/* ============================================================================
   ITALK — unified UI system (legacy it-* classes on v2 tokens)  (one design, used across every portal page)
   Light-first, warm-neutral, amber-accented. Prefix: .it-*
   ========================================================================= */

/* Legacy --it-* names, now mapped onto the v2 "Ink & Amber" tokens from
   /css/italk-kit.css (loaded first by theme.js), so older markup follows the
   same palette in light and dark. */
:root, html.italk-dark{
  --it-bg:var(--page); --it-surface:var(--surface); --it-surface-2:var(--surface-2);
  --it-ink:var(--ink); --it-muted:var(--ink-2); --it-faint:var(--ink-3);
  --it-line:var(--line); --it-line-2:var(--sunken);
  --it-accent:var(--accent-text); --it-accent-bright:var(--amber); --it-accent-soft:var(--amber-soft);
  --it-blue:var(--info); --it-blue-soft:var(--info-soft);
  --it-red:var(--danger); --it-red-soft:var(--danger-soft);
  --it-green:var(--success); --it-green-soft:var(--success-soft);
  --it-amber:var(--accent-text); --it-amber-soft:var(--amber-soft);
  --it-purple:var(--on-tint-lilac); --it-purple-soft:var(--tint-lilac);
  --it-shadow:var(--shadow-card); --it-shadow-sm:var(--shadow-card);
}
html.italk-dark{ color-scheme:dark }

body.it-body{
  margin:0; background:var(--it-bg); color:var(--it-ink);
  font-family:var(--font-sans);
  -webkit-font-smoothing:antialiased; font-size:15px; line-height:1.5;
}
.it-num{font-variant-numeric:tabular-nums}
.it-app h1,.it-app h2,.it-app h3{font-family:var(--font-display); letter-spacing:-.01em}
/* zero-specificity reset, so a heading's own spacing class (mb-6 …) still applies —
   the old ".it-app h2{margin:0}" silently removed it on 23 headings */
:where(.it-app) :where(h1,h2,h3){margin:0}

.it-app{display:grid; grid-template-columns:248px 1fr; min-height:100vh}

/* ── Sidebar (v2: the design's .side / .snav look) ──────── */
.it-side{background:var(--page); border-right:1px solid var(--line); display:flex; flex-direction:column; position:sticky; top:0; height:100vh}
.it-brand{display:flex; align-items:center; gap:10px; padding:24px 22px 14px; text-decoration:none; color:var(--ink)}
.it-brand-icon{width:32px; height:32px; border-radius:9px; flex:none; display:block}
.it-brand-txt{display:flex; flex-direction:column; align-items:flex-start; gap:3px; line-height:1.15}
.it-logo{height:14px; width:auto; display:block}
.it-brand-sub{font-size:12px; line-height:16px; font-weight:600; color:var(--ink-2)}

