/* ==============================================
   v7 Design System — Extracted from design preview
   Layout, sidebar, navigation, dashboard components
   ============================================== */

:root {
  --sb-w: 250px;
  --sb-cw: 72px;
}

/* ======== LAYOUT ======== */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ======== SIDEBAR ======== */
.sidebar {
  width: var(--sb-w);
  background: var(--color-white);
  border-right: 1px solid var(--color-gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: width .3s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}

/* Collapsed state */
.layout.collapsed .sidebar {
  width: var(--sb-cw);
}

.sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}

.sb-logo {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 3px 10px rgba(255, 87, 87, .25);
  flex-shrink: 0;
}

.sb-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
  transition: opacity .3s, max-width .3s;
  max-width: 200px;
}

.layout.collapsed .sb-brand {
  opacity: 0;
  max-width: 0;
  margin: 0;
}

/* Hamburger in sidebar header */
.sb-toggle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: none;
  background: var(--color-gray-100);
  border-radius: 8px;
  color: var(--color-gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}

.sb-toggle:hover {
  background: var(--color-gray-200);
  color: var(--color-gray-900);
}

/* Collapsed header: stack logo on top, toggle below */
.layout.collapsed .sidebar-header {
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  align-items: center;
}

.sidebar-nav {
  padding: 8px 6px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-sec {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-gray-400);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 12px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .2s, max-height .3s, padding .3s;
  max-height: 40px;
}

.layout.collapsed .nav-sec {
  opacity: 0;
  max-height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

/* Collapsed: show thin separator instead of section label */
.layout.collapsed .nav-sec + .nav-item {
  margin-top: 6px;
}

.layout.collapsed .nav-sec::after {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--color-gray-200);
  margin: 0 auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-gray-600);
  transition: all .2s;
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-800);
}

.nav-item.active {
  background: rgba(255, 87, 87, .08);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  background: var(--color-primary);
  border-radius: 0 4px 4px 0;
}

.ni {
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex-shrink: 0;
}

.nav-lbl {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity .2s, max-width .3s;
  max-width: 200px;
}

.layout.collapsed .nav-lbl {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}

.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: #fee2e2;
  color: #ef4444;
  white-space: nowrap;
  transition: opacity .2s, max-width .3s;
  max-width: 50px;
}

.nb-blue {
  background: #dbeafe;
  color: #3b82f6;
}

.layout.collapsed .nav-badge {
  opacity: 0;
  max-width: 0;
  padding: 0;
  overflow: hidden;
}

.layout.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
  gap: 0;
}

/* Tooltip on collapsed items */
.nav-item .nav-tip {
  display: none;
  position: absolute;
  left: calc(var(--sb-cw) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-gray-800);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 300;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  pointer-events: none;
}

.nav-item .nav-tip::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--color-gray-800);
}

.layout.collapsed .nav-item:hover .nav-tip {
  display: block;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--color-gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.sf-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.sf-info {
  flex: 1;
  overflow: hidden;
  transition: opacity .2s, max-width .3s;
  max-width: 200px;
}

.sf-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-800);
  white-space: nowrap;
}

.sf-role {
  font-size: 11px;
  color: var(--color-gray-500);
  white-space: nowrap;
}

