/* ================================================================
   Behi Center Dashboard — Professional Redesign
   ================================================================ */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --bg:          #f1f5f9;
  --panel:       #ffffff;
  --text:        #0f172a;
  --muted:       #64748b;
  --border:      #e2e8f0;
  --border-soft: #f1f5f9;
  --primary:     #475569;
  --primary-h:   #334155;
  --primary-lit: #eef1f5;
  --green:       #16a34a;
  --green-lit:   #dcfce7;
  --amber:       #d97706;
  --amber-lit:   #fef3c7;
  --red:         #dc2626;
  --red-lit:     #fee2e2;
  --gray:        #94a3b8;
  --radius:      14px;
  --radius-sm:   9px;
  --shadow:      0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --sidebar-bg:     #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-text:   #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-w:      239px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: linear-gradient(rgba(241,245,249,.94), rgba(241,245,249,.94)), url('behi.jpg');
  background-repeat: no-repeat;
  background-position: top center;
  background-size: 420px;
  background-attachment: fixed;
  color: var(--text);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.75;
}

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

/* Layout */
.container {
  max-width: none;
  margin: 0;
  padding: 28px 24px 72px;
}

/* App Shell / Sidebar */
.sidebar-toggle-input { display: none; }

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: background .15s;
}
.sidebar-brand:hover {
  background: rgba(255,255,255,.06);
  text-decoration: none;
}
.sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255,255,255,.08);
}
.sidebar-brand-text {
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 6px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.3);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.06);
  color: var(--sidebar-active);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--primary);
  color: #fff;
}
.nav-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.nav-group { position: relative; }
.nav-group > .nav-parent {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.nav-group:hover > .nav-parent {
  background: rgba(255,255,255,.06);
  color: var(--sidebar-active);
  text-decoration: none;
}
.nav-group > .nav-parent.active {
  background: var(--primary);
  color: #fff;
}
.nav-arrow { margin-inline-start: auto; font-size: 0.75rem; opacity: .6; }
.nav-submenu {
  display: none;
  position: fixed;
  min-width: 200px;
  background: var(--sidebar-bg);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow-md);
  z-index: 300;
  flex-direction: column;
  gap: 2px;
}
.nav-submenu { max-height: calc(100vh - 16px); overflow-y: auto; }
.nav-submenu.open { display: flex; }
.nav-submenu a { white-space: nowrap; }
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-footer .nav-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: #f87171;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background .15s;
}
.sidebar-footer .nav-logout:hover {
  background: rgba(248,113,113,.1);
  color: #fca5a5;
  text-decoration: none;
}

.sidebar-overlay { display: none; }

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

/* Mobile Topbar (sidebar toggle) */
.topbar {
  display: none;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  min-height: 54px;
}
.sidebar-burger {
  display: none;
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
}
.sidebar-burger:hover { background: var(--bg); }
.brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

/* Cards / Panels */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.panel h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel h2 .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  border: 1px solid var(--border);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}
.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.dashboard-col .panel { margin-bottom: 0; }

