:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --surface3: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --faint: #94a3b8;
  --border: #e2e8f0;
  --sidebar-bg: #1e293b;
  --topbar-bg: #ffffff;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --accent: #0325bd;
  --accent-lt: #eff6ff;
  --accent-md: #dbeafe;
  --r: #ef4444;
  --r-lt: #fef2f2;
  --g: #10b981;
  --g-lt: #ecfdf5;
  --amber: #f59e0b;
  --amber-lt: #fffbeb;
  --sky: #0ea5e9;
  --sky-lt: #f0f9ff;
  --purple: #8b5cf6;
  --purple-lt: #f5f3ff;
  --steel: #475569;
  --steel-lt: #f1f5f9;
  --radius: 12px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --surface3: #475569;
  --text: #f1f5f9;
  --muted: #94adcf;
  --faint: #64748b;
  --border: #334155;
  --sidebar-bg: #0f172a;
  --topbar-bg: #1e293b;
  --card-bg: #1e293b;
  --input-bg: #0f172a;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --accent-lt: rgba(3, 37, 189, 0.15);
}

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

html,
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: background .3s, color .3s;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  width: 100%;
  max-width: 100vw;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 62px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, .07);
}

.sl {
  padding: 14px 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform .2s cubic-bezier(0.34, 1.56, 0.64, 1);
}


.app-name {
  display: none;
  font-family: 'Nunito', sans-serif;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.side-close {
  display: none;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: all 0.2s;
}

.side-close:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(90deg);
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

nav {
  padding: 10px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
}

.ni {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  color: rgba(255, 255, 255, .35);
  position: relative;
  overflow: visible;
}

.ni:hover {
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .8);
}

.ni.on {
  background: var(--accent);
  color: #fff;
}

.ni svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.tip {
  display: none;
}

.theme-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  color: rgba(255, 255, 255, .35);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .8);
}

[data-theme="dark"] .theme-toggle .sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .moon {
  display: block !important;
}

[data-theme="light"] .theme-toggle .sun {
  display: block !important;
}

[data-theme="light"] .theme-toggle .moon {
  display: none;
}

.tt-circle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tt-circle svg {
  width: 20px;
  height: 20px;
}

.nsep {
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, .07);
  margin: 4px 0;
}

.sb-bot {
  padding: 10px 0 14px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--steel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .15);
}

.ib-s {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, .3);
  transition: all .15s;
  position: relative;
}

.ib-s:hover {
  background: rgba(255, 59, 48, .15);
  color: var(--r);
}

.ib-s svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

/* ── MAIN ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 22px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ptitle {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.pcrumb {
  font-size: 11px;
  color: var(--faint);
  font-weight: 500;
}

.pcrumb b {
  color: var(--accent);
  font-weight: 700;
}

.tbar-left {
  display: flex;
  flex-direction: column;
}

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

.sbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 6px 12px;
  width: 230px;
  transition: all .15s;
}

.sbar:focus-within {
  border-color: var(--accent);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px var(--accent-lt);
}

.sbar svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
  flex-shrink: 0;
  stroke-width: 1.8;
}

.sbar input {
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  width: 100%;
}

.sbar input::placeholder {
  color: var(--faint);
  font-weight: 400;
}

.ib {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  color: var(--muted);
  position: relative;
}

.ib:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ib svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.nd {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--r);
  border: 1.5px solid var(--topbar-bg);
}

.btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lt);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(3, 37, 189, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(3, 37, 189, 0.35);
  filter: brightness(1.1);
}

.btn-green {
  background: var(--g);
  color: #fff;
}

.btn-steel {
  background: var(--steel);
  color: #fff;
}

.btn-red {
  background: var(--r);
  color: #fff;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 11px;
  min-height: 32px;
}

/* ── PAGES ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.page {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.page.active {
  display: flex;
}

/* ── STATS ── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.slabel {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
}

.sval {
  font-family: 'JetBrains Mono', monospace;
  font-size: 30px;
  font-weight: 600;
  color: var(--text);
  margin: 6px 0 3px;
  line-height: 1;
}

.snote {
  font-size: 11px;
  font-weight: 700;
}

.sicon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 14px;
  right: 14px;
}

.sicon svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

/* ── LAYOUT ── */
.row {
  display: grid;
  gap: 14px;
}

