@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_UltraLight.woff2') format('woff2');
}
@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_Light.woff2') format('woff2');
}
@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/IRANSansWeb.woff2') format('woff2');
}
@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_Bold.woff2') format('woff2');
}
:root {
  --brand-50:  #F5F3FF;
  --brand-100: #EDE9FE;
  --brand-200: #DDD6FE;
  --brand-300: #C4B5FD;
  --brand-400: #A78BFA;
  --brand-500: #8B5CF6;
  --brand-600: #7C3AED;
  --brand-700: #6D28D9;
  --brand-800: #5B21B6;
  --brand-900: #4C1D95;

  --slate-50:  #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;

  --success-50:  #ECFDF5;
  --success-500: #10B981;
  --success-700: #047857;
  --warn-50:     #FFFBEB;
  --warn-500:    #F59E0B;
  --warn-700:    #B45309;
  --danger-50:   #FEF2F2;
  --danger-500:  #EF4444;
  --danger-700:  #B91C1C;
  --info-50:     #EFF6FF;
  --info-500:    #3B82F6;
  --info-700:    #1D4ED8;

  --bg:           var(--slate-50);
  --surface:      #FFFFFF;
  --surface-alt:  var(--slate-100);
  --border:       var(--slate-200);
  --border-soft:  var(--slate-100);
  --text:         var(--slate-900);
  --text-muted:   var(--slate-500);
  --text-subtle:  var(--slate-400);

  --primary:        var(--brand-600);
  --primary-hover:  var(--brand-700);
  --primary-soft:   var(--brand-50);
  --primary-on:     #FFFFFF;
  --ring:           rgb(124 58 237 / .35);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgb(15 23 42 / .04);
  --shadow:    0 4px 12px -2px rgb(15 23 42 / .06);
  --shadow-md: 0 8px 20px -6px rgb(15 23 42 / .08);
  --shadow-lg: 0 12px 28px -12px rgb(124 58 237 / .18);

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-rtl:  'IRANSans', system-ui, 'Segoe UI', Tahoma, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs:   .75rem;
  --text-sm:   .875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-relax:  1.7;

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-extra:    800;

  --sidebar-w: 96px;
  --topbar-h:  64px;
  --container: 1280px;

  --transition-fast: 120ms cubic-bezier(.4, 0, .2, 1);
  --transition:      180ms cubic-bezier(.4, 0, .2, 1);
  --transition-slow: 280ms cubic-bezier(.4, 0, .2, 1);

  --z-sidebar:  20;
  --z-topbar:   30;
  --z-dropdown: 40;
  --z-modal:    60;
  --z-toast:    80;
}

[dir="rtl"] {
  --font-sans: var(--font-rtl);
}

[data-theme="dark"] {
  --bg:           var(--slate-900);
  --surface:      var(--slate-800);
  --surface-alt:  var(--slate-700);
  --border:       var(--slate-700);
  --border-soft:  var(--slate-800);
  --text:         var(--slate-50);
  --text-muted:   var(--slate-400);
  --text-subtle:  var(--slate-500);

  --primary-soft: rgb(124 58 237 / .12);

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3);
  --shadow:    0 4px 12px -2px rgb(0 0 0 / .35);
  --shadow-md: 0 8px 20px -6px rgb(0 0 0 / .45);
  --shadow-lg: 0 12px 28px -12px rgb(124 58 237 / .35);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:           var(--slate-900);
    --surface:      var(--slate-800);
    --surface-alt:  var(--slate-700);
    --border:       var(--slate-700);
    --border-soft:  var(--slate-800);
    --text:         var(--slate-50);
    --text-muted:   var(--slate-400);
    --text-subtle:  var(--slate-500);
    --primary-soft: rgb(124 58 237 / .12);
  }
}
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[dir="rtl"] body { font-family: var(--font-rtl); }

img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
}

img, picture { height: auto; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--primary-hover); }
a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text);
}
h1 { font-size: var(--text-3xl); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

p { margin: 0 0 var(--space-4); }

small { font-size: var(--text-sm); color: var(--text-muted); }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: .92em; }
code {
  padding: .15em .4em;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}
pre {
  padding: var(--space-4);
  background: var(--surface-alt);
  border-radius: var(--radius);
  overflow-x: auto;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

ul, ol { padding-inline-start: var(--space-6); }

input, button, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

::selection {
  background: var(--brand-200);
  color: var(--brand-900);
}

[data-theme="dark"] ::selection {
  background: var(--brand-700);
  color: var(--brand-50);
}

[hidden], .hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 768px) {
  .container { padding-inline: var(--space-6); }
}
@media (min-width: 1024px) {
  .container { padding-inline: var(--space-10); }
}

