/* ============ Tokens ============ */
:root {
  --font: Vazirmatn, system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1100px 520px at 100% -8%, rgb(243 128 32 / 9%), transparent 60%), radial-gradient(900px 480px at -5% 0%, rgb(99 102 241 / 7%), transparent 55%);
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --surface-3: #e6e9f0;
  --glass: rgb(255 255 255 / 72%);
  --border: #e4e7ee;
  --border-strong: #cfd5df;
  --text: #121722;
  --text-2: #475163;
  --muted: #7b8496;

  --accent: #f38020;
  --accent-2: #f9a43f;
  --accent-hover: #e2701a;
  --accent-soft: #fff1e4;
  --accent-ink: #ffffff;
  --accent-grad: linear-gradient(135deg, #f6821f 0%, #fbad41 100%);

  --info: #2563eb;
  --info-soft: #e8efff;
  --success: #16a34a;
  --success-soft: #e5f6ec;
  --warning: #b45309;
  --warning-soft: #fdf2e0;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --violet: #7c3aed;
  --violet-soft: #f1eafe;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 5%);
  --shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 10px 30px -14px rgb(16 24 40 / 18%);
  --shadow-lg: 0 30px 60px -16px rgb(16 24 40 / 30%);
  --ring: 0 0 0 3px rgb(243 128 32 / 25%);

  --sidebar-w: 256px;
  --topbar-h: 62px;
  --bottom-nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #0b0f17;
  --bg-grad: radial-gradient(1100px 520px at 100% -8%, rgb(246 145 74 / 10%), transparent 60%), radial-gradient(900px 480px at -5% 0%, rgb(99 102 241 / 10%), transparent 55%);
  --surface: #121823;
  --surface-2: #19202d;
  --surface-3: #242d3c;
  --glass: rgb(18 24 35 / 72%);
  --border: #222b3a;
  --border-strong: #334054;
  --text: #e9edf3;
  --text-2: #b3bdcb;
  --muted: #8390a3;

  --accent: #f7954b;
  --accent-2: #fbb36a;
  --accent-hover: #ffa766;
  --accent-soft: #34230f;
  --accent-ink: #1a0f05;

  --info: #7aa7ff;
  --info-soft: #172340;
  --success: #4ade80;
  --success-soft: #11291b;
  --warning: #fbbf24;
  --warning-soft: #2d230d;
  --danger: #f87171;
  --danger-soft: #321617;
  --violet: #b39bff;
  --violet-soft: #241b3d;

  --shadow-sm: none;
  --shadow: 0 0 0 1px var(--border), 0 12px 30px -16px rgb(0 0 0 / 70%);
  --shadow-lg: 0 30px 60px -16px rgb(0 0 0 / 70%);
  --ring: 0 0 0 3px rgb(247 149 75 / 30%);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { flex-shrink: 0; width: 18px; height: 18px; }
.foot svg, .small svg, .crumbs svg { width: 15px; height: 15px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
.mono, code { font-family: var(--mono); font-size: 0.92em; direction: ltr; unicode-bidi: isolate; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.raw { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

.boot-splash { min-height: 100vh; display: grid; place-items: center; }

/* ============ Spinner & skeleton ============ */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500; font-size: 13.5px;
  cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, color .15s, transform .06s, box-shadow .15s;
  user-select: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -8px rgb(243 128 32 / 70%); }
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 8px 20px -8px rgb(243 128 32 / 80%); }
[data-theme="dark"] .btn.primary { color: #1a0f05; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.glass { background: var(--glass); backdrop-filter: blur(10px); }
.btn.subtle-danger { color: var(--danger); }
.btn.subtle-danger:hover { background: var(--danger-soft); }
.btn.icon { width: 38px; padding: 0; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn.icon.sm { width: 32px; padding: 0; }
.btn.block { width: 100%; }
.btn.lg { height: 46px; font-size: 14.5px; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; border-color: currentColor; border-top-color: transparent; opacity: .8; }
.btn.loading { pointer-events: none; }

/* ============ Forms ============ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error-text { font-size: 12px; color: var(--danger); }
.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input.invalid { border-color: var(--danger); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.input.file { padding: 8px; height: auto; }
.select {
  appearance: none; padding-left: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8496' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 10px center;
}
.select.compact { width: auto; min-width: 150px; height: 36px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 42px; }
.input-wrap .btn { position: absolute; left: 4px; top: 4px; width: 34px; height: 34px; box-shadow: none; }

/* ساب‌دامنه قبل از دامنه (چپ‌به‌راست): [ www ][.example.com] */
.input-affix { display: flex; align-items: stretch; direction: ltr; }
.input-affix .input { direction: ltr; text-align: left; border-radius: var(--radius-sm) 0 0 var(--radius-sm); min-width: 0; }
.input-affix .affix {
  display: flex; align-items: center; padding: 0 12px; flex-shrink: 0;
  border: 1px solid var(--border-strong); border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2); color: var(--muted); font-family: var(--mono); font-size: 12.5px;
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.input-affix:focus-within .affix { border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }

.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; right: 12px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search .input { padding-right: 40px; height: 40px; background: var(--surface); }
.search.big .input { height: 48px; font-size: 15px; border-radius: 12px; }
.search.big svg { width: 20px; height: 20px; right: 14px; }
.search.big .input { padding-right: 44px; }

input[type="checkbox"].check { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; margin: 0; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px; height: 23px; border-radius: 999px; background: var(--surface-3);
  position: relative; transition: background .2s; flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 10%);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
  transition: transform .22s cubic-bezier(.3, 1.4, .5, 1);
}
.switch input:checked + .track { background: var(--accent-grad); }
.switch.danger input:checked + .track { background: linear-gradient(135deg, #ef4444, #f97316); }
.switch input:checked + .track::after { transform: translateX(-17px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch input:disabled + .track { opacity: .45; }
.switch input:disabled ~ * { opacity: .6; }
.switch.busy .track::after { animation: pulse .8s ease infinite; }
.switch.lg .track { width: 52px; height: 30px; }
.switch.lg .track::after { width: 24px; height: 24px; }
.switch.lg input:checked + .track::after { transform: translateX(-22px); }
.proxy-on { color: var(--accent); font-weight: 600; }
@keyframes pulse { 50% { opacity: .5; } }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 11px; border: 1px solid var(--border); flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px;
  font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s;
}
.seg button svg { width: 16px; height: 16px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(16 24 40 / 12%); font-weight: 600; }
[data-theme="dark"] .seg button.active { background: var(--surface-3); }
.seg.seg-lg button { padding: 8px 14px; font-size: 13.5px; }
.seg.seg-lg button.active { color: var(--accent); }

/* Chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); }
.chip .count { color: var(--muted); font-size: 11.5px; }
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip.active .count { color: inherit; opacity: .7; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 7px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge svg { width: 13px; height: 13px; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent); }

.type-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 54px; height: 24px; padding: 0 6px; border-radius: 7px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  background: var(--surface-2); color: var(--text-2);
}
.type-A, .type-AAAA { background: var(--info-soft); color: var(--info); }
.type-CNAME { background: var(--accent-soft); color: var(--accent); }
.type-TXT { background: var(--success-soft); color: var(--success); }
.type-MX { background: var(--warning-soft); color: var(--warning); }
.type-NS { background: var(--violet-soft); color: var(--violet); }

/* Zone avatar with per-domain color */
.zavatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 800; font-size: 16px; text-transform: uppercase; font-family: var(--mono);
  background: linear-gradient(135deg, hsl(var(--h) 85% 93%), hsl(calc(var(--h) + 40) 85% 88%));
  color: hsl(var(--h) 55% 35%);
  box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 80% / 60%);
}
[data-theme="dark"] .zavatar {
  background: linear-gradient(135deg, hsl(var(--h) 45% 22%), hsl(calc(var(--h) + 40) 45% 17%));
  color: hsl(var(--h) 85% 75%);
  box-shadow: inset 0 0 0 1px hsl(var(--h) 50% 35% / 60%);
}
.zavatar.lg { width: 54px; height: 54px; border-radius: 16px; font-size: 22px; }

/* ============ Cards ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card.lift { transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
.card.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card-head > svg { color: var(--accent); }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ============ Shell ============ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; font-weight: 800; font-size: 15.5px; }
.brand-sub { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .3px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-grad); color: #fff; box-shadow: 0 8px 20px -8px rgb(243 128 32 / 70%);
}
.brand .logo svg { width: 21px; height: 21px; }
.nav-label { font-size: 11px; color: var(--muted); padding: 0 12px 6px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 12px;
  border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; position: relative;
  transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; right: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px 0 0 3px; background: var(--accent); }
.sidebar .spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xl { width: 56px; height: 56px; font-size: 22px; }
.user-chip .email { font-size: 12.5px; font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .mobile-brand { display: none; padding: 0; }
.topbar .actions { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.content { padding: 26px 28px 48px; max-width: 1240px; width: 100%; margin: 0 auto; }

.page-head, .page-hero { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1, .page-hero h1 { margin: 0; font-size: 23px; font-weight: 800; line-height: 1.3; letter-spacing: -.2px; }
.page-head .sub, .page-hero .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-head .tools, .page-hero .tools { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 380px; }
.hide-sm { display: inline; }

/* Account switcher */
.acct-btn {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 6px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  cursor: pointer; max-width: 270px; box-shadow: var(--shadow-sm);
}
.acct-btn:hover { border-color: var(--border-strong); }
.acct-btn .name { font-weight: 600; font-size: 13px; }
.acct-btn > svg { width: 16px; height: 16px; color: var(--muted); }
.acct-ic {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--info-soft); color: var(--info);
}
.acct-ic.global { background: var(--accent-soft); color: var(--accent); }
.acct-ic svg { width: 15px; height: 15px; }
.acct-ic.lg { width: 44px; height: 44px; border-radius: 12px; }
.acct-ic.lg svg { width: 21px; height: 21px; }
.menu {
  position: absolute; z-index: 60; min-width: 270px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; animation: pop .14s ease;
}
.menu .menu-title { font-size: 11.5px; color: var(--muted); padding: 6px 10px 4px; font-weight: 600; }
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border: 0; background: transparent; border-radius: 9px; cursor: pointer; text-align: start; color: var(--text);
}
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu > button > svg, .menu > a > svg { width: 17px; height: 17px; color: var(--muted); }
.menu .check { margin-inline-start: auto; color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

.bottom-nav { display: none; }

/* ============ Zones list & search ============ */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { padding: 16px; display: flex; gap: 12px; align-items: center; position: relative; overflow: hidden; }
.stat .stat-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--text-2); }
.stat .stat-ic svg { width: 20px; height: 20px; }
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 800; line-height: 1.3; letter-spacing: -.3px; }
.stat .v.sm { font-size: 14px; font-weight: 600; }
.stats.five .stat { flex-direction: column; align-items: flex-start; gap: 10px; }
.stats.five .stat .v { white-space: nowrap; }
.stat.s-accent .stat-ic { background: var(--accent-soft); color: var(--accent); }
.stat.s-success .stat-ic { background: var(--success-soft); color: var(--success); }
.stat.s-warning .stat-ic { background: var(--warning-soft); color: var(--warning); }
.stat.s-info .stat-ic { background: var(--info-soft); color: var(--info); }
.stat.s-danger .stat-ic { background: var(--danger-soft); color: var(--danger); }
.stat.s-violet .stat-ic { background: var(--violet-soft); color: var(--violet); }

