:root {
  --nav: #132238;
  --nav-active: #243a59;
  --page: #f4f6f9;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #66758b;
  --line: #dce3ec;
  --line-strong: #c6d0dd;
  --primary: #1769d2;
  --primary-dark: #0e56b4;
  --green: #087a55;
  --green-bg: #eaf8f1;
  --yellow: #946200;
  --yellow-bg: #fff7dc;
  --red: #b43131;
  --red-bg: #fff0f0;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 Inter, "Microsoft YaHei", Arial, sans-serif; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.auth-view { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(420px, .95fr); background: #fff; }
.auth-media { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 42px 6vw 72px; color: #fff; background: #132238 url('/static/dns-infrastructure.jpg') center/cover; isolation: isolate; }
.auth-media::before { position: absolute; inset: 0; z-index: -1; content: ""; background: rgba(12, 30, 52, .83); }
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: var(--ink); font-size: 20px; font-weight: 760; }
.brand-light { color: #fff; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; color: #fff; background: var(--primary); font-size: 11px; font-weight: 800; }
.auth-copy { max-width: 620px; }
.auth-copy h1 { margin: 0 0 14px; max-width: 580px; font-size: 42px; line-height: 1.18; letter-spacing: 0; }
.auth-copy p { max-width: 520px; margin: 0; color: #d7e4f4; font-size: 17px; }
.auth-panel { display: grid; place-items: center; min-height: 100vh; padding: 36px; }
.auth-box { width: min(420px, 100%); }
.auth-brand { display: none; }
.auth-box h2 { margin: 32px 0 5px; font-size: 26px; letter-spacing: 0; }
.auth-box > p { margin: 0 0 28px; }
.form-stack { display: grid; gap: 17px; }
.form-stack label, .field { display: grid; gap: 7px; color: #304057; font-weight: 680; }
.input, select, textarea { width: 100%; min-height: 38px; padding: 8px 10px; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 5px; outline: none; background: #fff; }
textarea { resize: vertical; }
.input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 105, 210, .12); }
.link-button { margin-top: 22px; padding: 0; color: var(--primary); border: 0; background: transparent; cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 13px; border: 1px solid var(--line-strong); border-radius: 5px; color: #314158; background: #fff; font-weight: 680; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #aab7c8; background: #f8fafc; }
.btn.primary { color: #fff; border-color: var(--primary); background: var(--primary); }
.btn.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.btn.danger { color: #fff; border-color: var(--red); background: var(--red); }
.btn.small { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 5px; color: #40516a; background: #fff; cursor: pointer; font-size: 18px; }

.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 18px 12px; color: #c8d5e5; background: var(--nav); }
.sidebar-brand { padding: 2px 10px 24px; }
.main-nav { display: grid; gap: 3px; }
.nav-group { margin: 17px 10px 5px; color: #8296b1; font-size: 11px; font-weight: 760; }
.nav-button { width: 100%; padding: 9px 11px; border: 0; border-radius: 5px; color: #cad6e5; background: transparent; text-align: left; cursor: pointer; }
.nav-button:hover, .nav-button.active { color: #fff; background: var(--nav-active); }
.sidebar-status { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 15px 10px 3px; border-top: 1px solid #2b405d; color: #99aac0; font-size: 12px; }
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: #d59b2d; }
.health-dot.ok { background: #31b77c; }
.health-dot.bad { background: #e66464; }
.app-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; height: 62px; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .97); }
.topbar-title { font-weight: 760; }
.topbar-actions, .account { display: flex; align-items: center; gap: 11px; }
.status-link { color: #46566d; font-size: 13px; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #1559ad; background: #e4efff; font-weight: 760; }
.content { width: min(1500px, 100%); margin: 0 auto; padding: 25px 28px 48px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; line-height: 1.3; letter-spacing: 0; }
.page-head p { margin: 5px 0 0; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; background: #fff; overflow: hidden; }
.metric { min-height: 114px; padding: 19px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { margin-top: 7px; font-size: 29px; font-weight: 760; }
.metric-detail { margin-top: 4px; color: var(--muted); font-size: 12px; }
.section-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.panel + .panel { margin-top: 16px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); font-weight: 720; }
.panel-body { padding: 17px; }
.notice { padding: 11px 13px; border: 1px solid #bed5f4; border-radius: 5px; color: #234d80; background: #f0f6ff; }
.notice.warn { border-color: #ecd38d; color: #795500; background: var(--yellow-bg); }
.notice.danger { border-color: #efc1c1; color: #8c2929; background: var(--red-bg); }
.empty { padding: 44px 20px; color: var(--muted); text-align: center; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 20px; color: var(--green); background: var(--green-bg); font-size: 12px; font-weight: 680; }
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-pill.wait { color: var(--yellow); background: var(--yellow-bg); }
.status-pill.off, .status-pill.failed { color: var(--red); background: var(--red-bg); }
.tag { display: inline-block; min-width: 42px; padding: 2px 6px; border-radius: 4px; color: #1857a5; background: #eaf2fd; text-align: center; font-size: 12px; font-weight: 720; }

.zone-header { margin: -25px -28px 18px; padding: 20px 28px 0; border-bottom: 1px solid var(--line); background: #fff; }
.zone-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.zone-name { display: flex; align-items: center; gap: 10px; }
.zone-name h1 { margin: 0; font-size: 22px; letter-spacing: 0; }
.zone-meta { display: flex; gap: 18px; margin: 8px 0 17px; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 24px; overflow-x: auto; }
.tab-button { position: relative; min-height: 42px; padding: 0; border: 0; color: #526279; background: transparent; cursor: pointer; white-space: nowrap; }
.tab-button.active { color: var(--primary); font-weight: 720; }
.tab-button.active::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--primary); content: ""; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .input { width: 210px; }
.toolbar select { width: 130px; }
.bulk-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #bed5f4; background: #f0f6ff; }
.table-scroll { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { height: 47px; padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.data-table th { color: var(--muted); background: #f8fafc; font-size: 12px; font-weight: 680; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.cell-value { max-width: 310px; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 10px; }
.row-action { padding: 0; border: 0; color: var(--primary); background: transparent; cursor: pointer; font-size: 12px; }
.row-action.danger { color: var(--red); }
.pagination { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); }
.pagination-actions { display: flex; align-items: center; gap: 8px; }

.detail-list { display: grid; grid-template-columns: 170px minmax(0, 1fr); margin: 0; }
.detail-list dt, .detail-list dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.node-result { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.node-result:last-child { border-bottom: 0; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(15, 29, 48, .58); }
.modal { width: min(640px, 100%); max-height: 90vh; overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 18px 60px rgba(11, 27, 48, .28); }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.code-box { max-height: 340px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafc; font-family: ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 40; max-width: min(420px, calc(100vw - 40px)); padding: 11px 14px; border-radius: 5px; color: #fff; background: #18273d; box-shadow: 0 10px 35px rgba(11, 27, 48, .25); }
.toast.error { background: #a82e2e; }

@media (max-width: 980px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .section-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 760px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-media { display: none; }
  .auth-panel { padding: 24px; }
  .auth-brand { display: inline-flex; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; display: block; height: auto; padding: 10px 12px; }
  .sidebar-brand, .sidebar-status, .nav-group { display: none; }
  .main-nav { display: flex; overflow-x: auto; }
  .nav-button { white-space: nowrap; }
  .topbar { padding: 0 15px; }
  .status-link, .account > span:not(.avatar) { display: none; }
  .content { padding: 18px 14px 36px; }
  .zone-header { margin: -18px -14px 16px; padding: 16px 14px 0; }
  .zone-title-row, .page-head { align-items: stretch; flex-direction: column; }
  .zone-meta { flex-wrap: wrap; gap: 7px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .node-result { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 500px) {
  .metrics { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .toolbar .input, .toolbar select { width: 100%; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .pagination { align-items: flex-start; flex-direction: column; gap: 8px; }
}