.text-muted   { color: var(--text-muted); }
.text-subtle  { color: var(--text-subtle); }
.text-success { color: var(--success-700); }
.text-warn    { color: var(--warn-700); }
.text-danger  { color: var(--danger-700); }
.text-center  { text-align: center; }
.text-end     { text-align: end; }
.text-start   { text-align: start; }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: var(--weight-bold); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-medium { font-weight: var(--weight-medium); }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-col { flex-direction: column; }
.flex-1   { flex: 1 1 0; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

[x-cloak] { display: none !important; }

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .bottom-nav,
  .footer,
  .btn,
  .page-header-actions { display: none !important; }
  .content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  body { background: #fff !important; }
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: .625rem 1rem;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
              box-shadow var(--transition-fast), transform var(--transition-fast),
              border-color var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.btn:disabled,
.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: var(--primary-on);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
  color: var(--primary-on);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-500);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-700);
  color: #fff;
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-soft:hover {
  background: var(--brand-100);
  color: var(--primary-hover);
}

.btn-sm { padding: .375rem .75rem; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { padding: .85rem 1.4rem; font-size: var(--text-base); }
.btn-block { width: 100%; }

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-body  { padding: var(--space-6); }
.card-head  {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.card-foot  {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-soft);
  background: var(--surface-alt);
}
.card-title { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.card-hover { transition: transform var(--transition), box-shadow var(--transition); }
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.stat-card .stat-icon {
  width: 2.75rem; height: 2.75rem;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
.stat-card .stat-icon svg { width: 1.4rem; height: 1.4rem; }
.stat-card .stat-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.stat-card .stat-value { font-size: var(--text-2xl); font-weight: var(--weight-bold); margin: var(--space-1) 0 0; line-height: 1.1; }
.stat-card .stat-meta  { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .55rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  background: var(--surface-alt);
  color: var(--text-muted);
  line-height: 1;
}
.badge::before {
  content: '';
  width: .4rem; height: .4rem;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}
.badge-success { background: var(--success-50); color: var(--success-700); }
.badge-warn    { background: var(--warn-50);    color: var(--warn-700); }
.badge-danger  { background: var(--danger-50);  color: var(--danger-700); }
.badge-info    { background: var(--info-50);    color: var(--info-700); }
.badge-brand   { background: var(--brand-50);   color: var(--brand-700); }
.badge-plain   { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.badge-plain::before { display: none; }
.badge-soft    { background: var(--surface-alt); color: var(--text-muted); }
.badge-soft::before { display: none; }

[data-theme="dark"] .badge-success { background: rgb(16 185 129 / .15); color: var(--success-500); }
[data-theme="dark"] .badge-warn    { background: rgb(245 158 11  / .15); color: var(--warn-500); }
[data-theme="dark"] .badge-danger  { background: rgb(239 68  68  / .15); color: var(--danger-500); }
[data-theme="dark"] .badge-info    { background: rgb(59  130 246 / .15); color: var(--info-500); }
[data-theme="dark"] .badge-brand   { background: rgb(124 58  237 / .15); color: var(--brand-300); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-4);
}
.alert-info    { background: var(--info-50);    border-color: rgb(59 130 246 / .25);  color: var(--info-700); }
.alert-success { background: var(--success-50); border-color: rgb(16 185 129 / .25);  color: var(--success-700); }
.alert-warn    { background: var(--warn-50);    border-color: rgb(245 158 11 / .25);  color: var(--warn-700); }
.alert-danger  { background: var(--danger-50);  border-color: rgb(239 68 68  / .25);  color: var(--danger-700); }
.alert h2, .alert h3, .alert h4 { margin: 0 0 var(--space-1); color: inherit; font-size: var(--text-base); }
.alert ul { margin: var(--space-2) 0 0; padding-inline-start: var(--space-5); }

[data-theme="dark"] .alert-info    { background: rgb(59  130 246 / .08); color: #93C5FD; border-color: rgb(59 130 246 / .25); }
[data-theme="dark"] .alert-success { background: rgb(16  185 129 / .08); color: #6EE7B7; border-color: rgb(16 185 129 / .25); }
[data-theme="dark"] .alert-warn    { background: rgb(245 158 11  / .08); color: #FCD34D; border-color: rgb(245 158 11 / .25); }
[data-theme="dark"] .alert-danger  { background: rgb(239 68  68  / .08); color: #FCA5A5; border-color: rgb(239 68 68  / .25); }

.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  margin-bottom: var(--space-2);
}
.form-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}
.form-error {
  font-size: var(--text-xs);
  color: var(--danger-700);
  margin-top: var(--space-1);
}
.form-control,
.form-select {
  display: block;
  width: 100%;
  padding: .625rem .85rem;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--ring);
  outline: none;
}
.form-control::placeholder { color: var(--text-subtle); }
.form-select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(-45deg, transparent 50%, var(--text-muted) 50%);
  background-position: calc(100% - 18px) center, calc(100% - 12px) center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  appearance: none;
  padding-inline-end: 2.25rem;
}
[dir="rtl"] .form-select {
  background-position: 18px center, 12px center;
  padding-inline-end: 2.25rem;
}
textarea.form-control { min-height: 7rem; resize: vertical; }
.form-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
  user-select: none;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 1rem; height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group > .form-control {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}
.input-group-addon {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-inline-start: 0;
  border-start-end-radius: var(--radius);
  border-end-end-radius: var(--radius);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th, .table td {
  padding: var(--space-3) var(--space-4);
  text-align: start;
  vertical-align: middle;
}
.table th {
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.table tbody tr { border-top: 1px solid var(--border-soft); }
.table tbody tr:first-child { border-top: 0; }
.table tbody tr:hover { background: var(--surface-alt); }
.table-actions { text-align: end; white-space: nowrap; }

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

.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + .35rem);
  min-width: 14rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  animation: fade-in var(--transition) ease-out;
}
.dropdown-menu.is-end { inset-inline-start: auto; inset-inline-end: 0; }
[dir="ltr"] .dropdown-menu.is-end { left: auto; right: 0; }
[dir="rtl"] .dropdown-menu.is-end { right: auto; left: 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  background: transparent;
  border: 0;
  text-align: start;
}
.dropdown-item:hover { background: var(--surface-alt); color: var(--text); }
.dropdown-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: var(--weight-semibold); }
.dropdown-item.is-danger:hover { background: var(--danger-50); color: var(--danger-700); }
[data-theme="dark"] .dropdown-item.is-danger:hover { background: rgb(239 68 68 / .15); color: var(--danger-500); }
.dropdown-divider {
  height: 1px;
  background: var(--border-soft);
  margin: var(--space-2) 0;
}
.dropdown-header {
  padding: .55rem .75rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / .55);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head { padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: var(--space-6); }
.modal-foot { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: var(--space-2); }

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}
.tab {
  padding: .65rem 1rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep {
  color: var(--text-subtle);
  margin: 0 var(--space-1);
}
[dir="rtl"] .breadcrumb-sep { transform: scaleX(-1); }

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: center;
  margin: var(--space-6) 0;
}
.pagination .page,
.pagination .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 .65rem;
  font-size: var(--text-sm);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.pagination .page:hover,
.pagination .page-link:hover { background: var(--surface-alt); }
.pagination .page.is-active,
.pagination .page-link.is-active {
  background: var(--primary);
  color: var(--primary-on);
  border-color: var(--primary);
}
.pagination .page.is-disabled,
.pagination .page-link.is-disabled {
  opacity: .5;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}
.empty-state svg.illustration {
  width: 9rem;
  height: 9rem;
  margin: 0 auto var(--space-4);
  opacity: .9;
}
.empty-state h3 { margin: 0 0 var(--space-2); color: var(--text); }
.empty-state p  { margin: 0 auto var(--space-4); max-width: 28rem; }

.skeleton {
  background: linear-gradient(90deg,
    var(--surface-alt) 25%,
    var(--border-soft) 50%,
    var(--surface-alt) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: skeleton-shine 1.4s linear infinite;
}
@keyframes skeleton-shine {
  to { background-position: -200% 0; }
}

.spinner {
  width: 1.25rem; height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner-rotate .8s linear infinite;
  display: inline-block;
}

.toast-container {
  position: fixed;
  top: var(--space-4);
  inset-inline-end: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: var(--z-toast);
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  min-width: 16rem;
  max-width: 24rem;
  animation: fade-in var(--transition) ease-out;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: var(--primary-on);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  flex-shrink: 0;
}
.avatar-lg { width: 3rem; height: 3rem; font-size: var(--text-sm); }
.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 10px; }
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-6) 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: var(--z-sidebar);
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-modal);
  }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / .55);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
  }
  .sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: var(--primary-on);
  font-size: var(--text-lg);
  font-weight: var(--weight-extra);
  text-decoration: none;
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-lg);
}
.sidebar-brand img { width: 1.6rem; height: 1.6rem; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
  padding: 0 var(--space-3);
  flex: 1;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .85rem .5rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  text-align: center;
}
.nav-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav-item.is-active {
  background: var(--primary-soft);
  color: var(--brand-800);
}
[data-theme="dark"] .nav-item.is-active { color: var(--brand-300); }
.nav-item.is-active::before {
  content: '';
  position: absolute;
  top: 25%;
  bottom: 25%;
  inset-inline-start: -12px;
  width: 3px;
  border-radius: 2px;
  background: var(--primary);
}
.nav-item svg { width: 1.5rem; height: 1.5rem; }

