:root {
  color: #181a1b;
  background: #f5f6f4;
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; margin: 0; background: #f5f6f4; color: #181a1b; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }

.shell { min-height: 100vh; }
.auth-view { width: min(440px, calc(100% - 40px)); margin: 0 auto; padding: 13vh 0 64px; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 8px; background: #1f7a52; color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .08em; }
.eyebrow { margin: 0 0 7px; color: #1f7a52; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: 27px; line-height: 1.2; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.3; }
.lead { margin-bottom: 26px; color: #68706b; font-size: 14px; line-height: 1.6; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; color: #4d5650; font-size: 13px; }
.auth-form input, .inline-form input, textarea { width: 100%; border: 1px solid #bfc5c0; border-radius: 6px; background: #fff; color: #181a1b; padding: 10px 11px; outline: none; }
.auth-form input:focus, .inline-form input:focus, textarea:focus { border-color: #2d5f88; box-shadow: 0 0 0 2px #dbe8f1; }
.button { min-height: 36px; padding: 7px 13px; border: 1px solid #bfc5c0; border-radius: 6px; background: #fff; color: #202322; font-size: 13px; }
.button:hover { border-color: #6e7771; background: #f8f9f8; }
.button:focus-visible { outline: 2px solid #2d5f88; outline-offset: 2px; }
.button-primary { border-color: #1f7a52; background: #1f7a52; color: #fff; }
.button-primary:hover { border-color: #166341; background: #166341; }
.button-secondary { border-color: #8da497; color: #205e43; }
.button-quiet { border-color: transparent; background: transparent; color: #59635d; }
.button-danger { border-color: #c4543c; color: #9c3e2b; }
.setup-panel { margin-top: 32px; padding-top: 25px; border-top: 1px solid #ccd1cd; }
.setup-panel h2 { margin-bottom: 8px; }
.setup-panel p { color: #68706b; font-size: 13px; line-height: 1.6; }
.setup-secret { margin-top: 16px; padding: 14px; border: 1px solid #c7d8ce; border-radius: 6px; background: #f5faf7; }
.setup-secret p { margin-bottom: 8px; }
.setup-secret code { display: block; overflow-wrap: anywhere; padding: 9px; border-radius: 4px; background: #e8f3ef; color: #166341; font: 700 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.setup-secret a { display: inline-block; margin: 10px 0 15px; color: #2d5f88; font-size: 13px; }
.notice { margin: 0 0 18px; padding: 11px 13px; border: 1px solid; border-radius: 6px; font-size: 13px; line-height: 1.45; }
.notice-error { border-color: #e0aaa0; background: #faeae6; color: #8d3828; }
.notice-success { border-color: #a6cdb9; background: #edf4f0; color: #166341; }

.topbar { min-height: 104px; padding: 23px clamp(20px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #d9ddd8; background: #fff; }
.topbar h1 { margin: 0; font-size: 25px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.connection { padding: 6px 9px; border-radius: 4px; background: #edf4f0; color: #166341; font-size: 12px; }
.connection[data-state="loading"] { background: #fbf3df; color: #875b0f; }
.connection[data-state="error"] { background: #faeae6; color: #9c3e2b; }
.muted { color: #737b76; font-size: 12px; }

#control-view { min-height: 100vh; }
#control-view > .notice { margin: 18px clamp(20px, 4vw, 56px) 0; }
.metric-grid { width: min(1480px, 100%); margin: 0 auto; padding: 26px clamp(20px, 4vw, 56px) 0; display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 10px; }
.metric { min-height: 112px; padding: 16px 17px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid #d9ddd8; border-radius: 6px; background: #fff; }
.metric span { color: #68706b; font-size: 13px; }
.metric strong { font-size: 31px; line-height: 1; font-variant-numeric: tabular-nums; }
.metric small { min-height: 15px; color: #7c847f; font-size: 11px; }
.metric-primary { border-top: 3px solid #1f7a52; }
.metric-warning { border-top: 3px solid #c38a23; }
.metric-alert { border-top: 3px solid #c4543c; }
.section { width: min(1480px, 100%); margin: 30px auto 0; padding: 25px clamp(20px, 4vw, 56px) 0; border-top: 1px solid #ccd1cd; }
.section-heading { min-height: 44px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.section-kicker { margin: 0 0 6px; color: #68706b; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.list-frame { margin-top: 13px; overflow: auto; max-height: 365px; border: 1px solid #d9ddd8; border-radius: 6px; background: #fff; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
th, td { height: 46px; padding: 9px 13px; border-bottom: 1px solid #e5e8e5; text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; height: 40px; color: #68706b; background: #f8f9f8; font-size: 11px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
td.numeric { font-variant-numeric: tabular-nums; }
.list-sentinel { min-height: 30px; padding: 8px; color: #8a928d; text-align: center; font-size: 11px; }
.list-sentinel[data-state="done"] { color: #b0b6b1; }
.list-sentinel[data-state="error"] { color: #9c3e2b; }
.empty { padding: 20px 13px; color: #7c847f; text-align: center; }
.status { display: inline-flex; min-height: 23px; align-items: center; padding: 3px 8px; border-radius: 4px; background: #edf4f0; color: #166341; font-size: 11px; }
.status-paused, .status-draft, .status-expiring { background: #fbf3df; color: #875b0f; }
.status-revoked, .status-banned, .status-expired, .status-frozen, .status-withdrawn { background: #faeae6; color: #9c3e2b; }
.status-disabled { background: #eeefee; color: #5d635f; }
.row-actions { display: inline-flex; gap: 7px; }
.row-actions .button { min-height: 29px; padding: 4px 8px; font-size: 11px; }
.split-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.split-section .section-heading { padding-top: 0; }
.release-draft { margin: 2px 0 15px; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border: 1px solid #d9ddd8; border-radius: 6px; background: #fff; }
.release-draft strong, .release-draft span { display: block; }
.release-draft span { margin-top: 3px; color: #737b76; font-size: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.inline-form input { width: 145px; padding: 8px 9px; font-size: 12px; }
.inline-form input[name="notes"] { width: 190px; }
footer { width: min(1480px, 100%); min-height: 58px; margin: 34px auto 0; padding: 16px clamp(20px, 4vw, 56px); display: flex; justify-content: space-between; border-top: 1px solid #d9ddd8; color: #737b76; background: #fff; font-size: 12px; }

.reason-dialog { width: min(440px, calc(100% - 32px)); border: 1px solid #c5cbc6; border-radius: 8px; padding: 0; background: #fff; color: #181a1b; box-shadow: 0 20px 70px #18251f38; }
.reason-dialog::backdrop { background: #18251f66; }
.reason-dialog form { padding: 22px; }
.reason-dialog h2 { margin-bottom: 7px; font-size: 18px; }
.reason-dialog p { margin-bottom: 13px; color: #68706b; font-size: 13px; }
.dialog-field { display: grid; gap: 6px; margin-top: 12px; color: #4d5650; font-size: 13px; }
.dialog-field input, .dialog-field select { width: 100%; border: 1px solid #bfc5c0; border-radius: 6px; background: #fff; color: #181a1b; padding: 9px 10px; outline: none; }
.dialog-field input:focus, .dialog-field select:focus, .reason-dialog textarea:focus { border-color: #2d5f88; box-shadow: 0 0 0 2px #dbe8f1; }
.reason-dialog textarea { resize: vertical; min-height: 96px; }
.one-time-code { display: block; overflow-wrap: anywhere; padding: 12px; border-radius: 5px; background: #e8f3ef; color: #166341; font: 700 15px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; user-select: all; }
.dialog-actions { margin-top: 15px; display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 1100px) { .metric-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); } }
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .metric-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .split-section { grid-template-columns: 1fr; gap: 0; }
  .release-draft { align-items: stretch; flex-direction: column; }
  .inline-form { justify-content: flex-start; }
}
@media (max-width: 420px) { .metric-grid { gap: 8px; padding-top: 18px; } .metric { min-height: 100px; padding: 13px; } .metric strong { font-size: 27px; } }