.it-nav{flex:1; overflow-y:auto; padding:4px 16px 12px; display:flex; flex-direction:column}
.it-nav-group{display:flex; flex-direction:column; gap:2px}
.it-nav-label{font-size:11px; line-height:14px; font-weight:700; letter-spacing:.9px; text-transform:uppercase; color:var(--ink-2); padding:14px 12px 6px}
.it-nav a{display:flex; align-items:center; gap:12px; min-height:44px; padding:0 12px; border-radius:var(--radius-pill); color:var(--ink); text-decoration:none; font-weight:600; font-size:15px; line-height:20px}
.it-nav a .ic{font-size:22px}
.it-nav a .lbl{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.it-nav a:hover{background:var(--sunken)}
.it-nav a.active{background:var(--amber); color:var(--on-amber)}
.it-nav a .count, .it-nav a .badge{margin-left:auto; min-width:22px; height:22px; padding:0 7px; border-radius:var(--radius-pill); background:var(--ink); color:var(--page); font-size:12px; font-weight:700; line-height:22px; text-align:center}
.it-nav a.active .count{background:var(--on-amber); color:var(--amber)}

.it-side-foot{padding:12px 12px 16px}
/* compact theme / sign-out buttons so the name gets the room ("Sarah Kim", not "Sarah …") */
.it-userchip{display:flex; align-items:center; gap:0; padding:8px 6px; border-radius:var(--radius-card)}
.it-userchip .it-iconbtn{width:32px; height:32px}
.it-userchip:hover{background:var(--sunken)}
.it-userlink{display:flex; align-items:center; gap:10px; flex:1; min-width:0; text-decoration:none; color:inherit}
.it-avatar{width:36px; height:36px; border-radius:50%; background:var(--bold); color:var(--on-bold); font-family:var(--font-display); font-weight:800; font-size:13px; display:flex; align-items:center; justify-content:center; flex-shrink:0; overflow:hidden}
.it-avatar img{width:100%;height:100%;object-fit:cover}
.it-userchip .who{flex:1; min-width:0; line-height:1.25}
.it-userchip .who b{font-size:15px; line-height:19px; font-weight:700; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; white-space:normal; overflow:hidden; overflow-wrap:anywhere} /* a long name wraps to a 2nd line instead of "Sarah …" */
.it-userchip .who span{font-size:13px; color:var(--ink-2)}
.it-iconbtn{background:none; border:0; color:var(--ink-2); cursor:pointer; width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; flex:none}
.it-iconbtn:hover{background:var(--line); color:var(--ink)}

/* ── Main (v2: top bar = kicker + display title, tools on the right) ── */
.it-main{min-width:0; display:flex; flex-direction:column}
.it-topbar{display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:16px; padding:28px 40px 8px; max-width:1280px; width:100%; margin:0 auto; box-sizing:border-box}
.it-topbar h1{font-family:var(--font-display); font-size:32px; line-height:38px; font-weight:800; letter-spacing:-0.9px}
.it-topbar .sub{color:var(--ink-2); font-size:15px; line-height:20px; font-weight:600; margin-top:4px}
.it-topbar .kick{order:-1}
.it-topbar .sub b{color:var(--accent-text); font-weight:700}
.it-actions{display:flex; flex-wrap:wrap; align-items:center; gap:10px; flex-shrink:0}
/* Buttons = the kit's .btn: pill, amber primary, quiet secondary */
.it-btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; height:44px; padding:0 18px; border-radius:var(--radius-pill); font-weight:700; font-size:15px; line-height:20px; cursor:pointer; border:0; font-family:var(--font-sans); text-decoration:none; white-space:nowrap}
.it-btn svg{width:18px; height:18px; stroke-width:2.1}
.it-btn .ms, .it-btn .ic{font-size:20px}
.it-btn-ghost{background:var(--sunken); color:var(--ink)}
.it-btn-ghost:hover{background:var(--line)}
.it-btn-primary{background:var(--amber); color:var(--on-amber)}
.it-btn-primary:hover{filter:brightness(0.97)}
.it-btn-primary .ms,.it-btn-primary svg{color:inherit}

.it-content{padding:20px 40px 64px; display:flex; flex-direction:column; gap:24px; max-width:1280px; width:100%; margin:0 auto; box-sizing:border-box}

/* Stat tiles */
.it-stats{display:grid; grid-template-columns:repeat(6,1fr); gap:16px}
.it-stat{background:var(--surface); border-radius:var(--radius-card); padding:18px 20px; box-shadow:var(--shadow-card); display:flex; flex-direction:column; gap:8px; text-decoration:none; color:var(--ink)}
.it-stat:hover{background:var(--surface-2)}
.it-stat .lab{display:flex; align-items:center; gap:8px; font-size:13px; line-height:18px; font-weight:600; color:var(--ink-2)}
.it-stat .dot{width:8px; height:8px; border-radius:50%; flex-shrink:0}
.it-stat .val{font-family:var(--font-display); font-weight:800; font-size:28px; letter-spacing:-0.6px; line-height:32px; color:var(--ink)}
.it-stat .foot{font-size:12px; color:var(--ink-3); font-weight:600}
.it-c-blue{color:var(--info)!important} .it-c-amber{color:var(--accent-text)!important} .it-c-red{color:var(--danger)!important} .it-c-green{color:var(--success)!important}
.it-d-ink{background:var(--ink-3)} .it-d-blue{background:var(--info)} .it-d-amber{background:var(--amber)} .it-d-red{background:var(--danger)}

