/* Lingify admin. Brand: the wordmark's ink for text, the logo's light blue as the one accent,
   white surfaces split by hairlines (no shadows), Plus Jakarta Sans throughout. */
:root {
  --ink: #141a3b;
  --ink-2: #2b3157;
  --soft: #4a5070;
  --mute: #646a8a;
  --faint: #9aa0bb;
  --brand: #1a9bf0;
  --brand-hover: #0f8de0;
  --brand-ink: #0a7cc8;
  --brand-soft: #e8f6fe;
  --brand-line: #bfe4fc;
  --bg: #f6f7fa;
  --surface: #ffffff;
  --sunk: #eef0f5;
  --hover: #f8f9fc;
  --line: #e6e9f2;
  --line-2: #d6dae7;
  --ok: #17864a;
  --ok-soft: #e3f6ea;
  --bad: #d92d20;
  --bad-soft: #fee4e2;
  --bad-line: #f4c1bc;
  --amber: #a15c00;
  --amber-soft: #fff4d6;
  --scrim: rgba(20, 26, 59, 0.28);
  --focus: rgba(26, 155, 240, 0.22);
  --radius: 12px;
  --r-sm: 8px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9ebf5;
    --ink-2: #c9cde0;
    --soft: #b0b5cf;
    --mute: #8c92b0;
    --faint: #626887;
    --brand: #1a9bf0;
    --brand-hover: #3aabf4;
    --brand-ink: #6cc4fb;
    --brand-soft: rgba(26, 155, 240, 0.14);
    --brand-line: rgba(26, 155, 240, 0.4);
    --bg: #0d1020;
    --surface: #131729;
    --sunk: #1b2036;
    --hover: #171c31;
    --line: #232944;
    --line-2: #2f365a;
    --ok: #4ccb84;
    --ok-soft: rgba(76, 203, 132, 0.14);
    --bad: #f97066;
    --bad-soft: rgba(249, 112, 102, 0.14);
    --bad-line: rgba(249, 112, 102, 0.4);
    --amber: #f5b83d;
    --amber-soft: rgba(245, 184, 61, 0.14);
    --scrim: rgba(4, 6, 14, 0.6);
    --focus: rgba(26, 155, 240, 0.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand-ink); }
.muted { color: var(--mute); }
.sm { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.ph { font-size: 18px; line-height: 1; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 120ms var(--ease); }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn.primary, .btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.btn.primary:hover, .btn.brand:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--soft); cursor: pointer; flex: none; transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 120ms var(--ease); }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
.icon-btn:active { transform: scale(0.95); }
.link { background: none; border: 0; padding: 0; color: var(--brand-ink); font-weight: 700; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
input, select { height: 38px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); padding: 0 12px; outline: none; transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
input::placeholder { color: var(--mute); }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
select { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23878da9' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; cursor: pointer; }

/* sign in: one calm column, logo top left, real service status bottom left */
.signin { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--surface); border-top: 3px solid var(--brand); }
.signin-top { padding: 28px 40px; }
.signin-top .logo { height: 28px; width: auto; display: block; }
.signin-box { align-self: center; justify-self: center; width: 100%; max-width: 380px; padding: 0 20px 8vh; }
.signin-box h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.025em; font-weight: 800; margin: 0 0 8px; }
.signin-box .lead { color: var(--soft); font-size: 15px; line-height: 1.55; margin: 0 0 28px; }
.signin-box .lead b { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field input { height: 48px; font-size: 16px; padding: 0 14px; }
.signin-box .btn.wide { height: 48px; font-size: 15px; border-radius: 11px; }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.otp input { width: 100%; min-width: 0; height: 58px; padding: 0; text-align: center; font-size: 24px; font-weight: 800; font-family: var(--font); caret-color: var(--brand); }
.otp input:nth-child(3) { margin-right: 6px; }
.alt { margin: 18px 0 0; color: var(--mute); font-size: 13.5px; }
.hint { font-size: 13px; color: var(--brand-ink); background: var(--brand-soft); border-radius: var(--r-sm); padding: 9px 12px; margin: 0 0 14px; }
.error { color: var(--bad); font-size: 13.5px; font-weight: 600; margin: 14px 0 0; }
.signin-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 40px 26px; color: var(--mute); font-size: 12.5px; }
.sys { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }

