/* ============================================================
   BATTERY ADMIN — dashboard.css
   Fonts : Sora (display/brand) + DM Sans (body/UI)
   Palette: Indigo-primary · Emerald-secondary · Slate-neutrals
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* ─── TOKENS ─────────────────────────────────────────────────── */
:root {
  --font-display:       'Sora', system-ui, sans-serif;
  --font-body:          'DM Sans', system-ui, sans-serif;

  /* primary – indigo */
  --primary:            #4338ca;
  --primary-dark:       #3730a3;
  --primary-soft:       #eef2ff;
  --primary-ring:       rgba(67, 56, 202, 0.2);

  /* secondary – emerald */
  --secondary:          #059669;
  --secondary-soft:     #d1fae5;

  /* semantic */
  --danger:             #dc2626;
  --danger-soft:        #fee2e2;
  --warning:            #d97706;
  --warning-soft:       #fef3c7;
  --success:            #166534;
  --success-soft:       #dcfce7;

  /* sidebar */
  --sidebar-bg:         #0f172a;
  --sidebar-border:     #1e293b;
  --sidebar-text:       #94a3b8;
  --sidebar-hover:      #1e293b;
  --sidebar-active-bg:  #4338ca;
  --sidebar-label:      #475569;
  --sidebar-width:      268px;

  /* surfaces */
  --body-bg:            #f8fafc;
  --card-bg:            #ffffff;
  --surface2:           #f1f5f9;
  --border:             #e2e8f0;
  --text-main:          #0f172a;
  --text-muted:         #64748b;

  /* shadows */
  --shadow-sm:   0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md:   0 4px 12px rgba(15,23,42,.08);
  --shadow-lg:   0 12px 32px rgba(15,23,42,.12);

  /* misc */
  --radius:             12px;
  --radius-sm:          8px;
  --radius-xs:          6px;
  --radius-pill:        9999px;
  --header-height:      60px;
  --workspace-pad:      clamp(1.25rem, 3vw, 2rem);
}

/* ─── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: clamp(14px, 1.4vw, 15px);
  line-height: 1.6;
  color: var(--text-main);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── LAYOUT ─────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.sidebar-brand {
  padding: 1.375rem 1.5rem;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 1.125rem 0.875rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 3px; }

.sidebar-label {
  display: block;
  font-size: 0.675rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--sidebar-label);
  letter-spacing: 0.1em;
  padding: 0 0.625rem;
  margin: 0.75rem 0 0.375rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sidebar-text);
  transition: background 0.18s, color 0.18s;
  margin-bottom: 2px;
  text-decoration: none;
}
.sidebar-link:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--sidebar-active-bg); color: #fff; font-weight: 600; }
.sidebar-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* count badge inside nav link  (<strong> in sidebar.php) */
.sidebar-link strong {
  margin-left: auto;
  font-weight: 700;
  font-size: 0.7rem;
  background: rgba(255,255,255,0.12);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  font-family: var(--font-display);
}
.sidebar-link.active strong { background: rgba(255,255,255,0.22); }

.sidebar-foot {
  padding: 1.125rem 1.5rem;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.8rem;
  color: var(--sidebar-text);
  flex-shrink: 0;
  line-height: 1.6;
}
.sidebar-home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.625rem;
  color: #818cf8;
  font-weight: 600;
  font-size: 0.8rem;
  transition: color 0.18s;
}
.sidebar-home-link:hover { color: #a5b4fc; }

/* ─── SIDEBAR OVERLAY ────────────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.55);
  backdrop-filter: blur(3px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.is-visible { opacity: 1; pointer-events: all; }
/* hidden attr used by JS – override display so the class transition works */
.sidebar-overlay[hidden] { display: block !important; }

/* Sidebar open state – when hamburger is clicked */
.sidebar.is-open {
  transform: translateX(0);
}

body.sidebar-open {
  overflow: hidden;
}

/* ─── MOBILE NAV BAR ─────────────────────────────────────────── */
.mobile-nav-bar {
  display: none; /* shown via media query below */
  align-items: center;
  justify-content: space-between;
  padding: 0 1.125rem;
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1100;
  box-shadow: var(--shadow-sm);
}

/* brand text shown inside mobile nav bar */
.mobile-nav-bar .sidebar-brand {
  padding: 0;
  border: none;
  font-size: 1rem;
  color: var(--text-main);
  background: transparent;
}

/* ─── HAMBURGER ──────────────────────────────────────────────── */
.sidebar-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-main);
  transition: border-color 0.18s, background 0.18s;
  flex-shrink: 0;
}
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.28s cubic-bezier(0.4,0,0.2,1);
  transform-origin: center;
}
.sidebar-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.sidebar-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.sidebar-toggle:hover  { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.sidebar-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─── WORKSPACE ──────────────────────────────────────────────── */
.workspace {
  flex: 1;
  min-width: 0;
  padding: var(--workspace-pad);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── PAGE HEAD ──────────────────────────────────────────────── */
.page-head {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}
.page-head p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}
.page-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 3vw, 1.875rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text-main);
}

