/* ==========================================================
   Pinar Fonts
   ========================================================== */
@font-face { font-family:'Pinar'; src:url('/fonts/PINAR-LIGHT.TTF')   format('truetype'); font-weight:300; font-display:swap; }
@font-face { font-family:'Pinar'; src:url('/fonts/PINAR-REGULAR.TTF') format('truetype'); font-weight:400; font-display:swap; }
@font-face { font-family:'Pinar'; src:url('/fonts/PINAR-MEDIUM.TTF')  format('truetype'); font-weight:500; font-display:swap; }
@font-face { font-family:'Pinar'; src:url('/fonts/PINAR-SEMIBOLD.TTF')format('truetype'); font-weight:600; font-display:swap; }
@font-face { font-family:'Pinar'; src:url('/fonts/PINAR-BOLD.TTF')    format('truetype'); font-weight:700; font-display:swap; }

/* ==========================================================
   Design Tokens
   ========================================================== */
:root {
  --brand:        #00BFA6;
  --brand-dark:   #00967F;
  --brand-darker: #007A68;
  --brand-light:  #D9F5F0;
  --brand-soft:   #EFFCF9;

  --bg-1: #F7F9FB;
  --bg-2: #F2F5F7;
  --white: #FFFFFF;
  --surface: rgba(255,255,255,.88);

  --text-1: #0F1922;
  --text-2: #5A6B78;
  --text-3: #8A98A3;

  --border-1: rgba(15,25,34,.06);
  --border-2: rgba(15,25,34,.10);
  --border-3: rgba(0,191,166,.22);

  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #EF4444;

  --card-1: #26A69A;
  --card-2: #FF7043;
  --card-3: #7E57C2;
  --card-4: #42A5F5;
  --card-5: #FFA726;
  --card-6: #EC407A;
  --card-7: #AB47BC;
  --card-8: #5C6BC0;

  --shadow-sm: 0 1px 3px rgba(15,25,34,.05), 0 1px 2px rgba(15,25,34,.03);
  --shadow-md: 0 4px 12px rgba(15,25,34,.06), 0 2px 4px rgba(15,25,34,.04);
  --shadow-lg: 0 12px 28px rgba(15,25,34,.08), 0 4px 10px rgba(15,25,34,.04);

  --sidebar-w: 76px;
  --sidebar-w-open: 248px;
  --field-h: 44px;
  --btn-h: 44px;
  --transition: .22s cubic-bezier(.4,0,.2,1);
  --transition-slow: .35s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg-1: #0A1418;
  --bg-2: #0D1A1F;
  --white: #112128;
  --surface: rgba(17,33,40,.90);
  --text-1: #E8EFF4;
  --text-2: #92A8B4;
  --text-3: #6B7885;
  --border-1: rgba(232,239,244,.06);
  --border-2: rgba(232,239,244,.10);
  --border-3: rgba(0,191,166,.30);
  --brand-light: #0F3D36;
  --brand-soft: #0A2A25;
  --card-1: #1E8578;
  --card-2: #D85A30;
  --card-3: #6A47A8;
  --card-4: #2A7EC4;
  --card-5: #D98A1F;
  --card-6: #C23568;
  --card-7: #8C3A9E;
  --card-8: #4A56A8;
}

