* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: hidden; height: 100%; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar { flex-shrink: 0; }
.container { flex: 1 0 auto; }
footer { flex-shrink: 0; }

.topbar {
  background: #DB2F08;
  color: #fff;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar a { color: #fff; text-decoration: none; margin-left: 16px; opacity: .85; }
.topbar a:hover { opacity: 1; }
.topbar .brand { font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; gap: 12px; font-size: 17px; }
.topbar .brand img { height: 44px; width: 44px; object-fit: contain; object-position: center; display: block; }

.nav-toggle { display: none; }
.hamburger {
  display: none;
  cursor: pointer;
  user-select: none;
}

.container { max-width: 1400px; margin: 0 auto; padding: 28px 20px; }

.card {
  background: #fff;
  border-radius: 0;
  padding: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  margin-bottom: 20px;
}

/* Ξεχωριστή "κάρτα-λίστα" για πίνακες/κάρτες ειδοποιήσεων - ΠΑΝΤΑ μηδενικό padding, σε
   desktop ΚΑΙ mobile, χωρίς καμία εξάρτηση/ακύρωση padding γονέα. Μπαίνει ΜΕΤΑ από μια
   κανονική .card (με τίτλο/υπότιτλο) ώστε να μοιάζουν οπτικά ένα section, αλλά είναι δύο
   ξεχωριστά κουτιά - έτσι το πλάτος της λίστας είναι πάντα 100%, καμία αμφισβήτηση.*/
.card-list {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  margin-bottom: 20px;
  margin-top: -12px;
  padding: 0;
}

h1 { font-size: 22px; margin-bottom: 4px; }
h2 { font-size: 17px; margin-bottom: 14px; }
.subtitle { color: #666; font-size: 14px; margin-bottom: 20px; }

.table-wrap { overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 14px; }
th { color: #555; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:hover td { background: #fafbfc; }
.td-label { display: none; }
.mobile-cards { display: none; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 0; font-size: 12px; font-weight: 600; }
.badge-active { background: #fff4e0; color: #b26a00; }
.badge-returned { background: #e5f7ec; color: #147a3f; }
.badge-pending { background: #eef1f5; color: #555; }
.badge-sent { background: #e5f7ec; color: #147a3f; }
.badge-failed { background: #fde8e8; color: #c0392b; }
.badge-opted_out { background: #eee; color: #888; }
.badge-insufficient_credit { background: #fde8e8; color: #c0392b; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 0;
  border: none;
  background: #DB2F08;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #B32405; }
.btn-secondary { background: #e5e7eb; color: #222; }
.btn-secondary:hover { background: #d5d8dd; }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #9c2d21; }
.btn-sm { padding: 5px 10px; font-size: 13px; margin-right: 4px; }

form label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
input[type=text], input[type=tel], input[type=password], input[type=datetime-local], input[type=date], select {
  width: 100%; padding: 9px 11px; border: 1px solid #ddd; border-radius: 0; font-size: 14px;
  background: #fff; color: #1a1a1a;
}
select { cursor: pointer; }

.contact-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }
.contact-row input { flex: 1; }
.remove-contact { color: #c0392b; cursor: pointer; font-size: 13px; white-space: nowrap; }

.contact-block { border: 1px solid #eee; padding: 12px; margin-bottom: 10px; background: #fafbfc; }
.contact-row-top { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.contact-row-top input { flex: 1 1 200px; }
.contact-row-top select { flex: 1 1 190px; min-width: 190px; }
.contact-row-bottom { display: flex; gap: 10px; align-items: center; }
.contact-row-bottom .contact-country { flex: 0 0 190px; }
.contact-row-bottom input { flex: 1; }

.flash { padding: 10px 14px; border-radius: 0; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #e5f7ec; color: #147a3f; }
.flash-error { background: #fde8e8; color: #c0392b; }

.empty-state { text-align: center; padding: 40px 0; color: #888; }

.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions-cell form { display: inline-flex; margin: 0; }

/* Dropdown menu ενεργειών (χρησιμοποιεί το native <details>/<summary>, χωρίς JS) */
.action-menu { position: relative; display: inline-block; }
.action-menu summary {
  list-style: none;
  cursor: pointer;
  background: #e5e7eb;
  color: #222;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  display: inline-block;
  user-select: none;
}
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu summary::after { content: ' ▾'; }
.action-menu[open] summary { background: #d5d8dd; }
.action-menu[open] summary::after { content: ' ▴'; }
.action-menu-list {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
  z-index: 20;
  min-width: 170px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 4px;
}
.action-menu-list .btn,
.action-menu-list form { width: 100%; margin: 0; }
.action-menu-list form button { width: 100%; }

/* ============================================================
   Responsive - κινητά & tablets
   ============================================================ */
@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    padding: 14px 16px;
    position: relative;
  }
  .hamburger {
    display: block;
    width: 50px;
    height: 40px;
    position: relative;
    flex-shrink: 0;
  }
  .hamburger span,
  .hamburger span::before,
  .hamburger span::after {
    content: '';
    position: absolute;
    left: 4px;
    right: 4px;
    width: auto;
    height: 5px;
    background: #fff;
    border-radius: 3px;
  }
  .hamburger span { top: 50%; margin-top: -2.5px; }
  .hamburger span::before { top: -14px; }
  .hamburger span::after { top: 14px; }
  .topbar-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 2px;
    margin-top: 14px;
    order: 3;
  }
  .nav-toggle:checked ~ .topbar-nav { display: flex; }
  .topbar-nav a {
    margin-left: 0;
    padding: 14px 4px;
    border-top: 1px solid rgba(255,255,255,.15);
    font-size: 17px;
  }

  .container { padding: 16px 12px; }
  .card { padding: 16px; }

  body { font-size: 17px; }
  h1 { font-size: 22px; }
  h2 { font-size: 19px; }
  .subtitle { font-size: 16px; }
  label { font-size: 16px !important; }
  .badge { font-size: 14px; padding: 5px 11px; }
  input[type=text], input[type=tel], input[type=password], input[type=datetime-local], input[type=date], input[type=time], select {
    font-size: 17px; padding: 12px 13px;
  }
  .btn { font-size: 17px; padding: 12px 16px; }
  .btn-sm { font-size: 16px; padding: 10px 13px; }

  /* Πίνακες: μετατροπή σε στοιβαγμένες "κάρτες" - καμία οριζόντια κύλιση.
     ΣΗΜΑΝΤΙΚΟ: χρησιμοποιούμε πραγματικά <span class="td-label"> στοιχεία (όχι CSS
     ::before + flex/space-between) γιατί αυτό το trick είχε προβλήματα αξιοπιστίας σε
     στενά πλάτη σε μερικά browsers (η ετικέτα/τιμή "χάνονταν"). Το label πάνω, η τιμή
     από κάτω - ίδιο μοτίβο με τις φόρμες, πολύ πιο σταθερό. */
  .table-wrap { overflow-x: visible; }
  table { min-width: 0; width: 100%; }
  table, tr { display: block; width: 100%; }
  table > tr:first-child { display: none; }
  tr:has(th) { display: none; }
  tr {
    display: block;
    border: 1px solid #eee;
    margin-bottom: 12px;
    padding: 4px 0;
  }
  tr:hover td { background: transparent; }
  td {
    display: block;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #f2f2f2;
    font-size: 16px;
  }
  td:empty { display: none; }
  td:last-child { border-bottom: none; }
  .td-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #888;
    margin-bottom: 3px;
  }
  .td-value { display: block; }
  td.no-label { text-align: right; }

  /* Φόρμες: στοίβαξη πεδίων που ήταν δίπλα-δίπλα (contact rows ΚΑΙ η γραμμή
     ημερομηνίας/ώρας αποστολής, που είχε δικό της inline flex χωρίς αυτή τη ρύθμιση) */
  .contact-row-top, .contact-row-bottom {
    flex-direction: column;
    align-items: stretch;
  }
  .date-time-row { flex-wrap: wrap; }
  .date-time-row input[type=date] { flex: 1 1 100%; }
  .date-time-row select { flex: 1 1 calc(50% - 5px); }
  .contact-row-bottom .contact-country { flex: 1 1 auto; }

  /* Κουμπιά ενεργειών: πλέον μέσα σε flex td, γεμίζουν το διαθέσιμο πλάτος */
  td .btn-sm { width: auto; margin: 0; }
  .actions-cell { justify-content: flex-end; }

  .btn { width: 100%; text-align: center; }
  form .btn { margin-top: 4px; }

  /* ============================================================
     Νέο card design (μόνο για τις σελίδες που το χρησιμοποιούν):
     κόκκινη κεφαλίδα με βασικά στοιχεία + toggle "+", γκρι
     αναδιπλούμενο σώμα με λεπτομέρειες. Βασισμένο σε <details>,
     καμία JavaScript.
     ============================================================ */
  .desktop-table { display: none; }
  .mobile-cards { display: block; }

  .notif-card {
    border: 1px solid #eee;
    margin-bottom: 14px;
    background: #fff;
  }
  .notif-card > summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    list-style: none;
    cursor: pointer;
    background: #DB2F08;
    color: #fff;
    padding: 14px 16px;
  }
  .notif-card > summary::-webkit-details-marker { display: none; }
  .notif-header-fields { display: flex; flex-direction: column; gap: 4px; font-size: 15px; line-height: 1.4; }
  .notif-header-fields b { font-weight: 600; }

  .notif-toggle-icon { width: 24px; height: 24px; position: relative; flex-shrink: 0; margin-top: 2px; transition: transform .15s; }
  .notif-toggle-icon::before, .notif-toggle-icon::after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 2px;
  }
  .notif-toggle-icon::before { top: 50%; left: 0; width: 100%; height: 3px; margin-top: -1.5px; }
  .notif-toggle-icon::after { left: 50%; top: 0; height: 100%; width: 3px; margin-left: -1.5px; }
  .notif-card[open] .notif-toggle-icon { transform: rotate(45deg); }

  .notif-body {
    background: #eee;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
  }
  .notif-card-white .notif-body {
    background: #fff;
    border: 1px solid #000;
  }
  .notif-body-fields { display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.4; flex: 1; }
  .notif-badge {
    flex-shrink: 0;
    text-align: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
  }
  .notif-delete-link {
    background: none;
    border: none;
    color: #c0392b;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    padding: 6px 0;
    align-self: flex-start;
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 20px; }
  td { font-size: 15px; padding: 10px 10px; }
  .td-label { font-size: 11px; }
}
