@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700;800;900&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #171a19;
  --muted: #616963;
  --line: #d4d7d0;
  --paper: #f2f0e9;
  --white: #fff;
  --night: #181b1a;
  --blue: #3455e8;
  --blue-dark: #2946ca;
  --danger: #a12f3e;
  --font: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
}

body { background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--font); }
h1, h2, h3, .brand, .metric strong { font-family: var(--font); }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.subtle, .help-text { color: var(--muted); }
.notice { color: var(--blue-dark); }
.notice.error { color: var(--danger); }

.app-shell { grid-template-columns: 238px minmax(0, 1fr); background: var(--paper); }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; padding: 29px 17px 24px; border-right: 1px solid var(--line); background: #f8f8f4; color: var(--ink); }
.sidebar .brand { margin: 0 13px 61px; padding: 0; }
.brand { gap: 0; color: var(--ink); font-size: 32px; font-weight: 800; line-height: 1; letter-spacing: -.09em; text-transform: lowercase; }
.brand::after { content: '.'; color: var(--blue); }
.brand-mark { display: none; }
.side-nav { gap: 2px; }
.side-nav a { min-height: 48px; gap: 0; padding: 13px 14px; border-radius: 0; color: #56615a; font-size: 14px; font-weight: 600; transition: background .2s ease, color .2s ease; }
.side-nav a:hover { background: #edeef5; color: var(--ink); }
.side-nav a.active { position: relative; background: #e3e9ff; color: var(--blue-dark); }
.side-nav a.active::before { content: ''; position: absolute; top: 10px; bottom: 10px; left: 0; width: 3px; background: var(--blue); }
.side-nav .nav-glyph { display: none; }
.side-footer { padding: 21px 13px 0; border-top: 1px solid var(--line); }
.side-footer .account-email { color: #515b54; font: 12px/1.5 var(--mono); }
.side-footer button { min-height: 44px; margin-top: 10px; padding: 0; color: var(--blue-dark); font-size: 13px; font-weight: 600; }
.side-footer button:hover { color: var(--ink); }
.mobile-nav { display: none; }

.app-main { padding: 36px clamp(28px, 4vw, 72px) 90px; }
.app-top { min-height: 40px; margin-bottom: 48px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.app-top .breadcrumb { color: #6c746d; font: 500 11px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.app-top .badge { padding: 8px 12px; border: 1px solid #c9d5cd; border-radius: 0; background: #e9efe7; color: #285b42; font-size: 11px; }
.app-top .badge::before { width: 6px; height: 6px; background: #32825b; }
.page-title { align-items: end; margin-bottom: 34px; }
.page-title h1 { margin-bottom: 10px; font-size: clamp(38px, 4.15vw, 62px); font-weight: 700; line-height: 1.06; letter-spacing: -.075em; }
.page-title p { max-width: 620px; color: var(--muted); font-size: 15px; }

.button { min-height: 48px; padding: 11px 18px; border-radius: 0; font-size: 13px; font-weight: 600; transition: background .2s ease, color .2s ease, border-color .2s ease; }
.button:hover { transform: none; }
.button-dark { background: var(--ink); color: #fff; }
.button-dark:hover { background: var(--blue); }
.button-outline { border-color: #aab4aa; background: transparent; color: var(--ink); }
.button-outline:hover { border-color: var(--blue); background: #e8edff; color: var(--blue-dark); }
.button-ghost { border-color: var(--line); background: transparent; color: var(--ink); }
.button-ghost:hover { background: #e8edff; }
.button-danger { border-color: #d9abb1; background: #fff; color: var(--danger); }
.button-small { min-height: 42px; border-radius: 0; }
input, select { min-height: 48px; padding: 11px 14px; border: 1px solid #b8c0b8; border-radius: 0; background: #fff; color: var(--ink); font-size: 14px; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #dce3ff; }
label { color: #424c45; font-size: 13px; font-weight: 600; }

.metric-grid { gap: 1px; margin-bottom: 28px; background: var(--line); border: 1px solid var(--line); }
.metric { position: relative; min-height: 184px; padding: 24px 26px; border: 0; border-radius: 0; background: #fff; }
.metric .label { color: #616a63; font: 500 11px/1.4 var(--mono); letter-spacing: .025em; text-transform: uppercase; }
.metric strong { margin-top: 30px; font-size: clamp(34px, 3vw, 46px); font-weight: 700; letter-spacing: -.06em; }
.metric .detail { margin-top: 6px; color: #6b746d; font-size: 12px; }
.metric.featured { border: 0; background: var(--blue); color: #fff; }
.metric.featured .label, .metric.featured .detail { color: #e0e6ff; }
.metric.featured strong { color: #fff; }
.bar { height: 5px; margin-top: 17px; border-radius: 0; background: rgba(255, 255, 255, .33); }
.bar span { border-radius: 0; background: #fff; }

.split-grid { gap: 20px; }
.panel { min-width: 0; padding: 27px; border: 1px solid var(--line); border-radius: 0; background: #fff; box-shadow: none; }
.panel + .panel { margin-top: 20px; }
.panel-head { align-items: start; margin-bottom: 23px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.055em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.inline-form { gap: 9px; }
.key-list { gap: 0; }
.key-row { padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.key-row:first-child { border-top: 1px solid var(--line); }
.key-row strong { font-size: 14px; }
.key-row small { color: var(--muted); font-size: 12px; }
.status { padding: 5px 8px; border-radius: 0; background: #e8f0ea; color: #286344; font-size: 11px; }
.status.suspended, .status.revoked { background: #f8e8e9; color: var(--danger); }
.status.pending { background: #fff1db; color: #805918; }
.empty { padding: 32px 20px; border: 1px dashed #b9c2b9; border-radius: 0; color: var(--muted); }
.empty strong { color: var(--ink); }
.secret-box { padding: 17px; border: 1px solid #a7b7f2; border-radius: 0; background: #ecf0ff; }
.secret-box p { color: #515e82; }
.table-wrap { max-width: 100%; }
.data-table { font-size: 13px; }
.data-table th { padding: 12px 10px; border-bottom: 1px solid var(--ink); color: #626b64; font: 500 10px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.data-table td { padding: 17px 10px; border-bottom: 1px solid var(--line); }
.data-table tr[data-clickable]:hover { background: #eff2ff; }
.settings-grid { gap: 12px; }
.settings-grid > div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.drawer-form { gap: 18px; }
.help-text { line-height: 1.5; }
.admin-layout { grid-template-columns: minmax(0, 1fr) minmax(310px, 35%); gap: 20px; }
.admin-layout .panel { margin: 0; }
.invite-panel { margin-bottom: 20px; }
.invite-form { display: flex; gap: 10px; }
.invite-form input { flex: 1; min-width: 0; }
.invite-result { margin-top: 20px; }
.invite-credentials { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.invite-credentials code { overflow-wrap: anywhere; font: 600 13px/1.5 var(--mono); }
.invite-credentials button { margin-left: auto; }
@media (max-width: 650px) { .invite-form { flex-direction: column; } .invite-credentials { align-items: stretch; flex-direction: column; } .invite-credentials button { margin-left: 0; } }
.copy-button { min-height: 40px; padding: 8px; color: var(--blue-dark); }

/* Sign in and registration */
.auth-shell { background: var(--paper); }
.auth-art { padding: 47px clamp(35px, 5vw, 84px); background: var(--blue); color: #fff; }
.auth-art::before { content: ''; position: absolute; inset: 0; opacity: .15; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 58px 58px; }
.auth-art::after { right: -135px; bottom: -115px; border-color: rgba(255,255,255,.6); box-shadow: 0 0 0 65px rgba(255,255,255,.035), 0 0 0 140px rgba(255,255,255,.025); }
.auth-art .brand { position: relative; z-index: 1; color: #fff; }
.auth-art .brand::after { color: #fff; }
.auth-art blockquote { font: 700 clamp(44px, 4.5vw, 73px)/1.05 var(--font); letter-spacing: -.075em; }
.auth-art blockquote span { color: #cdd7ff; }
.auth-art .art-bottom { color: #d5ddff; font: 500 11px var(--mono); }
.auth-main { padding: 50px 30px; background: var(--paper); }
.auth-content { width: min(445px, 100%); }
.auth-back { margin-bottom: 62px; color: var(--blue-dark); font-size: 13px; font-weight: 600; }
.auth-back:hover { color: var(--ink); }
.auth-content h1 { margin: 0 0 16px; font-size: clamp(41px, 4vw, 58px); font-weight: 700; line-height: 1.08; letter-spacing: -.07em; }
#register-view > p, #login-view > p, #verify-view > p { margin: 0 0 34px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.auth-form { gap: 20px; }
.auth-form .button { min-height: 54px; margin-top: 12px; justify-content: space-between; }
.auth-switch { margin-top: 30px !important; font-size: 13px !important; }
.auth-switch a { color: var(--blue-dark); }
.auth-note { border-radius: 0; background: #e6ebff; color: #4e5e91; }
.auth-mobile-brand { display: none; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .metric { padding: 21px; }
  .split-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .mobile-top { display: flex; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #f8f8f4; color: var(--ink); }
  .mobile-top .brand { font-size: 28px; }
  .mobile-top .button { min-height: 42px; }
  .mobile-nav { display: flex; gap: 18px; overflow-x: auto; padding: 0 18px; border-bottom: 1px solid var(--line); background: #f8f8f4; scrollbar-width: none; }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav a { display: inline-flex; align-items: center; min-height: 50px; flex: none; border-bottom: 2px solid transparent; color: #535e55; font-size: 13px; font-weight: 600; }
  .mobile-nav a:hover, .mobile-nav a:focus-visible { border-color: var(--blue); color: var(--blue-dark); }
  .app-main { padding: 28px 18px 65px; }
  .app-top { margin-bottom: 32px; }
  .page-title { align-items: start; margin-bottom: 27px; }
  .page-title h1 { font-size: clamp(38px, 8vw, 54px); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric.featured { grid-column: 1 / -1; }
  .metric { min-height: 155px; }
  .panel { padding: 22px; }
  .data-table { min-width: 600px; }
  .admin-layout .data-table { min-width: 520px; }
  .auth-main { display: block; min-height: 100vh; padding: 22px 18px 65px; }
  .auth-mobile-brand { display: inline-flex; margin-bottom: 70px; }
  .auth-back { display: none; }
}
@media (max-width: 450px) {
  .app-top .badge { display: none; }
  .page-title h1 { font-size: 39px; }
  .metric-grid { grid-template-columns: minmax(0, 1fr); }
  .metric.featured { grid-column: auto; }
  .metric { min-height: 142px; }
  .metric strong { margin-top: 20px; }
  .panel { padding: 19px; }
  .inline-form { flex-direction: column; }
  .inline-form button { width: 100%; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .key-row { align-items: start; flex-direction: column; }
  .key-row-actions { width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
