:root {
  --ink: #0f1830;
  --panel: #17223d;
  --panel-2: #1e2c4d;
  --line: #2b3b60;
  --text: #eef2fa;
  --muted: #9aa8c7;
  --amber: #ffb547;
  --amber-ink: #2a1c00;
  --ok: #5fd4a0;
  --bad: #ff7a7a;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; background: var(--ink); color: var(--text); }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 650; }
h3 { font-size: 1.08rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--amber); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

.wrap { max-width: 640px; margin: 0 auto; padding: 20px 18px 48px; }
.wrap-wide { max-width: 1040px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 0 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(255,181,71,.18); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px;
}
textarea { min-height: 130px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px;
}

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border: 1px solid transparent; border-radius: 999px;
  padding: 12px 20px; background: var(--amber); color: var(--amber-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
button:disabled { opacity: .55; cursor: wait; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-small { padding: 7px 14px; font-size: 0.88rem; }
.btn-ok { background: var(--ok); color: #05261a; }
.btn-bad { background: transparent; color: var(--bad); border-color: rgba(255,122,122,.45); }
.btn-block { width: 100%; }

.tabs { display: flex; gap: 6px; background: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); padding: 9px 12px; }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--text); }

.msg { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.92rem; }
.msg-bad { background: rgba(255,122,122,.12); color: #ffc2c2; }
.msg-ok { background: rgba(95,212,160,.12); color: #bff0d8; }
.hidden { display: none !important; }

/* ---------- Broadcast log (news feed) ---------- */
.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed::before {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line);
}
.feed li { position: relative; padding: 0 0 26px 30px; }
.feed li::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--ink); border: 2px solid var(--line);
}
.feed li.latest::before { background: var(--amber); border-color: var(--amber); animation: onair 2.4s ease-out 1; }
@keyframes onair {
  0% { box-shadow: 0 0 0 0 rgba(255,181,71,.6); }
  100% { box-shadow: 0 0 0 16px rgba(255,181,71,0); }
}
.feed time { display: block; font-size: 0.84rem; color: var(--muted); margin-bottom: 4px; }
.feed h3 { margin-bottom: 6px; }
.feed .body { white-space: pre-wrap; overflow-wrap: anywhere; color: #d7deee; }

.status-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.expiry { font-family: var(--font-head); font-size: 1.25rem; font-weight: 700; }
.expiry.soon { color: var(--amber); }
.expiry.past { color: var(--bad); }

/* ---------- Admin table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 820px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td input[type="date"] { padding: 7px 9px; min-width: 140px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.pill-pending { background: rgba(255,181,71,.15); color: var(--amber); }
.pill-approved { background: rgba(95,212,160,.15); color: var(--ok); }
.pill-blocked { background: rgba(255,122,122,.15); color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.stat b { display: block; font-family: var(--font-head); font-size: 1.6rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 999px;
  font-weight: 600; z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .feed li.latest::before { animation: none; }
}

/* Show / hide password */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 84px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 6px 12px; font-size: 0.85rem;
}

/* Install card */
.install-card {
  background: linear-gradient(160deg, #1f2c52 0%, var(--panel) 70%);
  border: 1px solid rgba(255,181,71,.45); border-radius: var(--radius-lg);
  padding: 22px; display: grid; gap: 16px;
}
.install-head { display: flex; gap: 14px; align-items: center; }
.install-head img { border-radius: 14px; flex-shrink: 0; }
.btn-big { padding: 16px 20px; font-size: 1.1rem; }
.ios-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ios-steps li { display: flex; gap: 12px; align-items: center; }
.ios-ico {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px;
  display: grid; place-items: center; background: var(--ink); border: 1px solid var(--line); color: var(--amber);
}
.ios-hint {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--amber); color: var(--amber-ink); font-weight: 700;
  padding: 10px 16px; border-radius: 999px; z-index: 20; white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.ios-hint-arrow { display: inline-block; animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .ios-hint-arrow { animation: none; } }

/* iPhone install guide overlay */
.ios-overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(6,10,24,.82);
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 18px calc(110px + env(safe-area-inset-bottom, 0px));
}
.ios-sheet {
  background: var(--panel); border: 1px solid rgba(255,181,71,.45);
  border-radius: var(--radius-lg); padding: 22px; max-width: 480px; width: 100%; margin: 0 auto;
}
.ios-arrow {
  position: fixed; right: 14px; bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: flex-end; gap: 4px;
  color: var(--amber); font-weight: 700; font-size: 1.05rem;
  animation: point 1.1s ease-in-out infinite;
}
.ios-arrow span { margin-bottom: 52px; }
@keyframes point { 50% { transform: translate(5px, 5px); } }
@media (prefers-reduced-motion: reduce) { .ios-arrow { animation: none; } }

