/* Aspen Control UI — Token + 组件。约定见 UI-SYSTEM.md */
:root {
  /* 色面 */
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #131722;
  --muted: #6b7280;
  --border: #d8dee8;

  /* 语义 */
  --accent: #2962ff;
  --accent-soft: #e8efff;
  --ok: #089981;
  --ok-soft: #e8f8f3;
  --warn: #b54708;
  --warn-soft: #fff6e8;
  --warn-border: #f0dfb0;
  --danger: #f23645;
  --danger-soft: #fff5f5;
  --danger-border: #f5c2c7;

  /* 导航 / 字号 / 控件 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --fs-caption: 11px;
  --fs-body: 13.5px;
  --fs-title: 15px;
  --fs-display: 22px;
  --ctrl-h: 36px;
  --ctrl-h-sm: 30px;

  /* 壳 */
  --nav-w: 220px;
  --nav-bg: #10151f;
  --nav-fg: #d7dce5;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --shadow: 0 10px 30px rgba(19, 23, 34, 0.06);
  --z-modal: 80;
  --z-toast: 90;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body.app {
  background: var(--bg);
  color: var(--text);
  font: var(--fs-body)/1.45 var(--font);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.caption {
  margin-top: var(--space-1);
  font-size: var(--fs-caption);
}
.muted {
  color: var(--muted);
}

.err {
  color: var(--danger);
  margin: 0;
  min-height: 1.2em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: url('/aspen-control-icon.png') center / cover no-repeat;
  flex: 0 0 auto;
}

.btn {
  height: var(--ctrl-h);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover {
  border-color: #b8c2d4;
}
.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  filter: brightness(1.05);
}
.btn.block {
  width: 100%;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
  height: auto;
  padding: 0;
}
.btn.sm {
  height: var(--ctrl-h-sm);
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn.danger:hover {
  filter: brightness(1.05);
}
.btn.danger-ghost {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-soft);
}
.btn.danger-ghost:hover {
  background: #ffe8ea;
}

.row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.input {
  height: var(--ctrl-h);
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
}
textarea.input {
  height: auto;
  min-height: 72px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.45;
}
.input--inline {
  width: auto;
  min-width: 180px;
  max-width: 360px;
}
.input:focus,
.btn:focus-visible,
.modal__close:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* —— 双视图：固定铺满，杜绝 height/% 与 hidden 打架 —— */
.view {
  position: fixed;
  inset: 0;
  display: none;
}
.view.is-on {
  display: block;
}

/* Auth */
.view-auth.is-on {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(41, 98, 255, 0.16), transparent 60%),
    radial-gradient(700px 360px at 100% 0%, rgba(8, 153, 129, 0.12), transparent 55%),
    var(--bg);
  overflow: auto;
}

.auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.auth-brand p {
  margin: 2px 0 0;
}

.login-form {
  display: grid;
  gap: 12px;
  margin: 0;
}
.login-form .btn {
  width: 100%;
  margin-top: 4px;
}

/* Shell */
.view-shell.is-on {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
}

.nav {
  background: var(--nav-bg);
  color: var(--nav-fg);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.nav-list {
  display: grid;
  gap: 4px;
  flex: 1;
  align-content: start;
}
.nav-item {
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.nav-item.is-active {
  background: var(--accent);
  color: #fff;
}
.nav-foot {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-foot .btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
  color: #fff;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
}
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 560px;
}
.search {
  background: var(--surface-2);
}
.search-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 420px;
  overflow: auto;
  z-index: 20;
  padding: 8px;
}
.search-group {
  margin-bottom: 8px;
}
.search-group h4 {
  margin: 0;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.search-hit {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}
.search-hit:hover {
  background: var(--accent-soft);
}
.pill {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  white-space: nowrap;
}
.pill.ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 35%, var(--border));
}
.pill.bad {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}
.pill.warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-border);
}
td.warn {
  color: var(--warn);
}
.role-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 108px;
}
.role-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  background: var(--surface);
}
.role-card.is-on {
  border-color: var(--accent);
  background: linear-gradient(180deg, #f7f9ff 0%, var(--surface) 55%);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.role-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.role-card__tag {
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.role-card.is-on .role-card__tag {
  color: var(--accent);
}
.role-card__title {
  font-size: var(--fs-title);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.25;
}
.role-card__desc {
  margin-top: auto;
  font-size: var(--fs-caption);
  color: var(--muted);
  line-height: 1.4;
}
.role-card.is-on .role-card__desc {
  color: color-mix(in srgb, var(--accent) 70%, var(--muted));
}
@media (max-width: 900px) {
  .role-cards {
    grid-template-columns: 1fr;
  }
  .role-card {
    min-height: 0;
  }
}
.role-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.role-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}
.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.check-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.check-list li:last-child { border-bottom: 0; }
.check-list .mark { width: 18px; flex: none; font-weight: 700; }
.check-list li.ok .mark { color: var(--ok); }
.check-list li.bad .mark { color: var(--danger); }
.check-list .detail { color: var(--muted); font-size: 12px; margin-top: 2px; }
.panel-head .pill {
  margin-left: 8px;
  vertical-align: middle;
}

.main {
  overflow: auto;
  padding: 18px;
  min-height: 0;
}
.page {
  display: none;
  gap: var(--space-4);
  align-content: start;
}
.page.is-on {
  display: grid;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-size: var(--fs-display);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-head p {
  margin: var(--space-1) 0 0;
  max-width: 52ch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel.tone-warn {
  background: var(--warn-soft);
  border-color: var(--warn-border);
}
.panel.tone-danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.server-status {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-width: 2px;
}
.server-status.is-up {
  border-color: rgba(8, 153, 129, 0.35);
  background: linear-gradient(180deg, rgba(8, 153, 129, 0.06), transparent 56%);
}
.server-status.is-down {
  border-color: rgba(242, 54, 69, 0.28);
  background: linear-gradient(180deg, rgba(242, 54, 69, 0.05), transparent 56%);
}
.server-status__main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.server-status__badge {
  flex-shrink: 0;
  min-width: 72px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
}
.server-status__badge.is-up {
  background: #089981;
  color: #fff;
}
.server-status__badge.is-down {
  background: #f23645;
  color: #fff;
}
.server-status__title {
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.server-status__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 10px;
  font-size: 13px;
}
.server-status__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.server-status__hint {
  min-height: 1.2em;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.panel-head h2 {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 650;
}
.panel-body-lead {
  margin: 0 0 var(--space-3);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}
.metrics--page {
  margin-bottom: var(--space-3);
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.metric.clickable {
  cursor: pointer;
}
.metric.clickable:hover {
  border-color: var(--accent);
}
.metric--ok .value {
  color: var(--ok);
}
.metric--warn .value {
  color: var(--warn);
}
.metric--bad .value {
  color: var(--danger);
}
.metric .label {
  color: var(--muted);
  font-size: 12px;
}
.metric .value {
  margin-top: 8px;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
  max-width: 100%;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.table td.cell-actions {
  white-space: nowrap;
  width: 1%;
}
.table td.cell-status {
  width: 88px;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tr.clickable {
  cursor: pointer;
}
.table tr.clickable:hover td {
  background: var(--surface-2);
}
.table tr.is-selected td {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--accent, #2563eb);
}
.table tr.is-warn-row td {
  background: #fff7ed;
}

.user-cell {
  display: grid;
  gap: 2px;
  min-width: 140px;
}
.user-cell strong {
  font-weight: 650;
}
.cred-block {
  display: grid;
  gap: 6px;
  min-width: 200px;
}
.cred-line {
  display: grid;
  grid-template-columns: 1.25em minmax(0, 1fr) 6.5rem;
  align-items: center;
  column-gap: 6px;
  min-width: 0;
}
.cred-line > span:first-child {
  text-align: center;
}
.cred-line > span:nth-child(2),
.cred-line .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: none;
  flex: unset;
}
.cred-line > .btn {
  width: 6.5rem;
  justify-self: end;
  justify-content: center;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  flex-shrink: 0;
}
.cred-kv {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.cred-kv .mono {
  word-break: break-all;
}
.secret-mask {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.kv {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 14px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.kv:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.kv:first-child {
  padding-top: 0;
}
.kv > span:first-child {
  color: var(--muted);
  font-size: 12px;
}
.kv > span:last-child {
  min-width: 0;
  word-break: break-word;
}
.kv .truncate,
.truncate {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.url-list {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}
.url-list .mono {
  word-break: break-all;
  white-space: normal;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.danger-zone__text {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.danger-zone__text strong {
  font-weight: 650;
}

.qr-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.qr-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.qr-card__preview {
  width: 112px;
  height: 112px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}
.qr-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.qr-card__empty {
  color: var(--muted);
  font-size: 12px;
}
.qr-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  margin-bottom: 4px;
}
.qr-card__meta .pill {
  margin-left: 0;
}

.split-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 14px;
}
@media (max-width: 960px) {
  .split-2 {
    grid-template-columns: 1fr;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.badge.pro {
  background: var(--ok-soft);
  border-color: #b7e6d8;
  color: #067a67;
}
.badge.admin {
  background: var(--accent-soft);
  border-color: #c5d4ff;
  color: #1d4ed8;
}
.badge.live {
  background: var(--ok-soft);
  border-color: #b7e6d8;
  color: #067a67;
}

.release-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  align-items: stretch;
  padding: 16px 18px;
  background:
    linear-gradient(135deg, #f3f7ff 0%, #ffffff 55%, #f4fbf8 100%);
  border: 1px solid var(--border);
}
.release-hero-ver {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-top: 4px;
  color: var(--text);
}
.release-hero-side .truncate {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table tr.row-active td {
  background: var(--ok-soft);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.check input {
  margin: 0;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  width: 100%;
}
.upload-panel .upload-zone {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 16px;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.upload-zone--stable {
  background: linear-gradient(180deg, #f7fafc 0%, var(--surface-2) 48%);
}
.upload-zone--test {
  background: linear-gradient(180deg, #f8f6f2 0%, var(--surface-2) 48%);
}
.upload-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.upload-zone-head strong {
  font-size: 15px;
}
.upload-zone.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-zone-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  flex: 1;
}
.upload-zone-body p {
  margin: 0;
}
.upload-zone-body .input {
  width: 100%;
  min-height: 64px;
  resize: vertical;
}
.upload-progress {
  margin-top: 14px;
}
.upload-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.upload-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #089981);
  transition: width 0.12s linear;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar--filters {
  width: 100%;
}
.toolbar--filters .input--inline {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 320px;
}
.toolbar--compact {
  gap: 6px;
}
.toolbar .input {
  width: auto;
  min-width: 180px;
  max-width: 280px;
}

/* 运维筛选条：扁平工具行，不与 panel 抢卡片层 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  min-height: var(--ctrl-h-sm);
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.page-head--stack > .filter-bar {
  padding-top: var(--space-3);
  margin-top: var(--space-1);
  border-top: 1px solid var(--border);
}
.panel > .filter-bar,
.panel > .panel-head + .filter-bar {
  margin: 0 0 var(--space-3);
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.filter-bar__search {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 320px;
  height: var(--ctrl-h-sm);
  padding-top: 0;
  padding-bottom: 0;
}
.filter-bar .input--inline,
.filter-bar select.input {
  height: var(--ctrl-h-sm);
  padding-top: 0;
  padding-bottom: 0;
  min-width: 140px;
}
.filter-bar__group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.filter-bar__label {
  font-size: var(--fs-caption);
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1;
}
.filter-bar__meta {
  margin-left: auto;
  font-size: var(--fs-caption);
  color: var(--muted);
  line-height: 1.3;
  max-width: 28ch;
  text-align: right;
}
.seg {
  display: inline-flex;
  align-items: stretch;
  height: var(--ctrl-h-sm);
  padding: 2px;
  gap: 1px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.panel > .filter-bar .seg {
  background: var(--surface);
}
.seg__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-caption);
  font-weight: 550;
  line-height: 1;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.seg__btn:hover {
  color: var(--text);
  background: rgba(19, 23, 34, 0.04);
}
.seg__btn.is-on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
  box-shadow: none;
}
.page-head--stack {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}
.page-head--stack .page-head__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-start;
  justify-content: space-between;
}
.page-head--stack .page-head__row .toolbar {
  margin-top: 2px;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.panel--table {
  padding-bottom: 8px;
}
.panel--table .table-wrap {
  margin: 0 -6px;
}
.table-wrap--audit {
  max-height: min(62vh, 720px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin: 0;
  padding: 0;
}
.table--audit {
  min-width: 860px;
}
.table--audit thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--border);
}
.table--audit .col-time {
  width: 148px;
  white-space: nowrap;
}
.table--audit .col-type {
  width: 160px;
}
.table--audit .col-actor {
  width: 180px;
}
.table--audit .col-actions {
  width: 72px;
}
.audit-type {
  font-weight: 650;
  line-height: 1.3;
}
.audit-type-id {
  font-size: var(--fs-caption);
  margin-top: 2px;
  word-break: break-all;
}
.audit-target {
  margin-top: 4px;
}
.audit-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 42rem;
}
.audit-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-caption);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-chip__k {
  color: var(--muted);
  font-weight: 600;
}
.audit-chip__k::after {
  content: ':';
}
.pill.info {
  background: var(--accent-soft);
  color: var(--accent);
}
.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}
.stack {
  display: grid;
  gap: var(--space-2);
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.1fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 960px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
.stack-sm {
  display: grid;
  gap: var(--space-1);
}
.timeline {
  display: grid;
  gap: 0;
}
.timeline-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child {
  border-bottom: 0;
}
.u-mt-1 { margin-top: var(--space-1) !important; }
.u-mt-2 { margin-top: var(--space-2) !important; }
.u-mt-3 { margin-top: var(--space-3) !important; }
.u-mb-2 { margin-bottom: var(--space-2) !important; }
.u-m-0 { margin: 0 !important; }

.callout {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 12px 14px;
  font-size: var(--fs-body);
  line-height: 1.45;
}
.callout.info {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  color: var(--text);
}
.callout.ok {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 30%, var(--border));
}
.callout.warn {
  background: var(--warn-soft);
  border-color: var(--warn-border);
  color: var(--warn);
}
.callout.danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--space-5);
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 23, 34, 0.45);
}
.modal__panel {
  position: relative;
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 14px 16px 0;
}
.modal__title {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 650;
}
.modal__close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.modal__close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.modal__body {
  padding: 12px 16px 4px;
}
.modal__message {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: 14px 16px 16px;
}

/* Toast */
.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: var(--z-toast);
  display: grid;
  gap: var(--space-2);
  pointer-events: none;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.toast.is-in {
  opacity: 1;
  transform: translateY(0);
}
.toast.is-out {
  opacity: 0;
  transform: translateY(6px);
}
.toast--ok {
  border-color: color-mix(in srgb, var(--ok) 40%, var(--border));
  background: color-mix(in srgb, var(--ok-soft) 70%, var(--surface));
}
.toast--warn {
  border-color: var(--warn-border);
  background: var(--warn-soft);
  color: var(--warn);
}
.toast--danger {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}
.toast--info {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-soft);
}

@media (max-width: 900px) {
  .metrics,
  .split-2,
  .release-hero {
    grid-template-columns: 1fr;
  }
  .view-shell.is-on {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .nav-brand span:last-child,
  .nav-item {
    font-size: 0;
  }
  .nav-item {
    text-align: center;
    padding: 12px 6px;
  }
  .nav-item::first-letter {
    font-size: 13px;
  }
  .nav-foot .muted {
    display: none;
  }
}
