:root {
  --black: #070809;
  --surface: #101214;
  --surface-2: #171a1d;
  --line: rgba(234, 231, 222, .12);
  --line-strong: rgba(234, 231, 222, .2);
  --ivory: #eae7de;
  --muted: #92969a;
  --gold: #e5bd61;
  --good: #81b995;
  --warning: #d8ae63;
  --danger: #c77870;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body { margin: 0; color: var(--ivory); background: var(--black); font-family: Inter, "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 20px; border-right: 1px solid var(--line); background: #0a0b0c; }
.brand { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 8px; }
.brand img { width: 42px; height: 34px; object-fit: contain; }
.brand strong { font-size: 18px; letter-spacing: .14em; }
.product-label { display: block; margin: 22px 8px 12px; color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.nav { display: grid; gap: 5px; }
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 13px; border: 1px solid transparent; border-radius: 10px; color: #b4b7b9; font-size: 14px; }
.nav a:hover { color: var(--ivory); background: rgba(255,255,255,.025); }
.nav a.active { color: var(--ivory); border-color: rgba(229,189,97,.28); background: rgba(229,189,97,.065); }
.sidebar-footer { position: absolute; left: 20px; right: 20px; bottom: 24px; padding: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.55; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 72px; padding: 0 34px; display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); background: rgba(7,8,9,.94); }
.menu-button { display: none; padding: 8px; color: var(--ivory); border: 0; background: none; font-size: 22px; }
.context { margin-right: auto; }
.context strong { display: block; font-size: 14px; font-weight: 600; }
.context span { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--gold); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.avatar:hover { border-color: rgba(229,189,97,.48); }

.auth-required .app-shell { visibility: hidden; }
.auth-required.auth-ready .app-shell { visibility: visible; }
.auth-view { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: var(--black); }
.auth-card { width: min(100%, 440px); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.auth-brand { display: inline-flex; align-items: center; gap: 11px; }
.auth-brand img { width: 42px; height: 34px; object-fit: contain; }
.auth-brand strong { font-size: 17px; letter-spacing: .14em; }
.auth-copy { margin: 42px 0 28px; }
.auth-copy span { color: var(--gold); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.auth-copy h1 { margin: 12px 0 10px; font-size: clamp(26px, 6vw, 34px); font-weight: 470; letter-spacing: -.025em; }
.auth-copy p, .auth-footnote { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { margin-top: 5px; color: #b8bbbd; font-size: 12px; }
.auth-form input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; outline: 0; color: var(--ivory); background: #0b0d0e; }
.auth-form input:focus { border-color: rgba(229,189,97,.58); }
.auth-form input[readonly] { color: var(--muted); }
.code-field { display: grid; gap: 10px; }
.auth-error { margin: 4px 0 0; color: var(--danger); font-size: 12px; line-height: 1.45; }
.auth-submit { min-height: 48px; margin-top: 10px; border: 1px solid var(--gold); border-radius: 10px; color: #111; background: var(--gold); font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-submit:disabled { opacity: .55; cursor: wait; }
.auth-reset { justify-self: center; padding: 8px; border: 0; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.auth-reset:hover { color: var(--ivory); }
.auth-footnote { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.modal-layer { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.72); }
.modal { width: min(100%, 460px); padding: 26px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.modal-head h2 { margin: 0; font-size: 21px; font-weight: 550; }
.modal-head button { width: 34px; height: 34px; border: 0; color: var(--muted); background: transparent; font-size: 25px; cursor: pointer; }
.modal form { display: grid; gap: 14px; }
.modal label { display: grid; gap: 8px; color: #b8bbbd; font-size: 12px; }
.modal input, .modal select { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 9px; outline: 0; color: var(--ivory); background: #0b0d0e; }
.modal input:focus, .modal select:focus { border-color: rgba(229,189,97,.58); }

.content { width: min(100% - 68px, 1320px); margin-inline: auto; padding: 42px 0 70px; }
.page-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 30px; }
.page-head h1 { margin: 0 0 8px; font-size: clamp(27px, 3vw, 38px); font-weight: 450; letter-spacing: -.025em; }
.page-head p { margin: 0; color: var(--muted); line-height: 1.5; }
.button { min-height: 42px; padding: 0 18px; border: 1px solid rgba(229,189,97,.55); border-radius: 999px; color: var(--gold); background: transparent; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.button:disabled { opacity: .48; cursor: not-allowed; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.metric { min-height: 126px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 20px; font-size: 30px; font-weight: 430; }
.metric small { color: var(--good); font-size: 11px; }
.metric small.neutral { color: var(--muted); }

.grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 16px; }
.panel { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.panel-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 18px; }
.panel h2 { margin: 0; font-size: 17px; font-weight: 600; }
.panel-head span { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 15px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.tag { display: inline-flex; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 999px; color: #b8bbbd; font-size: 11px; }
.tag.good { color: var(--good); border-color: rgba(129,185,149,.3); }
.tag.warning { color: var(--warning); border-color: rgba(216,174,99,.3); }
.list { display: grid; }
.list-item { padding: 15px 0; display: grid; grid-template-columns: 1fr auto; gap: 14px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item strong { font-size: 13px; font-weight: 550; }
.list-item span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.list-item time { color: var(--muted); font-size: 11px; }
.empty-note { padding: 28px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; width: min(82vw, 290px); transform: translateX(-102%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; }
  .topbar { padding: 0 16px; }
  .status { display: none; }
  .content { width: min(100% - 28px, 1320px); padding-top: 30px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 112px; padding: 18px; }
  .metric strong { margin-top: 15px; font-size: 25px; }
  .panel { padding: 18px; }
}

@media (max-width: 460px) {
  .metrics { grid-template-columns: 1fr; }
  .auth-view { padding: 0; }
  .auth-card { min-height: 100vh; width: 100%; padding: 28px 20px; border: 0; border-radius: 0; }
}