/* Steps to unblock notifications */
.fix-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; }
.fix-steps li::marker { color: var(--amber); font-weight: 700; }

/* Notification switch */
.notify-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.notify-on { padding-top: 16px; padding-bottom: 16px; }
.notify-on #notifyTitle { color: var(--ok); font-size: 1.05rem; }
.notify-on #notifyDesc { font-size: 0.9rem; }

/* Arrow positions for each iPhone browser */
.ios-overlay.arrow-top {
  padding-top: calc(120px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
.ios-arrow.top-right {
  bottom: auto; top: calc(6px + env(safe-area-inset-top, 0px));
  align-items: flex-start;
}
.ios-arrow.top-right svg { transform: rotate(-90deg); }
.ios-arrow.top-right span { margin: 52px 0 0; }
.ios-arrow.bottom-center { right: auto; left: calc(50% - 60px); }
.ios-arrow.bottom-center svg { transform: rotate(45deg); }

/* Welcome / install-first screen */
.welcome { text-align: center; display: grid; gap: 14px; padding-top: 8px; }
.welcome-logo { width: 132px; height: 132px; border-radius: 30px; margin: 0 auto 6px; box-shadow: 0 10px 40px rgba(2,143,235,.25); }
.welcome h1 { font-size: 2rem; }
.welcome-lead { color: var(--muted); font-size: 1.05rem; max-width: 30ch; margin: 0 auto 6px; }
.welcome .install-card { text-align: left; }
.welcome .install-head { display: none; }
.link-btn {
  background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 0.95rem;
  text-decoration: underline; text-underline-offset: 3px; padding: 10px; margin: 0 auto;
}

/* WhatsApp number with country code */
.phone-row { display: flex; gap: 8px; }
.phone-row select { width: auto; flex-shrink: 0; padding-right: 8px; }
.phone-row input { flex: 1; min-width: 0; }
.pin-input { letter-spacing: 0.5em; font-size: 1.25rem; font-weight: 700; }

/* Small menu at the bottom right of the home page (holds Log out) */
#viewHome { padding-bottom: 80px; }
.corner-menu {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.corner-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
}
.corner-btn span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--muted); }
.corner-pop {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.corner-pop button {
  background: transparent; color: var(--bad); border-radius: 8px; padding: 10px 18px; font-weight: 700; white-space: nowrap;
}

/* Support & official channels card */
.contact-card { padding: 16px 0 14px; }
.contact-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 18px; margin-bottom: 12px; }
.contact-head h2 { font-size: 1.05rem; white-space: nowrap; }
.contact-row {
  display: flex; gap: 6px; overflow-x: auto; padding: 0 14px 4px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.contact-row::-webkit-scrollbar { display: none; }
.contact-chip {
  flex: 0 0 auto; width: 70px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text); text-decoration: none; font-size: 0.78rem; font-weight: 600; scroll-snap-align: start;
  padding: 4px 0; border-radius: var(--radius-sm);
}
.contact-ico {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); border: 1px solid var(--line); color: var(--amber);
}
.contact-chip:active .contact-ico { background: var(--panel-2); }
.contact-note { margin: 10px 18px 0; font-size: 0.82rem; color: var(--muted); }
.contact-note b { color: var(--text); font-weight: 600; }

