/* DrMakh — luxury light admin (Persian RTL) */
:root {
  --brand: #278578;
  --brand-dark: #1f6b61;
  --brand-soft: #E8F3F1;
  --selected: #EAF0F6;
  --sidebar-bg: #142335;
  --sidebar-text: #E8EEF5;
  --sidebar-muted: #A3B0C2;
  --sidebar-active: rgba(185, 151, 91, 0.28);
  --sidebar-border: rgba(255, 255, 255, 0.14);
  --sidebar-glass-shadow: -10px 0 36px rgba(16, 28, 42, 0.22);
  --bg: #F5F4F0;
  --panel: #FFFFFF;
  --white: #FFFFFF;
  --text: #182536;
  --muted: #657386;
  --border: #E4E1DA;
  --gold: #B9975B;
  --gold-soft: rgba(185, 151, 91, 0.14);
  --chart-blue: #4278BC;
  --chart-green: #278578;
  --chart-purple: #8270B3;
  --chart-amber: #BE8739;
  --danger: #B54A3F;
  --warn: #BE8739;
  --ok: #278578;
  --shadow: 0 1px 2px rgba(24, 37, 54, 0.04), 0 8px 24px rgba(24, 37, 54, 0.04);
  --radius: 14px;
  --radius-sm: 12px;
  --control-h: 44px;
  --sidebar-w: 260px;
  --bottom-nav-h: 64px;
  --font: "Vazirmatn", Tahoma, sans-serif;
  --focus-ring: 0 0 0 3px rgba(66, 120, 188, 0.22);
  --motion: 160ms ease;
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion: 0ms; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

* { box-sizing: border-box; }

html {
  max-width: 100%;
  overflow-x: hidden;
}

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  max-width: 100%;
  overflow-x: hidden;
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

img, canvas, svg { max-width: 100%; height: auto; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.hidden { display: none !important; }

.row-unread td {
  background: var(--selected);
  font-weight: 500;
}

.data-ltr {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}

/* —— Footer —— */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 0.8rem 0.5rem 0;
  opacity: 0.9;
}

.login-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.main-footer {
  margin-top: auto;
  padding: 1.5rem 0 0.5rem;
  border-top: 1px solid transparent;
}

.sidebar .site-footer {
  padding: 0.75rem 0.25rem 0;
  font-size: 0.72rem;
}

/* —— Login —— */
#login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(185, 151, 91, 0.18), transparent 55%),
    radial-gradient(900px 420px at 0% 100%, rgba(66, 120, 188, 0.12), transparent 50%),
    linear-gradient(165deg, #F7F5F0 0%, #EEF1F5 45%, #F5F4F0 100%);
}

.login-card {
  width: min(400px, 100%);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem 1.25rem;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.brand-title {
  margin: 0;
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--gold);
  text-align: center;
  user-select: none;
}

.brand-title-login {
  font-size: clamp(2.5rem, 9vw, 3.25rem);
}

.brand-title-sidebar {
  flex: 1;
  min-width: 0;
  font-size: clamp(1.6rem, 4vw, 1.95rem);
  text-align: right;
}

.brand-logo {
  display: block;
  object-fit: contain;
  object-position: center;
}

.brand-logo-login {
  width: min(220px, 70vw);
  max-height: 96px;
  margin: 0 auto;
}

.brand-logo-sidebar {
  flex: 1;
  min-width: 0;
  max-width: 160px;
  max-height: 48px;
  object-position: right center;
}

.panel-brand-logo {
  display: block;
  visibility: visible;
  opacity: 1;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius);
  order: -1;
  margin-bottom: 1rem;
}

.brand-logo-badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  background: var(--selected);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 600;
}

.brand-logo-help {
  margin: 0 0 1rem;
  line-height: 1.7;
}

