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

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: #f4f4f4;
}

a { text-decoration: none; color: inherit; }

/* ── Navbar ── */
.navbar {
  display: none; /* hidden on desktop */
}
.navbar-title { font-size: 17px; font-weight: 600; color: #1F2937; }

.dash-toggle {
  display: none;
  width: 38px; height: 38px; place-items: center;
  border: 1px solid #e5e7eb; border-radius: 10px;
  background: #fff; cursor: pointer; flex-shrink: 0;
}
.dash-toggle img { width: 22px; height: 22px; display: block; }

/* ── Layout ── */
.main-layout { display: flex; height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 250px; background: #2E2E2E;
  border-top-right-radius: 40px; border-bottom-right-radius: 40px;
  flex-shrink: 0; display: flex; flex-direction: column;
}
.side-nav { padding: 24px 16px; color: #fff; display: flex; flex-direction: column; gap: 12px; width: 100%; flex: 1; overflow: auto; }
.side-title { font-size: 18px; font-weight: 600; opacity: .9; margin-bottom: 6px; }
.side-menu { list-style: none; display: grid; gap: 6px; margin: 0; padding: 0; }
.side-menu a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; width: 100%; border-radius: 14px; color: rgba(255,255,255,.9); text-decoration: none; font-weight: 500; transition: background .2s ease; }
.side-menu a:hover { background: #3a3a3a; }
.side-menu a.active { background: #1F6F79; color: #fff; box-shadow: 0 6px 18px rgba(31,111,121,.35); }
.side-menu a::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: transparent; transition: background .2s ease; flex-shrink: 0; }
.side-menu a.active::before { background: #fff; }
.side-footer { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.logout-btn { width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid #ef4444; background: transparent; color: #ef4444; font-size: 14px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; transition: background .2s ease, color .2s ease; }
.logout-btn:hover { background: #ef4444; color: #fff; }
.sidebar-overlay { display: none; }

/* ── Content ── */
.content {
  flex: 1; overflow-y: auto;
  padding: 28px 32px;
  display: flex; flex-direction: column; gap: 0;
}

/* ── Filter pills bar ── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-pill {
  padding: 7px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  border: 1px solid #dde3ea;
  background: #fff; color: #374151;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.filter-pill.active,
.filter-pill:hover {
  background: #1F6F79; color: #fff; border-color: #1F6F79;
  box-shadow: 0 4px 12px rgba(31,111,121,.18);
}

/* ── Cards container ── */
.bundles-container {
  display: flex; flex-direction: column; gap: 16px;
}

/* ── Card ── */
.consolidation-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  overflow: hidden;
}

/* Card header */
.card-top {
  background: #2E2E2E;
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.card-top-info { display: flex; flex-direction: column; gap: 3px; }
.card-code { font-size: 16px; font-weight: 700; color: #fff; }
.card-date { font-size: 12px; color: #999; }

.view-req-btn {
  background: #1F6F79; color: #fff;
  border: none; border-radius: 12px;
  padding: 9px 18px; font-size: 13px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background .2s;
}
.view-req-btn:hover { background: #17565e; }

/* Card stat row */
.card-body {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid #f0f0f0;
}
.card-stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 20px;
  border-right: 1px solid #f0f0f0;
}
.card-stat:last-child { border-right: none; }
.stat-label { font-size: 11px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 15px; font-weight: 600; color: #1a1a1a; }

/* Status colours */
.status-draft     { color: #6b7280; }
.status-pending   { color: #d97706; }
.status-submitted { color: #2563eb; }
.status-approved  { color: #059669; }
.status-rejected  { color: #dc2626; }
.status-shipped   { color: #7c3aed; }
.status-delivered { color: #0284c7; }

/* ── Package list inside card ── */
.card-packages { border-top: 1px solid #f0f0f0; }

.pkg-toggle-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 11px 20px;
  background: none; border: none; border-bottom: 1px solid #f0f0f0;
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600;
  color: #374151; cursor: pointer;
  transition: background .15s;
}
.pkg-toggle-btn:hover { background: #f9fafb; }
.pkg-toggle-btn .chevron { font-size: 11px; color: #9ca3af; transition: transform .2s; }
.card-packages.open .pkg-toggle-btn .chevron { transform: rotate(180deg); }

.pkg-list { display: none; }
.card-packages.open .pkg-list { display: block; }

.pkg-row {
  padding: 12px 20px;
  border-bottom: 1px solid #f8f8f8;
  font-size: 13px;
}
.pkg-row:last-child { border-bottom: none; }

.pkg-main {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.pkg-tracking { font-weight: 600; color: #1b3a40; font-size: 13px; flex: 1; min-width: 120px; }
.pkg-meta { color: #6b7280; font-size: 12px; display: flex; gap: 8px; align-items: center; }
.pkg-status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: #f3f4f6; color: #374151;
}

.pkg-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pkg-btn {
  padding: 5px 12px; border-radius: 8px; border: 1px solid #e5e7eb;
  background: #fff; font-size: 12px; font-weight: 500;
  font-family: 'Inter', sans-serif; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pkg-btn:hover { background: #f3f4f6; }
.pkg-btn.danger { border-color: #fca5a5; color: #dc2626; }
.pkg-btn.danger:hover { background: #fef2f2; }

.pkg-details-panel {
  display: none;
  margin-top: 8px; padding: 10px 12px;
  background: #f8fafc; border-radius: 10px;
  font-size: 12px; color: #374151;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px;
}
.pkg-row.details-open .pkg-details-panel { display: grid; }
.pkg-details-panel div { display: flex; flex-direction: column; gap: 1px; }
.pkg-details-panel strong { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: #9ca3af; }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: #9ca3af;
}
.empty-state h3 { font-size: 18px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.empty-state p  { margin-bottom: 16px; }
.primary-btn {
  display: inline-block; padding: 10px 20px;
  border-radius: 10px; background: #1F6F79; color: #fff;
  font-weight: 600; font-size: 14px;
}

/* ── Mobile (≤900px) ── */
@media (max-width: 900px) {
  .main-layout { display: block; height: auto; }

  .navbar {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-auto-rows: min-content;
    gap: 10px;
    padding: 8px 12px 10px;
    position: sticky; top: 0; z-index: 1000;
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid #e5e7eb;
  }
  .dash-toggle { display: grid; }

  .filter-pills-row {
    grid-column: 1 / -1;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 2px 0 4px;
    border-top: 1px solid #e5e7eb;
  }
  .filter-pills-row::-webkit-scrollbar { display: none; }
  .filter-bar {
    flex-wrap: nowrap; white-space: nowrap;
    margin-bottom: 0; gap: 6px;
  }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1100;
    width: min(84vw, 300px); height: 100vh;
    border-radius: 0 20px 20px 0;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,.15);
  }
  .sidebar.open, .sidebar.is-open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0; z-index: 1090;
    display: none; background: rgba(0,0,0,.4); backdrop-filter: blur(2px);
  }
  .sidebar-overlay.show { display: block; }

  .content { padding: 14px 12px 32px; gap: 14px; }

  /* Tighten cards */
  .card-top { padding: 14px 16px; }
  .card-code { font-size: 15px; }
  .card-stat { padding: 12px 14px; }
  .stat-value { font-size: 14px; }

  /* Stack stat cells on very narrow */
  @media (max-width: 400px) {
    .card-body { grid-template-columns: 1fr; }
    .card-stat { border-right: none; border-bottom: 1px solid #f0f0f0; }
    .card-stat:last-child { border-bottom: none; }
  }

  .pkg-details-panel { grid-template-columns: 1fr; }
}
