/* ============================================
   سامانه مشاور املاک — Design System (RTL)
   رنگ‌ها از theme.css می‌آیند
   ============================================ */
@import url('theme.css');

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* ---------- Scrollbars (سیستم) ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
*::-webkit-scrollbar {
  width: var(--scroll-size);
  height: var(--scroll-size);
}
*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #67e8f9, var(--brand) 45%, var(--brand-dark));
  border-radius: 999px;
  border: 2px solid var(--scroll-track);
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--brand-mid), var(--scroll-thumb-hover));
  border: 2px solid var(--scroll-track);
}
*::-webkit-scrollbar-thumb:active {
  background: var(--scroll-thumb-active);
  border: 2px solid var(--scroll-track);
}
*::-webkit-scrollbar-corner { background: transparent; }

.app-sidebar,
.app-sidebar * {
  scrollbar-color: rgba(94, 234, 212, .45) rgba(255, 255, 255, .06);
}
.app-sidebar::-webkit-scrollbar-track,
.app-sidebar *::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .06);
}
.app-sidebar::-webkit-scrollbar-thumb,
.app-sidebar *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(94, 234, 212, .75), rgba(14, 116, 144, .9));
  border: 2px solid transparent;
  background-clip: padding-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: .925rem;
  line-height: 1.7;
  color: var(--ink-soft);
  text-align: right;
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, var(--bg-glow-1), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, var(--bg-glow-2), transparent),
    linear-gradient(180deg, #f4f7fa 0%, var(--bg) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Tooltips (سیستم) ---------- */
[data-tooltip] { cursor: default; }
a[data-tooltip], button[data-tooltip], .btn[data-tooltip],
.btn-icon[data-tooltip], label[data-tooltip], summary[data-tooltip] {
  cursor: pointer;
}
.ui-tooltip {
  position: fixed;
  z-index: 10050;
  max-width: min(260px, calc(100vw - 24px));
  padding: .48rem .72rem;
  border-radius: var(--tooltip-radius);
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  border: 1px solid var(--tooltip-border);
  box-shadow: var(--tooltip-shadow);
  font-family: var(--font);
  font-size: var(--tooltip-fs);
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
  letter-spacing: .01em;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(.96);
  transition: opacity .16s ease, transform .16s cubic-bezier(.2, .9, .2, 1);
  backdrop-filter: blur(8px);
  -webkit-font-smoothing: antialiased;
}
.ui-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.ui-tooltip[data-placement="bottom"] {
  transform: translateY(-6px) scale(.96);
}
.ui-tooltip[data-placement="bottom"].is-visible {
  transform: translateY(0) scale(1);
}
.ui-tooltip::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: #0f3d4d;
  border: 1px solid var(--tooltip-border);
  border-top-color: transparent;
  border-inline-start-color: transparent;
  transform: rotate(45deg);
}
.ui-tooltip[data-placement="top"]::after {
  bottom: -5px;
  left: 50%;
  margin-left: -4px;
}
.ui-tooltip[data-placement="bottom"]::after {
  top: -5px;
  left: 50%;
  margin-left: -4px;
  transform: rotate(225deg);
}
.ui-tooltip.is-danger {
  background: linear-gradient(145deg, #7f1d1d, #991b1b 55%, #450a0a);
  border-color: rgba(252, 165, 165, .45);
}
.ui-tooltip.is-danger::after { background: #7f1d1d; }
.ui-tooltip.is-success {
  background: linear-gradient(145deg, #065f46, #047857 55%, #064e3b);
  border-color: rgba(110, 231, 183, .45);
}
.ui-tooltip.is-success::after { background: #065f46; }

@media (prefers-reduced-motion: reduce) {
  .ui-tooltip { transition: none; }
}

h1, h2, h3, h4, h5, h6,
.panel-title, .form-section, .topbar-title,
.page-hero h1, .stat-label, label, .form-label {
  text-align: right;
}

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

img { max-width: 100%; }

/* ---------- Sidebar ---------- */
.app-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 55%, #071f28 100%);
  color: #fff;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 32px rgba(7, 31, 40, .28);
}

.app-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(20, 184, 166, .18), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(180, 83, 9, .12), transparent 35%);
  pointer-events: none;
}

.sidebar-brand {
  position: relative;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  margin-left: .75rem;
  box-shadow: 0 8px 20px var(--brand-glow);
}

.sidebar-brand .brand-text {
  display: inline-block;
  vertical-align: middle;
}

.sidebar-brand .brand-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.sidebar-brand .brand-sub {
  display: block;
  font-size: .72rem;
  opacity: .65;
  margin-top: 2px;
}

.sidebar-nav {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 1rem .85rem 1.5rem;
}

.nav-section {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
  padding: .75rem .85rem .4rem;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .72rem .9rem;
  margin-bottom: .2rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.78) !important;
  font-weight: 500;
  font-size: .9rem;
  transition: all var(--transition);
  border: 1px solid transparent;
  position: relative;
}

.nav-link i {
  width: 22px;
  text-align: center;
  font-size: .95rem;
  opacity: .85;
}

.nav-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff !important;
  transform: translateX(-2px);
}

.nav-link.active {
  background: rgba(20, 184, 166, .22);
  color: #fff !important;
  border-color: rgba(20, 184, 166, .35);
  box-shadow: inset 3px 0 0 var(--primary-mid);
}

.nav-link.logout {
  margin-top: 1rem;
  color: #fca5a5 !important;
}

.nav-link.logout:hover {
  background: rgba(220, 38, 38, .15);
  color: #fecaca !important;
}

.sidebar-footer {
  position: relative;
  padding: 1rem 1.15rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .72rem;
  line-height: 1.55;
  color: rgba(255,255,255,.55);
}

/* ---------- Main ---------- */
.app-main {
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

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

.pwa-install-modal { text-align: center; max-width: 380px; }
.pwa-install-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto .85rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0b2e3a, #14708a);
  color: #f4d78a;
  font-size: 1.5rem;
}
.pwa-install-modal h3 { margin: 0 0 .5rem; font-size: 1.15rem; }
.pwa-install-modal p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.7;
}