.brand-logo-editor {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-logo-actions {
  flex: 1;
  min-width: 220px;
}

.brand-logo-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.brand-logo-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-danger-outline {
  border: 1px solid rgba(192, 57, 43, 0.35);
  background: var(--white);
  color: var(--danger);
}

.btn-danger-outline:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.profile-logo-preview {
  width: 148px;
  height: 148px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: var(--white);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.brand-logo-status {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
}

.brand-logo-status.hidden { display: none; }

.brand-logo-status.is-info {
  background: var(--selected);
  color: var(--brand-dark);
  border: 1px solid var(--border);
}

.brand-logo-status.is-success {
  background: #e8f7ef;
  color: var(--ok);
  border: 1px solid rgba(31, 122, 76, 0.25);
}

.brand-logo-status.is-error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid rgba(192, 57, 43, 0.25);
}

.profile-logo-preview .brand-title {
  font-size: 1.35rem;
  padding: 0.5rem;
}

.brand-mark p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* —— Fields & buttons —— */
.field { margin-bottom: 1rem; }

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.search-input {
  width: 100%;
  min-height: var(--control-h);
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--control-h);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover { background: #eef4f5; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-danger { background: #fdecea; color: var(--danger); }
.btn-warn { background: #fff8eb; color: var(--warn); }
.btn-ok { background: #e8f7ef; color: var(--ok); }

.btn-block { width: 100%; }

.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.7rem;
  font-size: 0.84rem;
  border-radius: 8px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.is-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
  color: var(--brand);
}

.btn-primary.is-loading::after {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

.error-box {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid rgba(192, 57, 43, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.7;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
}

/* —— Shell —— */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  background: var(--bg);
}

.sidebar-backdrop { display: none; }

.menu-toggle,
.menu-close {
  display: none;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.menu-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.menu-close {
  margin-right: auto;
  width: 36px;
  height: 36px;
  font-size: 1.4rem;
  line-height: 1;
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.sidebar {
  background:
    linear-gradient(165deg, rgba(36, 56, 78, 0.78) 0%, rgba(16, 28, 42, 0.7) 55%, rgba(14, 26, 40, 0.74) 100%);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border-left: 1px solid var(--sidebar-border);
  box-shadow: var(--sidebar-glass-shadow);
  padding: 1rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  color: var(--sidebar-text);
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.15rem 0.1rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .brand-title {
  color: var(--gold);
}

.sidebar .menu-close {
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sidebar .site-footer {
  color: var(--sidebar-muted);
}

.nav {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 0.5rem;
}

.nav-group {
  margin-bottom: 0.75rem;
}

.nav-group-title {
  display: block;
  padding: 0.5rem 0.75rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sidebar-muted);
  letter-spacing: 0.02em;
  text-transform: none;
}

.nav-btn {
  position: relative;
  width: 100%;
  text-align: right;
  background: transparent;
  border: 1px solid transparent;
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.15rem;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 500;
  transition:
    background 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-btn.active {
  background: var(--sidebar-active);
  border-color: rgba(185, 151, 91, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--gold);
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-box {
  padding: 0.75rem 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--sidebar-text);
}

.user-box .btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

.user-box-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-box-meta { min-width: 0; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #dce6e5;
}

img.avatar { display: block; }

.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 1.8rem; }

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  box-sizing: border-box;
  background: var(--selected);
}

.avatar-sm.avatar-fallback { font-size: 0.75rem; }
.avatar-lg.avatar-fallback { font-size: 1rem; }
.avatar-xl.avatar-fallback { font-size: 1.8rem; }

.user-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-avatar-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-avatar-actions { flex: 1; min-width: 200px; }

.profile-avatar-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.profile-avatar-form input[type="file"] {
  max-width: 100%;
}

/* —— Main / topbar —— */
.main {
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

body.has-bottom-nav .main {
  padding-bottom: calc(1rem + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.topbar-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.topbar h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.notif-btn {
  position: relative;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
}

.notif-btn:hover { background: var(--selected); }

.notif-icon {
  color: var(--brand);
  font-size: 0.7rem;
  line-height: 1;
}

.notif-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

@media (min-width: 481px) {
  .notif-icon { display: none; }
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.25rem 0.75rem 0.25rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
}

.account-chip:hover { background: var(--selected); }

.live-clock {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.jalali-dt {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

.jalali-dt select {
  width: 100%;
  min-height: var(--control-h);
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.35rem;
  font-size: 0.88rem;
  outline: none;
}

.jalali-dt select:focus {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.jalali-dt-hint {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.jalali-date-only select { min-width: 4.5rem; }

/* —— Page header —— */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.page-header-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.page-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* —— Filter bar —— */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--selected);
  border-color: rgba(1, 151, 139, 0.35);
  color: var(--brand-dark);
}

.filter-clear {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  min-height: 36px;
}

.filter-clear:hover { color: var(--danger); }

/* —— Empty / loading / error states —— */
.empty-state,
.loading-state,
.error-state {
  text-align: center;
  padding: 2.5rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.empty-state-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.empty-state-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.loading-state { color: var(--muted); }

.error-state {
  background: #fdecea;
  border-color: rgba(192, 57, 43, 0.2);
  color: var(--danger);
}

/* —— Cards & panels —— */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.card,
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow);
}

.card .label,
.stat-card .label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.card .value,
.stat-card .value {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.3rem;
  color: var(--text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stat-card .hint {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.panel h3 {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.toolbar {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
  align-items: center;
}

/* —— Tables —— */
.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 100%;
  background: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th, td {
  text-align: right;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }

tbody tr:hover td {
  background: rgba(239, 249, 249, 0.65);
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #f8fbfb;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.8rem;
}

/* —— Badges —— */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge-pending { background: #fff4d9; color: #8a6d1d; }
.badge-approved { background: #e7f7ee; color: var(--ok); }
.badge-returned { background: #eef2f6; color: #3d5270; }
.badge-voided,
.badge-rejected { background: #fdecea; color: var(--danger); }
.badge-open { background: #ffe8d9; color: #9c4221; }
.badge-closed,
.badge-none { background: #eef2f2; color: #526664; }
.badge-finalized { background: #e7f7ee; color: var(--ok); }
.badge-estimated { background: #fff4d9; color: #8a6d1d; }

.scheme-confirm-effects {
  margin: 0.75rem 0 0;
  padding-inline-start: 1.25rem;
  line-height: 1.7;
  color: var(--text);
}

.scheme-confirm-panel strong {
  font-weight: 700;
}
.badge-paid { background: var(--selected); color: var(--brand-dark); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  vertical-align: middle;
}

.status-dot.is-ok,
.status-dot.ok { background: var(--ok); }
.status-dot.is-warn,
.status-dot.warn { background: var(--warn); }
.status-dot.is-error,
.status-dot.error { background: var(--danger); }
.status-dot.is-brand { background: var(--brand); }

.progress {
  height: 8px;
  background: #e8efee;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
}

/* Inventory row highlights */
.inv-zero td { background: rgba(192, 57, 43, 0.05); }
.inv-low td { background: rgba(183, 121, 31, 0.06); }

/* —— Sales ranking (compact) —— */
.race-panel {
  background: #FFFFFF;
  border: 1px solid #E5ECEE;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(24, 52, 58, 0.04);
  padding: 24px;
  margin-bottom: 1rem;
  overflow: hidden;
  height: auto;
}

.race-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.race-head-main {
  min-width: 0;
  flex: 1 1 12rem;
}

.race-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #18343A;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.race-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #71848A;
  line-height: 1.45;
}

.race-month {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.22rem 0.6rem;
  border-radius: 8px;
  background: #EFF9F9;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid #E5ECEE;
  white-space: nowrap;
}

.race-board {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.race-row {
  display: grid;
  grid-template-columns: 32px 36px minmax(0, 1fr) auto;
  gap: 0.65rem 0.75rem;
  align-items: center;
  min-height: 72px;
  padding: 0.65rem 0.15rem;
  border-bottom: 1px solid #E5ECEE;
  background: transparent;
  cursor: default;
}

.race-row:last-child { border-bottom: none; }

.race-row.place-1 {
  background: #EFF9F9;
  margin-inline: -0.35rem;
  padding-inline: 0.5rem;
  border-radius: 10px;
  border-bottom-color: transparent;
}

.race-row.place-1 + .race-row {
  border-top: none;
}

.race-row.is-me:not(.place-1) {
  background: rgba(1, 151, 139, 0.04);
  margin-inline: -0.35rem;
  padding-inline: 0.5rem;
  border-radius: 10px;
}

.race-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #F3F6F7;
  color: #71848A;
  font-weight: 700;
  font-size: 0.82rem;
  border: 1px solid #E5ECEE;
  flex-shrink: 0;
}

.place-1 .race-rank {
  background: #F8E7A8;
  color: #7A5C10;
  border-color: #E6C75A;
}

.place-2 .race-rank {
  background: #E4EAEE;
  color: #3F4F58;
  border-color: #B7C4CC;
}

.place-3 .race-rank {
  background: #F0D0B4;
  color: #7A4020;
  border-color: #D9A078;
}

.race-avatar,
.avatar.race-avatar {
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.race-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.race-name-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.race-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #18343A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
  line-height: 1.35;
}

.race-you {
  display: inline-flex;
  align-items: center;
  padding: 0.06rem 0.4rem;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.35;
  flex-shrink: 0;
}

.race-branch {
  font-size: 0.75rem;
  color: #71848A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.race-score {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  white-space: nowrap;
  justify-self: end; /* در RTL = سمت چپ ردیف */
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  min-width: 0;
  color: #18343A;
}

.place-1 .race-score-num { color: var(--brand); }

.race-score-num {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #18343A;
}

.race-score-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: #71848A;
}

.race-empty {
  padding: 1.1rem 0.25rem 0.35rem;
  text-align: center;
}

.race-empty p {
  margin: 0 0 0.75rem;
  color: #71848A;
  font-size: 0.9rem;
}

.race-skel .race-skel-block,
.race-skel .race-skel-line {
  background: linear-gradient(90deg, #EEF3F4 25%, #F7FAFA 50%, #EEF3F4 75%);
  background-size: 200% 100%;
  animation: race-skel-pulse 1.2s ease-in-out infinite;
  border-radius: 8px;
}

.race-skel .race-rank,
.race-skel .race-avatar {
  border: none;
}

.race-skel-line {
  height: 10px;
  width: 70%;
}

.race-skel-line-lg { width: 58%; height: 12px; }
.race-skel-line-sm { width: 38%; margin-top: 0.35rem; }
.race-skel-line-score { width: 3.2rem; height: 1.1rem; }

@keyframes race-skel-pulse {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 640px) {
  .race-panel { padding: 16px; }

  .race-head {
    flex-direction: column;
    align-items: stretch;
  }

  .race-month {
    align-self: flex-start;
  }

  .race-row {
    grid-template-columns: 28px 32px minmax(0, 1fr) auto;
    gap: 0.5rem 0.55rem;
    min-height: 64px;
    padding: 0.55rem 0;
  }

  .race-rank {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .race-avatar,
  .avatar.race-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .race-name { font-size: 0.875rem; }
  .race-score-num { font-size: 1.2rem; }
}

/* —— Daily sales —— */
.daily-filter { margin-top: 0.5rem; }

.seller-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 36px;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  font-size: 0.86rem;
}

.check-pill:has(input:checked) {
  border-color: rgba(1, 151, 139, 0.4);
  background: var(--selected);
  color: var(--brand-dark);
}

.check-pill input { accent-color: var(--brand); }

.daily-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  margin-bottom: 0.8rem;
}

.daily-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
}

.daily-legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.daily-legend-item em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.76rem;
}

.daily-chart-wrap {
  overflow-x: auto;
  padding-bottom: 0.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  min-height: 210px;
  padding: 0.9rem 0.75rem 0.55rem;
  min-width: max-content;
}

.daily-col {
  width: var(--group-w, 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.daily-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 165px;
  width: 100%;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}

.daily-bar {
  border-radius: 6px 6px 2px 2px;
  min-height: 2px;
}

.daily-day-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
}

/* —— Forms / grids —— */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.item-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.65rem;
  background: var(--bg);
}

/* —— Sale form (seller-friendly) —— */
.sale-form-page {
  padding-bottom: 5.5rem;
  max-width: 100%;
  overflow-x: hidden;
}

.sale-form-panel {
  background: #FFFFFF;
  border: 1px solid #E5ECEE;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(24, 52, 58, 0.04);
}

.sale-branch-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #EFF9F9;
  color: #18343A;
  font-size: 0.86rem;
  border: 1px solid #E5ECEE;
}

.sale-seller-banner {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #EFF9F9;
  border: 1px solid #E5ECEE;
  color: #18343A;
  font-size: 0.92rem;
}

.sale-seller-fixed {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: #F5FAFB;
  border: 1px solid #E5ECEE;
  color: #18343A;
  font-weight: 600;
}

.sale-line-sellers {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.55rem;
}

.sale-shared-box {
  margin-bottom: 0.9rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #F5FAFB;
  border: 1px solid #E5ECEE;
}

.sale-shared-inline {
  margin-bottom: 0;
}

.sale-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  font-weight: 600;
  color: #18343A;
  cursor: pointer;
}

.sale-check input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--brand);
}

.sale-line {
  border: 1px solid #E5ECEE;
  border-radius: 14px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  background: #FFFFFF;
}

.sale-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.sale-line-head strong {
  color: #18343A;
  font-size: 0.92rem;
}

.sale-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.sale-chip {
  min-height: 44px;
  min-width: 44px;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #E5ECEE;
  background: #F5FAFB;
  color: #18343A;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.sale-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.sale-qty-row {
  margin-top: 0.55rem;
}

.sale-qty-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.sale-qty-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #E5ECEE;
  background: #EFF9F9;
  color: var(--brand);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}

.sale-qty-input {
  width: 4.2rem;
  height: 44px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid #E5ECEE;
  font-weight: 700;
  color: #18343A;
}

.sale-stock {
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

.sale-line-summary {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.sale-suggest {
  margin-top: 0.35rem;
  border: 1px solid #E5ECEE;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}

.sale-suggest-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-bottom: 1px solid #E5ECEE;
  background: #fff;
  text-align: right;
  cursor: pointer;
  color: #18343A;
}

.sale-suggest-item:last-child { border-bottom: 0; }
.sale-suggest-item:hover,
.sale-suggest-item:focus-visible { background: #EFF9F9; }
.sale-suggest-item strong { font-size: 0.9rem; }
.sale-suggest-item span { font-size: 0.8rem; color: #71848A; }
.sale-suggest-empty { padding: 0.7rem; color: #71848A; font-size: 0.86rem; }

.sale-add-btn {
  width: 100%;
  min-height: 44px;
  border-style: dashed;
}

.sale-collapse-toggle {
  width: 100%;
  min-height: 44px;
  text-align: right;
  border: 1px solid #E5ECEE;
  background: #F5FAFB;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  color: #18343A;
  cursor: pointer;
}

.sale-collapse { margin-top: 0.75rem; }

.sale-sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 28;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding:
    0.65rem 0.85rem
    calc(0.65rem + env(safe-area-inset-bottom, 0));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #E5ECEE;
  box-shadow: 0 -4px 16px rgba(24, 52, 58, 0.06);
  backdrop-filter: none;
}

body.has-bottom-nav .sale-sticky-bar {
  bottom: var(--bottom-nav-h);
  padding-bottom: 0.65rem;
}

body.sale-form-active.has-bottom-nav .sale-form-page {
  padding-bottom: calc(5.5rem + var(--bottom-nav-h));
}

.sale-sticky-total {
  color: #18343A;
  font-size: 0.9rem;
  white-space: nowrap;
}

.sale-sticky-total strong {
  color: var(--brand);
  font-size: 1.1rem;
}

.sale-sticky-submit {
  min-height: 44px;
  flex: 1 1 auto;
  max-width: 16rem;
}

.sale-sticky-bar.is-away {
  transform: translateY(110%);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.sale-form-spacer { height: 0.5rem; }

body.sale-modal-open {
  overflow: hidden;
}

.sale-success-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(24, 52, 58, 0.42);
  animation: sale-fade-in 0.24s ease;
}

.sale-success-modal {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 18px;
  border: 1px solid #E5ECEE;
  padding: 1.15rem 1.1rem 1rem;
  box-shadow: 0 12px 40px rgba(24, 52, 58, 0.16);
  position: relative;
  outline: none;
  animation: sale-pop-in 0.28s ease;
}

.sale-success-close {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  color: #71848A;
  cursor: pointer;
  border-radius: 10px;
}

.sale-sticker {
  display: grid;
  place-items: center;
  margin: 0.2rem auto 0.55rem;
}

.sale-sticker-svg {
  animation: sale-sticker-pop 0.35s ease both;
}

.sale-success-modal h3 {
  margin: 0 0 0.4rem;
  text-align: center;
  color: #18343A;
  font-size: 1.15rem;
}

.sale-success-msg,
.sale-success-status {
  text-align: center;
  color: #71848A;
  font-size: 0.9rem;
  margin: 0 0 0.45rem;
  line-height: 1.6;
}

.sale-success-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 0.85rem 0 1rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: #F5FAFB;
  border: 1px solid #E5ECEE;
}

.sale-success-summary > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.sale-success-summary strong {
  color: #18343A;
  font-size: 0.95rem;
}

.sale-success-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sale-success-actions .btn {
  min-height: 44px;
  width: 100%;
}

@keyframes sale-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sale-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sale-sticker-pop {
  0% { transform: scale(0.86); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .sale-success-backdrop,
  .sale-success-modal,
  .sale-sticker-svg,
  .target-celeb {
    animation: none !important;
  }
}

.target-celeb {
  position: fixed;
  inset-inline: 0;
  top: 1rem;
  z-index: 70;
  display: grid;
  place-items: center;
  pointer-events: none;
  animation: sale-pop-in 0.28s ease;
}

.target-celeb-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 28px rgba(1, 151, 139, 0.28);
  text-align: center;
  min-width: min(280px, 90vw);
}

.target-celeb-card strong { font-size: 1.05rem; }
.target-celeb-card span { font-size: 0.88rem; opacity: 0.95; }

@media (max-width: 640px) {
  .sale-sticky-bar {
    flex-wrap: wrap;
  }
  .sale-sticky-submit {
    max-width: none;
    width: 100%;
  }
  .sale-success-summary {
    grid-template-columns: 1fr;
  }
}

.form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.form-section-desc {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.65;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.field-error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--danger);
}

.req-mark {
  color: var(--danger);
  font-weight: 700;
  margin-inline-start: 0.15rem;
}

.tier-editor {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tier-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
  align-items: end;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

.actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* —— Shortcuts / targets —— */
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.shortcut-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.25rem;
  min-height: 72px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: right;
  cursor: pointer;
}

.shortcut-btn:hover {
  background: var(--selected);
  border-color: rgba(1, 151, 139, 0.35);
  color: var(--brand-dark);
}

.target-hero {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.target-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

/* —— Mobile card list —— */
.mobile-card-list {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
}

.mobile-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.mobile-card-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.mobile-card-meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.mobile-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

/* —— Toast / modal —— */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  background: #1a2423;
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  z-index: 50;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 2rem);
}

body.has-bottom-nav .toast {
  bottom: calc(var(--bottom-nav-h) + 0.75rem + env(safe-area-inset-bottom, 0));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 35, 33, 0.4);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 1rem;
}

.modal {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--white);
  border-radius: 16px;
  padding: 1.15rem;
  border: 1px solid var(--border);
}

.modal h3 { margin-top: 0; }

/* —— Bottom navigation (mobile) —— */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding:
    0.35rem 0.5rem
    calc(0.35rem + env(safe-area-inset-bottom, 0));
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 0.15rem;
  align-items: end;
  box-shadow: 0 -1px 0 rgba(26, 36, 35, 0.03);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 44px;
  padding: 0.35rem 0.25rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  text-decoration: none;
}

.bottom-nav-item:hover {
  color: var(--brand-dark);
  background: var(--selected);
}

.bottom-nav-item.active {
  color: var(--brand-dark);
  font-weight: 700;
  background: var(--selected);
}

.bottom-nav-item.is-primary {
  position: relative;
  top: -10px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(1, 151, 139, 0.25);
}

.bottom-nav-item.is-primary:hover,
.bottom-nav-item.is-primary.active {
  background: var(--brand-dark);
  color: #fff;
}

/* —— Responsive —— */
@media (min-width: 901px) {
  .sidebar {
    border-radius: 0 0 0 0;
    border-left: 1px solid var(--sidebar-border);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.04) inset,
      8px 0 28px rgba(16, 28, 42, 0.08);
  }
  .sidebar .site-footer { display: none; }
  .menu-toggle,
  .menu-close,
  .sidebar-backdrop { display: none !important; }
  .bottom-nav { display: none !important; }
}

@media (max-width: 1280px) {
  .main { padding: 1.15rem 1.25rem 1rem; }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .menu-toggle { display: inline-flex; }
  .menu-close { display: inline-grid; place-items: center; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(14, 24, 36, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 35;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.28s ease;
  }

  .sidebar-backdrop[hidden] { display: none !important; }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 86vw);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 40;
    border-left: 1px solid var(--sidebar-border);
    border-bottom: none;
    border-radius: 18px 0 0 18px;
    box-shadow:
      -12px 0 40px rgba(12, 22, 34, 0.28),
      inset 1px 0 0 rgba(255, 255, 255, 0.08);
    transform: translateX(108%);
    transition:
      transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 0.34s ease;
    will-change: transform;
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0));
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0));
  }

  body.menu-open .sidebar {
    transform: translateX(0);
    box-shadow:
      -16px 0 48px rgba(12, 22, 34, 0.34),
      inset 1px 0 0 rgba(255, 255, 255, 0.1);
  }
  body.menu-open { overflow: hidden; }

  .sidebar-bottom { display: block; }
  .sidebar-bottom .user-box { margin: 0; }
  .sidebar .site-footer { padding-top: 0.7rem; }

  .main {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 100dvh;
    padding: 0.85rem 0.85rem calc(1rem + env(safe-area-inset-bottom, 0));
    overflow-x: hidden;
  }

  body.has-bottom-nav .main {
    padding-bottom: calc(1rem + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
  }

  body.has-bottom-nav .bottom-nav {
    display: grid;
  }

  #page-root {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .main-footer {
    display: block;
    margin-top: 1.5rem;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    background: var(--bg);
    margin: -0.85rem -0.85rem 0.9rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  .topbar-start {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar h2,
  .page-header-title {
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .live-clock {
    font-size: 0.74rem;
    padding: 0.35rem 0.65rem;
    max-width: 100%;
    flex: 1 1 100%;
    text-align: center;
    white-space: normal;
  }

  .nav {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow: auto;
    flex: 1;
    min-height: 0;
  }

  .nav-btn {
    white-space: normal;
    width: 100%;
    text-align: right;
    padding: 0.75rem 0.8rem;
    min-height: 44px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .card,
  .stat-card {
    padding: 0.85rem;
    min-width: 0;
  }

  .card .value,
  .stat-card .value {
    font-size: 1.15rem;
    word-break: break-word;
  }

  .panel {
    padding: 0.9rem;
    max-width: 100%;
    min-width: 0;
  }

  .grid-2,
  .grid-3 { grid-template-columns: 1fr; }

  .toolbar { width: 100%; }

  .toolbar .search-input,
  .toolbar input:not([type="checkbox"]):not([type="radio"]),
  .toolbar select {
    flex: 1 1 100%;
    max-width: 100% !important;
    width: 100%;
    min-width: 0;
  }

  .toolbar .btn,
  .actions .btn { min-height: 44px; }

  .jalali-dt { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jalali-date-only { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .jalali-date-only select { min-width: 0; }

  .item-row { padding: 0.65rem; }
  .seller-checkboxes { gap: 0.35rem; }
  .check-pill { max-width: 100%; }
  .daily-chart-wrap { max-width: 100%; }

  .mobile-card-list { display: flex; }

  .toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.9rem + env(safe-area-inset-bottom, 0));
    transform: none;
    width: auto;
    text-align: center;
  }

  body.has-bottom-nav .toast {
    bottom: calc(var(--bottom-nav-h) + 0.65rem + env(safe-area-inset-bottom, 0));
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
  }

  table { min-width: 480px; }

  th, td {
    padding: 0.55rem 0.5rem;
    font-size: 0.82rem;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-actions { width: 100%; }

  .page-header-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .filter-bar { padding: 0.65rem; }

  .shortcut-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .target-hero-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tier-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
  .login-card {
    padding: 1.5rem 1.1rem 1rem;
    width: 100%;
  }
  .brand-title-login { font-size: 2.35rem; }
  .brand-title-sidebar { font-size: 1.5rem; }
  #login-view { padding: 1rem; }
  .main {
    padding: 0.7rem 0.7rem calc(1rem + env(safe-area-inset-bottom, 0));
  }
  body.has-bottom-nav .main {
    padding-bottom: calc(0.85rem + var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
  }
  .topbar {
    margin: -0.7rem -0.7rem 0.8rem;
    padding: 0.65rem 0.7rem;
  }
  .panel { padding: 0.75rem; }
  .btn { padding: 0.7rem 0.9rem; }
  .profile-avatar-box {
    flex-direction: column;
    align-items: flex-start;
  }
  .profile-avatar-form { width: 100%; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .target-hero-grid { grid-template-columns: 1fr; }
  .notif-label { display: none; }
  .live-clock {
    flex: 1 1 100%;
    order: 5;
    text-align: center;
  }
  .account-chip span:not(.avatar) {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .topbar-chip { font-size: 0.74rem; padding: 0.2rem 0.55rem; }
  .bottom-nav-item { font-size: 0.64rem; }
  .filter-chip { font-size: 0.78rem; }
}

@media (max-width: 360px) {
  .main { padding-inline: 0.6rem; }
  .card .value,
  .stat-card .value { font-size: 1.05rem; }
  .nav-btn { font-size: 0.86rem; }
}

@media (min-width: 1440px) {
  .main {
    padding: 1.5rem 2rem 1.25rem;
  }
  .app-shell {
    grid-template-columns: 268px 1fr;
  }
}

@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top, 0);
  }
}

/* —— Desktop/mobile table swap —— */
.mobile-only { display: none; }
@media (max-width: 768px) {
  .table-desktop { display: none; }
  .mobile-only { display: block; }
  .mobile-only.mobile-card-list { display: flex; }
}

/* —— Excel import steps (visual only) —— */
.excel-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.1rem;
}
.excel-step {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

/* —— Warehouse module —— */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.stat-card {
  background: var(--brand-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
}
.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-top: 0.2rem;
}
.warn-text {
  color: var(--warn);
  font-weight: 600;
}
.mobile-friendly .grid-2 {
  gap: 0.75rem;
}
@media (max-width: 768px) {
  .mobile-friendly input,
  .mobile-friendly select,
  .mobile-friendly button {
    min-height: 44px;
  }
}

/* —— Warranty module —— */
.wr-panel { max-width: 920px; }
.wr-accept { max-width: 420px; }
.wr-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.wr-step {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}
.wr-step span { display: block; font-weight: 600; color: var(--text); margin-top: 0.15rem; }
.wr-step.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.wr-step.done { opacity: 0.85; }
.wr-shoe-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin: 0.75rem 0;
  background: var(--panel);
}
.wr-shoe-title { font-weight: 600; margin-bottom: 0.55rem; color: var(--brand-dark); }
.wr-chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0.7rem; }
.wr-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  min-height: 44px;
  cursor: pointer;
}
.wr-chip.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.wr-model-hits { display: grid; gap: 0.25rem; margin-top: 0.35rem; }
.wr-hit {
  text-align: right;
  border: 1px solid var(--border);
  background: var(--brand-soft);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}
.wr-media-list { display: grid; gap: 0.6rem; margin-top: 0.75rem; }
.wr-media-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}
.wr-media-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}
.wr-voice-pill {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  border-radius: 8px;
  color: var(--brand-dark);
  font-weight: 600;
}
.wr-tracking {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: 0.03em;
}
.wr-success-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--brand-soft);
  border: 1px solid var(--border);
}
.wr-case-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.wr-loc { color: var(--text); margin: 0.75rem 0; }
.wr-action-list { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.75rem; }
.wr-act-box {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
  margin-top: 0.5rem;
}
.wr-check { display: flex; align-items: center; gap: 0.4rem; margin: 0.5rem 0; }
.wr-timeline { display: grid; gap: 0.85rem; }
.wr-tl-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 0.65rem;
  position: relative;
}
.wr-tl-item.done .wr-tl-dot {
  background: var(--brand);
}
.wr-tl-dot {
  width: 12px;
  height: 12px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--border);
}
.wr-tl-title { font-weight: 600; }
.wr-att {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  margin-bottom: 0.55rem;
}
.wr-att-img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
}
.wr-badge {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid rgba(1, 151, 139, 0.25);
}
.badge-ok {
  background: #e8f7ef;
  color: var(--ok);
}
.badge-danger {
  background: #fdecea;
  color: var(--danger);
}
.wr-queue-bar { flex-wrap: wrap; }
@media (max-width: 420px) {
  .wr-accept { max-width: 100%; }
  .wr-steps { grid-template-columns: 1fr; }
  .wr-media-item { grid-template-columns: 1fr; }
}