.r2 {
  grid-template-columns: 1fr 1fr;
}

.r3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.r31 {
  grid-template-columns: 1.85fr 1fr;
}

.r21 {
  grid-template-columns: 2fr 1fr;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── CARD ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.ch {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ct {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.cs {
  font-size: 11px;
  color: var(--faint);
  margin-top: 2px;
  font-weight: 500;
}

.ch180 {
  position: relative;
  height: 180px;
}

.ch140 {
  position: relative;
  height: 140px;
}

/* ── TABLE ── */
.tw {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  font-size: 10px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 0 10px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

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

tbody tr:hover td {
  background: var(--surface2);
  cursor: pointer;
}

.tdm {
  color: var(--text) !important;
  font-weight: 700 !important;
  font-size: 12px !important;
}

.mono {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 10px !important;
  color: var(--faint) !important;
  font-weight: 400 !important;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.b-gold {
  background: var(--accent-lt);
  color: var(--accent);
}

.b-green {
  background: var(--g-lt);
  color: #0A6B30;
}

.b-red {
  background: var(--r-lt);
  color: #C0281F;
}

.b-sky {
  background: var(--sky-lt);
  color: var(--sky);
}

.b-amber {
  background: var(--amber-lt);
  color: var(--amber);
}

.b-faint {
  background: var(--surface3);
  color: var(--muted);
}

.b-steel {
  background: var(--steel-lt);
  color: var(--steel);
}

.b-purple {
  background: var(--purple-lt);
  color: var(--purple);
}

/* ── PROGRESS ── */
.pw {
  background: var(--surface3);
  border-radius: 20px;
  height: 6px;
  overflow: hidden;
}

.pf {
  height: 100%;
  border-radius: 20px;
  transition: width .4s;
}

/* ── FILTER ── */
.fb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: all .15s;
  color: var(--muted);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.fsr {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  margin-left: auto;
}

.fsr:focus-within {
  border-color: var(--accent);
}

.fsr svg {
  width: 13px;
  height: 13px;
  color: var(--faint);
  stroke-width: 1.8;
}

.fsr input {
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  width: 150px;
}

/* ── FORM BASE ── */
.fsec {
  margin-bottom: 20px;
}

.fst {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
}

.sd {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fg {
  display: grid;
  gap: 12px;
}

.fg2 {
  grid-template-columns: 1fr 1fr;
}

.fg3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.freq {
  color: var(--r);
}

.fi,
.fta {
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--input-bg);
  outline: none;
  transition: all .15s;
  width: 100%;
}

.fi:focus,
.fta:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}

.fi::placeholder,
.fta::placeholder {
  color: var(--faint);
  font-weight: 400;
}

.fta {
  resize: vertical;
  min-height: 72px;
}

.fa {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════
   CUSTOM SELECT — replaces native <select> entirely.
   The dropdown panel is position:absolute inside a
   position:relative wrapper, so it never overflows the card.
   ══════════════════════════════════════════════════════════ */
.fsel-wrap {
  position: relative;
  width: 100%;
}

/* The visible trigger button */
.fsel {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 9px 36px 9px 12px;
  /* right pad for chevron */
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--input-bg);
  outline: none;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

/* native select fallback (hidden but kept for semantics if needed) */
select.fsel-native {
  display: none;
}

.fsel:focus,
.fsel.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}

/* Chevron icon inside trigger */
.fsel-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--faint);
  transition: transform .2s;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.fsel.open .fsel-chevron {
  transform: translateY(-50%) rotate(180deg);
}

/* The dropdown panel */
.fsel-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  /* ← key: stretches to parent width, never wider */
  background: var(--card-bg);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 500;
  overflow: hidden;
  display: none;
  max-height: 220px;
  overflow-y: auto;
}

.fsel-dropdown.open {
  display: block;
}

/* Individual option */
.fsel-opt {
  padding: 10px 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--border);
}

.fsel-opt:last-child {
  border-bottom: none;
}

.fsel-opt:hover {
  background: var(--accent-lt);
  color: var(--accent);
}

.fsel-opt.selected {
  background: var(--accent);
  color: #fff;
}

.fsel-opt.placeholder-opt {
  color: var(--faint);
  font-weight: 500;
}

/* ── STEP WIZARD ── */
.step-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
}

