:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --ink: #17212b;
  --muted: #66717d;
  --line: #dbe1e7;
  --soft: #eef2f5;
  --nav: #17212b;
  --accent: #e95f20;
  --accent-dark: #c94710;
  --teal: #14806d;
  --danger: #b42318;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #edf1f4; }
.login-panel { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 32px; box-shadow: 0 16px 45px rgba(23, 33, 43, .1); }
.brand-lockup, .sidebar-brand { display: flex; align-items: center; gap: 12px; }
.brand-lockup img { width: 46px; height: 46px; border-radius: 8px; }
.brand-lockup strong, .sidebar-brand strong { display: block; font-size: 18px; }
.brand-lockup span, .sidebar-brand span { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.login-panel form { margin-top: 34px; }
.login-panel h1 { margin: 0 0 24px; font-size: 24px; letter-spacing: 0; }
label { display: grid; gap: 8px; margin-bottom: 18px; color: #34404c; font-size: 14px; font-weight: 700; }
input, select { width: 100%; min-height: 42px; border: 1px solid #bcc6d0; border-radius: 5px; background: #fff; color: var(--ink); padding: 9px 11px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233, 95, 32, .12); }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-field .icon-button { position: absolute; top: 3px; right: 3px; }
.environment-note { margin: 24px 0 0; color: var(--muted); text-align: center; font-size: 12px; }

.primary-button, .secondary-button, .text-button, .icon-button { border: 0; border-radius: 5px; min-height: 38px; }
.primary-button { background: var(--accent); color: #fff; padding: 9px 16px; font-weight: 700; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { background: #fff; border: 1px solid #aeb9c4; color: #263442; padding: 8px 14px; font-weight: 700; }
.text-button { background: transparent; color: #31516c; padding: 6px 8px; }
.icon-button { width: 38px; background: transparent; color: #44515e; font-weight: 700; }
.full-width { width: 100%; }
.form-error { min-height: 20px; margin: -7px 0 10px; color: var(--danger); font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; background: var(--nav); color: #fff; }
.sidebar-brand { padding: 4px 8px 24px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand img { width: 38px; height: 38px; border-radius: 6px; }
.sidebar-brand span { color: #aeb8c2; }
.sidebar nav { display: grid; gap: 4px; margin-top: 18px; }
.nav-item { min-height: 42px; border: 0; border-radius: 5px; background: transparent; color: #c9d1d8; padding: 0 14px; text-align: left; }
.nav-item:hover, .nav-item.active { background: #263644; color: #fff; }
.nav-item.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 8px; color: #aeb8c2; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #38b48b; }

.workspace { min-width: 0; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar strong { display: block; margin-top: 3px; }
.eyebrow { color: var(--muted); font-size: 12px; }
.account-menu { display: flex; align-items: center; gap: 12px; color: #475462; font-size: 14px; }
.content-area { width: min(1320px, 100%); margin: 0 auto; padding: 28px; }
.app-view { display: none; }
.app-view.active-view { display: block; }
.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-size: 26px; letter-spacing: 0; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.section-heading h2 { margin: 0; font-size: 17px; }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.metric-strip > div { min-height: 112px; padding: 20px; border-right: 1px solid var(--line); }
.metric-strip > div:last-child { border-right: 0; }
.metric-strip span, .metric-strip small { display: block; color: var(--muted); }
.metric-strip strong { display: block; margin: 8px 0 5px; font-size: 28px; }
.notice-band { display: flex; gap: 14px; margin-top: 18px; padding: 13px 16px; border-left: 3px solid #d4a72c; background: #fff9e8; color: #5e4a18; font-size: 14px; }
.data-section { margin-top: 30px; }
.data-section .section-heading { margin-bottom: 12px; }
.table-wrap { width: 100%; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 14px; }
th { background: #f0f3f6; color: #384654; font-size: 12px; text-transform: none; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 12px; padding: 3px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.success { background: #dff4ec; color: #14654f; }
.badge.danger { background: #fde7e4; color: #9f2419; }
.badge.neutral { background: #e9eef3; color: #516170; }
.definition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.definition-grid div { padding: 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.definition-grid div:nth-child(2n) { border-right: 0; }
.definition-grid div:nth-last-child(-n+2) { border-bottom: 0; }
.definition-grid dt { color: var(--muted); font-size: 12px; }
.definition-grid dd { margin: 7px 0 0; font-size: 14px; overflow-wrap: anywhere; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 180px; gap: 12px; margin-bottom: 14px; }
.strategy-form { display: grid; gap: 18px; }
fieldset { margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
legend { padding: 0 8px; color: #22303e; font-weight: 700; }
.form-grid { display: grid; gap: 16px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.strategy-form label { margin-bottom: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.preview-panel { margin-top: 22px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.preview-panel .section-heading { padding: 12px 16px; border-bottom: 1px solid var(--line); }
pre { margin: 0; max-height: 420px; overflow: auto; padding: 18px; background: #18242e; color: #e7eef5; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 360px; transform: translateY(20px); opacity: 0; pointer-events: none; padding: 12px 16px; border-radius: 5px; background: #1d2a35; color: #fff; box-shadow: 0 12px 28px rgba(0,0,0,.2); transition: .2s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }
.mobile-only { display: none; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -244px; z-index: 20; width: 232px; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { justify-content: flex-start; }
  .account-menu { margin-left: auto; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip > div:nth-child(2) { border-right: 0; }
  .metric-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .three-columns, .four-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .content-area { padding: 20px 14px; }
  .topbar { padding: 10px 14px; }
  .topbar .eyebrow { display: none; }
  .account-menu span { display: none; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 22px; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-strip > div:last-child { border-bottom: 0; }
  .definition-grid, .two-columns, .three-columns, .four-columns, .toolbar { grid-template-columns: 1fr; }
  .definition-grid div { border-right: 0; }
  .definition-grid div:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .notice-band { display: grid; gap: 5px; }
  .form-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
