@font-face {
  font-family: Vazirmatn;
  src: url('/static/fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-elevated: #FFFFFF;
  --text: #0F172A;
  --muted: #64748B;
  --subtle: #94A3B8;
  --line: #E2E8F0;
  --brand: #059669;
  --brand-hover: #047857;
  --brand-soft: #ECFDF5;
  --brand-line: #A7D8C4;
  --on-brand: #FFFFFF;
  --nav: #101E30;
  --nav-text: #E2E8F0;
  --nav-active: #17352F;
  --nav-indicator: #059669;
  --green: #059669;
  --success-soft: #ECFDF5;
  --amber: #D97706;
  --warning-soft: #FFFBEB;
  --red: #DC2626;
  --danger-soft: #FEF2F2;
  --blue: #2563EB;
  --info-soft: #EFF6FF;
  --cyan: var(--brand);
  --violet: var(--blue);
  --radius: 16px;
  --radius-control: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-elevated: 0 12px 28px rgba(15, 23, 42, 0.12);
  --sidebar: 260px;
  --topbar: 72px;
  --bottom-nav: 64px;
  --page-inline: 32px;
  --card-padding: 24px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 15px;
  --text-lg: 18px;
  --text-title: 24px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D1726;
  --surface: #142338;
  --surface-2: #101E30;
  --surface-elevated: #1B2D44;
  --text: #F1F5F9;
  --muted: #94A3B8;
  --subtle: #94A3B8;
  --line: #2B3D53;
  --brand: #10B981;
  --brand-hover: #34D399;
  --brand-soft: #15382F;
  --brand-line: #285A49;
  --on-brand: #052E24;
  --nav: #101E30;
  --nav-text: #CBD5E1;
  --nav-active: #17352F;
  --nav-indicator: #10B981;
  --green: #10B981;
  --success-soft: #15382F;
  --amber: #FBBF24;
  --warning-soft: #3B3020;
  --red: #F87171;
  --danger-soft: #432733;
  --blue: #60A5FA;
  --info-soft: #1B324D;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  --shadow-elevated: 0 16px 36px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
  letter-spacing: normal !important;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  font-family: Vazirmatn, Tahoma, sans-serif;
  color: var(--text);
  direction: rtl;
}

body,
body.app-shell,
body.public-page,
body.auth-page {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: var(--text-base);
  line-height: 1.75;
}

button,
input,
select,
textarea,
summary {
  font: inherit;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

svg.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

h1,
h2,
h3,
p,
dd,
th,
td {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: var(--text-title);
  line-height: 1.5;
}

h2 {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.55;
}

h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

p {
  margin-block: 0 12px;
}

small,
.table-subtext,
.muted-text {
  font-size: var(--text-xs);
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

[dir="ltr"],
code,
bdi {
  direction: ltr;
  unicode-bidi: isolate;
  overflow-wrap: anywhere;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent);
  outline-offset: 2px;
}

button:disabled,
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
}

select {
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: var(--subtle);
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  padding: 0;
  accent-color: var(--brand);
}

label {
  color: var(--muted);
  font-size: var(--text-sm) !important;
}

fieldset {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

legend {
  padding: 0 6px;
  color: var(--text);
  font-size: var(--text-sm);
}

.skip-link {
  position: fixed;
  top: -120px;
  right: 24px;
  z-index: 400;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-elevated);
}

.skip-link:focus {
  top: 12px;
}

.sidebar {
  width: var(--sidebar);
  padding: 24px 16px 16px;
  border: 0;
  border-left: 1px solid rgba(226, 232, 240, 0.08);
  background: var(--nav);
  color: var(--nav-text);
  box-shadow: none;
  z-index: 100;
  overflow-y: auto;
}

.brand {
  min-height: 72px;
  padding: 0 8px 24px;
  gap: 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.08);
  margin-bottom: 16px;
}

.brand-mark,
.public-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}

.brand-mark img,
.public-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand b {
  color: #FFFFFF;
  font-size: 18px;
  line-height: 1.4;
}

.brand small,
.sidebar-account small {
  color: #A5B4C6;
  font-size: 12px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  min-height: 46px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--nav-text);
  font-size: 14px;
  gap: 12px;
}

.nav-link > span {
  width: auto;
  color: inherit;
  text-align: inherit;
}

