/* Growthwright Front Desk. Tokens match the Growthwright hub (navy / coral, Schibsted Grotesk). */
@font-face { font-family: "Schibsted Grotesk"; src: url("/static/schibsted.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }

:root {
  --navy: #0F172A; --navy-2: #1E293B; --coral: #FF5A5F; --coral-ink: #C2272D;
  --bg: #F6F7F9; --card: #FFFFFF; --sunk: #F1F4F8; --text: #0F172A; --soft: #334155; --muted: #5B6B80;
  --rule: #E2E8F0; --rule-strong: #CBD5E1;
  --good: #137A3A; --good-bg: #DDF6E6; --warn: #9A5B00; --warn-bg: #FFF1D6; --bad: #B4232A; --bad-bg: #FDE3E4;
  --info: #1D4ED8; --info-bg: #E3ECFF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 6px 18px rgba(15,23,42,.06);
  --shadow-lift: 0 2px 4px rgba(15,23,42,.06), 0 14px 34px rgba(15,23,42,.12);
  --ease: cubic-bezier(.22,1,.36,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1120; --card: #131C2E; --sunk: #0F1726; --text: #E8EDF4; --soft: #C8D2DF; --muted: #93A1B5;
    --rule: #22304A; --rule-strong: #2F4060; --coral-ink: #FF8A8E;
    --good: #5BE08F; --good-bg: #0B2C1A; --warn: #F5C063; --warn-bg: #2E2208; --bad: #FF8F95; --bad-bg: #36101A;
    --info: #8DB2FF; --info-bg: #13233F;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.28); --shadow-lift: 0 2px 6px rgba(0,0,0,.35), 0 18px 40px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { font: 15px/1.5 "Schibsted Grotesk", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }
::selection { background: var(--coral); color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
a { color: var(--coral-ink); text-underline-offset: 3px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; border-radius: 6px; }
.num, td.n, .kpi b, .price { font-variant-numeric: tabular-nums; }

/* shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #CBD5E1; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 850; letter-spacing: -0.03em; font-size: 18px; padding: 4px 8px 6px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.biz { padding: 2px 10px 14px; color: #94A3B8; font-size: 13px; }
.biz select { background: var(--navy-2); color: #fff; border: 1px solid #334155; min-height: 36px; margin-top: 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: inherit; text-decoration: none; font-weight: 550; transition: background .18s var(--ease), color .18s var(--ease); }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--coral); }
.count { margin-left: auto; font-size: 12px; font-weight: 750; background: var(--coral); color: var(--navy); padding: 1px 7px; border-radius: 99px; }
.count:empty { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 6px; }
.side-foot a, .side-foot button { color: #94A3B8; background: none; border: 0; text-align: left; padding: 8px 12px; cursor: pointer; text-decoration: none; font-size: 14px; border-radius: 8px; }
.side-foot a:hover, .side-foot button:hover { color: #fff; background: var(--navy-2); }
.main { padding: 30px clamp(16px, 4vw, 44px) 72px; max-width: 1200px; width: 100%; min-width: 0; outline: none; }
.tabbar, .mobile-only { display: none; }

/* page parts */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 28px; font-weight: 820; letter-spacing: -0.035em; }
.sub { margin: 6px 0 0; color: var(--muted); }
.h2 { font-size: 17px; font-weight: 760; margin: 26px 0 12px; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel > .ph { font-size: 15.5px; font-weight: 760; margin: 0 0 4px; }
.panel > .phs { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.note { color: var(--muted); font-size: 13.5px; max-width: 72ch; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > * { min-width: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--rule-strong); background: var(--card); color: var(--text); font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease); }
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--coral); border-color: var(--coral); color: var(--navy); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: 13.5px; border-radius: 9px; }
.btn[disabled], .btn.loading { opacity: .6; cursor: progress; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--rule-strong); background: var(--card); transition: border-color .16s var(--ease), box-shadow .16s var(--ease); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 22%, transparent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--soft); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.grid-form .span2, .grid-form .full { grid-column: 1 / -1; }
.hint { font-weight: 450; color: var(--muted); font-size: 12.5px; }

/* switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 14.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch small { display: block; font-weight: 450; color: var(--muted); font-size: 13px; }
.switch input { appearance: none; width: 44px; min-height: 0; height: 26px; border-radius: 99px; background: var(--rule-strong); border: 0; position: relative; cursor: pointer; flex: none; padding: 0; transition: background .2s var(--ease); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--good); }
.switch input:checked::after { transform: translateX(18px); }

.seg { display: inline-flex; background: var(--sunk); border: 1px solid var(--rule); border-radius: 11px; padding: 3px; gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; line-height: 1.3; padding: 3px 9px; border-radius: 99px; background: var(--sunk); color: var(--soft); white-space: nowrap; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.coral { background: color-mix(in srgb, var(--coral) 16%, transparent); color: var(--coral-ink); }

/* summary strip */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.kpi { padding: 14px 18px; border-left: 1px solid var(--rule); }
.kpi:first-child { border-left: 0; }
.kpi span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 24px; font-weight: 820; letter-spacing: -0.02em; margin-top: 2px; }
.kpi small { color: var(--muted); font-size: 12.5px; }

/* list rows */
.list { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--rule); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; transition: background .15s var(--ease); }
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--sunk); }
.item .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .r { text-align: right; display: grid; gap: 4px; justify-items: end; font-size: 13px; color: var(--muted); }
.ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--sunk); color: var(--soft); }
.ico.missed { background: var(--bad-bg); color: var(--bad); }
.ico.ai { background: var(--info-bg); color: var(--info); }
.ico.sms { background: var(--warn-bg); color: var(--warn); }
.ico.booking { background: var(--good-bg); color: var(--good); }
.empty { padding: 30px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 16.5px; margin-bottom: 6px; }

