:root {
  color-scheme: dark;
  --bg: #080a0d;
  --surface: rgba(20, 23, 29, 0.88);
  --surface-strong: #171a20;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f3ef;
  --muted: #a7a8ad;
  --red: #df3346;
  --red-soft: rgba(223, 51, 70, 0.14);
  --green: #78d5a7;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 15% 0%, #1c1116 0, transparent 32rem), var(--bg); color: var(--text); line-height: 1.55; }
a { color: #ff8b99; text-underline-offset: .2em; }
button, input, textarea, select { font: inherit; }
.orb { position: fixed; border-radius: 50%; filter: blur(1px); pointer-events: none; opacity: .65; }
.orb-one { width: 18rem; height: 18rem; right: -8rem; top: 9rem; background: radial-gradient(circle at 35% 35%, #ef5365, #7f0b20 65%, transparent 68%); }
.orb-two { width: 8rem; height: 8rem; left: -4rem; bottom: 8%; background: #38101a; filter: blur(18px); }
.admin-nav { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; min-height: 4.5rem; padding: 0 4vw; border-bottom: 1px solid var(--line); background: rgba(8, 10, 13, .78); backdrop-filter: blur(16px); }
.brand { display: inline-flex; gap: .7rem; align-items: center; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: linear-gradient(135deg, #ff5366, #a70724); box-shadow: 0 0 1.5rem rgba(223, 51, 70, .45); }
.section-nav { display: flex; align-items: center; gap: .25rem; padding: .3rem; border: 1px solid rgba(255,255,255,.08); border-radius: .8rem; background: rgba(255,255,255,.025); }
.section-nav a { color: var(--muted); text-decoration: none; font-size: .82rem; font-weight: 700; padding: .42rem .72rem; border-radius: .55rem; }
.section-nav a:hover, .section-nav a.is-active { color: var(--text); background: rgba(255,255,255,.08); }
.section-nav a.is-active { box-shadow: inset 0 -2px 0 var(--red); }
.identity { display: flex; gap: .7rem; align-items: center; color: var(--muted); font-size: .88rem; }
.identity span, .status, .live-boundary, .data-boundary { border: 1px solid var(--line); border-radius: 999px; padding: .2rem .55rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.client-context-bar { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 4vw; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(28, 12, 17, .86); }
.client-context-bar > div { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; min-width: 0; }
.client-context-bar span { color: #ff9ca8; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.client-context-bar strong { overflow-wrap: anywhere; }
.client-context-bar code, .client-context-bar em { border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: .15rem .5rem; color: var(--muted); font-size: .7rem; font-style: normal; }
.client-context-bar em { color: #ffd49a; border-color: rgba(242,178,91,.28); text-transform: uppercase; letter-spacing: .08em; }
.client-context-form { display: flex; align-items: end; gap: .55rem; min-width: min(27rem, 48vw); }
.client-context-form label { flex: 1; gap: .2rem; }
.client-context-form label span { color: var(--muted); font-size: .62rem; }
.client-context-form select, .client-context-form button { min-height: 2.35rem; padding-block: .4rem; }
.container { position: relative; z-index: 1; width: min(1180px, 92vw); margin: 0 auto; padding: 4rem 0 6rem; }
.page-head { display: flex; justify-content: space-between; align-items: start; gap: 2rem; margin-bottom: 2rem; }
.page-head h1, .login-card h1 { margin: .25rem 0 .5rem; font-size: clamp(2.2rem, 5vw, 4.5rem); line-height: .98; letter-spacing: -.055em; }
.page-head p, .form-intro { color: var(--muted); max-width: 48rem; }
.eyebrow { color: #ff8291 !important; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(20rem, .8fr); gap: 1.25rem; align-items: start; }
.admin-grid > * { min-width: 0; }
.panel, .login-card { border: 1px solid var(--line); border-radius: 1.1rem; background: var(--surface); box-shadow: 0 1.4rem 5rem rgba(0, 0, 0, .28); padding: clamp(1.25rem, 3vw, 2rem); backdrop-filter: blur(18px); }
.section-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 1.5rem; }
h2 { margin: 0 0 .35rem; letter-spacing: -.025em; }
.section-head p { color: var(--muted); margin: 0; font-size: .9rem; }
.live-boundary { color: var(--green); border-color: rgba(120, 213, 167, .25); white-space: nowrap; }
.data-boundary { color: #b9c7ff; border-color: rgba(137, 162, 255, .28); white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .9rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.meta { display: block; color: var(--muted); margin-top: .15rem; font-size: .78rem; }
.status-draft { background: var(--red-soft); color: #ff9ba6; border-color: rgba(223, 51, 70, .28); }
.status-review, .status-approved { color: #ffd49a; border-color: rgba(242, 178, 91, .3); background: rgba(158, 91, 21, .18); }
.status-active { color: #aaf0cb; border-color: rgba(120, 213, 167, .3); background: rgba(42, 121, 83, .18); }
.status-publishing, .status-withdrawing, .status-withdrawal-failed { color: #cdd7ff; border-color: rgba(137, 162, 255, .3); background: rgba(72, 94, 176, .18); }
.status-withdrawn { color: #c4c5ca; background: rgba(255,255,255,.04); }
.status-qualified, .status-contacted, .status-notified { color: #aaf0cb; border-color: rgba(120, 213, 167, .3); background: rgba(42, 121, 83, .18); }
.status-needs-follow-up, .status-requested { color: #ffd49a; border-color: rgba(242, 178, 91, .3); background: rgba(158, 91, 21, .18); }
.status-closed, .status-none { color: #c4c5ca; background: rgba(255,255,255,.04); }
code { color: #d6d2ca; font-size: .78rem; }
.empty { color: var(--muted); padding: 2rem .7rem; }
.stack { display: grid; gap: 1rem; margin-top: 1.5rem; }
label { display: grid; gap: .45rem; color: #dedbd5; font-size: .84rem; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: .7rem; background: #0d0f13; color: var(--text); padding: .72rem .8rem; outline: none; }
textarea { resize: vertical; min-height: 13rem; }
input:focus, textarea:focus, select:focus { border-color: #ff6f80; box-shadow: 0 0 0 3px rgba(223, 51, 70, .14); }
.field-row { display: grid; grid-template-columns: 1fr .55fr; gap: .8rem; }
.hint, .security-note { color: var(--muted); font-size: .75rem; font-weight: 400; }
.check { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .7rem; font-weight: 450; }
.check input { width: 1rem; margin-top: .25rem; accent-color: var(--red); }
button { border: 0; border-radius: .7rem; background: linear-gradient(135deg, #ef4053, #b10d29); color: white; padding: .75rem 1rem; font-weight: 750; cursor: pointer; }
button:hover { filter: brightness(1.08); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(255, 139, 153, .5); outline-offset: 3px; }
.button-secondary { background: transparent; border: 1px solid var(--line); color: var(--text); }
.logout-form { margin: 0; }
.logout-form button { white-space: nowrap; }
.future-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: #6e7076; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.future-actions span { border: 1px solid rgba(255,255,255,.07); border-radius: 999px; padding: .25rem .55rem; }
.errors, .notice { border-radius: .75rem; padding: .85rem 1rem; margin: 1rem 0; }
.errors { background: rgba(172, 24, 45, .22); border: 1px solid rgba(255, 91, 111, .35); }
.errors ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.notice { background: rgba(42, 121, 83, .22); border: 1px solid rgba(120, 213, 167, .3); color: #b7f2d2; }
.login-shell { min-height: calc(100vh - 12rem); display: grid; place-items: center; }
.login-card { width: min(30rem, 100%); }
.login-card h1 { font-size: clamp(2rem, 6vw, 3.5rem); }
.preview-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; color: var(--muted); }
.preview-meta span, .preview-meta code { max-width: 100%; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .55rem; }
.preview pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #0c0e12; border: 1px solid var(--line); border-radius: .8rem; padding: 1.25rem; color: #e8e5de; font-family: inherit; }
.preview dl { display: grid; grid-template-columns: 8rem 1fr; gap: .5rem 1rem; }
.preview dt { color: var(--muted); }
.preview dd { margin: 0; overflow-wrap: anywhere; }
.knowledge-actions { margin: 1.5rem 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: .85rem; background: rgba(255,255,255,.025); }
.knowledge-actions h2 { font-size: 1.05rem; }
.knowledge-actions p { color: var(--muted); }
.action-form { display: grid; gap: .85rem; max-width: 34rem; margin-top: 1rem; }
.danger-zone { border-left: 3px solid var(--red); padding-left: 1rem; }
.danger-zone button { background: #9f1027; }
.row-link { color: var(--text); text-decoration-color: rgba(255,139,153,.45); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(17rem, .55fr); gap: 1.25rem; align-items: start; }
.activity-grid { grid-template-columns: minmax(0, 1.5fr) minmax(18rem, .5fr); }
.detail-grid > * { min-width: 0; }
.compact-head h1 { font-size: clamp(2.2rem, 4.5vw, 3.8rem); }
.detail-list { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 0 1rem; margin: 0; }
.detail-list dt, .detail-list dd { margin: 0; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.detail-list dd { overflow-wrap: anywhere; }
.side-panel { position: sticky; top: 1.25rem; }
.section-spaced { margin-top: 1.25rem; }
.back-link { margin: 1.5rem 0 0; }
.privacy-note { margin: 0 0 1.25rem; border: 1px solid rgba(137, 162, 255, .24); border-radius: .8rem; background: rgba(72, 94, 176, .12); color: #cdd7ff; padding: .85rem 1rem; font-size: .86rem; }
.empty-panel { max-width: 46rem; }
.empty-panel p, .empty-state { color: var(--muted); }
.handoff-list { display: grid; gap: .75rem; }
.handoff-card { display: grid; gap: .65rem; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; background: rgba(8,10,13,.42); }
.handoff-card > div { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.handoff-card p { margin: 0; color: #d8d6d1; font-size: .88rem; }
.badge-row { justify-content: flex-start !important; }
.transcript { display: grid; gap: .8rem; }
.message { width: min(88%, 42rem); border: 1px solid var(--line); border-radius: .9rem; padding: .9rem 1rem; background: rgba(255,255,255,.035); }
.message-outbound { justify-self: end; background: rgba(136, 26, 49, .18); border-color: rgba(223,51,70,.23); }
.message-meta { display: flex; justify-content: space-between; gap: .75rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.message-meta strong { color: #f1e9e6; }
.message p { margin: .5rem 0 0; overflow-wrap: anywhere; }
.usage-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.usage-stat { min-width: 0; display: grid; gap: .35rem; border: 1px solid var(--line); border-radius: .9rem; padding: 1.1rem; background: rgba(20,23,29,.76); box-shadow: 0 1rem 3rem rgba(0,0,0,.16); }
.usage-stat span { color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.usage-stat strong { font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1; letter-spacing: -.04em; overflow-wrap: anywhere; }
.usage-stat small { color: var(--muted); font-size: .76rem; }
.cost-note { margin-bottom: 1.25rem; border-left: 3px solid #879fff; background: rgba(72,94,176,.12); color: #cdd7ff; padding: .85rem 1rem; font-size: .86rem; }
.usage-columns { display: grid; grid-template-columns: minmax(18rem, .7fr) minmax(0, 1.3fr); gap: 1.25rem; align-items: start; }
.usage-columns > * { min-width: 0; }
.language-list { display: grid; gap: 1rem; }
.language-row { display: grid; gap: .65rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.language-row:last-child { padding-bottom: 0; border-bottom: 0; }
.language-measure { display: grid; grid-template-columns: minmax(0, 1fr) 3.5rem; gap: .7rem; align-items: center; }
.language-measure meter { width: 100%; height: .55rem; accent-color: var(--red); }
.language-measure span { color: var(--muted); font-size: .78rem; text-align: right; font-variant-numeric: tabular-nums; }
.warning-text { color: #ffd49a; }
.usage-model-table td, .usage-daily-table td { font-variant-numeric: tabular-nums; }
.client-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.clients-table td { font-variant-numeric: tabular-nums; }
.workspace-entry-form { margin: 0; }
.workspace-entry-form button { padding: .55rem .7rem; white-space: nowrap; }
.current-workspace { display: inline-flex; border: 1px solid rgba(120,213,167,.3); border-radius: 999px; padding: .28rem .55rem; color: #aaf0cb; background: rgba(42,121,83,.18); font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.period-toolbar { display: grid; grid-template-columns: minmax(13rem, 1fr) minmax(9rem, .45fr) minmax(7rem, .3fr) auto; align-items: end; gap: .75rem; margin: 0 0 1.25rem; padding: 1rem; border: 1px solid var(--line); border-radius: .9rem; background: rgba(20,23,29,.76); }
.period-toolbar > div { display: grid; gap: .15rem; }
.period-toolbar > div span { color: #ff9ca8; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.period-toolbar > div strong { font-size: 1.15rem; }
.period-toolbar label { gap: .2rem; font-size: .72rem; color: var(--muted); }
.period-toolbar select, .period-toolbar button { min-height: 2.65rem; padding-block: .5rem; }
.commercial-empty { color: #ffd49a; font-weight: 700; }
.client-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.client-actions a { white-space: nowrap; font-size: .78rem; font-weight: 700; }
.commercial-layout { grid-template-columns: minmax(0, 1.15fr) minmax(18rem, .55fr); }
.commercial-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.accounting-table td { vertical-align: top; }
.accounting-empty { color: var(--muted); }
.accounting-incomplete { color: #ffd49a; font-weight: 750; }
.usage-status { display: inline-flex; width: fit-content; border: 1px solid var(--line); border-radius: 999px; padding: .3rem .55rem; font-size: .68rem; font-weight: 800; line-height: 1; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.usage-status-normal { color: #aaf0cb; border-color: rgba(120,213,167,.35); background: rgba(42,121,83,.18); }
.usage-status-warning { color: #ffd49a; border-color: rgba(255,193,92,.35); background: rgba(165,105,20,.18); }
.usage-status-over { color: #ffacb6; border-color: rgba(239,51,73,.42); background: rgba(139,22,42,.2); }
.usage-status-demo { color: #cdd7ff; border-color: rgba(135,159,255,.35); background: rgba(72,94,176,.12); }
.usage-status-incomplete, .usage-status-unconfigured { color: #d5ced0; background: rgba(255,255,255,.035); }
.cost-accounting-form { gap: 1.15rem; }
.cost-category { min-width: 0; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; }
.cost-category legend { padding: 0 .4rem; font-size: 1rem; font-weight: 800; }
.cost-category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.compact-list { margin-top: 1rem; }
.commercial-layout .compact-list dd { overflow-wrap: normal; white-space: nowrap; }

@media (max-width: 960px) {
  .clients-table thead { display: none; }
  .clients-table, .clients-table tbody { display: block; }
  .clients-table tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
  .clients-table tr { display: grid; align-content: start; gap: .65rem; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; background: rgba(8,10,13,.34); }
  .clients-table td { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .65rem; padding: 0; border: 0; overflow-wrap: anywhere; }
  .clients-table td::before { content: attr(data-label); color: var(--muted); font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
  .clients-table .meta { grid-column: 2; }
}

@media (max-width: 860px) {
  .admin-grid, .detail-grid, .activity-grid, .usage-columns, .commercial-layout { grid-template-columns: 1fr; }
  .usage-stats, .client-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head, .section-head { display: grid; }
  .identity { display: none; }
  .side-panel { position: static; }
  .client-context-bar { align-items: stretch; }
  .client-context-form { min-width: min(24rem, 55vw); }
  .period-toolbar { grid-template-columns: minmax(0, 1fr) minmax(8rem, .45fr) minmax(7rem, .35fr); }
  .period-toolbar > div { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .clients-table tbody { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .admin-nav { flex-wrap: wrap; gap: .55rem; padding-top: .8rem; padding-bottom: .8rem; }
  .section-nav { order: 2; width: 100%; }
  .section-nav a { flex: 1; text-align: center; padding-inline: .2rem; font-size: .76rem; }
  .client-context-bar, .client-context-form { display: grid; width: 100%; min-width: 0; }
  .client-context-form { grid-template-columns: minmax(0, 1fr) auto; }
  .client-context-form label { min-width: 0; }
  .period-toolbar { grid-template-columns: 1fr; }
  .period-toolbar > div { grid-column: auto; }
  .container { padding-top: 2.2rem; }
  .field-row, .commercial-fields, .cost-category-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 2.5rem; }
  .panel { border-radius: .8rem; padding: 1rem; }
  .admin-grid th:nth-child(3), .admin-grid td:nth-child(3) { display: none; }
  .leads-table thead, .activity-table thead, .usage-model-table thead, .usage-daily-table thead { display: none; }
  .leads-table, .activity-table, .usage-model-table, .usage-daily-table, .leads-table tbody, .activity-table tbody, .usage-model-table tbody, .usage-daily-table tbody { display: block; }
  .leads-table tbody, .activity-table tbody, .usage-model-table tbody, .usage-daily-table tbody { display: grid; gap: .8rem; }
  .leads-table tr, .activity-table tr, .usage-model-table tr, .usage-daily-table tr { display: grid; gap: .65rem; padding: .9rem; border: 1px solid var(--line); border-radius: .75rem; background: rgba(8,10,13,.34); }
  .leads-table td, .activity-table td, .usage-model-table td, .usage-daily-table td { display: grid; grid-template-columns: 6.8rem minmax(0, 1fr); gap: .65rem; padding: 0; border: 0; overflow-wrap: anywhere; }
  .leads-table td::before, .activity-table td::before, .usage-model-table td::before, .usage-daily-table td::before { content: attr(data-label); color: var(--muted); font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
  .leads-table .meta, .activity-table .meta, .usage-model-table .meta, .usage-daily-table .meta { grid-column: 2; }
  .clients-table td { grid-template-columns: 7.25rem minmax(0, 1fr); }
  .current-workspace { justify-content: center; text-align: center; white-space: normal; }
  .usage-stats, .client-summary { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list dt { padding-bottom: .15rem; border-bottom: 0; }
  .detail-list dd { padding-top: 0; }
  .message { width: 96%; }
  .message-meta { display: grid; gap: .2rem; }
  .data-boundary { white-space: normal; width: fit-content; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