.nav-link > span[data-icon] {
  display: flex;
  width: 20px;
  flex: none;
}

.nav-link:hover,
.nav-link.active {
  background: var(--nav-active);
  color: #FFFFFF;
}

.nav-link.active {
  box-shadow: inset -3px 0 var(--nav-indicator);
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(226, 232, 240, 0.10);
  padding-top: 16px;
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 8px 8px;
}

.sidebar-account b,
.sidebar-account small {
  display: block;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--nav-active);
  color: var(--nav-indicator);
  font-weight: 800;
}

.logout-link {
  width: 100%;
  background: transparent;
  border: 0;
  text-align: start;
}

.main-content {
  min-width: 0;
  min-height: 100vh;
  margin-right: var(--sidebar);
}

.topbar {
  height: var(--topbar);
  padding: 0 var(--page-inline);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: none;
  z-index: 80;
}

.breadcrumbs {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs i {
  color: var(--subtle);
}

.breadcrumbs b {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.top-actions {
  min-width: 0;
  gap: 8px;
}

.environment-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.environment-control select {
  min-height: 40px;
  padding: 6px 10px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--muted);
}

.mobile-menu {
  display: none;
}

.page-wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 32px var(--page-inline) 64px;
}

.page-heading,
.bot-detail-page .bot-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-heading h1,
.page-heading compact-heading h1 {
  margin: 0 0 4px;
  font-size: var(--text-title);
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  display: block;
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  line-height: 1.6;
}

.button,
.public-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  box-shadow: none;
}

.button.primary,
.public-button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}

.button.primary:hover,
.public-button.primary:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
}

.button.secondary,
.public-button.secondary,
.button.ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.button.ghost {
  color: var(--muted);
}

.button.secondary:hover,
.button.ghost:hover {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand);
}

.button.danger {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--red);
}

.button.small {
  min-height: 40px;
  padding: 7px 12px;
  font-size: 12px;
}

.text-link,
.back-link {
  color: var(--brand);
  font-size: 13px;
}

.panel,
.stat-card,
.owner-card,
.loading-card,
.reporter-card {
  min-width: 0;
  padding: var(--card-padding);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-heading h2 {
  font-size: var(--text-lg);
}

.stats-grid,
.bot-detail-page .bot-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  min-height: 144px;
  color: var(--text);
}

.stat-card::after,
.bot-detail-page .stat-card::after {
  display: none;
}

.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stat-card strong {
  display: block;
  margin: 4px 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.45;
}

.stat-card em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.55;
}

.stat-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--brand);
  font-weight: 800;
  box-shadow: none;
}

.stat-card.green .stat-icon,
.stat-card.cyan .stat-icon,
.stat-card.violet .stat-icon,
.stat-card.amber .stat-icon {
  background: var(--surface-2);
  color: var(--brand);
}

.stat-card.amber .stat-icon {
  color: var(--amber);
  background: var(--warning-soft);
}

.stat-card.green .stat-icon {
  color: var(--green);
  background: var(--success-soft);
}

.stat-card.violet .stat-icon {
  color: var(--blue);
  background: var(--info-soft);
}

.content-grid,
.dashboard-grid,
.detail-grid,
.receipt-layout,
.editor-layout {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.content-grid.two-thirds,
.dashboard-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
}

.detail-grid,
.receipt-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-layout {
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
}

.content-grid > *,
.detail-grid > *,
.form-grid > *,
.panel {
  min-width: 0;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
}

.status-pill.success,
.tag.production,
.notice.ok,
.notice.success {
  background: var(--success-soft);
  color: var(--green);
}

.status-pill.pending,
.tag.test,
.notice.warning {
  background: var(--warning-soft);
  color: var(--amber);
}

.status-pill.danger,
.notice.error,
.notice.danger,
.alert.danger {
  background: var(--danger-soft);
  color: var(--red);
}

.status-pill.neutral {
  background: var(--surface-2);
  color: var(--muted);
}

.notice,
.alert {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
}

.notice.info {
  border-color: var(--line);
  background: var(--info-soft);
  color: var(--blue);
}