.sidebar-foot {
  width: 100%;
  padding: 0 var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
}
@media (min-width: 768px) {
  .topbar { padding: 0 var(--space-6); }
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.topbar-left { flex: 1; min-width: 0; }
.topbar-mobile-toggle {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.topbar-mobile-toggle:hover { background: var(--surface-alt); color: var(--text); }
@media (min-width: 768px) { .topbar-mobile-toggle { display: none; } }

.topbar-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-bold);
  color: var(--text);
  text-decoration: none;
}
.topbar-logo img { height: 28px; width: auto; }
@media (min-width: 768px) { .topbar-logo { display: none; } }

.topbar-search {
  flex: 1;
  max-width: 22rem;
}
@media (max-width: 640px) { .topbar-search { display: none; } }

.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 2px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}
.lang-switch a {
  padding: .35rem .65rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.lang-switch a.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: .35rem .55rem;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.user-menu-trigger:hover { background: var(--surface-alt); }
.user-menu-trigger .name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
@media (max-width: 640px) {
  .user-menu-trigger .name { display: none; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.icon-btn:hover { background: var(--surface-alt); color: var(--primary); }
.icon-btn svg { width: 1.25rem; height: 1.25rem; }
.icon-btn .dot {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: .55rem;
  height: .55rem;
  background: var(--primary);
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.content {
  flex: 1;
  padding: var(--space-6) var(--space-4);
}
@media (min-width: 768px) {
  .content { padding: var(--space-8) var(--space-6); }
}
@media (min-width: 1024px) {
  .content { padding: var(--space-8) var(--space-10); }
}

.content-narrow { max-width: 48rem; margin-inline: auto; }
.content-mid    { max-width: 72rem; margin-inline: auto; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.page-header h1 { margin: 0; }
.page-header .lead {
  color: var(--text-muted);
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.section { margin-bottom: var(--space-8); }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}
.section-title h2 { margin: 0; font-size: var(--text-xl); }
.section-title a { font-size: var(--text-sm); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-1);
  z-index: var(--z-sidebar);
}
.bottom-nav .nav-item {
  font-size: .65rem;
  padding: .45rem .25rem;
}
.bottom-nav .nav-item svg { width: 1.25rem; height: 1.25rem; }
.bottom-nav .nav-item.is-active::before { display: none; }
.bottom-nav .nav-item.is-active { background: var(--primary-soft); color: var(--primary); }
@media (min-width: 768px) {
  .bottom-nav { display: none; }
}
@media (max-width: 768px) {
  .content { padding-bottom: 5rem; }
}

.footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--primary); }

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background:
    radial-gradient(circle at 0% 0%, var(--brand-100) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, var(--brand-200) 0%, transparent 35%),
    var(--bg);
}
[data-theme="dark"] .auth-shell {
  background:
    radial-gradient(circle at 0% 0%, rgb(124 58 237 / .15) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgb(91 33 182 / .18) 0%, transparent 35%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
}
.auth-card .auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}
.auth-card .auth-logo img { max-height: 44px; width: auto; }
.auth-card h1 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-1);
}
.auth-card .auth-sub {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}
.dashboard-hero {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: var(--primary-on);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
}
.dashboard-hero::after {
  content: '';
  position: absolute;
  inset-block-start: -40%;
  inset-inline-end: -10%;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / .15), transparent 65%);
  pointer-events: none;
}
.dashboard-hero h1 { color: var(--primary-on); margin: 0 0 var(--space-2); font-size: var(--text-2xl); }
.dashboard-hero p  { margin: 0; opacity: .9; }