/* ==========================================================
   Base Reset
   ========================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Pinar', Tahoma, system-ui, sans-serif;
  color: var(--text-1);
  direction: rtl;
  font-size: 14px;
  line-height: 1.65;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-1);
  background-image:
    radial-gradient(ellipse 90% 60% at 15% 0%, rgba(0,191,166,.08), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 25%, rgba(168,213,255,.10), transparent 55%),
    radial-gradient(circle, rgba(0,191,166,.10) 1.2px, transparent 1.4px),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-size: auto, auto, 22px 22px, auto;
  background-repeat: no-repeat, no-repeat, repeat, no-repeat;
  background-attachment: fixed;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 90% 60% at 15% 0%, rgba(0,191,166,.12), transparent 55%),
    radial-gradient(circle, rgba(0,191,166,.10) 1.2px, transparent 1.4px),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-size: auto, 22px 22px, auto;
  background-repeat: no-repeat, repeat, no-repeat;
}

a { color: var(--brand-dark); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--brand); }

/* ==========================================================
   App Layout
   ========================================================== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 0;
  height: 100vh;
  overflow: hidden;
  gap: 14px;
}

/* ==========================================================
   Sidebar
   ========================================================== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #00BFA6 0%, #00967F 100%);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  transition: width var(--transition-slow);
  z-index: 100;
  box-shadow: 1px 0 0 rgba(0,0,0,.04), 4px 0 24px rgba(0,191,166,.08);
}
.sidebar::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
.sidebar::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -100px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(0,0,0,.10) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
.sidebar.open { width: var(--sidebar-w-open); }

[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #0E3A33 0%, #062522 100%);
  box-shadow: 1px 0 0 rgba(0,0,0,.30), 4px 0 24px rgba(0,0,0,.40);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255,255,255,.18);
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.brand-logo-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255,255,255,.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
  flex-shrink: 0;
  transition: var(--transition);
}
.brand-logo-wrap svg { width: 26px; height: 26px; color: var(--brand-darker); }
.brand-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity .22s, max-height .3s;
  color: #fff;
}
.brand-text strong { display: block; }
.brand-text small {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  color: rgba(255,255,255,.80);
  margin-top: 3px;
}
.sidebar.open .brand-text { opacity: 1; max-height: 80px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.20); border-radius: 3px; }

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  width: 100%;
  height: 46px;
  border-radius: 12px;
  color: rgba(255,255,255,.82);
  font-weight: 500;
  font-size: 13.5px;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.sidebar.open .nav-link { justify-content: flex-start; gap: 13px; padding: 0 13px; }
.nav-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-link.active {
  background: #fff;
  color: var(--brand-darker);
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.nav-link.active .nav-icon svg { stroke: var(--brand-darker); }

.nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border-radius: 8px;
  transition: var(--transition);
}
.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  display: block;
  flex-shrink: 0;
}

.nav-label { display: none; }
.sidebar.open .nav-label { display: inline-block; font-size: 13.5px; white-space: nowrap; }

.sidebar:not(.open) .nav-link::after {
  content: attr(title);
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 12px;
  padding: 8px 14px;
  background: #0F1922;
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
  z-index: 200;
  box-shadow: 0 8px 20px rgba(0,0,0,.20);
}
.sidebar:not(.open) .nav-link:hover::after { opacity: 1; }

.nav-divider { height: 1px; background: rgba(255,255,255,.15); margin: 12px 6px; flex-shrink: 0; }
.nav-section-label {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(255,255,255,.55);
  padding: 8px 13px 4px;
  letter-spacing: .05em;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  max-height: 0;
  transition: opacity .22s, max-height .3s;
}
.sidebar.open .nav-section-label { opacity: 1; max-height: 30px; }

.nav-logout { color: rgba(255,220,220,.90) !important; }
.nav-logout:hover { background: rgba(239,68,68,.20) !important; color: #fff !important; }

.sidebar-toggle {
  margin-top: auto;
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.10);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}
.sidebar-toggle:hover {
  background: rgba(255,255,255,.20);
  border-color: rgba(255,255,255,.35);
}
.sidebar-toggle svg {
  transition: transform var(--transition-slow);
  width: 18px;
  height: 18px;
}
.sidebar.open .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,25,34,.40);
  z-index: 99998;
  opacity: 0;
  transition: opacity .25s;
}
.sidebar-overlay.show { display: block; opacity: 1; }

/* ==========================================================
   Topbar
   ========================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 20px;
  padding: 12px 22px;
  gap: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
  min-height: 68px;
  position: relative;
  z-index: 500;
  background: linear-gradient(135deg, #00BFA6 0%, #00967F 100%);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px rgba(0,191,166,.20), 0 1px 0 rgba(255,255,255,.10) inset;
  overflow: visible;
}
[data-theme="dark"] .topbar {
  background: linear-gradient(135deg, #0E3A33 0%, #072E29 100%);
  box-shadow: 0 8px 24px rgba(0,0,0,.40);
}
.topbar::before {
  content: '';
  position: absolute;
  top: -60%; right: 10%;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,.15) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 2;
}
.topbar-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  color: #fff;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; position: relative; z-index: 2; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.20);
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  text-decoration: none;
  backdrop-filter: blur(10px);
}
.icon-btn:hover {
  background: rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.35);
  transform: translateY(-1px);
}
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; display: block; }

/* ⭐ NEW — دکمه‌های مخصوص موبایل */
.menu-toggle   { display: none; }
.filter-toggle { display: none; }
.filter-toggle.active {
  background: rgba(255,255,255,.32);
  border-color: rgba(255,255,255,.45);
}

