/* Team Hub — design system
   Ported from design_handoff_team_hub/design-reference/styles.css (brief §3).
   Dark is the default identity; [data-theme="light"] overrides on the app root.
   The reference scopes everything under `.th` (each prototype mounts in a frame);
   here the whole document is the app, so base styles apply to html/body. */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg:        #0e1422;
    --surface:   #161d2e;
    --surface-2: #1d2638;
    --line:      #2a3550;
    --ink:       #eef2fb;
    --muted:     #8d9bbb;
    --faint:     #5d6a89;
    --accent:    #5b8cff;
    --accent-ink:#ffffff;
    --in:        #34d399;
    --break:     #fbbf24;
    --out:       #7c89a8;
    --leave:     #a78bfa;
    --danger:    #fb7185;

    --in-bg:     rgba(52,211,153,.14);
    --break-bg:  rgba(251,191,36,.14);
    --out-bg:    rgba(124,137,168,.14);
    --leave-bg:  rgba(167,139,250,.16);
    --danger-bg: rgba(251,113,133,.14);
    --accent-bg: rgba(91,140,255,.14);

    --r-card: 13px;
    --r-ctrl: 10px;
    --r-pill: 999px;
    --pad: 16px;
    --gap: 14px;

    --font-display: 'Sora', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --shadow-card: 0 1px 2px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.22);
    --shadow-pop: 0 12px 40px rgba(0,0,0,.45);
}

/* Light theme — applied via data-theme on the app root (html). */
[data-theme="light"] {
    --bg:        #eaeef6;
    --surface:   #ffffff;
    --surface-2: #f1f4fb;
    --line:      #dbe2f0;
    --ink:       #16203a;
    --muted:     #5b6680;
    --faint:     #93a0bb;
    --accent-ink:#ffffff;
    --in:        #0f9d6a;
    --break:     #c07e00;
    --out:       #6b7793;
    --leave:     #6f4fd6;
    --danger:    #e23d63;
    --in-bg:     rgba(15,157,106,.12);
    --break-bg:  rgba(192,126,0,.13);
    --out-bg:    rgba(107,119,147,.12);
    --leave-bg:  rgba(111,79,214,.12);
    --danger-bg: rgba(226,61,99,.11);
    --accent-bg: rgba(91,140,255,.13);
    --shadow-card: 0 1px 2px rgba(20,32,58,.06), 0 6px 20px rgba(20,32,58,.08);
    --shadow-pop: 0 14px 44px rgba(20,32,58,.18);
}

