/* Apple-like + liquid glass · DNS 授权 */
:root {
  --bg: #f3f6fb;
  --bg2: linear-gradient(165deg, #f8fbff 0%, #edf2f9 48%, #f4f7fc 100%);
  --text: #1f2937;
  --text2: #6b7280;
  --glass: rgba(255, 255, 255, 0.7);
  --glass2: rgba(255, 255, 255, 0.88);
  --stroke: rgba(30, 64, 175, 0.12);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  --blur: blur(18px) saturate(1.25);
  --radius: 14px;
  --radius-sm: 10px;
  --accent: #2563eb;
  --accent2: #2563eb;
  --warn: #ff9500;
  --danger: #ff3b30;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg2);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.minimal-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.minimal-wrap { width: 100%; max-width: 420px; }

.glass-panel {
  background: var(--glass2);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.glass-panel--narrow { max-width: 420px; margin: 0 auto; }

.layout-admin {
  display: flex;
  min-height: 100vh;
}

.glass-nav--side {
  width: 220px;
  flex-shrink: 0;
  padding: 20px 16px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-right: 1px solid var(--stroke);
}

.glass-nav__brand {
  font-weight: 600;
  font-size: 17px;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.glass-nav__meta {
  margin-top: -14px;
  margin-bottom: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.glass-nav__links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.glass-nav__links a {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}

.glass-nav__links a:hover {
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
}

.glass-nav__muted { opacity: 0.75; }

.layout-admin .glass-nav--side {
  background: linear-gradient(180deg, #173173 0%, #1f4bb9 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.layout-admin .glass-nav__brand {
  color: #fff;
  font-size: 18px;
  margin-bottom: 18px;
}

.layout-admin .glass-nav__links a {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}

.layout-admin .glass-nav__links a.is-active {
  background: rgba(255, 255, 255, 0.22);
}

.layout-admin .glass-nav__links a:hover {
  background: rgba(255, 255, 255, 0.14);
}

.layout-admin .glass-nav__muted {
  opacity: 0.9;
}

.glass-main {
  flex: 1;
  padding: 28px 32px 48px;
  overflow: auto;
}

.layout-admin .glass-main {
  background: linear-gradient(180deg, #f6f8fc 0%, #f0f4fa 100%);
}

.layout-user .glass-nav--top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--stroke);
  position: sticky;
  top: 0;
  z-index: 10;
}

.glass-nav--top .glass-nav__links {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

.layout-user .glass-main--user {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.layout-user.layout-user-side {
  display: flex;
  min-height: 100vh;
}

.layout-user .glass-nav--side-user {
  width: 220px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #173173 0%, #1f4bb9 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.layout-user .glass-nav--side-user .glass-nav__brand {
  color: #fff;
  font-size: 18px;
  margin-bottom: 18px;
}

.layout-user .glass-nav--side-user .glass-nav__links a {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}

.layout-user .glass-nav--side-user .glass-nav__links a:hover {
  background: rgba(255, 255, 255, 0.14);
}

.layout-user .glass-main--user-side {
  flex: 1;
  padding: 28px 32px 48px;
  background: linear-gradient(180deg, #f6f8fc 0%, #f0f4fa 100%);
}

.glass-main--user-inner {
  max-width: 980px;
  margin: 0 auto;
}

.layout-user.layout-user-side .glass-main--user-inner {
  max-width: none;
  margin: 0;
}

.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.page-subtitle {
  margin-top: -10px;
  margin-bottom: 14px;
  color: var(--text2);
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-soft {
  background: rgba(37, 99, 235, 0.12);
  color: #1e40af;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
}

.section-title--inline {
  margin-top: 0;
}

.muted { color: var(--text2); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.break-all { word-break: break-all; }
.nowrap { white-space: nowrap; }

.stack-form label {
  display: block;
  margin: 12px 0 6px;
  font-size: 13px;
  color: var(--text2);
}

.input, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  font-family: inherit;
}

.textarea { min-height: 100px; resize: vertical; }

.btn {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent2);
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-warn { background: var(--warn); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }

.form-error { color: var(--danger); margin: 0 0 12px; }

.toolbar {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.admin-filter-input {
  max-width: 360px;
  min-height: 40px;
  margin-left: auto;
}

.compact-input {
  width: auto;
  min-width: 140px;
  max-width: 220px;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 14px;
}

.table-wrap {
  overflow: auto;
}

.stats-grid--management {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 18px;
}

.stat-filter-card {
  width: 100%;
  border: 1px solid var(--stroke);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.stat-filter-card:hover {
  border-color: rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
  text-decoration: none;
}

.stat-label { font-size: 13px; color: var(--text2); }
.stat-num { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }

.stat-card--warn .stat-num { color: var(--warn); }
.stat-card--danger .stat-num { color: var(--danger); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  vertical-align: top;
}

.data-table th {
  color: var(--text2);
  font-weight: 500;
  font-size: 13px;
  position: sticky;
  top: 0;
  background: rgba(248, 250, 255, 0.96);
  z-index: 1;
}

.auth-row--expired td {
  background: rgba(255, 59, 48, 0.05);
}

.auth-row--expiring td {
  background: rgba(255, 149, 0, 0.05);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-ok { background: rgba(52, 199, 89, 0.18); color: #1a7a3a; }
.badge-warn { background: rgba(255, 149, 0, 0.2); color: #a65c00; }
.badge-danger { background: rgba(255, 59, 48, 0.18); color: #c41e16; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-info { background: rgba(0, 122, 255, 0.12); color: #004999; }
.alert-success { background: rgba(52, 199, 89, 0.15); color: #1a6b32; }
.alert-warn { background: rgba(255, 149, 0, 0.15); color: #8a5200; }
.alert-danger { background: rgba(255, 59, 48, 0.12); color: #b01010; }

.glass-alert {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--stroke);
}

.alert-note {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 204, 0, 0.15);
  border: 1px solid rgba(255, 149, 0, 0.35);
}

.alert-note__title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #8a5200;
}

.alert-note__body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.qr-block { text-align: center; }
.qr-img { border-radius: 12px; vertical-align: middle; }

.mt-sm { margin-top: 8px; }
.mt-lg { margin-top: 24px; }
.mb-md { margin-bottom: 16px; }

.inline { display: inline-flex; align-items: center; gap: 8px; }

.host-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.host-field .input {
  flex: 1 1 200px;
  min-width: 0;
}
.host-field__suffix {
  color: var(--text2);
  font-size: 15px;
  white-space: normal;
  max-width: 100%;
}

.idn-puny {
  color: var(--text2);
  font-weight: 400;
}

.dns-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 249, 255, 0.9));
}

.dns-toolbar__label {
  font-size: 13px;
  color: var(--text2);
}

.dns-toolbar__value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 600;
  word-break: break-all;
}

.dns-toolbar__badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dns-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.dns-table {
  table-layout: fixed;
}

.dns-table th:nth-child(1) { width: 20%; }
.dns-table th:nth-child(2) { width: 12%; }
.dns-table th:nth-child(3) { width: 38%; }
.dns-table th:nth-child(4) { width: 14%; }
.dns-table th:nth-child(5) { width: 16%; }

.dns-table .input {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 14px;
}

.dns-actions {
  white-space: nowrap;
  min-width: 0;
}

.dns-actions form {
  display: inline;
  margin: 0;
}

.dns-cell-input {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.dns-value-field {
  display: grid;
  gap: 6px;
}

.dns-type-fields {
  display: grid;
  gap: 6px;
}

.dns-type-fields[hidden] {
  display: none;
}

.dns-mx-fields {
  grid-template-columns: minmax(160px, 1fr) 90px;
}

.dns-caa-fields {
  grid-template-columns: 70px 110px minmax(160px, 1fr);
}

.dns-type-hint {
  line-height: 1.35;
}

.dns-actions .inline-form + .inline-form {
  margin-left: 8px;
}

.dns-add-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 120px minmax(220px, 2fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.04);
}

.dns-add-row .btn {
  margin-top: 0;
}

.dns-toolbar-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.dns-search {
  flex: 1 1 280px;
  min-height: 38px;
  max-width: 520px;
}

.dns-link-btn {
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 13px;
  cursor: pointer;
  padding: 0 4px;
}

.dns-link-btn:hover {
  text-decoration: underline;
}

.dns-link-btn-danger {
  color: #dc2626;
}

.inline-form {
  display: inline;
}

.batch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.05);
}

.btn-compact {
  margin-top: 0;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.zone-sync-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.zone-sync-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.zone-sync-card__label {
  font-size: 17px;
  font-weight: 600;
}

.zone-sync-card__meta {
  margin-top: 4px;
  color: var(--text2);
  font-size: 13px;
}

.zone-management-panel {
  padding: 18px;
}

.zone-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.zone-search-input {
  flex: 1 1 320px;
  min-height: 40px;
}

.zone-table-wrap {
  max-height: calc(100vh - 360px);
  min-height: 240px;
}

.zone-table th:first-child,
.zone-table td:first-child {
  min-width: 260px;
}

.zone-name-cell {
  font-weight: 600;
  word-break: break-all;
}

.zone-open-form {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.zone-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
}

.zone-pagination .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn:disabled,
.dns-link-btn:disabled {
  opacity: 0.58;
  cursor: wait;
}

.is-loading {
  position: relative;
}

.app-toast-root {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 1000;
  max-width: min(360px, calc(100vw - 32px));
}

.app-toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(31, 41, 55, 0.92);
  color: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.2);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-toast--success { background: rgba(20, 130, 62, 0.94); }
.app-toast--danger { background: rgba(176, 16, 16, 0.94); }
.app-toast--info { background: rgba(0, 73, 153, 0.94); }

.app-toast--hide {
  opacity: 0;
  transform: translateY(-6px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal-pre {
  margin: 12px 0 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.05);
  white-space: pre-wrap;
  word-break: break-word;
}

.dns-row.is-pending {
  opacity: 0.45;
  pointer-events: none;
}

.customer-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.customer-workspace__sidebar {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 16px;
}

.customer-workspace__content {
  min-width: 0;
}

.dns-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.dns-sidebar {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 16px;
}

.dns-main {
  min-width: 0;
}

.workspace-auth-search {
  min-height: 38px;
  margin-bottom: 10px;
}

.workspace-auth-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workspace-auth-item {
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 10px;
  padding: 10px;
  color: inherit;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.65);
}

.workspace-auth-item:hover {
  border-color: rgba(37, 99, 235, 0.35);
  text-decoration: none;
}

.workspace-auth-item--active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.45);
}

.workspace-auth-item__title {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.workspace-auth-item__meta {
  margin-top: 4px;
  color: var(--text2);
  font-size: 12px;
}

.workspace-auth-item__badges {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.workspace-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace-actions .btn {
  margin-top: 0;
}

.dns-history-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dns-history-filter .btn {
  margin-top: 0;
}

@media (max-width: 768px) {
  .layout-admin { flex-direction: column; }
  .glass-nav--side {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--stroke);
  }
  .glass-nav__links { flex-direction: row; flex-wrap: wrap; }
  .layout-user.layout-user-side {
    flex-direction: column;
  }
  .layout-user .glass-nav--side-user {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }
  .layout-user .glass-main--user-side {
    padding: 18px 14px 28px;
  }
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .dns-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .dns-info-grid {
    grid-template-columns: 1fr;
  }
  .customer-workspace {
    grid-template-columns: 1fr;
  }
  .customer-workspace__sidebar {
    position: static;
    max-height: none;
  }
  .dns-workspace {
    grid-template-columns: 1fr;
  }
  .dns-sidebar {
    position: static;
    max-height: none;
  }
  .dns-add-row {
    grid-template-columns: 1fr;
  }
  .dns-mx-fields,
  .dns-caa-fields {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass-panel, .glass-nav, .glass-alert {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(255, 253, 248, 0.96);
  }
}

/* Rewrite shell separation: admin is private/dense, user area is calm/public. */
.layout-admin .glass-nav--side {
  background:
    radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.35), transparent 28%),
    linear-gradient(180deg, #111827 0%, #182235 58%, #0f172a 100%);
}

.layout-admin .glass-nav__meta {
  color: rgba(226, 232, 240, 0.72);
}

.layout-admin .glass-main {
  background:
    radial-gradient(circle at 80% 0%, rgba(37, 99, 235, 0.08), transparent 32%),
    linear-gradient(180deg, #f5f7fb 0%, #eef2f8 100%);
}

.layout-user .glass-nav--side-user {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.75), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(245, 247, 251, 0.92));
  border-right: 1px solid rgba(60, 60, 67, 0.12);
}

.layout-user .glass-nav--side-user .glass-nav__brand,
.layout-user .glass-nav--side-user .glass-nav__links a {
  color: #1c1c1e;
}

.layout-user .glass-nav--side-user .glass-nav__links a:hover {
  background: rgba(0, 122, 255, 0.08);
}

.layout-user .glass-main--user-side {
  background:
    radial-gradient(circle at 78% 0%, rgba(52, 199, 89, 0.08), transparent 30%),
    linear-gradient(180deg, #fbfaf8 0%, #f4f2ed 100%);
}

.layout-user .dns-workspace {
  align-items: flex-start;
}

.layout-user .dns-main .glass-panel {
  border-color: rgba(60, 60, 67, 0.1);
}