/* نقش‌ها و دسترسی‌ها */
.rbac-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}
.rbac-tabs .tab-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-family: inherit;
}
.rbac-tabs .tab-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.rbac-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: #fafcfb;
}
.rbac-group summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.rbac-group summary::-webkit-details-marker { display: none; }
.rbac-perm-list { margin-top: 0.65rem; }
.rbac-perm-row {
  display: grid;
  gap: 0.4rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
}
.rbac-perm-row.is-sensitive {
  background: rgba(1, 151, 139, 0.04);
  border-radius: 8px;
  padding: 0.55rem;
}
.rbac-perm-check {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
}
.rbac-branch-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
}
.rbac-branch-pick.hidden { display: none; }
.rbac-hint { font-size: 0.8rem; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: var(--brand-soft, #e6f5f3);
  color: var(--brand-dark, #016960);
}
.is-muted { opacity: 0.65; }
.muted { color: var(--muted); font-size: 0.85rem; }

/* —— Dashboard luxury —— */
.dash-page { display: flex; flex-direction: column; gap: 1rem; }
.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}
.dash-toolbar-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.dash-scope-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.dash-scope-sub { color: var(--muted); font-size: 0.88rem; }
.dash-range-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.dash-pill {
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion), color var(--motion);
}
.dash-pill:hover { border-color: #c9c4b8; }
.dash-pill.active {
  background: var(--sidebar-bg);
  border-color: var(--sidebar-bg);
  color: #fff;
}
.dash-toolbar-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.dash-inline-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.dash-inline-field select {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.3rem 0.55rem;
  background: var(--white);
  color: var(--text);
  font-family: inherit;
}
.dash-custom-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.dash-custom-dates.hidden { display: none; }
.dash-custom-dates label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.dash-custom-dates input[type="date"] {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.25rem 0.45rem;
  font-family: inherit;
}
.dash-updated {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.dash-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: -0.35rem;
}
.dash-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.55rem;
}
.dash-tab {
  min-height: 38px;
  padding: 0.35rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: background var(--motion), color var(--motion);
}
.dash-tab:hover { background: var(--selected); color: var(--text); }
.dash-tab.active {
  background: var(--selected);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--gold);
}
.dash-kpi-grid,
.dash-mini-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}
.dash-kpi {
  text-align: right;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: transform var(--motion), border-color var(--motion), box-shadow var(--motion);
}
.dash-kpi:hover {
  border-color: #d2cdc3;
  transform: translateY(-1px);
}
.dash-kpi.is-static { cursor: default; }
.dash-kpi.is-static:hover { transform: none; }
.dash-kpi-title {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.dash-kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.dash-kpi-unit {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-right: 0.25rem;
}
.dash-kpi-cmp {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.dash-kpi-cmp.is-up { color: var(--ok); }
.dash-kpi-cmp.is-down { color: var(--danger); }
.dash-kpi-cmp.is-snap {
  color: var(--chart-blue);
  background: rgba(66, 120, 188, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}
.dash-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}
.dash-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}
.dash-panel {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dash-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.dash-panel-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.dash-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #7a6235;
  font-size: 0.72rem;
  font-weight: 700;
}
.dash-svg { width: 100%; height: auto; display: block; }
.dash-chart-label {
  fill: var(--muted);
  font-size: 10px;
  font-family: var(--font);
}
.dash-bars { display: flex; flex-direction: column; gap: 0.55rem; }
.dash-bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 28%) 1fr auto;
  gap: 0.55rem;
  align-items: center;
}
.dash-bar-label {
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-bar-track {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.dash-bar-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
  transition: width var(--motion);
}
.dash-bar-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  min-width: 2.2rem;
  text-align: left;
}
.dash-status-dist { display: flex; flex-direction: column; gap: 0.55rem; }
.dash-status-row {
  display: grid;
  grid-template-columns: auto 1fr auto minmax(80px, 1.4fr);
  gap: 0.45rem;
  align-items: center;
}
.dash-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dash-status-label { font-size: 0.84rem; }
.dash-status-num { font-size: 0.84rem; font-weight: 700; }
.dash-donut-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.dash-donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 28px var(--white);
}
.dash-donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.84rem;
}
.dash-donut-legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.dash-donut-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dash-donut-legend em {
  color: var(--muted);
  font-style: normal;
  margin-right: auto;
}
.dash-progress {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.65rem 0;
}
.dash-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--chart-green), var(--chart-blue));
  border-radius: 999px;
}
.dash-target-pct {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.dash-target-empty {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.dash-empty {
  padding: 1.25rem 0.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.dash-note { margin: 0.25rem 0 0.5rem; }
.dash-skel { pointer-events: none; opacity: 0.7; }

button.card.card-click {
  display: block;
  width: 100%;
  text-align: inherit;
  cursor: pointer;
  font: inherit;
  color: inherit;
  appearance: none;
}
button.card.card-click:hover {
  border-color: rgba(66, 120, 188, 0.35);
  box-shadow: var(--shadow);
}
button.card.card-click:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.dash-stocktake { margin-top: 0.75rem; }

.page-header-title { letter-spacing: -0.01em; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.breadcrumb span[aria-hidden="true"] { opacity: 0.5; }

.field-error {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--danger);
}
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: rgba(181, 74, 63, 0.55);
}

.state-box {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  background: var(--white);
}
.state-box.is-error { border-color: rgba(181, 74, 63, 0.35); }
.state-box.is-denied { border-style: solid; background: #faf8f4; }

.rbac-tabs .tab-btn.active {
  background: var(--sidebar-bg);
  border-color: var(--sidebar-bg);
}

.dash-kpi-cmp.is-warn { color: var(--danger); }
.dash-kpi.is-alert {
  border-color: rgba(181, 74, 63, 0.35);
  box-shadow: 0 0 0 1px rgba(181, 74, 63, 0.08);
}
.dash-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  vertical-align: middle;
  cursor: help;
}
.dash-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.dash-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.dash-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dash-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.dash-action {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  min-height: 52px;
  text-align: right;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm, 12px);
  border: 1px solid var(--border);
  background: var(--white);
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color var(--motion), transform var(--motion);
}
.dash-action:hover {
  transform: translateY(-1px);
  border-color: #d2cdc3;
}
.dash-action.is-urgent {
  border-color: rgba(181, 74, 63, 0.45);
  background: #fff8f7;
}
.dash-action.is-high.tone-amber {
  border-color: rgba(190, 135, 57, 0.4);
  background: #fffaf3;
}
.dash-action.tone-green {
  border-color: rgba(39, 133, 120, 0.35);
  background: #f3faf8;
}
.dash-action.tone-purple {
  border-color: rgba(130, 112, 179, 0.35);
  background: #f7f5fb;
}
.dash-action.tone-rose.is-high,
.dash-action.tone-rose {
  border-color: rgba(181, 74, 63, 0.3);
}
.dash-action-title {
  font-weight: 700;
  font-size: 0.92rem;
}
.dash-action-wait {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.dash-action-count {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: left;
}
.dash-action-count span {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.dash-action-go {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--chart-blue, #4278BC);
  min-width: 3.2rem;
}
.dash-gaps {
  margin: 0.65rem 0 0;
  padding-right: 1.1rem;
  color: var(--muted);
  font-size: 0.84rem;
}
.dash-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dash-bar-row.is-click {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.dash-compare-note {
  width: 100%;
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}
.dash-filter-toggle {
  display: none;
}
.dash-chip.is-warn {
  background: rgba(181, 74, 63, 0.12);
  color: #8f3a32;
}
button.linkish {
  border: none;
  background: none;
  color: var(--chart-blue, #4278BC);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  min-height: 44px;
}

@media (max-width: 960px) {
  .dash-grid-2,
  .dash-grid-3 { grid-template-columns: 1fr; }
  .dash-action {
    grid-template-columns: 1fr auto;
  }
  .dash-action-go { grid-column: 2; grid-row: 1; }
}
@media (max-width: 640px) {
  .dash-filter-toggle {
    display: inline-flex;
    min-height: 44px;
  }
  .dash-toolbar-side {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .dash-toolbar-side.is-open { display: flex; }
  .dash-range-pills {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .dash-pill {
    min-height: 44px;
    flex: 0 0 auto;
  }
  .dash-kpi-grid,
  .dash-mini-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-bar-row { grid-template-columns: 1fr auto; }
  .dash-bar-label { grid-column: 1 / -1; }
  .dash-status-row { grid-template-columns: auto 1fr auto; }
  .dash-status-track { grid-column: 1 / -1; }
  .dash-page {
    overflow-x: hidden;
  }
}
@media (max-width: 380px) {
  .dash-kpi-grid,
  .dash-mini-kpis {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-kpi,
  .dash-action,
  .dash-tab,
  .dash-bar-track span,
  .dash-progress span {
    transition: none !important;
  }
}