.sf-logout {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border: none;
  background: transparent;
  color: var(--color-gray-400);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.sf-logout:hover {
  background: #fee2e2;
  color: #ef4444;
}

.layout.collapsed .sf-info {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}

.layout.collapsed .sf-logout {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}

.layout.collapsed .sidebar-footer {
  justify-content: center;
  padding: 10px 8px;
}

/* ======== MAIN ======== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sb-w);
  transition: margin-left .3s cubic-bezier(.4, 0, .2, 1);
}

.layout.collapsed .main {
  margin-left: var(--sb-cw);
}

/* ======== TOP BAR ======== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 24px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-gray-200);
  background: var(--color-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-600);
  transition: all .2s;
  position: relative;
}

.topbar-btn:hover {
  background: var(--color-gray-50);
  border-color: var(--color-gray-300);
  color: var(--color-gray-900);
}

.topbar-btn svg {
  width: 17px;
  height: 17px;
}

.notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid white;
}

/* ======== TOPBAR LAYOUT ======== */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-burger {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--color-gray-200);
  background: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  color: var(--color-gray-600);
}
.topbar-burger:hover {
  background: var(--color-gray-50);
  box-shadow: var(--shadow-sm);
}
.topbar-burger svg {
  width: 18px;
  height: 18px;
}
.topbar-greeting {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-greeting span {
  color: var(--color-primary);
  font-weight: 700;
}
.topbar-left {
  min-width: 0;
  overflow: hidden;
}
.topbar-left > div {
  min-width: 0;
  overflow: hidden;
}
.topbar-sub {
  font-size: 12px;
  color: var(--color-gray-400);
  margin-top: 1px;
}

/* ======== BANNER ======== */
.page-banner {
  background: linear-gradient(135deg, #ff5757 0%, #ff7b7b 40%, #ff9a9a 100%);
  color: white;
  padding: 14px 28px;
  position: relative;
  overflow: hidden;
}

.page-banner::before {
  content: '';
  position: absolute;
  top: -80%;
  right: -5%;
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, .07);
  border-radius: 50%;
}

.page-banner::after {
  content: '';
  position: absolute;
  bottom: -90%;
  left: -3%;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, .04);
  border-radius: 50%;
}

.ban-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.ban-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ban-icon {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, .2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ban-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.ban-sub {
  font-size: 12px;
  opacity: .85;
  margin-top: 2px;
}

.ban-date {
  font-size: 12px;
  opacity: .8;
  text-align: right;
}

.ban-date strong {
  display: block;
  font-size: 13px;
  opacity: 1;
}

/* ======== DASHBOARD ======== */
.dash {
  padding: 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  width: 100%;
}

/* Center .dash only in customer portal (no sidebar) */
.topnav-content .dash {
  max-width: 1400px;
  margin: 0 auto;
}

/* ======== SECTIONS ======== */
.sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sec-l {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-bar {
  width: 3px;
  height: 18px;
  background: var(--color-primary);
  border-radius: 3px;
}

.sec-t {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-gray-900);
}

.sec-a {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}

.sec-a:hover {
  color: var(--color-primary-dark);
}

/* ======== STAT CARDS ======== */
.sg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

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

.sg3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ---- Professional White Card Design (all portals) ---- */
.sc {
  background: #ffffff;
  border-radius: 12px;
  padding: 0;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  transition: transform .25s ease, box-shadow .25s ease;
  color: #111827;
  text-decoration: none;
}

.sc:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.06);
  color: #111827;
}

/* Accent bar at top via ::before */
.sc::before {
  content: '';
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: 0;
  background: #e5e7eb;
  display: block;
}

.sc::after {
  display: none;
}