.search-panel { padding: 14px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.search-panel .seg { align-self: flex-start; }

.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.zone-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; cursor: pointer; text-decoration: none !important; color: inherit; }
.zone-card .top { display: flex; align-items: center; gap: 12px; }
.zone-card .zname { font-weight: 700; font-size: 15px; text-align: right; }
.zone-card .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.zone-card .ns-box { background: var(--warning-soft); border-radius: var(--radius-sm); padding: 8px 10px; }
.zone-card .ns-box code { background: transparent; }
.zone-card .foot { display: flex; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--border); }
.zone-card .foot .grow { text-align: right; }
.zone-card .go { transition: transform .2s; display: inline-flex; }
.zone-card:hover .go { transform: translateX(-3px); color: var(--accent); }

.results-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.results-head > div { flex: 1; }
.index-progress { padding: 12px 16px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent-grad); border-radius: 99px; transition: width .3s ease; }

/* ============ Zone page ============ */
.zone-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.zone-hero h1 { margin: 0; font-size: 24px; font-weight: 800; text-align: right; letter-spacing: -.2px; }
.zone-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
.zone-nav { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.zone-nav a {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 9px;
  color: var(--text-2); font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.zone-nav a svg { width: 17px; height: 17px; }
.zone-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.zone-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.zone-nav a.is-locked { color: var(--muted); }
.zone-nav .nav-lock { margin-inline-start: auto; display: inline-flex; color: var(--muted); }
.zone-nav .nav-lock svg { width: 14px; height: 14px; }
.zone-main { min-width: 0; container-type: inline-size; }
@container (max-width: 860px) {
  .rtable.selectable .rrow { grid-template-columns: 22px 64px minmax(100px, 1fr) minmax(120px, 1.4fr) 92px 104px; gap: 10px; padding-left: 12px; padding-right: 12px; }
  .rtable.selectable .rrow .rttl { display: none; }
}
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 38px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.section-head .tools { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ DNS table ============ */
.rtable { overflow: hidden; }
.rrow {
  display: grid;
  grid-template-columns: 76px minmax(140px, 1.1fr) minmax(160px, 1.6fr) 104px 96px 112px;
  align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .3s;
}
.rtable.selectable .rrow { grid-template-columns: 22px 70px minmax(130px, 1.1fr) minmax(150px, 1.6fr) 104px 76px 112px; }
.rtable.global .rrow { grid-template-columns: 70px minmax(170px, 1.3fr) minmax(150px, 1.4fr) 104px minmax(110px, .8fr) 112px; }
.rrow:last-child { border-bottom: 0; }
.rrow.head { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); padding-top: 9px; padding-bottom: 9px; }
.rrow:not(.head):hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.rrow.selected { background: color-mix(in srgb, var(--accent-soft) 70%, transparent) !important; }
.rrow .rsel { display: flex; align-items: center; }
.rrow .rname { font-family: var(--mono); font-size: 13px; font-weight: 600; direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .rname .zone-part { color: var(--muted); font-weight: 400; }
.rrow .rcontent { min-width: 0; }
.rrow .rc-line {
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2); direction: ltr;
  display: flex; align-items: center; gap: 6px; min-width: 0; justify-content: flex-end;
}
.rrow .rc-line > span:not(.badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rrow .rc-line .copy { order: -1; }
.rrow .rcomment { font-size: 11.5px; color: var(--muted); display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .ractions { display: flex; gap: 2px; justify-content: flex-end; }
.rrow .copy { opacity: 0; transition: opacity .15s; box-shadow: none; }
.rrow:hover .copy { opacity: 1; }
.rrow.flash { animation: flash 1.8s ease; }
.rrow.removing { opacity: .35; pointer-events: none; }
.zone-link { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; text-align: right; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } }
.proxy-off { color: var(--muted); font-size: 12px; }
.ttl { font-size: 12.5px; color: var(--text-2); }

.bulk-bar {
  position: sticky; bottom: 16px; z-index: 15; margin-top: 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px;
  background: var(--text); color: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: rise .2s ease;
}
.bulk-bar .btn:not(.danger) { background: color-mix(in srgb, var(--bg) 12%, transparent); border-color: transparent; color: inherit; box-shadow: none; }
.bulk-bar .btn:not(.danger):hover { background: color-mix(in srgb, var(--bg) 22%, transparent); }

.record-preview { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); text-align: left; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty .icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.empty .icon svg { width: 26px; height: 26px; }
.empty h3 { margin: 4px 0 0; font-size: 15.5px; color: var(--text); }
.empty p { margin: 0; max-width: 440px; line-height: 1.8; }

/* ============ Locked (permission) ============ */
.locked {
  display: flex; gap: 16px; align-items: flex-start; padding: 22px;
  border-radius: var(--radius); border: 1px dashed var(--border-strong);
  background: repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--surface-2) 70%, transparent) 10px 20px), var(--surface);
}
.locked.compact { padding: 14px; border-radius: var(--radius-sm); }
.locked-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--warning-soft); color: var(--warning); flex-shrink: 0; }
.locked.compact .locked-icon { width: 36px; height: 36px; border-radius: 10px; }
.locked h3 { margin: 0 0 4px; font-size: 15px; }
.locked p { margin: 0 0 8px; color: var(--text-2); line-height: 1.8; }
.perm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; margin-bottom: 6px; }
.perm-chip svg { width: 14px; height: 14px; color: var(--accent); }

