:root {
  color-scheme: dark;
  --bg: #111522;
  --sidebar: #10131d;
  --surface: #181d2b;
  --raised: #1c2232;
  --hover: #242a3b;
  --border: #2a3244;
  --text: #f0f2f7;
  --muted: #a4afc4;
  --subtle: #7987a1;
  --accent: #f4c078;
  --accent-text: #20170d;
  --accent-bg: #382e26;
  --success: #77dcac;
  --warning: #f1c47f;
  --critical: #ffa8ab;
  --info: #9fbaff;
  --focus: #a8c1ff;
  --radius: 14px;
  --shell: 245px;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { min-width: 290px; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, [tabindex] { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--focus); }
[hidden] { display: none !important; }
button { cursor: pointer; }
button:disabled, button[aria-disabled=true] { cursor: not-allowed; }
button:disabled { opacity: .58; }
a { color: var(--info); text-underline-offset: .2em; }
a:hover { color: var(--text); }
p { margin: 0; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 680; letter-spacing: -.025em; }
h1 { font-size: clamp(29px, 3.2vw, 43px); letter-spacing: -.045em; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.mono, code { font-family: var(--mono); overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.align-right { text-align: right; }
.skip { position: fixed; left: 14px; top: -80px; z-index: 20; padding: 10px 16px; border-radius: 8px; background: var(--surface); }
.skip:focus { top: 14px; }

.icon { display: inline-block; flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-lg { width: 22px; height: 22px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand strong { display: block; font-size: 17px; font-weight: 750; letter-spacing: -.035em; }
.brand small { display: block; margin-top: 1px; color: var(--muted); letter-spacing: .025em; }
.brand-mark { position: relative; display: grid; width: 39px; height: 39px; flex: 0 0 auto; place-items: center; border: 1px solid #6b5134; border-radius: 11px; background: radial-gradient(circle at 20% 5%, #534029, #29232b 72%); box-shadow: inset 0 0 10px #f4c07819; }
.brand-mark span { width: 16px; height: 16px; transform: rotate(45deg); border: 1px solid var(--accent); border-radius: 3px; position: relative; }
.brand-mark span::before, .brand-mark span::after { content: ""; position: absolute; background: var(--accent); opacity: .75; }
.brand-mark span::before { width: 1px; height: 11px; left: 6px; top: 1px; }
.brand-mark span::after { height: 1px; width: 11px; left: 1px; top: 6px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--shell) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; border-right: 1px solid #252b3a; background: var(--sidebar); padding: 25px 16px 14px; overflow: auto; }
.sidebar .brand { margin: 1px 5px 25px; }
.nav-group { display: grid; gap: 3px; margin: 0 0 15px; }
.nav-heading { color: var(--subtle); font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 5px 10px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-height: 36px; border: 1px solid transparent; border-radius: 8px; color: #b7c0d3; font-size: 13px; font-weight: 560; text-decoration: none; }
.nav-link:hover { background: #1b2030; color: var(--text); }
.nav-link[aria-current=page] { border-color: #514133; background: linear-gradient(90deg, #342b27, #242330); color: #ffd297; }
.nav-link .icon { width: 17px; height: 17px; }
.side-footer { margin-top: auto; padding: 11px 9px 0; border-top: 1px solid #252b3a; font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-footer .icon { color: var(--subtle); }
.topbar { min-height: 65px; padding: 10px clamp(16px, 3vw, 40px); border-bottom: 1px solid #252b3a; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #141825; }
.crumbs { display: flex; align-items: center; gap: 9px; color: var(--muted); line-height: 1.2; min-width: 0; }
.crumbs strong { color: var(--text); font-weight: 620; }
.crumb-divider { color: #65728b; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.top-clock { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.top-clock .icon { width: 15px; height: 15px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #54483b; border-radius: 8px; flex: 0 0 auto; background: #312923; color: var(--accent); font-size: 12px; font-weight: 760; }
.profile { position: relative; }
.profile summary { display: flex; align-items: center; gap: 9px; list-style: none; cursor: pointer; border-radius: 8px; }
.profile summary::-webkit-details-marker { display: none; }
.profile-name { display: grid; color: var(--text); line-height: 1.2; }
.profile-name small { color: var(--muted); margin-top: 3px; }
.profile-controls { z-index: 4; position: absolute; right: 0; top: calc(100% + 10px); display: grid; min-width: 210px; padding: 7px; border: 1px solid #3a4357; border-radius: 10px; background: var(--raised); box-shadow: 0 12px 30px #0006; }
.profile-controls button { justify-content: flex-start; }
.topbar .menu-toggle, .nav-overlay { display: none; }
.main { max-width: 1660px; margin: 0 auto; padding: 30px clamp(16px, 3vw, 40px) 55px; }
.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 25px; }
.page-intro p { margin-top: 8px; color: var(--muted); max-width: 70ch; }
.page-intro .page-icon { color: var(--accent); margin-bottom: 11px; }
.page-icon { display: flex; gap: 7px; align-items: center; font-size: 12px; font-weight: 680; }
.page-icon .icon { width: 16px; height: 16px; }

.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 170px; padding: 24px clamp(20px, 3vw, 34px); border: 1px solid #3d3b4e; border-radius: 17px; background: radial-gradient(ellipse at 87% 38%, #463735 0%, #272638 34%, transparent 62%), linear-gradient(112deg, #1d2434, #252435); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hero-copy { position: relative; z-index: 2; }
.hero-date { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: #f2bf87; font-size: 12px; font-weight: 670; }
.hero-date .icon { width: 15px; height: 15px; }
.hero h1 { margin-bottom: 8px; }
.hero p { color: #bbc5d8; }
.hero .button { position: relative; z-index: 2; white-space: nowrap; }
.hero-decoration { pointer-events: none; position: absolute; right: 9%; width: 290px; height: 290px; top: calc(50% - 145px); border: 1px solid #a68d6970; border-radius: 50%; opacity: .38; transform: rotate(-17deg); }
.hero-decoration::before, .hero-decoration::after { position: absolute; content: ""; border: 1px solid #bca87980; inset: 20px; border-radius: 50%; }
.hero-decoration::after { inset: 44px; transform: rotate(45deg); border-radius: 12px; background: linear-gradient(120deg, #a7773830, transparent, #ab76582c); }
.hero-decoration i { display: block; position: absolute; transform: rotate(45deg); top: 40%; left: 40%; width: 20%; height: 20%; border: 1px solid #efbc81; border-radius: 8%; box-shadow: 0 0 38px #dcab7080, inset 0 0 22px #dcab7040; }
.hero-decoration b { inset: -18px; position: absolute; border: 1px dashed #bb946456; border-radius: 50%; }
.dashboard { display: grid; gap: 19px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { min-width: 0; min-height: 124px; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: grid; align-content: start; gap: 4px; }
.metric-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 590; }
.metric-icon { display: grid; place-items: center; color: var(--info); background: #252e45; border: 1px solid #303d57; border-radius: 8px; width: 29px; height: 29px; flex: 0 0 auto; }
.metric-icon .icon { width: 15px; height: 15px; }
.metric-icon.amber { color: var(--accent); background: #342d29; border-color: #4a3d33; }
.metric-icon.green { color: var(--success); background: #233531; border-color: #344941; }
.metric-value { font-size: clamp(20px, 2.4vw, 29px); line-height: 1.1; font-weight: 730; letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric-note { color: var(--subtle); font-size: 11px; margin-top: 3px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px; border-bottom: 1px solid var(--border); }
.panel-title { display: flex; align-items: flex-start; gap: 9px; }
.panel-title > .icon { color: var(--accent); margin-top: 2px; }
.panel-title p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px 18px; }
.panel .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.panel .table-wrap td:first-child, .panel .table-wrap th:first-child { padding-left: 18px; }
.panel .table-wrap td:last-child, .panel .table-wrap th:last-child { padding-right: 18px; }
.stack { display: grid; gap: 16px; }
.compact-stack { display: grid; gap: 10px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stat-list { display: grid; grid-template-columns: 1fr auto; gap: 10px 18px; margin: 0; }
.stat-list dt { color: var(--muted); }
.stat-list dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.stat-list dt:not(:first-child), .stat-list dd:not(:nth-child(2)) { border-top: 1px solid #2a3244; padding-top: 9px; }
.quick-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick-link { text-decoration: none; display: flex; gap: 9px; align-items: center; min-height: 49px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 9px; background: #181d29; color: var(--text); font-size: 13px; font-weight: 620; }
.quick-link:hover { background: var(--hover); border-color: #47516a; }
.quick-link .icon:first-child { color: var(--accent); }
.quick-link .icon:last-child { margin-left: auto; color: var(--muted); width: 14px; height: 14px; }
.activity-list { padding: 3px 17px; }
.activity { display: grid; align-items: start; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 8px; padding: 12px 0; }
.activity + .activity { border-top: 1px solid var(--border); }
.activity .detail { line-height: 1.25; min-width: 0; }
.activity .detail strong { font-size: 13px; font-weight: 620; display: block; }
.activity time { color: var(--muted); font-size: 11px; text-align: right; }
.activity p { color: var(--muted); font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }

.toolbar, .actions, .inline-list { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.toolbar { padding: 13px; gap: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.toolbar .search { flex: 1 1 220px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 12px; border-radius: 8px; border: 1px solid #3b455b; background: #222939; color: var(--text); font-size: 12px; text-decoration: none; font-weight: 660; line-height: 1.3; }
.button:hover { background: #2d364b; color: var(--text); border-color: #53617c; }
.button.primary { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.button.primary:hover { color: var(--accent-text); background: #ffd399; border-color: #ffd399; }
.button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.button.ghost:hover { background: var(--hover); color: var(--text); }
.button.danger { background: #3b252c; border-color: #764650; color: #ffc1c4; }
.button.danger:hover { background: #51313b; }
.button.icon-button { padding: 7px; width: 35px; min-height: 35px; }
.button .icon { width: 15px; height: 15px; }
.button.compact { min-height: 29px; padding: 4px 8px; }
.button[aria-disabled=true] { opacity: .6; }
.row-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration-color: #8190ac; font-weight: 620; }
.badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #424e64; padding: 3px 8px; border-radius: 20px; color: #c3cee0; background: #242b3b; white-space: nowrap; font-size: 11px; font-weight: 620; line-height: 1.25; }
.badge::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; flex: 0 0 auto; }
.badge.ok { color: var(--success); border-color: #35574c; background: #223631; }
.badge.warn { color: var(--warning); border-color: #604d31; background: #3a3027; }
.badge.error { color: var(--critical); border-color: #68424c; background: #3a2932; }
.badge.info { color: var(--info); border-color: #3a5279; background: #27334c; }
.notice { display: flex; align-items: flex-start; gap: 10px; color: #bfcbe3; background: #222c41; border: 1px solid #34476a; border-radius: 10px; padding: 11px 13px; }
.notice .icon { margin-top: 2px; color: var(--info); }
.notice.error { color: #ffc1c6; border-color: #754651; background: #3a2632; }
.notice.error .icon { color: var(--critical); }
.notice.warn { color: #f5d5a5; border-color: #6b5439; background: #342a28; }
.notice.warn .icon { color: var(--warning); }
.notice.ok { color: #b2ebce; border-color: #3c6555; background: #22382f; }
.notice.ok .icon { color: var(--success); }
.loading, .empty { color: var(--muted); padding: 29px 18px; text-align: center; }
.empty { display: grid; justify-items: center; gap: 7px; }
.empty strong { color: var(--text); font-size: 14px; }
.empty .icon { width: 24px; height: 24px; color: var(--subtle); }
.loading::before { display: inline-block; vertical-align: -.2em; margin-right: 8px; content: ""; width: 15px; height: 15px; border: 2px solid #515e78; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); background: #1e2433; font-size: 11px; line-height: 1.3; font-weight: 690; white-space: nowrap; letter-spacing: .01em; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #1c2230; }
.cell-secondary { margin-top: 2px; color: var(--subtle); font-size: 11px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.structured { padding: 9px 12px; border: 1px solid var(--border); background: #141927; border-radius: 8px; }
details summary { cursor: pointer; font-weight: 640; }
.structured summary { color: var(--muted); }
pre { margin: 10px 0 0; max-height: 355px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.5 var(--mono); color: #d3ddf2; }
.log-lines { max-height: 460px; padding: 14px; margin: 0; border: 1px solid var(--border); border-radius: 8px; background: #0e1320; }
.preview { padding: 13px; border: 1px solid #3b455b; border-radius: 9px; background: #202638; color: #d6e0f1; }
.preview h3 { margin-bottom: 7px; color: var(--text); }
.preview p { white-space: pre-wrap; overflow-wrap: anywhere; }
.definition { padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: #1b2130; }
.definition > .compact-stack { margin-top: 12px; }
.definition header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.field { display: grid; gap: 5px; font-size: 13px; color: #dce3f0; font-weight: 620; min-width: 0; }
.field input, .field select, .field textarea, .search { display: block; width: 100%; min-width: 0; background: #111725; color: var(--text); padding: 9px 10px; border: 1px solid #3b465c; border-radius: 7px; min-height: 37px; font-weight: 450; }
.field input[type=checkbox] { width: 16px; min-height: 16px; accent-color: var(--accent); }
.field.check { display: flex; align-items: center; gap: 7px; align-self: end; min-height: 37px; }
.field input::placeholder, .field textarea::placeholder, .search::placeholder { color: #8895ae; }
.field textarea { resize: vertical; min-height: 82px; }
.field small { color: var(--muted); font-weight: 450; }
.field.full { grid-column: 1 / -1; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.filters .field { font-size: 11px; align-self: end; }
.filters .field input, .filters .field select { min-height: 35px; }
.filters .field.grow { flex: 1 1 190px; }
.filters > button { align-self: end; }
fieldset { min-width: 0; margin: 0; padding: 11px; border: 1px solid var(--border); border-radius: 8px; }
legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.attachment { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(85px, 120px) auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.attachment .button { align-self: end; }
dialog { width: min(660px, calc(100vw - 24px)); max-height: calc(100dvh - 28px); padding: 0; color: var(--text); border-radius: 14px; border: 1px solid #4a5368; background: var(--surface); box-shadow: 0 30px 100px #0009; }
dialog::backdrop { background: #080b14c2; backdrop-filter: blur(3px); }
.dialog-header { padding: 18px 19px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog-body { padding: 17px 19px 19px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 1px; }
.form-error:empty { display: none; }
.notifications { position: fixed; z-index: 8; right: 17px; bottom: 17px; width: min(390px, calc(100% - 34px)); display: grid; gap: 8px; pointer-events: none; }
.notifications .notice { box-shadow: 0 8px 30px #0006; pointer-events: auto; }
.notifications .notice .button { margin-left: auto; min-height: 24px; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(370px, 1fr) minmax(0, 1fr); }
.login-side { display: flex; flex-direction: column; padding: clamp(20px, 5vw, 67px); gap: 26px; }
.login-card { margin: auto; width: min(100%, 390px); }
.login-card h1 { margin-bottom: 10px; }
.login-card p { margin-bottom: 23px; color: var(--muted); }
.login-card .button { width: 100%; min-height: 42px; }
.login-art { position: relative; isolation: isolate; display: grid; align-content: center; justify-items: center; overflow: hidden; min-height: 250px; margin: 13px; border-radius: 20px; border: 1px solid #443e50; background: radial-gradient(circle at 51% 47%, #63483b, #312940 34%, #1d2639 67%, #151a2b 95%); }
.login-art .hero-decoration { top: auto; right: auto; width: min(55vw, 460px); height: min(55vw, 460px); opacity: .8; }
.login-art .brand-mark { width: 89px; height: 89px; border-radius: 23px; box-shadow: 0 0 70px #f6bf7d58; }
.login-art .brand-mark span { width: 33px; height: 33px; }
.login-art .brand-mark span::before { left: 15px; top: 6px; height: 19px; }
.login-art .brand-mark span::after { top: 15px; left: 6px; width: 19px; }
.map-week { display: grid; grid-template-columns: repeat(7, minmax(90px, 1fr)); gap: 1px; background: var(--border); overflow: auto; }
.day { padding: 8px; min-height: 88px; background: var(--surface); display: grid; align-content: start; gap: 5px; }
.day > strong { color: var(--muted); font-size: 12px; }
.day.today { background: #25283a; }
.day a { display: block; color: #cfdbf1; font-size: 11px; border-left: 2px solid #a28358; border-radius: 2px; padding: 3px 5px; background: #2e2c36; overflow-wrap: anywhere; }
.day .more { color: var(--subtle); font-size: 11px; }

@media (max-width: 1100px) {
  :root { --shell: 212px; }
  .metric-grid { gap: 9px; }
  .metric { padding: 13px 10px; }
  .quick-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-name { display: none; }
}
@media (max-width: 850px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: min(var(--shell), 90vw); height: 100dvh; transform: translateX(-105%); transition: transform .18s ease; visibility: hidden; }
  .sidebar.open { transform: translateX(0); visibility: visible; }
  .nav-overlay.visible { display: block; position: fixed; inset: 0; z-index: 9; background: #080a10b8; border: 0; border-radius: 0; }
  .topbar .menu-toggle { display: inline-flex; }
  .crumb-root, .crumb-divider { display: none; }
  .topbar { min-height: 58px; }
  .hero { min-height: 146px; }
}
@media (max-width: 620px) {
  .top-actions { gap: 8px; }
  .top-clock { display: none; }
  .hero { align-items: flex-start; flex-direction: column; gap: 15px; padding: 17px; }
  .hero-decoration { right: -110px; opacity: .25; }
  .dashboard-grid, .split { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 112px; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .main { padding-top: 20px; }
  .login { display: block; }
  .login-side { min-height: 100dvh; padding: 21px; }
  .login-art { display: none; }
}
@media (max-width: 385px) {
  .fields { grid-template-columns: 1fr; }
  .attachment { grid-template-columns: 1fr; }
  .quick-links { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
.icon-knob { fill: var(--sidebar); }
