:root {
  color-scheme: light;
  --ink: #202b28;
  --muted: #68756f;
  --line: #dfe6e2;
  --paper: #ffffff;
  --canvas: #f2f5f3;
  --sidebar: #1d302a;
  --sidebar-muted: #afc0b8;
  --green: #167755;
  --green-dark: #115d42;
  --green-soft: #e6f2ec;
  --amber: #a66116;
  --amber-soft: #fbf1e2;
  --red: #aa423c;
  --red-soft: #fbeceb;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: #edf2ef; }
.login-panel { width: min(440px, 100%); background: var(--paper); padding: 40px; border: 1px solid var(--line); border-top: 4px solid var(--green); }
.login-brand, .sidebar-brand { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.brand-monogram { width: 38px; height: 38px; display: inline-grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--green); font-weight: 750; border-radius: 6px; }
.eyebrow { margin: 0; color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: 1px; }
.login-panel .eyebrow { margin-top: 38px; }
h1, h2, p { margin-top: 0; }
.login-panel h1 { margin: 8px 0 6px; font-size: 26px; }
.muted { color: var(--muted); }
.login-panel > .muted { margin-bottom: 24px; }
.form-stack { display: grid; gap: 10px; }
.form-stack label, .branding-controls label { margin-top: 8px; font-weight: 650; }
input, select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #cbd6d0; border-radius: 4px; color: var(--ink); background: white; }
input:focus, select:focus, button:focus-visible { outline: 3px solid #8ccbb0; outline-offset: 2px; }
.button { min-height: 38px; padding: 8px 14px; border: 1px solid transparent; border-radius: 4px; font-weight: 650; white-space: nowrap; }
.button-primary { background: var(--green); color: white; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: #31423b; border-color: #cfd9d3; background: white; }
.button-secondary:hover { background: #f4f7f5; }
.button-wide { width: 100%; margin-top: 12px; }
.setup-notice { display: grid; gap: 8px; margin: 18px 0; padding: 12px; border-left: 3px solid var(--amber); color: #67420f; background: var(--amber-soft); line-height: 1.6; }
.setup-notice code { overflow-wrap: anywhere; }
.form-message { min-height: 20px; margin: 12px 0 0; color: var(--red); }
.login-footnote { margin: 28px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { min-height: 100vh; display: flex; flex-direction: column; padding: 24px 16px 16px; color: white; background: var(--sidebar); }
.sidebar-brand { padding: 0 8px 24px; border-bottom: 1px solid #40534b; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 16px; }
.sidebar-brand small { margin-top: 3px; color: var(--sidebar-muted); font-size: 12px; }
.main-nav { display: grid; gap: 5px; padding-top: 18px; }
.nav-item { min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 10px; border: 0; border-radius: 4px; color: #e4ece8; text-align: left; background: transparent; }
.nav-item:hover { background: #2d453b; }
.nav-item.active { color: #fff; background: #31624d; }
.nav-mark { width: 24px; color: #a9c9b8; font-size: 10px; font-variant-numeric: tabular-nums; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid #40534b; color: var(--sidebar-muted); font-size: 12px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #70d39f; }
.quiet-button { margin-left: auto; border: 0; color: #e7eeea; background: transparent; }
.quiet-button:hover { color: white; text-decoration: underline; }
.workspace { min-width: 0; padding: 0 34px 44px; }
.topbar { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 5px 0 0; font-size: 24px; }
.admin-chip { display: flex; align-items: center; gap: 9px; color: #34433d; font-weight: 650; }
.avatar-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--green-dark); background: var(--green-soft); }
.view-panel { max-width: 1280px; margin: 28px auto 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 4px; font-size: 19px; }
.section-heading p { margin: 0; color: var(--muted); }
.section-heading.compact { margin-bottom: 14px; }
.section-heading.compact h2 { font-size: 16px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric { min-height: 120px; display: grid; align-content: center; gap: 5px; padding: 20px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
.metric > span { color: var(--muted); }
.metric strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); }
.overview-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
.content-section { min-width: 0; padding-top: 18px; border-top: 2px solid #bdcfc5; }
.text-button { border: 0; color: var(--green); background: none; font-weight: 650; }
.text-button:hover { text-decoration: underline; }
.compact-list { display: grid; }
.compact-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.compact-row strong { display: block; margin-bottom: 4px; }
.compact-row small { color: var(--muted); }
.compact-row .status-pill { align-self: center; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 5px; background: white; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.data-table th, .data-table td { padding: 11px 13px; border-bottom: 1px solid #e7ece9; vertical-align: middle; }
.data-table th { color: #5c6b64; background: #f7f9f8; font-size: 12px; font-weight: 700; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.small-button { min-height: 30px; padding: 4px 8px; border: 1px solid #d4ddd8; border-radius: 4px; color: #3d5147; background: white; font-size: 12px; }
.small-button:hover { border-color: #91b5a1; background: #f3f8f5; }
.small-button.danger { color: var(--red); }
.status-pill { display: inline-block; padding: 4px 8px; border-radius: 99px; color: #426151; background: var(--green-soft); font-size: 12px; }
.status-pill.warning { color: var(--amber); background: var(--amber-soft); }
.status-pill.danger { color: var(--red); background: var(--red-soft); }
.empty-state { padding: 30px; color: var(--muted); text-align: center; }
.toolbar-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 20px 0; padding: 16px; border: 1px solid var(--line); border-radius: 5px; background: white; }
.toolbar-form label { display: grid; gap: 6px; min-width: 130px; color: #45564e; font-size: 12px; font-weight: 650; }
.toolbar-form .grow-field { flex: 1 1 180px; }
.toolbar-form .button { min-height: 40px; }
.branding-notice { margin: -4px 0 20px; padding: 12px 15px; border-left: 3px solid #8aada0; color: #455e53; background: #eaf1ed; line-height: 1.65; }
.branding-cards { display: grid; gap: 20px; }
.branding-card { overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
.branding-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.branding-location { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.branding-card-heading h3 { margin: 0; font-size: 16px; }
.image-format { padding: 5px 9px; border: 1px solid var(--line); border-radius: 4px; color: #52665c; background: #f7f9f8; font: 600 11px Consolas, monospace; letter-spacing: .5px; }
.branding-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr); gap: 22px; align-items: start; padding: 20px; }
.branding-preview, .branding-controls { border: 1px solid var(--line); border-radius: 5px; background: white; }
.branding-preview { padding: 16px; }
.preview-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 650; }
.version-label { color: var(--muted); font-size: 12px; font-weight: 400; }
.preview-stage { min-height: 220px; display: grid; place-items: center; margin-top: 14px; border: 1px dashed #c6d2cb; background: #f6f8f7; }
.preview-stage img { display: block; max-width: 100%; max-height: 360px; object-fit: contain; }
.preview-stage span { padding: 16px; color: var(--muted); text-align: center; line-height: 1.6; }
.preview-stage-banner { min-height: 148px; padding: 20px 0; }
.preview-stage-banner img { width: 100%; height: auto; aspect-ratio: 1221 / 73; }
.preview-stage-main { aspect-ratio: 1020 / 605; min-height: 0; }
.preview-stage-main img { width: 100%; height: 100%; max-height: 360px; }
.branding-controls { display: grid; gap: 12px; padding: 20px; }
.branding-controls label { margin-top: 0; }
.branding-controls input[type=file] { min-width: 0; padding: 7px; font-size: 12px; }
.branding-controls input::file-selector-button { margin-right: 8px; padding: 5px 8px; border: 0; border-radius: 3px; color: #325b46; background: var(--green-soft); cursor: pointer; }
.branding-message { margin: 0; padding: 9px 11px; border-left: 3px solid var(--green); color: #28543d; background: var(--green-soft); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.branding-message.error { border-left-color: var(--red); color: #842f2a; background: var(--red-soft); }
.branding-card[aria-busy=true] .branding-controls { cursor: progress; }
.branding-controls :disabled { opacity: .6; cursor: progress; }
.field-note { margin: -5px 0 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.app-message { max-width: 1280px; margin: 16px auto 0; padding: 11px 14px; border-left: 3px solid var(--green); color: #28543d; background: var(--green-soft); }
.app-message.error { border-left-color: var(--red); color: #842f2a; background: var(--red-soft); }
.dialog-backdrop { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; background: rgb(19 31 25 / 45%); }
.secret-dialog { width: min(540px, 100%); padding: 24px; border: 1px solid #ced9d3; border-radius: 6px; background: white; box-shadow: 0 18px 45px rgb(14 32 23 / 20%); }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; color: #384a41; background: white; font-size: 20px; line-height: 1; }
.secret-output { max-height: 240px; overflow: auto; padding: 14px; border: 1px solid #d8e2dc; border-radius: 4px; color: #185a3e; background: #f1f7f3; font: 600 14px/1.7 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 900px) {
  .branding-layout { grid-template-columns: 1fr; gap: 16px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; padding: 14px 16px 8px; }
  .sidebar-brand { padding: 0 2px 12px; }
  .main-nav { display: flex; overflow-x: auto; padding: 10px 0; }
  .nav-item { flex: 0 0 auto; }
  .nav-mark { display: none; }
  .sidebar-footer { margin-top: 0; padding: 10px 2px 0; }
  .workspace { padding: 0 20px 36px; }
  .topbar { min-height: 92px; }
}
@media (max-width: 620px) {
  .login-shell { padding: 16px; }
  .login-panel { padding: 26px 22px; }
  .workspace { padding: 0 14px 28px; }
  .topbar { align-items: flex-start; min-height: 92px; padding: 18px 0; }
  .topbar h1 { font-size: 20px; }
  .admin-chip { font-size: 12px; }
  .metric-grid { grid-template-columns: 1fr; gap: 8px; }
  .metric { min-height: 88px; padding: 14px; }
  .metric strong { font-size: 23px; }
  .overview-columns, .branding-layout { grid-template-columns: 1fr; gap: 20px; }
  .section-heading { align-items: flex-start; }
  .section-heading .button { padding-inline: 10px; }
  .toolbar-form { align-items: stretch; }
  .toolbar-form label, .toolbar-form .grow-field { flex: 1 1 100%; }
  .toolbar-form .button { width: 100%; }
  .preview-stage { min-height: 170px; }
  .branding-card-heading, .branding-layout { padding: 16px; }
  .branding-controls { padding: 16px; }
  .preview-stage-banner { min-height: 112px; }
  .preview-stage-main { min-height: 0; }
}