/* Images in posts */
.post-img {
  display: block; width: 100%; max-height: 420px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--line); margin: 6px 0 8px; background: var(--ink);
}
.img-preview { margin-top: 10px; display: grid; gap: 8px; justify-items: start; }
.img-preview img { max-width: 100%; max-height: 240px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
input[type="file"] { padding: 10px; }

/* ---------- Live chat ---------- */
.chat-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 0.7rem; font-weight: 700; line-height: 18px; text-align: center;
}
.contact-ico { position: relative; }
.chat-chip { background: none; border: 0; font: inherit; cursor: pointer; }
.chat-chip .contact-ico { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }
.chat-chip .chat-badge { position: absolute; top: -4px; right: -6px; }
button .chat-badge { display: inline-block; margin-left: 6px; }

.chat-view {
  display: flex; flex-direction: column;
  height: calc(100vh - 120px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  height: calc(100dvh - 120px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
.chat-view.hidden { display: none; }
.chat-top { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.chat-top img { border-radius: 12px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 2px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.bubble { max-width: 82%; padding: 10px 13px; border-radius: 16px; }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { display: block; font-size: 0.72rem; margin-top: 4px; opacity: .7; text-align: right; }
.bubble.me { align-self: flex-end; background: var(--amber); color: var(--amber-ink); border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--line); }
.chat-input textarea { min-height: 46px; max-height: 140px; resize: none; padding: 12px 14px; border-radius: 22px; }
.chat-input button { flex-shrink: 0; height: 46px; }

/* Admin chat inbox */
.chat-admin { display: grid; grid-template-columns: 320px 1fr; gap: 14px; min-height: 520px; }
.conv-list { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-y: auto; max-height: 70vh; background: var(--panel); }
.conv-item {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left;
  background: transparent; color: var(--text); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 14px; font-weight: 400;
}
.conv-item.active { background: var(--panel-2); }
.conv-item b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .last { grid-column: 1 / -1; color: var(--muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item time { color: var(--muted); font-size: 0.78rem; }
.conv-pane { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); padding: 14px; display: flex; flex-direction: column; max-height: 70vh; }
.conv-pane .chat-msgs { min-height: 300px; }
.conv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.conv-head > div { flex: 1; min-width: 160px; }
.tab-badge { margin-left: 6px; }
@media (max-width: 760px) {
  .chat-admin { grid-template-columns: 1fr; }
  .chat-admin.open .conv-list { display: none; }
  .chat-admin:not(.open) .conv-pane { display: none; }
}
@media (min-width: 761px) { #convBack { display: none; } }

/* Admin "My account" panel */
.account-panel { height: auto; max-height: 90vh; overflow-y: auto; }
@media (min-width: 640px) { #accountSheet { align-items: center; } #accountSheet .account-panel { border-radius: var(--radius-lg); border-bottom: 1px solid var(--line); } }
.corner-pop { display: grid; gap: 2px; }
.corner-pop button.menu-ok { color: var(--text); }

/* Country code button + searchable picker (works on older iPhones too) */
.country-btn {
  flex-shrink: 0; background: var(--ink); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px;
  font-weight: 600; display: inline-flex; align-items: center;
}
.country-btn > span + span { margin-left: 6px; color: var(--muted); }
.country-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 40;
  background: rgba(6,10,24,.8);
  display: flex; align-items: flex-end; justify-content: center;
}
.country-sheet.hidden { display: none !important; }
.country-panel {
  width: 100%; max-width: 560px; height: 80vh; max-height: 640px;
  background: var(--panel); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 18px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
}
.country-panel > * + * { margin-top: 12px; }
.country-head { display: flex; justify-content: space-between; align-items: center; }
.country-head h2 { margin-right: 12px; }
.country-list {
  list-style: none; margin: 12px 0 0; padding: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 0;
}
.country-list li { list-style: none; margin: 0; padding: 0; }
.country-item {
  width: 100%; display: flex; align-items: center; text-align: left;
  background: transparent; color: var(--text); border: 0; border-radius: var(--radius-sm);
  padding: 12px 10px; font-weight: 500; justify-content: flex-start;
  -webkit-appearance: none; appearance: none;
}
.country-item:active, .country-item:focus-visible, .country-item.selected { background: var(--panel-2); }
.country-item.selected .country-dial::after { content: " ✓"; color: var(--ok); }
.country-flag { font-size: 1.4rem; line-height: 1; margin-right: 12px; }
.country-name { flex: 1 1 auto; }
.country-dial { color: var(--muted); }
#countrySearch { -webkit-appearance: none; appearance: none; }

/* ---------- Admin layout polish ---------- */
.admin-top { flex-wrap: nowrap; }
.admin-top .brand { white-space: nowrap; min-width: 0; }
.top-actions { display: flex; gap: 8px; flex-shrink: 0; }
.top-actions button { white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { white-space: nowrap; }

@media (max-width: 760px) {
  .wrap-wide { padding-left: 14px; padding-right: 14px; }
  .admin-top .brand { font-size: 1rem; }
  .top-actions button { padding: 7px 12px; font-size: 0.82rem; }

  /* Members table becomes one card per client */
  .table-wrap { overflow: visible; border: 0; border-radius: 0; }
  .table-wrap table, .table-wrap tbody { display: block; min-width: 0; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    display: grid; grid-template-columns: 90px 1fr; column-gap: 10px; row-gap: 8px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 14px 16px; margin-bottom: 12px;
  }
  .table-wrap td { display: contents; border: 0; padding: 0; }
  .table-wrap td[data-label]::before {
    content: attr(data-label); color: var(--muted); font-size: 0.82rem; align-self: center;
  }
  .table-wrap td > * { min-width: 0; overflow-wrap: anywhere; align-self: center; }
  .table-wrap td.cell-name, .table-wrap td.cell-actions { display: block; grid-column: 1 / -1; }
  .table-wrap td.cell-name { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
  .table-wrap td.cell-actions { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
  .table-wrap td.cell-actions .row-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .table-wrap td.cell-actions .row-actions button { width: 100%; padding: 9px 6px; }
  .table-wrap td input[type="date"] { min-width: 0; width: 100%; min-height: 40px; }
}
@media (max-width: 760px) {
  .table-wrap td .pill { justify-self: start; }
  .table-wrap td.cell-actions .row-actions .btn-ok { grid-column: 1 / -1; }
  .tabs button { white-space: nowrap; font-size: 0.92rem; padding: 9px 8px; }
  .stat b { font-size: 1.35rem; }
}

/* Refresh button in the app header */
.refresh-btn {
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
}
.refresh-btn.spinning svg { animation: spin360 .8s linear infinite; }
@keyframes spin360 { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .refresh-btn.spinning svg { animation-duration: 2.5s; } }

/* Client actions: one compact segmented bar */
.row-actions {
  display: inline-flex; flex-wrap: nowrap; gap: 0;
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--ink);
}
.row-actions button {
  border: 0; border-radius: 0; background: transparent; color: var(--text);
  padding: 7px 13px; font-size: 0.82rem; font-weight: 700; white-space: nowrap;
  border-left: 1px solid var(--line);
}
.row-actions button:first-child { border-left: 0; }
.row-actions button:hover, .row-actions button:focus-visible { background: var(--panel-2); }
.row-actions .btn-bad { color: var(--bad); }
.row-actions .btn-ok { color: var(--ok); }
td.cell-actions { white-space: nowrap; }

@media (max-width: 760px) {
  .table-wrap td.cell-actions .row-actions { display: flex; width: 100%; grid-template-columns: none; gap: 0; }
  .table-wrap td.cell-actions .row-actions button { flex: 1 1 0; width: auto; padding: 10px 4px; font-size: 0.8rem; }
  .table-wrap td.cell-actions .row-actions .btn-ok { grid-column: auto; }
}
@media (min-width: 761px) {
  .wrap-wide { max-width: 1260px; }
  .table-wrap td.cell-name { white-space: nowrap; }
  .table-wrap td input[type="date"] { min-width: 132px; }
  .row-actions button { padding: 7px 11px; }
}
@media (min-width: 761px) {
  .table-wrap th, .table-wrap td { padding: 12px 10px; }
  .row-actions button { padding: 7px 9px; font-size: 0.8rem; }
}

/* ---------- Welcome card with the client's name ---------- */
.hero-card {
  position: relative; overflow: hidden; display: block;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(2,143,235,.22) 0%, rgba(2,143,235,0) 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(251,218,60,.14) 0%, rgba(251,218,60,0) 60%),
    var(--panel);
  border-color: rgba(251,218,60,.35);
}
.hero-top { display: flex; align-items: center; }
.avatar {
  width: 58px; height: 58px; flex-shrink: 0; border-radius: 50%; margin-right: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; color: #0f1830;
  background: linear-gradient(135deg, #028feb 0%, #fbda3c 100%);
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px rgba(251,218,60,.45), 0 8px 24px rgba(2,143,235,.35);
}
.hero-text { min-width: 0; }
.hero-hello { margin: 0; color: var(--muted); font-size: 0.95rem; }
.hero-name {
  margin: 2px 0 0; font-family: var(--font-head); font-weight: 700; font-size: 1.7rem; line-height: 1.15;
  overflow-wrap: anywhere;
  color: #fbda3c;
  background: linear-gradient(90deg, #4fb6ff 0%, #ffffff 45%, #fbda3c 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.2s ease-in-out 1; }
@keyframes wave { 0%,60%,100% { transform: rotate(0); } 10%,30% { transform: rotate(16deg); } 20%,40% { transform: rotate(-8deg); } }
.hero-bottom {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.hero-bottom > * + * { margin-left: 10px; }
.status-line { display: flex; align-items: center; margin: 6px 0; }
.status-line .expiry { font-size: 1.05rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--ok); box-shadow: 0 0 0 4px rgba(95,212,160,.18); }
.status-line[data-state="soon"] .status-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(255,181,71,.2); }
.status-line[data-state="past"] .status-dot { background: var(--bad); box-shadow: 0 0 0 4px rgba(255,122,122,.2); }
@media (prefers-reduced-motion: reduce) { .wave { animation: none; } }
.hero-bottom { display: block; }
.hero-bottom > * + * { margin-left: 0; }
.hero-bottom .btn { margin-top: 10px; }
.contact-chip.chat-chip { font-size: 0.78rem; font-weight: 600; line-height: 1.3; padding: 4px 0; white-space: nowrap; color: var(--text); }
.top-actions a.btn { white-space: nowrap; }
/* iPhone date boxes: stay inside the card */
input[type="date"] { -webkit-appearance: none; appearance: none; max-width: 100%; box-sizing: border-box; display: block; text-align: left; min-height: 42px; }
.table-wrap td input[type="date"] { width: 100%; }
@media (max-width: 380px) { .top-actions button, .top-actions a.btn { padding: 7px 10px; } }
.back-to-app {
  display: inline-flex; align-items: center; margin: -8px 0 14px; padding: 6px 2px;
  color: var(--amber); font-weight: 700; font-size: 0.92rem; text-decoration: none;
}
.back-to-app:hover, .back-to-app:focus-visible { text-decoration: underline; }

/* WhatsApp verification code on the waiting screen */
.verify-box { border: 1px dashed rgba(251,218,60,.5); border-radius: var(--radius-sm); padding: 14px; background: rgba(251,218,60,.06); }
.verify-box > * + * { margin-top: 8px; }
.verify-code {
  font-family: var(--font-head); font-weight: 700; font-size: 1.8rem; letter-spacing: 0.12em; text-align: center;
  color: var(--amber); padding: 6px 0;
}
.verify-tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px; border: 1px dashed rgba(251,218,60,.6); color: var(--amber); font-weight: 700; font-size: 0.78rem; letter-spacing: .05em; }
.conv-tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* Slim "notifications are off" banner */
.push-banner {
  display: flex; align-items: flex-start; margin: -8px 0 14px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(255,181,71,.12); border: 1px solid rgba(255,181,71,.35);
  font-size: 0.84rem; line-height: 1.45; color: var(--text);
}
.push-banner.hidden { display: none !important; }
.push-banner-text { flex: 1 1 auto; }
.push-banner-close {
  flex-shrink: 0; margin-left: 8px; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--muted); border: 0; font-size: 1.2rem; line-height: 1;
}