/* ==========================================================
   User chip
   ========================================================== */
.user-chip { position: relative; z-index: 600; }
.user-chip-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.20);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  color: #fff;
  backdrop-filter: blur(10px);
}
.user-chip-btn:hover { background: rgba(255,255,255,.25); }
.user-chip-btn .user-info { text-align: right; line-height: 1.35; }
.user-chip-btn .user-info strong { font-size: 12.5px; display: block; color: #fff; font-weight: 600; }
.user-chip-btn .user-info small { font-size: 10.5px; color: rgba(255,255,255,.80); }
.user-chip-btn .avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,.95);
  color: var(--brand-darker);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0,0,0,.12);
}
.user-chip-btn .chevron {
  color: rgba(255,255,255,.85);
  transition: transform .22s;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
.user-chip.open .user-chip-btn .chevron { transform: rotate(180deg); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 230px;
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--border-2);
  border-top: 3px solid var(--brand);
  box-shadow: 0 24px 60px rgba(15,25,34,.18), 0 4px 12px rgba(15,25,34,.08);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 9999;
  pointer-events: none;
}
.user-chip.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
  text-align: right;
}
.dropdown-item + .dropdown-item { margin-top: 2px; }
.dropdown-item:hover { background: var(--brand-soft); color: var(--brand-darker); }
.dropdown-item svg { width: 18px; height: 18px; stroke: currentColor; fill: none; flex-shrink: 0; }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: #FEF2F2; color: #991B1B; }

/* ==========================================================
   Page content
   ========================================================== */
.page-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 12px;
  padding-left: 4px;
}
.page-scroll::-webkit-scrollbar { width: 6px; }
.page-scroll .table-wrap,
.page-scroll .table-scroll { flex: none; min-height: 0; }

/* ==========================================================
   Filter bar
   ========================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--white);
  border: 1px solid var(--border-1);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
[data-theme="dark"] .filter-bar { background: var(--surface); }

.filter-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--field-h);
  padding: 0 14px;
  background: var(--bg-1);
  border: 1.5px solid var(--border-1);
  border-radius: 12px;
  transition: var(--transition);
  flex-shrink: 0;
}
[data-theme="dark"] .filter-field { background: rgba(10,20,24,.5); }
.filter-field:focus-within {
  border-color: var(--brand);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(0,191,166,.10);
}
.filter-field svg { width: 16px; height: 16px; color: var(--brand); flex-shrink: 0; stroke: currentColor; fill: none; }
.filter-field label { font-size: 12px; color: var(--text-2); font-weight: 600; white-space: nowrap; margin: 0; }
.filter-field input,
.filter-field select {
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-1);
  height: 100%;
  padding: 0 4px;
  min-width: 0;
  font-weight: 500;
}
.filter-field input[type="text"] { width: 110px; text-align: center; letter-spacing: 0.5px; direction: ltr; font-variant-numeric: tabular-nums; }
.filter-field select { cursor: pointer; }
.filter-submit { height: 42px; padding: 0 18px; font-size: 12.5px; flex-shrink: 0; }
.filter-reset { height: 42px; padding: 0 18px; font-size: 12.5px; flex-shrink: 0; }

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 22px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(0,191,166,.28); }
.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,191,166,.35);
}
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; height: 50px; font-size: 14.5px; border-radius: 12px; }
.btn-outline { background: var(--white); border: 1.5px solid var(--border-2); color: var(--text-1); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; color: #fff; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 12.5px; border-radius: 10px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn-mini {
  height: 32px;
  padding: 0 12px;
  font-size: 11.5px;
  border-radius: 8px;
  cursor: pointer;
  background: var(--brand-soft);
  color: var(--brand-darker);
  border: 1px solid var(--border-3);
  transition: var(--transition);
  font-family: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  gap: 4px;
}
.btn-mini:hover {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,191,166,.25);
}
.btn-mini svg { width: 13px; height: 13px; stroke: currentColor; fill: none; }
.btn-mini.danger { background: rgba(239,68,68,.10); color: var(--danger); border-color: rgba(239,68,68,.15); }
.btn-mini.danger:hover { background: var(--danger); color: #fff; }

/* ==========================================================
   Forms
   ========================================================== */