.service-card,
.domain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: transform var(--transition), box-shadow var(--transition);
}
.service-card:hover,
.domain-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.service-card .head,
.domain-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.service-card .title,
.domain-card .title {
  font-weight: var(--weight-semibold);
  color: var(--text);
  font-size: var(--text-base);
}
.service-card .meta,
.domain-card .meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.service-card .footer-row,
.domain-card .footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.invoice-amount {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text);
}
.invoice-status-paid    { color: var(--success-700); }
.invoice-status-unpaid  { color: var(--warn-700); }
.invoice-status-overdue { color: var(--danger-700); }
.invoice-status-cancelled,
.invoice-status-refunded { color: var(--text-muted); }

.ticket-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
}
.ticket-row:hover { background: var(--surface-alt); }
.ticket-row .subject {
  font-weight: var(--weight-medium);
  color: var(--text);
}
.ticket-row .meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); }

.captcha {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}
.captcha img {
  max-height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.kb-search {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--primary-on);
  margin-bottom: var(--space-8);
}
.kb-search h1 { color: var(--primary-on); }
.kb-search .lead { color: rgb(255 255 255 / .85); margin-bottom: var(--space-6); }
.kb-search form {
  max-width: 32rem;
  margin: 0 auto;
  display: flex;
  gap: var(--space-2);
}
.kb-search input.form-control {
  background: rgb(255 255 255 / .15);
  border-color: rgb(255 255 255 / .25);
  color: var(--primary-on);
}
.kb-search input.form-control::placeholder { color: rgb(255 255 255 / .7); }