.step-item {
  display: flex;
  align-items: center;
  flex: 1;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--faint);
  background: var(--card-bg);
  flex-shrink: 0;
  transition: all .2s;
}

.step-circle.done {
  background: var(--g);
  border-color: var(--g);
  color: #fff;
}

.step-circle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--faint);
  margin-top: 4px;
  white-space: nowrap;
}

.step-label.active {
  color: var(--accent);
}

.step-label.done {
  color: var(--g);
}

.step-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 14px;
}

.step-line.done {
  background: var(--g);
}

/* ── IMAGE UPLOAD ── */
.img-upload-section {
  background: var(--surface2);
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
}

.img-upload-header {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.img-upload-sub {
  font-size: 10px;
  color: var(--faint);
  font-weight: 600;
  margin-bottom: 12px;
}

.img-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.img-slot {
  width: 72px;
  height: 72px;
  border-radius: 9px;
  border: 1.5px dashed var(--border);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  overflow: hidden;
}

.img-slot:hover {
  border-color: var(--accent);
  background: var(--accent-lt);
}

.img-slot.filled {
  border-style: solid;
  border-color: var(--g);
  background: var(--g-lt);
}

.img-slot.compulsory {
  border-color: var(--r);
}

.img-slot svg {
  width: 20px;
  height: 20px;
  color: var(--faint);
}

.img-slot.filled svg {
  color: var(--g);
}

.img-slot-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--faint);
  margin-top: 4px;
  text-align: center;
}

.img-count-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 4px;
}

.req-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--r-lt);
  color: var(--r);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── MODAL ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.overlay.open {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: 14px;
  width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
  padding: 22px;
}

.modal-lg {
  width: 780px;
}

.mh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.mtt {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.mx {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--surface2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 16px;
}

.mx:hover {
  background: var(--r-lt);
  color: var(--r);
}

/* ── EMPLOYEE CARDS ── */
.emp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.emp-card-modern {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all .25s cubic-bezier(.4, 0, .2, 1);
  box-shadow: var(--shadow);
}

.emp-card-modern:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.ec-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ec-av {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.ec-info {
  flex: 1;
  min-width: 0;
}

.ec-name {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ec-role {
  font-size: 11px;
  color: var(--faint);
  font-weight: 600;
  margin-top: 1px;
}

.ec-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ec-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.ec-meta svg {
  width: 13px;
  height: 13px;
  color: var(--faint);
}

.ec-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.ec-tags {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.btn-icon:hover {
  background: var(--accent-lt);
  color: var(--accent);
}

.btn-icon-red:hover {
  background: var(--r-lt);
  color: var(--r);
}

/* ── FEED ── */
.fr {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.fr:last-child {
  border-bottom: none;
}

.fp {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.ft {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.fti {
  font-size: 10px;
  color: var(--faint);
  margin-top: 2px;
  font-weight: 500;
}

/* ── TOGGLE ── */
.tog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.tog-row:last-child {
  border-bottom: none;
}

.tl2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

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

.toggle {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--border);
  cursor: pointer;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}

.toggle.on {
  background: var(--accent);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.toggle.on::after {
  transform: translateX(18px);
}

/* ── REPORT FILTERS ── */
.report-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 4px;
}

.rfl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--faint);
  margin-right: 4px;
}

.rfi {
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--input-bg);
  outline: none;
  transition: border-color .15s;
}

.rfi:focus {
  border-color: var(--accent);
}

/* ── WEIGHBRIDGE BANNER ── */
.wb-banner {
  background: linear-gradient(135deg, var(--steel) 0%, #1a3354 100%);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #fff;
}

.wb-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wb-icon svg {
  width: 24px;
  height: 24px;
  stroke: #fff;
  stroke-width: 1.8;
}

.wb-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.wb-sub {
  font-size: 11px;
  opacity: .75;
  margin-top: 2px;
}

.wb-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 600;
  margin-left: auto;
}

.wb-unit {
  font-size: 12px;
  opacity: .7;
  font-weight: 600;
}

/* ── DRIVER URL ── */
.driver-url-card {
  background: var(--card-bg);
  border: 1.5px solid var(--amber);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.driver-url-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 4px;
}

.driver-url-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}

.driver-url-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--g);
  margin-top: 3px;
}