.toolbar,
.filter-bar,
.management-filters,
.analytics-toolbar,
.inline-form,
.form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.toolbar,
.filter-bar {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.filter-bar label,
.toolbar label,
.form-grid label,
.reporter-secure-form label,
.owner-contact-form label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.form-grid button,
.inline-form button {
  min-height: 44px;
}

.search-box {
  display: flex;
  flex: 1;
  min-width: 220px;
  align-items: center;
  gap: 8px;
  padding-right: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.search-box input:focus {
  box-shadow: none;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-panel > .panel-heading {
  padding: 20px 24px 0;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 0;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: auto;
  background: var(--surface);
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 13px;
  line-height: 1.65;
  white-space: normal;
  vertical-align: middle;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: var(--surface-2);
}

.table-title,
.table-title small {
  display: block;
  color: var(--text);
}

.table-title small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.pagination {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state,
.empty-panel,
.reporter-empty {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.activity-list,
.action-list,
.health-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.activity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.activity:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 8px;
  height: 8px;
  flex: none;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: none;
}

.activity-dot.green {
  background: var(--green);
}

.activity-dot.amber {
  background: var(--amber);
}

.activity-dot.blue {
  background: var(--blue);
}

.activity b {
  display: block;
  font-size: 14px;
}

.activity small,
.activity time {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.activity time {
  margin-inline-start: auto;
  white-space: nowrap;
}

.funnel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.funnel div {
  width: var(--w);
  min-width: 42%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}

.funnel div:nth-child(1) {
  border-inline-end: 3px solid var(--blue);
}

.funnel div:nth-child(2) {
  border-inline-end: 3px solid var(--brand);
}

.funnel div:nth-child(3) {
  border-inline-end: 3px solid var(--amber);
}

.funnel div:nth-child(4) {
  border-inline-end: 3px solid var(--green);
}

.tab-list,
.tabs,
.subnav,
.bot-category-tabs,
.link-mode-tabs,
.editor-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 20px;
  border: 0;
  padding: 0;
}

.tab-button,
.bot-category-tabs a,
.subnav a,
.tabs a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.tab-button.active,
.tab-button[aria-selected="true"],
.bot-category-tabs a.is-active,
.subnav a:hover,
.tabs a.primary {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.bot-category-tabs {
  border: 1px solid var(--line);
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
}

.bot-category-tabs a {
  flex: 1;
  border: 0;
}

.bot-category-tabs a.is-active {
  border: 1px solid var(--brand-line);
}

.management-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.management-filters {
  align-items: end;
}

.management-filters .search-box {
  flex: 1 1 260px;
}

.reporter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.75fr);
  gap: 24px;
}

.reporter-card {
  min-width: 0;
}

.reporter-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.reporter-symbol {
  width: 48px;
  height: 48px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 24px;
}

.reporter-actions,
.runtime-actions,
.owner-links,
.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reporter-secure-form,
.owner-contact-form {
  display: grid;
  gap: 12px;
  max-width: 560px;
}

.reporter-owner-list,
.reporter-history,
.reporter-danger {
  margin-top: 24px;
}

.reporter-danger {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.reporter-danger summary {
  min-height: 44px;
  color: var(--red);
  cursor: pointer;
}

.reporter-error {
  color: var(--red);
}

.owner-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.owner-card h3,
.owner-card p {
  margin-bottom: 8px;
}

.owner-metrics,
.table-subtext {
  color: var(--muted);
}

.owner-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg);
}

.auth-card {
  width: min(430px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-elevated);
  text-align: center;
}

.auth-card .brand-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 16px;
}

.auth-card h1 {
  margin-bottom: 4px;
  font-size: 24px;
}

.auth-card > p {
  color: var(--muted);
  font-size: 14px;
}

.auth-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stack-form {
  display: grid;
  gap: 16px;
  text-align: right;
}

.stack-form label {
  display: grid;
  gap: 6px;
}

.wide {
  width: 100%;
}

.bottom-nav,
.mobile-backdrop,
.mobile-menu,
.mobile-row-toggle,
.mobile-section-picker {
  display: none;
}

.toast {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 250;
  max-width: calc(100vw - 48px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--nav);
  color: #FFFFFF;
  box-shadow: var(--shadow-elevated);
  font-size: 14px;
}

.form-feedback,
.field-error {
  grid-column: 1 / -1;
  color: var(--red);
  font-size: 12px;
}

.form-feedback {
  padding: 12px;
  border-radius: 10px;
  background: var(--danger-soft);
}

.link-builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(250px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.link-summary-aside {
  position: sticky;
  top: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.link-filter-summary,
.link-code-preview,
.link-area-picker,
.timeline-box,
.button-users-box,
.analytics-meta,
.analytics-card,
.preview-box,
.timeline-box,
.cache-stats span {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
}

.link-area-picker {
  display: flex;
  flex-wrap: wrap;
  max-height: 220px;
  gap: 8px;
  overflow: auto;
  padding: 12px;
}

.link-area-option,
.link-area-chip,
.region-option,
.region-chip {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
}

.link-area-option:hover,
.link-area-option.selected,
.region-option.selected,
.link-area-chip,
.region-chip {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand);
}

.link-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
}

.link-code-chip button {
  min-width: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--brand);
}