/* Density */
[data-density="compact"]     { --pad: 12px; --gap: 10px; }
[data-density="comfortable"] { --pad: 18px; --gap: 16px; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.45;
    letter-spacing: -0.005em;
}

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ───────────────── typography ───────────────── */
h1, .h1 { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -0.02em; margin: 0 0 1rem; }
h2, .h2 { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; margin: 1.5rem 0 .75rem; }
h3, .h3 { font-family: var(--font-body); font-weight: 600; font-size: 14px; margin: 0; }
.h-display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.lead { font-size: 1.05rem; color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

/* ───────────────── layout helpers ───────────────── */
.container { max-width: 1180px; margin: 0 auto; width: 100%; padding: 0 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ───────────────── card ───────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: var(--pad);
}
.card-flush { padding: 0; overflow: hidden; }
.card-2 { background: var(--surface-2); }

/* ───────────────── buttons ───────────────── */
.btn {
    font-family: var(--font-body);
    font-weight: 600; font-size: 13.5px;
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    height: 40px; padding: 0 16px;
    border-radius: var(--r-ctrl);
    border: 1px solid var(--line);
    cursor: pointer; white-space: nowrap;
    transition: background .14s, border-color .14s, transform .04s, color .14s;
    color: var(--ink);
    background: var(--surface-2);
}
.btn:hover { background: color-mix(in oklab, var(--surface-2), var(--ink) 8%); }
.btn:active { transform: translateY(1px); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: color-mix(in oklab, var(--accent), #000 12%); }
.btn-in { background: var(--in); color: #04130c; border-color: transparent; }
.btn-in:hover { background: color-mix(in oklab, var(--in), #000 10%); }
.btn-break { background: var(--break); color: #1c1303; border-color: transparent; }
.btn-break:hover { background: color-mix(in oklab, var(--break), #000 10%); }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover { background: color-mix(in oklab, var(--danger), #000 10%); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: color-mix(in oklab, var(--surface), var(--ink) 7%); color: var(--ink); }
.btn-icon { width: 38px; padding: 0; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* CTA — kept for existing template pages; maps to the primary button look. */
.cta {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    font-family: var(--font-body); font-weight: 600; font-size: 13.5px;
    height: 40px; padding: 0 16px; border-radius: var(--r-ctrl);
    background: var(--accent); color: var(--accent-ink);
    border: 1px solid transparent; cursor: pointer;
    transition: background .14s, transform .04s;
}
.cta:hover { background: color-mix(in oklab, var(--accent), #000 12%); text-decoration: none; }
.cta:active { transform: translateY(1px); }

/* ───────────────── pills / status ───────────────── */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px;
    border-radius: var(--r-pill);
    font-size: 12px; font-weight: 600;
    background: var(--surface-2); color: var(--muted);
    border: 1px solid var(--line);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.pill-in    { color: var(--in);    background: var(--in-bg);    border-color: color-mix(in oklab, var(--in), transparent 70%); }
.pill-break { color: var(--break); background: var(--break-bg); border-color: color-mix(in oklab, var(--break), transparent 70%); }
.pill-out   { color: var(--out);   background: var(--out-bg);   border-color: color-mix(in oklab, var(--out), transparent 70%); }
.pill-leave { color: var(--leave); background: var(--leave-bg); border-color: color-mix(in oklab, var(--leave), transparent 70%); }
.pill-danger{ color: var(--danger);background: var(--danger-bg);border-color: color-mix(in oklab, var(--danger), transparent 65%); }
.pill-accent{ color: var(--accent);background: var(--accent-bg);border-color: color-mix(in oklab, var(--accent), transparent 70%); }
.dot-in { background: var(--in); } .dot-break { background: var(--break); }
.dot-out { background: var(--out); } .dot-leave { background: var(--leave); }
.dot-accent { background: var(--accent); }

/* ───────────────── fields ───────────────── */
.field, .form-row input, .form-row textarea {
    width: 100%; height: 40px; padding: 0 12px;
    background: var(--surface-2); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--r-ctrl);
    font-family: var(--font-body); font-size: 13.5px; outline: none;
    transition: border-color .14s, box-shadow .14s;
}
textarea.field, .form-row textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field::placeholder, .form-row input::placeholder, .form-row textarea::placeholder { color: var(--faint); }
.field:focus, .form-row input:focus, .form-row textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; display: block; }
select.field { appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238d9bbb' d='M0 0h10L5 6z'/></svg>");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }

/* form-row layout (carried from the template Contact form) */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; max-width: 32rem; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--muted); }

/* ───────────────── avatar ───────────────── */
.avatar { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 600; color: #fff; flex: 0 0 auto; overflow: hidden;
    background: var(--accent); user-select: none; }

/* ───────────────── validation / alerts ───────────────── */
.validation-message, .field-validation-error { color: var(--danger); font-size: 0.85rem; }
.validation-errors, .validation-summary-errors { color: var(--danger); margin-bottom: 1rem; }
.alert-success {
    background: var(--in-bg);
    border: 1px solid color-mix(in oklab, var(--in), transparent 60%);
    color: var(--in);
    padding: 0.85rem 1rem; border-radius: var(--r-ctrl);
}

/* ───────────────── toast ───────────────── */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
    background: var(--ink); color: var(--bg); font-weight: 600; font-size: 13px;
    padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-pop);
    display: inline-flex; align-items: center; gap: 8px; z-index: 50;
    animation: toastIn .22s cubic-bezier(.2,.8,.3,1); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ───────────────── focus / motion ───────────────── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.noscroll::-webkit-scrollbar { display: none; }
.noscroll { scrollbar-width: none; }

/* ───────────────── icon button (used across chrome) ───────────────── */
.iconbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0;
    background: transparent; border: 0; border-radius: 8px;
    color: var(--muted); cursor: pointer;
    transition: background .14s, color .14s;
}
.iconbtn:hover { background: color-mix(in oklab, var(--surface), var(--ink) 8%); color: var(--ink); text-decoration: none; }

/* ───────────────── page header ───────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-subtitle { font-size: 13.5px; margin-top: 4px; }
.page-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ───────────────── grids ───────────────── */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-1-1\.5 { grid-template-columns: 1.5fr 1fr; }
.grid-1\.3-1 { grid-template-columns: 1.3fr 1fr; }
.grid-1\.6-1 { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4, .grid-1-1\.5, .grid-1\.3-1, .grid-1\.6-1 { grid-template-columns: 1fr; }
}

/* ───────────────── segmented control ───────────────── */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctrl); padding: 3px; gap: 2px; }
.seg-item { font: 600 12.5px var(--font-body); padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; transition: background .12s, color .12s; }
.seg-item:hover { color: var(--ink); }
.seg-item.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }

/* ───────────────── toggle ───────────────── */
.toggle { width: 40px; height: 23px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; padding: 0; position: relative; transition: background .15s, border-color .15s; }
.toggle.on { background: var(--accent); border-color: transparent; }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on .toggle-knob { left: 19px; }

/* ───────────────── progress ───────────────── */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; transition: width .3s; }

/* ───────────────── priority tag ───────────────── */
.prio-tag { font: 600 11px var(--font-body); padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; }
.prio-high { color: var(--danger); background: var(--danger-bg); }
.prio-medium { color: var(--break); background: var(--break-bg); }
.prio-low { color: var(--muted); background: var(--surface-2); }

/* ───────────────── KPI card ───────────────── */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-value { font: 600 26px var(--font-display); letter-spacing: -0.02em; }
.kpi-label { font-size: 12px; color: var(--muted); }

/* ───────────────── stat card ───────────────── */
.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-value { font: 600 30px var(--font-display); letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ───────────────── table ───────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font: 600 11px var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in oklab, var(--surface), var(--ink) 3%); }

/* ───────────────── tab bar ───────────────── */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
    padding: 4px 8px 0;
    gap: 2px;
}
.panel-tab {
    display: inline-flex; align-items: center; gap: 7px;
    font: 600 13px var(--font-body);
    color: var(--muted);
    background: transparent; border: 0;
    padding: 12px 14px 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .12s, border-color .12s;
}
.panel-tab:hover { color: var(--ink); }
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel-tab svg { opacity: .85; }
.tab-count {
    font: 600 11px var(--font-mono);
    background: var(--surface-2); color: var(--muted);
    border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.panel-tab.active .tab-count { background: var(--accent-bg); color: var(--accent); }

/* ───────────────── empty state ───────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { color: var(--faint); margin-bottom: 10px; }

/* loading splash for auth */
.th-loading { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--muted); }