/* Page Hero */
.page-hero {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fff;
  text-align: center;
  padding: 32px 24px;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
}
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: rec-pulse 1.6s infinite;
}
.rec-indicator-sm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #86efac;
  margin-bottom: 4px;
}
@keyframes rec-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* Announcement */
.announcement-panel { border-right: 5px solid var(--amber); }
.announcement-box {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 2;
  background: var(--amber-lit);
  color: #92400e;
  border: 1.5px solid #fcd34d;
  border-radius: 12px;
  padding: 18px 20px;
  white-space: pre-wrap;
}
.announcement-box.announcement-blink {
  animation: announcement-blink 1.4s ease-in-out infinite;
}
@keyframes announcement-blink {
  0%, 100% { background: var(--amber-lit); border-color: #fcd34d; }
  50%      { background: #fde68a; border-color: #f59e0b; }
}
.announcement-blink-title {
  animation: announcement-title-blink 1.4s ease-in-out infinite;
}
@keyframes announcement-title-blink {
  0%, 100% { opacity: 1; color: #0f172a; }
  50%      { opacity: 1; color: #dc2626; }
}

/* Login */
.login-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--panel);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.login-card h1 {
  font-size: 1.2rem;
  margin: 0 0 6px;
  color: var(--text);
}
.login-card .subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 0.9rem;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: right;
}
.login-card label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 4px;
}
.login-card input {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  background: var(--bg);
}
.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71,85,105,.12);
  background: #fff;
}
.login-card button {
  margin-top: 16px;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .1s;
}
.login-card button:hover { background: var(--primary-h); }
.login-card button:active { transform: scale(.98); }
.error-msg { color: var(--red); font-size: 0.88rem; background: var(--red-lit); padding: 8px 12px; border-radius: 8px; margin: 4px 0; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .02em;
}
.badge-secondary, .badge.info { background: var(--primary-lit); color: var(--primary); }
.badge-warning               { background: var(--amber-lit);   color: #92400e; }
.badge-success, .badge.success { background: var(--green-lit); color: #166534; }
.badge-muted, .badge.muted   { background: #f1f5f9;           color: var(--muted); }

/* Bot Control Panel */
.status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.btn {
  flex: 1 1 160px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: filter .15s, box-shadow .15s;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-on    { border-color: #86efac; background: #f0fdf4; color: #166534; }
.btn-hours { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.btn-off   { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }
.btn-ghost { border-color: var(--border); background: var(--bg); color: var(--muted); }
.btn-start { border-color: #86efac; background: #f0fdf4; color: #166534; }
.btn:hover { filter: brightness(.96); box-shadow: var(--shadow); text-decoration: none; }
.btn:active { transform: scale(.98); }

/* Summary Chips */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.summary-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 4px;
  padding: 18px 12px;
  border-radius: 12px;
  text-align: center;
  transition: transform .15s, box-shadow .15s;
  text-decoration: none !important;
  border: 1.5px solid transparent;
}
.summary-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.summary-chip .icon { font-size: 1.5rem; }
.summary-chip .num { font-size: 1.6rem; font-weight: 800; line-height: 1.05; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.summary-chip .lbl { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
/* Override badge colors for chips */
.summary-chip.badge-secondary { background: var(--primary-lit); border-color: #cbd5e1; }
.summary-chip.badge-secondary .num { color: var(--primary); }
.summary-chip.badge-warning { background: var(--amber-lit); border-color: #fcd34d; }
.summary-chip.badge-warning .num { color: var(--amber); }
.summary-chip.badge-success { background: var(--green-lit); border-color: #86efac; }
.summary-chip.badge-success .num { color: var(--green); }
.summary-chip.badge-muted { background: #f8fafc; border-color: var(--border); }
.summary-chip.badge-muted .num { color: var(--muted); }

/* Order List */
.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.summary-chip.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(71,85,105,.12); }
.order-card {
  display: block;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  color: inherit;
  background: var(--panel);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.order-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71,85,105,.08);
  background: #fafbff;
  text-decoration: none;
}
.order-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.order-id { font-weight: 700; font-size: 0.95rem; }
.order-card-body {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cust-name { font-size: 0.9rem; }
.order-card-extra { margin-top: 4px; font-size: 0.78rem; color: var(--muted); }
.muted { color: var(--muted); font-size: 0.85rem; }
.empty {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.empty::before { content: '—'; opacity: .5; }

/* Order Detail */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  transition: border-color .15s, color .15s;
}
.back-link:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

.detail-card { border-right: 4px solid var(--primary); }
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-head h1 { font-size: 1.25rem; margin: 0; }
.dk-status { margin-top: 6px; font-size: 0.9rem; }

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.info-list li {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.info-list li:last-child { border-bottom: none; }
.info-list .k { color: var(--muted); min-width: 120px; font-size: 0.85rem; font-weight: 500; }
.info-list .v { font-weight: 600; font-size: 0.9rem; }

/* Item Grid */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.item-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s;
}
.item-card:hover { box-shadow: var(--shadow-md); }
.item-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--bg); }
.item-info { padding: 12px 14px; }
.item-title { margin: 0 0 6px; font-size: 0.88rem; line-height: 1.55; font-weight: 600; }

.item-grid.compact { grid-template-columns: 1fr; }
.item-card.compact { flex-direction: row; align-items: center; gap: 12px; padding: 8px 12px; }
.item-card.compact img { width: 60px; height: 60px; flex: none; border-radius: 10px; }
.item-card.compact .item-info { padding: 0; }

/* Alert Banner */
.alert-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--red-lit);
  border: 1.5px solid #fca5a5;
  color: #991b1b;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert-banner a { color: #991b1b; font-weight: 700; text-decoration: underline; }
.alert-banner .updated-at { color: #b45309; font-size: 0.78rem; opacity: .85; }

/* Collapsible How-to */
.howto {
  margin: 10px 0 18px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--muted);
  background: var(--panel);
}
.howto summary { cursor: pointer; color: var(--text); font-weight: 700; }
.howto ol { margin: 10px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.howto code { background: var(--bg); border-radius: 5px; padding: 2px 6px; font-size: 0.83em; direction: ltr; display: inline-block; border: 1px solid var(--border); }

/* SnappBox / Form Styles */
.sb-form { display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.sb-form label { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.sb-form input, .sb-form textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.sb-form input:focus, .sb-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71,85,105,.12);
  background: #fff;
}
.sb-form input { text-align: center; letter-spacing: 2px; }
.sb-form button {
  margin-top: 8px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.sb-form button:hover { background: var(--primary-h); }
.sb-form .btn-cancel { background: var(--red); }
.sb-form .btn-cancel:hover { background: #b91c1c; }

.status-msg {
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--primary-lit);
  color: var(--primary);
  font-size: 0.9rem;
  margin-bottom: 16px;
  font-weight: 500;
  border: 1px solid #cbd5e1;
}
.status-msg.success { background: var(--green-lit); color: #166534; border-color: #86efac; }
.status-msg.error   { background: var(--red-lit);   color: #991b1b; border-color: #fca5a5; }
.status-msg .updated-at { display: block; margin-top: 4px; font-size: 0.78rem; opacity: .75; }

/* Variant Management */
.vm-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.vm-filters input, .vm-filters select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--panel);
  transition: border-color .15s;
}
.vm-filters input:focus, .vm-filters select:focus {
  outline: none;
  border-color: var(--primary);
}
.vm-filters input[type="number"], .vm-filters input[type="text"] { min-width: 130px; }
.vm-filters button {
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.vm-filters button:hover { background: var(--primary-h); }
.vm-filters .reset { background: var(--panel); color: var(--text); border: 1.5px solid var(--border); }

.vm-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--panel);
  transition: box-shadow .15s;
}
.vm-card:hover { box-shadow: var(--shadow-md); }
.vm-thumb { width: 68px; height: 68px; border-radius: 10px; object-fit: cover; background: var(--bg); flex-shrink: 0; border: 1px solid var(--border); }
.vm-main { flex: 1 1 240px; min-width: 0; }
.vm-title { font-size: 0.9rem; font-weight: 700; margin: 0 0 6px; line-height: 1.5; }
.vm-title a { color: inherit; }
.vm-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.76rem; color: var(--muted); margin-bottom: 8px; align-items: center; }
.vm-stats { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.82rem; color: var(--muted); }
.vm-stats b { color: var(--text); font-weight: 700; }
.vm-actions {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1.5px dashed var(--border);
  align-items: center;
}
.vm-edit { display: flex; align-items: center; gap: 8px; }
.vm-edit label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.vm-edit input {
  width: 120px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  text-align: center;
  background: var(--bg);
}
.vm-edit input:focus { outline: none; border-color: var(--primary); background: #fff; }
.vm-edit button {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.vm-edit button:hover { background: var(--primary-h); }
.vm-toggle {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: filter .15s;
}
.vm-toggle:hover { filter: brightness(.95); }
.vm-toggle.is-on  { border-color: #86efac; background: #f0fdf4; color: #166534; }
.vm-toggle.is-off { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }
.vm-msg { font-size: 0.78rem; margin-inline-start: auto; font-weight: 600; }
.vm-msg.ok  { color: var(--green); }
.vm-msg.err { color: var(--red); }
.vm-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.vm-pager a, .vm-pager span {
  padding: 8px 15px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--panel);
}
.vm-pager a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.vm-pager .current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

/* Inventory Management */
.inv-header { padding-bottom: 14px; }
.inv-title-row { margin-bottom: 14px; }
.inv-title { font-size: 1.05rem; font-weight: 800; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.inv-subtitle { font-size: 0.82rem; color: var(--muted); margin: 0; }
.inv-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border);
  width: fit-content;
}
.inv-tab-btn {
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.inv-tab-btn:hover { color: var(--text); }
.inv-tab-btn.active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: var(--shadow);
}
.inv-tab-panel { padding-top: 18px; }

/* HR Management */
.hr-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border);
  width: fit-content;
}
.hr-tab {
  padding: 9px 22px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.hr-tab.active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: var(--shadow);
}
.hr-tab-content { display: none; }
.hr-tab-content.active { display: block; }

.hr-status-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.hr-person-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  min-width: 140px;
  text-align: center;
  background: var(--panel);
}
.hr-person-chip.chip-in  { background: #f0fdf4; border-color: #86efac; }
.hr-person-chip.chip-out { background: #fef2f2; border-color: #fca5a5; }
.chip-name   { font-weight: 700; font-size: 0.9rem; }
.chip-status { font-size: 0.78rem; font-weight: 600; }
.chip-time   { font-size: 0.76rem; color: var(--muted); }
.hr-person-chip.chip-in  .chip-status { color: #166534; }
.hr-person-chip.chip-out .chip-status { color: #991b1b; }

.hr-form-group { margin-bottom: 14px; }
.hr-label { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.hr-select {
  width: 100%; max-width: 380px;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  transition: border-color .15s;
}
.hr-select:focus { outline: none; border-color: var(--primary); background: #fff; }
.hr-textarea {
  width: 100%; max-width: 500px;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  resize: vertical;
}
.hr-textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
.hr-btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hr-btn {
  padding: 12px 26px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 700;
  transition: filter .15s, box-shadow .15s;
}
.hr-btn-in     { background: #f0fdf4; border-color: #86efac; color: #166534; }
.hr-btn-out    { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.hr-btn-cargo  { background: var(--amber-lit); border-color: #fcd34d; color: #92400e; }
.hr-btn-report { background: var(--primary); border-color: var(--primary); color: #fff; }
.hr-btn-deposit { background: #f0fdf4; border-color: #86efac; color: #166534; }
.hr-btn-expense { background: #fff7ed; border-color: #fdba74; color: #c2410c; }
.hr-btn:hover { filter: brightness(.96); box-shadow: var(--shadow); }

.hr-section-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 12px; }

.hr-cargo-box {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1.5px solid #fcd34d;
  border-radius: 12px;
  background: #fffbeb;
}
.hr-cargo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hr-number-input {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  width: 140px;
  text-align: center;
  background: var(--panel);
}
.hr-number-input:focus { outline: none; border-color: var(--primary); }

.hr-report-box {
  margin-top: 24px;
  padding: 20px 22px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.hr-report-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hr-select-sm {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--panel);
}
.hr-select-sm:focus { outline: none; border-color: var(--primary); }

.hr-fin-group {
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.hr-fin-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 12px; }
.hr-fin-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.hr-fin-field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 130px; }
.hr-money-input, .hr-text-input {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--bg);
  transition: border-color .15s;
}
.hr-money-input:focus, .hr-text-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

/* ================== Finance Management (مدیریت مالی) ================== */
.fin-table-wrap { overflow-x: auto; }
.fin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.fin-table thead tr { background: var(--bg); border-bottom: 2px solid var(--border); }
.fin-table tbody tr { border-bottom: 1px solid var(--border-soft); transition: background .12s; }
.fin-table tbody tr:hover { background: #f8faff; }
.fin-table td { padding: 10px 10px 10px 14px; }
.fin-table .num { font-family: inherit; font-weight: 700; }

.fin-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.fin-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1.5px solid;
  white-space: nowrap;
}
.fin-badge-success { background: var(--green-lit); border-color: #86efac; color: #166534; }
.fin-badge-warning { background: var(--amber-lit); border-color: #fcd34d; color: #92400e; }
.fin-badge-danger  { background: var(--red-lit);   border-color: #fca5a5; color: #991b1b; }
.fin-badge-muted   { background: #f8fafc; border-color: var(--border); color: var(--muted); }
.fin-badge-primary { background: var(--primary-lit); border-color: #cbd5e1; color: var(--primary); }

.fin-section-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 12px; }
.fin-collapsible > summary.fin-section-title {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.fin-collapsible > summary.fin-section-title::-webkit-details-marker { display: none; }
.fin-collapsible > summary.fin-section-title::before {
  content: '▸';
  font-size: 0.8rem;
  color: var(--muted);
  transition: transform .15s;
}
.fin-collapsible[open] > summary.fin-section-title::before { transform: rotate(90deg); }
.fin-collapsible[open] > summary.fin-section-title { margin-bottom: 12px; }
.fin-form-group { margin-bottom: 14px; }
.fin-form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.fin-form-field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 150px; }
.fin-form-field.grow-2 { flex: 2 1 220px; }
.fin-form-field.grow-3 { flex: 3 1 260px; }

.fin-items-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 10px; }
.fin-items-table th { padding: 6px 8px; text-align: right; font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.fin-items-table td { padding: 4px 6px; }
.fin-items-table input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--bg);
}
.fin-items-table input:focus { outline: none; border-color: var(--primary); background: #fff; }
.fin-items-table .line-total { font-weight: 700; white-space: nowrap; padding: 0 6px; min-width: 90px; text-align: left; }

.fin-row-btn {
  border: 1.5px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: filter .15s;
}
.fin-row-btn:hover { filter: brightness(.95); }
.fin-row-add  { border-color: #86efac; background: #f0fdf4; color: #166534; }
.fin-row-del  { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }

.fin-total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
  margin-bottom: 14px;
  font-weight: 700;
}
.fin-total-box .amount { font-size: 1.15rem; color: var(--primary); }

.fin-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.fin-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel);
  transition: box-shadow .15s, border-color .15s;
}
.fin-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.fin-card a { color: inherit; text-decoration: none; display: block; }
.fin-card-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }
.fin-card-balance { font-size: 1.05rem; font-weight: 800; }
.fin-card-balance.positive { color: #166534; }
.fin-card-balance.negative { color: #991b1b; }
.fin-card-balance.zero { color: var(--muted); }

.fin-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fin-cal-label { font-weight: 800; font-size: 1rem; }
.fin-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.fin-cal-head {
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 0;
}
.fin-cal-cell {
  min-height: 64px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 4px;
  background: var(--bg);
}
.fin-cal-cell.empty { background: transparent; border-color: transparent; }
.fin-cal-cell.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(71,85,105,.12); }
.fin-cal-daynum { font-size: 0.78rem; font-weight: 700; margin-bottom: 4px; }
.fin-cal-chip {
  font-size: 0.66rem;
  border-radius: 5px;
  padding: 2px 4px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fin-cal-chip-issued { background: var(--amber-lit); color: #92400e; }
.fin-cal-chip-received { background: var(--green-lit); color: #166534; }
.fin-cal-chip-digikala { background: var(--green-lit); color: #166534; font-weight: 600; }

@media (max-width: 760px) {
  .fin-cal-grid { grid-template-columns: repeat(7, minmax(34px, 1fr)); gap: 2px; }
  .fin-cal-cell { min-height: 44px; font-size: 0.7rem; padding: 2px; }
  .fin-cal-chip { font-size: 0.6rem; }
}

.fin-link-btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: filter .15s;
}
.fin-link-btn:hover { filter: brightness(.96); box-shadow: var(--shadow); text-decoration: none; }
.fin-link-btn.back { border-color: var(--border); color: var(--muted); }

.fin-trend {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 140px;
  padding: 10px 4px 0;
  overflow-x: auto;
  border-bottom: 1.5px solid var(--border);
}
.fin-trend-bar {
  flex: 1 0 6px;
  min-width: 6px;
  min-height: 2px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  transition: filter .15s;
  cursor: pointer;
}
.fin-trend-bar:hover { filter: brightness(1.3); background: var(--green); }

.fin-channel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fin-channel-label { width: 80px; font-size: 0.82rem; font-weight: 600; flex-shrink: 0; }
.fin-channel-track { flex: 1; background: var(--bg); border-radius: 6px; height: 18px; overflow: hidden; }
.fin-channel-fill { height: 100%; background: var(--primary); border-radius: 6px; transition: width .3s; }
.fin-channel-value { width: 120px; text-align: left; font-size: 0.8rem; font-weight: 700; flex-shrink: 0; }

/* Shared Table & Form Controls (price bot, inventory) */
.th {
  padding: 10px 10px 10px 14px;
  text-align: right;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.pb-row { border-bottom: 1px solid var(--border-soft); transition: background .12s; }
.pb-row:hover { background: #f8faff; }
.pb-row.expanded { background: #eef2ff; }
.pb-settings-row td { transition: none; }
.pb-toggle {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid;
  font-family: inherit;
  transition: filter .15s;
  white-space: nowrap;
}
.pb-toggle.is-on  { border-color: #86efac; background: #f0fdf4; color: #166534; }
.pb-toggle.is-off { border-color: #e2e8f0; background: var(--bg); color: var(--muted); }
.pb-toggle:hover  { filter: brightness(.94); }
.set-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  display: block;
}
.set-input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.87rem;
  background: var(--panel);
}
.set-input:focus { outline: none; border-color: var(--primary); }
.pf-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.79rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: all .13s;
  white-space: nowrap;
}
.pf-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pf-btn:not(.active):hover { border-color: var(--primary); color: var(--primary); }

/* Misc */
.btn-cancel {
  padding: 9px 18px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: filter .15s;
}
.btn-cancel:hover { filter: brightness(.96); }

/* Mobile */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    transform: translateX(100%);
    transition: transform .25s ease;
    box-shadow: -8px 0 24px rgba(0,0,0,.25);
  }
  .sidebar-toggle-input:checked ~ .app-shell .sidebar {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 150;
  }
  .sidebar-toggle-input:checked ~ .app-shell .sidebar-overlay {
    display: block;
  }
  .topbar { display: block; }
  .sidebar-burger { display: inline-flex; align-items: center; justify-content: center; }
}

@media (max-width: 640px) {
  .container { padding: 16px 14px 60px; }
  .panel { padding: 16px 16px; border-radius: 12px; }
  .page-hero { padding: 24px 16px; }
  .page-title { font-size: 1.15rem; }
  .control-actions .btn { flex: 1 1 100%; }
  .info-list .k { min-width: 95px; font-size: 0.82rem; }
  .vm-card { flex-direction: column; }
  .vm-edit input { width: 90px; }
  .vm-msg { margin-inline-start: 0; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .summary-chip { padding: 14px 8px; }
  .summary-chip .num { font-size: 1.15rem; }
  .hr-tabs { width: 100%; }
  .hr-tab { padding: 9px 16px; font-size: 0.85rem; flex: 1; text-align: center; }
  .hr-status-row { flex-direction: column; }
  .hr-person-chip { flex-direction: row; justify-content: space-between; }
  .hr-report-row { flex-direction: column; }
  .hr-select, .hr-select-sm { max-width: 100%; width: 100%; }
  .login-card { padding: 28px 22px; }
  .announcement-box { font-size: 1rem; }
  .fin-card-grid { grid-template-columns: 1fr; }
  .fin-total-box { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* کارتِ جمع‌شونده (ثبت چک) */
.fin-collapse-card > summary.fin-collapse-head {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.fin-collapse-card > summary.fin-collapse-head::-webkit-details-marker { display: none; }
.fin-collapse-card[open] > summary .fin-collapse-arrow { transform: rotate(180deg); }
.fin-collapse-arrow { transition: transform .2s; color: var(--muted); font-size: 0.9rem; }
.fin-collapse-body { margin-top: 16px; }

/* ===== انتخابگر تاریخ شمسی ===== */
.jalali-date-input {
  cursor: pointer;
  background: var(--bg);
}
.jalali-dp-popup {
  display: none;
  position: absolute;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15,23,42,.15);
  padding: 10px;
  width: 256px;
  font-size: 0.85rem;
}
.jalali-dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
}
.jalali-dp-nav {
  border: none;
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  cursor: pointer;
}
.jalali-dp-nav:hover { background: var(--primary-lit); color: var(--primary); }
.jalali-dp-weekdays, .jalali-dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.jalali-dp-weekdays span {
  color: var(--muted);
  font-size: 0.75rem;
  padding: 4px 0;
}
.jalali-dp-day {
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 0;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}
.jalali-dp-day:hover { background: var(--primary-lit); }
.jalali-dp-day.today { font-weight: 700; color: var(--primary); }
.jalali-dp-day.holiday { color: #dc2626; font-weight: 600; }
.jalali-dp-day.selected { background: var(--primary); color: #fff; }
.jalali-dp-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.jalali-dp-footer button {
  border: none;
  background: var(--bg);
  color: var(--primary);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
}
.jalali-dp-footer button:hover { background: var(--primary-lit); }

/* قابلیتِ خاموشِ پنل — لینک منو خاکستری/قفل (فاز ۱ گیت واقعی) */
.nav-locked { opacity: .5; }
.nav-locked:hover { opacity: .62; }

.fin-cal-cell.clickable { cursor: pointer; transition: background 0.12s, box-shadow 0.12s; }
.fin-cal-cell.clickable:hover { background: var(--bg, #f3f4f6); box-shadow: inset 0 0 0 2px var(--accent, #2563eb); }