.receipt-preview {
  width: 100%;
  max-height: 600px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  object-fit: contain;
}

.receipt-thumb {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 12px;
  object-fit: cover;
}

.content-editor {
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.preview-phone {
  max-width: 340px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  white-space: pre-wrap;
}

.grid-2,
.region-groups-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.region-picker,
.region-group-list,
.region-group-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.region-picker {
  max-height: 240px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.region-group-card {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.region-group-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.region-group-tags span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.bot-detail-page {
  --bd-bg: var(--bg);
  --bd-surface: var(--surface);
  --bd-surface-2: var(--surface-2);
  --bd-surface-3: var(--brand-soft);
  --bd-line: var(--line);
  --bd-text: var(--text);
  --bd-muted: var(--muted);
  --bd-accent: var(--brand);
  --bd-sticky-top: var(--topbar);
  max-width: 1500px;
  min-width: 0;
  margin: 0 auto;
  color: var(--text);
}

.bot-detail-page .bot-hero,
.bot-detail-page .detail-section,
.bot-detail-page #bot-data {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.bot-detail-page .bot-hero {
  padding: var(--card-padding);
  margin-bottom: 24px;
}

.bot-detail-page .bot-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--brand-line);
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: none;
}

.bot-detail-page .bot-title-row h1 {
  font-size: 24px;
  color: var(--text);
}

.bot-detail-page .meta,
.bot-detail-page .bot-title .meta {
  color: var(--muted);
  font-size: 13px;
}

.bot-detail-page .bot-kpi-grid {
  display: none;
}

.bot-detail-page .bd-tabs-wrap {
  position: static;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.bot-detail-page .bd-tabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  margin-bottom: 24px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  scrollbar-width: none;
}

.bot-detail-page .bd-tabs a {
  min-height: 44px;
  display: flex;
  flex: none;
  align-items: center;
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  opacity: 1;
  white-space: nowrap;
  text-decoration: none;
}

.bot-detail-page .bd-tabs a:hover,
.bot-detail-page .bd-tabs a.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

.bot-detail-page .detail-section {
  margin-bottom: 16px;
  overflow: hidden;
}

.bot-detail-page .detail-section > summary {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.bot-detail-page .detail-section > summary::-webkit-details-marker {
  display: none;
}

.bot-detail-page .detail-section > summary b {
  display: block;
  font-size: 18px;
}

.bot-detail-page .detail-section > summary small {
  color: var(--muted);
  font-size: 13px;
}

.bot-detail-page .detail-section-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-top: 1px solid var(--line);
}

.bot-detail-page .bd-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.bot-detail-page .compact-panel {
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  box-shadow: none;
}

.bot-detail-page .compact-detail-list,
.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.bot-detail-page .compact-detail-list > div,
.detail-list > div {
  min-width: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.bot-detail-page .compact-detail-list dt,
.detail-list dt,
.bot-detail-page .health-stack span {
  color: var(--muted);
  font-size: 13px;
}

.bot-detail-page .compact-detail-list dd,
.detail-list dd,
.bot-detail-page .health-stack b {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.bot-detail-page .health-stack.compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bot-detail-page .health-stack.compact > div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.bot-detail-page .tab-list,
.bot-detail-page #bot-data > .section-heading-row {
  display: flex;
}

.bot-detail-page #bot-data {
  margin-bottom: 16px;
  padding: 24px;
}

.bot-detail-page .bot-action-menu-popover {
  border: 1px solid var(--line);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: var(--shadow-elevated);
}

.analytics-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.analytics-card {
  min-height: 132px;
  padding: 16px;
  cursor: pointer;
  box-shadow: none;
}