.driver-url-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g);
}

/* ── REPORT FILTERS IMPROVED ── */
.rf-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rf-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rf-period {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.rf-dates {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rf-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.rf-to {
  font-size: 11px;
  color: var(--faint);
  font-weight: 700;
  text-transform: uppercase;
}

.rf-apply {
  height: 32px;
  padding: 0 16px;
  width: auto;
  min-height: unset;
}

/* ── INFO GRID ── */
.ig {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.ii .il {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--faint);
  margin-bottom: 3px;
}

.ii .iv {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

/* ── BULK ACTIONS ── */
.bulk-action-bar {
  display: flex;
  align-items: center;
}

tbody tr.selected td {
  background: var(--accent-lt);
}

.row-select {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── FLATPICKR ── */
.flatpickr-calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  width: 280px !important;
  padding: 5px;
}

.flatpickr-day {
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  height: 35px;
  line-height: 34px;
}

.flatpickr-day:hover {
  background: var(--accent-lt);
  color: var(--accent);
}

.flatpickr-day.selected {
  background: var(--accent) !important;
  color: #fff !important;
  border: none;
}

.flatpickr-months .flatpickr-month {
  color: var(--text);
  fill: var(--text);
  padding-bottom: 8px;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
  font-weight: 800;
  font-size: 13px;
  color: var(--accent);
}

.flatpickr-weekday {
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
}

.flatpickr-day.today {
  border-color: var(--accent);
  color: var(--accent);
}

.flatpickr-innerContainer {
  padding: 4px;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  fill: var(--faint);
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  fill: var(--accent);
  background: var(--accent-lt);
  border-radius: 50%;
}

/* ── MISC ── */
.c-green {
  background: var(--g-lt) !important;
  color: var(--g) !important;
}

.c-red {
  background: var(--r-lt) !important;
  color: var(--r) !important;
}

.b-sm {
  padding: 1px 6px;
  font-size: 9px;
}

#bulk-bar .bulk-action-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ══════════════════════════════════════════════════════════
   MOBILE MENU TOGGLE
   ══════════════════════════════════════════════════════════ */
.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  transition: all .2s;
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

.mobile-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE  ≤ 1024px
   ══════════════════════════════════════════════════════════ */
@media(max-width:1024px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .r31,
  .r21 {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE  ≤ 768px
   ══════════════════════════════════════════════════════════ */
@media(max-width:768px) {
  .shell {
    flex-direction: column;
  }

  /* Slide-in sidebar */
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    width: 280px;
    background: var(--sidebar-bg);
    transition: left .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, .2);
    align-items: flex-start;
  }

  .sidebar.active {
    left: 0;
  }

  .sidebar .sl {
    justify-content: flex-start;
    padding: 24px 20px;
  }

  .sidebar .app-name {
    display: block;
    margin-top: 2px;
  }

  .sidebar .side-close {
    display: flex;
  }
  .sidebar .logo-img {
    width: 44px;
    height: 44px;
  }

  .sidebar nav {
    padding: 20px 15px;
    align-items: stretch;
  }

  .sidebar .ni {
    width: 100%;
    height: 48px;
    justify-content: flex-start;
    padding: 0 15px;
    gap: 12px;
  }

  .sidebar .tip {
    display: block;
    position: static;
    transform: none;
    opacity: 1;
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
  }

  .sidebar .tip::before {
    display: none;
  }

  .sidebar .sb {
    width: 100%;
    padding: 20px;
    margin-top: auto;
  }

  .main {
    width: 100%;
    max-width: 100%;
  }

  .topbar {
    padding: 0 16px;
    height: 64px;
  }

  .menu-toggle {
    display: flex;
  }

  .content {
    padding: 16px;
  }

  /* Stacked grids */
  .stats {
    grid-template-columns: 1fr;
  }

  .row,
  .r2,
  .r3,
  .r31,
  .r21 {
    grid-template-columns: 1fr !important;
  }

  /* Charts */
  .ch180,
  .ch140 {
    width: 100%;
    height: 220px;
  }

  canvas {
    width: 100% !important;
    height: 100% !important;
  }

  /* Forms */
  .fg,
  .fg2,
  .fg3 {
    grid-template-columns: 1fr !important;
  }

  .fi,
  .fta {
    width: 100% !important;
    font-size: 14px !important;
    min-height: 48px;
  }

  .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .fa {
    flex-direction: column;
    width: 100%;
  }

  /* Report filter bar */
  .report-filter-bar {
    flex-direction: column;
    height: auto;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    background: var(--surface2);
    border-radius: 12px;
    border: none;
  }

  .rf-group {
    background: var(--card-bg);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    box-shadow: var(--shadow);
  }

  .rf-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    gap: 6px;
  }

  .rf-chips .chip {
    text-align: center;
    padding: 6px 4px;
    font-size: 10px;
    width: 100%;
  }

  .rf-period {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
  }

  .rf-dates {
    width: 100%;
    gap: 6px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .rf-dates .rfi {
    flex: 1;
    font-size: 12px !important;
    padding: 6px !important;
  }

  .rf-apply, .rf-reset {
    width: 120px !important;
    height: 38px !important;
    font-size: 11px !important;
    border-radius: 30px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(3, 37, 189, 0.1);
  }

  .rf-actions {
    width: 100%;
    margin-left: 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  .rf-actions .btn {
    width: 100% !important;
    height: 34px !important;
  }

  .report-filter-bar .nsep {
    display: none;
  }

  .report-filter-bar .rfi {
    width: 100% !important;
    margin: 0 !important;
    height: 38px;
  }

  /* ── REPORTS: Table Fit Fix ── */
  #page-reports .tw {
    margin: 0 -4px;
    width: calc(100% + 8px);
  }

  #page-reports table {
    min-width: 100% !important;
    table-layout: auto;
  }

  #page-reports th,
  #page-reports td {
    padding: 10px 4px !important;
    font-size: 9.5px !important;
  }

  /* Hide noisy columns on small screens to make it fit */
  #page-reports th:nth-child(5),
  #page-reports td:nth-child(5),
  /* Invoice / Ref */
  #page-reports th:nth-child(6),
  #page-reports td:nth-child(6),
  /* Lorry # */
  #page-reports th:nth-child(4),
  #page-reports td:nth-child(4)

  /* Party/Company */
    {
    display: none;
  }

  #page-reports th:nth-child(1) {
    width: 30px;
  }

  /* Checkbox */
  #page-reports th:nth-child(2) {
    width: auto;
  }

  /* Date */
  #page-reports th:nth-child(3) {
    width: 55px;
  }

  /* Type */
  #page-reports th:nth-child(7) {
    width: 45px;
  }

  /* Weight */
  #page-reports th:nth-child(8) {
    width: 65px;
  }

  /* Status */
  #page-reports th:nth-child(9) {
    width: 40px;
  }

  /* Actions */

  #page-reports .tdm {
    font-size: 10px !important;
  }

  #page-reports .btn-sm {
    padding: 0 !important;
    font-size: 9px !important;
    min-height: 24px !important;
  }

  /* Row Actions (Icons on mobile) */
  .row-actions {
    display: flex;
    gap: 4px;
  }

  .row-actions .btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    flex-shrink: 0;
    border-radius: 6px !important;
  }

  .row-actions .btn-ghost {
    width: auto !important;
    padding: 0 8px !important;
    font-size: 9px;
  }

  .row-actions .btn-ghost span {
    display: none;
  }

  .row-actions svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.2;
  }

  #page-reports th:nth-child(9) {
    width: 90px;
  }

  /* Search bar fit */
  .ch .fsr {
    margin-left: 0;
    width: 100%;
  }

  .ch .fsr input {
    width: 100%;
  }

  /* Bulk bar alignment */
  /* Bulk bar alignment - Slimmer */
  #bulk-bar {
    flex-direction: row !important;
    align-items: center !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    border-radius: 8px !important;
    justify-content: space-between !important;
    border: 1px solid var(--accent);
  }

  #bulk-bar div:first-child {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
  }

  #bulk-bar #bulk-count {
    font-size: 10px !important;
    font-weight: 800;
  }

  #bulk-bar .btn {
    height: 28px !important;
    padding: 0 8px !important;
    font-size: 9px !important;
    width: auto !important;
  }

  #bulk-bar button[onclick*="Deselect All"] {
    font-size: 9px !important;
    margin-left: auto;
  }

  /* Table scroll container */
  .tw {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  /* Modals slide up from bottom */
  .modal {
    width: 100% !important;
    border-radius: 24px 24px 0 0 !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 90vh;
  }

  /* Employee & info grids */
  .emp-grid,
  .ig {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* ── DASHBOARD: Recent Transactions Fit Fix ── */
  #page-dashboard .tw {
    margin: 0 -4px;
    width: calc(100% + 8px);
    overflow-x: hidden;
  }

  #page-dashboard table {
    min-width: 100% !important;
    table-layout: fixed;
  }

  #page-dashboard th,
  #page-dashboard td {
    padding: 10px 4px !important;
    font-size: 10px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Show critical columns on phone */
  #page-dashboard th:nth-child(2),
  #page-dashboard td:nth-child(2),
  /* Type */
  #page-dashboard th:nth-child(4),
  #page-dashboard td:nth-child(4)

  /* Lorry # */
    {
    display: none;
  }

  #page-dashboard th:nth-child(1) {
    width: 60px;
  }

  /* Date */
  #page-dashboard th:nth-child(3) {
    width: auto;
  }

  /* Party */
  #page-dashboard th:nth-child(5) {
    width: 55px;
  }

  /* Weight */
  #page-dashboard th:nth-child(6) {
    width: 62px;
  }

  /* Status */
  #page-dashboard th:nth-child(7) {
    width: 42px;
  }

  /* Action (View) */

  #page-dashboard td:nth-child(7) {
    padding: 8px 2px !important;
    text-align: right;
  }

  #page-dashboard .btn-sm {
    padding: 2px 4px !important;
    font-size: 9px !important;
    min-height: 22px !important;
    width: auto !important;
  }

  #page-dashboard .badge {
    padding: 1px 4px !important;
    font-size: 8.5px !important;
  }

  /* Card padding reduction */
  .card {
    padding: 14px !important;
  }

  .ch {
    flex-wrap: wrap;
    gap: 10px;
  }

  .ch .btn {
    width: auto !important;
    min-height: 30px !important;
    padding: 4px 10px !important;
    font-size: 10px !important;
  }

  /* ── CUSTOM SELECT stays contained ── */
  .fsel-wrap {
    width: 100%;
  }

  .fsel {
    width: 100%;
    font-size: 13px !important;
    height: 38px !important;
    padding: 0 12px !important;
    min-height: unset !important;
  }

  .fsel-dropdown {
    max-height: 200px;
    border-width: 1px;
  }

  .fsel-opt {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Scale down Flatpickr on mobile */
  .flatpickr-calendar {
    width: 250px !important;
    transform: scale(0.88);
    transform-origin: top center;
  }

  .flatpickr-day {
    height: 30px;
    line-height: 30px;
    width: 30px;
    font-size: 11px;
  }

  /* Form action buttons */
  .fa {
    gap: 8px;
  }

  .fa .btn {
    width: 100% !important;
    margin-bottom: 0;
  }

  .btn:not(.btn-primary):not(.btn-green):not(.btn-red) {
    width: 100%;
  }
}

@media(max-width:480px) {
  .sval {
    font-size: 24px;
  }

  .mtt {
    font-size: 13px;
  }

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

  #page-dashboard .tw {
    padding: 0;
  }

  #page-dashboard td {
    font-size: 9.5px !important;
  }
}