:root {
  --navy: #07345d;
  --blue: #0877b9;
  --ice: #eaf7fd;
  --line: #d8e7ef;
  --text: #10283d;
  --muted: #64788a;
  --white: #fff;
  --green: #118c63;
  --orange: #cf6c13;
  --red: #c83737;
  --purple: #7143a5;
  --shadow: 0 16px 40px rgba(15, 70, 108, .12);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif; color: var(--text); background: linear-gradient(145deg, #f7fcff, #eaf7fd); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.page-shell { min-height: 100vh; }
.topbar { background: linear-gradient(115deg, #072e55, #0879ad); color: white; padding: 26px clamp(20px, 5vw, 76px); display: flex; justify-content: space-between; align-items: center; gap: 20px; box-shadow: var(--shadow); }
.brand { display: flex; gap: 16px; align-items: center; }
.brand-mark { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: var(--navy); font-weight: 900; font-size: 22px; background: #e3f6ff; }
.brand h1 { margin: 0 0 5px; font-size: clamp(24px, 3vw, 34px); }
.brand p { margin: 0; opacity: .8; }
.top-actions { display: flex; gap: 10px; }
main { width: min(1480px, calc(100% - 34px)); margin: 34px auto 70px; }
.auth-card { max-width: 920px; margin: 70px auto; background: white; border: 1px solid var(--line); border-radius: 28px; display: grid; grid-template-columns: 1.15fr 1fr; overflow: hidden; box-shadow: var(--shadow); }
.auth-copy { padding: 56px; background: linear-gradient(150deg, #effaff, #dff5ff); }
.auth-copy h2 { font-size: 38px; margin: 10px 0 16px; }
.auth-copy p { color: var(--muted); line-height: 1.8; }
.auth-form { padding: 56px; display: flex; flex-direction: column; gap: 20px; justify-content: center; }
.eyebrow { font-size: 12px; letter-spacing: .18em; font-weight: 800; color: var(--blue); }
label { display: flex; flex-direction: column; gap: 8px; color: #27445b; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: white; padding: 12px 14px; color: var(--text); outline: none; transition: .15s ease; }
input:focus, select:focus, textarea:focus { border-color: #47a8d6; box-shadow: 0 0 0 4px rgba(71, 168, 214, .12); }
textarea { resize: vertical; }
.btn { border: 0; border-radius: 12px; padding: 11px 17px; font-weight: 750; transition: transform .12s ease, box-shadow .12s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: linear-gradient(135deg, #086fab, #075c95); box-shadow: 0 9px 22px rgba(8, 111, 171, .22); }
.btn-light { color: var(--navy); background: rgba(255,255,255,.92); border: 1px solid #d6e7ef; }
.btn-danger { color: #a72323; background: #fff0f0; border: 1px solid #ffd0d0; }
.btn-warn { color: #a7530a; background: #fff4e8; border: 1px solid #ffd4aa; }
.btn-success { color: #0e7755; background: #eaf9f2; border: 1px solid #bfe9d8; }
.btn-small { padding: 7px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 13px; }
.form-message { min-height: 22px; font-size: 14px; color: var(--red); }
.dashboard-head { display: flex; justify-content: space-between; align-items: end; gap: 22px; margin-bottom: 18px; }
.dashboard-head h2 { margin: 8px 0 6px; font-size: 34px; }
.dashboard-head p { margin: 0; color: var(--muted); }
.dashboard-actions { display: flex; gap: 10px; }
.status-strip { border: 1px solid var(--line); background: white; border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; color: var(--muted); }
.status-strip.ok { color: var(--green); background: #edf9f4; border-color: #cdebdc; }
.status-strip.error { color: var(--red); background: #fff1f1; border-color: #f5cccc; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 18px; box-shadow: 0 8px 24px rgba(20, 85, 125, .07); }
.stat-card span { color: var(--muted); font-size: 14px; }
.stat-card strong { display: block; margin-top: 7px; font-size: 30px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.filter-row { display: grid; grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(145px, 190px)); gap: 10px; padding: 18px; border-bottom: 1px solid var(--line); background: #fbfeff; }
.table-wrap { overflow: auto; min-height: 500px; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th { text-align: left; font-size: 13px; color: var(--muted); background: #f3f9fc; padding: 13px 14px; position: sticky; top: 0; z-index: 1; }
td { border-top: 1px solid #edf3f6; padding: 14px; vertical-align: top; }
.rule-term { font-weight: 800; margin-bottom: 5px; }
.rule-code { color: var(--muted); font-size: 12px; }
.rule-note { max-width: 360px; color: var(--muted); font-size: 13px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.severity-A { color: var(--red); background: #ffeaea; }
.severity-B { color: var(--orange); background: #fff0df; }
.severity-C { color: #8b6900; background: #fff8cf; }
.severity-D { color: var(--purple); background: #f2eaff; }
.status-published { color: var(--green); background: #e7f8f0; }
.status-draft { color: #5a6c7b; background: #edf2f5; }
.status-reviewing { color: #8b6900; background: #fff8cf; }
.status-disabled { color: var(--red); background: #ffeaea; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 205px; }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; border-top: 1px solid var(--line); color: var(--muted); }
.pagination > div { display: flex; gap: 8px; }
.actions-col { width: 225px; }
.empty-row { text-align: center; padding: 80px 20px; color: var(--muted); }
dialog { width: min(960px, calc(100% - 28px)); max-height: 92vh; border: 0; border-radius: 23px; padding: 0; box-shadow: 0 25px 80px rgba(4, 40, 70, .28); }
dialog::backdrop { background: rgba(4, 26, 46, .52); backdrop-filter: blur(3px); }
.rule-form { padding: 26px; overflow-y: auto; max-height: 92vh; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 20px; }
.dialog-head h2 { margin: 7px 0 0; }
.icon-btn { border: 0; background: #edf5f8; width: 38px; height: 38px; border-radius: 12px; font-size: 25px; color: var(--navy); }
.form-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rule-form > label, .rule-form fieldset { margin-bottom: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
legend { padding: 0 7px; font-weight: 750; color: #27445b; }
.check-grid { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.check-grid label, .compact-checks label { flex-direction: row; align-items: center; font-weight: 600; }
.check-grid input, .compact-checks input { width: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
@media (max-width: 950px) {
  .auth-card { grid-template-columns: 1fr; }
  .auth-copy, .auth-form { padding: 34px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .form-grid.four { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .topbar, .dashboard-head { align-items: flex-start; flex-direction: column; }
  .top-actions, .dashboard-actions { width: 100%; }
  .top-actions .btn, .dashboard-actions .btn { flex: 1; }
  main { width: min(100% - 18px, 1480px); margin-top: 18px; }
  .stats-grid, .filter-row, .form-grid.two, .form-grid.four { grid-template-columns: 1fr; }
  .auth-copy, .auth-form { padding: 26px; }
}