/* ============ Settings rows ============ */
.set-row { display: flex; align-items: center; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row.flat { padding: 0 0 12px; }
.set-row .info { flex: 1; min-width: 0; }
.set-row .title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.set-row .title svg { width: 16px; height: 16px; color: var(--muted); }
.set-row .desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.7; }
.set-row.danger-row { background: var(--danger-soft); }

.ssl-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 16px; }
.ssl-mode {
  border: 1.5px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 12px;
  text-align: right; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: all .15s;
}
.ssl-mode b { font-size: 14px; }
.ssl-mode span { font-size: 12px; color: var(--muted); line-height: 1.6; }
.ssl-mode:hover { border-color: var(--border-strong); }
.ssl-mode.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgb(243 128 32 / 12%); }
.ssl-mode.active b { color: var(--accent); }
.ssl-mode:disabled { opacity: .5; cursor: not-allowed; }

.ua-card, .status-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; transition: all .25s; }
.ua-card h3, .status-card h3 { margin: 0; font-size: 15.5px; }
.ua-card p, .status-card p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.ua-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex-shrink: 0; }
.ua-icon svg { width: 24px; height: 24px; }
.ua-card.on { background: linear-gradient(135deg, var(--danger-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.ua-card.on .ua-icon { background: var(--danger); color: #fff; animation: beat 1.6s ease infinite; }
.status-card.on { background: linear-gradient(135deg, var(--success-soft), var(--surface) 70%); }
.status-card.on .ua-icon { background: var(--success); color: #fff; }
@keyframes beat { 50% { transform: scale(1.06); } }

/* Lists (rules, certs...) */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row.rule.disabled > :not(.switch):not(.btn) { opacity: .5; }
.rule-num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; font-weight: 700; flex-shrink: 0; color: var(--muted); }
.expr { display: block; margin-top: 4px; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: transparent; padding: 0; text-align: left; }
.list-row .chips { margin-top: 6px; }

.builder { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.builder .label { display: flex; align-items: center; gap: 6px; }
.builder .label svg { width: 15px; height: 15px; }
.builder-row { display: grid; grid-template-columns: 1.2fr 1fr 1.3fr auto auto; gap: 8px; align-items: center; }
.access-form { display: grid; grid-template-columns: 150px 120px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.access-form .input, .access-form .select { height: 38px; }
#email-addr-form { grid-template-columns: minmax(0, 1fr) auto; }
.pr-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pr-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.pr-row:has([data-pr="url"]) { grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1.5fr) auto; }

.kv { display: flex; flex-direction: column; gap: 4px; }
.kv.pad { padding: 8px 18px 14px; }
.kv-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { color: var(--muted); font-size: 12.5px; min-width: 130px; }
.kv-row .v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.kv-row code.v { display: block; }

/* Chart */
.chart-card { overflow: hidden; }
.chart { padding: 18px 18px 6px; height: 240px; }
.chart svg { width: 100%; height: 100%; display: block; }
.bar-total { fill: color-mix(in srgb, var(--accent) 30%, transparent); transition: fill .15s; }
.bar-cached { fill: var(--accent); }
.chart g:hover .bar-total { fill: color-mix(in srgb, var(--accent) 50%, transparent); }
.chart-x { display: flex; justify-content: space-between; padding: 0 18px 14px; font-size: 11px; color: var(--muted); direction: ltr; }
.legend { margin-inline-start: auto; display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-total { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.lg-cached { background: var(--accent); }

/* History */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.tl-item:last-child { border-bottom: 0; }
.tl-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.tl-icon svg { width: 16px; height: 16px; }
.tl-icon.create { background: var(--success-soft); color: var(--success); }
.tl-icon.update { background: var(--info-soft); color: var(--info); }
.tl-icon.delete { background: var(--danger-soft); color: var(--danger); }
.tl-body { flex: 1; min-width: 0; }
.tl-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.diff { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.diff .f { color: var(--muted); min-width: 56px; display: inline-block; }
.diff del { color: var(--danger); background: var(--danger-soft); padding: 0 5px; border-radius: 5px; text-decoration: line-through; unicode-bidi: isolate; }
.diff ins { color: var(--success); background: var(--success-soft); padding: 0 5px; border-radius: 5px; text-decoration: none; unicode-bidi: isolate; }

/* Accounts */
.acct-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.acct-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.acct-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 12px 30px -18px rgb(243 128 32 / 60%); }
.acct-card .top { display: flex; gap: 12px; align-items: center; }
.acct-card .actions { display: flex; gap: 6px; }

.verify-state { display: flex; align-items: center; gap: 8px; font-size: 12.5px; min-height: 22px; }
.verify-state.ok { color: var(--success); }
.verify-state.bad { color: var(--danger); }
.verify-state svg { width: 16px; height: 16px; }

.help { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; color: var(--text-2); line-height: 1.9; }
.help ol { margin: 4px 0; padding-inline-start: 18px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

/* ============ Dialog ============ */
dialog.modal {
  border: 0; padding: 0; background: transparent; color: inherit;
  width: min(540px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: visible;
}
dialog.modal.wide { width: min(680px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgb(8 12 20 / 50%); backdrop-filter: blur(3px); animation: fade .15s ease; }
dialog.modal[open] .sheet { animation: rise .22s cubic-bezier(.2, .9, .3, 1.2); }
.sheet {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 32px);
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { margin: 0; font-size: 16.5px; font-weight: 800; flex: 1; }
.sheet-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.sheet-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-start; flex-direction: row-reverse; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.sheet-foot .btn { min-width: 96px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.8; }
.alert svg { width: 18px; height: 18px; margin-top: 3px; }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
.alert.warning { background: var(--warning-soft); color: var(--warning); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.success { background: var(--success-soft); color: var(--success); }
.alert code { background: rgb(255 255 255 / 40%); }
.stack > .alert { margin: 0; }

/* ============ Toasts ============ */
.toasts {
  position: fixed; z-index: 100; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(460px, calc(100vw - 24px));
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .28s cubic-bezier(.2, .9, .3, 1.2);
}
.toast-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--success) 25%, transparent); color: var(--success); }
.toast.error .toast-icon { background: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.toast-icon svg { width: 16px; height: 16px; }
.toast .grow { line-height: 1.7; }
.toast button { background: transparent; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 2px 6px; }
.toast.out { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ============ Auth ============ */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.auth-glow {
  position: absolute; inset: -20%; pointer-events: none;
  background:
    radial-gradient(500px 380px at 75% 20%, rgb(243 128 32 / 22%), transparent 70%),
    radial-gradient(520px 400px at 20% 85%, rgb(99 102 241 / 18%), transparent 70%);
  filter: blur(10px); animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(-3%, 2%) rotate(3deg); } }
.auth-card { width: 100%; max-width: 420px; padding: 32px 28px; position: relative; background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow-lg); border-radius: 22px; }
.auth-card .brand { justify-content: center; flex-direction: column; text-align: center; gap: 14px; padding: 0 0 24px; }
.auth-card .brand .logo { width: 56px; height: 56px; border-radius: 18px; }
.auth-card .brand .logo svg { width: 30px; height: 30px; }
.auth-card .brand h1 { margin: 0; font-size: 21px; }
.auth-card .brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-weight: 400; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 4px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-switch { text-align: center; font-size: 13px; color: var(--muted); margin-top: 18px; }
.google-btn svg { width: 18px; height: 18px; }

/* ============ Responsive ============ */
@media (max-width: 1180px) {
  .stats.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .zone-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .zone-nav {
    position: sticky; top: var(--topbar-h); z-index: 12; flex-direction: row; overflow-x: auto; scrollbar-width: none;
    padding: 6px; border-radius: 14px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .zone-nav::-webkit-scrollbar { display: none; }
  .zone-nav a { height: 36px; flex-shrink: 0; }
  .zone-nav .nav-lock { margin-inline-start: 2px; }
  .ssl-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .rrow { grid-template-columns: 70px minmax(120px, 1fr) minmax(140px, 1.4fr) 96px 104px; }
  .rtable.selectable .rrow { grid-template-columns: 22px 64px minmax(110px, 1fr) minmax(130px, 1.4fr) 96px 104px; }
  .rtable.global .rrow { grid-template-columns: 64px minmax(150px, 1.2fr) minmax(130px, 1.3fr) 96px 104px; }
  .rrow .rttl { display: none; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; }
  .topbar .mobile-brand { display: flex; }
  .topbar .mobile-brand .logo { width: 32px; height: 32px; border-radius: 10px; }
  .topbar .mobile-brand .logo svg { width: 18px; height: 18px; }
  .content { padding: 16px 16px calc(var(--bottom-nav-h) + var(--safe-b) + 28px); }
  .page-head h1, .page-hero h1 { font-size: 20px; }
  .zone-hero h1 { font-size: 19px; }
  .zavatar.lg { width: 46px; height: 46px; font-size: 19px; }
  .stats, .stats.five { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat .v { font-size: 18px; }
  .zone-grid, .acct-list { grid-template-columns: minmax(0, 1fr); }
  .toolbar .search { max-width: none; min-width: 100%; }
  .acct-btn { max-width: 175px; }
  .hide-sm { display: none !important; }
  .search-panel .seg { align-self: stretch; }
  .search-panel .seg button { flex: 1; justify-content: center; padding: 8px 6px; font-size: 12.5px; }
  .ssl-modes { grid-template-columns: minmax(0, 1fr); }
  .builder-row, .access-form, .pr-row, .pr-row:has([data-pr="url"]) { grid-template-columns: minmax(0, 1fr); }
  .zone-nav { top: var(--topbar-h); margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: fixed; z-index: 30; bottom: 0; left: 0; right: 0;
    height: calc(var(--bottom-nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a:hover { text-decoration: none; }

  .toasts { bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 12px); }
  .bulk-bar { bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 10px); }

  /* ردیف‌های DNS به کارت تبدیل می‌شوند */
  .rrow.head { display: none; }
  .rrow, .rtable.selectable .rrow, .rtable.global .rrow {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "sel type name proxy" "content content content content" "foot foot foot actions";
    gap: 6px 10px; padding: 12px 14px;
  }
  .rtable.global .rrow { grid-template-areas: "type name name proxy" "content content content content" "foot foot foot actions"; }
  .rrow .rsel { grid-area: sel; }
  .rrow .rtype { grid-area: type; }
  .rrow .rname { grid-area: name; }
  .rrow .rcontent { grid-area: content; }
  .rrow .rproxy { grid-area: proxy; }
  .rrow .rttl { grid-area: foot; display: block; }
  .rrow .ractions { grid-area: actions; }
  .rrow .copy { opacity: 1; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .set-row.wrap { flex-wrap: wrap; }
  .set-row.wrap .seg, .set-row.wrap .select { width: 100%; }
  .list-row { flex-wrap: wrap; }
  .kv-row .k { min-width: 100px; }
  .locked { flex-direction: column; }

  dialog.modal, dialog.modal.wide { width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92vh; }
  dialog.modal .sheet { border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: var(--safe-b); }
  dialog.modal[open] .sheet { animation: sheet-up .25s cubic-bezier(.2, .9, .3, 1); }
  .sheet-foot { border-radius: 0; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============ v3: login steps ============ */
.auth-card { position: relative; }
.auth-back { position: absolute; top: 14px; left: 14px; }
.auth-back svg { transform: scaleX(-1); }
.input.lg { height: 50px; font-size: 15px; border-radius: 12px; }
.id-chip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.id-chip span { flex: 1; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font-weight: 600; padding: 4px 2px; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.center { text-align: center; justify-content: center; align-self: center; }
.code-input { text-align: center; font-family: var(--mono); font-size: 24px; letter-spacing: 10px; height: 56px; font-weight: 700; }
.code-input::placeholder { letter-spacing: 10px; }
.resend { min-height: 22px; text-align: center; }
.tg-btn { background: linear-gradient(135deg, #2aabee, #229ed9); color: #fff; border-color: transparent; }
.tg-btn:hover { filter: brightness(1.06); background: linear-gradient(135deg, #2aabee, #229ed9); }
.tg-wait { align-items: stretch; text-align: center; }
.tg-anim { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #2aabee, #229ed9); box-shadow: 0 0 0 0 rgb(42 171 238 / 50%); animation: ring 1.8s ease infinite; }
.tg-anim svg { width: 32px; height: 32px; }
@keyframes ring { 70% { box-shadow: 0 0 0 18px rgb(42 171 238 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(42 171 238 / 0%); } }
.tfa-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tfa-icon svg { width: 30px; height: 30px; }
.copy-line { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); min-width: 0; }
.copy-line code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; font-size: 12px; text-align: left; }
.pw-meter { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }
.pw-meter[data-score="1"] span { width: 25%; background: var(--danger); }
.pw-meter[data-score="2"] span { width: 50%; background: var(--warning); }
.pw-meter[data-score="3"] span { width: 75%; background: #84cc16; }
.pw-meter[data-score="4"] span { width: 100%; background: var(--success); }

/* ============ v3: account settings ============ */
.set-row.contact .c-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex-shrink: 0; }
.set-row.contact .c-ic.tg { background: #e3f4fd; color: #229ed9; }
[data-theme="dark"] .set-row.contact .c-ic.tg { background: #10283a; color: #5ec2f5; }
.set-row.contact .btn { flex-shrink: 0; }
.steps { margin: 0; padding-inline-start: 20px; line-height: 2; color: var(--text-2); }
.qr-box { display: grid; place-items: center; }
.qr { width: 196px; height: 196px; padding: 8px; background: #fff; border-radius: 14px; display: grid; place-items: center; box-shadow: var(--shadow); }
.qr img, .qr canvas { width: 180px !important; height: 180px !important; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.recovery-grid code { text-align: center; padding: 8px; font-size: 14px; letter-spacing: 1px; }
.only-mobile { display: none; }

/* ============ v3: announcement ============ */
.announce { display: flex; align-items: center; gap: 10px; padding: 10px 28px; font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--border); }
.announce.info { background: var(--info-soft); color: var(--info); }
.announce.success { background: var(--success-soft); color: var(--success); }
.announce.warning { background: var(--warning-soft); color: var(--warning); }
.announce.danger { background: var(--danger-soft); color: var(--danger); }

/* ============ v3: monitors ============ */
.cron-alert code { font-size: 11.5px; }
.cron-help { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; color: var(--text-2); }
.cron-alert { margin-bottom: 16px; }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.mon-card { display: flex; flex-direction: column; overflow: hidden; border-top: 3px solid var(--border-strong); }
.mon-card.st-ok { border-top-color: var(--success); }
.mon-card.st-degraded { border-top-color: var(--warning); }
.mon-card.st-down { border-top-color: var(--danger); background: linear-gradient(180deg, var(--danger-soft), var(--surface) 40%); }
.mon-card.paused { opacity: .7; }
.mon-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.targets { display: flex; flex-direction: column; gap: 6px; padding: 0 16px 12px; }
.target { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; }
.target.live { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.target code { background: transparent; font-size: 13px; text-align: left; }
.target .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.target.up .pulse { background: var(--success); box-shadow: 0 0 0 0 rgb(22 163 74 / 50%); animation: live 2s infinite; }
.target.down .pulse { background: var(--danger); }
.target.down code { color: var(--danger); text-decoration: line-through; }
@keyframes live { 70% { box-shadow: 0 0 0 6px rgb(22 163 74 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(22 163 74 / 0%); } }
.prio { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface); color: var(--muted); }
.mon-events { padding: 10px 16px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 6px; }
.mon-events .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-foot { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); margin-top: auto; flex-wrap: wrap; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: all .15s; }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card b { display: flex; align-items: center; gap: 6px; }
.mode-card b svg { width: 16px; height: 16px; color: var(--accent); }
.mode-card span { font-size: 12px; color: var(--muted); line-height: 1.7; }
.mode-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgb(243 128 32 / 12%); }
.t-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.t-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 80px auto; gap: 8px; align-items: center; }
.t-num { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--muted); }
.affix-select { width: auto; max-width: 60%; border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; border-left: 0; background-color: var(--surface-2); font-family: var(--mono); font-size: 12.5px; direction: ltr; }
details.adv { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 14px; }
details.adv > summary { cursor: pointer; padding: 12px 0; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; color: var(--text-2); }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary svg { width: 16px; height: 16px; }
details.adv[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 14px; }
details.adv[open] { padding-bottom: 14px; }

/* ============ v3: replace ============ */
.replace-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: center; }
.replace-head .from { padding: 10px 12px; color: var(--danger); background: var(--danger-soft); text-decoration: line-through; }
.replace-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.replace-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.replace-item:last-child { border-bottom: 0; }
.replace-item:hover { background: var(--surface-2); }
.replace-item .zone-part { color: var(--muted); }

/* ============ v3: admin ============ */
.pill-tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.pill-tabs a { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-weight: 500; white-space: nowrap; }
.pill-tabs a svg { width: 16px; height: 16px; }
.pill-tabs a:hover { text-decoration: none; border-color: var(--border-strong); }
.pill-tabs a.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.utable { overflow: hidden; }
.urow { display: grid; grid-template-columns: minmax(200px, 2fr) 150px 110px 110px 80px; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.urow:last-child { border-bottom: 0; }
.urow.head { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.clickable { cursor: pointer; transition: background .15s; }
.clickable:hover { background: var(--surface-2); }
.u-methods { display: inline-flex; gap: 4px; }
.u-methods span { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.u-methods span.ok { color: var(--success); background: var(--success-soft); }
.u-methods svg { width: 14px; height: 14px; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.pager > span { margin-inline-end: auto; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding: 16px 18px 0; }
.mini-bars span { flex: 1; background: var(--accent-grad); border-radius: 4px 4px 0 0; min-width: 4px; opacity: .85; }
.save-bar { position: sticky; bottom: 16px; display: flex; justify-content: flex-start; z-index: 5; }
.save-bar .btn { box-shadow: var(--shadow-lg); }
.sms-log { white-space: pre-wrap; direction: ltr; text-align: left; font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); max-height: 220px; overflow: auto; margin: 12px 0 0; }
.sm-switch .track { width: 32px; height: 19px; }
.sm-switch .track::after { width: 13px; height: 13px; }
.sm-switch input:checked + .track::after { transform: translateX(-13px); }
.kv-row .k svg { width: 14px; height: 14px; vertical-align: -2px; }

@media (max-width: 860px) {
  .bottom-nav { grid-template-columns: repeat(var(--n, 4), 1fr); }
  .bottom-nav a span { font-size: 10.5px; }
  .announce { padding: 10px 16px; }
  .mon-grid { grid-template-columns: minmax(0, 1fr); }
  .mode-cards { grid-template-columns: minmax(0, 1fr); }
  .urow { grid-template-columns: minmax(0, 1fr) auto; }
  .urow > :nth-child(3), .urow > :nth-child(4), .urow.head { display: none; }
  .urow > :nth-child(2) { grid-row: 2; }
  .only-mobile { display: inline-flex; }
  .set-row.contact { flex-wrap: wrap; }
  .replace-head { grid-template-columns: minmax(0, 1fr); }
}

/* ============ v4: polish ============ */
/* محتوای داخل alert نباید از کارت بیرون بزند (مثل راهنمای cron) */
.alert > div { min-width: 0; flex: 1; }
.alert > svg { flex-shrink: 0; }
.cron-help .copy-line { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.cron-help code { color: var(--text); }

/* Profile card */
.profile-card { overflow: hidden; position: relative; }
.profile-cover {
  height: 92px;
  background:
    radial-gradient(400px 120px at 85% 0%, rgb(255 255 255 / 35%), transparent 70%),
    linear-gradient(120deg, #f6821f 0%, #fbad41 45%, #f43f5e 100%);
}
[data-theme="dark"] .profile-cover { background: radial-gradient(400px 120px at 85% 0%, rgb(255 255 255 / 12%), transparent 70%), linear-gradient(120deg, #9a4a10 0%, #8a5a12 45%, #7a1f33 100%); }
.profile-main { display: flex; align-items: flex-end; gap: 16px; padding: 0 22px 16px; margin-top: -42px; flex-wrap: wrap; }
.profile-avatar {
  position: relative; width: 88px; height: 88px; border-radius: 26px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 34px; font-weight: 800; color: var(--accent);
  background: var(--surface); border: 4px solid var(--surface); box-shadow: var(--shadow-lg); overflow: visible;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }
.shield-dot { position: absolute; bottom: -4px; left: -4px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--success); color: #fff; border: 3px solid var(--surface); }
.shield-dot svg { width: 14px; height: 14px; }
.profile-id { flex: 1; min-width: 200px; padding-bottom: 2px; }
.profile-id h2 { margin: 0; font-size: 19px; font-weight: 800; }
.profile-sub { color: var(--muted); font-size: 12.5px; text-align: right; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.profile-actions { display: flex; gap: 6px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.profile-stats > div { padding: 12px 10px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.profile-stats > div + div { border-inline-start: 1px solid var(--border); }
.profile-stats b { font-size: 16px; font-weight: 800; }
.profile-stats span { font-size: 11.5px; color: var(--muted); }

/* Scrollable chip rows instead of wrapping into many lines */
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }

@media (max-width: 860px) {
  /* ---- Compact scale for phones ---- */
  body { font-size: 13px; }
  .btn { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
  .btn.sm { height: 30px; padding: 0 9px; font-size: 12px; }
  .btn.icon { width: 36px; }
  .btn.icon.sm { width: 30px; }
  .btn.lg { height: 44px; font-size: 14px; }
  .btn svg { width: 16px; height: 16px; }
  .input, .select { height: 40px; font-size: 13.5px; }
  .search .input { height: 38px; }
  .search.big .input { height: 44px; font-size: 14px; }
  .card { border-radius: 14px; }
  .card-head { padding: 12px 14px; }
  .card-head h3 { font-size: 13.5px; }
  .card-body { padding: 14px; }
  .set-row { padding: 12px 14px; gap: 10px; }
  .set-row .title { font-size: 13px; }
  .set-row .desc { font-size: 11.5px; line-height: 1.6; }
  .badge { height: 20px; font-size: 10.5px; padding: 0 6px; }
  .type-badge { min-width: 46px; height: 22px; font-size: 10.5px; }
  .chip { height: 28px; font-size: 11.5px; padding: 0 10px; }
  .seg button { padding: 5px 10px; font-size: 12px; }
  .page-head, .page-hero { margin-bottom: 14px; gap: 10px; }
  .page-head h1, .page-hero h1 { font-size: 18px; }
  .page-head .sub, .page-hero .sub { font-size: 12px; }
  .page-hero .tools, .page-head .tools { width: 100%; }
  .page-hero .tools .btn, .page-head .tools .btn { flex: 1; }
  .section-head h2 { font-size: 15.5px; }
  .zone-hero { gap: 10px; margin-bottom: 12px; }
  .zone-hero h1 { font-size: 17px; }
  .zavatar { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
  .zavatar.lg { width: 42px; height: 42px; font-size: 17px; }
  .stat { padding: 10px 12px; gap: 10px; }
  .stat .stat-ic { width: 32px; height: 32px; border-radius: 10px; }
  .stat .stat-ic svg { width: 16px; height: 16px; }
  .stat .k { font-size: 11px; }
  .stat .v { font-size: 16px; }
  .search-panel { padding: 10px; gap: 10px; }
  .zone-card { padding: 12px; gap: 10px; }
  .zone-card .zname { font-size: 14px; }
  .toolbar { gap: 8px; }
  .toolbar .chips, #type-chips, #g-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding-bottom: 2px; }
  .rrow, .rtable.selectable .rrow, .rtable.global .rrow { padding: 10px 12px; }
  .rrow .rname { font-size: 12.5px; }
  .rrow .rc-line { font-size: 12px; }
  .empty { padding: 32px 16px; }
  .empty .icon { width: 46px; height: 46px; }
  .alert { font-size: 12.5px; padding: 10px 12px; }
  .list-row { padding: 10px 14px; }
  .sheet-head { padding: 12px 16px; }
  .sheet-head h2 { font-size: 15px; }
  .sheet-body { padding: 14px 16px; gap: 12px; }
  .sheet-foot { padding: 10px 16px; }
  .sheet-foot .btn { flex: 1; min-width: 0; }
  .topbar { height: 54px; }
  .acct-btn { height: 36px; }
  .zone-nav a { height: 32px; padding: 0 10px; font-size: 12.5px; }
  .ssl-mode { padding: 10px; }
  .mon-head { padding: 12px; }
  .targets { padding: 0 12px 10px; }
  .mon-foot { padding: 8px 12px; }
  .auth-card { padding: 24px 18px; border-radius: 20px; }
  .auth-card .brand { padding-bottom: 18px; }
  .auth-card .brand .logo { width: 48px; height: 48px; }
  .code-input { font-size: 20px; height: 50px; letter-spacing: 8px; }

  /* دکمه‌های کنار تنظیمات زیر متن قرار بگیرند */
  .set-row.contact .info, .set-row:has(> .btn) .info { flex-basis: calc(100% - 52px); }
  .set-row:has(> .btn) > .btn { flex: 1; }
  .set-row.contact > .badge { order: 3; }

  /* Profile */
  .profile-cover { height: 70px; }
  .profile-main { padding: 0 14px 12px; margin-top: -34px; gap: 12px; }
  .profile-avatar { width: 68px; height: 68px; border-radius: 20px; font-size: 26px; }
  .profile-avatar img { border-radius: 16px; }
  .profile-id { min-width: 0; flex-basis: calc(100% - 84px); }
  .profile-id h2 { font-size: 16px; }
  .profile-actions { width: 100%; }
  .profile-actions .btn { flex: 1; }
  .profile-stats b { font-size: 14px; }

  /* ---- Bottom dock ---- */
  :root { --bottom-nav-h: 62px; }
  .content { padding: 14px 12px calc(var(--bottom-nav-h) + var(--safe-b) + 30px); }
  .bottom-nav {
    left: 10px; right: 10px; bottom: calc(8px + var(--safe-b));
    height: var(--bottom-nav-h); padding: 6px; gap: 2px;
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    box-shadow: 0 10px 30px -10px rgb(16 24 40 / 35%), 0 2px 6px rgb(16 24 40 / 8%);
  }
  [data-theme="dark"] .bottom-nav { box-shadow: 0 10px 30px -8px rgb(0 0 0 / 80%), inset 0 1px 0 rgb(255 255 255 / 4%); }
  .bottom-nav a {
    position: relative; border-radius: 14px; gap: 2px; font-size: 10px; font-weight: 600;
    color: var(--muted); transition: color .2s, background .2s;
  }
  .bottom-nav a svg { width: 20px; height: 20px; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
  .bottom-nav a.active { color: var(--accent); background: var(--accent-soft); }
  .bottom-nav a.active svg { transform: translateY(-1px) scale(1.08); }
  .bottom-nav a.active::after {
    content: ""; position: absolute; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
  }
  .bottom-nav a span { font-size: 10px; letter-spacing: -.1px; }
  .toasts { bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 18px); }
  .bulk-bar { bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 16px); }
  .save-bar { bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 14px); }
  .save-bar .btn { width: 100%; }
  dialog.modal .sheet { padding-bottom: var(--safe-b); }

  /* Admin users / monitors */
  .urow { padding: 10px 12px; gap: 8px; }
  .mon-events .small { white-space: normal; }
  .cron-help { font-size: 12px; }
  .t-row { grid-template-columns: 22px minmax(0, 1fr) 64px auto; gap: 6px; }
  .pill-tabs a { height: 34px; padding: 0 12px; font-size: 12.5px; }
}

/* وب‌اپ تلگرام: همیشه فشرده، حتی روی تبلت */
html.tg body { font-size: 13px; }
html.tg .content { padding-top: 12px; }
html.tg .topbar { height: 52px; }

@media (max-width: 380px) {
  .bottom-nav a span { font-size: 9px; }
  .bottom-nav a svg { width: 18px; height: 18px; }
  .stats, .stats.five { gap: 8px; }
  .profile-stats span { font-size: 10.5px; }
}

/* Backups */
.bk-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.bk-actions { display: flex; gap: 4px; align-items: center; }
@media (max-width: 860px) { .bk-row { flex-wrap: wrap; } .bk-actions { width: 100%; justify-content: flex-end; } }

/* Load balancer */
.lb-flow { display: flex; align-items: center; gap: 10px; padding: 14px 16px; margin-bottom: 16px; flex-wrap: wrap; }
.flow-step { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; }
.flow-step svg { width: 18px; height: 18px; color: var(--muted); }
.flow-step.cf { background: var(--accent-soft); color: var(--accent); }
.flow-step.cf svg { color: var(--accent); }
.flow-step.me { background: var(--info-soft); color: var(--info); }
.flow-step.me svg { color: var(--info); }
.flow-step code { background: transparent; padding: 0; font-size: 11.5px; }
.flow-arrow { color: var(--muted); }
.flow-status { margin-inline-start: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.lb-flow .sms-log { width: 100%; }
.share { height: 5px; border-radius: 99px; background: var(--surface-3); margin-top: 5px; overflow: hidden; }
.share span { display: block; height: 100%; background: var(--accent-grad); border-radius: 99px; transition: width .3s; }
.b-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.b-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 80px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.b-list.manual .b-row { grid-template-columns: minmax(0, 1.4fr) 80px 70px minmax(0, 1fr) auto auto; }
@media (max-width: 860px) {
  .b-row, .b-list.manual .b-row { grid-template-columns: minmax(0, 1fr) 70px; }
  .b-row [data-b="label"] { grid-column: span 2; }
  .flow-arrow { display: none; }
  .flow-status { margin-inline-start: 0; width: 100%; }
}

/* v4.1 fixes */
.profile-id { padding-top: 48px; }
@media (max-width: 860px) {
  .profile-id { padding-top: 38px; }
  .set-row.contact > .btn { flex: 0 0 auto; }
  .set-row.contact > .badge { margin-inline-start: 52px; }
  .set-row.contact > .badge + .btn, .set-row.contact > .btn:first-of-type { margin-inline-start: auto; }
}
.profile-avatar { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }

/* Network & proxy */
.relay-box { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.relay-box b { display: inline-flex; align-items: center; gap: 6px; }
.relay-box b svg { width: 16px; height: 16px; color: var(--accent); }
.proxy-switches { display: flex; flex-direction: column; gap: 10px; }
.net-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.net-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.net-row:last-child { border-bottom: 0; }
.net-row > b { display: inline-flex; align-items: center; gap: 6px; min-width: 150px; font-size: 13px; }
.net-row > b svg { width: 15px; height: 15px; color: var(--muted); }

/* فیلد رمز با دکمهٔ چشم (بدون type=password تا مدیر رمز مرورگر دخالت نکند) */
.input.secret-mask { -webkit-text-security: disc; }
.input.secret-mask::placeholder { -webkit-text-security: none; }
