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

:root {
  --bg:           #16293a;
  --surface:      #1d3348;
  --surface2:     #223c55;
  --surface3:     #1a2f42;
  --border:       rgba(255,255,255,0.07);
  --border-md:    rgba(255,255,255,0.14);
  --text:         #e8edf2;
  --text-2:       #9ab0c4;
  --text-3:       #5f7d95;
  --accent:       #4db89a;
  --accent-dark:  #3a9a7e;
  --accent-bg:    rgba(77,184,154,0.12);
  --green:        #4db89a;
  --green-bg:     rgba(77,184,154,0.15);
  --green-text:   #7dd4bb;
  --amber:        #e6a84a;
  --amber-bg:     rgba(230,168,74,0.15);
  --amber-text:   #f0c070;
  --red:          #d96060;
  --red-bg:       rgba(217,96,96,0.15);
  --red-text:     #f09090;
  --blue:         #5b9bd5;
  --blue-bg:      rgba(91,155,213,0.15);
  --blue-text:    #8ec4f0;
  --radius:       6px;
  --radius-lg:    10px;
  --font:         system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-heading: Georgia, 'Palatino Linotype', Palatino, serif;
  --mono:         ui-monospace, Consolas, 'Cascadia Mono', 'Courier New', monospace;
  --nav-h:        48px;
  --sidebar-w:    215px;
  --trans:        0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── RESET & BASE ─────────────────────────────────────────────────
   KEY FIX: No overflow:hidden on html/body. Instead we control
   scrolling precisely on each region. */
html { height: 100%; }
body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.15s ease;
}
body.page-ready { opacity: 1; }

/* ── PAGE LAYOUT ──────────────────────────────────────────────────
   The page is a fixed-height flex column:
   [nav: fixed 48px] + [shell: fills remaining viewport height]
   This lets each panel scroll independently. */
.page-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden; /* clips the shell, NOT the content inside */
}

/* ── SITE NAV ─────────────────────────────────────────────────── */
.site-nav {
  height: var(--nav-h);
  min-height: var(--nav-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 2px;
  position: relative;
  z-index: 300; /* above sidebar overlay */
  overflow: hidden; /* prevent nav from wrapping/expanding */
}

/* Hamburger — always visible on dashboard */
.sidebar-toggle {
  width: 36px; height: 36px; min-width: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius); color: var(--text-2);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.sidebar-toggle:hover { background: var(--surface2); color: var(--text); }
.sidebar-toggle svg { width: 18px; height: 18px; display: block; }

/* Logo */
.logo-area {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; flex-shrink: 0;
  margin: 0 8px 0 4px;
  min-width: 0;
}
.site-icon {
  width: 26px; height: 26px; min-width: 26px;
  background: var(--accent); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.site-icon svg { width: 16px; height: 16px; color: #fff; }
.site-logo-text {
  font-family: var(--font-heading);
  font-size: 14px; font-weight: 600;
  color: var(--text); white-space: nowrap;
}
.site-logo-text span { color: var(--accent); }

/* Desktop nav links — hidden on mobile */
.site-links {
  display: flex; gap: 1px;
  flex-shrink: 1; overflow: hidden;
}
.site-links a {
  font-size: 14px; color: var(--text-2);
  text-decoration: none; padding: 5px 9px;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.site-links a:hover { background: var(--surface2); color: var(--text); }
.site-links a.active { color: var(--accent); font-weight: 500; }

/* Spacer pushes right group to the right */
.nav-spacer { flex: 1; min-width: 0; }

/* Right group of icon buttons */
.nav-right {
  display: flex; align-items: center; gap: 1px;
  flex-shrink: 0;
}

.nav-divider {
  width: 1px; height: 18px;
  background: var(--border-md);
  margin: 0 4px; flex-shrink: 0;
}

/* Icon buttons in desktop nav */
.icon-btn {
  width: 34px; height: 34px; min-width: 34px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius); color: var(--text-2);
  flex-shrink: 0; position: relative;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; display: block; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); border: 1.5px solid var(--surface);
  pointer-events: none;
}
/* Tooltip — only on desktop */
.icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: -28px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border-md);
  font-size: 11px; padding: 2px 7px; border-radius: 5px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s; z-index: 999;
}
.icon-btn[data-tip]:hover::after { opacity: 1; }

/* Search bar */
.site-search {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg); border: 1px solid var(--border-md);
  border-radius: var(--radius); padding: 5px 10px;
  font-size: 12px; color: var(--text-3); cursor: pointer;
  width: 148px; flex-shrink: 0;
  transition: border-color 0.15s;
}
.site-search:hover { border-color: var(--accent); }
.site-search kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  background: var(--surface2); border: 1px solid var(--border-md);
  border-radius: 4px; padding: 1px 5px; color: var(--text-3);
}