/* Grid + cards */
.it-grid{display:grid; gap:20px; align-items:start}
.it-grid-3{grid-template-columns:1.15fr 1fr .85fr}
.it-grid-2{grid-template-columns:1.55fr 1fr}
.it-card{background:var(--surface); border-radius:var(--radius-card); box-shadow:var(--shadow-card); overflow:hidden}
.it-card-h{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 20px 10px}
.it-card-h h2{font-family:var(--font-display); font-size:18px; line-height:24px; font-weight:700; letter-spacing:-0.2px}
.it-card-h .cnt{font-size:12px; color:var(--it-muted); font-weight:600; margin-left:8px}
.it-card-h a{color:var(--accent-text); font-weight:700; font-size:15px; text-decoration:none; display:inline-flex; align-items:center; gap:4px}
.it-card-h a:hover{text-decoration:underline}
.it-card-body{padding:6px 0}
.it-card-pad{padding:18px 20px}

/* Rows (schedule / attention / lists) */
.it-row{display:flex; align-items:center; gap:14px; padding:12px 20px; border-bottom:1px solid var(--line); text-decoration:none; color:inherit}
.it-row:last-child{border-bottom:0}
.it-row:hover{background:var(--it-surface-2)}
.it-time{font-family:var(--font-display); font-weight:800; font-size:15px; color:var(--it-ink); width:46px; flex-shrink:0; font-variant-numeric:tabular-nums}
.it-row .info{flex:1; min-width:0}
.it-row .info b{font-weight:700; font-size:15px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--it-ink)}
.it-row .info span{font-size:13px; color:var(--it-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block}
.it-row.dim{opacity:.6}
.it-chev{color:var(--it-faint); flex-shrink:0}

.it-pill{display:inline-flex; align-items:center; height:24px; font-size:12px; font-weight:700; padding:0 10px; border-radius:999px; flex-shrink:0; white-space:nowrap}
.it-pill-done{background:var(--it-green-soft); color:var(--it-green)}
.it-pill-live{background:var(--ink); color:var(--page)}
.it-pill-soon{background:var(--amber-soft); color:var(--accent-text)}
.it-pill-up{background:var(--it-amber-soft); color:var(--it-amber)}
.it-pill-cancel{background:var(--it-red-soft); color:var(--it-red)}
.it-pill-makeup{background:var(--amber-soft); color:var(--accent-text)}
.it-pill-off{background:var(--it-line); color:var(--it-muted)}
.it-pill-accent{background:var(--it-accent-soft); color:var(--it-accent)}
.it-pill-blue{background:var(--it-blue-soft); color:var(--it-blue)}
.it-dot-on{background:var(--it-green)} .it-dot-off{background:var(--it-faint)}
.it-ic-green{background:var(--it-green-soft); color:var(--it-green)}
.it-ic-blue{background:var(--it-blue-soft); color:var(--it-blue)}
.it-ic-amber{background:var(--it-amber-soft); color:var(--it-amber)}

/* Empty / clear state */
.it-empty{display:flex; flex-direction:column; align-items:center; text-align:center; gap:6px; padding:30px 22px}
.it-empty .em{font-size:30px}
.it-empty b{font-size:14px; font-weight:700}
.it-empty span{font-size:12.5px; color:var(--it-muted)}

/* Sign-in list */
.it-signin{display:flex; align-items:center; gap:12px; padding:10px 20px; border-bottom:1px solid var(--line)}
.it-signin:last-child{border-bottom:0}
.it-key{width:36px; height:36px; border-radius:12px; background:var(--sunken); color:var(--ink-2); display:flex; align-items:center; justify-content:center; flex-shrink:0}
.it-key.bad{background:var(--it-red-soft); color:var(--it-red)}
.it-signin .info{flex:1; min-width:0; line-height:1.3}
.it-signin .info b{font-size:15px; font-weight:700; color:var(--it-ink)}
.it-signin .info .role{font-size:13px; color:var(--it-muted); font-weight:600}
.it-signin time{font-size:13px; color:var(--ink-2); font-weight:500; white-space:nowrap; font-variant-numeric:tabular-nums}

/* Inputs / filters / chips / banners (shared form components) */
.it-input,.it-select{border:1px solid var(--line-strong); border-radius:var(--radius-md); padding:11px 14px; font-size:15px; background:var(--it-surface); color:var(--it-ink); font-family:inherit; outline:none; transition:border-color .12s}
.it-input:focus,.it-select:focus{border-color:var(--it-accent-bright)}
.it-select{cursor:pointer}
.it-filters{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.it-search{position:relative; flex:1; min-width:220px}
.it-search input{width:100%; padding-left:38px}
.it-search .ms{position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--it-muted); font-size:18px; pointer-events:none}
.it-chip{font-size:12px; font-weight:700; padding:3px 10px; border-radius:999px; background:var(--sunken); color:var(--ink-2); white-space:nowrap}
.it-linkbtn{font-size:13px; font-weight:700; border:0; border-radius:999px; padding:6px 12px; background:var(--sunken); color:var(--it-ink); cursor:pointer; transition:border-color .12s,color .12s}
.it-linkbtn:hover{border-color:var(--it-accent); color:var(--it-accent)}
.it-banner{display:flex; align-items:center; gap:10px; flex-wrap:wrap; background:var(--amber-soft); color:var(--ink); border-radius:var(--radius-card); padding:12px 16px; font-size:13px; font-weight:600}
.it-banner a{color:inherit; font-weight:800}
.it-danger-link{font-size:12px; color:var(--it-red); background:none; border:0; cursor:pointer; padding:0}
.it-danger-link:hover{text-decoration:underline}
.it-code{font-family:var(--font-display); font-weight:800; font-size:20px; letter-spacing:.22em; color:var(--it-ink)}
/* toast */
.it-toast{position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--it-ink); color:var(--it-surface); font-size:13.5px; font-weight:600; padding:12px 22px; border-radius:999px; box-shadow:var(--it-shadow); opacity:0; transition:opacity .3s; pointer-events:none; z-index:200}
.it-toast.show{opacity:1}