.form-group { margin-bottom: 16px; text-align: right; }
.form-group label {
  display: block;
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-1);
}
.form-control {
  width: 100%;
  height: var(--field-h);
  padding: 0 16px;
  border: 1.5px solid var(--border-2);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  background: var(--white);
  color: var(--text-1);
  outline: none;
}
.form-control::placeholder { color: var(--text-3); }
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(0,191,166,.10); }
textarea.form-control { height: auto; min-height: 80px; padding: 12px 16px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}
.form-grid label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  height: var(--field-h);
}
.form-grid input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* ==========================================================
   Panels & Cards
   ========================================================== */
.card, .glass {
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
[data-theme="dark"] .card,
[data-theme="dark"] .glass { background: var(--surface); }
.glass:hover { box-shadow: var(--shadow-md); }

.panel {
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
}
[data-theme="dark"] .panel { background: var(--surface); }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-1);
}
.panel-head h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.panel-head h3::before {
  content: '';
  width: 3px;
  height: 14px;
  border-radius: 3px;
  background: var(--brand);
  flex-shrink: 0;
}
.panel-body { padding: 18px; }

/* ==========================================================
   KPI Cards
   ========================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  flex-shrink: 0;
}
@media (max-width: 1400px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-grid.kpi-8 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .kpi-grid.kpi-8 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .kpi-grid.kpi-8 { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  transition: transform .28s cubic-bezier(.4,0,.2,1), box-shadow .28s;
  min-height: 104px;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: none;
  color: #fff;
  isolation: isolate;
}
.kpi-card.k1 { background: var(--card-1); box-shadow: 0 6px 16px rgba(38,166,154,.28); }
.kpi-card.k2 { background: var(--card-2); box-shadow: 0 6px 16px rgba(255,112,67,.28); }
.kpi-card.k3 { background: var(--card-3); box-shadow: 0 6px 16px rgba(126,87,194,.28); }
.kpi-card.k4 { background: var(--card-4); box-shadow: 0 6px 16px rgba(66,165,245,.28); }
.kpi-card.k5 { background: var(--card-5); box-shadow: 0 6px 16px rgba(255,167,38,.28); }
.kpi-card.k6 { background: var(--card-6); box-shadow: 0 6px 16px rgba(236,64,122,.28); }
.kpi-card.k7 { background: var(--card-7); box-shadow: 0 6px 16px rgba(171,71,188,.28); }
.kpi-card.k8 { background: var(--card-8); box-shadow: 0 6px 16px rgba(92,107,192,.28); }
.kpi-card.k-positive { background: #10B981; box-shadow: 0 6px 16px rgba(16,185,129,.28); }
.kpi-card.k-negative { background: #EF4444; box-shadow: 0 6px 16px rgba(239,68,68,.28); }
.kpi-card:hover { transform: translateY(-3px); }

.kpi-watermark {
  position: absolute;
  bottom: -25px;
  left: -20px;
  width: 120px;
  height: 120px;
  opacity: .13;
  color: #fff;
  pointer-events: none;
  z-index: 0;
  transform: rotate(-8deg);
  transition: opacity .35s, transform .35s;
}
.kpi-watermark svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.2; fill: none; display: block; }
.kpi-card:hover .kpi-watermark { opacity: .21; transform: rotate(-8deg) scale(1.05); }

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.30);
  align-self: flex-start;
  color: #fff;
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 1;
}
.kpi-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.kpi-body { display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }
.kpi-label { font-size: 11px; color: rgba(255,255,255,.90); margin-bottom: 2px; font-weight: 600; }
.kpi-value {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0,0,0,.10);
}
.kpi-hint { font-size: 10px; color: rgba(255,255,255,.78); margin-top: 2px; font-weight: 500; }

.dashboard-frozen .kpi-card { min-height: 92px; padding: 12px 14px; }
.dashboard-frozen .kpi-value { font-size: 17px; }
.dashboard-frozen .kpi-icon { width: 32px; height: 32px; }
.dashboard-frozen .kpi-icon svg { width: 16px; height: 16px; }

/* ==========================================================
   Dashboard frozen + scroll
   ========================================================== */