/* Login button */
.btn-login {
  font-family: var(--font); font-size: 12px; font-weight: 500;
  padding: 5px 13px; border-radius: var(--radius);
  background: var(--accent); color: #0f2030;
  border: none; cursor: pointer; flex-shrink: 0; white-space: nowrap;
  transition: background 0.12s; text-decoration: none;
  display: inline-flex; align-items: center;
}

.btn-login:hover { background: var(--accent-dark); }

.btn-logout {
  font-family: var(--font); font-size: 12px; font-weight: 500;
  padding: 5px 13px; border-radius: var(--radius);
  background: var(--accent); color: #0f2030;
  border: none; cursor: pointer; flex-shrink: 0; white-space: nowrap;
  transition: background 0.12s; text-decoration: none;
  display: inline-flex; align-items: center;
  margin-right: 25px;
}



.btn-logout:hover { background: var(--accent-dark); }

/* Avatar */
.avatar {
  width: 28px; height: 28px; min-width: 28px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent);
  font-size: 10px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 1px solid rgba(77,184,154,0.3);
  flex-shrink: 0;
}

/* Mobile menu button (⋮) — hidden by default, shown on mobile */
.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px; min-width: 36px;
  align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius); color: var(--text-2);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.mobile-menu-btn:hover, .mobile-menu-btn.open { background: var(--surface2); color: var(--text); }
.mobile-menu-btn svg { width: 18px; height: 18px; display: block; }

/* ── MOBILE NAV MENU ──────────────────────────────────────────────
   Sits directly below the nav bar. Uses max-height transition so
   it reliably animates open/close without display:none conflicts. */
.mobile-menu {
  position: absolute;
  top: var(--nav-h);
  left: 0; right: 0;
  z-index: 290;
  background: var(--surface);
  border-bottom: 1px solid var(--border-md);
  /* Hidden state */
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4,0,0.2,1);
}
.mobile-menu.open {
  max-height: 420px; /* large enough for all content */
}
.mobile-menu-inner {
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Search inside mobile menu */
.mm-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border-md);
  border-radius: var(--radius); padding: 9px 12px;
  font-size: 13px;
}
.mm-search input {
  border: none; background: transparent;
  font-family: var(--font); font-size: 13px; color: var(--text);
  outline: none; flex: 1; min-width: 0;
}
.mm-search input::placeholder { color: var(--text-3); }
.mm-search svg { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; }

/* Page links inside mobile menu */
.mm-links {
  display: flex; flex-direction: column; gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.mm-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; font-size: 14px; color: var(--text-2);
  text-decoration: none; border-radius: var(--radius);
  transition: background 0.1s, color 0.1s;
}
.mm-link:hover { background: var(--surface2); color: var(--text); }
.mm-link.active { color: var(--accent); font-weight: 500; }
.mm-link-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--border-md); flex-shrink: 0;
}
.mm-link.active .mm-link-dot { background: var(--accent); }

/* Icon grid inside mobile menu — social + utility */
.mm-icons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.mm-icon-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; color: var(--text-2);
  font-family: var(--font); font-size: 0;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  position: relative; text-decoration: none;
  border: none; /* reset button */
  background: var(--bg);
  outline: 1px solid var(--border);
  outline-offset: -1px;
}
.mm-icon-btn:hover { background: var(--surface2); color: var(--accent); outline-color: var(--accent); }
.mm-icon-btn svg { width: 18px; height: 18px; flex-shrink: 0; display: block; }
.mm-icon-label { font-size: 9px; color: var(--text-3); text-align: center; line-height: 1.2; }
.mm-icon-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--accent); color: #0f2030;
  font-size: 9px; font-weight: 700;
  width: 14px; height: 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* Login row inside mobile menu */
.mm-login-row {
  display: flex; align-items: center; gap: 8px;
}

.mm-btn-login {
  font-family: var(--font); font-size: 12px; font-weight: 500;
  padding: 5px 13px; border-radius: var(--radius);
  background: var(--accent); color: #0f2030;
  border: none; cursor: pointer; flex-shrink: 0; white-space: nowrap;
  transition: background 0.12s; text-decoration: none;
  display: inline-flex; align-items: center;
}

.mm-avatar {
  width: 32px; height: 32px; min-width: 32px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent);
  font-size: 11px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(77,184,154,0.3);
}
.mm-login-row .mm-btn-login { flex: 1; justify-content: center; padding: 8px; font-size: 13px; }

