@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f7f7f9;
  --bg-elevated: #ffffff;
  --bg-subtle: #f0f1f4;
  --bg-hover: #e9eaef;
  --border: #e6e7eb;
  --border-strong: #d6d8de;
  --text: #16171d;
  --text-muted: #62636c;
  --text-faint: #9497a1;

  --accent: #5850ec;
  --accent-hover: #4740d4;
  --accent-soft: #eeedfd;
  --accent-contrast: #ffffff;

  --success: #12805c;
  --success-soft: #e3f6ee;
  --warning: #a15c07;
  --warning-soft: #fbf0dd;
  --danger: #c22a3e;
  --danger-soft: #fbe9ec;
  --info: #0b6e8f;
  --info-soft: #e4f4f9;

  --shadow-xs: 0 1px 2px rgba(15, 15, 30, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 15, 30, 0.06), 0 1px 2px rgba(15,15,30,.04);
  --shadow-md: 0 8px 24px rgba(15, 15, 30, 0.08);
  --shadow-lg: 0 16px 48px rgba(15, 15, 30, 0.14);

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --sidebar-w: 248px;
  --topbar-h: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0d;
    --bg-elevated: #15161b;
    --bg-subtle: #1c1d24;
    --bg-hover: #24252d;
    --border: #26272f;
    --border-strong: #34353f;
    --text: #f2f2f5;
    --text-muted: #9fa0aa;
    --text-faint: #6b6c78;

    --accent: #7c74ff;
    --accent-hover: #9089ff;
    --accent-soft: #201d3d;
    --accent-contrast: #ffffff;

    --success: #35d399;
    --success-soft: #0f2b22;
    --warning: #f0a83c;
    --warning-soft: #332408;
    --danger: #f2586b;
    --danger-soft: #331319;
    --info: #4fc3e8;
    --info-soft: #0c2933;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
    --shadow-md: 0 8px 24px rgba(0,0,0,.5);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.6);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a0d;
  --bg-elevated: #15161b;
  --bg-subtle: #1c1d24;
  --bg-hover: #24252d;
  --border: #26272f;
  --border-strong: #34353f;
  --text: #f2f2f5;
  --text-muted: #9fa0aa;
  --text-faint: #6b6c78;

  --accent: #7c74ff;
  --accent-hover: #9089ff;
  --accent-soft: #201d3d;
  --accent-contrast: #ffffff;

  --success: #35d399;
  --success-soft: #0f2b22;
  --warning: #f0a83c;
  --warning-soft: #332408;
  --danger: #f2586b;
  --danger-soft: #331319;
  --info: #4fc3e8;
  --info-soft: #0c2933;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow-md: 0 8px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.6);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: "Vazirmatn", -apple-system, "Segoe UI", Tahoma, sans-serif;
  direction: rtl; font-size: 14.5px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  max-width: 100%; overflow-x: hidden;
}
img, svg, table, pre { max-width: 100%; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; }
::selection { background: var(--accent-soft); color: var(--accent); }

h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 800; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 17px; } h4 { font-size: 15px; }
p { margin: 0 0 1em; color: var(--text-muted); }

.icon { flex-shrink: 0; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 650; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease, box-shadow .15s ease;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { filter: brightness(0.96); }
.btn-warning { background: var(--warning-soft); color: var(--warning); }
.btn-warning:hover { filter: brightness(0.96); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 22px;
}
.card-hover { transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--border-strong); }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 650; color: var(--text-muted); margin-bottom: 6px; }
.form-group { margin-bottom: 16px; }
input, select, textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text);
  font-family: inherit; font-size: 14px; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.input-group { display: flex; align-items: stretch; }
.input-group > * { border-radius: 0; }
.input-group > *:first-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.input-group > *:last-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.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-muted { background: var(--bg-subtle); color: var(--text-muted); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 480px; }
th { text-align: right; color: var(--text-faint); font-weight: 650; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: var(--bg-subtle); }
tr:last-child td { border-bottom: none; }