/* ── Mobile hamburger drawer ─────────────────────────── */
.it-mobile-topbar{display:none}
.it-backdrop{display:none}
@media (max-width:1120px){ .it-topbar{padding-left:28px;padding-right:28px} .it-content{padding-left:28px;padding-right:28px} .it-stats{grid-template-columns:repeat(3,1fr)} .it-grid-3{grid-template-columns:1fr 1fr} }
@media (max-width:900px){
  .it-app{grid-template-columns:1fr}
  .it-mobile-topbar{display:flex; align-items:center; gap:12px; padding:10px 16px; border-bottom:1px solid var(--line); background:var(--page); position:sticky; top:0; z-index:30}
  .it-burger{width:44px; height:44px; border-radius:50%; border:0; background:var(--sunken); display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--ink); flex-shrink:0}
  .it-m-brand{display:flex; align-items:center; gap:9px; min-width:0}
  .it-m-brand .it-brand-mark{width:32px; height:32px; border-radius:9px}
  .it-m-brand .n{font-family:var(--font-display); font-weight:800; font-size:15px; color:var(--it-ink)}
  .it-m-brand .s{font-size:12px; font-weight:600; color:var(--ink-2)}
  .it-side{position:fixed; top:0; left:0; height:100dvh; width:280px; background:var(--surface); z-index:60; transform:translateX(-102%); transition:transform .26s cubic-bezier(.4,0,.2,1); box-shadow:0 0 44px rgba(0,0,0,.2)}
  body.it-nav-open .it-side{transform:translateX(0)}
  .it-backdrop{display:block; position:fixed; inset:0; background:rgba(20,16,8,.44); z-index:55; opacity:0; pointer-events:none; transition:opacity .26s}
  body.it-nav-open .it-backdrop{opacity:1; pointer-events:auto}
  .it-topbar{padding:18px 18px 15px} .it-topbar h1{font-size:21px}
  .it-grid-3,.it-grid-2{grid-template-columns:1fr}
}
@media (max-width:560px){
  .it-stats{grid-template-columns:repeat(2,1fr)}
  .it-content{padding-left:16px; padding-right:16px}
  .it-topbar{padding-left:16px; padding-right:16px; flex-wrap:wrap; align-items:center}
  /* header buttons wrap under the title instead of pushing the page sideways */
  .it-actions{flex-shrink:1; min-width:0; flex-wrap:wrap}
  .it-stat{min-width:0} .it-stat .lab,.it-stat .foot{overflow-wrap:anywhere}
  .it-btn-ghost{display:none}
}
@media (prefers-reduced-motion: reduce){ .it-side,.it-backdrop,.it-stat{transition:none} }