.analytics-card strong {
  display: block;
  margin: 6px 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.4;
}

.analytics-card span,
.analytics-card small {
  color: var(--muted);
}

.analytics-card.is-missing {
  border-style: dashed;
}

.analytics-missing {
  color: var(--amber);
}

.analytics-buttons,
.analytics-related {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.mobile-filter-sheet,
.mobile-filter-backdrop {
  display: none;
}

@media (min-width: 768px) and (max-width: 1199px) {
  :root {
    --sidebar: 76px;
  }

  .sidebar {
    width: 76px;
    padding: 20px 10px;
  }

  .sidebar .nav-label,
  .sidebar .brand small {
    display: none;
  }

  .sidebar .brand {
    justify-content: center;
    padding: 0 4px 20px;
  }

  .sidebar .nav-link {
    justify-content: center;
    padding: 12px;
  }

  .sidebar-account {
    justify-content: center;
    padding-inline: 0;
  }

  .main-content {
    margin-right: 76px;
  }

  .sidebar.open {
    width: 260px;
  }

  .sidebar.open .nav-label,
  .sidebar.open .brand small {
    display: block;
  }

  .sidebar.open .nav-link {
    justify-content: flex-start;
  }

  .page-wrap {
    padding: 24px;
  }

  .topbar {
    padding-inline: 24px;
  }

  .stats-grid,
  .bot-detail-page .bot-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid.two-thirds,
  .dashboard-grid,
  .reporter-layout,
  .region-groups-layout,
  .link-builder-layout {
    grid-template-columns: 1fr;
  }

  .link-summary-aside {
    position: static;
  }
}

@media (max-width: 767px) {
  :root {
    --sidebar: 280px;
    --topbar: 56px;
    --page-inline: 16px;
    --card-padding: 16px;
  }

  body,
  body.app-shell,
  body.public-page,
  body.auth-page {
    font-size: 15px;
  }

  input,
  select,
  textarea {
    min-height: 48px;
  }

  .sidebar {
    width: 280px;
    max-width: 86vw;
    transform: translateX(105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }


  .mobile-backdrop.open {
    position: fixed;
    inset: 0;
    z-index: 99;
    display: block;
    background: rgba(15, 23, 42, 0.48);
  }

  .main-content {
    margin: 0;
  }

  .topbar {
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    gap: 8px;
  }

  .mobile-menu {
    display: grid;
    flex: none;
  }

  .breadcrumbs {
    flex: 1;
    justify-content: center;
  }

  .breadcrumbs > span,
  .breadcrumbs > i,
  .environment-control > span,
  .top-actions [data-logout] {
    display: none;
  }

  .breadcrumbs b {
    max-width: 130px;
  }

  .top-actions {
    gap: 4px;
  }

  .environment-control select {
    max-width: 92px;
    min-height: 44px;
    font-size: 12px;
  }

  .page-wrap {
    padding: 24px 16px calc(88px + env(safe-area-inset-bottom));
  }

  .page-heading,
  .bot-detail-page .bot-hero {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 20px;
  }

  .page-heading h1,
  .bot-detail-page .bot-title-row h1 {
    font-size: 22px;
  }

  .page-heading p {
    line-height: 1.7;
  }

  .page-heading > .filter-bar,
  .page-heading > .toolbar,
  .filter-bar,
  .management-filters {
    width: 100%;
  }

  .stats-grid,
  .bot-detail-page .bot-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .stat-card {
    min-height: 136px;
    padding: 16px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .panel,
  .reporter-card,
  .owner-card,
  .loading-card {
    padding: 16px;
  }

  .table-panel {
    padding: 0;
  }

  .panel-heading {
    flex-wrap: wrap;
  }

  .content-grid.two-thirds,
  .dashboard-grid,
  .detail-grid,
  .receipt-layout,
  .editor-layout,
  .reporter-layout,
  .owner-grid,
  .grid-2,
  .region-groups-layout,
  .link-builder-layout,
  .bot-detail-page .bd-grid-2,
  .bot-detail-page .health-stack.compact {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .bot-detail-page .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .management-filters,
  .filter-bar,
  .analytics-toolbar {
    align-items: stretch;
  }

  .toolbar > *,
  .management-filters > *,
  .filter-bar > *,
  .analytics-toolbar > *,
  .search-box {
    width: 100%;
  }

  .search-box {
    min-width: 0;
  }

  .search-box input {
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  tbody {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: block;
    margin-bottom: 12px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  tbody td {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0 !important;
    border: 0;
    text-align: start;
    white-space: normal !important;
  }

  td::before {
    content: attr(data-label);
    max-width: 42%;
    flex: none;
    color: var(--muted);
    font-size: 12px;
  }

  td[colspan] {
    display: block;
    text-align: center;
  }

  td[colspan]::before {
    display: none;
  }

  .mobile-extra {
    display: none !important;
  }

  tr.row-expanded .mobile-extra {
    display: flex !important;
  }

  .mobile-row-toggle {
    min-height: 44px;
    display: block;
    margin-top: 4px;
    border: 0;
    background: transparent;
    color: var(--brand);
  }

  .bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 90;
    height: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
    display: flex;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .bottom-nav a,
  .bottom-nav button {
    width: auto;
    flex: 1 1 25%;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
  }

  .bottom-nav .active {
    background: var(--brand-soft);
    color: var(--brand);
  }

  .toast {
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 16px;
    max-width: none;
  }

  .bot-detail-page .bot-hero {
    padding: 16px;
  }

  .bot-detail-page .bot-identity {
    flex-basis: 100%;
  }

  .bot-detail-page .bot-hero-actions {
    width: 100%;
  }

  .bot-detail-page .bd-tabs-wrap,
  .bot-detail-page .bot-kpi-grid {
    display: none;
  }

  .mobile-section-picker {
    display: grid;
    margin-bottom: 16px;
  }

  .mobile-section-picker select {
    width: 100%;
  }

  .bot-detail-page .detail-section > summary {
    min-height: 56px;
    padding: 16px;
  }

  .bot-detail-page .detail-section-body,
  .bot-detail-page #bot-data {
    padding: 16px;
  }

  .bot-detail-page .compact-panel {
    padding: 16px;
  }

  .bot-detail-page .compact-detail-list,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .bot-detail-page .bot-action-menu-popover {
    position: fixed;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 12px;
    top: auto;
    max-height: 65dvh;
    overflow: auto;
  }

  .bot-detail-page .bot-action-menu-popover a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .link-summary-aside {
    position: static;
  }

  .analytics-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-card {
    padding: 24px 16px;
  }

  .auth-card .brand-mark {
    width: 64px;
    height: 64px;
  }

  .content-editor {
    padding: 16px;
  }

  .editor-layout .preview-phone {
    display: none;
  }

  .editor-layout.is-preview form {
    display: none;
  }

  .editor-layout.is-preview .preview-phone {
    display: block;
  }

  .form-actions {
    position: sticky;
    bottom: calc(72px + env(safe-area-inset-bottom));
    z-index: 5;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .bot-category-tabs {
    gap: 4px;
  }

  .bot-category-tabs a {
    min-height: 48px;
    padding: 8px 4px;
  }

  .bot-category-tabs a span {
    display: none;
  }

  .management-actions .button,
  .reporter-actions form,
  .reporter-actions .button {
    width: 100%;
  }

  .reporter-actions form button {
    width: 100%;
  }

  .region-group-card-head {
    flex-direction: column;
  }
}

@media (max-width: 350px) {
  .stats-grid,
  .analytics-cards {
    grid-template-columns: 1fr;
  }

  .breadcrumbs b {
    max-width: 112px;
  }

  .bottom-nav a,
  .bottom-nav button {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.dashboard-page-heading {
  align-items: flex-end;
}

.dashboard-page-heading .filter-bar {
  align-items: end;
  min-width: 260px;
}

.stats-grid:has(.dashboard-kpi) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-kpi {
  min-width: 0;
  min-height: 152px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.dashboard-kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-elevated);
}

.kpi-indigo {
  border-color: color-mix(in srgb, #6366F1 24%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, #6366F1 10%, var(--surface)), var(--surface));
}

.kpi-emerald {
  border-color: color-mix(in srgb, #10B981 24%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, #10B981 11%, var(--surface)), var(--surface));
}

.kpi-sky {
  border-color: color-mix(in srgb, #0EA5E9 24%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, #0EA5E9 10%, var(--surface)), var(--surface));
}

.kpi-amber {
  border-color: color-mix(in srgb, #F59E0B 25%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, #F59E0B 11%, var(--surface)), var(--surface));
}

.kpi-icon {
  width: 48px;
  height: 48px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 14px;
}

.kpi-indigo .kpi-icon {
  background: #6366F118;
  color: #6366F1;
}

.kpi-emerald .kpi-icon {
  background: #10B98118;
  color: #059669;
}

.kpi-sky .kpi-icon {
  background: #0EA5E918;
  color: #0284C7;
}

.kpi-amber .kpi-icon {
  background: #F59E0B18;
  color: #D97706;
}

:root[data-theme="dark"] .kpi-emerald .kpi-icon {
  color: #34D399;
}

:root[data-theme="dark"] .kpi-sky .kpi-icon {
  color: #38BDF8;
}

:root[data-theme="dark"] .kpi-amber .kpi-icon {
  color: #FBBF24;
}

.kpi-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.kpi-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kpi-copy strong {
  margin: 5px 0 2px;
  color: var(--text);
  font-size: 30px;
  line-height: 1.25;
  direction: rtl;
}

.kpi-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.55;
}

.dashboard-analytics-card {
  min-width: 0;
  margin-bottom: 24px;
  padding: 20px 24px 16px;
}

.chart-header-metric {
  min-width: 116px;
  display: grid;
  grid-template-columns: 8px auto;
  column-gap: 8px;
  align-items: center;
  justify-content: end;
  text-align: left;
}

.chart-live-dot {
  width: 8px;
  height: 8px;
  grid-row: 1;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 5px #10B98118;
}

.chart-header-metric b {
  grid-row: 1;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.chart-header-metric small {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.activity-chart-wrap {
  position: relative;
  height: 340px;
  min-height: 340px;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand-soft) 35%, transparent), transparent 58%);
}

.chart-legend {
  position: absolute;
  top: 6px;
  right: 18px;
  z-index: 3;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i {
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: #10B981;
}

.activity-line-chart {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: block;
  direction: ltr;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.chart-axis-label,
.bar-chart-label,
.bar-chart-value {
  fill: var(--muted);
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: 12px;
}

.activity-area {
  opacity: 0;
  animation: chartAreaIn 220ms ease forwards;
}

.activity-line {
  stroke: #10B981;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1600;
  stroke-dashoffset: 1600;
  animation: chartLineIn 420ms ease forwards;
  filter: drop-shadow(0 5px 8px rgba(16, 185, 129, 0.14));
}

.activity-dot-chart {
  fill: var(--surface);
  stroke: #10B981;
  stroke-width: 3;
  cursor: crosshair;
  transition: r 180ms ease, fill 180ms ease;
}

.activity-dot-chart:hover,
.activity-dot-chart:focus {
  r: 7;
  fill: #10B981;
  outline: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 8;
  min-width: 124px;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-elevated);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chart-tooltip small,
.chart-tooltip b {
  direction: rtl;
  text-align: right;
}

.chart-skeleton,
.chart-skeleton span {
  display: block;
}

.chart-skeleton {
  position: absolute;
  inset: 20px 0 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 16px;
  opacity: 0.35;
}

.chart-skeleton span {
  width: 18%;
  height: 35%;
  border-radius: 12px 12px 4px 4px;
  background: var(--surface-2);
  animation: chartSkeleton 800ms ease-in-out infinite alternate;
}

.chart-skeleton span:nth-child(2) {
  height: 66%;
}

.chart-skeleton span:nth-child(3) {
  height: 48%;
}

.chart-accessible-summary {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-data-details {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.chart-data-details summary {
  min-height: 36px;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
}

.dashboard-secondary-grid,
.dashboard-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-chart-card {
  min-width: 0;
  min-height: 330px;
}

.donut-layout {
  min-height: 248px;
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(150px, 1fr);
  align-items: center;
  gap: 12px;
}

.donut-chart {
  width: 220px;
  max-width: 100%;
  min-height: 180px;
  margin: auto;
  aspect-ratio: 1;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 12px 18px rgba(15, 23, 42, 0.08));
}

.donut-segment {
  transition: stroke-width 180ms ease, opacity 180ms ease;
}

.donut-segment:hover {
  stroke-width: 22;
}

.donut-total {
  fill: var(--text);
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: 27px;
  font-weight: 800;
  direction: rtl;
}

.donut-caption {
  fill: var(--muted);
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: 12px;
  direction: rtl;
}

.donut-legend {
  display: grid;
  gap: 8px;
}

.donut-legend-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.donut-legend-row span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.donut-legend-row i {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
}

.donut-legend-row b {
  color: var(--text);
  direction: rtl;
}

.donut-empty-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.bar-chart {
  min-height: 248px;
  width: 100%;
  display: grid;
  place-items: center;
}

.bar-chart-svg {
  width: 100%;
  height: 248px;
  display: block;
  direction: ltr;
  overflow: visible;
}

.bar-chart-track {
  fill: var(--surface-2);
}

.bar-chart-bar {
  transform-origin: 76px center;
  animation: barGrow 420ms ease-out both;
  transition: opacity 180ms ease;
}

.bar-chart-row:hover .bar-chart-bar {
  opacity: 0.82;
}

.bar-chart-label,
.bar-chart-value {
  direction: rtl;
  unicode-bidi: plaintext;
}

.bar-chart-value {
  fill: var(--text);
  font-weight: 700;
}

.dashboard-empty,
.chart-empty,
.donut-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.dashboard-empty span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 20px;
}

.dashboard-empty b {
  color: var(--text);
  font-size: 14px;
}

.dashboard-empty small {
  color: var(--muted);
  font-size: 12px;
}

.chart-empty {
  min-height: 260px;
  width: 100%;
  border: 0;
}

.dashboard-timeline,
.dashboard-action-list {
  min-width: 0;
}

.dashboard-activity-list {
  display: grid;
  gap: 2px;
}

.dashboard-activity {
  min-height: 58px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.dashboard-activity:last-child {
  border-bottom: 0;
}

.dashboard-activity .activity-tone {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 5px #10B98114;
}

.dashboard-activity .activity-tone.amber {
  background: #F59E0B;
  box-shadow: 0 0 0 5px #F59E0B14;
}

.dashboard-activity b,
.dashboard-activity small {
  display: block;
}

.dashboard-activity b {
  color: var(--text);
  font-size: 13px;
}

.dashboard-activity small,
.dashboard-activity time {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-activity time {
  direction: ltr;
  white-space: nowrap;
}

.action-item {
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.action-item:hover {
  transform: translateX(-2px);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.action-item:active,
.button:active,
.dashboard-kpi:active {
  transform: scale(0.985);
}

@keyframes chartLineIn {
  to { stroke-dashoffset: 0; }
}

@keyframes chartAreaIn {
  to { opacity: 1; }
}

@keyframes chartSkeleton {
  to { height: 75%; }
}

@keyframes barGrow {
  from { transform: scaleX(0); opacity: 0.25; }
  to { transform: scaleX(1); opacity: 1; }
}

@media (max-width: 1199px) {
  .stats-grid:has(.dashboard-kpi) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .activity-chart-wrap {
    height: 300px;
    min-height: 300px;
  }

  .dashboard-secondary-grid,
  .dashboard-insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .dashboard-page-heading {
    gap: 12px;
  }

  .dashboard-page-heading .filter-bar {
    min-width: 0;
  }

  .stats-grid:has(.dashboard-kpi) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-kpi {
    min-height: 136px;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
  }

  .kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .kpi-copy strong {
    margin-top: 3px;
    font-size: 24px;
  }

  .dashboard-analytics-card {
    padding: 16px 12px 12px;
  }

  .chart-header-metric {
    min-width: 100px;
  }

  .activity-chart-wrap {
    height: 260px;
    min-height: 260px;
  }

  .chart-legend {
    right: 8px;
  }

  .dashboard-secondary-grid,
  .dashboard-insights-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dashboard-chart-card {
    min-height: 0;
  }

  .donut-layout {
    grid-template-columns: minmax(150px, 0.9fr) minmax(130px, 1fr);
  }

  .donut-chart {
    width: 180px;
  }

  .bar-chart,
  .bar-chart-svg {
    min-height: 220px;
    height: 220px;
  }

  .dashboard-activity {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .dashboard-activity time {
    grid-column: 2;
  }
}

@media (max-width: 350px) {
  .stats-grid:has(.dashboard-kpi) {
    grid-template-columns: 1fr;
  }

  .dashboard-kpi {
    min-height: 126px;
  }

  .donut-layout {
    grid-template-columns: 1fr;
  }
}