/* tables */
.table-wrap { padding: 0; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { text-align: left; font-size: 12.5px; font-weight: 650; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; background: var(--sunk); }
.data td { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.data tr:last-child td { border-bottom: 0; }
.data td.n, .data th.n { text-align: right; }
.data tr.click { cursor: pointer; }
.data tr.click:hover td { background: var(--sunk); }

/* thread */
.thread { display: grid; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 14px; font-size: 14.5px; white-space: pre-wrap; }
.bubble.in { background: var(--sunk); justify-self: start; border-bottom-left-radius: 4px; }
.bubble.out { background: var(--navy); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.bubble small { display: block; font-size: 11.5px; opacity: .7; margin-top: 3px; }
.bubble.sys { justify-self: center; background: none; color: var(--muted); font-size: 12.5px; padding: 2px; }
.composer { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.composer textarea { min-height: 44px; height: 44px; }
.transcript { display: grid; gap: 6px; font-size: 14px; background: var(--sunk); padding: 12px; border-radius: 11px; max-height: 320px; overflow-y: auto; }
.transcript b { color: var(--muted); font-weight: 650; margin-right: 6px; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { font-size: 17px; font-weight: 760; margin-right: auto; }
.cal { display: grid; grid-template-columns: 54px repeat(7, minmax(110px, 1fr)); background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: 72vh; position: relative; }
.cal .dh { position: sticky; top: 0; z-index: 3; background: var(--card); border-bottom: 1px solid var(--rule); padding: 8px; font-size: 13px; font-weight: 700; text-align: center; }
.cal .dh.today { color: var(--coral-ink); }
.cal .dh small { display: block; color: var(--muted); font-weight: 550; }
.cal .tc { border-right: 1px solid var(--rule); }
.cal .tl { height: 48px; font-size: 11.5px; color: var(--muted); text-align: right; padding: 2px 6px 0 0; }
.cal .col { position: relative; border-right: 1px solid var(--rule); background-image: linear-gradient(var(--rule) 1px, transparent 1px); background-size: 100% 48px; }
.cal .col.closed { background-color: var(--sunk); }
.ev { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 4px 7px; font-size: 12px; line-height: 1.25; overflow: hidden; cursor: pointer; background: var(--info-bg); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }
.ev b { display: block; font-size: 12.5px; }
.ev.ai { background: color-mix(in srgb, var(--coral) 14%, var(--card)); color: var(--coral-ink); border-color: color-mix(in srgb, var(--coral) 35%, transparent); }
.ev.done { opacity: .55; }
.ev.no_show { background: var(--bad-bg); color: var(--bad); }

/* hours editor */
.hours { display: grid; gap: 6px; }
.hrow { display: grid; grid-template-columns: 54px 60px 1fr 1fr; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; }
.hrow input[type="time"] { min-height: 36px; padding: 5px 8px; }
.hrow input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--coral); }

/* sheet */
.sheet { border: 0; padding: 0; margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); max-width: 100vw; background: var(--bg); color: var(--text); box-shadow: -18px 0 48px rgba(15,23,42,.22); }
.sheet[open] { animation: slidein .26s var(--ease); }
.sheet::backdrop { background: rgba(11,17,32,.5); }
@keyframes slidein { from { transform: translateX(32px); opacity: 0; } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 22px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.sheet-head h2 { font-size: 18.5px; font-weight: 780; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 18px 22px 40px; display: grid; gap: 14px; }
.sheet-body .panel { margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--sunk); color: var(--text); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.facts div { background: var(--card); padding: 11px 13px; }
.facts span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.facts b { font-size: 15.5px; font-weight: 750; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow-lift); z-index: 50; font-weight: 600; animation: toast .22s var(--ease); max-width: calc(100vw - 32px); }
@keyframes toast { from { transform: translate(-50%, 10px); opacity: 0; } }
.skel { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card), var(--sunk), var(--card)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border: 1px solid var(--rule); margin-bottom: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.copybox { display: flex; gap: 8px; align-items: center; background: var(--sunk); border-radius: 10px; padding: 6px 6px 6px 12px; font-size: 14px; }
.copybox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: inherit; font-weight: 650; }
.secret { font-family: ui-monospace, Menlo, monospace; background: var(--warn-bg); color: var(--warn); padding: 2px 8px; border-radius: 6px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); overflow-x: clip; }
  .mobile-only { display: flex; }
  .head h1 { font-size: 24px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 20; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--rule); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 650; position: relative; }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar a[aria-current="page"] { color: var(--coral-ink); }
  .tabbar .count { position: absolute; top: 2px; right: 22%; font-size: 10.5px; padding: 0 5px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .grid2 { grid-template-columns: 1fr; }
  .sheet { width: 100vw; margin: 0; max-height: none; height: 100dvh; }
  .cal { grid-template-columns: 44px repeat(7, minmax(92px, 1fr)); }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .item { grid-template-columns: auto minmax(0, 1fr); }
  .item .r { grid-column: 2; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