/* app shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; background: var(--surface); border-right: 1px solid var(--line); padding: 22px 14px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.brand .logo { height: 24px; width: auto; display: block; }
.badge { font-size: 11.5px; font-weight: 700; color: var(--brand-ink); background: var(--brand-soft); border-radius: 6px; padding: 2px 7px; }
.nav { display: grid; gap: 2px; }
.tab { display: flex; align-items: center; gap: 11px; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--soft); font-weight: 600; cursor: pointer; text-align: left; transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.tab .ph { font-size: 19px; }
.tab:hover { background: var(--hover); color: var(--ink); }
.tab.on { background: var(--brand-soft); color: var(--brand-ink); }
.tab .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.who { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 4px 0 8px; display: flex; align-items: center; gap: 8px; }
.who-id { flex: 1; min-width: 0; display: grid; gap: 1px; }
.who .email { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .env { font-size: 12px; color: var(--mute); }
.main { padding: 28px 36px 56px; min-width: 0; }
.view-head { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head h2 { font-size: 24px; letter-spacing: -0.025em; margin: 0; font-weight: 800; }
.view-head .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font-weight: 700; font-size: 12.5px; color: var(--soft); cursor: pointer; transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); outline: 1px solid var(--line); }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.kpi { padding: 16px 18px 10px; display: grid; gap: 4px; min-width: 0; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi .label { font-size: 12.5px; font-weight: 600; color: var(--mute); }
.kpi .row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi .value { font-size: 27px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.delta { font-size: 12px; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--mute); }
.kpi .sub { font-size: 11.5px; color: var(--mute); }
.kpi svg.spark { width: 100%; height: 30px; display: block; margin-top: 2px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.panel-head h3 { font-size: 15px; margin: 0; letter-spacing: -0.01em; font-weight: 700; }
.panel-head .muted { margin-left: auto; font-size: 12px; text-align: right; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--soft); margin: -6px 0 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--mute); font-size: 10.5px; font-family: var(--font); }
.chart .bar { fill: var(--brand); opacity: 0.85; transition: opacity 120ms; }
.chart .bar:hover { opacity: 1; }
.chart .bar.alt { fill: var(--brand-line); }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--brand-soft); }
.chart .hover-line { stroke: var(--line-2); stroke-dasharray: 3 3; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--surface); border-radius: 9px; padding: 7px 10px; font-size: 12px; line-height: 1.45; white-space: nowrap; }
.tip b { font-weight: 800; }
.funnel { display: grid; gap: 12px; }
.funnel .step { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: baseline; }
.funnel .step .name { font-size: 13px; font-weight: 600; }
.funnel .step .n { font-weight: 800; }
.funnel .track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.funnel .track i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.funnel .conv { grid-column: 1 / -1; font-size: 11.5px; color: var(--mute); }
.bars { display: grid; gap: 9px; }
.bars .b { display: grid; grid-template-columns: 116px 1fr 52px; gap: 10px; align-items: center; font-size: 13px; }
.bars .b .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bars .b .t { height: 6px; border-radius: 3px; overflow: hidden; }
.bars .b .t i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.bars .b .t i.ink { background: var(--ink); }
.bars .b .v { text-align: right; font-weight: 700; }
.code-chip { display: inline-block; min-width: 26px; padding: 1px 6px; margin-right: 6px; border-radius: 6px; background: var(--sunk); font-size: 11px; font-weight: 800; color: var(--soft); text-align: center; }
.cohort { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.cohort th { font-weight: 600; color: var(--mute); text-align: left; padding: 2px 4px; white-space: nowrap; }
.cohort td { text-align: center; padding: 7px 2px; border-radius: 6px; font-weight: 700; }
.cohort td.label { text-align: left; font-weight: 600; color: var(--soft); white-space: nowrap; }
.heat { display: grid; grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 3px; font-size: 10.5px; color: var(--mute); }
.heat .c { aspect-ratio: 1; border-radius: 4px; background: var(--sunk); }
.heat .d { align-self: center; font-weight: 600; }
.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--sunk); margin: 6px 0 12px; gap: 2px; }
.stack i { display: block; height: 100%; }
.split-list { display: grid; gap: 7px; font-size: 13px; }
.split-list div { display: flex; align-items: center; gap: 8px; }
.split-list .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.split-list .v { margin-left: auto; font-weight: 700; }
.recent { display: grid; }
.recent .r { display: flex; align-items: center; gap: 10px; padding: 9px 6px; margin: 0 -6px; border-top: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: background-color 120ms; }
.recent .r:hover { background: var(--hover); }
.recent .r:first-child { border-top: 0; }
.recent .r .meta { flex: 1; min-width: 0; }
.recent .r .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--mute); padding: 18px 0; text-align: center; font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--sunk), var(--hover), var(--sunk)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* tables & chips */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.toolbar .search { flex: 1 1 260px; padding-left: 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23878da9' stroke-width='1.6'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 12px center; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--mute); padding: 11px 16px; background: var(--hover); border-bottom: 1px solid var(--line); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background-color 120ms; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 600; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mini td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.mini tr:last-child td { border-bottom: 0; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; gap: 8px; border-top: 1px solid var(--line); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .meta { min-width: 0; }
.person .name { font-weight: 700; }
.person .email { color: var(--mute); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.avatar { width: 34px; height: 34px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin: 2px 4px 2px 0; border-radius: 7px; background: var(--sunk); color: var(--soft); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.chip.plus { background: var(--brand-soft); color: var(--brand-ink); }
.chip.pro { background: var(--amber-soft); color: var(--amber); }
.chip.team { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }

/* reports */
.reports { display: grid; gap: 10px; }
.report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 14px; justify-content: space-between; }
.report .top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.report .body { margin-top: 6px; }
.report .quote { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--line-2); background: var(--hover); border-radius: 0 8px 8px 0; color: var(--soft); }
.report .actions { display: flex; gap: 6px; align-items: flex-start; flex: none; }

/* drawer */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--line); z-index: 50; transform: translateX(100%); visibility: hidden; transition: transform 260ms var(--ease), visibility 0s linear 260ms; display: flex; flex-direction: column; }
.drawer.open { transform: none; visibility: visible; transition: transform 260ms var(--ease); }
.drawer-head { display: flex; justify-content: flex-end; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow: auto; padding: 20px 24px 40px; }
.d-title { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.d-title .name { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.d-section { margin-bottom: 22px; }
.d-section h4 { font-size: 13px; font-weight: 700; color: var(--ink); margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; }
.action-box { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.action-row { display: flex; gap: 8px; align-items: center; padding: 10px 12px; flex-wrap: wrap; }
.action-row + .action-row { border-top: 1px solid var(--line); }
.action-row .grow { flex: 1 1 160px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 70; }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3n + 1) { border-left: 0; }
  .kpi:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .signin-top { padding: 22px 20px; }
  .signin-foot { padding: 16px 20px 22px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand .badge { display: none; }
  .nav { display: flex; order: 3; width: 100%; overflow-x: auto; }
  .tab { width: auto; }
  .who { margin: 0 0 0 auto; border: 0; padding: 0; }
  .who .env { display: none; }
  .who .email { max-width: 160px; }
  .main { padding: 20px 16px 40px; }
  .g-2-1, .g-1-1, .g-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 0; border-top: 1px solid var(--line); }
  .kpi:nth-child(-n + 2) { border-top: 0; }
  .kpi:nth-child(2n) { border-left: 1px solid var(--line); }
  .table th:nth-child(n + 3), .table td:nth-child(n + 3) { display: none; }
  .person .email { max-width: 190px; }
  .table th, .table td { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