/* ---------- Smart list: instant search + pagination ---------- */
.smart-toolbar { position: relative; margin-bottom: 12px; }
.smart-toolbar .smart-search-icon {
  position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none; display: flex;
}
.smart-toolbar input.smart-search-input { padding-inline-start: 38px; }
.smart-empty { display: none; text-align: center; padding: 40px 20px; color: var(--text-faint); font-size: 13.5px; }
.smart-empty.show { display: block; }
.smart-pagination {
  display: none; align-items: center; justify-content: center; gap: 14px;
  margin-top: 16px; padding-top: 4px;
}
.smart-pagination.show { display: flex; }
.smart-pagination .smart-page-info { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 84px; text-align: center; }
.smart-pagination button { min-width: 36px; }
.smart-pagination button:disabled { opacity: .4; cursor: not-allowed; }
[data-smart-list] [data-smart-hidden] { display: none !important; }

@media (max-width: 640px) {
  table[data-smart-list] thead, table.list-table thead { display: none; }
  table[data-smart-list], table.list-table,
  table[data-smart-list] tbody, table.list-table tbody { display: block; width: 100%; min-width: 0; }
  table[data-smart-list] tbody tr, table.list-table tbody tr {
    display: block; background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px;
  }
  table[data-smart-list] tbody tr:last-child, table.list-table tbody tr:last-child { margin-bottom: 0; }
  table[data-smart-list] tbody tr:hover, table.list-table tbody tr:hover { background: var(--bg-elevated); }
  table[data-smart-list] tbody td, table.list-table tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 7px 0; border-bottom: 1px solid var(--border); text-align: left; white-space: normal;
  }
  table[data-smart-list] tbody td:last-child, table.list-table tbody td:last-child { border-bottom: none; }
  table[data-smart-list] tbody td[data-label]::before, table.list-table tbody td[data-label]::before {
    content: attr(data-label); font-size: 11px; font-weight: 650; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
  }
  table[data-smart-list] tbody td:not([data-label]), table.list-table tbody td:not([data-label]) { justify-content: flex-start; padding-top: 10px; }
}

/* ---------- Utility ---------- */
.flex { display: flex; } .flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 6px; } .gap-2 { gap: 12px; } .gap-3 { gap: 20px; }
.text-muted { color: var(--text-muted); } .text-faint { color: var(--text-faint); }
.text-sm { font-size: 12.5px; } .text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.font-mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

.grid { display: grid; gap: 18px; min-width: 0; }
.grid > * { min-width: 0; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-cols-4 { grid-template-columns: repeat(2, 1fr); } }
.flex, .flex-col { min-width: 0; }
[style*="flex:1"] { min-width: 0; }
.card { min-width: 0; max-width: 100%; }
@media (max-width: 640px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
  .stat-grid.grid-cols-2, .stat-grid.grid-cols-3, .stat-grid.grid-cols-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-grid .stat-tile { padding: 12px 13px; border-radius: var(--radius-md); }
  .stat-grid .stat-tile .stat-top { margin-bottom: 14px; }
  .stat-grid .stat-tile .label { font-size: 10.5px; }
  .stat-grid .stat-tile .stat-icon { width: 24px; height: 24px; border-radius: 6px; }
  .stat-grid .stat-tile .stat-icon svg { width: 14px; height: 14px; }
  .stat-grid .stat-tile .value { font-size: 18px; }
  .stat-grid .stat-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-faint); }
.empty-state .icon { margin-bottom: 14px; opacity: .5; }
.empty-state p { color: var(--text-faint); margin-bottom: 18px; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: relative; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-subtle); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }
.nav-alert-dot {
  position: absolute; top: -3px; inset-inline-end: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg-elevated);
}
.mobile-tabbar a { position: relative; }
.tabbar-alert-dot {
  position: absolute; top: 2px; inset-inline-end: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg-elevated);
}

/* ---------- Flash messages ---------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-warning { background: var(--warning-soft); color: var(--warning); }
.flash-danger { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--info-soft); color: var(--info); }

/* =========================================================
   PUBLIC SITE (landing / marketing)
   ========================================================= */
