:root {
  color-scheme: light;
  --navy: #10182c;
  --blue: #3659f5;
  --blue-dark: #2444d7;
  --surface: #ffffff;
  --canvas: #f3f5fa;
  --line: #e2e7f0;
  --text: #172033;
  --muted: #667085;
  --green: #0f9f6e;
  --green-bg: #e9f8f2;
  --amber: #c77700;
  --amber-bg: #fff5df;
  --red: #c2394b;
  --shadow: 0 16px 40px rgba(29, 42, 72, .09);
}

* { box-sizing: border-box; }
html { min-width: 1180px; background: var(--canvas); }
body { margin: 0; color: var(--text); background: var(--canvas); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar { height: 72px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; color: #fff; background: linear-gradient(112deg, #10182c, #1c2850); box-shadow: 0 4px 18px rgba(15, 24, 48, .2); }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 18px; font-weight: 800; background: linear-gradient(135deg, #7568ff, #3f7bff); box-shadow: 0 7px 18px rgba(73, 102, 255, .4); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: .08em; }
.brand small { margin-top: 1px; color: #bfc8df; font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-chip { padding: 7px 12px; color: #dce3f7; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; }

.page-shell { width: min(1600px, calc(100% - 48px)); margin: 26px auto 60px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding: 28px 32px; color: #fff; border-radius: 20px; background: radial-gradient(circle at 80% 0, rgba(122, 116, 255, .5), transparent 40%), linear-gradient(130deg, #25379d, #405ff4); box-shadow: var(--shadow); }
.hero h1 { margin: 2px 0 7px; font-size: 30px; line-height: 1.2; }
.hero p { max-width: 780px; margin: 0; color: #dfe5ff; }
.eyebrow { margin: 0 0 5px !important; color: #75809a; font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.hero .eyebrow { color: #bdc8ff; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.primary-button, .secondary-button, .ghost-button, .icon-button { border: 0; border-radius: 10px; cursor: pointer; transition: .16s ease; }
.primary-button { padding: 10px 17px; color: #fff; font-weight: 700; background: var(--blue); box-shadow: 0 6px 16px rgba(54, 89, 245, .22); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.secondary-button { padding: 10px 15px; color: var(--blue); font-weight: 700; background: #eef1ff; }
.hero .secondary-button { color: #fff; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.12); }
.ghost-button { display: inline-flex; align-items: center; justify-content: center; padding: 9px 14px; color: #40506e; text-decoration: none; border: 1px solid var(--line); background: #fff; }
.topbar .ghost-button { color: #fff; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.08); }
button:disabled { cursor: wait; opacity: .55; transform: none !important; }

.notice { display: flex; align-items: center; gap: 12px; margin: 16px 0; padding: 12px 16px; color: #6c5200; border: 1px solid #f3ddb1; border-radius: 12px; background: #fff8e9; }
.notice strong { flex: 0 0 auto; }

.filter-panel { display: grid; grid-template-columns: 1.45fr 1fr 1.1fr .9fr .9fr auto auto; align-items: end; gap: 12px; margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 6px 24px rgba(34, 48, 84, .05); }
label span { display: block; margin-bottom: 5px; color: #59647b; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; color: var(--text); border: 1px solid #d8deea; border-radius: 9px; outline: none; background: #fff; }
input, select { height: 40px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #7489ff; box-shadow: 0 0 0 3px rgba(54, 89, 245, .1); }

.metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 16px 0; }
.metric-grid article { min-height: 116px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 7px 24px rgba(34, 48, 84, .05); }
.metric-grid span, .metric-grid small { display: block; color: var(--muted); }
.metric-grid strong { display: block; margin: 7px 0 1px; color: var(--navy); font-size: 28px; line-height: 1.1; }
.metric-grid small { font-size: 12px; }

.content-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #a8afbe; }
.dot.green { background: var(--green); }.dot.amber { background: var(--amber); }.dot.gray { background: #a8afbe; }
.table-wrap { overflow: auto; max-height: calc(100vh - 360px); min-height: 330px; }
table { width: 100%; min-width: 1420px; border-collapse: separate; border-spacing: 0; }
th { position: sticky; top: 0; z-index: 2; padding: 12px 13px; color: #5d6780; font-size: 12px; text-align: left; background: #f7f8fb; border-bottom: 1px solid var(--line); }
td { padding: 14px 13px; vertical-align: top; border-bottom: 1px solid #edf0f5; }
tbody tr:hover { background: #fafbff; }
.cell-title { display: block; max-width: 230px; font-weight: 700; }
.cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.value-strong { font-size: 16px; font-weight: 750; }
.badge { display: inline-flex; align-items: center; margin: 1px 4px 3px 0; padding: 3px 8px; border-radius: 999px; color: #59647b; font-size: 12px; background: #eef1f6; }
.badge.success { color: #087451; background: var(--green-bg); }
.badge.warning { color: #955800; background: var(--amber-bg); }
.badge.danger { color: #a52d3d; background: #ffeaed; }
.row-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.text-button { padding: 0; color: var(--blue); border: 0; cursor: pointer; background: none; }
.empty { padding: 80px 20px; color: var(--muted); text-align: center; }

.modal { width: min(980px, calc(100vw - 60px)); max-height: calc(100vh - 60px); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 28px 80px rgba(15, 25, 52, .3); }
.modal.compact { width: 620px; }
.modal::backdrop { background: rgba(13, 22, 43, .56); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 21px; }
.icon-button { width: 34px; height: 34px; color: #667085; font-size: 24px; line-height: 1; background: #f0f2f7; }
.modal-content { max-height: calc(100vh - 170px); padding: 22px 24px 28px; overflow: auto; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.detail-grid article { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; }
.detail-grid span, .detail-grid small { display: block; color: var(--muted); font-size: 12px; }
.detail-grid strong { display: block; margin: 4px 0; font-size: 19px; }
.detail-section { margin-top: 18px; }
.detail-section h3 { margin: 0 0 9px; font-size: 16px; }
.detail-list { display: grid; gap: 8px; }
.detail-item { display: flex; justify-content: space-between; gap: 20px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.detail-item p { margin: 0; }.detail-item small { color: var(--muted); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 22px 24px 8px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 17px; height: 17px; }.check span { margin: 0; font-size: 13px; }
.form-help { margin: 5px 24px; padding: 10px 12px; color: #6f5a11; border-radius: 9px; background: #fff7e6; }
.form-error { min-height: 20px; margin: 7px 24px; color: var(--red); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 24px 22px; }

.toast { position: fixed; right: 26px; bottom: 26px; z-index: 30; max-width: 420px; padding: 12px 17px; color: #fff; border-radius: 11px; background: #18213a; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a52d3d; }

@media (max-width: 1320px) {
  .filter-panel { grid-template-columns: repeat(4, 1fr); }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
}
