:root {
  --ink: #14221c;
  --muted: #66736d;
  --line: #dce4df;
  --paper: #f6f8f6;
  --white: #ffffff;
  --green: #26b66f;
  --green-dark: #128251;
  --green-soft: #e7f8ef;
  --navy: #10201a;
  --shadow: 0 16px 50px rgba(16, 32, 26, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); font-size: 16px; }
button, input, select, textarea { font: inherit; }
button, label[for="csvInput"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, label[for="csvInput"]:focus-visible { outline: 3px solid rgba(38,182,111,.3); outline-offset: 2px; }
.topbar { min-height: 70px; padding: 0 4vw; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.brand { color: var(--navy); text-decoration: none; font-size: 1.25rem; font-weight: 800; display: inline-flex; align-items: center; gap: 11px; letter-spacing: -.04em; }
.brand > span:last-child > span { color: var(--green-dark); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--navy); display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 8px; }
.brand-mark i { height: 2px; display: block; border-radius: 2px; background: #66dfa2; }
.brand-mark i:last-child { width: 60%; }
.top-actions, .selection-actions, .composer-foot, .modal-actions { display: flex; align-items: center; gap: 10px; }
.privacy-pill { font-size: .78rem; color: var(--muted); padding: 8px 12px; border-radius: 999px; background: #f0f4f1; }
.account-pill { font-size: .78rem; color: var(--muted); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.privacy-pill span { color: var(--green); font-size: .65rem; margin-right: 6px; }
.btn { border: 0; min-height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 700; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .15s, background .15s, opacity .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-quiet { color: var(--ink); background: var(--white); border: 1px solid var(--line); }
.btn-dark { color: white; background: var(--navy); }
.btn-primary { color: white; background: var(--green-dark); box-shadow: 0 6px 16px rgba(18,130,81,.18); }
.btn-primary:hover:not(:disabled) { background: #0d6f44; }
.btn-danger { color: white; background: #b42318; }
.btn-danger:hover:not(:disabled) { background: #8f1c13; }
.btn-wide { width: 100%; min-height: 48px; }
.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 44px 4vw 70px; }
.summary { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 8px; color: var(--green-dark); font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.summary h1 { margin: 0; max-width: 660px; font: 500 clamp(2rem, 4vw, 3.75rem)/1.02 Georgia, serif; letter-spacing: -.045em; }
.summary > div > p:last-child { color: var(--muted); max-width: 650px; margin: 14px 0 0; }
.stats { display: flex; gap: 8px; }
.stats div { min-width: 105px; padding: 15px 18px; background: var(--white); border: 1px solid var(--line); border-radius: 13px; }
.stats strong, .stats span { display: block; }
.stats strong { font-size: 1.5rem; letter-spacing: -.04em; }
.stats span { color: var(--muted); font-size: .75rem; margin-top: 2px; }
.workspace { min-height: 600px; display: grid; grid-template-columns: 230px minmax(0,1fr); background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.sidebar { background: #f2f6f3; padding: 26px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar-title { padding: 0 8px 15px; display: flex; justify-content: space-between; align-items: center; font-size: .72rem; font-weight: 800; letter-spacing: .14em; color: var(--muted); }
.icon-btn { border: 0; background: transparent; color: inherit; width: 34px; height: 34px; border-radius: 8px; font-size: 1.3rem; cursor: pointer; }
.icon-btn:hover { background: rgba(20,34,28,.07); }
#listNav { display: grid; gap: 4px; }
.nav-item { width: 100%; min-height: 43px; border: 0; border-radius: 9px; padding: 0 12px; background: transparent; display: flex; align-items: center; justify-content: space-between; color: #425049; cursor: pointer; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.7); }
.nav-item.active { color: var(--navy); background: var(--white); box-shadow: 0 4px 14px rgba(16,32,26,.08); font-weight: 750; }
.nav-item b { font-size: .74rem; padding: 3px 7px; min-width: 24px; text-align: center; color: var(--muted); background: #e7ede9; border-radius: 999px; }
.nav-item.active b { background: var(--green-soft); color: var(--green-dark); }
.sidebar-note { margin-top: auto; padding: 16px; background: var(--navy); color: white; border-radius: 13px; display: flex; gap: 10px; }
.sidebar-note > span { color: #5bdd9b; }
.sidebar-note p { margin: 0; font-size: .75rem; line-height: 1.45; color: #b9c8c1; }
.sidebar-note strong { color: white; display: block; margin-bottom: 4px; }
.content { min-width: 0; padding: 25px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.toolbar-actions { display: flex; gap: 10px; }
.search-wrap { height: 42px; width: min(420px, 100%); border: 1px solid var(--line); border-radius: 10px; display: flex; align-items: center; gap: 10px; padding: 0 13px; color: var(--muted); }
.search-wrap input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.section-heading h2, .composer h2, .queue-head h2, .modal h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.025em; }
.selection-actions > span { color: var(--muted); font-size: .82rem; }
.table-card { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { height: 42px; padding: 0 14px; text-align: left; color: var(--muted); background: #f6f8f6; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
td { height: 64px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: .88rem; vertical-align: middle; }
tbody tr:hover { background: #fbfcfb; }
.check-cell { width: 46px; text-align: center; }
input[type="checkbox"] { accent-color: var(--green-dark); width: 16px; height: 16px; }
.contact-name { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: var(--green-dark); background: var(--green-soft); font-size: .72rem; font-weight: 800; }
.phone, .date { color: var(--muted); }
.tag { display: inline-flex; padding: 5px 9px; color: #3b4b43; background: #edf2ef; border-radius: 999px; font-size: .75rem; }
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row-action { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 7px; border-radius: 7px; }
.row-action:hover { color: var(--ink); background: #edf2ef; }
.empty-state { display: grid; place-items: center; text-align: center; padding: 46px 20px; }
.empty-state[hidden] { display: none; }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: var(--green-soft); color: var(--green-dark); font-size: 1.4rem; transform: rotate(-4deg); }
.empty-state h3 { margin: 15px 0 6px; }
.empty-state p { color: var(--muted); max-width: 450px; margin: 0 0 18px; font-size: .9rem; line-height: 1.5; }
.composer { margin-top: 22px; padding: 22px; border: 1px solid var(--line); border-radius: 13px; background: #fcfdfc; }
.composer-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 14px; }
select { border: 1px solid var(--line); border-radius: 9px; padding: 9px 34px 9px 11px; background: white; color: var(--ink); }
textarea { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; line-height: 1.55; color: var(--ink); }
.media-picker { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: .72rem; flex-wrap: wrap; }
.media-preview { display: grid; grid-template-columns: 96px minmax(0,1fr) auto; align-items: center; gap: 12px; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.media-preview[hidden] { display: none; }
.media-preview img, .media-preview video { width: 96px; height: 72px; border-radius: 8px; object-fit: cover; background: #e8eeea; }
.media-preview strong, .media-preview span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-preview span { margin-top: 4px; color: var(--muted); font-size: .72rem; }
.signature-note { margin-top: 9px; padding: 10px 12px; border-left: 3px solid var(--green); background: var(--green-soft); color: #3f564a; font-size: .75rem; line-height: 1.45; }
.signature-note strong { color: var(--green-dark); margin-right: 7px; }
.composer-foot { justify-content: space-between; margin-top: 10px; color: var(--muted); font-size: .75rem; }
.composer-foot > div { display: flex; align-items: center; gap: 10px; }
.tokens { display: flex; gap: 6px; flex-wrap: wrap; }
.tokens button { border: 0; padding: 5px 8px; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); font: 700 .72rem ui-monospace, monospace; cursor: pointer; }
.text-btn { border: 0; background: transparent; color: var(--green-dark); font-weight: 750; cursor: pointer; padding: 7px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(8,20,15,.55); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(480px, 100%); background: white; border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.modal-small { width: min(560px, 100%); }
.admin-modal { width: min(920px, 100%); max-height: min(860px, 92dvh); overflow: auto; }
.admin-form { grid-template-columns: repeat(3, minmax(0,1fr)); align-items: end; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.admin-form .form-error { grid-column: 1 / -2; }
.admin-users { margin-top: 20px; display: grid; gap: 8px; }
.admin-user { padding: 13px; border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) auto auto; align-items: center; gap: 12px; }
.admin-user strong, .admin-user span { display: block; }
.admin-user span { color: var(--muted); font-size: .75rem; margin-top: 3px; }
.status-badge { display: inline-flex !important; width: max-content; padding: 5px 8px; border-radius: 999px; font-size: .72rem !important; font-weight: 800; }
.status-active { color: var(--green-dark) !important; background: var(--green-soft); }
.status-blocked { color: #b42318 !important; background: #feeceb; }
.access-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 0%, #e2f7eb, transparent 35%), var(--paper); }
.access-screen[hidden] { display: none; }
.auth-pending .topbar, .auth-pending .app-shell, .auth-pending .global-footer { visibility: hidden; }
.access-card { width: min(460px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); text-align: center; }
.access-card .brand-mark { margin: 0 auto 22px; }
.access-card h1 { margin: 0; font: 500 2.25rem/1.05 Georgia, serif; letter-spacing: -.04em; }
.access-card p:not(.eyebrow) { color: var(--muted); line-height: 1.55; margin: 14px 0 22px; }
.access-card .access-ad { margin: 22px 0 0 !important; padding-top: 18px; border-top: 1px solid var(--line); font-size: .75rem; }
.login-form { margin: 22px 0 10px; display: grid; gap: 12px; text-align: left; }
.login-form[hidden] { display: none; }
.login-form label { display: grid; gap: 6px; color: #39473f; font-size: .78rem; font-weight: 800; }
.login-form input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.login-form .form-error { margin: 0 !important; }
.save-status { color: var(--green-dark); font-size: .72rem; font-weight: 800; }
.global-footer { min-height: 78px; padding: 18px 4vw; display: flex; align-items: center; justify-content: center; gap: 14px; color: #b8c8c0; background: var(--navy); font-size: .78rem; text-align: center; }
.global-footer strong { color: #5bdd9b; white-space: nowrap; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal form { display: grid; gap: 15px; }
.modal label { display: grid; gap: 7px; color: #39473f; font-size: .82rem; font-weight: 700; }
.modal input { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; color: var(--ink); }
.modal-actions { justify-content: flex-end; margin-top: 6px; }
.form-error { min-height: 18px; color: #b42318; margin: 0; font-size: .8rem; }
.confirm-text { color: var(--muted); line-height: 1.55; margin: 0 0 22px; }
.contact-picker { display: grid; gap: 9px; }
.picker-head { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; }
.picker-search { min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.picker-search input { width: 100%; min-height: 36px !important; padding: 0 !important; border: 0 !important; outline: 0; }
.picker-options { max-height: 265px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfb; }
.picker-contact { min-height: 52px; padding: 7px 10px; display: grid !important; grid-template-columns: 22px 32px minmax(0,1fr); align-items: center; gap: 9px !important; border-bottom: 1px solid var(--line); cursor: pointer; }
.picker-contact:last-child { border-bottom: 0; }
.picker-contact:hover { background: var(--green-soft); }
.picker-contact .avatar { width: 30px; height: 30px; }
.picker-contact-info { min-width: 0; }
.picker-contact-info strong, .picker-contact-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-contact-info strong { color: var(--ink); font-size: .82rem; }
.picker-contact-info span { color: var(--muted); font-size: .7rem; margin-top: 2px; font-weight: 500; }
.picker-empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: .82rem; }
.picker-help { margin: 0; color: var(--muted); font-size: .73rem; line-height: 1.4; }
.queue-panel { position: fixed; z-index: 40; top: 0; right: 0; width: min(430px, 100%); height: 100dvh; padding: 30px; background: white; box-shadow: -15px 0 50px rgba(16,32,26,.18); overflow: auto; }
.queue-panel[hidden] { display: none; }
.queue-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.queue-progress { height: 6px; margin: 24px 0 10px; border-radius: 999px; overflow: hidden; background: #e8eeea; }
.queue-progress div { height: 100%; width: 0; border-radius: inherit; background: var(--green); transition: width .25s; }
.queue-status { color: var(--muted); font-size: .8rem; margin: 0 0 20px; }
.queue-card { min-height: 265px; border: 1px solid var(--line); border-radius: 15px; padding: 22px; margin-bottom: 18px; background: #f8faf8; }
.queue-person { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.queue-person .avatar { width: 44px; height: 44px; }
.queue-person strong, .queue-person span { display: block; }
.queue-person span { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.message-preview { padding: 15px; border-radius: 4px 13px 13px 13px; background: var(--green-soft); white-space: pre-wrap; line-height: 1.5; font-size: .9rem; }
.queue-media { margin-bottom: 14px; }
.queue-media img, .queue-media video { display: block; width: 100%; max-height: 220px; object-fit: contain; border-radius: 10px; background: #e8eeea; }
.queue-media span { display: block; margin-top: 7px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
#copyMediaBtn { margin-bottom: 8px; }
#copyMediaBtn[hidden] { display: none; }
.queue-tip { padding: 13px; color: var(--muted); background: #f4f6f4; border-radius: 9px; font-size: .75rem; line-height: 1.45; text-align: center; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 16px; color: white; background: var(--navy); border-radius: 9px; box-shadow: var(--shadow); transition: .2s; font-size: .85rem; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 920px) {
  .privacy-pill { display: none; }
  .summary { align-items: flex-start; flex-direction: column; }
  .stats { width: 100%; }
  .stats div { flex: 1; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { border: 0; border-bottom: 1px solid var(--line); padding: 14px; }
  .sidebar-title, .sidebar-note { display: none; }
  #listNav { display: flex; overflow-x: auto; padding-bottom: 2px; }
  .nav-item { width: auto; min-width: max-content; gap: 12px; }
  th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { display: none; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  .top-actions .btn-quiet, .top-actions label { padding: 0 10px; font-size: .78rem; }
  #exportBtn { display: none; }
  .app-shell { padding: 28px 12px 50px; }
  .summary h1 { font-size: 2.3rem; }
  .stats div { min-width: 0; padding: 12px; }
  .stats span { font-size: .68rem; }
  .content { padding: 16px; }
  .toolbar, .section-heading, .composer-head, .composer-foot { align-items: stretch; flex-direction: column; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar .btn { min-height: 44px; }
  .selection-actions { justify-content: space-between; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  th, td { padding-left: 8px; padding-right: 8px; }
  .composer-foot > div { justify-content: space-between; }
  .queue-panel { padding: 22px; }
  .admin-form { grid-template-columns: 1fr; }
  .admin-form .form-error { grid-column: auto; }
  .admin-user { grid-template-columns: 1fr auto; }
  .global-footer { flex-direction: column; gap: 6px; }
}