.topnav {
  position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topnav-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 18px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link { padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px; color: var(--text-muted); }
.nav-link:hover { background: var(--bg-subtle); color: var(--text); }
.nav-link.active { color: var(--accent); background: var(--accent-soft); }
.mobile-menu-btn { display: none; }
@media (max-width: 780px) {
  .nav-links-desktop { display: none; }
  .mobile-menu-btn { display: inline-flex; }
}

.hero { padding: 88px 0 64px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 480px;
  background: radial-gradient(600px circle at 50% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none; z-index: -1;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; margin-bottom: 22px;
}
.hero h1 { font-size: 44px; margin-bottom: 16px; max-width: 780px; margin-inline: auto; }
.hero p.lead { font-size: 16.5px; max-width: 600px; margin: 0 auto 32px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 640px) { .hero { padding: 56px 0 40px; } .hero h1 { font-size: 28px; } }

.trust-strip { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; padding: 30px 0 60px; }
.trust-item { text-align: center; }
.trust-item .num { font-size: 26px; font-weight: 800; color: var(--text); }
.trust-item .lbl { font-size: 12.5px; color: var(--text-faint); }

.section { padding: 60px 0; }
.section-head { text-align: center; max-width: 560px; margin: 0 auto 40px; }
.section-head .eyebrow { color: var(--accent); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; display: block; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 860px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card { padding: 26px; border-radius: var(--radius-lg); background: var(--bg-elevated); border: 1px solid var(--border); }
.feature-card .fi {
  width: 42px; height: 42px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}

.pricing-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 280px)); gap: 20px;
  justify-content: center;
}
.pricing-card {
  position: relative; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 28px 24px; display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 280px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.pricing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.pricing-card.popular { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); }
.popular-tag {
  position: absolute; top: -12px; right: 24px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.pricing-card .plan-name { font-size: 16px; font-weight: 800; }
.pricing-card .plan-price { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.pricing-card .plan-price small { font-size: 13px; font-weight: 600; color: var(--text-faint); }
.plan-specs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 11px; }
.plan-specs li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-muted); }
.plan-specs li .ic { color: var(--success); flex-shrink: 0; }

.site-footer { border-top: 1px solid var(--border); padding: 40px 0; margin-top: 40px; }
.footer-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col h4 { font-size: 12.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.footer-col a { display: block; color: var(--text-muted); font-size: 13.5px; padding: 5px 0; }
.footer-col a:hover { color: var(--text); }
.footer-bottom { color: var(--text-faint); font-size: 12.5px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); }

/* =========================================================
   APP SHELL (admin + customer dashboards)
   ========================================================= */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-elevated); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 30;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-section-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 14px 12px 6px; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600; font-size: 13.5px; margin-bottom: 2px; position: relative;
}
.side-link:hover { background: var(--bg-subtle); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.side-link .icon { flex-shrink: 0; }
.side-link .count { margin-inline-start: auto; font-size: 11px; background: var(--bg-subtle); color: var(--text-faint); padding: 1px 7px; border-radius: 999px; }
.side-link.active .count { background: var(--accent); color: #fff; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.user-chip:hover { background: var(--bg-subtle); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}

.app-main { flex: 1; min-width: 0; }
.app-topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; border-bottom: 1px solid var(--border); background: var(--bg-elevated);
  position: sticky; top: 0; z-index: 20;
}
.app-content { padding: 26px; max-width: 1520px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.mobile-nav-toggle { display: none; }

.mobile-tabbar { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; right: 0; top: 0; height: 100vh; height: 100dvh;
    transform: translateX(100%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
    max-width: 84vw;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }
  .sidebar-overlay.open { display: block; }
  .mobile-nav-toggle { display: inline-flex; }
  .app-topbar { padding: 0 14px; gap: 8px; }
  .app-topbar .badge-info { display: none; }
  .app-content { padding: 16px; padding-bottom: 84px; max-width: 100%; overflow-x: hidden; }
  .mobile-tabbar {
    display: flex; position: fixed; bottom: 0; right: 0; left: 0; height: 62px; background: var(--bg-elevated);
    border-top: 1px solid var(--border); z-index: 35; padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-tabbar a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-faint); font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
  .mobile-tabbar a.active { color: var(--accent); }
  .mobile-topbar-logout { display: inline-flex !important; }
}
.mobile-topbar-logout { display: none; }

/* ---------- Stat tiles ---------- */
.stat-tile { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.stat-tile .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-tile .label { font-size: 12px; color: var(--text-faint); font-weight: 650; }
.stat-tile .stat-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.stat-tile .value { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; }
.stat-tile .trend { font-size: 12px; font-weight: 650; display: flex; align-items: center; gap: 3px; margin-top: 6px; }
.trend.up { color: var(--success); } .trend.down { color: var(--danger); }

/* ---------- Server power / status ---------- */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.on { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.off { background: var(--text-faint); }
.status-dot.pending { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }

.server-card {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius-lg);
  background: var(--bg-elevated); border: 1px solid var(--border); transition: border-color .15s ease, box-shadow .15s ease;
}
.server-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.server-card.is-provisioning { flex-direction: column; align-items: stretch; gap: 10px; }
.server-card.is-provisioning .progress-track { height: 6px; }
.server-card .os-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--bg-subtle); display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }

/* ---------- Server hero / detail ---------- */
.server-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 24px; border-radius: var(--radius-lg); background: var(--bg-elevated);
  border: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap;
}
.server-hero .hn { font-size: 18px; font-weight: 800; font-family: ui-monospace, monospace; }
.spec-pill { display: flex; align-items: center; gap: 10px; padding: 13px 16px; background: var(--bg-subtle); border-radius: var(--radius-md); font-size: 13px; }
.spec-pill .icon { color: var(--text-faint); }
.spec-pill b { font-size: 14.5px; }
.action-btn.loading { opacity: .6; pointer-events: none; }
.copy-chip { cursor: pointer; user-select: all; font-family: ui-monospace, monospace; background: var(--bg-subtle); padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); font-size: 13px; }