/* flex helpers used inline in the PHP files */
.aligned,
.d_flex_between {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: space-between;
}




/* ─── FLASH MESSAGES ─────────────────────────────────────────── */
.flash {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.flash.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: #86efac;
}
.flash.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fca5a5;
}

/* ─── NOTICE / WARNING BAR ───────────────────────────────────── */
.notice {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.875rem;
  line-height: 1.55;
}

/* ─── CARDS ──────────────────────────────────────────────────── */
.toolbar-card,
.table-card,
.editor-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem 1.375rem;
  box-shadow: var(--shadow-sm);
}

/* ─── SEARCH / TOOLBAR FORM ──────────────────────────────────── */
.search-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.field { flex: 1; min-width: 180px; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.375rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.5625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.875rem;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.field input::placeholder { color: #94a3b8; }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.search-btn {
  padding: 0.5625rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: background 0.18s, box-shadow 0.18s, transform 0.18s;
  align-self: flex-end;
}
.search-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(67,56,202,.3);
  transform: translateY(-1px);
}
.search-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.reset-btn {
  padding: 0.5625rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  transition: background 0.18s;
  align-self: flex-end;
}
.reset-btn:hover { background: #e2e8f0; color: var(--text-main); }

/* ─── TABLE META / CHIPS ─────────────────────────────────────── */
.table-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.875rem;
}
.table-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid #c7d2fe;
}

/* ─── TABLE ──────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.table-wrap::-webkit-scrollbar { height: 5px; }
.table-wrap::-webkit-scrollbar-track { background: var(--surface2); }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
thead tr { background: var(--surface2); }
th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-main);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: #fafbff; }
td.muted { color: var(--text-muted); font-size: 0.825rem; }

/* ─── MEDIA CELLS ────────────────────────────────────────────── */
.thumb {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}
.thumb-placeholder {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 16px;
}
.img-preview {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ─── ACTIONS CELL ───────────────────────────────────────────── */
.actions-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn,
.btn-icon,
.action-btn,
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  line-height: 1.3;
  text-decoration: none;
}
.btn:focus-visible,
.btn-icon:focus-visible,
.action-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* primary */
.action-btn.primary,
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.action-btn.primary:hover,
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(67,56,202,.35);
  transform: translateY(-1px);
}

/* secondary */
.action-btn.secondary,
.btn-secondary {
  background: var(--secondary-soft);
  color: var(--success);
}
.action-btn.secondary:hover,
.btn-secondary:hover { background: #bbf7d0; }

/* edit */
.btn-edit {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-edit:hover { background: #dde5ff; }

/* delete */
.btn-delete {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-delete:hover { background: #fecaca; }

/* WhatsApp */
.btn-wa {
  background: var(--success-soft);
  color: var(--success);
}
.btn-wa:hover { background: #bbf7d0; }

/* disabled */
.btn:disabled,
.btn-icon:disabled,
.action-btn:disabled { opacity: 0.45; pointer-events: none; }

/* ─── STATUS BADGES ──────────────────────────────────────────── */
.status-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* status-pill (categories) */
.status-pill          { background: var(--primary-soft); color: var(--primary); }
.status-pill.active   { background: var(--success-soft); color: var(--success); }
.status-pill.hidden   { background: var(--surface2);     color: var(--text-muted); }

/* status-badge (rfqs) */
.status-badge.pending   { background: var(--warning-soft); color: var(--warning); }
.status-badge.confirmed { background: var(--success-soft); color: var(--success); }
.status-badge.cancelled { background: var(--danger-soft);  color: var(--danger); }

/* ─── ITEMS LIST (RFQ) ───────────────────────────────────────── */
.items-list {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface2);
  margin: 0 auto 1rem;
}
.empty-state h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.375rem;
}
.empty-state p { font-size: 0.875rem; }

/* ─── BOOTSTRAP MODAL OVERRIDES ──────────────────────────────── */
.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-body);
}
.modal-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  gap: 0.625rem;
}

/* form-label inside Bootstrap modals */
.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.375rem;
}
.form-control,
.form-select {
  font-family: var(--font-body);
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: none;
}