/* ── APP SHELL ────────────────────────────────────────────────────
   KEY FIX: flex:1 + min-height:0 lets it fill remaining space.
   overflow:hidden clips children but each child scrolls itself. */
.app-shell {
  flex: 1;
  min-height: 0; /* critical — allows shrinking below content size */
  display: flex;
  position: relative;
  overflow: hidden;
}

/* ── SIDEBAR OVERLAY ──────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans);
}
.sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

/* ── SIDEBAR ──────────────────────────────────────────────────────
   KEY FIX: overflow-y:auto on the sidebar itself, not the shell.
   The sidebar is flex column, takes fixed width on desktop. */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface3);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;   /* sidebar scrolls independently */
  overflow-x: hidden;
  padding: 12px 0 24px;
  transition: width var(--trans), transform var(--trans);
  z-index: 210;
}
.sidebar.collapsed { width: 0; border-right-color: transparent; overflow: hidden; }

/* Sidebar header — only shown on mobile */
.sidebar-header {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
  flex-shrink: 0;
}
.sidebar-header-logo { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); font-family: var(--font-heading); }
.sidebar-close {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius); color: var(--text-2); font-size: 18px;
  transition: background 0.12s;
}
.sidebar-close:hover { background: var(--surface2); }

.nav-section-label {
  padding: 10px 16px 4px; font-size: 10px; font-weight: 500;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent); opacity: 0.7;
  white-space: nowrap; flex-shrink: 0;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; font-size: 13px; color: var(--text-2);
  cursor: pointer; user-select: none;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.open { color: var(--text); font-weight: 500; }
.nav-icon { width: 15px; height: 15px; margin-right: 9px; flex-shrink: 0; opacity: 0.5; }
.nav-item-inner { display: flex; align-items: center; }
.chevron { font-size: 10px; color: var(--text-3); transition: transform 0.15s; flex-shrink: 0; }
.nav-item.open .chevron { transform: rotate(90deg); }
.sub-nav { display: none; flex-shrink: 0; }
.sub-nav.open { display: block; }
.sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px 7px 33px; font-size: 12px; color: var(--text-2);
  cursor: pointer; white-space: nowrap;
  transition: color 0.1s, background 0.1s;
}
.sub-item:hover { color: var(--text); background: var(--surface2); }
.sub-item.active { color: var(--accent); font-weight: 500; }
.sub-item::before { content: ''; width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0; background: transparent; }
.sub-item.active::before { background: var(--accent); }
.nav-count {
  font-size: 10px; font-family: var(--mono);
  background: var(--surface2); color: var(--text-3);
  border-radius: 20px; padding: 1px 6px;
  border: 1px solid var(--border); margin-left: auto; flex-shrink: 0;
}

/* ── MAIN CONTENT ─────────────────────────────────────────────────
   KEY FIX: overflow-y:auto here, not on the shell. flex:1 fills space. */
.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  min-height: 0;
}

.content-header {
  padding: 20px 24px 16px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); margin-bottom: 5px; flex-wrap: wrap; }
.breadcrumb b { color: var(--text-2); font-weight: 400; }
.page-title { font-family: var(--font-heading); font-size: 20px; font-weight: 600; color: var(--accent); line-height: 1.2; }
.page-subtitle { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }

.btn {
  font-family: var(--font); font-size: 12px;
  padding: 6px 14px; border-radius: var(--radius);
  border: 1px solid var(--border-md);
  background: var(--surface2); color: var(--text-2);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.btn:hover { background: var(--surface3); color: var(--text); border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #0f2030; border-color: var(--accent); font-weight: 500; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #0f2030; }

.content-body { padding: 20px 24px 40px; }

/* ── METRIC CARDS ─────────────────────────────────────────────── */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; border-left: 3px solid var(--accent); }
.metric-label { font-size: 10px; color: var(--text-3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.metric-value { font-family: var(--font-heading); font-size: 22px; font-weight: 600; color: var(--text); line-height: 1; }
.metric-delta { font-size: 11px; margin-top: 5px; }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }

/* ── DATA TABLE ───────────────────────────────────────────────── */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.table-card2 {width:50%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.table-toolbar { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.table-title { font-family: var(--font-heading); font-size: 16px; font-weight: 600; color: var(--accent); }
.table-count { font-size: 14px; color: var(--text-3); margin-left: 8px; }
.table-search {
  font-family: var(--font); font-size: 12px;
  background: var(--bg); border: 1px solid var(--border-md);
  border-radius: var(--radius); padding: 5px 10px; color: var(--text);
  outline: none; width: 150px; transition: border-color 0.15s;
}
.table-search:focus { border-color: var(--accent); }
.table-search::placeholder { color: var(--text-3); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 16px; min-width: 600px; }
th { text-align: left; padding: 9px 14px; font-size: 10px; font-weight: 500; color: var(--accent); opacity: 0.8; background: var(--surface3); border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.07em; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }
td.muted { color: var(--text-3); font-family: var(--mono); font-size: 11px; }
td.secondary { color: var(--text-2); }

/* ── BADGES ───────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 500; padding: 3px 8px; border-radius: 20px; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.badge-green { background: var(--green-bg); color: var(--green-text); }
.badge-green::before { background: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber-text); }
.badge-amber::before { background: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red-text); }
.badge-red::before { background: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue-text); }
.badge-blue::before { background: var(--blue); }

/* ── SUMMARY LAYOUT ───────────────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.summary-card-title { font-family: var(--font-heading); font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 14px; }
.bar-row { display: flex; flex-direction: column; gap: 10px; }
.bar-item { display: flex; align-items: center; gap: 10px; }
.bar-label { font-size: 11px; color: var(--text-2); width: 68px; text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 5px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; }
.bar-val { font-size: 11px; color: var(--text-3); font-family: var(--mono); width: 32px; flex-shrink: 0; }
.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.activity-text { flex: 1; color: var(--text); }
.activity-time { color: var(--text-3); font-size: 11px; white-space: nowrap; }

/* ── MEDIA (video / audio / iframe) ──────────────────────────── */
.media-wrap {
  padding: 10px 14px 14px;
  border-bottom: 1px solid var(--border);
}
.media-wrap:last-child { border-bottom: none; }
.media-label {
  display: block;
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.media-wrap video,
.media-wrap iframe {
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: #000;
}
.media-wrap audio {
  display: block;
  width: 100%;
  max-width: 720px;
}

/* ── VIEW TRANSITION ──────────────────────────────────────────── */
.view { animation: fadeIn 0.14s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ── RESPONSIVE ───────────────────────────────────────────────────
   Three breakpoints: tablet (≤768), mobile (≤540), tiny (≤380)
   Strategy: keep nav simple — hamburger + logo + menu button only.
   Everything else moves into the slide-down mobile menu. */

/* TABLET ≤768px */
@media (max-width: 768px) {
  .site-links { display: none; }
  .site-search { display: none; }
  .nav-divider { display: none; }
  .icon-btn { display: none; }
  /* .avatar { display: none; } */
  /* .btn-login { display: none; }  */
  /* Show mobile menu button */
  .mobile-menu-btn { display: flex; }
  /* Mobile menu container needs display:block to animate with max-height */
  .mobile-menu { display: block; }
  /* Sidebar stays as desktop panel on tablet but narrower */
  --sidebar-w: 190px;
  /* Content padding reduced */
  .content-header { padding: 16px 18px 14px; }
  .content-body { padding: 16px 18px 32px; }
  .summary-grid { gap: 12px; }

.table-card2{
  width: 100%;
}

}

/* MOBILE ≤540px */
@media (max-width: 540px) {
  :root { --sidebar-w: 240px; } /* wider slide-in on phone */
  /* Hide hamburger text on nav, keep icons only */
  /* .site-logo-text { display: none; } */
  /* Sidebar becomes full overlay slide-in */
  .sidebar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    height: 100%;
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    box-shadow: 6px 0 30px rgba(0,0,0,0.5);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .sidebar-header { display: flex; }
  /* Main content takes full width */
  .content-header { padding: 14px 14px 12px; flex-direction: column; gap: 10px; }
  .content-body { padding: 12px 14px 32px; }
  .page-title { font-size: 18px; }
  .header-actions { padding-top: 0; }
  .summary-grid { grid-template-columns: 1fr; gap: 10px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* TINY ≤380px — handles 300px wide screens */
@media (max-width: 380px) {
  :root { --nav-h: 44px; --sidebar-w: 220px; }
  .site-nav { padding: 0 8px; gap: 1px; }
  .sidebar-toggle, .mobile-menu-btn { width: 32px; height: 32px; min-width: 32px; }
  .site-icon { width: 24px; height: 24px; min-width: 24px; }
  .metrics-grid { grid-template-columns: 1fr; gap: 8px; }
  .metric-value { font-size: 18px; }
  .content-header { padding: 12px 10px 10px; }
  .content-body { padding: 10px 10px 28px; }
  .mm-icons { grid-template-columns: repeat(5, 1fr); }
  .mm-icon-btn { padding: 8px 2px 6px; }
  .mm-icon-btn svg { width: 16px; height: 16px; }
  table { min-width: 280px; font-size: 11px; }
  th, td { padding: 8px 8px; }
  .table-search { width: 100%; }
  .table-toolbar { flex-direction: column; align-items: flex-start; }
}