/* ---------- Bank card widget ---------- */
.bank-card {
  position: relative; border-radius: 18px; padding: 22px 22px 18px; color: #fff; overflow: hidden;
  background: linear-gradient(135deg, #2b2f77 0%, #4534a8 45%, #7c3aed 100%);
  box-shadow: 0 10px 30px -10px rgba(76, 42, 173, .55); min-height: 168px;
  display: flex; flex-direction: column; justify-content: space-between; cursor: pointer;
  direction: ltr; text-align: left;
}
.bank-card::before {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background: radial-gradient(circle at 88% 8%, rgba(255,255,255,.22), transparent 42%),
              radial-gradient(circle at 6% 96%, rgba(255,255,255,.12), transparent 40%);
}
.bank-card-chip {
  width: 40px; height: 30px; border-radius: 6px;
  background: linear-gradient(135deg, #e8d48a, #b8963f);
  position: relative; z-index: 1;
}
.bank-card-top { display: flex; align-items: flex-start; justify-content: space-between; z-index: 1; }
.bank-card-bank { font-size: 13px; font-weight: 700; opacity: .92; letter-spacing: .02em; z-index: 1; }
.bank-card-number {
  font-family: ui-monospace, "Courier New", monospace; font-weight: 600;
  font-size: clamp(14px, 5.2vw, 21px); letter-spacing: clamp(1px, 0.6vw, 3px);
  word-spacing: clamp(2px, 1.4vw, 6px); margin: 14px 0 12px; z-index: 1;
  white-space: nowrap;
}
.bank-card-bottom { display: flex; align-items: flex-end; justify-content: space-between; z-index: 1; }
.bank-card-holder { font-size: 13px; font-weight: 600; opacity: .95; text-transform: uppercase; letter-spacing: .04em; }
.bank-card-copy-hint { font-size: 10.5px; opacity: .75; margin-top: 2px; }
.bank-card:active { transform: scale(0.98); transition: transform .1s ease; }
@media (max-width: 420px) {
  .bank-card { padding: 16px 14px 12px; min-height: 140px; }
}

/* ---------- Tabs ---------- */
.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tab-link { padding: 10px 16px; font-size: 13.5px; font-weight: 650; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Live progress ---------- */
.progress-track { width: 100%; height: 8px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden; border: 1px solid var(--border); }
.progress-fill {
  height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  width: 4%; transition: width 0.6s cubic-bezier(.4,0,.2,1); position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  width: 40%; animation: progress-shine 1.3s linear infinite;
}
@keyframes progress-shine { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.progress-stage { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 650; color: var(--text-muted); margin-bottom: 12px; }
.progress-spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-pct { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 800; }

/* ---------- Range slider ---------- */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
  background: var(--bg-subtle); padding: 0; border: none; margin: 6px 0 4px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg-elevated); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
  cursor: pointer; margin-top: -7px;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
  border: 3px solid var(--bg-elevated); box-shadow: 0 0 0 1px var(--accent); cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; }
input[type="range"]:focus { outline: none; box-shadow: none; }

/* ---------- Ticket chat ---------- */
.chat-window { display: flex; flex-direction: column; gap: 12px; padding: 20px; max-height: 520px; overflow-y: auto; }
.chat-bubble { max-width: 72%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; }
.chat-bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-left-radius: 4px; }
.chat-bubble.theirs { align-self: flex-start; background: var(--bg-subtle); color: var(--text); border-bottom-right-radius: 4px; }
.chat-time { font-size: 10.5px; opacity: .7; margin-top: 4px; display: block; }
.chat-input-row { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--border); }
.chat-input-row textarea { resize: none; height: 44px; }
.ticket-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--bg-elevated); border: 1px solid var(--border); }
.ticket-row:hover { border-color: var(--border-strong); }