/* Bootstrap btn resets inside modals */
.modal-footer .btn.btn-light {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 600;
}
.modal-footer .btn.btn-light:hover { background: #e2e8f0; color: var(--text-main); }
.modal-footer .btn.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-family: var(--font-display);
  font-weight: 700;
}
.modal-footer .btn.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(67,56,202,.3);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE MEDIA QUERIES — 768px (Tablet) & 425px (Mobile)
   ═══════════════════════════════════════════════════════════════ */

/* ─── LARGE SCREENS (> 1100px) – Desktop ────────────────────── */
@media (min-width: 1101px) {
  .mobile-nav-bar { display: none !important; }
  .sidebar { position: sticky !important; transform: translateX(0) !important; }
}

/* ─── RESPONSIVE (< 1100px) – Mobile & Tablet ────────────────── */
@media (max-width: 1100px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-nav-bar { display: flex; }
  .app-shell { flex-direction: column; }
}

/* ─── TABLET (768px) ─────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 268px;
    --workspace-pad: clamp(1rem, 2.5vw, 1.5rem);
    --header-height: 56px;
  }

  /* Mobile nav bar becomes visible */
  .mobile-nav-bar {
    display: flex !important;
    padding: 0 1.125rem;
    height: 56px;
  }

  /* Sidebar positioning on tablet – slides from left */
  .sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    width: 268px;
    height: calc(100vh - 56px);
    z-index: 1000;
    transform: translateX(-100%);
    border-right: 1px solid var(--sidebar-border);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  /* App shell layout adjustment */
  .app-shell { flex-direction: column; }

  /* Workspace adjusts for mobile nav */
  .workspace {
    flex: 1;
    margin-top: 56px;
    padding: 1rem;
    gap: 1.25rem;
  }

  /* Page head adjustments */
  .page-head h2 {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  }
  .page-head p {
    font-size: 0.75rem;
  }

  /* Flex helpers for tablet */
  .aligned,
  .d_flex_between {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .page-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  /* Cards and spacing */
  .toolbar-card,
  .table-card,
  .editor-card {
    padding: 1rem;
    border-radius: 8px;
  }

  /* Search form on tablet */
  .search-form {
    flex-direction: column;
    gap: 0.5rem;
  }
  .field { min-width: unset; }
  .search-btn,
  .reset-btn {
    width: 100%;
    align-self: stretch;
  }

  /* Table adjustments */
  table { font-size: 0.8rem; }
  th { padding: 0.625rem 0.75rem; font-size: 0.65rem; }
  td { padding: 0.75rem 0.75rem; }
  
  .thumb { width: 32px; height: 32px; }
  .thumb-placeholder { width: 32px; height: 32px; }
  .img-preview { width: 56px; height: 56px; }

  /* Buttons on tablet */
  .btn,
  .btn-icon,
  .action-btn,
  .submit-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.75rem;
    gap: 0.25rem;
  }

  /* Modal adjustments */
  .modal-header { padding: 1rem; }
  .modal-body { padding: 1rem; }
  .modal-footer { padding: 0.875rem; gap: 0.5rem; }
  
  .form-label { font-size: 0.75rem; }
  .form-control,
  .form-select { font-size: 0.8rem; padding: 0.5rem 0.75rem; }

  /* Empty state on tablet */
  .empty-state { padding: 3rem 1.5rem; }
  .empty-icon { width: 48px; height: 48px; }
  .empty-state h4 { font-size: 0.95rem; }
  .empty-state p { font-size: 0.8rem; }

  /* Status badges */
  .status-pill,
  .status-badge { padding: 0.2rem 0.5rem; font-size: 0.65rem; }

  /* Field spacing */
  .field input,
  .field select,
  .field textarea {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  /* Hide overflow in actions cell more gracefully */
  .actions-cell {
    gap: 0.25rem;
  }

  /* Chip adjustments */
  .chip { padding: 0.2rem 0.6rem; font-size: 0.7rem; }

  /* Table meta */
  .table-meta { gap: 0.375rem; }
  .table-top { gap: 0.5rem; margin-bottom: 0.75rem; }

  /* Hamburger button on tablet */
  .sidebar-toggle {
    width: 40px;
    height: 40px;
    gap: 5px;
  }
  .sidebar-toggle span { width: 18px; height: 2px; }

  /* Overlay adjustments */
  .sidebar-overlay { backdrop-filter: blur(3px); }
}

