﻿/* ==========================================================================
   OptionPulse — Design system
   توکن‌ها، رنگ‌ها، فونت و اندازه‌ها با OptionCore.PresentationReact1 یکسان است
   (src/styles/globals.css و tailwind.config.ts) تا هر دو محصول یک زبان طراحی داشته باشند.
   رنگ‌ها به‌صورت کانال‌های RGB هستند تا شفافیت با rgb(var(--x) / a) ساخته شود.
   ========================================================================== */

@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/vazirmatn-arabic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/vazirmatn-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --sidebar-width: 15rem;
  --sidebar-width-collapsed: 4rem;
  --header-height: 3.5rem;
  --radius-card: 0.75rem;
  --radius-control: 0.5rem;
  --font-sans: 'Vazirmatn', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --shadow-pop: 0 10px 30px -10px rgb(0 0 0 / 0.35);
}

:root,
[data-theme='light'] {
  --bg: 244 246 250;
  --surface: 255 255 255;
  --surface-2: 238 241 246;
  --line: 222 227 235;
  --text: 17 24 39;
  --muted: 100 112 131;
  --primary: 79 70 229;
  --primary-fg: 255 255 255;
  --up: 5 150 105;
  --down: 220 38 38;
  --warn: 217 119 6;
  --info: 37 99 235;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: 10 13 20;
  --surface: 17 21 31;
  --surface-2: 24 30 43;
  --line: 36 43 58;
  --text: 229 233 240;
  --muted: 136 146 166;
  --primary: 129 140 248;
  --primary-fg: 12 14 22;
  --up: 34 197 94;
  --down: 244 63 94;
  --warn: 245 158 11;
  --info: 96 165 250;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: rgb(var(--bg));
  color: rgb(var(--text));
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: rgb(var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 600; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.9375rem; }
p { margin: 0; }
code, pre, .mono { font-family: var(--font-mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid rgb(var(--primary) / 0.7); outline-offset: 1px; border-radius: 4px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgb(var(--line)); border-radius: 999px; }
.icon { flex-shrink: 0; vertical-align: middle; }
[dir='rtl'] .flip-rtl { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -3rem; z-index: 100; background: rgb(var(--primary)); color: rgb(var(--primary-fg)); padding: .5rem 1rem; border-radius: var(--radius-control); }
.skip-link:focus { top: 1rem; }

/* اعداد مالی: همیشه چپ‌به‌راست، جدا از متن راست‌به‌چپ و با ارقام هم‌عرض برای ترازبندی ستون‌ها */
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }
.muted { color: rgb(var(--muted)); }
.text-up { color: rgb(var(--up)); }
.text-down { color: rgb(var(--down)); }
.text-warn { color: rgb(var(--warn)); }
.small { font-size: 12px; }
.xs { font-size: 11px; line-height: 16px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-width); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgb(var(--surface)); border-inline-end: 1px solid rgb(var(--line));
  transition: width .2s ease;
  z-index: 40;
}
.sidebar-brand { height: var(--header-height); display: flex; align-items: center; gap: .5rem; padding: 0 .75rem; border-bottom: 1px solid rgb(var(--line)); font-weight: 600; color: rgb(var(--text)); }
.sidebar-brand:hover { text-decoration: none; }
.brand-mark { width: 2rem; height: 2rem; border-radius: var(--radius-control); background: rgb(var(--primary)); color: rgb(var(--primary-fg)); display: grid; place-items: center; flex-shrink: 0; }
.nav { flex: 1; overflow-y: auto; padding: .75rem .5rem; display: flex; flex-direction: column; gap: 1rem; }
.nav-group-title { padding: 0 .75rem .25rem; font-size: 11px; color: rgb(var(--muted)); font-weight: 500; }
.nav-link {
  display: flex; align-items: center; gap: .625rem; padding: .5rem .75rem; border-radius: var(--radius-control);
  color: rgb(var(--muted)); font-weight: 500; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgb(var(--surface-2)); color: rgb(var(--text)); text-decoration: none; }
.nav-link[aria-current='page'] { background: rgb(var(--primary) / .12); color: rgb(var(--primary)); }
.sidebar-footer { border-top: 1px solid rgb(var(--line)); padding: .75rem; }
.sidebar-collapse { display: flex; justify-content: center; }

