/* shared dashboard / event / login styles. depends on landing.css for tokens */
:root { --danger:#B91C1C; --good:#15803D; --warn:#A16207; }

.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 9px; min-height: 36px; }
.btn.block { width: 100%; }
.btn.danger { background: white; color: var(--danger); border: 1px solid #FCA5A5; }
.btn.danger:hover { background: #FEF2F2; }
/* keep buttons easy to tap on phone */
.btn { min-height: 44px; }
.btn.small { min-height: 36px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.full { grid-column: 1 / -1; }

/* ---- auth pages ---- */
.auth-body { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-shell { width: 100%; max-width: 420px; display: grid; place-items: center; }
.auth-card {
  width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.3px; }
.auth-form { display: grid; gap: 10px; margin-top: 14px; }
.auth-form label { font-size: 13px; color: var(--muted); font-weight: 600; }
.auth-form input {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px;
  font-size: 16px; background: white;
}
.auth-form input:focus { outline: 2px solid var(--sky-300); outline-offset: 1px; }
.auth-form .msg { min-height: 1em; font-size: 13px; color: var(--good); margin: 0; }
.auth-form .msg.error { color: var(--danger); }

.google-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line); background: white; border-radius: 10px;
  font-weight: 600; color: #1F2937; font-size: 14px;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.google-btn:hover { border-color: var(--sky-400); background: var(--sky-50); }

.divider { display: flex; align-items: center; gap: 12px; margin: 16px 0 4px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---- main page wrap ---- */
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 18px 16px 28px; }
@media (min-width: 720px) { .page-wrap { padding: 24px; } }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.5px; }
@media (min-width: 720px) { .page-head h1 { font-size: 26px; } }

/* ---- panels ---- */
.panel {
  background: white; border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 18px 16px;
  box-shadow: 0 8px 22px -18px rgba(2,132,199,.4);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: -2px 0 12px;
}
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: .2px; color: var(--sky-700); text-transform: uppercase; font-weight: 800; }

/* ---- forms ---- */
.grid-form { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.grid-form .field { display: grid; gap: 6px; }
.grid-form .field.full { grid-column: 1 / -1; }
.grid-form .field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.grid-form input, .grid-form select, .grid-form textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font-size: 16px; /* prevents iOS auto-zoom */
  background: white; font-family: inherit;
  min-height: 44px; /* tap target */
}
.grid-form input[type=date], .grid-form input[type=time] {
  appearance: none; -webkit-appearance: none;
  background-color: white;
  /* date/time pickers expose icon on right; keep readable on iOS */
}
.grid-form textarea { min-height: 80px; }
.grid-form input:focus, .grid-form textarea:focus { outline: 2px solid var(--sky-300); outline-offset: 1px; }
.grid-form .row { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 640px) { .grid-form { grid-template-columns: 1fr; } }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input[type=text], .inline-form input:not([type=file]) {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 16px;
  flex: 1; min-width: 140px; background: white; min-height: 40px;
}
.inline-form input[type=file] {
  font-size: 13px; flex: 1 1 100%;
}
@media (min-width: 600px) { .inline-form input[type=file] { flex: 1 1 220px; } }

.msg { font-size: 13px; color: var(--good); }
.msg.error { color: var(--danger); }

/* ---- segmented control ---- */
.seg.horizontal {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  background: var(--sky-50); padding: 5px; border-radius: 10px;
}
.seg.horizontal input {
  /* visually-hidden but focusable */
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.seg.horizontal label {
  text-align: center; padding: 11px 8px; border-radius: 7px;
  cursor: pointer; user-select: none; font-weight: 600; font-size: 13px; color: var(--sky-700);
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg.horizontal input:checked + label { background: white; box-shadow: 0 2px 6px rgba(2,132,199,.2); color: var(--sky-900); }
.seg.horizontal input:focus-visible + label { outline: 2px solid var(--sky-400); outline-offset: 2px; }

/* ---- events grid (dashboard) ---- */
.events-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.event-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
  display: grid; gap: 8px;
  text-decoration: none; color: var(--ink);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.event-card:hover { border-color: var(--sky-300); transform: translateY(-1px); box-shadow: 0 12px 26px -18px rgba(2,132,199,.4); }
.event-card h3 { margin: 0; font-size: 17px; }
.event-card .meta { color: var(--muted); font-size: 13px; }
.event-card .stats-row { display: flex; gap: 12px; margin-top: 4px; font-size: 13px; }
.event-card .stats-row span { background: var(--sky-50); padding: 4px 10px; border-radius: 999px; color: var(--sky-700); font-weight: 600; }

.empty-state {
  background: white; border: 1px dashed var(--sky-300);
  border-radius: 16px; padding: 36px 24px; text-align: center;
}
.empty-state p { margin: 0 0 14px; color: var(--muted); }

/* ---- modal ---- */
.modal {
  position: fixed; inset: 0; background: rgba(12, 74, 110, .42);
  display: grid; place-items: center; z-index: 50; padding: 16px;
  animation: modal-fade .15s ease-out;
}
.modal[hidden] { display: none; }     /* override .modal{display:grid} when hidden */
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  background: white; border-radius: 16px; padding: 24px 22px 20px;
  width: 100%; max-width: 520px;
  max-height: calc(100dvh - 32px); overflow: auto;
  box-shadow: 0 25px 60px -20px rgba(2,132,199,.45);
}
.modal-card h2 { margin: 0 0 16px; font-size: 20px; padding-right: 28px; }
.modal-close {
  position: absolute; top: 8px; right: 10px;
  width: 36px; height: 36px;
  background: transparent; border: 0; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--muted);
  border-radius: 8px;
}
.modal-close:hover { background: var(--sky-50); color: var(--ink); }

/* ---- event editor ---- */
.event-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.event-head h1 { margin: 0; font-size: 22px; letter-spacing: -.4px; min-width: 0; word-break: break-word; }
@media (min-width: 720px) { .event-head h1 { font-size: 24px; } }

/* ---- tabs ---- */
.tabs {
  display: flex; gap: 6px; padding: 4px;
  background: white; border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  appearance: none; border: none; cursor: pointer;
  padding: 11px 12px; border-radius: 9px;
  background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, color .15s, box-shadow .15s;
  min-height: 44px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  background: var(--sky-50);
  color: var(--sky-700);
  box-shadow: 0 2px 6px rgba(2,132,199,.12);
}
.tab-icon { font-size: 16px; line-height: 1; }
.pane[hidden] { display: none; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- send-mode cards ---- */
.seg-cards {
  display: grid; gap: 10px;
  grid-template-columns: 1fr 1fr;
}
.seg-cards.seg-cards-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 880px) { .seg-cards.seg-cards-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .seg-cards, .seg-cards.seg-cards-3 { grid-template-columns: 1fr; } }
.seg-card.seg-card-disabled { opacity: .55; cursor: not-allowed; pointer-events: auto; }
.seg-card.seg-card-disabled:hover { border-color: transparent; }
.coming-soon {
  display: inline-block;
  background: #FEF3C7; color: #A16207;
  font: 700 10px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px;
  margin-left: 6px; vertical-align: middle;
}
.seg-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 14px 14px 14px;
  background: var(--sky-50);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.seg-card:hover { border-color: var(--sky-300); }
.seg-card input[type=radio] {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.seg-card-body { flex: 1; }
.seg-card-title {
  font-weight: 700; color: var(--ink); margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.seg-card-title::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--sky-300); background: white;
  flex-shrink: 0;
}
.seg-card input:checked ~ .seg-card-body .seg-card-title::before {
  border-color: var(--sky-500); background: var(--sky-500);
  box-shadow: inset 0 0 0 3px white;
}
.seg-card input:checked ~ .seg-card-body { color: var(--ink); }
.seg-card:has(input:checked) {
  border-color: var(--sky-500);
  background: white;
  box-shadow: 0 6px 18px -10px rgba(2,132,199,.45);
}
.seg-card-desc { color: var(--muted); font-size: 13px; line-height: 1.4; }
.seg-card input:focus-visible ~ .seg-card-body .seg-card-title::before {
  outline: 2px solid var(--sky-400); outline-offset: 2px;
}

/* ---- draggable chip tray ---- */
.chip-tray {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px;
  background: var(--sky-50); border-radius: 10px;
  margin-bottom: 8px;
}
.chip {
  appearance: none; cursor: grab;
  background: white;
  color: var(--sky-700);
  border: 1px solid var(--sky-200);
  border-radius: 999px;
  padding: 6px 12px;
  font: 600 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  transition: background .15s, transform .1s, box-shadow .15s;
  user-select: none;
  -webkit-user-select: none;
}
.chip:hover { background: var(--sky-50); border-color: var(--sky-400); }
.chip:active { cursor: grabbing; transform: scale(.96); }
.chip.dragging { opacity: .5; }
#sms-template {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}
#sms-template.drop-target {
  border-color: var(--sky-500);
  background: #EBF7FF;
  box-shadow: 0 0 0 3px rgba(14,165,233,.18);
}
.starter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* ---- footer ---- */
.app-footer {
  margin-top: 32px;
  padding: 18px 24px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
}
.app-footer a { color: var(--sky-700); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.app-footer .sep { color: var(--line); }

.event-grid {
  display: grid; gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
}
@media (max-width: 900px) { .event-grid { grid-template-columns: 1fr; } }

/* Invite sub-tabs (Upload / Templates) */
.invite-tabs {
  display: flex; gap: 4px;
  background: var(--sky-50);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.invite-tab {
  flex: 1;
  appearance: none; border: 0; cursor: pointer;
  padding: 9px 12px; border-radius: 7px;
  background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 13px;
  min-height: 38px;
}
.invite-tab[aria-selected="true"] {
  background: white;
  color: var(--sky-700);
  box-shadow: 0 1px 4px rgba(2,132,199,.15);
}
.invite-pane[hidden] { display: none; }

/* Template grid */
.template-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.template-card {
  position: relative;
  cursor: pointer;
  background: white;
  border: 2px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s, transform .1s;
}
.template-card:hover { border-color: var(--sky-300); transform: translateY(-2px); }
.template-card.selected {
  border-color: var(--sky-500);
  box-shadow: 0 6px 18px -8px rgba(2,132,199,.5);
}
.template-card .thumb {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  background: #f0f0f0;
}
.template-card .meta {
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 1px;
}
.template-card .name { font-weight: 600; font-size: 13px; color: var(--ink); }
.template-card .cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.template-card.selected::after {
  content: '✓';
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px;
  background: var(--sky-500); color: white;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(2,132,199,.4);
}

.image-zone {
  display: block;
  border: 2px dashed var(--sky-300);
  border-radius: 14px;
  background: var(--sky-50);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  outline: none;
}
.image-zone:hover, .image-zone:focus-visible { border-color: var(--sky-500); background: #EBF7FF; }
.image-zone.drag { border-color: var(--sky-600); background: #DBEFFB; transform: scale(1.005); }
.image-preview {
  width: 100%;
  min-height: 180px;
  display: grid; place-items: center;
  border-radius: 10px;
  overflow: hidden;
  background: white;
  pointer-events: none;
}
.image-preview img { width: 100%; height: 100%; max-height: 360px; object-fit: contain; }
.image-placeholder { color: var(--muted); font-size: 14px; line-height: 1.5; }
.image-placeholder strong { color: var(--sky-700); }
.image-zone #image-msg { display: block; margin-top: 8px; }

.add-row { margin-top: 4px; }

/* ---- stats ---- */
.stats {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin-bottom: 14px;
}
.stat { background: var(--sky-50); border-radius: 10px; padding: 10px 12px; }
.stat .label { font-size: 11px; color: var(--sky-700); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 2px; color: var(--ink); }
.stat.yes .value { color: var(--good); }
.stat.no .value { color: var(--danger); }
.stat.pending .value { color: var(--warn); }

/* ---- contacts table ---- */
.table-wrap { overflow-x: auto; }
.contacts { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.contacts th, .contacts td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.contacts thead th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.contacts tbody tr:hover { background: var(--sky-50); }
.contacts .name { font-weight: 600; }
.contacts .meta { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.yes { background: #DCFCE7; color: var(--good); }
.pill.no  { background: #FEE2E2; color: var(--danger); }
.pill.pending { background: #FEF3C7; color: var(--warn); }
.pill.sent { background: var(--sky-100); color: var(--sky-700); }
.pill.error { background: #FEE2E2; color: var(--danger); }

.link-cell { display: flex; align-items: center; gap: 4px; }
.link-cell input { flex: 1; min-width: 0; max-width: 220px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 11px; background: var(--sky-50); color: var(--ink); }
.send-block { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.send-block .send-btn { white-space: nowrap; }
.send-caption { font-size: 11px; line-height: 1.2; }

@media (max-width: 720px) {
  .contacts thead { display: none; }
  .contacts, .contacts tbody, .contacts tr, .contacts td { display: block; width: 100%; }
  .contacts tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
  .contacts td { border: none; padding: 5px 4px; }
  .contacts td::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 600; font-size: 11px; }
}
