:root {
  font-family: Inter, "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color-scheme: light;
  color: var(--text);
  background: var(--canvas);
  --canvas: #eef2f8;
  --surface: #ffffff;
  --surface-soft: #f6f8fc;
  --text: #19253d;
  --muted: #465670;
  --line: #d7e0ee;
  --control-line: #8191ad;
  --blue: #1746bd;
  --blue-hover: #12358f;
  --blue-soft: #eaf1ff;
  --blue-line: #bacdf4;
  --focus: #2759d4;
  --nav: #121e37;
  --nav-hover: #26395f;
  --nav-text: #eff4ff;
  --nav-muted: #bfcdeb;
  --nav-line: #3d5178;
  --green-ink: #075139;
  --green-bg: #dcf4e8;
  --amber-ink: #704405;
  --amber-bg: #fff0cc;
  --red-ink: #8a241d;
  --red-bg: #fce6e2;
  --danger: #a32924;
  --radius: 13px;
  --control-radius: 9px;
  --control-height: 48px;
  --gutter: clamp(18px, 3vw, 48px);
  --shadow: 0 2px 7px #1d30540c, 0 12px 30px #1d305407;
}

* { box-sizing: border-box; }
body { margin: 0; }
[v-cloak] { display: none; }
button, .button, select, input, textarea { font: inherit; }
button, .button, select, input:not([type=checkbox], [type=file]), textarea {
  min-height: var(--control-height);
  padding: 9px 14px;
  border: 1px solid var(--control-line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
}
button, .button { font-weight: 650; }
button, .button, select, input[type=checkbox], summary { cursor: pointer; }
button:hover, .button:hover { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-hover); }
button:disabled, select:disabled { cursor: default; color: #525e72; background: #e9edf4; border-color: #b1bdce; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, .import-scope:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
button.primary, .button.primary { color: white; background: var(--blue); border-color: var(--blue); }
button.primary:hover, .button.primary:hover { color: white; background: var(--blue-hover); border-color: var(--blue-hover); }
button.danger { color: white; background: var(--danger); border-color: var(--danger); }
button.danger:hover { color: white; background: #7d201c; border-color: #7d201c; }
button.primary:disabled, button.danger:disabled { background: #dce3ef; color: #4a576d; border-color: #aebbd0; }
a { color: var(--blue); }
a.button { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
input, select, textarea { max-width: 100%; }
input[type=checkbox] { width: 20px; height: 20px; margin: 0 4px 0 0; vertical-align: middle; accent-color: var(--blue); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; min-height: 96px; }

#app { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.session-gate { grid-column: 1/-1; place-self: center; width: min(450px, calc(100vw - 36px)); }
.session-gate .form button { width: 100%; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 22px 15px 16px;
  background: var(--nav);
  color: var(--nav-text);
}
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 26px; font-size: 22px; font-weight: 750; line-height: 1.1; }
.brand span { display: block; margin-top: 5px; color: var(--nav-muted); font-size: 14px; font-weight: 500; }
.mark {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  height: 40px;
  border-radius: 10px;
  background: #b6d2ff;
  color: var(--nav);
  font: 750 25px/1 system-ui, sans-serif;
}
.sidebar .mobile-nav-toggle { display: none; white-space: nowrap; }
nav { display: grid; gap: 4px; margin-bottom: 18px; }
.sidebar button {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--nav-text);
  border-color: transparent;
  background: transparent;
  text-align: left;
}
.sidebar button:hover { background: var(--nav-hover); color: white; }
.sidebar button.current { background: #dae7ff; color: #132c61; }
.sidebar button:focus-visible { outline-color: #b6d2ff; }
.menu-toggle { justify-content: space-between; }
.sidebar .menu-toggle { margin-top: 8px; border-color: var(--nav-line); }
.menu-section { border-left: 1px solid var(--nav-line); margin: 1px 0 5px 14px; padding-left: 10px; }
.menu-section small { margin: 7px 0 5px; padding-left: 10px; color: var(--nav-muted); }
.menu-section button { width: 100%; padding-inline: 10px; }
.side-foot {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid var(--nav-line);
  color: var(--nav-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.side-foot small { margin: 0 0 0 auto; color: inherit; }
.light { width: 8px; height: 8px; border-radius: 50%; background: #a1c2ff; }
main { min-width: 0; }
header {
  min-height: 74px;
  padding: 10px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.crumb { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.crumb em { margin-inline: 7px; color: var(--muted); font-style: normal; }
.toptools, .actions, .center, .selection, .pager, .scope { display: flex; align-items: center; gap: 10px; }
.toptools, .wrap { flex-wrap: wrap; }
.toptools { justify-content: flex-end; }
.toptools select { max-width: min(42vw, 290px); }
.account-caption { color: var(--muted); font-size: 14px; }
.guard {
  display: inline-block;
  padding: 4px 9px;
  border: 1px solid var(--blue-line);
  border-radius: 7px;
  background: var(--blue-soft);
  color: #21417e;
  font-size: 13px;
  font-weight: 650;
}
.body { max-width: 1600px; margin: auto; padding: 30px var(--gutter) 60px; }
.heading, .panel-title, .account-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.heading { margin-bottom: 23px; flex-wrap: wrap; }
.heading p:empty { display: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 2.9vw, 38px); line-height: 1.23; letter-spacing: -.025em; }
.heading p { margin-top: 7px; }
h2 { font-size: 20px; line-height: 1.35; }
h3 { margin: 10px 0; font-size: 18px; }
p, small, .hint { color: var(--muted); }
p { line-height: 1.65; }
small, .hint { font-size: 14px; }
small { display: block; margin-top: 4px; font-weight: 450; }
h2 small { display: inline; margin-left: 5px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.metrics article, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.metrics article { padding: 16px 19px; }
.metrics label { color: var(--muted); font-size: 14px; font-weight: 650; }
.metrics strong { display: block; margin-top: 5px; font-size: clamp(25px, 2.8vw, 36px); font-variant-numeric: tabular-nums; line-height: 1.2; }
.zone-inventory .metrics article:nth-child(2) strong { color: var(--green-ink); }
.zone-inventory .metrics article:nth-child(3) strong { color: var(--amber-ink); }
.panel { min-width: 0; overflow: hidden; margin-bottom: 19px; }
.panel-title { padding: 15px 20px; border-bottom: 1px solid var(--line); min-height: 65px; flex-wrap: wrap; }
.panel-title:last-child { border-bottom: 0; }
.panel-title .actions, .form .actions { flex-wrap: wrap; }
.overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: #203765;
  color: white;
}
.overview span { color: #d6e4ff; font-size: 14px; }
.overview h2 { margin: 5px 0; font-size: 25px; }
.overview p { color: #e8f0ff; }
.overview button { background: #eaf1ff; border-color: #eaf1ff; color: #19366f; }
.overview button:hover { background: #d6e5ff; border-color: #d6e5ff; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.tool-card { margin: 0; padding: 20px; }
.tool-card h2 { display: flex; align-items: center; gap: 10px; }
.tool-card h2 i { color: var(--blue); font: 20px system-ui, sans-serif; }
.tool-card p { margin: 9px 0 16px; }
.tool-links { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.tool-links button { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-soft); text-align: left; }
.tool-links button:hover { background: var(--blue-soft); }
.tool-links span { color: var(--blue); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px; }
.filters input { width: min(285px, 100%); }
.selection, .pager { padding: 12px 20px; color: var(--muted); font-size: 14px; }
.selection { flex-wrap: wrap; background: var(--surface-soft); border-top: 1px solid var(--line); }
.pager { justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.pager span:first-child { margin-right: auto; }
.inv-pager input { width: 72px; text-align: center; }
.scroll { overflow: auto; max-height: 63vh; }
.scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.table-scroll-hint { display: none; }
.scroll table { border-collapse: separate; border-spacing: 0; width: 100%; text-align: left; white-space: nowrap; }
th, td { padding: 12px 15px; border-bottom: 1px solid var(--line); font-size: 15px; }
th { position: sticky; top: 0; z-index: 1; background: #e8effa; color: #293d60; font-weight: 700; }
tbody tr:nth-child(even) { background: #f8faff; }
tbody tr:hover { background: #eef4ff; }
tr:last-child td { border-bottom: 0; }
td button + button { margin-left: 4px; }
td .actions button + button { margin-left: 0; }
.domain { font-size: 16px; font-weight: 700; color: #203d70; }
.mono { font: 14px/1.6 ui-monospace, Consolas, monospace; color: var(--muted); }
.read-detail { white-space: normal; overflow-wrap: anywhere; min-width: 15em; }
.zone-table td { vertical-align: top; }
.zone-table .domain { min-width: 166px; white-space: normal; overflow-wrap: anywhere; }
.zone-status, .zone-ns { min-width: 145px; max-width: 220px; white-space: normal; overflow-wrap: anywhere; }
.zone-note { margin-top: 6px; white-space: pre-wrap; }
.zone-row-actions { min-width: 202px; }

.pill { display: inline-block; padding: 4px 10px; border-radius: 6px; background: #e9eff8; color: #354661; font-size: 14px; font-weight: 700; white-space: nowrap; }
.active, .demo, .success, .completed, .change, .enabled, .site-running, .monitor-ok { background: var(--green-bg); color: var(--green-ink); }
.pending, .paused, .conflict, .completed_with_errors, .site-pending, .monitor-waiting { background: var(--amber-bg); color: var(--amber-ink); }
.error, .failed, .monitor-unavailable, .monitor-incomplete { background: var(--red-bg); color: var(--red-ink); }
.activation-pending { color: var(--amber-ink); font-weight: 650; }
.activation-unavailable, .activation-incomplete { color: var(--red-ink); font-weight: 650; }
.activation-ok { color: var(--green-ink); font-weight: 650; }
.activation-results { display: grid; gap: 8px; list-style: none; padding: 0; margin: 4px 0 8px; }
.activation-results li { display: flex; align-items: baseline; gap: 6px 13px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface-soft); }
.activation-results small { flex-basis: 100%; margin: 0; }

.empty { padding: 34px 20px; text-align: center; }
.intro { padding: 46px 18px 51px; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 11px; font-size: 28px; background: var(--blue-soft); color: var(--blue); }
.center { justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.account-row { padding: 16px 21px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.account-row > div { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.form, .dialog-body { padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 16px 0 20px; }
.form label, .dialog label { display: grid; gap: 7px; color: #344562; font-size: 15px; font-weight: 650; }
.form > label, .form > .scope { margin-bottom: 14px; }
.form > label { max-width: 670px; }
.scope, .notice {
  padding: 11px 14px;
  border: 1px solid var(--blue-line);
  border-radius: var(--control-radius);
  justify-content: space-between;
  flex-wrap: wrap;
  background: var(--blue-soft);
  color: #233e73;
}
.notice { display: flex; align-items: center; gap: 8px; margin-bottom: 17px; }
.notice button, .toast button {
  min-width: var(--control-height);
  padding: 4px 8px;
  border-color: currentColor;
  background: transparent;
  color: inherit;
  font-size: 21px;
}
.notice button:hover, .toast button:hover { background: #ffffff38; color: inherit; }
.error { padding: 10px 13px; border-radius: var(--control-radius); }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: calc(100vw - 40px);
  padding: 12px 15px;
  border-radius: var(--control-radius);
  background: #872822;
  color: white;
  z-index: 12;
}
.toast button:focus-visible { outline-color: #fddad6; }
.backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: #15244180; }
.dialog {
  width: min(640px, 100%);
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 18px 80px #121e3750;
}
.dialog-body { overflow: auto; display: grid; gap: 14px; }
.dialog-body > button { justify-self: start; }
.close { min-width: var(--control-height); font-size: 22px; line-height: 1; }
.record { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.record:last-of-type { margin-bottom: 10px; }
details p { font-size: 14px; }
.template-editor { margin-top: 18px; }
.template-dns-row { min-width: 0; margin: 12px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--control-radius); }
.template-dns-row .grid { margin: 2px 0 12px; }
.template-dns-row .actions label { margin: 0; }
.template-preview-value { white-space: pre-line; overflow-wrap: anywhere; }
.domain-scope { padding: 16px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: var(--radius); margin-bottom: 20px; }
.scope-head, .scope-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scope-head { justify-content: space-between; margin-bottom: 9px; }
.scope-head span { font-size: 14px; color: var(--muted); }
.domain-scope textarea { width: 100%; margin: 0 0 10px; }
.domain-scope .scope-actions label.button { display: inline-flex; align-items: center; cursor: pointer; position: relative; }
.import-scope input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.domain-scope .hint { margin: 8px 0; }
.scope-issues { padding: 9px 12px; background: var(--amber-bg); color: var(--amber-ink); border-radius: 7px; overflow-wrap: anywhere; }
.scope-picker { margin-top: 12px; }
.scope-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 5px; margin: 10px 0; }
.domain-scope .scope-checks label { min-height: 38px; display: flex; align-items: center; gap: 7px; overflow-wrap: anywhere; }
.config-backup-panel pre { max-height: 24rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.dns-delete-controls { margin-block: 14px; }

@media (max-width: 1040px) {
  #app { grid-template-columns: 220px minmax(0, 1fr); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-links { grid-template-columns: 1fr; }
  .account-caption { display: none; }
}

@media (max-width: 800px) {
  #app { display: block; }
  .sidebar { position: static; height: auto; padding: 10px 16px; overflow: visible; }
  .brand { padding: 2px 0; font-size: 20px; }
  .mark { flex-basis: 36px; height: 36px; }
  .sidebar .mobile-nav-toggle { display: flex; border-color: var(--nav-line); }
  .sidebar nav { display: none; }
  .sidebar nav.mobile-open { display: grid; margin: 10px 0 2px; }
  .side-foot { display: none; }
  .session-gate { margin: 20px auto; }
  header { padding-block: 8px; min-height: 64px; }
  .toptools { justify-content: flex-start; }
  .body { padding-top: 21px; }
  .table-scroll-hint { display: block; padding: 9px 13px; font-size: 14px; }
}

@media (max-width: 580px) {
  :root { --gutter: 12px; }
  .crumb { display: none; }
  .toptools { width: 100%; }
  .toptools select { max-width: min(100%, 240px); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metrics article, .tool-card { padding: 13px; }
  .tool-grid, .grid { grid-template-columns: 1fr; }
  .tool-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form, .dialog-body, .panel-title, .filters, .selection, .pager, .overview { padding-inline: 13px; }
  .heading > button { width: 100%; }
  .zone-toolbar .actions { width: 100%; }
  .zone-toolbar .actions > * { flex: 1 1 auto; }
}

@media (max-width: 360px) {
  .tool-links { grid-template-columns: 1fr; }
}
