:root {
  color-scheme: dark;
  --surface: #101820;
  --background: #0a1017;
  --raised: #141e29;
  --border: #263341;
  --text: #eef4fa;
  --muted: #9eafbf;
  --accent: #64e6c5;
  --blue: #8bb7fd;
  --amber: #f4c082;
  --danger: #ff9b9f;
  --radius: 12px;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; background: var(--background); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
h1, h2, h3, p, dl, dd { margin: 0; }
h2 { font-size: 16px; line-height: 1.35; font-weight: 670; }
h3 { font-size: 15px; }
p { line-height: 1.52; }
.muted { color: var(--muted); }
.monospace { font-family: var(--mono); }
.shell { min-height: 100dvh; display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  background: #0d151d; border-right: 1px solid var(--border); padding: 27px 14px 16px; z-index: 2;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); font-weight: 760; letter-spacing: .08em; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); font-weight: 760; }
.brand-mark {
  display: inline-flex; align-items: end; justify-content: center; gap: 3px;
  width: 34px; height: 34px; padding-bottom: 8px; border-radius: 8px;
  border: 1px solid #30594f; background: #112628; flex: none;
}
.brand-mark i { display: block; background: var(--accent); width: 3px; height: 8px; border-radius: 1px; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 18px; }
.sidebar > .brand { margin-left: 11px; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; margin-top: 32px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; min-height: 43px;
  color: var(--muted); border: 1px solid transparent; border-radius: 7px; font-weight: 560;
}
.sidebar nav a:hover { text-decoration: none; color: var(--text); background: var(--surface); }
.sidebar nav a[aria-current] { color: var(--accent); background: #132826; border-color: #26453e; }
.nav-symbol { flex: 0 0 17px; font-family: var(--mono); font-size: 18px; text-align: center; line-height: 1; }
.identity { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 3px 0; display: flex; align-items: center; gap: 9px; }
.identity > div { overflow: hidden; }
.identity strong, .identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.5; }
.identity small { color: var(--muted); font-size: 11px; }
.identity form { margin-left: auto; flex: none; }
.avatar { display: grid; place-items: center; background: var(--raised); border: 1px solid var(--border); width: 34px; height: 34px; border-radius: 50%; flex: none; }
.signout, .link-button { color: var(--muted); background: transparent; border: none; padding: 7px; }
.signout { font-size: 19px; min-width: 36px; min-height: 36px; }
.signout:hover, .link-button:hover { color: var(--accent); }
.main { padding: 34px clamp(20px, 3.3vw, 54px) 56px; width: 100%; max-width: 1720px; margin-inline: auto; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-head > div { min-width: 0; }
h1 { font-size: clamp(27px, 3vw, 40px); letter-spacing: -.04em; line-height: 1.1; font-weight: 720; }
.subtitle { color: var(--muted); margin-top: 7px; overflow-wrap: anywhere; }
.freshness {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 999px;
  flex: none; color: var(--muted); padding: 7px 11px; font-size: 12px; white-space: nowrap; background: var(--surface);
}
.freshness i, .status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.freshness.live i, .status-active .status-dot { background: var(--accent); box-shadow: 0 0 10px #58e4bf55; }
.freshness.stale i, .status-waiting .status-dot, .status-unknown .status-dot { background: var(--amber); }
.status-failed .status-dot { background: var(--danger); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { --signal: var(--accent); padding: 15px 16px 13px; border-top: 2px solid var(--signal); }
.metric.ram { --signal: var(--blue); }
.metric.disk { --signal: var(--amber); }
.metric.swap { --signal: #c3abff; }
.metric h2 { font-size: 13px; color: var(--muted); }
.metric-value { font-size: clamp(23px, 2.65vw, 39px); font-weight: 690; font-variant-numeric: tabular-nums; letter-spacing: -.06em; margin-top: 7px; white-space: nowrap; }
.metric-value small { font-size: .52em; font-weight: 550; margin-left: 3px; color: var(--muted); letter-spacing: 0; }
.metric p { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; margin-top: 7px; }
meter { display: block; width: 100%; height: 5px; margin-top: 12px; background: #24313d; border-radius: 3px; border: 0; }
meter::-webkit-meter-bar { background: #24313d; height: 5px; border: 0; border-radius: 3px; }
meter::-webkit-meter-optimum-value { background: var(--signal, var(--accent)); border-radius: 3px; }
meter::-moz-meter-bar { background: var(--signal, var(--accent)); border-radius: 3px; }
.notice, .error { background: #30241b; color: #fed5a7; border: 1px solid #674b34; border-radius: 8px; padding: 11px 13px; margin-bottom: 14px; }
.error { background: #331e28; color: #ffbdbe; border-color: #6e3c4a; }
.issues { margin-top: 14px; padding: 15px 16px; }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.card-head a { font-size: 12px; flex: none; padding-block: 2px; }
.card-head p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.issue-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.issue-list a, .pill {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 8px;
  color: var(--muted); background: var(--raised); border: 1px solid var(--border); border-radius: 6px; font-size: 12px;
}
.issue-list .status-failed { color: var(--danger); background: #241b24; border-color: #583541; }
.issue-list .status-unknown { color: var(--amber); }
.chart-grid, .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.chart-grid .graph { padding: 15px 15px 9px; overflow: hidden; }
.chart { min-height: 170px; margin-top: 12px; }
.chart > .muted { padding: 18px 2px; }
.uplot { color: var(--muted); font-family: var(--mono); }
.uplot .u-legend { font-size: 11px; text-align: center; }
.uplot .u-legend .u-series > * { padding: 2px 2px; }
.uplot .u-legend .u-marker { width: .55em; height: .55em; }
.facts { padding: 15px 16px; }
.facts dl { display: grid; grid-template-columns: minmax(95px, 1fr) minmax(0, 1.8fr); gap: 0 12px; margin-top: 9px; font-size: 13px; }
.facts dt, .facts dd { padding: 8px 0; border-bottom: 1px solid #202c38; min-width: 0; }
.facts dt { color: var(--muted); }
.facts dd { text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.segmented button { border: 0; border-radius: 5px; padding: 6px 9px; min-height: 32px; background: transparent; color: var(--muted); white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: #203936; color: var(--accent); }
.history-note { font-size: 12px; margin-top: 4px; }
.history-note:empty { display: none; }
.live-detail { margin-top: 20px; }
.core-bars { display: grid; gap: 9px; margin-top: 14px; }
.core-row { display: grid; grid-template-columns: 47px minmax(0, 1fr) 49px; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; color: var(--muted); }
.core-row meter { margin: 0; }
.core-row span:last-child { text-align: right; }
.process-table, .file-table { margin-top: 9px; width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.process-table td, .process-table th, .file-table th, .file-table td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.process-table th:first-child, .process-table td:first-child, .file-table :is(th, td):first-child { text-align: left; }
.process-table th, .file-table th { color: var(--muted); font-size: 12px; font-weight: 550; }
.process-table tr > :first-child { width: 51%; }
.process-table tr > :nth-child(2) { width: 19%; }
.toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 17px; }
.toolbar label { min-width: 130px; max-width: 100%; }
.toolbar label:has(input[type="search"]) { flex: 1 1 180px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
input, select, .button {
  width: 100%; min-width: 0; color: var(--text); background: #111b25; border: 1px solid #334352;
  border-radius: 7px; min-height: 38px; padding: 7px 9px;
}
input::placeholder { color: #889bab; }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px; width: auto; font-weight: 590;
  white-space: nowrap; text-decoration: none; font-size: 13px;
}
.button:hover:enabled, a.button:hover { background: #1b2a37; text-decoration: none; }
.button.primary { background: var(--accent); color: #09231e; border-color: var(--accent); font-weight: 710; }
.button.primary:hover:enabled { background: #a0f4df; }
.button.danger { color: var(--danger); }
.button:disabled { opacity: .5; cursor: default; }
.service-group { margin-top: 20px; }
.service-group > h2 { margin-bottom: 9px; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 10px; }
.service { padding: 13px; }
.service h3 { overflow-wrap: anywhere; }
.service .pill { flex: none; }
.service > .muted { font-size: 11px; margin-top: 6px; overflow-wrap: anywhere; }
.service dl { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.service dl > div { display: grid; gap: 2px; padding-right: 8px; }
.service dd { color: var(--text); }
.service .links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 11px; font-size: 13px; }
.status-failed { color: var(--danger); }
.status-active { color: var(--accent); }
.status-waiting, .status-unknown { color: var(--amber); }
.log-filters label { min-width: min(140px, 100%); }
#log-custom { display: contents; }
.log-head { align-items: center; padding: 11px 13px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.log-actions { display: flex; gap: 7px; }
#log-window { height: min(57vh, 620px); min-height: 270px; overflow: auto; overscroll-behavior: contain; }
.log-entry { border-bottom: 1px solid #212e3a; font-size: 12px; }
.log-entry summary { display: grid; grid-template-columns: 66px minmax(80px, 13em) 64px minmax(0, 1fr); gap: 8px; padding: 9px 12px; list-style: none; }
.log-entry summary::-webkit-details-marker { display: none; }
.log-entry summary:hover { background: var(--raised); }
.log-entry time, .log-source, .log-level { color: var(--muted); }
.log-entry .clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-entry p { padding: 6px 12px 13px; color: #d7e6f3; font-family: var(--mono); overflow-wrap: anywhere; white-space: pre-wrap; }
.log-level.error-level { color: var(--danger); }
.log-level.warn-level { color: var(--amber); }
.log-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px; padding: 9px 12px; color: var(--muted); border-top: 1px solid var(--border); font-size: 12px; }
.empty { padding: 12px 8px; color: var(--muted); }
.catalog-layout, .access-layout { display: grid; grid-template-columns: minmax(180px, 235px) minmax(0, 1fr); gap: 14px; align-items: start; }
.project-list, .catalog-file { padding: 14px; }
.project-list a { display: block; padding: 10px 8px; margin-top: 4px; border-radius: 5px; color: var(--muted); }
.project-list a[aria-current] { background: #132826; color: var(--accent); }
.catalog-base { font-size: 12px; margin-top: 5px; overflow-wrap: anywhere; }
.breadcrumbs { display: flex; gap: 7px; flex-wrap: wrap; overflow-wrap: anywhere; font-size: 13px; margin: 14px 0; }
.breadcrumbs a { min-width: 0; }
.file-table tr > :nth-child(2) { width: 19%; }
.file-table tr > :nth-child(3) { width: 27%; }
.mobile-date { display: none; }
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.pager > span { margin-right: auto; }
.access-layout { grid-template-columns: minmax(230px, .8fr) minmax(0, 1.2fr); }
.form { display: grid; gap: 12px; margin-top: 14px; }
.form.compact { margin-top: 8px; }
.form input:not([type="checkbox"]) { min-height: 42px; }
fieldset { border: 1px solid var(--border); border-radius: 7px; padding: 8px 11px; margin: 0; min-width: 0; }
legend { color: var(--muted); font-size: 12px; padding: 0 3px; }
.checkbox { display: flex; align-items: center; gap: 7px; min-height: 32px; }
.checkbox input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--accent); }
.guest { padding-block: 12px; border-bottom: 1px solid var(--border); }
.guest fieldset, .guest-actions, .invite { margin-top: 8px; }
.guest-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#copy-invite { margin-top: 6px; }
.auth-shell { display: grid; place-items: center; padding: 20px; min-height: 100dvh; background: radial-gradient(ellipse at 50% 25%, #12282c 0, var(--background) 52%); }
.auth-card { width: min(100%, 420px); border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: clamp(19px, 5vw, 30px); }
.auth-card h1 { margin-top: 20px; font-size: 30px; }
.auth-card p { color: var(--muted); margin-top: 9px; }
.auth-card .error { color: #ffbdbe; }
.auth-card .qr { display: block; max-width: 100%; height: auto; margin: 12px auto 5px; border-radius: 7px; }
.manual-key { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.manual-key code { display: block; margin-top: 6px; color: var(--text); }

@media (max-width: 1040px) {
  .shell { grid-template-columns: 163px minmax(0, 1fr); }
  .sidebar { padding-inline: 8px; }
  .main { padding-inline: 19px; }
  .metric { padding-inline: 11px; }
}
@media (max-width: 850px) {
  .shell { display: block; }
  .sidebar { position: relative; height: auto; padding: 11px 16px 9px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar > .brand { margin: 0; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 4px; margin: 0; }
  .sidebar nav a { padding: 6px 9px; min-height: 40px; gap: 5px; font-size: 13px; }
  .identity { border: 0; padding: 0; margin: 0; max-width: 175px; }
  .identity .avatar { display: none; }
  .main { padding: 24px 16px 36px; }
}
@media (max-width: 630px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric-value { font-size: clamp(21px, 6vw, 33px); }
  .chart-grid, .detail-grid, .catalog-layout, .access-layout { grid-template-columns: minmax(0, 1fr); }
  .chart { min-height: 154px; }
  .page-head { align-items: flex-start; flex-wrap: wrap; margin-bottom: 15px; }
  .freshness { padding: 5px 8px; font-size: 11px; }
  .sidebar nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar nav a { padding-inline: 6px; }
  .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .toolbar label, .log-filters label { min-width: 0; }
  .log-filters > button { align-self: end; }
  .log-entry summary { grid-template-columns: 56px minmax(0, 1fr) 52px; gap: 4px 6px; padding: 8px 9px; }
  .log-entry .log-preview { grid-column: 1 / -1; }
  .file-table :is(th, td):nth-child(3) { display: none; }
  .file-table tr > :nth-child(2) { width: 25%; }
  .mobile-date { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
  .section-head { flex-wrap: wrap; }
}
@media (max-width: 330px) {
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding-inline: 10px; }
  .toolbar { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: background-color .15s, color .15s; }
}