.dashboard-frozen {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dashboard-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 12px;
  padding-left: 4px;
}
.dashboard-scroll::-webkit-scrollbar { width: 6px; }

/* ==========================================================
   Mini stats
   ========================================================== */
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; flex-shrink: 0; }
@media (max-width: 900px) { .mini-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .mini-stats { grid-template-columns: 1fr; } }

.mini-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--border-1);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
[data-theme="dark"] .mini-stat { background: var(--surface); }
.mini-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mini-stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.mini-stat-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.mini-stat-icon.ok     { background: rgba(16,185,129,.12);  color: #059669; }
.mini-stat-icon.warn   { background: rgba(245,158,11,.12);  color: #B45309; }
.mini-stat-icon.info   { background: rgba(59,130,246,.12);  color: #1E40AF; }
.mini-stat-icon.danger { background: rgba(239,68,68,.12);   color: #B91C1C; }
.mini-stat-icon.purple { background: rgba(126,87,194,.12);  color: #6A47A8; }
.mini-stat-body { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.mini-stat-label { font-size: 11px; color: var(--text-2); font-weight: 600; }
.mini-stat-value { font-size: 15px; font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }

/* ==========================================================
   Charts
   ========================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  flex-shrink: 0;
}
@media (max-width: 760px) { .charts-grid { grid-template-columns: 1fr; } }

/* ⭐ NEW — دو کارت داشبورد (بودجه + پرهزینه‌ترین اقلام) */
.dashboard-two-col {
  grid-template-columns: 2fr 1fr;
}
@media (max-width: 900px) {
  .dashboard-two-col { grid-template-columns: 1fr; }
}

.chart-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  height: 320px;
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .chart-card { background: var(--surface); }
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}
.chart-head h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.chart-head h3::before {
  content: '';
  width: 3px;
  height: 14px;
  border-radius: 3px;
  background: var(--brand);
  flex-shrink: 0;
}
.chart-body { position: relative; flex: 1; min-height: 0; }
.chart-body canvas { display: block !important; width: 100% !important; height: 100% !important; }

.chart-fullscreen-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-soft);
  border: 1px solid var(--border-3);
  color: var(--brand-darker);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition);
  flex-shrink: 0;
  padding: 0;
  font-family: inherit;
}
.chart-fullscreen-btn:hover {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(0,191,166,.28);
}
.chart-fullscreen-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; }
.chart-fullscreen-btn .icon-compress { display: none; }
.chart-fullscreen-btn.active .icon-expand { display: none; }
.chart-fullscreen-btn.active .icon-compress { display: block; }

.chart-card:fullscreen,
.chart-card.is-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  padding: 24px 32px !important;
  background: var(--white) !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: none !important;
  border: none !important;
  overflow: hidden !important;
  margin: 0 !important;
}
.chart-card.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 50000 !important;
}
[data-theme="dark"] .chart-card:fullscreen,
[data-theme="dark"] .chart-card.is-fullscreen { background: var(--bg-1) !important; }
.chart-card:fullscreen .chart-head,
.chart-card.is-fullscreen .chart-head {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--border-2);
  flex-shrink: 0;
}
.chart-card:fullscreen .chart-head h3,
.chart-card.is-fullscreen .chart-head h3 { font-size: 18px; font-weight: 800; }

/* ==========================================================
   Tables
   ========================================================== */
.table-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .table-wrap { background: var(--surface); }

.table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: rgba(0,191,166,.30); border-radius: 8px; }

.table-modern { width: 100%; border-collapse: collapse; font-size: 12px; }
.table-modern th,
.table-modern td {
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-1);
  border-left: 1px solid var(--border-1);
}
.table-modern th:last-child,
.table-modern td:last-child { border-left: none; }
.table-modern tr:last-child td { border-bottom: none; }
.table-modern thead th {
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 700;
  color: var(--text-1);
  font-size: 11.5px;
  border-bottom: 2px solid var(--border-2);
}
[data-theme="dark"] .table-modern thead th { background: rgba(10,20,24,.7); }
.table-modern tbody tr:nth-child(even) { background: rgba(0,191,166,.025); }
.table-modern tbody tr:hover { background: rgba(0,191,166,.07); }
.table-modern .mono { font-variant-numeric: tabular-nums; direction: rtl; }
.table-modern .strong { font-weight: 700; color: var(--brand-darker); }
.table-modern .trunc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.table-modern .empty { text-align: center; padding: 40px; color: var(--text-3); }

