/* ============================================================
   style.css — Kaizo Logistic · Clean Light Theme
   Background: #f8f9fc  Surface: #ffffff  Accent: #2563eb
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f0f2f7;
  --surface:     #ffffff;
  --surface-2:   #f8f9fc;
  --border:      #e2e6ef;
  --border-dark: #cdd2de;
  --accent:      #2563eb;
  --accent-light:#eff4ff;
  --accent-hover:#1d4ed8;
  --text:        #111827;
  --text-muted:  #6b7280;
  --text-dim:    #9ca3af;
  --sidebar-w:   240px;
  --topbar-h:    60px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow:      0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 30px rgba(0,0,0,0.12);
  --transition:  0.18s ease;

  /* Status colours */
  --status-inprogress: #2563eb;
  --status-completed:  #16a34a;
  --status-pending:    #d97706;
  --status-overdue:    #dc2626;

  /* Task type accent colours */
  --type-air:       #0ea5e9;
  --type-export:    #8b5cf6;
  --type-import:    #06b6d4;
  --type-road:      #f59e0b;
  --type-express:   #ef4444;
  --type-warehouse: #10b981;
}

html { font-size: 15px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  /* Sticky-footer column: the layout grows to fill, so the footer sits at the
     bottom of the viewport on short pages (always visible) and is pushed down
     naturally when content is taller than the screen. */
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ── Layout ────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  /* Grow to fill the body's flex column (instead of forcing a full 100vh, which
     would push the sibling footer below the fold on short pages). */
  flex: 1 0 auto;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-width: 0;
  transition: margin-left var(--transition);
}

.page-body {
  padding: 28px 32px;
  /* Wider cap + centered so content doesn't hug the left with a big empty band on
     ultra-wide screens, while still bounding line length on huge monitors. */
  max-width: 1700px;
  margin: 0 auto;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
}

.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #1e40af);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.brand-sub  { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 10px 12px 4px;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.nav-active-bar {
  position: absolute;
  right: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--accent);
  border-radius: 3px 0 0 3px;
}

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
}

.nav-logout { color: var(--text-muted); }
.nav-logout:hover { color: var(--status-overdue); background: rgba(220,38,38,0.06); }

/* Sidebar collapsed */
.sidebar-collapsed .sidebar  { transform: translateX(calc(-1 * var(--sidebar-w))); }
.sidebar-collapsed .main-content { margin-left: 0; }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 20px;
  z-index: 90;
  transition: left var(--transition);
  gap: 16px;
}

.sidebar-collapsed .topbar { left: 0; }

.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.sidebar-toggle:hover { background: var(--bg); }
.sidebar-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: var(--transition);
}

.topbar-search { position: relative; }
.search-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  padding: 6px 14px 6px 36px;
  font-size: 0.83rem;
  width: 200px;
  outline: none;
  transition: border-color var(--transition), width var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  border-color: var(--accent);
  width: 260px;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Top-bar shortcut icons (Master Data grid, Admin Config gear). */
.topbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  flex: none;
  transition: background 0.15s, color 0.15s;
}
.topbar-icon:hover { background: var(--bg); color: var(--text); }
.topbar-icon.active { background: var(--accent-soft, #eef); color: var(--accent); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  position: relative;
  user-select: none;
}
.topbar-user:hover { background: var(--bg); }

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #1e40af);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}

.user-name { font-size: 0.85rem; font-weight: 500; }
.chevron { color: var(--text-muted); transition: transform var(--transition); }
.topbar-user.open .chevron { transform: rotate(180deg); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 210px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.visible { display: block; }

.user-dropdown-info {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-dropdown-info strong { font-size: 0.875rem; color: var(--text); }
.user-dropdown-info small  { font-size: 0.75rem;  color: var(--text-muted); }

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.user-dropdown-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.user-dropdown-item.logout:hover { background: rgba(220,38,38,0.06); color: var(--status-overdue); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: rgba(37,99,235,0.1);   color: var(--accent); }
.stat-icon.green  { background: rgba(22,163,74,0.1);   color: var(--status-completed); }
.stat-icon.amber  { background: rgba(217,119,6,0.1);   color: var(--status-pending); }
.stat-icon.red    { background: rgba(220,38,38,0.1);   color: var(--status-overdue); }

.stat-info { min-width: 0; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Dashboard ─────────────────────────────────────────────── */
.dash-hero {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
  padding: 20px 22px; border-radius: 14px;
  background: linear-gradient(120deg, var(--accent), #1e3a8a);
  color: #fff; box-shadow: 0 6px 22px rgba(37,99,235,0.22);
}
.dash-hero-title { margin: 0; font-size: 1.35rem; font-weight: 700; color: #fff; }
.dash-hero-sub   { margin: 4px 0 0; font-size: 0.85rem; color: rgba(255,255,255,0.85); }
.dash-hero-sub strong { color: #fff; }
.dash-hero .btn-primary { background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.3); }
.dash-hero .btn-primary:hover { background: rgba(255,255,255,0.28); }

.dash-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-row > .card { margin-bottom: 0; }

/* Horizontal breakdown bars (service types + PIC workload) */
.dash-bars { display: flex; flex-direction: column; gap: 11px; padding: 4px 0; }
.dash-bar-row { display: flex; align-items: center; gap: 10px; text-decoration: none; }
a.dash-bar-row:hover .dash-bar-label { color: var(--accent); }
.dash-bar-label {
  flex: 0 0 110px; font-size: 0.82rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-bar-track { flex: 1; height: 9px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.dash-bar-fill  { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }
.dash-bar-count { flex: 0 0 28px; text-align: right; font-size: 0.84rem; font-weight: 600; color: var(--text); }

/* Status donut */
.dash-donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 6px 0; }
.dash-donut {
  flex: 0 0 132px; width: 132px; height: 132px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.dash-donut-hole {
  width: 88px; height: 88px; border-radius: 50%; background: var(--card-bg, #fff);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px var(--border);
}
.dash-donut-num { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--text); }
.dash-donut-cap { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.dash-legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 7px; }
.dash-legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.dash-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dash-legend-label { flex: 1; color: var(--text-muted); }
.dash-legend-val { font-weight: 600; color: var(--text); }

@media (max-width: 720px) {
  .dash-bar-label { flex-basis: 84px; }
  .dash-donut-wrap { justify-content: center; }
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 11px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--accent-light); }

tbody td { padding: 12px 16px; vertical-align: middle; }

.table-actions { display: flex; gap: 8px; }

/* ── Shipment number pill ───────────────────────────────────── */
.shipment-link {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 8px;
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition);
}
.shipment-link:hover {
  background: rgba(37,99,235,0.18);
  text-decoration: none;
}

/* ── Task type tab accent colours ──────────────────────────── */
/* --tab-accent feeds the active .tab-count badge background (see .tab-btn.active
   .tab-count) so each badge matches its tab colour and stays visible. */
.tab-btn[data-tab="air"].active     { color: var(--type-air);       border-bottom-color: var(--type-air);       --tab-accent: var(--type-air); }
.tab-btn[data-tab="export"].active  { color: var(--type-export);    border-bottom-color: var(--type-export);    --tab-accent: var(--type-export); }
.tab-btn[data-tab="import"].active  { color: var(--type-import);    border-bottom-color: var(--type-import);    --tab-accent: var(--type-import); }
.tab-btn[data-tab="road"].active    { color: var(--type-road);      border-bottom-color: var(--type-road);      --tab-accent: var(--type-road); }
.tab-btn[data-tab="express"].active { color: var(--type-express);   border-bottom-color: var(--type-express);   --tab-accent: var(--type-express); }
.tab-btn[data-tab="warehouse"].active { color: var(--type-warehouse); border-bottom-color: var(--type-warehouse); --tab-accent: var(--type-warehouse); }

/* Tab count badge */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-muted);
  margin-left: 6px;
  vertical-align: middle;
}
.tab-btn.active .tab-count {
  /* NB: don't use `background: currentColor` here — this rule also sets color:#fff,
     and currentColor resolves to the element's OWN color, giving a white badge with
     white text (invisible). Use an explicit accent background instead. Per-type
     active tabs override --tab-accent below so the badge matches the tab colour. */
  background: var(--tab-accent, var(--accent));
  color: #fff;
}

/* ── Status Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.71rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-inprogress { background: rgba(37,99,235,0.1);  color: var(--status-inprogress); }
.badge-completed  { background: rgba(22,163,74,0.1);  color: var(--status-completed); }
.badge-pending    { background: rgba(217,119,6,0.1);  color: var(--status-pending); }
.badge-overdue    { background: rgba(220,38,38,0.1);  color: var(--status-overdue); }
.badge-active     { background: rgba(22,163,74,0.1);  color: var(--status-completed); }
.badge-inactive   { background: rgba(107,114,128,0.1);color: var(--text-muted); }
.badge-paid       { background: rgba(22,163,74,0.1);  color: var(--status-completed); }
.badge-approved   { background: rgba(22,163,74,0.1);  color: var(--status-completed); }
.badge-received   { background: rgba(37,99,235,0.1);  color: var(--status-inprogress); }
.badge-cancelled  { background: rgba(220,38,38,0.1);  color: var(--status-overdue); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 10px rgba(37,99,235,0.3);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(37,99,235,0.25);
}
.btn-secondary:hover { background: rgba(37,99,235,0.15); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); text-decoration: none; }

.btn-icon {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--border); color: var(--text); }
.btn-icon svg { width: 14px; height: 14px; display: block; }

.btn-danger {
  background: rgba(220,38,38,0.08);
  color: var(--status-overdue);
  border: 1px solid rgba(220,38,38,0.2);
}
.btn-danger:hover { background: rgba(220,38,38,0.15); text-decoration: none; }

.btn-sm { padding: 5px 11px; font-size: 0.8rem; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;          /* wrap onto a new line instead of horizontal scroll */
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Page header row ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

/* ── Filter bar ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.filter-pill:hover { border-color: var(--accent); color: var(--accent); }
.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-control {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 13px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-control::placeholder { color: var(--text-dim); }
select.form-control { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Searchable select (app.js enhanceSelect) ──────────────────
   The native <select> is hidden; a text input + filtered panel sit on top.
   It inherits .form-control sizing, plus a chevron like a real select. */
.ss-wrap { position: relative; }
.ss-native { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.ss-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.ss-wrap.ss-open .ss-input { cursor: text; }
.ss-panel {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  max-height: 260px; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  padding: 4px;
}
.ss-wrap.ss-open .ss-panel { display: block; }
.ss-opt {
  padding: 8px 11px; border-radius: var(--radius-sm);
  font-size: 0.875rem; color: var(--text); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ss-opt:hover, .ss-opt.ss-active { background: var(--bg); }
.ss-opt.ss-selected { color: var(--accent); font-weight: 600; }
.ss-opt.ss-disabled { color: var(--text-dim); cursor: default; background: none; }
.ss-empty { padding: 10px 11px; font-size: 0.85rem; color: var(--text-muted); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Checkbox list ─────────────────────────────────────────── */
.checkbox-grid {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
  user-select: none;
}
.checkbox-item:last-child { border-bottom: none; }
.checkbox-item:hover { background: var(--accent-light); color: var(--text); }
.checkbox-item:has(input:checked) { background: var(--accent-light); color: var(--accent); }

.checkbox-item input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px;
  border: 2px solid var(--border-dark);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}
.checkbox-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body    { padding: 24px; }
.modal-footer  {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--surface-2);
  border-radius: 0 0 12px 12px;
}

/* ── Progress bar ───────────────────────────────────────────── */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-bar-track {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  min-width: 50px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  transition: width 0.4s ease;
}
.progress-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 600;
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 32px;
  color: var(--text-muted);
  gap: 12px;
}
.empty-state svg {
  width: 40px; height: 40px;
  color: var(--text-dim);
  opacity: 0.6;
}
.empty-state p { font-size: 0.9rem; }

/* ── Login page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #eff4ff 0%, #f0f2f7 60%, #faf5ff 100%);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), #1e40af);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}

.login-title    { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.login-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 32px; }

.login-divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.btn-microsoft:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--border-dark);
  text-decoration: none;
  color: #1a1a1a;
}
.ms-logo { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Detail view ───────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.detail-field label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.detail-field p {
  font-size: 0.9rem;
  color: var(--text);
}

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-dim); }
.breadcrumb span { color: var(--text); font-weight: 500; }

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 16px 32px;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  margin-left: var(--sidebar-w);
  flex-shrink: 0;   /* never compress — stays a visible band at the viewport bottom */
}
.sidebar-collapsed .app-footer { margin-left: 0; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  border-left: 3px solid;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: rgba(22,163,74,0.08);  color: var(--status-completed); border-color: var(--status-completed); }
.alert-error   { background: rgba(220,38,38,0.08);  color: var(--status-overdue);   border-color: var(--status-overdue); }
.alert-info    { background: var(--accent-light);   color: var(--accent);           border-color: var(--accent); }

/* ── Payroll stats row ─────────────────────────────────────── */
.payroll-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.payroll-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.payroll-stat .value { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
.payroll-stat .label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Divider ────────────────────────────────────────────────── */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .app-footer { margin-left: 0; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.15); }
  .page-body { padding: 20px 16px; }
  .user-name { display: none; }
}

@media (max-width: 600px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .search-input { width: 140px; }
  .search-input:focus { width: 160px; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
