:root {
  --bg: #f4f6f8;
  --panel: #fff;
  --text: #17212b;
  --muted: #718096;
  --line: #e3e8ee;
  --primary: #176b5b;
  --primary-dark: #105448;
  --blue: #3976d9;
  --green: #168568;
  --amber: #c67a16;
  --coral: #d45b4c;
  --danger: #c7473b;
  --shadow: 0 10px 30px rgba(26, 39, 49, .06);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.auth-shell { min-height: 100vh; background: #eef2f1; padding: 28px; }
.auth-brand, .logo { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; color: white; background: var(--primary); border-radius: 7px; font-weight: 800; font-size: 20px; }
.auth-brand strong, .logo strong { display: block; font-size: 18px; }
.auth-brand span, .logo span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.auth-panel { width: min(1120px, 100%); min-height: 650px; margin: 35px auto 0; display: grid; grid-template-columns: 1.08fr .92fr; background: var(--panel); box-shadow: 0 25px 80px rgba(29, 51, 45, .13); border-radius: 8px; overflow: hidden; }
.auth-copy { padding: 92px 74px; color: #fff; background: linear-gradient(145deg, #0f4f45, #1d7463 60%, #278674); position: relative; }
.auth-copy:after { content: ""; position: absolute; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.14); right: -150px; bottom: -170px; transform: rotate(25deg); }
.auth-copy .eyebrow { text-transform: uppercase; font-size: 12px; letter-spacing: 2px; opacity: .75; }
.auth-copy h1 { font-size: 45px; line-height: 1.22; letter-spacing: 0; margin: 34px 0 24px; }
.auth-copy > p:not(.eyebrow) { line-height: 1.9; opacity: .78; max-width: 390px; }
.auth-metric { position: absolute; left: 74px; bottom: 80px; display: flex; align-items: center; gap: 14px; }
.auth-metric b { font-size: 36px; }.auth-metric span { opacity: .72; }
.auth-form-wrap { display: grid; place-items: center; padding: 50px; }
.auth-form { width: min(360px, 100%); }
.form-heading { margin-bottom: 32px; }.form-heading h2 { font-size: 28px; margin: 0 0 8px; }.form-heading p, .panel-head p { color: var(--muted); margin: 0; font-size: 13px; }
label { display: block; font-size: 13px; font-weight: 600; color: #465463; margin-bottom: 18px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 11px 12px; margin-top: 7px; color: var(--text); background: #fff; outline: none; transition: .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23,107,91,.1); }
textarea { resize: vertical; line-height: 1.6; }
.captcha-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; margin-bottom: 23px; }.captcha-row input { margin-top: 0; }
.captcha { border: 0; border-radius: 6px; background: #e8eeec; color: var(--primary); font-family: monospace; font-size: 21px; font-weight: 800; letter-spacing: 5px; }
.primary, .secondary, .danger { border: 1px solid transparent; border-radius: 6px; padding: 10px 15px; font-weight: 600; font-size: 13px; }
.primary { background: var(--primary); color: #fff; }.primary:hover { background: var(--primary-dark); }
.secondary { background: #fff; border-color: var(--line); color: #394756; }.secondary:hover { border-color: #aab6c2; }
.danger { background: #fff; border-color: #edcac6; color: var(--danger); }.danger:hover { background: #fff3f2; }
.wide { width: 100%; padding: 12px; }
.switch-auth { text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; }.switch-auth button, .text-button { border: 0; background: transparent; color: var(--primary); font-weight: 700; }
.auth-notice { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 24px 16px 18px; z-index: 10; }
.logo { padding: 0 9px 24px; border-bottom: 1px solid var(--line); }
nav { padding-top: 22px; display: grid; gap: 5px; }
nav button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; color: #5e6a76; border-radius: 6px; padding: 11px 13px; text-align: left; font-weight: 600; }
nav button:hover { background: #f1f5f4; color: var(--primary); }nav button.active { color: var(--primary); background: #eaf4f1; }
.icon { display: inline-grid; place-items: center; width: 19px; font-size: 17px; }
.sidebar-user { margin-top: auto; border-top: 1px solid var(--line); padding: 17px 6px 0; display: grid; grid-template-columns: 38px 1fr 28px; gap: 10px; align-items: center; }
.sidebar-user b, .sidebar-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.sidebar-user b { font-size: 13px; }.sidebar-user span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.sidebar-user button { border: 0; background: transparent; color: var(--muted); font-size: 20px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #dcebe7; color: var(--primary); font-weight: 800; }.avatar.small { width: 34px; height: 34px; }
main { grid-column: 2; min-width: 0; }
header { height: 78px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header h1 { font-size: 19px; margin: 0 0 4px; }header p { margin: 0; color: var(--muted); font-size: 12px; }
#menu-toggle { display: none; border: 0; background: transparent; font-size: 22px; }.header-user { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 12px; }
.content { padding: 28px; max-width: 1600px; margin: auto; }
.page { display: none; }.page.active { display: block; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); }
.stat-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 7px; font-size: 20px; font-weight: 800; }.stat-icon.blue { color: var(--blue); background: #eaf1fc; }.stat-icon.green { color: var(--green); background: #e5f4ef; }.stat-icon.amber { color: var(--amber); background: #fff2df; }.stat-icon.coral { color: var(--coral); background: #fcebe8; }
.stat p { margin: 0 0 7px; color: var(--muted); font-size: 12px; }.stat strong { font-size: 28px; }.stat small { position: absolute; right: 18px; bottom: 17px; color: #9aa5af; font-size: 10px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); padding: 21px; margin-bottom: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; }.panel-head h2 { margin: 0 0 5px; font-size: 16px; }
.table-wrap { overflow-x: auto; margin: 0 -21px -21px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
th { color: #667381; background: #f8fafb; font-size: 11px; text-align: left; font-weight: 700; }
th, td { padding: 13px 15px; border-top: 1px solid var(--line); }td { color: #465462; }td.empty { padding: 60px; text-align: center; color: var(--muted); }
.badge { display: inline-block; border-radius: 4px; padding: 4px 7px; font-size: 10px; font-weight: 700; }.badge.on { color: #147159; background: #e5f4ef; }.badge.off { color: #b44239; background: #fbe9e7; }.badge.action { color: #386daa; background: #eaf1fa; }
.filter-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }.filter-grid label { margin: 0; }.filter-grid button { margin-bottom: 0; height: 40px; }
.toolbar { align-items: flex-end; }.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 5px; }.row-actions button { border: 0; border-radius: 4px; padding: 5px 7px; background: #eef3f3; color: var(--primary); font-size: 11px; }.row-actions .remove { color: var(--danger); background: #fff0ef; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-top: 18px; color: var(--muted); font-size: 12px; }.pagination button { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; }.pagination select { width: 80px; margin: 0; padding: 7px; }
.two-col { display: grid; grid-template-columns: .78fr 1.22fr; gap: 22px; align-items: start; }.form-panel > label { max-width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }.form-grid.three { grid-template-columns: repeat(3, 1fr); }.span-2 { grid-column: span 2; }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 7px; }.input-action input { margin-top: 0; }.input-action button { white-space: nowrap; }
.check { display: flex; align-items: center; gap: 9px; color: #53606d; }.check input { width: auto; margin: 0; }
.rule-help, .format-note { border: 1px solid #dce9e6; background: #f4f9f8; padding: 14px; margin: 0 0 18px; border-radius: 6px; color: #5c6c69; font-size: 12px; line-height: 2; }.rule-help code { margin-left: 9px; }.format-note { display: grid; grid-template-columns: 110px 1fr; align-items: center; }
code { color: var(--primary); background: #e6f1ee; border-radius: 3px; padding: 2px 5px; font-family: ui-monospace, monospace; }
.import-panel { max-width: 980px; margin: 0 auto; }.file-drop { border: 1px dashed #aabcb8; border-radius: 7px; min-height: 130px; display: grid; place-items: center; align-content: center; background: #f7faf9; color: var(--primary); cursor: pointer; }.file-drop input { display: none; }.file-drop span { font-weight: 700; }.file-drop small { color: var(--muted); margin-top: 8px; font-weight: 400; }
.settings-grid { grid-template-columns: 1fr 1fr; }
.toast { position: fixed; top: 18px; left: 50%; transform: translate(-50%, -20px); background: #1d2e2a; color: #fff; padding: 11px 18px; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: .2s; z-index: 100; font-size: 13px; }.toast.show { opacity: 1; transform: translate(-50%, 0); }.toast.error { background: #a53e36; }
dialog { width: min(650px, calc(100% - 28px)); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 25px 80px rgba(0,0,0,.22); }dialog::backdrop { background: rgba(20,31,34,.45); }.dialog-form { padding: 24px; }.dialog-head { display: flex; justify-content: space-between; margin-bottom: 20px; }.dialog-head h2 { margin: 0 0 4px; }.dialog-head p { margin: 0; color: var(--muted); font-size: 12px; }.dialog-head button { border: 0; background: transparent; font-size: 25px; color: var(--muted); }
@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }.filter-grid { grid-template-columns: 1fr 1fr; }.filter-grid button { width: max-content; }.two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .auth-shell { padding: 0; }.auth-brand { padding: 18px; }.auth-panel { margin: 0; border-radius: 0; grid-template-columns: 1fr; min-height: calc(100vh - 74px); }.auth-copy { display: none; }.auth-form-wrap { padding: 35px 24px; }
  .app { grid-template-columns: 1fr; }.sidebar { transform: translateX(-100%); transition: .2s; box-shadow: 10px 0 30px rgba(0,0,0,.12); }.sidebar.open { transform: translateX(0); }main { grid-column: 1; }
  header { padding: 0 16px; justify-content: flex-start; gap: 12px; }#menu-toggle { display: block; }.header-user { margin-left: auto; }.header-user span { display: none; }
  .content { padding: 16px; }.stats-grid { grid-template-columns: 1fr; gap: 12px; }.stat { padding: 17px; }.filter-grid, .form-grid.three { grid-template-columns: 1fr; }.form-grid { grid-template-columns: 1fr; }.span-2 { grid-column: span 1; }
  .panel-head.toolbar { align-items: flex-start; flex-direction: column; }.actions { width: 100%; }.actions button { flex: 1; }.settings-grid { grid-template-columns: 1fr; }
  .format-note { grid-template-columns: 1fr; }.format-note code { margin-bottom: 8px; overflow-wrap: anywhere; }.panel { padding: 16px; }.table-wrap { margin: 0 -16px -16px; }
  .input-action { grid-template-columns: 1fr; }
}