/* ==========================================================
   Badges
   ========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-essential { background: var(--brand-soft); color: var(--brand-darker); border-color: var(--border-3); }
.badge-semi      { background: rgba(245,158,11,.10); color: #B45309; border-color: rgba(245,158,11,.20); }
.badge-fun       { background: rgba(236,64,122,.10); color: #BE185D; border-color: rgba(236,64,122,.20); }
.badge-success   { background: rgba(16,185,129,.10); color: #047857; border-color: rgba(16,185,129,.20); }
.badge-danger    { background: rgba(239,68,68,.10);  color: #B91C1C; border-color: rgba(239,68,68,.20); }
.badge-neutral   { background: var(--bg-2); color: var(--text-2); border-color: var(--border-1); }

/* ==========================================================
   Progress
   ========================================================== */
.progress-info { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.progress {
  flex: 1;
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}
.progress > div { height: 100%; border-radius: 4px; transition: width .5s ease; background: var(--brand); }
.progress.warn > div   { background: var(--warning); }
.progress.danger > div { background: var(--danger); }
.progress-info small {
  color: var(--text-2);
  font-size: 11px;
  min-width: 36px;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ==========================================================
   Alerts
   ========================================================== */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  flex-shrink: 0;
  animation: slideIn .3s ease both;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.alert-danger  { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.alert-success { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
[data-theme="dark"] .alert-danger  { background: rgba(239,68,68,.12);  color: #FCA5A5; }
[data-theme="dark"] .alert-success { background: rgba(16,185,129,.12); color: #6EE7B7; }

/* ==========================================================
   Scrollbar
   ========================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,191,166,.30); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,191,166,.50); }

/* ==========================================================
   Modal
   ========================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,25,34,.60);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 20px;
  overflow: auto;
}
.modal-overlay.active { display: flex; }
.modal {
  position: relative;
  background: var(--white);
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  border: 1px solid var(--border-1);
  overflow: hidden;
  animation: modalIn .3s cubic-bezier(.4,0,.2,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
  background: var(--brand-soft);
}
.modal-header h3 { font-size: 15px; font-weight: 700; color: var(--brand-darker); margin: 0; }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: rgba(0,191,166,.10);
  color: var(--brand-darker);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: #fff; transform: rotate(90deg); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-1);
  background: var(--white);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.modal-footer .btn { flex: 1 1 auto; }

/* ==========================================================
   Sticky total (monthly)
   ========================================================== */
.sticky-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--white);
  border: 1px solid var(--border-1);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  position: sticky;
  bottom: 12px;
  z-index: 20;
}
[data-theme="dark"] .sticky-total { background: var(--surface); }
.sticky-total .total-label { font-size: 11px; color: var(--text-3); font-weight: 700; }
.sticky-total .total-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-darker);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================
   Empty state
   ========================================================== */
.empty-state { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty-state svg { width: 44px; height: 44px; stroke: currentColor; fill: none; margin: 0 auto 10px; opacity: .35; }
.empty-state p { font-size: 13px; }

/* ==========================================================
   Footer
   ========================================================== */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0 10px;
  font-size: 11.5px;
  color: var(--text-3);
  flex-shrink: 0;
  font-weight: 500;
}

/* ==========================================================
   Login
   ========================================================== */
body.login-body {
  background: linear-gradient(135deg, #003D34 0%, #00BFA6 100%) !important;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: auto;
  height: auto;
  min-height: 100vh;
  position: relative;
}
body.login-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255,255,255,.10) 0%, transparent 40%);
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,.98);
  backdrop-filter: blur(24px);
  border-radius: 24px;
  padding: 44px 38px 32px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 32px 80px rgba(0,0,0,.24), 0 0 0 1px rgba(255,255,255,.6) inset;
  animation: loginSlide .6s cubic-bezier(.4,0,.2,1) both;
}
@keyframes loginSlide { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
.login-brand { margin-bottom: 26px; }
.login-logo {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #00BFA6 0%, #00967F 100%);
  box-shadow: 0 12px 30px rgba(0,191,166,.35);
  color: #fff;
}
.login-logo svg { width: 44px; height: 44px; stroke: currentColor; fill: none; }
.login-brand h1 { font-size: 22px; font-weight: 700; color: #003D34; line-height: 1.35; }
.login-brand p { margin-top: 6px; color: #5A6B78; font-size: 13.5px; }
.login-card .form-group { text-align: right; }
.login-card .form-control { height: 50px; border-radius: 12px; }
.login-card .btn-block { margin-top: 8px; }

.security-badges {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed rgba(0,191,166,.25);
}
.security-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #5A6B78;
  font-size: 11px;
  font-weight: 500;
  transition: var(--transition);
}
.security-badge:hover { color: var(--brand-dark); }
.security-badge svg {
  width: 28px;
  height: 28px;
  stroke: var(--brand);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: var(--transition);
}
.security-badge:hover svg { transform: translateY(-3px); filter: drop-shadow(0 6px 14px rgba(0,191,166,.35)); }

.pwd-input { position: relative; display: flex; align-items: center; }
.pwd-input .form-control { padding-left: 46px; }
.pwd-toggle {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition);
}
.pwd-toggle:hover { background: var(--brand-soft); color: var(--brand-darker); }
.pwd-toggle.active { background: var(--brand-light); color: var(--brand-darker); }
.pwd-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 1200px) {
  .main-content { padding: 14px 16px 0; }
}