/* ─── MOBILE (425px) ─────────────────────────────────────────── */
@media (max-width: 425px) {
  :root {
    --sidebar-width: 60px;
    --workspace-pad: 0.875rem;
    --header-height: 52px;
  }

  html { font-size: 14px; }

  /* Mobile nav bar becomes visible */
  .mobile-nav-bar {
    display: flex !important;
    padding: 0 1rem;
    height: 52px;
  }

  /* Sidebar positioning on mobile – slides from left */
  .sidebar {
    position: fixed;
    left: 0;
    top: 52px;
    width: 268px;
    height: calc(100vh - 52px);
    z-index: 1000;
    transform: translateX(-100%);
    border-right: 1px solid var(--sidebar-border);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  /* App shell layout adjustment */
  .app-shell { flex-direction: column; }

  /* Workspace adjusts for mobile nav */
  .workspace {
    flex: 1;
    margin-top: 52px;
    padding: 0.875rem;
    gap: 1rem;
  }

  /* Mobile sidebar styling */
  .sidebar-brand {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }
  
  .sidebar-nav {
    padding: 1.125rem 0.875rem;
  }

  .sidebar-link {
    padding: 0.625rem 0.875rem;
    margin: 2px 0;
    font-size: 0.875rem;
  }

  .sidebar-icon {
    width: 18px;
    height: 18px;
  }

  .sidebar-foot { 
    padding: 1.125rem 1.5rem;
    font-size: 0.8rem;
  }

  /* Page head for mobile */
  .page-head {
    gap: 0.375rem;
    margin-bottom: 0.5rem;
  }
  .page-head h2 {
    font-size: 1.25rem;
    font-weight: 800;
  }
  .page-head p { font-size: 0.7rem; }

  /* Flex helpers for mobile */
  .aligned,
  .d_flex_between {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .page-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  .page-actions .btn {
    width: 100%;
  }

  /* Cards on mobile */
  .toolbar-card,
  .table-card,
  .editor-card {
    padding: 0.875rem;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
  }

  /* Flash messages on mobile */
  .flash {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }

  /* Notice on mobile */
  .notice {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }

  /* Search form on mobile */
  .search-form {
    flex-direction: column;
    gap: 0.5rem;
  }
  .field {
    width: 100%;
    min-width: unset;
  }
  .search-btn,
  .reset-btn {
    width: 100%;
  }

  /* Table on mobile */
  .table-wrap {
    border-radius: 6px;
    border: 1px solid var(--border);
  }
  
  table { font-size: 0.75rem; }
  th {
    padding: 0.5rem 0.5rem;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
  }
  td {
    padding: 0.625rem 0.5rem;
    font-size: 0.75rem;
  }

  /* Media cells on mobile */
  .thumb { width: 28px; height: 28px; }
  .thumb-placeholder { width: 28px; height: 28px; font-size: 14px; }
  .img-preview { width: 48px; height: 48px; }

  /* Buttons on mobile */
  .btn,
  .btn-icon,
  .action-btn,
  .submit-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    gap: 0.25rem;
    height: 36px;
  }
  
  .btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
  }

  /* Actions cell on mobile */
  .actions-cell {
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  /* Status badges on mobile */
  .status-pill,
  .status-badge {
    padding: 0.15rem 0.5rem;
    font-size: 0.6rem;
  }

  /* Items list on mobile */
  .items-list { font-size: 0.7rem; }

  /* Empty state on mobile */
  .empty-state {
    padding: 2rem 1rem;
    text-align: center;
  }
  .empty-icon { width: 40px; height: 40px; }
  .empty-state h4 { font-size: 0.9rem; }
  .empty-state p { font-size: 0.75rem; }

  /* Field inputs on mobile */
  .field input,
  .field select,
  .field textarea {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
    height: 40px;
  }
  .field textarea { height: auto; }

  /* Form control on mobile */
  .form-control,
  .form-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
  }

  .form-label { font-size: 0.7rem; margin-bottom: 0.25rem; }

  /* Modal on mobile */
  .modal-header { padding: 0.875rem; }
  .modal-body { padding: 0.875rem; }
  .modal-footer { 
    padding: 0.75rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  .modal-footer .btn { width: 100%; }

  /* Chips on mobile */
  .chip { padding: 0.15rem 0.5rem; font-size: 0.65rem; }

  /* Table meta on mobile */
  .table-meta { gap: 0.3rem; font-size: 0.7rem; }
  .table-top { gap: 0.5rem; margin-bottom: 0.625rem; }

  /* Hamburger button on mobile */
  .sidebar-toggle {
    width: 36px;
    height: 36px;
    gap: 4px;
  }
  .sidebar-toggle span { width: 16px; height: 1.5px; }

  /* Hide desktop nav text on mobile */
  .mobile-nav-bar .sidebar-brand {
    font-size: 0.9rem;
  }

  /* Overlay adjustments */
  .sidebar-overlay { backdrop-filter: blur(2px); }

  /* Scrollbar width */
  .sidebar-nav { scrollbar-width: thin; }
}