.cart-summary {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-4));
}
[dir="rtl"] {
  --font-sans: var(--font-rtl);
}

[dir="rtl"] body {
  font-family: var(--font-rtl);
}

[dir="rtl"] .topbar-search input { text-align: right; }

[dir="rtl"] .nav-item.is-active::before {
  inset-inline-start: auto;
  inset-inline-end: -12px;
}

[dir="rtl"] .icon-flip { transform: scaleX(-1); }

[dir="rtl"] .form-control,
[dir="rtl"] .form-select { text-align: right; }

[dir="rtl"] .form-control[type="email"],
[dir="rtl"] .form-control[type="tel"],
[dir="rtl"] .form-control[type="url"],
[dir="rtl"] .form-control[type="number"] { direction: ltr; text-align: right; }

/* === Mobile-first layout helpers === */
.layout-aside {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}
@media (min-width: 1024px) {
  .layout-aside { grid-template-columns: 2fr 1fr; }
}

.layout-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}
@media (min-width: 768px) {
  .layout-split { grid-template-columns: 1fr 1fr; }
}

/* Responsive show/hide */
.hide-sm { display: none; }
.show-sm { display: block; }
@media (min-width: 640px) {
  .hide-sm { display: revert; }
  .show-sm { display: none; }
}
.hide-md { display: none; }
@media (min-width: 768px) {
  .hide-md { display: revert; }
}

/* Filter bar (used on lists like services, domains, invoices) */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
@media (min-width: 640px) {
  .filter-bar { flex-direction: row; align-items: center; }
}
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  overflow-x: auto;
  padding-bottom: var(--space-1);
}
.filter-search { flex: 1; min-width: 0; }
@media (min-width: 640px) {
  .filter-search { max-width: 22rem; margin-inline-start: auto; }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: .4rem .75rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.pill:hover { background: var(--surface-alt); color: var(--text); }
.pill.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--brand-200);
}
[data-theme="dark"] .pill.is-active { border-color: var(--brand-700); }
.pill .count { color: var(--text-subtle); font-weight: var(--weight-normal); font-size: 11px; }
.pill.is-active .count { color: var(--brand-500); }

/* Table footer (page-size + pagination) */
.table-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  align-items: center;
  justify-content: center;
}
@media (min-width: 640px) {
  .table-footer { flex-direction: row; justify-content: space-between; }
}
.table-footer .pagination { margin: 0; }
.form-select-sm,
.form-control-sm {
  padding: .35rem .65rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

/* Sortable column headers */
.table th[data-sort-key] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-inline-end: 1.5em;
  transition: color var(--transition-fast);
}
.table th[data-sort-key]:hover { color: var(--text); }
.table th[data-sort-key]::after {
  content: '';
  position: absolute;
  inset-inline-end: .55em;
  top: 50%;
  width: 0; height: 0;
  margin-top: -2px;
  border-inline: 4px solid transparent;
  border-top: 5px solid var(--text-subtle);
  opacity: .35;
  transition: opacity var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}
.table th[data-sort-key]:hover::after { opacity: .7; }
.table th.is-sorted-asc::after,
.table th.is-sorted-desc::after {
  opacity: 1;
  border-top-color: var(--primary);
}
.table th.is-sorted-asc::after {
  transform: rotate(180deg);
  margin-top: -3px;
}
.table th.is-sorted-asc,
.table th.is-sorted-desc {
  color: var(--primary);
}

/* Clickable row */
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: var(--surface-alt); }

/* Dark-mode select option visibility */
[data-theme="dark"] .form-select option,
[data-theme="dark"] select option {
  background: var(--surface);
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .form-select option,
  :root[data-theme="auto"] select option {
    background: var(--surface);
    color: var(--text);
  }
}