@media (max-width: 900px) {
  html, body { overflow: auto; height: auto; }
  .app-layout { height: auto; min-height: 100vh; }
  .main-content {
    height: auto;
    overflow: visible;
    padding: 14px;
    gap: 12px;
  }
  .page-content { overflow: visible; height: auto; }
  .dashboard-frozen,
  .dashboard-scroll,
  .page-scroll {
    overflow: visible;
    flex: none;
    min-height: auto;
    padding-bottom: 0;
    padding-left: 0;
  }
  .dashboard-scroll { padding-bottom: 24px; }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-w-open) !important;
    transform: translateX(100%);
    box-shadow: -20px 0 60px rgba(0,0,0,.25);
    transition: transform var(--transition-slow);
    z-index: 99999;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .brand-text { opacity: 1; max-height: 80px; }
  .sidebar .nav-label { display: inline-block; }
  .sidebar .nav-link { justify-content: flex-start; padding: 0 13px; gap: 13px; }
  .sidebar .sidebar-toggle { display: none; }
  .sidebar .nav-section-label { opacity: 1; max-height: 30px; }

  /* ⭐ NEW — استفاده از grid برای center کردن آیکون در دکمه‌ها */
  .menu-toggle   { display: grid; }
  .filter-toggle { display: grid; }

  /* ⭐ NEW — فیلتر بار در موبایل پیش‌فرض بسته */
  .filter-bar { display: none; }
  .filter-bar.mobile-open { display: flex; }

  .table-wrap { flex: none; }
  .table-scroll { max-height: 65vh; }
  .user-chip-btn .user-info { display: none; }
  .user-dropdown { left: auto; right: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid.kpi-8 { grid-template-columns: repeat(2, 1fr); }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .chart-card { min-height: 280px; height: 280px; }
  .topbar h2 { font-size: 15px; }

  .filter-field { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .filter-field input[type="text"] { width: 100%; }
  .filter-submit, .filter-reset { flex: 1 1 calc(50% - 4px); }
}

@media (max-width: 768px) {
  .table-modern { font-size: 11px; }
  .table-modern th,
  .table-modern td { padding: 8px 10px; }
  .table-modern thead th { font-size: 10.5px; }
  .card.panel { border-radius: 12px; }
  .page-scroll { padding-bottom: 80px; }
  .sticky-total {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    margin: 0;
    z-index: 30;
  }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .kpi-grid,
  .kpi-grid.kpi-8,
  .mini-stats { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .filter-field { flex: 1 1 100%; }
  .filter-submit, .filter-reset { flex: 1 1 100%; }
  .chart-card { min-height: 260px; height: 260px; padding: 14px; }
  .table-modern { font-size: 10.5px; }
  .table-modern th,
  .table-modern td { padding: 6px 8px; }
}

@media (max-width: 480px) {
  .modal-overlay { padding: 10px; }
  .modal { border-radius: 16px; }
  .modal-footer .btn { flex: 1 1 100%; }
}