:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #15212b;
  --muted: #667784;
  --line: #dde5eb;
  --navy: #102a43;
  --teal: #087f8c;
  --teal-2: #06a6a6;
  --lime: #c8f04b;
  --danger: #dc4c4c;
  --warning: #d88a19;
  --success: #238b66;
  --shadow: 0 18px 50px rgba(16, 42, 67, .08);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px; background: var(--navy); color: white; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--lime); color: var(--navy); font-weight: 900; box-shadow: 0 8px 22px rgba(200,240,75,.18); }
.brand strong { display: block; letter-spacing: -.02em; }
.brand small { color: #9fb3c2; font-size: 11px; }
.nav { display: grid; gap: 7px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: #c4d3dd; font-size: 14px; transition: .18s ease; }
.nav a:hover { background: rgba(255,255,255,.08); color: white; transform: translateX(2px); }
.nav a.active { background: rgba(200,240,75,.12); color: var(--lime); box-shadow: inset 3px 0 var(--lime); }
.nav-icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-foot { margin-top: auto; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; color: #b9c9d3; font-size: 12px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); margin-right: 7px; box-shadow: 0 0 0 4px rgba(200,240,75,.1); }
.main { min-width: 0; }
.topbar { height: 76px; padding: 0 36px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(244,247,251,.9); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10; }
.topbar-title { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.content { max-width: 1450px; padding: 34px 36px 60px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 7px; }
h1 { margin: 0; font-size: clamp(28px, 3vw, 42px); line-height: 1.06; letter-spacing: -.045em; }
h2, h3, p { margin-top: 0; }
.subtitle { color: var(--muted); margin: 9px 0 0; max-width: 720px; line-height: 1.65; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.stat { padding: 21px; position: relative; overflow: hidden; min-height: 132px; }
.stat::after { content: ""; position: absolute; width: 92px; height: 92px; border-radius: 50%; right: -32px; top: -28px; background: var(--accent-soft, #e6f6f7); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.stat-value { font-size: 34px; font-weight: 800; letter-spacing: -.05em; margin-top: 14px; }
.stat-note { color: var(--muted); font-size: 12px; margin-top: 6px; }
.btn { border: 0; border-radius: 11px; padding: 10px 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; font-size: 13px; transition: .18s ease; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); filter: brightness(.98); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-primary { background: var(--navy); color: white; box-shadow: 0 8px 18px rgba(16,42,67,.16); }
.btn-accent { background: var(--lime); color: var(--navy); }
.btn-soft { background: #e8f5f6; color: var(--teal); }
.btn-danger { background: #fff0f0; color: var(--danger); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-sm { padding: 7px 10px; font-size: 12px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 12px; font-weight: 750; color: #435463; }
.field small { color: var(--muted); line-height: 1.45; }
.input, select, textarea { width: 100%; border: 1px solid #cfd9e1; background: white; color: var(--ink); border-radius: 11px; padding: 11px 12px; outline: none; transition: .16s ease; }
.input:focus, select:focus, textarea:focus { border-color: var(--teal-2); box-shadow: 0 0 0 4px rgba(6,166,166,.1); }
textarea { resize: vertical; min-height: 100px; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; min-width: 720px; }
th { color: var(--muted); background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: 12px 16px; }
td { border-top: 1px solid var(--line); padding: 14px 16px; font-size: 13px; vertical-align: middle; }
tbody tr:hover td { background: #fbfdfd; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge-success { color: var(--success); background: #e8f7f1; }
.badge-danger { color: var(--danger); background: #fff0f0; }
.badge-warning { color: var(--warning); background: #fff7e8; }
.badge-neutral { color: #60717e; background: #edf2f5; }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.empty { padding: 45px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-gap { margin-top: 20px; }
.preset-library { margin-bottom: 20px; overflow: hidden; }
.preset-library .card-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.preset-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.preset-card { padding: 22px; min-height: 196px; display: flex; flex-direction: column; gap: 17px; border-right: 1px solid var(--line); background: linear-gradient(145deg,#fff,#f8fbfc); }
.preset-card:last-child { border-right: 0; }
.preset-number { color: var(--teal); font: 800 12px/1 ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing: .12em; }
.preset-card h3 { margin: 0 0 7px; font-size: 17px; }
.preset-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.preset-card .actions { margin-top: auto; }
.notice { border-radius: 13px; padding: 14px 16px; background: #eaf6f7; color: #285e64; border: 1px solid #cce8ea; font-size: 13px; line-height: 1.55; }
.notice-warn { background: #fff8e9; color: #7a571d; border-color: #f2dfb5; }
.progress { height: 8px; border-radius: 99px; background: #e6edf1; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--teal),var(--teal-2)); }
.bar-chart { height: 210px; display: flex; gap: 10px; align-items: flex-end; padding-top: 28px; }
.bar-item { flex: 1; min-width: 30px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; text-align: center; color: var(--muted); font-size: 10px; }
.bar { border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg,var(--teal-2),var(--teal)); min-height: 4px; position: relative; }
.bar b { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); color: var(--ink); font-size: 10px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,30,45,.55); display: grid; place-items: center; z-index: 100; padding: 20px; backdrop-filter: blur(4px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(680px, 100%); max-height: 90vh; overflow: auto; background: white; border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.25); }
.toast-stack { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 10px; z-index: 200; }
.toast { padding: 13px 16px; color: white; background: var(--navy); border-radius: 12px; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease; }
.toast.error { background: #9f3232; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.mobile-toggle { display: none; }
.score-ring { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--teal) var(--score,0%), #e6edf1 0); position: relative; }
.score-ring::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: white; }
.score-ring strong { z-index: 1; font-size: 27px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #164b5a 0, #102a43 40%, #0b1d2c 100%); }
.login-card { width: min(430px, 100%); background: white; padding: 34px; border-radius: 24px; box-shadow: 0 30px 100px rgba(0,0,0,.3); }
.public-state { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef3f5; }
.public-card { width: min(560px,100%); text-align: center; background: white; padding: 40px; border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow); }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -270px; width: 250px; transition: .22s ease; box-shadow: 20px 0 50px rgba(0,0,0,.22); }
  .sidebar.open { left: 0; }
  .mobile-toggle { display: inline-flex; }
  .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .topbar { padding: 0 20px; }
  .content { padding: 28px 20px 50px; }
  .preset-grid { grid-template-columns: 1fr; }
  .preset-card { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .preset-card:last-child { border-bottom: 0; }
}
@media (max-width: 680px) {
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head .btn { width: 100%; }
  .topbar-title { display: none; }
  .card-pad, .card-head { padding: 17px; }
}