.notify-wrap { position: relative; }
.notify-bell {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.notify-bell:hover { color: var(--primary); border-color: rgba(11, 46, 58, .25); }
.notify-badge {
  position: absolute;
  top: -3px;
  left: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #c2410c;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.notify-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(340px, 86vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
  z-index: 80;
  overflow: hidden;
}
.notify-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.notify-list {
  max-height: 360px;
  overflow: auto;
}
.notify-item {
  display: block;
  padding: .75rem .9rem;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background .15s ease;
}
.notify-item:hover { background: #f8fafc; }
.notify-item.is-unread { background: #f0f9ff; }
.notify-item strong {
  display: block;
  font-size: .86rem;
  margin-bottom: .15rem;
}
.notify-item span {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.55;
}
.notify-item small {
  display: block;
  margin-top: .3rem;
  font-size: .7rem;
  color: var(--muted);
}
.notify-empty {
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.settings-session-info {
  padding: .7rem .85rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: .85rem;
}
.settings-pwa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

@media (max-width: 640px) {
  .pwa-install-btn span { display: none; }
  .pwa-install-btn { width: 38px; height: 38px; justify-content: center; padding: 0; }
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: .35rem .75rem .35rem .4rem;
  border-radius: 999px;
  font-size: .82rem;
  color: var(--ink-soft);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}

.app-content {
  padding: 1.5rem;
  flex: 1;
}

/* ---------- Cards ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.panel.panel-overflow-visible,
.panel-overflow-visible {
  overflow: visible;
}
.panel-body-overflow {
  overflow: visible;
}
.field-card.field-card-select,
.field-card:has(.cs-wrap) {
  overflow: visible;
  position: relative;
  z-index: 1;
}
.field-card:has(.cs-wrap.is-open) {
  z-index: 80;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--surface-2));
}

.panel-header h2,
.panel-header .panel-title {
  margin: 0;
  font-size: .98rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.panel-header .panel-title i { color: var(--primary); }

.panel-body { padding: 1.25rem; }
.panel-body.flush { padding: 0; }

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 4.5rem 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.danger::after { background: var(--danger); }
.stat-card.info::after { background: var(--info); }

.stat-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .35rem;
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.03em;
  line-height: 1.2;
}

.stat-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-card.success .stat-icon { background: var(--success-soft); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat-card.info .stat-icon { background: var(--info-soft); color: var(--info); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font);
  font-weight: 600;
  border-radius: var(--radius-xs);
  padding: .55rem 1.05rem;
  font-size: .875rem;
  line-height: 1.4;
  border: 1px solid transparent;
  transition: all .22s cubic-bezier(.34,1.2,.64,1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  cursor: pointer;
  box-shadow: none !important;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
  transform: translateX(120%);
  transition: transform .45s ease;
  pointer-events: none;
}

.btn:hover::after { transform: translateX(-120%); }

.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(15, 118, 110, .2) !important; }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn:active { transform: scale(.97); }

.btn-sm { padding: .38rem .7rem; font-size: .8rem; border-radius: 7px; }
.btn-lg { padding: .75rem 1.4rem; font-size: .95rem; }
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #2dd4bf, #0f766e);
  border-color: #0f766e;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(15,118,110,.28) !important;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #14b8a6, #0d5f59);
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15,118,110,.35) !important;
}

.btn-success {
  background: linear-gradient(135deg, #34d399, #059669);
  border-color: #059669;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(5,150,105,.25) !important;
}
.btn-success:hover { background: linear-gradient(135deg, #10b981, #047857); color: #fff !important; transform: translateY(-2px); }

.btn-danger {
  background: linear-gradient(135deg, #f87171, #dc2626);
  border-color: #dc2626;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(220,38,38,.22) !important;
}
.btn-danger:hover { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff !important; transform: translateY(-2px); }

.btn-warning {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border-color: #d97706;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(217,119,6,.22) !important;
}
.btn-warning:hover { transform: translateY(-2px); color: #fff !important; }

.btn-info {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border-color: #0284c7;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(2,132,199,.22) !important;
}
.btn-info:hover { transform: translateY(-2px); color: #fff !important; }

.btn-outline-primary {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary) !important;
}
.btn-outline-primary:hover {
  background: var(--primary-soft);
  color: var(--primary-dark) !important;
  transform: translateY(-2px);
}

.btn-outline-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-soft) !important;
}
.btn-outline-secondary:hover {
  background: var(--surface-2);
  border-color: var(--muted);
  transform: translateY(-2px);
}

.btn-outline-info {
  background: transparent;
  border-color: #7dd3fc;
  color: var(--info) !important;
}
.btn-outline-info:hover { background: var(--info-soft); transform: translateY(-2px); }

.btn-outline-danger {
  background: transparent;
  border-color: #fca5a5;
  color: var(--danger) !important;
}
.btn-outline-danger:hover { background: var(--danger-soft); transform: translateY(-2px); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted) !important;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink) !important; }

.data-table tbody tr:nth-child(even) td { background: #f3f6f5; }
.data-table tbody tr:nth-child(odd) td { background: #fff; }
.data-table tbody tr:hover td { background: #e6f7f4 !important; }

/* Wizard */
.wizard-steps,
.wizard-track {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1.75rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: .35rem .15rem 1rem;
}
.wizard-step {
  flex: 0 0 auto;
  min-width: 118px;
  padding: .85rem 1rem;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  text-align: center;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  position: relative;
  cursor: pointer;
  transition: transform .25s ease, border-color .25s ease, background .25s ease, box-shadow .25s ease, color .25s ease;
}
.wizard-step .wiz-label { display: inline-block; }
.wizard-step .num {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #64748b;
  font-size: .75rem;
  margin-left: .4rem;
  transition: transform .25s ease, background .25s ease, color .25s ease, box-shadow .25s ease;
}
.wizard-step:hover {
  transform: translateY(-3px);
  border-color: var(--primary-mid);
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(15,118,110,.14);
}
.wizard-step:hover .num {
  background: var(--primary-soft);
  color: var(--primary-dark);
  transform: scale(1.08);
}
.wizard-step.active {
  border-color: var(--primary-mid);
  background: linear-gradient(135deg, var(--primary-soft), #fff);
  color: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(15,118,110,.16);
  transform: translateY(-2px);
}
.wizard-step.active .num {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(20,184,166,.18);
  animation: wizPulse 1.6s ease-in-out infinite;
}
.wizard-step.done {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: var(--primary);
}
.wizard-step.done .num { background: var(--success); color: #fff; animation: none; }
.wizard-connector {
  flex: 1 1 36px;
  min-width: 28px;
  max-width: 90px;
  height: 2px;
  margin: 0 .35rem;
  position: relative;
  align-self: center;
}
.wizard-connector span {
  display: block;
  height: 2px;
  width: 100%;
  background-image: radial-gradient(circle, #94a3b8 1.4px, transparent 1.6px);
  background-size: 8px 2px;
  background-repeat: repeat-x;
  background-position: center;
  opacity: .7;
  transition: opacity .3s ease, filter .3s ease;
}
.wizard-connector.is-done span {
  background-image: radial-gradient(circle, var(--primary) 1.4px, transparent 1.6px);
  opacity: 1;
  animation: wizDash 1.2s linear infinite;
}
@keyframes wizDash {
  from { background-position: 0 center; }
  to { background-position: 16px center; }
}
@keyframes wizPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(20,184,166,.16); }
  50% { box-shadow: 0 0 0 8px rgba(20,184,166,.08); }
}
.wizard-pane { display: none; animation: toastIn .3s ease; }
.wizard-pane.active { display: block; }
.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.field-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem;
  height: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.field-card:focus-within {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(20,184,166,.12);
  background: #fff;
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .65rem;
}
.choice-card {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: .85rem .6rem;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: all .2s ease;
  user-select: none;
}
.choice-card:hover { border-color: var(--primary-mid); transform: translateY(-2px); }
.choice-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(15,118,110,.12);
}
.choice-card i { display: block; font-size: 1.25rem; margin-bottom: .4rem; color: var(--primary); }
.choice-card input { display: none; }
.assign-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.assign-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .75rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: .82rem;
  transition: all .2s;
}
.assign-chip:hover, .assign-chip:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.assign-chip input { accent-color: var(--primary); }

.btn-menu {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  display: none;
  align-items: center;
  justify-content: center;
}

/* ---------- Forms ---------- */
.form-label,
label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .4rem;
}

.form-control,
.form-select,
select.form-control,
textarea.form-control,
input.form-control {
  font-family: var(--font);
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-xs);
  padding: .65rem .9rem;
  font-size: .9rem;
  color: var(--ink-soft);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  height: auto;
}

.form-control-sm,
select.form-control-sm,
input.form-control-sm {
  padding: .45rem .7rem;
  font-size: .84rem;
  border-radius: 8px;
}

.form-control:hover,
select.form-control:hover { border-color: var(--line-strong); }

.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .18);
  background: #fff;
}

select.form-control,
select.form-control-sm {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4.6L6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left .9rem center;
  padding-left: 2.2rem;
  cursor: pointer;
}

textarea.form-control { min-height: 96px; resize: vertical; }

.form-section {
  margin: 1.5rem 0 1rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--primary);
  font-size: .92rem;
  font-weight: 700;
}

.form-section i {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
}

.form-hint { font-size: .75rem; color: var(--muted); margin-top: .3rem; }

.required { color: var(--danger); }

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 0 .35rem .45rem 0;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  font-size: .82rem;
}

.checkbox-chip:hover { border-color: var(--primary-mid); background: var(--primary-soft); }
.checkbox-chip input { margin: 0; accent-color: var(--primary); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: 1.15rem;
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  align-items: center;
}

.filter-bar .filter-field { flex: 1; min-width: 140px; }
.filter-bar .filter-field.grow { flex: 2 1 220px; }
.filter-bar .filter-actions { display: flex; gap: .4rem; flex-shrink: 0; align-items: flex-end; }
.filter-bar .filter-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .3rem;
}
.filter-bar-responsive .filter-field,
.filter-bar-responsive .filter-actions {
  display: flex;
  flex-direction: column;
}
.filter-bar-responsive .filter-actions .btn { white-space: nowrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
}

.data-table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: .02em;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink-soft);
  background: var(--surface);
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover td { background: #f0fdfa; }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table a { font-weight: 600; }
.code-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: .15rem .45rem;
  border-radius: 6px;
  color: var(--ink);
  direction: ltr;
  display: inline-block;
}