[data-sidebar='collapsed'] .sidebar { width: var(--sidebar-width-collapsed); }
[data-sidebar='collapsed'] .nav-label,
[data-sidebar='collapsed'] .nav-group-title,
[data-sidebar='collapsed'] .brand-name,
[data-sidebar='collapsed'] .sidebar-footer .user-text { display: none; }
[data-sidebar='collapsed'] .nav-link,
[data-sidebar='collapsed'] .sidebar-brand { justify-content: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
  position: sticky; top: 0; z-index: 30; height: var(--header-height);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
  background: rgb(var(--surface) / .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgb(var(--line));
}
.header-title { font-weight: 600; font-size: .9375rem; }
.header-spacer { flex: 1; }
.live-indicator { display: inline-flex; align-items: center; gap: .375rem; font-size: 12px; color: rgb(var(--muted)); }
.live-indicator .pulse { width: .5rem; height: .5rem; border-radius: 50%; background: rgb(var(--up)); box-shadow: 0 0 0 0 rgb(var(--up) / .6); animation: pulse 2s infinite; }
.live-indicator[data-state='offline'] .pulse { background: rgb(var(--down)); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(var(--up) / .55); } 70% { box-shadow: 0 0 0 6px rgb(var(--up) / 0); } 100% { box-shadow: 0 0 0 0 rgb(var(--up) / 0); } }
.content { padding: 1.25rem; max-width: 1440px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-backdrop { display: none; }

@media (max-width: 1023px) {
  .sidebar { width: var(--sidebar-width-collapsed); }
  .nav-label, .nav-group-title, .brand-name, .sidebar-footer .user-text, .sidebar-collapse { display: none; }
  .nav-link, .sidebar-brand { justify-content: center; }
}
@media (max-width: 767px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-width); transform: translateX(100%); transition: transform .2s ease; }
  [dir='ltr'] .sidebar { transform: translateX(-100%); }
  [data-mobile-nav='open'] .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  [data-mobile-nav='open'] .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 35; }
  .nav-label, .nav-group-title, .brand-name, .sidebar-footer .user-text { display: initial; }
  .nav-link, .sidebar-brand { justify-content: flex-start; }
  .content { padding: 1rem .75rem; }
  .header { padding: 0 .75rem; }
}
@media (min-width: 768px) { .mobile-only { display: none !important; } }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; }
.page-head p { color: rgb(var(--muted)); margin-top: .25rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.breadcrumb { display: flex; gap: .375rem; align-items: center; color: rgb(var(--muted)); font-size: 12px; margin-bottom: .25rem; }
.breadcrumb a { color: rgb(var(--muted)); }

/* ---------- Card ---------- */
.card { background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: var(--radius-card); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .875rem 1rem; border-bottom: 1px solid rgb(var(--line)); }
.card-head h2 { display: flex; align-items: center; gap: .5rem; }
.card-body { padding: 1rem; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 1rem; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1023px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.stat { padding: 1rem; display: flex; flex-direction: column; gap: .375rem; }
.stat-label { color: rgb(var(--muted)); font-size: 12px; display: flex; align-items: center; gap: .375rem; }
.stat-value { font-size: 1.5rem; font-weight: 600; }
.stat-hint { font-size: 12px; color: rgb(var(--muted)); }
.stat.accent-up .stat-value { color: rgb(var(--up)); }
.stat.accent-down .stat-value { color: rgb(var(--down)); }
.stat.accent-warn .stat-value { color: rgb(var(--warn)); }

.progress { height: .375rem; border-radius: 999px; background: rgb(var(--surface-2)); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: rgb(var(--up)); width: 0; transition: width .4s ease; }

/* ---------- Badges (وضعیت) ---------- */
.badge { display: inline-flex; align-items: center; gap: .375rem; padding: .125rem .5rem; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: rgb(var(--surface-2)); color: rgb(var(--muted)); border: 1px solid transparent; }
.badge .dot { width: .4375rem; height: .4375rem; border-radius: 50%; background: currentColor; }
.status-connected { background: rgb(var(--up) / .12); color: rgb(var(--up)); }
.status-connected .dot { box-shadow: 0 0 0 3px rgb(var(--up) / .18); }
.status-degraded { background: rgb(var(--warn) / .12); color: rgb(var(--warn)); }
.status-disconnected { background: rgb(var(--down) / .12); color: rgb(var(--down)); }
.status-disabled { background: rgb(var(--surface-2)); color: rgb(var(--muted)); }
.status-unknown { background: rgb(var(--info) / .1); color: rgb(var(--info)); }
.tag { display: inline-flex; align-items: center; gap: .25rem; padding: .0625rem .4375rem; border-radius: 6px; font-size: 11px; font-weight: 500; background: rgb(var(--surface-2)); color: rgb(var(--muted)); border: 1px solid rgb(var(--line)); }
.tag.primary { background: rgb(var(--primary) / .1); color: rgb(var(--primary)); border-color: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4375rem;
  height: 2.25rem; padding: 0 .875rem; border-radius: var(--radius-control);
  border: 1px solid rgb(var(--line)); background: rgb(var(--surface)); color: rgb(var(--text));
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: rgb(var(--surface-2)); text-decoration: none; }
.btn:disabled, .btn[aria-busy='true'] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: rgb(var(--primary)); border-color: rgb(var(--primary)); color: rgb(var(--primary-fg)); }
.btn-primary:hover { background: rgb(var(--primary) / .9); }
.btn-danger { color: rgb(var(--down)); border-color: rgb(var(--down) / .35); }
.btn-danger:hover { background: rgb(var(--down) / .1); }
.btn-danger.solid { background: rgb(var(--down)); color: #fff; border-color: rgb(var(--down)); }
.btn-ghost { border-color: transparent; background: transparent; color: rgb(var(--muted)); }
.btn-ghost:hover { color: rgb(var(--text)); }
.btn-sm { height: 1.875rem; padding: 0 .625rem; font-size: 12.5px; }
.btn-icon { width: 2.25rem; padding: 0; }
.btn-icon.btn-sm { width: 1.875rem; }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn[aria-busy='true'] .spinner { display: inline-block; }
.spinner { width: 1rem; height: 1rem; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline-form { display: inline; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-section { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-section > .span-2 { grid-column: 1 / -1; }
@media (max-width: 767px) { .form-section { grid-template-columns: minmax(0, 1fr); } }
.section-title { font-size: .875rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.section-desc { color: rgb(var(--muted)); font-size: 12.5px; margin-top: .125rem; }
.field { display: flex; flex-direction: column; gap: .375rem; min-width: 0; }
.field label, .field .label { font-weight: 500; font-size: 13px; }
.field .required::after { content: ' *'; color: rgb(var(--down)); }
.hint { color: rgb(var(--muted)); font-size: 12px; }
.input, .select, .textarea {
  width: 100%; height: 2.375rem; padding: 0 .75rem; border-radius: var(--radius-control);
  border: 1px solid rgb(var(--line)); background: rgb(var(--bg)); color: rgb(var(--text)); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 5.5rem; padding: .5rem .75rem; resize: vertical; font-family: var(--font-mono); font-size: 12.5px; direction: ltr; text-align: left; }
.input.ltr, .input[type='url'], .input.code { direction: ltr; text-align: left; }
.input.code { font-family: var(--font-mono); font-size: 12.5px; }
.input:hover, .select:hover, .textarea:hover { border-color: rgb(var(--muted) / .5); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: rgb(var(--primary)); box-shadow: 0 0 0 3px rgb(var(--primary) / .18); }
.input-validation-error, .input[aria-invalid='true'] { border-color: rgb(var(--down)) !important; }
.field-validation-error, .error-text { color: rgb(var(--down)); font-size: 12px; }
.field-validation-valid { display: none; }
.validation-summary-errors, .alert {
  display: flex; gap: .625rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius-control);
  border: 1px solid rgb(var(--down) / .3); background: rgb(var(--down) / .08); color: rgb(var(--down));
}
.validation-summary-errors ul { margin: 0; padding-inline-start: 1rem; }
.validation-summary-valid { display: none; }
.alert.info { border-color: rgb(var(--info) / .3); background: rgb(var(--info) / .08); color: rgb(var(--info)); }
.alert.warn { border-color: rgb(var(--warn) / .3); background: rgb(var(--warn) / .08); color: rgb(var(--warn)); }
.alert.success { border-color: rgb(var(--up) / .3); background: rgb(var(--up) / .08); color: rgb(var(--up)); }
.alert .alert-body { color: rgb(var(--text)); }
.check { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none; }
.check input { width: 1rem; height: 1rem; accent-color: rgb(var(--primary)); }
.form-actions { display: flex; gap: .5rem; justify-content: flex-start; flex-wrap: wrap; padding-top: .25rem; }
.segmented { display: inline-flex; padding: .1875rem; border-radius: var(--radius-control); background: rgb(var(--surface-2)); gap: .125rem; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; gap: .375rem; padding: .3125rem .875rem; border-radius: calc(var(--radius-control) - 2px); color: rgb(var(--muted)); font-weight: 500; }
.segmented input:checked + span { background: rgb(var(--surface)); color: rgb(var(--text)); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.segmented input:focus-visible + span { outline: 2px solid rgb(var(--primary) / .7); }
.secret-current { display: flex; align-items: center; gap: .5rem; font-size: 12px; color: rgb(var(--muted)); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar .input, .toolbar .select { width: auto; min-width: 11rem; height: 2.25rem; }
.search-box { position: relative; }
.search-box .icon { position: absolute; inset-inline-start: .625rem; top: 50%; transform: translateY(-50%); color: rgb(var(--muted)); pointer-events: none; }
.search-box .input { padding-inline-start: 2.125rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { position: sticky; top: 0; z-index: 1; background: rgb(var(--surface-2)); color: rgb(var(--muted)); font-weight: 500; font-size: 12px; text-align: start; padding: .5625rem .875rem; white-space: nowrap; border-bottom: 1px solid rgb(var(--line)); }
.table td { padding: .625rem .875rem; border-bottom: 1px solid rgb(var(--line)); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgb(var(--surface-2) / .6); }
.table .actions { display: flex; gap: .25rem; justify-content: flex-end; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: rgb(var(--text)); }
.table th[aria-sort='ascending']::after { content: ' ▲'; font-size: 9px; }
.table th[aria-sort='descending']::after { content: ' ▼'; font-size: 9px; }
.cell-title { display: flex; flex-direction: column; gap: .125rem; min-width: 0; }
.cell-title a { color: rgb(var(--text)); font-weight: 500; }
.cell-sub { color: rgb(var(--muted)); font-size: 12px; }
.error-cell { max-width: 18rem; color: rgb(var(--down)); font-size: 12px; }

/* ---------- Source cards ---------- */
.source-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.source-card { display: flex; flex-direction: column; }
.source-card .card-body { display: flex; flex-direction: column; gap: .75rem; flex: 1; }
.source-meta { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; font-size: 12.5px; }
.source-meta dt { color: rgb(var(--muted)); }
.source-meta dd { margin: 0; min-width: 0; }
.source-card .card-foot { display: flex; gap: .375rem; flex-wrap: wrap; padding: .75rem 1rem; border-top: 1px solid rgb(var(--line)); }
.avatar { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-control); background: rgb(var(--primary) / .12); color: rgb(var(--primary)); display: grid; place-items: center; font-weight: 700; text-transform: uppercase; flex-shrink: 0; }

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .5rem 1rem; font-size: 13px; margin: 0; }
.kv dt { color: rgb(var(--muted)); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid rgb(var(--line)); padding: 0 .75rem; overflow-x: auto; }
.tab { padding: .625rem .875rem; border: 0; background: none; color: rgb(var(--muted)); font: inherit; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: .375rem; align-items: center; white-space: nowrap; }
.tab:hover { color: rgb(var(--text)); }
.tab[aria-selected='true'] { color: rgb(var(--primary)); border-bottom-color: rgb(var(--primary)); }
.tab-panel { padding: 1rem; }

/* ---------- Code / JSON ---------- */
.code-block { margin: 0; padding: .875rem 1rem; background: rgb(var(--bg)); border: 1px solid rgb(var(--line)); border-radius: var(--radius-control); max-height: 32rem; overflow: auto; direction: ltr; text-align: left; white-space: pre; line-height: 1.55; }
.code-block.compact { max-height: 18rem; }
.json-key { color: rgb(var(--info)); }
.json-str { color: rgb(var(--up)); }
.json-num { color: rgb(var(--warn)); }
.json-bool, .json-null { color: rgb(var(--primary)); }

/* ---------- Data viewer ---------- */
.scalar-view { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 2.5rem 1rem; }
.scalar-value { font-size: 2.5rem; font-weight: 700; letter-spacing: -.01em; }
.scalar-delta { font-size: 13px; }
.chart-wrap { width: 100%; height: 340px; position: relative; direction: ltr; }
.chart-wrap svg { width: 100%; height: 100%; display: block; }
.chart-axis { stroke: rgb(var(--line)); }
.chart-grid { stroke: rgb(var(--line) / .6); stroke-dasharray: 3 4; }
.chart-label { fill: rgb(var(--muted)); font-size: 11px; font-family: var(--font-sans); }
.chart-line { fill: none; stroke: rgb(var(--primary)); stroke-width: 2; }
.chart-area { fill: rgb(var(--primary) / .12); }
.chart-tooltip { position: absolute; pointer-events: none; background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: var(--radius-control); padding: .375rem .625rem; font-size: 12px; box-shadow: var(--shadow-pop); white-space: nowrap; }
.chart-cursor { stroke: rgb(var(--muted) / .6); stroke-dasharray: 3 3; }
.viewer-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-bottom: 1px solid rgb(var(--line)); }
.list-view { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; }
.list-view li { padding: .5rem .75rem; border: 1px solid rgb(var(--line)); border-radius: var(--radius-control); background: rgb(var(--bg)); overflow-wrap: anywhere; }

/* ---------- Empty / skeleton ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .625rem; padding: 2.5rem 1rem; color: rgb(var(--muted)); }
.empty .empty-icon { width: 3rem; height: 3rem; border-radius: 50%; background: rgb(var(--surface-2)); display: grid; place-items: center; color: rgb(var(--muted)); }
.empty h3 { color: rgb(var(--text)); }
.skeleton { background: linear-gradient(90deg, rgb(var(--surface-2)) 25%, rgb(var(--line)) 37%, rgb(var(--surface-2)) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; height: 1rem; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Toast ---------- */
.toast-region { position: fixed; bottom: 1.25rem; inset-inline-start: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 28rem); }
[dir='rtl'] .toast-region { transform: translateX(50%); }
.toast { display: flex; gap: .625rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius-card); background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); box-shadow: var(--shadow-pop); animation: toast-in .2s ease; }
.toast.success { border-inline-start: 3px solid rgb(var(--up)); }
.toast.success .icon { color: rgb(var(--up)); }
.toast.error { border-inline-start: 3px solid rgb(var(--down)); }
.toast.error .icon { color: rgb(var(--down)); }
.toast .toast-text { flex: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Dialog (تأیید عملیات خطرناک) ---------- */
dialog.modal { border: 1px solid rgb(var(--line)); border-radius: var(--radius-card); background: rgb(var(--surface)); color: rgb(var(--text)); padding: 0; width: min(92vw, 26rem); box-shadow: var(--shadow-pop); }
dialog.modal::backdrop { background: rgb(0 0 0 / .5); backdrop-filter: blur(2px); }
.modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; padding: .875rem 1.25rem; border-top: 1px solid rgb(var(--line)); }

/* ---------- Auth pages ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(60rem 30rem at 85% -10%, rgb(var(--primary) / .16), transparent 60%),
  radial-gradient(40rem 24rem at 0% 110%, rgb(var(--up) / .08), transparent 60%),
  rgb(var(--bg)); }
.auth-card { width: min(100%, 24rem); padding: 1.75rem; display: flex; flex-direction: column; gap: 1.25rem; }
.auth-brand { display: flex; align-items: center; gap: .625rem; }
.auth-brand .brand-mark { width: 2.5rem; height: 2.5rem; }
.auth-foot { text-align: center; color: rgb(var(--muted)); font-size: 12px; }

/* ---------- Key reveal ---------- */
.key-reveal { display: flex; gap: .5rem; align-items: stretch; }
.key-reveal .input { font-family: var(--font-mono); direction: ltr; text-align: left; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: .375rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-top: 1px solid rgb(var(--line)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