/* ── Messages on phones: one pane at a time (see js/msg-mobile.js) ───────── */
.msg-back{display:none}
@media (max-width: 767px){
  .msg-two-pane > .msg-list-pane{width:100% !important; border-right:0 !important}
  .msg-two-pane > .msg-chat-pane{display:none !important}
  .msg-two-pane.msg-chatting > .msg-list-pane{display:none !important}
  .msg-two-pane.msg-chatting > .msg-chat-pane{display:flex !important}
  .msg-back{display:inline-flex !important; align-items:center; justify-content:center; width:36px; height:36px; margin-left:-6px;
    border-radius:10px; border:0; background:transparent; color:var(--it-ink); cursor:pointer; flex-shrink:0}
  .msg-back:hover{background:var(--it-surface-2)}
  .msg-two-pane #chat-header{padding-left:10px !important; padding-right:12px !important; gap:10px !important}
}

/* ── Toasts ─────────────────────────────────────────────────────────────────
   Pages hide a toast by clearing ALL its classes, so its coloured background
   vanished instantly while the text faded out over the report/page — bare
   text floating over content. Give every toast a default pill background, and
   make "info" toasts ink (they were the old blue). */
#toast{background:var(--ink); color:var(--page); border-radius:14px !important} /* not a 999px pill: a two-line toast became a capsule */
html:root #toast.info{background:var(--ink) !important; color:var(--page) !important}
html:root #toast.success{background:var(--success) !important; color:#fff !important}
html:root #toast.error{background:var(--danger) !important; color:#fff !important}

/* Copyright footer removed per request (web + desktop). */
[data-i18n="footer"]{display:none !important}

/* ── v2 page body inside .it-main (sidebar is injected by it-sidebar.js) ─────
   <div class="it-app"><div class="it-main"><div class="it-page"> <header class="top">…</header> … </div></div></div>
   Inside .it-page use the kit + web shell classes (.top .kick .t-display .top-tools .wsearch .g2/.g3/.g4
   .cols .c-main .c-side .wcard .tbox .tbl .drawer .modal …) exactly as on the design boards. */