.row-actions {
  display: inline-flex;
  gap: .3rem;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}

.empty-state i {
  font-size: 2.2rem;
  margin-bottom: .75rem;
  display: block;
  color: var(--line-strong);
}

/* ---------- Badges ---------- */
.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .28em .65em;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.3;
  border: 1px solid transparent;
}

.badge-soft.primary { background: var(--primary-soft); color: var(--primary-dark); border-color: #99f6e4; }
.badge-soft.success { background: var(--success-soft); color: #047857; border-color: #a7f3d0; }
.badge-soft.warning { background: var(--warning-soft); color: #b45309; border-color: #fde68a; }
.badge-soft.danger { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }
.badge-soft.info { background: var(--info-soft); color: #0369a1; border-color: #bae6fd; }
.badge-soft.neutral { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* ---------- Alerts / Toast ---------- */
.alert {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .85rem 1.1rem;
  font-size: .88rem;
  display: flex;
  align-items: flex-start;
  gap: .65rem;
}

.alert-success { background: var(--success-soft); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-info { background: var(--info-soft); border-color: #bae6fd; color: #075985; }

.toast-stack {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  max-width: 360px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: .9rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  animation: toastIn .28s ease;
  font-size: .88rem;
}

.toast-item.success { border-right: 4px solid var(--success); }
.toast-item.error { border-right: 4px solid var(--danger); }
.toast-item.info { border-right: 4px solid var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- Progress ---------- */
.progress-modern {
  height: 7px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-modern .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-mid), var(--primary));
  border-radius: 999px;
  transition: width .5s ease;
}

.progress-modern .bar.success { background: linear-gradient(90deg, #34d399, var(--success)); }
.progress-modern .bar.info { background: linear-gradient(90deg, #38bdf8, var(--info)); }

.pipeline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
  font-size: .88rem;
}

/* ---------- Pagination ---------- */
.pagination-modern {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .35rem;
  padding: 1rem;
  margin: 0;
  list-style: none;
}

.pagination-modern a,
.pagination-modern span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 .65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: .85rem;
  font-weight: 600;
  transition: all var(--transition);
}

.pagination-modern a:hover {
  border-color: var(--primary-mid);
  color: var(--primary);
  background: var(--primary-soft);
}

.pagination-modern .active span,
.pagination-modern .active a {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

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

.page-hero h1 {
  margin: 0 0 .35rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.02em;
}

.page-hero .meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.page-hero .actions { display: flex; gap: .45rem; flex-wrap: wrap; }

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

.detail-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: .75rem .9rem;
}

.detail-item .lbl {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: .2rem;
}

.detail-item .val {
  font-weight: 700;
  color: var(--ink);
  font-size: .92rem;
}

.price-box {
  text-align: center;
  padding: 1.5rem 1rem;
}

.price-box .amount {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.02em;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: .85rem 1.1rem .85rem 1rem;
  border-bottom: 1px solid var(--line);
  padding-right: 1.75rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  right: .7rem;
  top: 1.15rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-mid);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.timeline li:last-child { border-bottom: none; }

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .85rem 1.15rem;
  border-bottom: 1px solid var(--line);
  gap: .75rem;
}

.leaderboard-item:last-child { border-bottom: none; }

.rank-medal {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  margin-left: .5rem;
}

.rank-medal.gold { background: #fef3c7; color: #b45309; }
.rank-medal.silver { background: #f1f5f9; color: #64748b; }
.rank-medal.bronze { background: #ffedd5; color: #9a3412; }

.commission-preview {
  background: linear-gradient(135deg, #f0fdfa, #ecfeff);
  border: 1px dashed #99f6e4;
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  display: none;
}

.commission-preview.show { display: block; animation: toastIn .25s ease; }

.commission-preview .preview-label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}

.commission-preview .preview-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 40, 38, .45);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.show { display: flex; animation: toastIn .2s ease; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  border: 1px solid var(--line);
}

.modal-box.modal-box-lg {
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
}

.status-cell {
  min-width: 9.5rem;
}

.status-ajax-select {
  min-width: 8.5rem;
  font-size: .78rem !important;
  font-weight: 600;
  cursor: pointer;
}

.status-ajax-select--hero {
  min-width: 10rem;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.28);
  color: #fff;
}

.status-ajax-select--hero option {
  color: #111;
  background: #fff;
}

.ps-status-wrap { display: inline-flex; align-items: center; }

.ps-contract-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ps-contract-list li {
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
}

.ps-contract-list li:last-child { border-bottom: 0; }

.ps-contract-main {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  margin-bottom: .45rem;
}

.ps-contract-code {
  font-weight: 700;
  color: var(--primary);
}

.ps-contract-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  font-size: .82rem;
  color: var(--ink-soft);
}

.ps-contract-meta strong { color: var(--ink); font-weight: 600; }

.modal-box h3 {
  margin: 0 0 .5rem;
  font-size: 1.1rem;
  color: var(--ink);
}

.modal-box p {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: .9rem;
}

.modal-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-start;
}

/* ---------- Loading ---------- */
.ajax-loading {
  position: relative;
  pointer-events: none;
  opacity: .65;
}

.ajax-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.35);
  border-radius: inherit;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(15,118,110,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

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

.overlay-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1035;
}

.overlay-backdrop.show { display: block; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 70% 60% at 80% 10%, rgba(20, 184, 166, .25), transparent),
    radial-gradient(ellipse 50% 40% at 10% 90%, rgba(180, 83, 9, .12), transparent),
    linear-gradient(160deg, #0b3d3a 0%, #134e4a 40%, #0f766e 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,.96);
  border-radius: 20px;
  padding: 2.25rem 2rem;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.4);
  animation: toastIn .4s ease;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-brand .logo {
  width: 64px;
  height: 64px;
  margin: 0 auto .9rem;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary-mid), var(--primary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 12px 28px rgba(15, 118, 110, .35);
}

.login-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
}

.login-brand p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.login-card .btn-primary {
  width: 100%;
  padding: .8rem;
  font-size: .95rem;
  margin-top: .5rem;
}

.money-input,
.digit-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.text-muted { color: var(--muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.fw-bold { font-weight: 700 !important; }
.gap-2 { gap: .5rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.grid-sidebar {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 992px) {
  .grid-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(105%);
    transition: transform .3s ease;
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin-right: 0; }
  .btn-menu { display: inline-flex; }
  .stat-grid { grid-template-columns: 1fr; }
  .app-content { padding: 1rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .filter-field,
  .filter-bar .filter-field.grow { min-width: 100%; flex: 1 1 100%; }
  .filter-bar .filter-actions {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: stretch;
  }
  .filter-bar .filter-actions .btn { flex: 1; min-width: 120px; }
  .filter-bar-responsive { padding: .85rem; }
  .match-table-wrap { margin: 0 -.25rem; }
  .match-table thead { display: none; }
  .match-table,
  .match-table tbody,
  .match-table tr,
  .match-table td { display: block; width: 100%; }
  .match-table tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .85rem .95rem;
    margin-bottom: .75rem;
    box-shadow: 0 2px 10px rgba(15,23,42,.04);
  }
  .match-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
    padding: .35rem 0;
    border: 0 !important;
    text-align: left;
  }
  .match-table td::before {
    content: attr(data-label);
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
    text-align: right;
  }
  .match-table td[data-label=""] { justify-content: flex-end; }
  .match-table td[data-label=""]::before { content: none; }
  .match-table .d-none { display: none !important; }
  .page-hero { flex-direction: column; align-items: stretch; }
  .page-hero .actions { width: 100%; display: flex; flex-wrap: wrap; gap: .45rem; }
  .page-hero .actions .btn { flex: 1; min-width: 120px; }
  .wizard-track { flex-wrap: wrap; }
  .wizard-step { min-width: 0; text-align: right; }
  .wizard-nav { flex-direction: column-reverse; }
  .wizard-nav > div { width: 100%; display: flex; flex-wrap: wrap; gap: .5rem; }
  .wizard-nav .btn { flex: 1; min-width: 120px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 1.15rem 4.5rem 1.15rem 1.2rem; }
  .stat-icon { right: 1rem; left: auto; }
  .app-content { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .bulk-bar { bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}

/* ---------- Custom Select ---------- */
select.form-control,
select.form-control-sm {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--select-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='%230e7490' d='M1.2.8L7 6.6 12.8.8 14 2 7 9 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  padding-left: 2.4rem !important;
  border: 1.5px solid var(--select-border);
  border-radius: var(--select-radius);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
select.form-control:hover,
select.form-control-sm:hover {
  border-color: var(--brand-mid);
  background-color: #fff;
}
select.form-control:focus,
select.form-control-sm:focus {
  border-color: var(--select-active);
  box-shadow: 0 0 0 4px var(--brand-glow);
  outline: none;
}

.cs-wrap { position: relative; width: 100%; z-index: 2; }
.cs-wrap.is-open { z-index: 120; }
.cs-wrap.is-open .cs-trigger {
  border-color: var(--select-active);
  box-shadow: 0 0 0 4px var(--brand-glow);
}
.cs-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  text-align: right;
  background: var(--select-bg);
  border: 1.5px solid var(--select-border);
  border-radius: var(--select-radius);
  padding: .65rem .95rem;
  font-family: var(--font);
  font-size: .9rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .2s;
}
.cs-trigger:hover { border-color: var(--brand-mid); background: #fff; }
.cs-trigger .cs-arrow {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand);
  transition: transform .2s;
  flex-shrink: 0;
}
.cs-wrap.is-open .cs-arrow { transform: rotate(180deg); }
.cs-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0; left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--select-radius);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
  max-height: 260px;
  overflow-y: auto;
  display: none;
  padding: .35rem;
  animation: toastIn .18s ease;
}
.cs-wrap.is-open .cs-menu { display: block; }
.cs-menu.cs-menu-fixed {
  position: fixed;
  z-index: 5000;
}
.cs-option {
  display: block;
  width: 100%;
  text-align: right;
  border: none;
  background: transparent;
  padding: .65rem .8rem;
  border-radius: 8px;
  font-family: var(--font);
  font-size: .88rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s;
}
.cs-option:hover { background: var(--select-hover); color: var(--brand-dark); }
.cs-option.active {
  background: linear-gradient(135deg, var(--brand-soft), #e0f2fe);
  color: var(--brand-dark);
  font-weight: 700;
}

/* ---------- Mobile radial FAB menu ---------- */
.fab-menu {
  --fab-size: 3.15rem;
  --fab-radius: 5.6rem;
  --n: 8;
  display: none;
  place-content: center;
  position: fixed;
  bottom: calc(.95rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1300;
  width: var(--fab-size);
  height: var(--fab-size);
  pointer-events: none;
}
.fab-menu > * { grid-area: 1 / 1; }
.fab-menu .fab-menu-toggle { pointer-events: auto; }
.fab-menu-toggle {
  position: relative;
  z-index: 2;
  width: var(--fab-size);
  height: var(--fab-size);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  box-shadow: 0 10px 28px rgba(15, 118, 110, .42);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  transition: transform .25s ease, box-shadow .25s ease;
}
.fab-menu-toggle:focus-visible {
  outline: 2px dashed #f472b6;
  outline-offset: 3px;
}
.fab-plus {
  display: grid;
  place-items: center;
  transition: transform .3s ease;
}
.fab-menu.is-open .fab-plus,
.fab-menu:has(:popover-open) .fab-plus {
  transform: rotate(45deg);
}
.fab-menu.is-open .fab-menu-toggle,
.fab-menu:has(:popover-open) .fab-menu-toggle {
  box-shadow: 0 12px 32px rgba(15, 118, 110, .5);
}

.fab-menu-items {
  list-style: none;
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
  width: var(--fab-size);
  height: var(--fab-size);
  display: grid;
  place-content: center;
  position: relative;
  --fab-radius: clamp(5.2rem, calc(4.4rem + var(--n) * .14rem), 7rem);
  pointer-events: none;
}
.fab-menu-items > * { grid-area: 1 / 1; }

.fab-item {
  --den: max(1, calc(var(--n) - 1));
  --t: calc(var(--i) / var(--den));
  /* قوس بالای دکمه + : از چپ‌بالا تا راست‌بالا */
  --angle: calc(210deg + (var(--t) * 120deg));
  --delay: calc(var(--i) * .045s);
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(0, 0) scale(.55) rotate(40deg);
  transition:
    transform .32s var(--delay) cubic-bezier(.2, .9, .2, 1),
    opacity .25s var(--delay) ease;
  z-index: 1;
}

/* حالت باز — آیتم‌ها بالای دکمه + */
.fab-menu.is-open .fab-item,
.fab-menu-items.fab-open .fab-item {
  opacity: 1;
  pointer-events: auto;
  transform: translate(
    calc(cos(var(--angle)) * var(--fab-radius)),
    calc(sin(var(--angle)) * var(--fab-radius))
  ) scale(1) rotate(0deg);
}
.fab-menu.is-open .fab-menu-items {
  pointer-events: none;
}
.fab-menu.is-open .fab-item a {
  pointer-events: auto;
}

/* fallback برای مرورگرهای بدون cos()/sin() — ردیف بالای دکمه + */
@supports not (transform: translate(calc(cos(0deg) * 1px), 0)) {
  .fab-menu.is-open .fab-item,
  .fab-menu-items.fab-open .fab-item {
    transform: none;
    opacity: 1;
    pointer-events: auto;
    position: relative;
  }
  .fab-menu.is-open {
    width: min(92vw, 20rem);
    height: auto;
    display: flex !important;
    flex-direction: column-reverse;
    align-items: center;
    gap: .65rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    padding: .65rem;
    background: rgba(15, 40, 38, .5);
    backdrop-filter: blur(10px);
    border-radius: 22px;
    pointer-events: auto;
  }
  .fab-menu.is-open .fab-menu-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .55rem;
    width: 100%;
    height: auto;
  }
}
.fab-item a {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: #134e4a !important;
  background: hsl(calc(165 + var(--i) * 14), 55%, 88%);
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .16);
  font-size: 1.05rem;
  transition: transform .15s ease, background .15s ease;
}
.fab-item a:active { transform: scale(.94); }
.fab-item.is-active a {
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff !important;
}
.fab-item.is-danger a {
  background: #fee2e2;
  color: #b91c1c !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;
}

/* hide legacy bottom nav if residual markup exists */
.mobile-nav { display: none !important; }

/* نمایش منوی شعاعی فقط موبایل/تبلت — باید بعد از display:none باشد */
@media (max-width: 992px) {
  .fab-menu {
    display: grid !important;
  }
}
@media (min-width: 993px) {
  .fab-menu {
    display: none !important;
  }
}

/* ---------- Bulk assign bar ---------- */
.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 1200;
  background: linear-gradient(135deg, #0b2e3a, #0e7490);
  color: #fff;
  border-radius: 999px;
  padding: .65rem .75rem .65rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: 0 16px 40px rgba(11, 46, 58, .35);
  transition: transform .3s cubic-bezier(.34,1.2,.64,1);
  max-width: calc(100vw - 24px);
}
.bulk-bar.show { transform: translateX(-50%) translateY(0); }
.bulk-bar .bulk-count {
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
}
.bulk-bar .btn { white-space: nowrap; }
.check-col { width: 42px; text-align: center; }
.check-col input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

/* ---------- Edit page polish ---------- */
.edit-hero {
  background: linear-gradient(135deg, #0b2e3a 0%, #0e7490 55%, #06b6d4 100%);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  color: #fff;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.edit-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 90% 20%, rgba(255,255,255,.16), transparent 40%),
    linear-gradient(90deg, transparent, rgba(255,255,255,.04));
  pointer-events: none;
}
.edit-hero h1 {
  margin: 0 0 .35rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  position: relative;
}
.edit-hero .meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}
.edit-hero .code-pill {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.22);
  color: #fff;
}
.edit-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.edit-tabs {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.edit-tab {
  text-align: right;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: .8rem 1rem;
  font-family: var(--font);
  font-weight: 600;
  font-size: .86rem;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.edit-tab i {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  color: var(--brand);
  font-size: .8rem;
}
.edit-tab:hover { border-color: var(--brand-mid); color: var(--brand-dark); transform: translateX(-2px); }
.edit-tab.active {
  background: linear-gradient(135deg, var(--brand-soft), #e0f2fe);
  border-color: #a5f3fc;
  color: var(--brand-dark);
  box-shadow: 0 8px 20px var(--brand-glow);
}
.edit-pane { display: none; }
.edit-pane.active { display: block; animation: toastIn .25s ease; }
.edit-actions {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 992px) {
  .edit-layout { grid-template-columns: 1fr; }
  .edit-tabs {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: .25rem;
  }
  .edit-tab { white-space: nowrap; flex-shrink: 0; }
}

/* Bootstrap overrides for consistency */
.card { border: none; background: transparent; box-shadow: none; }
.badge { font-weight: 700; }
.table { margin-bottom: 0; }
.close { opacity: .6; }
.close:hover { opacity: 1; }

/* ---------- Amenities / Media / Deed ---------- */
.amenities-box {
  border: 1px dashed var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.55);
}
.amenities-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.amenities-toggle .chev { transition: transform .2s ease; opacity: .7; }
.amenities-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.amenities-panel { padding: 0 1rem 1rem; }
.amenity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .55rem;
}
.amenity-chip {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem .8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  margin: 0;
  font-size: .86rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.amenity-chip input { margin: 0; }
.amenity-chip i { color: var(--brand-mid); width: 1.1rem; text-align: center; }
.amenity-chip:has(input:checked),
.amenity-chip.readonly {
  border-color: rgba(15, 118, 110, .35);
  background: linear-gradient(135deg, rgba(20,184,166,.08), #fff);
  box-shadow: 0 4px 14px rgba(15,118,110,.08);
}
.amenity-chip.readonly { cursor: default; }

.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.media-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f172a;
  aspect-ratio: 4/3;
}
.media-card img,
.media-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-card .media-del {
  position: absolute;
  top: .4rem;
  left: .4rem;
  margin: 0;
}
.video-wrap { position: relative; width: 100%; height: 100%; }
.video-wrap .wm-overlay {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(15, 118, 110, .35);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .25rem .55rem;
  border-radius: 8px;
  pointer-events: none;
  opacity: .55;
  letter-spacing: .02em;
}

.commission-result .result-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.commission-result .result-card span { color: var(--muted); font-size: .8rem; }
.commission-result .result-card strong { font-size: 1.05rem; color: var(--ink); }
.commission-result .result-card.highlight {
  background: linear-gradient(135deg, rgba(20,184,166,.1), #fff);
  border-color: rgba(15,118,110,.25);
}

.deed-sheet {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 2rem 2.25rem;
  color: #1f2937;
  line-height: 2;
}
.deed-header { text-align: center; margin-bottom: 1.5rem; border-bottom: 2px solid #0f766e; padding-bottom: 1rem; }
.deed-header h1 { font-size: 1.35rem; margin: 0 0 .35rem; }
.deed-header p { margin: 0; color: #64748b; }
.deed-sheet h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; color: #0f766e; }
.deed-signs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2.5rem;
  text-align: center;
}
.deed-signs div {
  border-top: 1px dashed #94a3b8;
  padding-top: 2.5rem;
  font-size: .9rem;
}

@media print {
  .app-sidebar, .app-topbar, .mobile-nav, .fab-menu, .wizard-nav, .no-print,
  .panel-header .btn, .filter-bar, .edit-tabs { display: none !important; }
  .app-main { margin: 0 !important; }
  .deed-sheet { border: 0; box-shadow: none; }
}

@media (max-width: 768px) {
  .deed-signs { grid-template-columns: 1fr; }
  .amenity-grid { grid-template-columns: 1fr; }
  .wizard-track { padding-bottom: .5rem; }
  .wizard-step { min-width: 100px; padding: .7rem .65rem; }
  .wizard-connector { min-width: 18px; }
}

/* Input affix (% / تومان) */
.input-affix {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.input-affix .form-control {
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0;
}
.input-affix .affix-badge {
  min-width: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-soft), #e0f2fe);
  color: var(--primary-dark);
  font-weight: 800;
  border-right: 1px solid var(--line);
  padding: 0 .75rem;
}

.rent-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed rgba(15,118,110,.35);
  border-radius: 16px;
  background:
    radial-gradient(circle at 20% 20%, rgba(20,184,166,.08), transparent 45%),
    linear-gradient(180deg, #f8fffd, #fff);
  padding: 1rem;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.upload-zone.is-drag {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(20,184,166,.12);
  transform: scale(1.01);
}
.upload-zone-inner {
  text-align: center;
  padding: 1.25rem 1rem;
  cursor: pointer;
}
.upload-zone-inner .upload-icon {
  width: 64px; height: 64px;
  margin: 0 auto .75rem;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 10px 24px rgba(15,118,110,.22);
}
.upload-zone-inner strong { display: block; margin-bottom: .25rem; color: var(--ink); }
.upload-zone-inner span { color: var(--muted); font-size: .85rem; }
.upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .65rem;
  margin-top: .75rem;
}
.upload-previews:empty { display: none; }
.upload-thumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f172a;
  aspect-ratio: 1;
}
.upload-thumb img,
.upload-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.upload-thumb .thumb-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  color: #fff; font-size: .68rem; padding: .55rem .45rem .35rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-thumb .thumb-remove {
  position: absolute; top: .35rem; left: .35rem;
  width: 26px; height: 26px; border: 0; border-radius: 8px;
  background: rgba(185,28,28,.92); color: #fff; cursor: pointer;
}

.custom-features-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
  margin-bottom: 1rem;
}
.custom-feature-add {
  display: flex;
  gap: .55rem;
  margin-bottom: .75rem;
}
.custom-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.custom-feature-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid rgba(15,118,110,.2);
  border-radius: 999px;
  padding: .35rem .7rem;
  font-size: .82rem;
  font-weight: 600;
}
.custom-feature-chip button {
  border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; line-height: 1;
}

/* ========== Property Show — Unique dossier layout ========== */
.ps-page {
  --ps-gap: 1rem;
  display: flex;
  flex-direction: column;
  gap: var(--ps-gap);
  animation: toastIn .35s ease;
}
.ps-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .9fr);
  gap: 1rem;
  background:
    radial-gradient(ellipse 80% 60% at 0% 0%, rgba(6,182,212,.14), transparent 55%),
    linear-gradient(160deg, #0b2e3a 0%, #0f4c5c 45%, #134e5e 100%);
  border-radius: 22px;
  padding: 1rem;
  color: #fff;
  box-shadow: 0 20px 50px rgba(11, 46, 58, .28);
  overflow: hidden;
  position: relative;
}
.ps-hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(234,88,12,.22), transparent 70%);
  pointer-events: none;
}
.ps-hero-media { position: relative; z-index: 1; }
.ps-hero-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.12);
}
.ps-hero-frame img,
.ps-hero-frame video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.ps-hero-empty {
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.02)),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.04) 0 8px, transparent 8px 16px);
}
.ps-empty-visual {
  text-align: center; color: rgba(255,255,255,.75);
}
.ps-empty-visual i { font-size: 2.4rem; display: block; margin-bottom: .5rem; opacity: .85; }
.ps-thumbs {
  display: flex; gap: .45rem; margin-top: .65rem;
  overflow-x: auto; padding-bottom: .2rem;
}
.ps-thumb {
  flex: 0 0 68px; width: 68px; height: 52px;
  border-radius: 10px; overflow: hidden; border: 2px solid transparent;
  padding: 0; background: rgba(0,0,0,.25); cursor: pointer; position: relative;
  transition: transform .2s, border-color .2s;
}
.ps-thumb img, .ps-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-thumb:hover { transform: translateY(-2px); }
.ps-thumb.active { border-color: #67e8f9; box-shadow: 0 0 0 2px rgba(103,232,249,.25); }
.ps-thumb-play {
  position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .65rem; text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

.ps-hero-side {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: .75rem;
  padding: .35rem .25rem .25rem;
}
.ps-kicker { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.ps-kicker .code-pill {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-color: rgba(255,255,255,.2);
}
.ps-kicker .badge-soft {
  border-color: rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
}
.ps-kicker .badge-soft.success { background: rgba(16,185,129,.25); color: #d1fae5; }
.ps-kicker .badge-soft.warning { background: rgba(245,158,11,.28); color: #fef3c7; }
.ps-kicker .badge-soft.info { background: rgba(59,130,246,.28); color: #dbeafe; }
.ps-kicker .badge-soft.primary { background: rgba(6,182,212,.28); color: #cffafe; }
.ps-kicker .badge-soft.danger { background: rgba(239,68,68,.28); color: #fee2e2; }
.ps-kicker .badge-soft.neutral { background: rgba(255,255,255,.12); color: #e2e8f0; }
.ps-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -.02em;
}
.ps-badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.ps-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
}
.ps-chip i { opacity: .9; }
.ps-chip.deal { background: rgba(6,182,212,.22); }
.ps-chip.type { background: rgba(234,88,12,.18); }
.ps-chip.loc { background: rgba(255,255,255,.08); }

.ps-price-card {
  margin-top: .25rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(10px);
}
.ps-price-caption {
  display: block; font-size: .78rem; opacity: .8; margin-bottom: .2rem;
}
.ps-price-value {
  display: block;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -.02em;
}
.ps-price-sub {
  margin-top: .4rem; font-size: .82rem; opacity: .88;
}
.ps-price-sub.commission {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: .55rem; padding: .3rem .55rem; border-radius: 8px;
  background: rgba(16,185,129,.18); font-weight: 700;
}

.ps-actions {
  display: flex; flex-wrap: wrap; gap: .45rem; margin-top: auto;
}
.ps-actions .btn {
  border-radius: 11px;
  font-weight: 700;
}
.ps-actions .btn-primary {
  background: linear-gradient(135deg, #06b6d4, #0e7490);
  border: 0;
  box-shadow: 0 8px 20px rgba(6,182,212,.3);
}
.ps-actions .btn-outline-primary,
.ps-actions .btn-outline-secondary,
.ps-actions .btn-outline-danger {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.22);
  color: #fff;
}
.ps-actions .btn-outline-primary:hover,
.ps-actions .btn-outline-secondary:hover { background: rgba(255,255,255,.16); color: #fff; }
.ps-actions .btn-ghost { color: rgba(255,255,255,.85); }

.ps-specs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}
.ps-spec {
  display: flex; align-items: center; gap: .7rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.ps-spec:hover {
  transform: translateY(-2px);
  border-color: rgba(14,116,144,.28);
  box-shadow: 0 12px 28px rgba(14,116,144,.1);
}
.ps-spec i {
  width: 38px; height: 38px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-soft), #e0f2fe);
  color: var(--brand-dark);
  flex-shrink: 0;
}
.ps-spec span { display: block; font-size: .72rem; color: var(--muted); }
.ps-spec strong { display: block; font-size: .95rem; color: var(--ink); font-weight: 800; }

.ps-nav {
  position: sticky; top: .65rem; z-index: 30;
  display: flex; gap: .35rem; flex-wrap: wrap;
  padding: .45rem;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
}
.ps-nav a {
  padding: .45rem .85rem;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  transition: all .2s;
}
.ps-nav a:hover { background: var(--surface-2); color: var(--brand-dark); }
.ps-nav a.active {
  background: linear-gradient(135deg, var(--brand-soft), #e0f2fe);
  color: var(--brand-dark);
}

.ps-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .85fr);
  gap: 1rem;
  align-items: start;
}
.ps-main, .ps-aside {
  display: flex; flex-direction: column; gap: 1rem;
}
.ps-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem 1.25rem;
  scroll-margin-top: 72px;
}
.ps-card.sticky-card {
  position: sticky;
  top: 72px;
}
.ps-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1rem;
}
.ps-card-head h2 {
  margin: 0; font-size: 1rem; font-weight: 800;
  display: flex; align-items: center; gap: .45rem; color: var(--ink);
}
.ps-card-head h2 i { color: var(--brand); }
.ps-count {
  font-size: .78rem; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border-radius: 999px; padding: .2rem .65rem;
}
.ps-tech-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}
.ps-tech {
  padding: .8rem .9rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.ps-tech span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
.ps-tech strong { font-size: .92rem; color: var(--ink); }
.ps-block { margin-top: 1.15rem; }
.ps-block h3 {
  margin: 0 0 .65rem; font-size: .9rem; font-weight: 800;
  display: flex; align-items: center; gap: .4rem; color: var(--ink-soft);
}
.ps-block h3 i { color: var(--brand-mid); }
.ps-desc { margin: 0; color: var(--ink-soft); line-height: 1.9; white-space: pre-wrap; }
.ps-feature-wrap { display: flex; flex-wrap: wrap; gap: .4rem; }
.ps-feature {
  padding: .35rem .75rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: .8rem; font-weight: 700; border: 1px solid rgba(14,116,144,.18);
}
.ps-feature.other {
  background: var(--accent-soft); color: #9a3412; border-color: rgba(234,88,12,.2);
}

.ps-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .7rem;
}
.ps-gallery-item {
  position: relative;
  border-radius: 14px; overflow: hidden;
  aspect-ratio: 4/3; background: #0f172a;
  border: 1px solid var(--line);
}
.ps-gallery-item img,
.ps-gallery-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-gallery-del {
  position: absolute; top: .4rem; left: .4rem; margin: 0;
}
.ps-gallery-del button {
  width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: rgba(185,28,28,.92); color: #fff; cursor: pointer;
}

.ps-loc-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
}
.ps-loc-public, .ps-loc-private {
  padding: 1rem; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2);
}
.ps-loc-public { background: linear-gradient(160deg, #ecfeff, #fff); border-color: rgba(6,182,212,.25); }
.ps-loc-private.locked { background: #f8fafc; }
.ps-loc-label {
  display: block; font-size: .75rem; color: var(--muted); margin-bottom: .45rem; font-weight: 700;
}
.ps-loc-public strong { font-size: 1.02rem; display: block; margin-bottom: .25rem; }
.ps-loc-public small, .ps-loc-private .muted { color: var(--muted); font-size: .8rem; }
.ps-loc-private p { margin: 0 0 .4rem; font-size: .9rem; }
.ps-loc-private p i { width: 1.1rem; color: var(--brand); }

.ps-person {
  display: flex; align-items: center; gap: .75rem;
}
.ps-avatar {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-mid));
  color: #fff; font-size: 1.1rem;
}
.ps-phone {
  display: block; direction: ltr; text-align: right;
  color: var(--brand-dark); font-weight: 700; margin-top: .15rem;
}
.ps-locked-box {
  text-align: center; padding: 1rem .5rem; color: var(--muted);
}
.ps-locked-box i { font-size: 1.4rem; display: block; margin-bottom: .4rem; color: var(--warning); }
.ps-divider { height: 1px; background: var(--line); margin: 1rem 0; }
.ps-subhead {
  margin: 0 0 .4rem; font-size: .82rem; font-weight: 800; color: var(--ink-soft);
  display: flex; align-items: center; gap: .35rem;
}
.ps-subhead i { color: var(--brand-mid); }
.ps-assign-form { margin-top: .5rem; }
.btn-block { width: 100%; justify-content: center; }

.ps-check-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.ps-check-list li {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .7rem 0; border-bottom: 1px dashed var(--line);
}
.ps-check-list li:last-child { border-bottom: 0; }
.ps-check-list strong { display: block; font-size: .92rem; }
.ps-check-list small { color: var(--muted); font-size: .75rem; }
.ps-check-form {
  padding-top: .75rem; border-top: 1px solid var(--line);
}

.ps-timeline { list-style: none; margin: 0; padding: 0; }
.ps-timeline li {
  position: relative;
  padding: 0 1rem .95rem 0;
  border-right: 2px solid var(--brand-soft);
  margin-right: .35rem;
}
.ps-timeline li::before {
  content: "";
  position: absolute; right: -5px; top: .35rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.ps-timeline li:last-child { border-right-color: transparent; padding-bottom: 0; }
.ps-timeline strong { display: block; font-size: .9rem; }
.ps-timeline small { display: block; color: var(--muted); font-size: .75rem; margin-top: .15rem; }
.ps-timeline em { display: block; font-style: normal; color: var(--ink-soft); font-size: .82rem; margin-top: .2rem; }
.ps-timeline .muted { border: 0; padding: 0; color: var(--muted); }
.ps-timeline .muted::before { display: none; }

.ps-empty {
  text-align: center; padding: 1.75rem 1rem; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 14px; background: var(--surface-2);
}
.ps-empty.compact { padding: 1rem; }
.ps-empty i { font-size: 1.5rem; display: block; margin-bottom: .4rem; opacity: .7; }
.ps-empty p { margin: 0; }

@media (max-width: 1100px) {
  .ps-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 992px) {
  .ps-hero, .ps-body { grid-template-columns: 1fr; }
  .ps-card.sticky-card { position: static; }
  .ps-loc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
  .ps-specs { grid-template-columns: 1fr 1fr; }
  .ps-tech-grid { grid-template-columns: 1fr; }
  .ps-nav { top: 0; border-radius: 0; margin: 0 -.25rem; }
  .ps-hero { border-radius: 16px; padding: .75rem; }
  .ps-actions .btn { flex: 1 1 calc(50% - .45rem); justify-content: center; }
}

/* ---------- Jalali datepicker ---------- */
.jdp-wrap { position: relative; width: 100%; z-index: 3; }
.field-card:has(.jdp-wrap),
.ps-check-form .col-6,
.modal-box .col-md-6 { overflow: visible; }
.jdp-wrap:has(.jdp-popup.open) { z-index: 90; }
.jdp-wrap .jalali-date,
.jdp-wrap input[type="text"].jalali-date {
  width: 100%;
  padding-left: 2.6rem !important;
}
.jdp-btn {
  position: absolute;
  left: .45rem; top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  border: 0; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-soft), #e0f2fe);
  color: var(--brand-dark);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 2;
}
.jdp-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15,23,42,.16);
  padding: .65rem;
  z-index: 5000;
  display: none;
  animation: toastIn .16s ease;
}
.jdp-popup.open { display: block; }
.jdp-head {
  display: grid;
  grid-template-columns: 28px 28px 1fr 28px 28px;
  gap: .25rem;
  align-items: center;
  margin-bottom: .55rem;
}
.jdp-title {
  text-align: center;
  font-weight: 800;
  font-size: .88rem;
  color: var(--ink);
}
.jdp-nav {
  width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: var(--surface-2); color: var(--brand-dark); cursor: pointer;
}
.jdp-nav:hover { background: var(--brand-soft); }
.jdp-week {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: .15rem; margin-bottom: .25rem; text-align: center;
  font-size: .72rem; color: var(--muted); font-weight: 700;
}
.jdp-days {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: .2rem;
}
.jdp-days .empty { min-height: 32px; }
.jdp-day {
  min-height: 32px; border: 0; border-radius: 9px;
  background: transparent; cursor: pointer;
  font-family: inherit; font-size: .85rem; font-weight: 700;
  color: var(--ink-soft);
}
.jdp-day:hover { background: var(--brand-soft); color: var(--brand-dark); }
.jdp-day.today { box-shadow: inset 0 0 0 1.5px var(--brand-mid); }
.jdp-day.selected {
  background: linear-gradient(135deg, var(--brand), var(--brand-mid));
  color: #fff;
}
.jdp-foot {
  display: flex; justify-content: space-between; gap: .4rem;
  margin-top: .55rem; padding-top: .45rem; border-top: 1px solid var(--line);
}
.jdp-foot button {
  border: 0; background: var(--surface-2); border-radius: 8px;
  padding: .35rem .7rem; font-size: .78rem; font-weight: 700;
  cursor: pointer; font-family: inherit; color: var(--brand-dark);
}
.jdp-foot .jdp-clear { color: var(--danger); }