/* Color variants — accent bar + icon bg */
.c-bl { border-color: #e5e7eb; }
.c-bl::before { background: linear-gradient(90deg, #3b82f6, #93c5fd); }
.c-bl .sc-i { background: #eff6ff; color: #3b82f6; }
.c-bl:hover { box-shadow: 0 8px 24px rgba(59,130,246,0.1); }

.c-or { border-color: #e5e7eb; }
.c-or::before { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.c-or .sc-i { background: #fffbeb; color: #d97706; }
.c-or:hover { box-shadow: 0 8px 24px rgba(245,158,11,0.1); }

.c-gn { border-color: #e5e7eb; }
.c-gn::before { background: linear-gradient(90deg, #10b981, #6ee7b7); }
.c-gn .sc-i { background: #ecfdf5; color: #059669; }
.c-gn:hover { box-shadow: 0 8px 24px rgba(16,185,129,0.1); }

.c-pr { border-color: #e5e7eb; }
.c-pr::before { background: linear-gradient(90deg, #8b5cf6, #c4b5fd); }
.c-pr .sc-i { background: #f5f3ff; color: #7c3aed; }
.c-pr:hover { box-shadow: 0 8px 24px rgba(139,92,246,0.1); }

.c-rd { border-color: #e5e7eb; }
.c-rd::before { background: linear-gradient(90deg, #ef4444, #fca5a5); }
.c-rd .sc-i { background: #fef2f2; color: #dc2626; }
.c-rd:hover { box-shadow: 0 8px 24px rgba(239,68,68,0.1); }

.c-in { border-color: #e5e7eb; }
.c-in::before { background: linear-gradient(90deg, #6366f1, #a5b4fc); }
.c-in .sc-i { background: #eef2ff; color: #4f46e5; }
.c-in:hover { box-shadow: 0 8px 24px rgba(99,102,241,0.1); }

.c-tl { border-color: #e5e7eb; }
.c-tl::before { background: linear-gradient(90deg, #14b8a6, #5eead4); }
.c-tl .sc-i { background: #f0fdfa; color: #0d9488; }
.c-tl:hover { box-shadow: 0 8px 24px rgba(20,184,166,0.1); }

.c-pk { border-color: #e5e7eb; }
.c-pk::before { background: linear-gradient(90deg, #ec4899, #f9a8d4); }
.c-pk .sc-i { background: #fdf2f8; color: #db2777; }
.c-pk:hover { box-shadow: 0 8px 24px rgba(236,72,153,0.1); }

/* Card top row — icon + trend */
.sc-t {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
  padding: 16px 18px 0;
}

/* Icon — colored bg instead of transparent */
.sc-i {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sc-i svg {
  width: 20px;
  height: 20px;
}

/* Trend badge */
.sc-tr {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: #f3f4f6;
  color: #6b7280;
}

.tr-up::before {
  content: '\2191';
}

.tr-dn::before {
  content: '\2193';
}

/* Card bottom row — value + label */
.sc-b {
  position: relative;
  z-index: 1;
  padding: 10px 18px 16px;
}

.sc-v {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: 3px;
  color: #111827;
}

.sc-l {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  opacity: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ======== STATUS ROW ======== */
.sr {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.src {
  background: var(--color-white);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--color-gray-100);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .03);
  transition: all .25s;
  cursor: pointer;
}

.src:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .06);
}

.sd {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.sd-o {
  background: #f59e0b;
}

.sd-b {
  background: #3b82f6;
}

.sd-g {
  background: #10b981;
}

.sd-r {
  background: #ef4444;
}

.src-n {
  font-size: 22px;
  font-weight: 800;
  color: var(--color-gray-900);
  margin: 4px 0 2px;
}

.src-l {
  font-size: 11px;
  color: var(--color-gray-500);
  font-weight: 500;
}

.src-h {
  font-size: 11px;
  color: var(--color-gray-500);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ======== LOADING SKELETON (stat cards) ======== */
@keyframes sc-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.sc-v.sc-loading {
  color: transparent !important;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: sc-shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
  min-width: 40px;
  min-height: 24px;
  display: inline-block;
}
.sc-tr.sc-loading {
  color: transparent !important;
  background: #f0f0f0 !important;
  border-radius: 6px;
  min-width: 32px;
}
.sc-v.sc-error {
  color: #dc2626 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

/* ======== QUICK ACTIONS ======== */
.ag {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.ab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  background: var(--color-white);
  border: 1px solid var(--color-gray-100);
  border-radius: 12px;
  cursor: pointer;
  transition: all .25s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.ab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .06);
  border-color: rgba(255, 87, 87, .15);
}

.ab-i {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
}

.ab:hover .ab-i {
  transform: scale(1.08);
}

.ab-i svg {
  width: 18px;
  height: 18px;
}

.ir {
  background: rgba(255, 87, 87, .1);
  color: #ff5757;
}

.ib {
  background: #eff6ff;
  color: #3b82f6;
}

.ig {
  background: #ecfdf5;
  color: #10b981;
}

.ip {
  background: #faf5ff;
  color: #8b5cf6;
}

.io {
  background: #fffbeb;
  color: #f59e0b;
}

.ii {
  background: #eef2ff;
  color: #6366f1;
}

.ab-l {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-gray-700);
}

/* ======== TABLE ======== */
.tc {
  background: var(--color-white);
  border-radius: 14px;
  border: 1px solid var(--color-gray-100);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .03);
  overflow: hidden;
}

.tsc {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.at {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.at thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--color-gray-50);
  border-bottom: 1px solid var(--color-gray-200);
}

.at tbody td {
  padding: 11px 16px;
  font-size: 13px;
  color: var(--color-gray-700);
  border-bottom: 1px solid var(--color-gray-50);
  vertical-align: middle;
}

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

.at tbody tr:hover {
  background: var(--color-gray-50);
}

.tu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ta {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.ta1 {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.ta2 {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.ta3 {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.ta4 {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.ta5 {
  background: linear-gradient(135deg, #ec4899, #f472b6);
}

.tn {
  font-weight: 600;
  color: var(--color-gray-900);
  font-size: 12px;
}

.ts2 {
  font-size: 11px;
  color: var(--color-gray-500);
}

.bd {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
}

.bg {
  background: #ecfdf5;
  color: #10b981;
}

.bo {
  background: #fffbeb;
  color: #f59e0b;
}

.bb {
  background: #eff6ff;
  color: #3b82f6;
}

.br {
  background: #fef2f2;
  color: #ef4444;
}

.bp {
  background: #faf5ff;
  color: #8b5cf6;
}

.tam {
  font-weight: 700;
  color: var(--color-gray-900);
  font-size: 13px;
}

.tdt {
  color: var(--color-gray-500);
  font-size: 12px;
}

/* ======== BACK TO TOP ======== */
.btt {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(255, 87, 87, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all .3s;
  z-index: 90;
}

.btt.vis {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.btt:hover {
  box-shadow: 0 6px 20px rgba(255, 87, 87, .4);
  transform: translateY(-2px);
}

/* ======== RESPONSIVE ======== */
@media (max-width: 1279px) {
  .sg {
    grid-template-columns: repeat(2, 1fr);
  }
  .sg3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .ag {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1023px) {
  .sg,
  .sg2,
  .sg3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .sr {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .ag {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .dash {
    padding: 18px 16px;
    gap: 22px;
  }
  .page-banner {
    padding: 20px 16px;
  }
  .ban-title {
    font-size: 18px;
  }
  .ban-date {
    display: none;
  }
  .ban-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  .sc {
    padding: 14px 16px;
  }
  .sc-v {
    font-size: 22px;
  }
  .sc-i {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }
  .sc-i svg {
    width: 16px;
    height: 16px;
  }
  .sc-l {
    font-size: 10px;
  }
  .sc-tr {
    font-size: 9px;
    padding: 2px 6px;
  }
  .ab {
    padding: 14px 8px;
  }
  .ab-i {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
  .ab-i svg {
    width: 16px;
    height: 16px;
  }
  .ab-l {
    font-size: 10px;
  }
  .src-n {
    font-size: 20px;
  }
  .src {
    padding: 12px;
  }
  .src-l {
    font-size: 10px;
  }
  /* Hide sidebar on tablet — use mobile overlay pattern */
  .sidebar {
    width: 0;
    border: none;
    overflow: hidden;
  }
  .main {
    margin-left: 0;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .layout.expanded-mobile .sidebar {
    width: 260px !important;
    position: fixed !important;
    z-index: 300 !important;
    overflow: visible !important;
    overflow-y: auto !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .1) !important;
  }
  .layout.expanded-mobile .nav-lbl {
    opacity: 1 !important;
    max-width: 200px !important;
    width: auto !important;
    overflow: visible !important;
  }
  .layout.expanded-mobile .nav-item {
    justify-content: flex-start !important;
    padding: 9px 12px !important;
    gap: 10px !important;
  }
  .layout.expanded-mobile .nav-badge {
    opacity: 1 !important;
    max-width: 50px !important;
    width: auto !important;
    padding: 1px 7px !important;
  }
  .layout.expanded-mobile .sb-brand {
    opacity: 1 !important;
    max-width: 200px !important;
    width: auto !important;
    display: inline !important;
  }
  .layout.expanded-mobile .nav-sec {
    opacity: 1 !important;
    height: auto !important;
    padding: revert !important;
  }
  .layout.expanded-mobile .sf-info {
    opacity: 1 !important;
    max-width: 200px !important;
    width: auto !important;
    display: block !important;
  }
  .layout.expanded-mobile .sf-logout {
    opacity: 1 !important;
    display: flex !important;
  }
  .layout.expanded-mobile .sidebar-header {
    justify-content: flex-start !important;
  }
  .layout.expanded-mobile .sidebar-footer {
    justify-content: flex-start !important;
  }
  .layout.expanded-mobile .mob-overlay {
    display: block !important;
    opacity: 1 !important;
  }
  /* Touch targets */
  .sec-a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
  }
  /* Touch feedback */
  .sc:hover,
  .ab:hover,
  .src:hover {
    transform: none;
  }
  .sc:active,
  .ab:active,
  .src:active {
    transform: scale(.97);
    transition: transform .1s;
  }
}

@media (max-width: 767px) {
  .dash {
    padding: 14px 12px;
    gap: 18px;
  }
  .page-banner {
    padding: 16px 12px;
  }
  .ban-title {
    font-size: 16px;
  }
  .ban-sub {
    font-size: 11px;
  }
  .sg,
  .sg2,
  .sg3 {
    gap: 8px;
  }
  .sr {
    gap: 8px;
  }
  .ag {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .sc-t { padding: 12px 14px 0; }
  .sc-b { padding: 8px 14px 12px; }
  .sc-v { font-size: 20px; }
  .sc-l { font-size: 10px; }
  .sc-i { width: 34px; height: 34px; }
  .sc-i svg { width: 16px; height: 16px; }
  .ab {
    padding: 12px 6px;
    gap: 6px;
  }
  .ab-i {
    width: 34px;
    height: 34px;
  }
  .sec-t {
    font-size: 14px;
  }
  .topbar {
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  .dash {
    padding: 12px 10px;
    gap: 16px;
  }
  .page-banner {
    padding: 14px 10px;
  }
  .ban-title {
    font-size: 15px;
  }
  .ban-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
  .ban-icon svg {
    width: 18px;
    height: 18px;
  }
  .sg,
  .sg2,
  .sg3 {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sr {
    gap: 6px;
  }
  .ag {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .sc { border-radius: 10px; }
  .sc-t { padding: 10px 12px 0; }
  .sc-b { padding: 6px 12px 10px; }
  .sc-v { font-size: 18px; }
  .sc-l { font-size: 9px; }
  .sc-i { width: 28px; height: 28px; border-radius: 7px; }
  .sc-i svg { width: 14px; height: 14px; }
  .sc-tr { font-size: 8px; padding: 1px 5px; }
  .ab {
    padding: 10px 4px;
    gap: 5px;
    border-radius: 10px;
  }
  .ab-i {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
  .ab-i svg {
    width: 14px;
    height: 14px;
  }
  .ab-l {
    font-size: 10px;
  }
  .src {
    padding: 10px;
    border-radius: 10px;
  }
  .src-n {
    font-size: 18px;
  }
  .src-h {
    font-size: 10px;
  }
  .src-l {
    font-size: 9px;
  }
  .sec-t {
    font-size: 13px;
  }
  .sec-h {
    margin-bottom: 10px;
  }
  .sec-bar {
    width: 3px;
    height: 14px;
  }
  .sec-a {
    font-size: 11px;
  }
  /* Topbar compact */
  .topbar-greeting { font-size: 13px; }
  .topbar-burger { width: 34px; height: 34px; }
  .topbar-burger svg { width: 16px; height: 16px; }
  .topbar-btn { width: 32px; height: 32px; }
  .topbar-btn svg { width: 15px; height: 15px; }
  .topbar-left { gap: 10px; }
  .topbar-right { gap: 6px; }
}

@media (max-width: 360px) {
  .sc { border-radius: 8px; }
  .sc-t { padding: 8px 10px 0; }
  .sc-b { padding: 4px 10px 8px; }
  .sc-v { font-size: 16px; }
  .sc-i { width: 24px; height: 24px; border-radius: 6px; }
  .sc-i svg { width: 12px; height: 12px; }
  .sc-tr { font-size: 7px; padding: 1px 4px; }
  .src-n { font-size: 16px; }
  .ag { gap: 5px; }
}

/* ======== Mobile-specific layout (<=768px) ======== */
@media (max-width: 768px) {
  .topbar {
    padding: 8px 16px;
  }
  .topbar-sub {
    display: none;
  }
}

/* Mobile overlay */
.mob-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, .4);
  opacity: 0;
  transition: opacity .3s;
}
