:root {
  --brand-red: #b40016;
  --brand-dark-red: #970012;
  --brand-coral: #ff7352;
  --page-background: #fff5f5;
  --soft-red: #fff0f0;
  --dark-card: #2a070b;
  --text-primary: #222;
  --text-secondary: #777;
  --paper: #fff;
  --line: #ffd3d3;
  --shadow: 0 16px 42px rgba(180, 0, 22, .1);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text-primary); background: var(--page-background); font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--brand-coral); outline-offset: 3px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 8px; color: var(--brand-red); font-size: 11px; font-weight: 900; letter-spacing: .15em; }
.muted { color: var(--text-secondary); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 900; letter-spacing: .04em; }
.brand span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 13px 13px 13px 4px; color: #fff; background: linear-gradient(135deg, var(--brand-dark-red), var(--brand-coral)); }
.button { border: 0; border-radius: 999px; padding: 11px 20px; cursor: pointer; font-weight: 800; }
.button:disabled { cursor: wait; opacity: .6; }
.button-primary { color: #fff; background: linear-gradient(120deg, var(--brand-dark-red), var(--brand-red) 55%, var(--brand-coral)); box-shadow: 0 9px 20px rgba(180, 0, 22, .2); }
.button-outline { border: 1px solid var(--line); color: var(--brand-dark-red); background: #fff; }
.text-button { border: 0; padding: 0; color: #ffb3a4; background: none; cursor: pointer; font-weight: 700; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #ffd9d3, transparent 36%), linear-gradient(135deg, #fff5f5, #fff); }
.login-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 26px; background: #fff; box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 42px; }
.login-card h1 { margin: 0; color: var(--brand-dark-red); font-size: 34px; letter-spacing: -.04em; }
.login-card form { margin-top: 28px; }
.login-card label, dialog label { display: grid; gap: 6px; margin-top: 14px; font-size: 12px; font-weight: 800; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text-primary); background: #fffafa; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-red); box-shadow: 0 0 0 3px rgba(180, 0, 22, .1); }
.login-card .button { width: 100%; margin-top: 8px; }
.back-link { display: block; margin-top: 22px; color: var(--text-secondary); text-align: center; font-size: 13px; }
.form-error { min-height: 20px; margin: 10px 0 0; color: var(--brand-red); font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 22px; display: flex; flex-direction: column; color: #fff; background: var(--dark-card); }
.brand-light span { background: linear-gradient(135deg, var(--brand-red), var(--brand-coral)); }
.sidebar-label { margin: 38px 8px 10px; color: #dbaeb3; font-size: 11px; letter-spacing: .14em; }
.sidebar nav { display: grid; gap: 6px; }
.nav-button { padding: 12px 14px; border: 0; border-radius: 10px; color: #f4dfe1; background: transparent; cursor: pointer; text-align: left; font-weight: 700; }
.nav-button:hover, .nav-button.active { color: #fff; background: rgba(255, 115, 82, .18); }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; color: #f4dfe1; font-size: 13px; }

.dashboard { min-width: 0; padding: 42px clamp(24px, 4vw, 64px) 70px; }
.dashboard-header, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.dashboard-header h1 { margin: 0; color: var(--brand-dark-red); font-size: 38px; letter-spacing: -.05em; }
.page-message { min-height: 24px; margin: 10px 0; color: var(--brand-red); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0 28px; }
.stats article { padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: var(--shadow); }
.stats span { display: block; color: var(--text-secondary); font-size: 12px; }
.stats strong { display: block; margin-top: 5px; color: var(--brand-red); font-size: 30px; }
.panel { padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.panel-heading { margin-bottom: 20px; }
.panel h2 { margin: 0; color: var(--brand-dark-red); font-size: 23px; }
.panel-heading p { margin: 5px 0 0; color: var(--text-secondary); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid #ffe8e8; text-align: left; vertical-align: top; font-size: 13px; }
th { color: var(--text-secondary); font-size: 11px; letter-spacing: .04em; }
td strong { color: var(--brand-dark-red); }
.cell-subtitle { display: block; margin-top: 2px; color: var(--text-secondary); font-size: 11px; }
.status-pill { display: inline-flex; padding: 3px 8px; border-radius: 999px; color: var(--brand-red); background: var(--soft-red); font-size: 11px; }
.status-pill + .row-button { display: block; margin-top: 7px; }
.row-actions { display: flex; justify-content: flex-end; gap: 12px; white-space: nowrap; }
.row-button { border: 0; padding: 2px; color: var(--brand-red); background: none; cursor: pointer; font-weight: 700; }
.row-button.danger { color: #8f4350; }
.progress-list { display: grid; gap: 5px; min-width: 210px; }
.progress-list span { color: var(--text-secondary); font-size: 11px; }
.empty-state { padding: 28px; color: var(--text-secondary); text-align: center; }

dialog { width: min(720px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 22px; color: var(--text-primary); background: #fff; box-shadow: 0 30px 90px rgba(42, 7, 11, .35); }
dialog::backdrop { background: rgba(42, 7, 11, .62); backdrop-filter: blur(3px); }
dialog form { position: relative; padding: 34px; }
dialog h2 { margin: 0 0 20px; color: var(--brand-dark-red); font-size: 28px; }
.dialog-close { position: absolute; top: 15px; right: 20px; border: 0; color: var(--text-secondary); background: none; cursor: pointer; font-size: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid small { color: var(--text-secondary); font-weight: 400; }
.dialog-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; }
  .sidebar-label { display: none; }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; display: flex; }
  .sidebar-footer { margin: 0; text-align: right; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .login-card { padding: 30px 24px; }
  .dashboard { padding: 28px 16px 50px; }
  .dashboard-header, .panel-heading { align-items: stretch; flex-direction: column; }
  .stats { gap: 9px; }
  .stats article { padding: 16px; }
  .panel { padding: 20px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  dialog form { padding: 30px 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