.it-page{width:100%; max-width:1280px; margin:0 auto; padding:28px 40px 64px; box-sizing:border-box; display:flex; flex-direction:column; gap:28px; min-width:0}
.it-page.narrow{max-width:900px}
.it-page.full{max-width:none}
@media (max-width:1120px){ .it-page{padding:24px 28px 56px} }
@media (max-width:640px){ .it-page{padding:18px 16px 48px; gap:22px} .it-page .t-display{font-size:26px; line-height:32px} .it-page .top-tools{width:100%; flex-wrap:wrap} .it-page .top-tools > .wsearch{width:auto; flex:1 1 160px; min-width:0} .it-page .wsearch{width:100%} }
/* (the search shares its row with the bell / buttons instead of pushing them onto their own row;
   the row still wraps on pages with several buttons, so nothing runs off the screen) */
/* Fixed overlays for real drawers/modals (the boards draw them in place) */
.it-overlay{position:fixed; inset:0; z-index:80; background:rgba(21,19,14,.42); display:flex; align-items:center; justify-content:center; padding:24px}
.it-overlay.hidden{display:none}
.it-overlay > .modal{margin:0; width:100%; max-height:calc(100dvh - 48px); overflow-y:auto}
.it-overlay.side{justify-content:flex-end; padding:0}
.it-overlay.side > .drawer{max-width:460px; width:100%; height:100dvh; border-radius:0; overflow-y:auto}
/* Resets for v2 page content (the kit scopes its own to .it/.screen/.web) */
:where(.it-page, .it-overlay) a { color: inherit; text-decoration: none; }
:where(.it-page, .it-overlay) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
:where(.it-page, .it-overlay) :where(h1, h2, h3, p) { margin: 0; }
.hidden { display: none !important; }
/* Search pills: the input is part of the pill (polish.css styles bare inputs) */
.wsearch input, .it-page .wsearch input { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; height: 100%; border-radius: 0 !important; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
/* The sidebar's account chip uses .who, which the kit also defines (flex row) */
.it-userchip .who { display: block; flex: 1; min-width: 0; gap: 0; }
.it-userchip .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Side drawers are ".it-overlay.side", but the kit also styles ".side" as the
   desktop sidebar (248px column, border, padding). Undo that here so drawers
   always open full height on the right over a dimmed page. */
.it-overlay.side { flex: none; max-width: none; width: auto; min-height: 0; padding: 0; gap: 0; border: 0; flex-direction: row; justify-content: flex-end; align-items: stretch; background: rgba(21,19,14,.42); }
.it-overlay.side.hidden { display: none; }
@media (max-width: 640px) { .it-overlay.side { border: 0; } .it-overlay.side > .drawer { max-width: none; } }
/* Site-wide button reset (what Tailwind's preflight used to give every page).
   Zero specificity, so .btn / .icon-btn / .chip and page styles always win.
   Covers pop-ups placed outside .it-page (compose window, viewers, pickers). */
:where(body) :where(button) { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
:where(body) :where(button):disabled { cursor: default; }
/* Chat bubbles never grow past the chat column. A long quoted reply used to
   stay on one line (.ellipsis = nowrap), which made its bubble as wide as the
   whole quote and pushed it off the edge. The quote now wraps to two lines. */
.msg { min-width: 0; max-width: min(80%, 620px); }
.msg > .bub, .msg > div > .bub { max-width: 100%; min-width: 0; overflow-wrap: anywhere; word-break: normal; }
.bub .quote { display: block; max-width: 100%; min-width: 0; overflow: hidden; }
.bub .quote > .ellipsis { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; overflow: hidden; overflow-wrap: anywhere; }
/* Page loading screen: one look everywhere — full screen, centred spinner +
   caption. Pages hide it with style.display='none' or .hidden, which still win. */
#loading-overlay { position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--page); color: var(--ink-2); font-size: 15px; text-align: center; }
#loading-overlay > * { margin: 0 !important; }
#loading-overlay .spinner, #loading-overlay .it-spin, #loading-overlay .spin { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--accent-text); border-radius: 50%; animation: itLoadSpin .7s linear infinite; }
@keyframes itLoadSpin { to { transform: rotate(360deg); } }
