:root {
  --ink-950: #12201b;
  --ink-900: #172820;
  --ink-800: #23392f;
  --ink-700: #365044;
  --paper-50: #fbfaf5;
  --paper-100: #f4f1e7;
  --paper-200: #e8e2d2;
  --paper-300: #d4cbb7;
  --jade-700: #24634e;
  --jade-600: #2d7b60;
  --jade-100: #dcebe2;
  --cinnabar-700: #9e3628;
  --cinnabar-600: #b74735;
  --cinnabar-100: #f4dfd8;
  --brass-700: #8a682c;
  --brass-500: #ba9148;
  --brass-100: #f2e7cc;
  --blue-700: #315b74;
  --blue-100: #dce9ef;
  --danger: #b13d30;
  --text: #1b2923;
  --muted: #6d766e;
  --line: #d9d3c5;
  --white: #fffefa;
  --shadow: 0 12px 36px rgba(27, 41, 35, .08);
  --font-display: "STKaiti", "KaiTi", "Songti SC", "Noto Serif CJK SC", serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--text); background: var(--paper-100); font: 14px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

.login-view { min-height: 100dvh; display: grid; grid-template-columns: minmax(360px, 500px) 1fr; background: var(--paper-50); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(36px, 7vw, 92px); border-right: 1px solid var(--line); }
.login-brand { margin-bottom: 52px; }
.seal { width: 58px; height: 58px; display: inline-grid; place-items: center; margin-bottom: 24px; color: var(--white); background: var(--cinnabar-600); border: 2px solid rgba(255,255,255,.5); outline: 1px solid var(--cinnabar-600); font: 32px/1 var(--font-display); box-shadow: inset 0 0 0 4px var(--cinnabar-600), inset 0 0 0 5px rgba(255,255,255,.55); transform: rotate(-2deg); }
.seal-small { width: 38px; height: 38px; margin: 0; font-size: 22px; box-shadow: inset 0 0 0 2px var(--cinnabar-600), inset 0 0 0 3px rgba(255,255,255,.5); }
.login-brand h1 { margin: 0; font: 54px/1.1 var(--font-display); font-weight: 600; letter-spacing: .08em; }
#login-form { display: grid; gap: 8px; }
#login-form label { margin-top: 14px; color: var(--ink-700); font-size: 12px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid var(--paper-300); border-radius: 3px; color: var(--text); background: var(--white); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: #b8ae99; }
input:focus, select:focus, textarea:focus, button:focus-visible { border-color: var(--jade-600); box-shadow: 0 0 0 3px rgba(45,123,96,.14); outline: none; }
.login-foot { margin: 28px 0 0; color: var(--muted); font-size: 11px; letter-spacing: .16em; }
.login-atmosphere { position: relative; overflow: hidden; min-height: 100%; background: var(--ink-950); }
.map-grid { position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px); background-size: 58px 58px; transform: perspective(700px) rotateX(25deg) scale(1.2); transform-origin: center; }
.territory { position: absolute; border: 1px solid rgba(186,145,72,.75); background: rgba(36,99,78,.45); clip-path: polygon(8% 24%, 35% 4%, 69% 12%, 95% 39%, 88% 76%, 61% 96%, 29% 89%, 3% 63%); }
.territory::after { content: ""; position: absolute; inset: 10px; border: 1px dashed rgba(255,255,255,.2); }
.territory-a { width: 45%; height: 35%; top: 19%; left: 18%; transform: rotate(-5deg); }
.territory-b { width: 32%; height: 28%; top: 49%; left: 8%; background: rgba(49,91,116,.45); transform: rotate(8deg); }
.territory-c { width: 34%; height: 31%; top: 46%; right: 4%; background: rgba(158,54,40,.34); transform: rotate(-9deg); }
.capital-mark { position: absolute; left: 50%; top: 44%; display: grid; place-items: center; width: 76px; height: 76px; margin: -38px; border: 1px solid var(--brass-500); border-radius: 50%; color: var(--brass-100); font: 16px var(--font-display); letter-spacing: .12em; }
.capital-mark::before, .capital-mark::after { content: ""; position: absolute; background: var(--brass-500); opacity: .5; }
.capital-mark::before { width: 180px; height: 1px; }
.capital-mark::after { width: 1px; height: 180px; }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 232px minmax(0, 1fr); background: var(--paper-100); }
.sidebar { position: sticky; top: 0; z-index: 20; height: 100dvh; display: flex; flex-direction: column; color: rgba(255,255,255,.76); background: var(--ink-950); border-right: 1px solid rgba(255,255,255,.06); }
.brand { height: 88px; padding: 23px 22px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand strong { display: block; color: var(--white); font: 21px/1.2 var(--font-display); letter-spacing: .12em; }
.brand small { display: block; margin-top: 5px; font-size: 8px; letter-spacing: .14em; color: rgba(255,255,255,.44); }
.primary-nav { padding: 18px 12px; display: grid; gap: 4px; }
.nav-item { position: relative; width: 100%; min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 3px; color: inherit; background: transparent; text-align: left; }
.nav-item::before { content: ""; position: absolute; left: -12px; width: 3px; height: 18px; background: transparent; }
.nav-item:hover { color: var(--white); background: rgba(255,255,255,.06); }
.nav-item.is-active { color: var(--white); background: rgba(186,145,72,.12); }
.nav-item.is-active::before { background: var(--brass-500); }
.nav-item svg { color: var(--brass-500); }
.nav-badge { margin-left: auto; min-width: 21px; padding: 1px 6px; border-radius: 10px; color: var(--white); background: var(--cinnabar-600); font: 10px var(--font-mono); text-align: center; }
.sidebar-foot { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,.09); }
.mode-switch { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px; color: rgba(255,255,255,.68); border: 1px solid rgba(255,255,255,.12); border-radius: 3px; background: rgba(255,255,255,.04); font-size: 11px; }
.mode-knob { width: 27px; height: 15px; border-radius: 8px; background: rgba(255,255,255,.18); position: relative; }
.mode-knob::after { content: ""; position: absolute; width: 11px; height: 11px; left: 2px; top: 2px; border-radius: 50%; background: var(--white); transition: transform .2s; }
.mode-switch[data-mode="military"] .mode-knob::after { transform: translateX(12px); }
.account-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 2px 2px 0; }
.account-name { min-width: 0; flex: 1; overflow: hidden; color: rgba(255,255,255,.52); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .icon-button { border-color: rgba(255,255,255,.08); color: rgba(255,255,255,.6); background: transparent; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; height: 88px; display: flex; align-items: center; gap: 18px; padding: 0 clamp(20px, 3vw, 44px); border-bottom: 1px solid var(--line); background: rgba(251,250,245,.94); backdrop-filter: blur(14px); }
.topbar h1 { margin: 0; font: 27px/1.15 var(--font-display); font-weight: 600; letter-spacing: .06em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sync-status { display: flex; align-items: center; gap: 7px; margin-right: 3px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.sync-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--jade-600); box-shadow: 0 0 0 3px var(--jade-100); }
.sync-status.is-error i { background: var(--danger); box-shadow: 0 0 0 3px var(--cinnabar-100); }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--paper-300); border-radius: 3px; background: var(--white); transition: background .15s, border-color .15s; }
.icon-button:hover { border-color: var(--jade-600); background: var(--jade-100); }
.menu-button { display: none; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 15px; border: 1px solid transparent; border-radius: 3px; font-weight: 650; white-space: nowrap; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { color: var(--white); background: var(--ink-800); border-color: var(--ink-800); }
.button-primary:hover:not(:disabled) { background: var(--jade-700); border-color: var(--jade-700); }
.button-ghost { color: var(--ink-700); background: transparent; border-color: var(--paper-300); }
.button-ghost:hover { background: var(--paper-100); }
.button-danger { color: var(--cinnabar-700); background: var(--cinnabar-100); border-color: #e7c4ba; }
.button-small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.button-wide { width: 100%; min-height: 44px; margin-top: 13px; }
.content { padding: 30px clamp(20px, 3vw, 44px) 50px; max-width: 1600px; margin: 0 auto; }
.loading-state { min-height: calc(100dvh - 88px); display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.loading-state span { width: 17px; height: 17px; border: 2px solid var(--paper-300); border-top-color: var(--jade-600); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-banner { margin: 20px clamp(20px, 3vw, 44px) 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 14px; color: var(--danger); background: var(--cinnabar-100); border: 1px solid #e9c6bc; border-radius: 3px; }
.error-banner button { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: inherit; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font: 22px/1.2 var(--font-display); font-weight: 600; letter-spacing: .04em; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.section-head-actions { display: flex; gap: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { min-height: 112px; padding: 18px 19px; background: var(--white); border: 1px solid var(--line); border-top: 2px solid var(--jade-600); }
.stat-card:nth-child(2) { border-top-color: var(--brass-500); }
.stat-card:nth-child(3) { border-top-color: var(--blue-700); }
.stat-card:nth-child(4) { border-top-color: var(--cinnabar-600); }
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.stat-label svg { width: 15px; height: 15px; }
.stat-value { margin-top: 12px; font: 30px/1 var(--font-display); font-weight: 600; }
.stat-note { margin-top: 8px; color: var(--muted); font-size: 10px; }
.panel { background: var(--white); border: 1px solid var(--line); }
.panel-head { min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font: 17px/1.2 var(--font-display); font-weight: 600; }
.panel-head .muted { margin-left: auto; color: var(--muted); font-size: 10px; }
.panel-body { padding: 18px; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); gap: 16px; align-items: start; }
.department-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.department-card { position: relative; min-height: 132px; padding: 17px 18px; border: 1px solid var(--line); background: var(--paper-50); overflow: hidden; }
.department-card::after { content: attr(data-code); position: absolute; right: 10px; bottom: -9px; color: rgba(35,57,47,.045); font: 54px/1 var(--font-display); letter-spacing: 0; pointer-events: none; }
.department-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.department-name { margin: 0; font: 18px/1.25 var(--font-display); font-weight: 600; }
.department-formal { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.department-counts { display: flex; gap: 16px; margin-top: 22px; }
.mini-count strong { display: block; font: 18px/1 var(--font-mono); font-weight: 500; }
.mini-count span { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.status-pill, .risk-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 2px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-success, .status-online { color: var(--jade-700); background: var(--jade-100); }
.status-pending, .status-pending_approval, .status-queued, .status-leased { color: var(--brass-700); background: var(--brass-100); }
.status-running { color: var(--blue-700); background: var(--blue-100); }
.status-succeeded { color: var(--jade-700); background: var(--jade-100); }
.status-failed, .status-unknown, .status-offline { color: var(--danger); background: var(--cinnabar-100); }
.status-canceled, .status-rejected { color: var(--muted); background: #eeece5; }
.risk-low { color: var(--jade-700); background: var(--jade-100); }
.risk-high { color: var(--brass-700); background: var(--brass-100); }
.risk-irreversible { color: var(--danger); background: var(--cinnabar-100); }
.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 6px; height: 6px; margin-top: 6px; border-radius: 50%; background: var(--brass-500); }
.activity-main { min-width: 0; }
.activity-main strong { display: block; overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.activity-main span { color: var(--muted); font-size: 10px; }
.activity-time { color: var(--muted); font: 9px var(--font-mono); white-space: nowrap; }

.realm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
.realm-map { position: relative; min-height: 350px; padding: 25px; overflow: hidden; background-color: var(--ink-900); background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 36px 36px; border: 1px solid var(--ink-900); }
.realm-map::before { content: ""; position: absolute; width: 420px; height: 260px; left: 18%; top: 10%; border: 1px solid rgba(186,145,72,.38); border-radius: 48% 38% 55% 35%; transform: rotate(-7deg); box-shadow: inset 0 0 90px rgba(45,123,96,.12); }
.realm-map::after { content: ""; position: absolute; width: 280px; height: 180px; right: 5%; bottom: 3%; border: 1px dashed rgba(49,91,116,.6); border-radius: 45% 55% 41% 52%; transform: rotate(8deg); }
.map-caption { position: absolute; z-index: 2; top: 20px; left: 22px; color: rgba(255,255,255,.55); font-size: 9px; letter-spacing: .15em; }
.city-pin { position: absolute; z-index: 3; min-width: 128px; max-width: 180px; padding: 10px 12px; background: rgba(18,32,27,.92); border: 1px solid rgba(186,145,72,.45); box-shadow: 0 10px 28px rgba(0,0,0,.25); }
.city-pin:hover { border-color: var(--brass-500); }
.city-pin strong { display: block; color: var(--paper-50); font: 16px/1.2 var(--font-display); }
.city-pin span { display: block; margin-top: 4px; color: rgba(255,255,255,.48); font-size: 9px; }
.pin-signal { position: absolute; width: 8px; height: 8px; right: 9px; top: 9px; border-radius: 50%; background: var(--jade-600); box-shadow: 0 0 0 4px rgba(45,123,96,.18); }
.pin-signal.offline { background: var(--cinnabar-600); box-shadow: 0 0 0 4px rgba(183,71,53,.18); }
.pin-pos-0 { left: 17%; top: 28%; }
.pin-pos-1 { left: 52%; top: 18%; }
.pin-pos-2 { right: 12%; top: 30%; }
.pin-pos-3 { left: 31%; top: 54%; }
.pin-pos-4 { right: 29%; top: 55%; }
.pin-pos-5 { left: 8%; bottom: 9%; }
.pin-pos-6 { left: 46%; bottom: 7%; }
.pin-pos-7 { right: 9%; bottom: 10%; }
.pin-pos-8 { left: 36%; top: 34%; }
.pin-pos-9 { left: 72%; top: 38%; }
.pin-pos-10 { left: 20%; top: 69%; }
.pin-pos-11 { right: 39%; top: 72%; }
.realm-empty { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.45); font-size: 11px; }
.city-list { display: grid; gap: 10px; }
.city-list-card { padding: 15px; background: var(--white); border: 1px solid var(--line); }
.city-list-card h3 { margin: 0; font: 17px var(--font-display); }
.city-list-meta { display: flex; gap: 8px; margin-top: 5px; color: var(--muted); font-size: 9px; }
.resource-row { display: grid; grid-template-columns: 42px minmax(0,1fr) 38px; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 9px; }
.resource-bar { width: 100%; height: 5px; border: 0; border-radius: 0; background: var(--paper-200); appearance: none; overflow: hidden; }
.resource-bar::-webkit-progress-bar { background: var(--paper-200); }
.resource-bar::-webkit-progress-value { background: var(--jade-600); }
.resource-bar::-moz-progress-bar { background: var(--jade-600); }
.resource-bar.memory::-webkit-progress-value { background: var(--brass-500); }
.resource-bar.memory::-moz-progress-bar { background: var(--brass-500); }
.resource-bar.disk::-webkit-progress-value { background: var(--blue-700); }
.resource-bar.disk::-moz-progress-bar { background: var(--blue-700); }
.resource-row b { color: var(--text); font: 9px var(--font-mono); font-weight: 500; text-align: right; }
.node-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.node-card { padding: 17px; background: var(--white); border: 1px solid var(--line); }
.node-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.node-title { min-width: 0; }
.node-title h3 { margin: 0; overflow: hidden; font: 17px/1.3 var(--font-display); text-overflow: ellipsis; white-space: nowrap; }
.node-title p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.node-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; margin-top: 16px; background: var(--line); border: 1px solid var(--line); }
.node-metric { min-width: 0; padding: 9px; background: var(--paper-50); }
.node-metric span { display: block; color: var(--muted); font-size: 8px; }
.node-metric strong { display: block; margin-top: 4px; overflow: hidden; font: 12px var(--font-mono); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.node-detail-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 11px; color: var(--muted); font-size: 9px; }
.node-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.business-shares { margin-top: 14px; }
.share-item { display: grid; grid-template-columns: minmax(72px, .9fr) minmax(80px, 1.4fr) 32px; align-items: center; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 9px; }
.share-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-item > b { color: var(--text); font: 9px var(--font-mono); font-weight: 500; text-align: right; }
.share-meter { width: 100%; height: 6px; border: 0; border-radius: 0; background: var(--paper-200); appearance: none; }
.share-meter::-webkit-meter-bar { border: 0; border-radius: 0; background: var(--paper-200); }
.share-meter::-webkit-meter-optimum-value { background: var(--jade-600); }
.share-meter::-moz-meter-bar { background: var(--jade-600); }
.share-meter.share-2::-webkit-meter-optimum-value { background: var(--brass-500); }
.share-meter.share-2::-moz-meter-bar { background: var(--brass-500); }
.share-meter.share-3::-webkit-meter-optimum-value { background: var(--blue-700); }
.share-meter.share-3::-moz-meter-bar { background: var(--blue-700); }
.share-meter.share-4::-webkit-meter-optimum-value { background: var(--cinnabar-600); }
.share-meter.share-4::-moz-meter-bar { background: var(--cinnabar-600); }
.business-empty { margin-top: 12px; color: var(--muted); font-size: 9px; }
.live-summary { margin-bottom: 14px; padding: 9px 12px; color: var(--ink-700); background: var(--jade-100); border-left: 3px solid var(--jade-600); font-size: 10px; }

.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.data-table th { height: 40px; padding: 0 14px; color: var(--muted); background: var(--paper-50); border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-align: left; white-space: nowrap; }
.data-table td { height: 58px; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fcfbf7; }
.table-title { max-width: 320px; }
.table-title strong { display: block; overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.table-title span { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.table-mono { color: var(--muted); font: 9px var(--font-mono); }
.row-actions { display: flex; justify-content: end; gap: 5px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filter-chip { min-height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); background: var(--white); font-size: 10px; }
.filter-chip.is-active { color: var(--white); background: var(--ink-800); border-color: var(--ink-800); }
.empty-state { padding: 70px 20px; text-align: center; background: var(--white); border: 1px solid var(--line); }
.empty-state svg { width: 31px; height: 31px; color: var(--brass-500); }
.empty-state h3 { margin: 13px 0 5px; font: 19px var(--font-display); }
.empty-state p { margin: 0; color: var(--muted); font-size: 11px; }
.empty-inline { padding: 20px; color: var(--muted); text-align: center; font-size: 11px; }

.registry-layout { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.registry-card { min-height: 180px; display: flex; flex-direction: column; padding: 19px; background: var(--white); border: 1px solid var(--line); }
.registry-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--jade-700); background: var(--jade-100); border-radius: 50%; }
.registry-card h3 { margin: 16px 0 5px; font: 18px var(--font-display); }
.registry-card p { flex: 1; margin: 0; color: var(--muted); font-size: 10px; }
.registry-card button { align-self: start; margin-top: 16px; }
.registry-table { margin-top: 20px; }
.audit-list { position: relative; padding-left: 20px; }
.audit-list::before { content: ""; position: absolute; left: 5px; top: 12px; bottom: 12px; width: 1px; background: var(--line); }
.audit-item { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.audit-item:last-child { border-bottom: 0; }
.audit-item::before { content: ""; position: absolute; left: -18px; top: 18px; width: 7px; height: 7px; border: 1px solid var(--white); border-radius: 50%; background: var(--brass-500); box-shadow: 0 0 0 1px var(--brass-500); }
.audit-item strong { display: block; font: 11px var(--font-mono); font-weight: 500; }
.audit-item span { color: var(--muted); font-size: 10px; }
.audit-item time { color: var(--muted); font: 9px var(--font-mono); white-space: nowrap; }

.dialog { width: min(640px, calc(100vw - 28px)); padding: 0; color: var(--text); background: var(--paper-50); border: 1px solid var(--paper-300); border-radius: 4px; box-shadow: 0 24px 90px rgba(18,32,27,.3); }
.dialog-small { width: min(490px, calc(100vw - 28px)); }
.dialog::backdrop { background: rgba(18,32,27,.62); backdrop-filter: blur(3px); }
.dialog-head { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font: 22px var(--font-display); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; padding: 20px; }
.field { min-width: 0; display: grid; gap: 6px; color: var(--ink-700); font-size: 10px; font-weight: 650; }
.field-wide { grid-column: 1 / -1; }
.binding-toggle { display: flex; align-items: center; gap: 9px; padding: 10px 12px; background: var(--paper-100); border: 1px dashed var(--paper-300); cursor: pointer; }
.binding-toggle input { width: 15px; height: 15px; margin: 0; accent-color: var(--brass-500); }
.binding-toggle span { color: var(--ink-700); font-size: 10px; font-weight: 600; line-height: 1.5; }
.field textarea { resize: vertical; }
.form-error { min-height: 18px; margin: 0; padding: 0 20px; color: var(--danger); font-size: 10px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; padding: 15px 20px 20px; }
.token-note { margin: 0; padding: 18px 20px 0; color: var(--muted); font-size: 10px; }
.token-box { display: flex; align-items: center; gap: 8px; margin: 14px 20px; padding: 8px 8px 8px 12px; background: var(--ink-950); }
.token-box code { min-width: 0; flex: 1; overflow: hidden; color: #d6e7de; font: 10px var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.token-box .icon-button { color: var(--white); border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.05); }
.token-command { margin: 0 20px 20px; padding: 12px; overflow: auto; color: var(--paper-200); background: var(--ink-950); font: 10px/1.65 var(--font-mono); white-space: pre-wrap; word-break: break-all; }
.logs-content { padding: 20px; }
.log-block { margin-bottom: 2px; padding: 7px 10px; color: #d7ded9; background: var(--ink-950); font: 10px/1.65 var(--font-mono); white-space: pre-wrap; word-break: break-word; }
.log-block.stderr { color: #f0b9ab; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 360px; padding: 12px 16px; color: var(--white); background: var(--ink-900); border-left: 3px solid var(--brass-500); box-shadow: var(--shadow); font-size: 11px; }
.toast.is-error { border-left-color: var(--cinnabar-600); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split-layout, .realm-layout { grid-template-columns: 1fr; }
  .realm-map { min-height: 320px; }
  .registry-layout { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .login-view { grid-template-columns: 1fr; }
  .login-panel { min-height: 100dvh; padding: 34px 26px; border: 0; }
  .login-atmosphere { display: none; }
  .login-brand { margin-bottom: 32px; }
  .login-brand h1 { font-size: 44px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(82vw, 280px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 50px rgba(0,0,0,.22); }
  .sidebar.is-open { transform: translateX(0); }
  .menu-button { display: inline-grid; }
  .topbar { height: 76px; padding: 0 16px; gap: 11px; }
  .topbar h1 { font-size: 22px; }
  .topbar .eyebrow { display: none; }
  .sync-status, .topbar-actions #new-command-button span { display: none; }
  .topbar-actions #new-command-button { width: 36px; padding: 0; }
  .content { padding: 20px 14px 40px; }
  .stats-grid { gap: 8px; }
  .stat-card { min-height: 96px; padding: 14px; }
  .stat-value { font-size: 25px; }
  .department-grid, .node-grid, .registry-layout { grid-template-columns: 1fr; }
  .section-head { align-items: start; }
  .section-head h2 { font-size: 20px; }
  .section-head-actions .button span { display: none; }
  .section-head-actions .button { width: 36px; padding: 0; }
  .realm-map { min-height: 290px; padding: 16px; }
  .city-pin { position: relative !important; left: auto !important; top: auto !important; display: inline-block; margin: 42px 6px 0 0; vertical-align: top; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .audit-item { grid-template-columns: 1fr; gap: 4px; }
  .audit-item time { margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