/* ---------- Agents / Roles ---------- */
.ag-page { display: grid; gap: 1.25rem; }
.ag-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 1.25rem;
  align-items: center;
  padding: 1.25rem 1.4rem;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 20%, rgba(251,191,36,.22), transparent 40%),
    linear-gradient(135deg, #0b3d3a 0%, #0f766e 55%, #115e59 100%);
  box-shadow: 0 18px 40px rgba(15, 118, 110, .22);
}
.ag-kicker {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .78rem; font-weight: 700; opacity: .85; margin-bottom: .55rem;
}
.ag-hero h1 { margin: 0 0 .45rem; font-size: clamp(1.45rem, 2.4vw, 2rem); font-weight: 800; }
.ag-hero p { margin: 0; max-width: 40rem; opacity: .88; line-height: 1.7; }
.ag-hero-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.1rem; }
.btn-outline-light {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.35); color: #fff;
}
.btn-outline-light:hover { background: rgba(255,255,255,.16); color: #fff; }
.ag-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 120px));
  gap: .55rem;
  align-content: center;
}
.ag-stat {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  padding: .55rem .65rem;
  text-align: center;
  min-width: 0;
}
.ag-stat strong { display: block; font-size: 1.15rem; font-weight: 800; line-height: 1.2; }
.ag-stat span { display: block; font-size: .68rem; opacity: .8; line-height: 1.35; margin-top: .2rem; }