/* ---------- Modal ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(10,10,15,.5);
  z-index: 100; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-elevated); border-radius: var(--radius-lg); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto;
  padding: 24px; position: relative;
}
.modal-close { position: absolute; top: 16px; left: 16px; cursor: pointer; color: var(--text-faint); background: var(--bg-subtle); border-radius: 8px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { color: var(--text); }
.pay-option-card {
  display: flex; align-items: center; gap: 14px; padding: 20px; border-radius: var(--radius-lg);
  background: var(--bg-elevated); border: 1px solid var(--border); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%; box-sizing: border-box; text-align: right; font-family: inherit; margin-bottom: 0;
  font-size: inherit; color: inherit; font-weight: inherit;
}
.pay-option-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.pay-option-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pay-option-card input[type="radio"], .pay-option-card input[type="checkbox"] {
  flex-shrink: 0; width: 18px; height: 18px; margin: 0; accent-color: var(--accent);
}
.pay-option-card .label-text {
  flex: 1 1 0%; min-width: 0; display: flex; align-items: center; gap: 8px;
  overflow-wrap: break-word; word-break: break-word;
}

/* ---------- Activity log ---------- */
.activity-log { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.log-line { display: flex; align-items: center; gap: 9px; padding: 8px 4px; font-size: 13px; }
.log-line .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--text-faint); }
.log-line.ok .dot { background: var(--success); }
.log-line.fail .dot { background: var(--danger); }
.log-line.pending .dot { background: var(--warning); animation: pulse-dot 1s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.log-line .time { color: var(--text-faint); font-size: 11px; margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--success); margin-inline-end: 5px; animation: pulse-dot 1.4s ease-in-out infinite; }

/* ---------- Resource gauge ---------- */
.gauge-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.gauge-label { width: 70px; font-size: 12.5px; color: var(--text-muted); font-weight: 650; flex-shrink: 0; }
.gauge-track { flex: 1; height: 7px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.gauge-val { width: 40px; text-align: left; font-size: 12px; color: var(--text-faint); flex-shrink: 0; }

/* ---------- Print (invoices) ---------- */
@media print {
  .sidebar, .sidebar-overlay, .app-topbar, .mobile-tabbar, .no-print { display: none !important; }
  .app-main { margin: 0 !important; }
  .app-content { padding: 0 !important; }
  body, .card { background: #fff !important; color: #000 !important; }
  .invoice-box { border: none !important; box-shadow: none !important; max-width: 100% !important; }
}

/* ---------- Usage trend charts ---------- */
.usage-charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 640px) { .usage-charts-grid { grid-template-columns: 1fr; } }
.usage-chart-card { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; min-width: 0; }
.usage-chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 8px; }
.usage-chart-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usage-chart-value { font-size: 14.5px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.usage-chart-svg-wrap { position: relative; width: 100%; height: 64px; }
.usage-chart-svg-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.usage-chart-svg-wrap .chart-line { stroke: var(--accent); stroke-width: 2px; }
.usage-chart-svg-wrap .chart-grad-start { stop-color: var(--accent); stop-opacity: 0.32; }
.usage-chart-svg-wrap .chart-grad-end { stop-color: var(--accent); stop-opacity: 0; }
.usage-chart-svg-wrap .chart-grid-line { stroke: var(--border); stroke-width: 1px; }
.usage-chart-svg-wrap .chart-dot { fill: var(--accent); stroke: var(--bg-elevated); stroke-width: 2px; }
.usage-chart-svg-wrap .chart-guideline { stroke: var(--text-faint); stroke-width: 1px; stroke-dasharray: 2,2; }
.chart-tooltip {
  position: absolute; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; pointer-events: none;
  box-shadow: var(--shadow-sm); transform: translate(-50%, -125%); z-index: 5; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.usage-chart-empty { display: flex; align-items: center; justify-content: center; height: 64px; color: var(--text-faint); font-size: 12px; }