.ag-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.1rem; align-items: start; }
.ag-toolbar { margin-bottom: .85rem; }
.ag-toolbar .filter-bar { margin: 0; }
.ag-toolbar .filter-field.grow { flex: 1 1 220px; }

.ag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .9rem;
}
.ag-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ag-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(20,184,166,.35);
}
.ag-card-top { display: flex; align-items: flex-start; gap: .7rem; margin-bottom: .85rem; }
.ag-avatar {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff; font-weight: 800; font-size: 1.1rem; flex-shrink: 0;
}
.ag-card-id { flex: 1; min-width: 0; }
.ag-card-id h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.ag-card-id h3 a { color: inherit; text-decoration: none; }
.ag-card-id h3 a:hover { color: var(--primary); }
.ag-meta { display: flex; flex-wrap: wrap; gap: .35rem .7rem; margin-top: .25rem; color: var(--muted); font-size: .78rem; }
.ag-card-metrics {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem;
  padding: .7rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-bottom: .75rem;
}
.ag-card-metrics div { text-align: center; }
.ag-card-metrics strong { display: block; font-size: .92rem; font-weight: 800; }
.ag-card-metrics span { font-size: .68rem; color: var(--muted); }
.ag-card-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

.ag-aside { display: grid; gap: .9rem; }
.ag-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.ag-panel.soft { background: linear-gradient(180deg, #f0fdfa, #fff); }
.ag-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.ag-panel-head h2 { margin: 0; font-size: .95rem; font-weight: 800; display: flex; align-items: center; gap: .4rem; }
.ag-panel-head.between { flex-wrap: wrap; gap: .5rem; }
.ag-rank-item {
  display: flex; gap: .7rem; align-items: center;
  padding: .55rem 0; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.ag-rank-item:last-child { border-bottom: 0; }
.ag-rank-item:hover strong { color: var(--primary); }
.ag-rank-n {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--surface-2); font-size: .78rem; font-weight: 800; color: var(--muted);
}
.ag-rank-n.top { background: rgba(245,158,11,.15); color: #b45309; }
.ag-rank-info strong { display: block; font-size: .88rem; }
.ag-rank-info small { color: var(--muted); font-size: .72rem; }
.ag-aside-text { color: var(--muted); font-size: .85rem; margin: 0 0 .8rem; line-height: 1.7; }

.ag-create-page { display: grid; gap: 1.1rem; }
.ag-create-hero {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: 1.4rem 1.5rem; border-radius: 20px;
  background:
    radial-gradient(circle at 10% 80%, rgba(20,184,166,.12), transparent 45%),
    linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid var(--line);
}
.ag-create-hero h1 { margin: .35rem 0 .3rem; font-size: 1.5rem; font-weight: 800; }
.ag-create-hero p { margin: 0; color: var(--muted); max-width: 36rem; }
.ag-back { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .85rem; text-decoration: none; font-weight: 600; }
.ag-back:hover { color: var(--primary); }
.ag-create-badge {
  width: 72px; height: 72px; border-radius: 22px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff; font-size: 1.6rem; box-shadow: 0 12px 28px rgba(15,118,110,.28);
}
.ag-create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ag-form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.15rem 1.2rem;
}
.ag-form-card.accent { border-color: rgba(20,184,166,.35); background: linear-gradient(180deg, #f0fdfa, #fff); }
.ag-form-card header {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line);
}
.ag-form-card header i { color: var(--primary); }
.ag-form-card header h2 { margin: 0; font-size: 1rem; font-weight: 800; }
.ag-form-note {
  margin-top: .35rem; padding: .7rem .85rem; border-radius: 12px;
  background: rgba(20,184,166,.08); color: var(--ink-soft); font-size: .82rem;
}
.ag-create-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.roles-page { display: grid; gap: 1.1rem; }
.roles-hero {
  padding: 1.35rem 1.5rem; border-radius: 20px;
  background: linear-gradient(135deg, #134e4a, #0f766e); color: #fff;
}
.roles-hero h1 { margin: .35rem 0 .3rem; font-size: 1.45rem; font-weight: 800; }
.roles-hero p { margin: 0; opacity: .88; }
.roles-hero .ag-back { color: rgba(255,255,255,.8); }
.roles-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; align-items: start; }
.roles-side { display: grid; gap: .9rem; }
.roles-list { display: grid; gap: .35rem; }
.roles-item {
  display: block; padding: .7rem .8rem; border-radius: 12px;
  border: 1px solid var(--line); text-decoration: none; color: inherit;
  transition: .15s ease;
}
.roles-item:hover, .roles-item.active {
  border-color: rgba(20,184,166,.45);
  background: rgba(20,184,166,.08);
}
.roles-item strong { display: block; font-size: .9rem; }
.roles-item small { color: var(--muted); font-size: .72rem; }
.roles-bulk { display: flex; flex-wrap: wrap; gap: .4rem; }
.perm-group { margin-bottom: 1.1rem; }
.perm-group-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .55rem;
}
.perm-group-head h3 { margin: 0; font-size: .95rem; font-weight: 800; }
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .45rem;
}
.perm-item {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .65rem .7rem; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.perm-item:has(input:checked) {
  border-color: rgba(20,184,166,.5);
  background: rgba(20,184,166,.07);
}
.perm-item input { margin-top: .2rem; }
.perm-item strong { display: block; font-size: .82rem; font-weight: 700; }
.perm-item small { color: var(--muted); font-size: .68rem; }
.roles-form-foot { padding-top: .5rem; border-top: 1px solid var(--line); }
.btn-xs { padding: .2rem .55rem; font-size: .72rem; }

@media (max-width: 992px) {
  .ag-hero, .ag-layout, .ag-create-grid, .roles-layout { grid-template-columns: 1fr; }
  .ag-hero-stats { grid-template-columns: repeat(3, 1fr); }
  .ag-create-badge { display: none; }
}
@media (max-width: 560px) {
  .ag-hero-stats { grid-template-columns: 1fr; }
}

/* ---------- Settings / Brand ---------- */
.brand-logo {
  max-height: 42px; max-width: 120px; object-fit: contain;
  border-radius: 10px; background: rgba(255,255,255,.08); padding: .2rem .35rem;
}
.brand-mark-img { overflow: hidden; padding: 0; }
.brand-mark-img img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-footer a { color: #5eead4; text-decoration: none; font-weight: 700; }
.sidebar-footer a:hover { text-decoration: underline; color: #99f6e4; }

.settings-page { display: grid; gap: 1.1rem; }
.settings-hero {
  padding: 1.35rem 1.5rem; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, #0f766e, #115e59 60%, #134e4a);
}
.settings-hero h1 { margin: .35rem 0 .3rem; font-size: 1.45rem; font-weight: 800; }
.settings-hero p { margin: 0; opacity: .9; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.settings-brand-card { grid-column: 1 / -1; }
.settings-switch {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .85rem .9rem; border-radius: 14px; border: 1px solid var(--line);
  margin-bottom: .65rem; cursor: pointer; background: #fff;
}
.settings-switch.warn { border-color: rgba(245,158,11,.35); background: #fffbeb; }
.settings-switch input { margin-top: .25rem; }
.settings-switch strong { display: block; font-size: .9rem; }
.settings-switch small { color: var(--muted); font-size: .78rem; line-height: 1.6; }
.settings-uploads { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
.settings-upload label { font-weight: 700; font-size: .85rem; display: block; margin-bottom: .4rem; }
.settings-preview {
  height: 96px; border-radius: 14px; border: 1px dashed var(--line);
  display: grid; place-items: center; margin-bottom: .5rem; overflow: hidden;
  background: var(--surface-2);
}
.settings-preview.sm { height: 72px; }
.settings-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.settings-preview .muted { color: var(--muted); font-size: .8rem; }
.settings-vars {
  display: flex; flex-wrap: wrap; gap: .4rem;
  padding: .7rem; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line);
}
.settings-vars code {
  font-size: .72rem; padding: .2rem .45rem; border-radius: 8px;
  background: #ecfeff; color: #0f766e; border: 1px solid #99f6e4; cursor: help;
}
.settings-contract-tpl {
  font-family: inherit; line-height: 1.9; min-height: 220px;
  white-space: pre-wrap;
}
@media (max-width: 900px) {
  .settings-grid, .settings-uploads { grid-template-columns: 1fr; }
  .settings-brand-card { grid-column: auto; }
}

/* ========== تطبیق + کانبان (پورتال در portal.css) ========== */
.reminder-strip { display: flex; flex-wrap: wrap; gap: .5rem; }
.reminder-chip {
  display: flex; flex-direction: column; gap: .15rem;
  border: 1px solid #fde68a; background: #fffbeb; border-radius: 12px;
  padding: .55rem .75rem; min-width: 160px; color: inherit;
}
.reminder-chip small { color: var(--muted); }

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(200px, 1fr));
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .5rem;
}
.kanban-col {
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 420px;
  display: flex; flex-direction: column;
  min-width: 210px;
}
.kanban-col-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem .9rem; font-weight: 800; font-size: .88rem;
  border-bottom: 1px solid var(--line);
  background: #fff; border-radius: 16px 16px 0 0;
}
.kanban-count {
  background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 999px; padding: .1rem .55rem; font-size: .75rem;
}
.kanban-col-body {
  padding: .65rem; flex: 1; display: flex; flex-direction: column; gap: .55rem;
  min-height: 200px;
}
.kanban-col-body.drag-over { background: rgba(20,184,166,.08); outline: 2px dashed #5eead4; }
.kanban-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .75rem; cursor: grab; box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.kanban-card.dragging { opacity: .55; }
.kanban-card-title { font-weight: 800; display: block; margin-bottom: .25rem; color: var(--ink); }
.kanban-card-meta { display: flex; flex-wrap: wrap; gap: .35rem; font-size: .75rem; color: var(--muted); margin-bottom: .3rem; }
.kanban-card-budget { font-size: .8rem; font-weight: 700; margin-bottom: .35rem; }
.kanban-card-foot { display: flex; flex-direction: column; gap: .35rem; }
.kanban-card-foot .form-control { font-size: .75rem; }

.activity-timeline { display: flex; flex-direction: column; gap: .85rem; }
.activity-item { display: flex; gap: .75rem; }
.activity-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft);
  color: var(--primary-dark); display: grid; place-items: center; flex-shrink: 0;
}
.activity-item.activity-reminder .activity-icon { background: #fef3c7; color: #b45309; }
.activity-item.activity-voice .activity-icon { background: #fee2e2; color: #b91c1c; }
.activity-item.activity-stage_change .activity-icon { background: #e0e7ff; color: #4338ca; }
.activity-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .2rem; }
.activity-head small { color: var(--muted); }
.activity-body p { margin: 0 0 .35rem; }
.activity-remind { font-size: .85rem; color: #92400e; }
.activity-tabs .nav-link { font-size: .85rem; padding: .4rem .75rem; }
.voice-recorder { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

@media (max-width: 900px) {
  .kanban-board { grid-auto-flow: column; grid-template-columns: repeat(5, 240px); }
}

/* دسکتاپ: جدول تطبیق عادی */
@media (min-width: 769px) {
  .match-table thead { display: table-header-group; }
  .match-table,
  .match-table tbody { display: table; width: 100%; }
  .match-table tr { display: table-row; background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0; }
  .match-table td {
    display: table-cell;
    text-align: right;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--line) !important;
  }
  .match-table td::before { content: none !important; }
}
