/* ============================================================
   Shared Design System — "Site Blueprint": flat, high-contrast,
   industrial. Solid navy + safety-orange, sharp cards, thin
   borders instead of glassy shadows/gradients.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f2efe8;
  --surface: #ffffff;
  --surface-2: #f7f4ed;
  --text: #14202b;
  --muted: #667085;
  --border: #e3ded2;

  --navy: #0f2942;
  --navy-2: #16385a;
  --accent-1: #0f2942;
  --accent-2: #ff6b35;
  --accent-3: #ffb703;
  --gradient-brand: #ff6b35;

  --sidebar-bg: #0f2942;
  --sidebar-bg-2: #0f2942;
  --sidebar-text: #c3d1de;
  --sidebar-text-dim: #7793a8;
  --sidebar-active: rgba(255, 107, 53, 0.16);

  --success: #1f8a4c;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #2563eb;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 41, 66, 0.06);
  --shadow: 0 6px 16px rgba(15, 41, 66, 0.10);
  --shadow-lg: 0 16px 40px rgba(15, 41, 66, 0.20);

  --sidebar-w: 264px;
  --topbar-h: 68px;

  --font-heading: "Manrope", Inter, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
}

h1, h2, h3,
.stat-value, .module-value, .donut-center-value, .progress-ring-value,
.total-amount, .brand-text strong, .auth-logo {
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d9d2c1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #c4bba5; }

/* ============================================================
   App shell layout (sidebar + topbar + main)
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar (solid navy, flat, ruled) ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.24s ease;
  border-right: 3px solid var(--accent-2);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--font-heading);
  font-size: 17px;
  color: #0f2942;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.sidebar-brand .brand-text strong {
  font-size: 15px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.sidebar-brand .brand-text span {
  font-size: 11px;
  color: var(--sidebar-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.sidebar-nav .nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sidebar-text-dim);
  padding: 16px 10px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sidebar-text);
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--accent-2);
}

.nav-item.logout-item {
  color: #ffb0a3;
  margin-top: 8px;
}

.nav-item.logout-item:hover {
  background: rgba(220, 38, 38, 0.18);
  color: #ffc9c0;
}

.sidebar-footer {
  padding: 14px 18px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer .avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f2942;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-footer .who {
  line-height: 1.2;
  overflow: hidden;
}

.sidebar-footer .who strong {
  display: block;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .who span {
  font-size: 11px;
  color: var(--sidebar-text-dim);
}

/* ---------- Main / content area ---------- */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

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

.page-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title span {
  display: block;
  font-family: Inter, sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-welcome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 14px;
  margin-right: 4px;
  border-right: 1px solid var(--border);
}

.topbar-welcome .tw-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.topbar-welcome .tw-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.topbar-welcome .tw-greeting {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-2);
}

.topbar-welcome .tw-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 640px) {
  .topbar-welcome .tw-text { display: none; }
  .topbar-welcome { border-right: none; padding-right: 0; margin-right: 0; }
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--accent-2);
  border-color: var(--accent-2);
}

.icon-btn svg { width: 17px; height: 17px; }

.content {
  flex: 1;
  padding: 26px 28px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 16, 0.5);
  z-index: 90;
}

/* ============================================================
   Reusable components
   ============================================================ */

.hero-banner {
  border-radius: var(--radius-lg);
  padding: 30px 32px;
  background: var(--navy);
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  background-image:
    linear-gradient(var(--navy), var(--navy)),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 28px);
  border-left: 4px solid var(--accent-2);
}

.hero-banner h2 {
  margin: 0 0 6px;
  font-size: 23px;
  font-weight: 800;
  position: relative;
}

.hero-banner p {
  margin: 0;
  opacity: 0.85;
  font-size: 13.5px;
  max-width: 520px;
  position: relative;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-grid.stat-grid-tight { margin-bottom: 22px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
  border-top: 3px solid transparent;
}

.stat-card:hover {
  border-top-color: var(--accent-2);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: #fff;
}

.stat-card .stat-icon svg { width: 19px; height: 19px; }

.stat-card .stat-value {
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 5px;
}

.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.stat-card .stat-trend {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}

.stat-trend.up { color: var(--success); background: rgba(31, 138, 76, 0.1); }
.stat-trend.down { color: var(--danger); background: rgba(220, 38, 38, 0.1); }
.stat-trend.soon { color: var(--muted); background: rgba(107, 114, 128, 0.12); }

.icon-amber { background: var(--accent-2); }
.icon-orange { background: var(--navy); }
.icon-blue { background: var(--info); }
.icon-green { background: var(--success); }
.icon-slate { background: #475569; }
.icon-pink { background: #db2777; }

.panel-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
}

.panel-grid.charts-grid {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 22px;
}

.panel.full-panel {
  margin-bottom: 22px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 800;
}

.panel-header a {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
}

.panel-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease;
}

.quick-link:hover {
  border-color: var(--accent-2);
}

.quick-link .ql-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.quick-link .ql-icon svg { width: 15px; height: 15px; }

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent-2);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-item p {
  margin: 0;
  font-size: 13px;
}

.activity-item span {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Buttons & badges ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, filter 0.15s ease;
}

.btn-primary {
  background: var(--accent-2);
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-outline:hover { border-color: var(--accent-2); color: var(--accent-2); }

.btn-outline.danger { color: var(--danger); border-color: rgba(220, 38, 38, 0.3); }
.btn-outline.danger:hover { border-color: var(--danger); background: rgba(220, 38, 38, 0.06); color: var(--danger); }

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

.btn-success:hover { filter: brightness(1.08); }
.btn-success:active { transform: scale(0.98); }

.btn-lg {
  padding: 13px 26px;
  font-size: 14.5px;
}

.btn.perm-disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn.perm-disabled:hover,
.btn:disabled:hover {
  filter: grayscale(0.3);
  transform: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success { background: rgba(31, 138, 76, 0.1); color: var(--success); }
.badge-warning { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.badge-danger { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.badge-info { background: rgba(37, 99, 235, 0.1); color: var(--info); }

/* ============================================================
   List pages: page header, toolbar, data table, pagination, modal
   ============================================================ */

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header-row h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
}

.page-header-row p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.page-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin: 0 auto 14px;
}

.page-icon-badge svg { width: 22px; height: 22px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px 4px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.chip svg { width: 13px; height: 13px; flex-shrink: 0; }

.chip-amber { color: #b45309; border-color: rgba(255, 107, 53, 0.3); background: rgba(255, 107, 53, 0.08); }
.chip-blue { color: #1d4ed8; border-color: rgba(37, 99, 235, 0.25); background: rgba(37, 99, 235, 0.07); }
.chip-pink { color: #be185d; border-color: rgba(219, 39, 119, 0.22); background: rgba(219, 39, 119, 0.06); }
.chip-green { color: #15803d; border-color: rgba(31, 138, 76, 0.25); background: rgba(31, 138, 76, 0.08); }
.chip-slate { color: #475569; border-color: rgba(71, 85, 105, 0.22); background: rgba(71, 85, 105, 0.07); }

.text-amber { color: #b45309; }
.text-blue { color: #1d4ed8; }
.text-pink { color: #be185d; }
.text-green { color: #15803d; }
.text-slate { color: #475569; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.detail-card-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 800;
}

.card-header-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--accent-2);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}

.card-header-icon svg { width: 13px; height: 13px; }

.section-heading {
  font-size: 14.5px;
  font-weight: 800;
  margin: 26px 0 14px;
}

.section-heading.with-icon {
  display: flex;
  align-items: center;
}

.section-subheading {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0 0 16px;
}

.field-group-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-2);
}

.field-group-divider:first-child { margin-top: 0; }
.field-group-divider svg { width: 14px; height: 14px; flex-shrink: 0; }

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
}

.empty-state.compact { padding: 32px 20px; }
.empty-state.compact svg { width: 32px; height: 32px; margin-bottom: 8px; }

.empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p { margin: 0; font-size: 13.5px; }

.detail-rows { display: flex; flex-direction: column; }

.detail-row {
  display: flex;
  align-items: center;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 12px;
}

.detail-row:last-child { border-bottom: none; }
.detail-row:nth-child(even) { background: var(--surface-2); }

.detail-row .detail-label {
  flex: 0 0 42%;
  color: var(--muted);
  font-weight: 600;
}

.detail-row .detail-value {
  flex: 1;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

@media (max-width: 780px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 340px;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  padding: 9px 13px 9px 36px;
  font-size: 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input:focus {
  border-color: var(--accent-2);
  background: #fff;
}

.toolbar-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.data-table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 13px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.1s ease;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-2);
}

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

.data-table tbody tr.row-inactive {
  opacity: 0.5;
}

.data-table tbody tr.row-inactive:hover {
  opacity: 0.75;
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.cell-avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 10.5px;
}

.cell-user .cell-user-name {
  font-weight: 600;
  white-space: nowrap;
}

.cell-mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 4px;
  color: #b45309;
}

.desc-cell {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.active { background: rgba(31, 138, 76, 0.1); color: var(--success); }
.status-pill.inactive { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.status-pill.pending { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.status-pill.confirmed { background: rgba(37, 99, 235, 0.12); color: var(--info); }
.status-pill.delivered { background: rgba(31, 138, 76, 0.1); color: var(--success); }
.status-pill.at-risk { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.status-pill.on-track { background: rgba(31, 138, 76, 0.1); color: var(--success); }

.total-amount {
  font-weight: 800;
  color: var(--navy);
  font-size: 13px;
}

.row-actions {
  position: relative;
  display: inline-block;
}

.action-trigger {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.action-trigger:hover {
  background: var(--surface-2);
  color: var(--accent-2);
  border-color: var(--accent-2);
}

.action-trigger svg { width: 16px; height: 16px; }

.action-menu {
  position: fixed;
  top: -9999px;
  left: -9999px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 164px;
  padding: 5px;
  z-index: 500;
  display: none;
}

.action-menu.show { display: block; }

.action-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #14161f;
  cursor: pointer;
  text-align: left;
}

.action-menu button:hover {
  background: var(--surface-2);
}

.action-menu button svg { width: 15px; height: 15px; flex-shrink: 0; color: #14161f; }
.action-menu button.danger { color: var(--danger); }
.action-menu button.danger svg { color: var(--danger); }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 20px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 12px;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.page-btn.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 28, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--accent-2);
}

.modal-box.wide { max-width: 780px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.modal-header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
}

.modal-close:hover { color: var(--danger); border-color: var(--danger); }
.modal-close svg { width: 15px; height: 15px; }

.modal-body {
  padding: 22px 24px;
}

/* ---------- Page-level tabs (project detail sections) ---------- */
.page-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
}

.page-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 15px;
  margin-bottom: -2px;
  border: none;
  border-bottom: 2.5px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.page-tab svg { width: 15px; height: 15px; }
.page-tab.active { color: var(--accent-2); border-bottom-color: var(--accent-2); }
.page-tab:hover:not(.active) { color: var(--text); }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-grid .full { grid-column: 1 / -1; }

.field-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
  .field-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .field-grid.cols-3 { grid-template-columns: 1fr; }
}

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

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

.field label .req { color: var(--danger); }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="url"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  padding: 9px 12px;
  font-size: 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  outline: none;
  color: var(--text);
  transition: border-color 0.15s ease;
  width: 100%;
  font-family: inherit;
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-2);
  background: #fff;
}

.field input.error, .field select.error {
  border-color: var(--danger);
}

.field-error {
  font-size: 11px;
  color: var(--danger);
  display: none;
}

.field-error.show { display: block; }

.status-toggle-group {
  display: flex;
  gap: 10px;
}

.status-toggle-group label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}

.status-toggle-group input {
  display: none;
}

.status-toggle-group label:has(input:checked)[data-state="active"] {
  border-color: var(--success);
  background: rgba(31, 138, 76, 0.08);
  color: var(--success);
}

.status-toggle-group label:has(input:checked)[data-state="inactive"] {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--surface);
}

.view-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.view-detail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}

.view-detail-item span {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.view-detail-item strong {
  font-size: 13.5px;
  font-weight: 700;
}

.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 9px;
  border-left: 3px solid var(--accent-2);
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-notice svg { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }
.toast-notice.perm-denied svg { color: var(--danger); }

@media (max-width: 640px) {
  .field-grid, .view-detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .module-strip { grid-template-columns: 1fr; }
  .panel-grid.charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .quick-links { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 0 14px; }
  .hero-banner { padding: 22px; }
  .hero-banner h2 { font-size: 19px; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Auth Pages — Login (solid navy, ruled grid, flat card)
   ============================================================ */

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--navy);
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 34px);
}

.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}

.bg-blob.b1 { width: 420px; height: 420px; background: #ff6b35; top: -160px; left: -140px; }
.bg-blob.b2 { width: 380px; height: 380px; background: #ffb703; bottom: -160px; right: -120px; }
.bg-blob.b3 { width: 240px; height: 240px; background: #2563eb; top: 45%; right: 6%; }
.bg-blob.b4 { width: 200px; height: 200px; background: #1f8a4c; bottom: 8%; left: 8%; }

.auth-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  margin: auto;
}

.auth-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px 34px;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--accent-2);
}

.auth-logo {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  background: var(--accent-2);
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 21px;
  font-weight: 800;
}

.auth-card h1 {
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 6px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 26px;
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.input-wrapper { position: relative; }

.input-wrapper svg.leading-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.auth-card select,
.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"] {
  width: 100%;
  padding: 11px 13px 11px 38px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
  font-family: inherit;
  appearance: none;
}

.auth-card select { cursor: pointer; }

.auth-card input:focus, .auth-card select:focus {
  border-color: var(--accent-2);
  background: #fff;
}

.auth-card input.error { border-color: var(--danger); }

.form-alert {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.form-alert.show { display: flex; }
.form-alert svg { width: 15px; height: 15px; flex-shrink: 0; }

.submit-btn { width: 100%; padding: 12px; }

.demo-hint {
  margin-top: 18px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.demo-hint b { color: var(--text); }

/* ============================================================
   Icon-prefixed inputs
   ============================================================ */

.icon-field-wrap { position: relative; }

.icon-field-wrap .field-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}

.icon-field-wrap input { padding-left: 34px !important; }

.field input[type="date"] {
  color-scheme: light;
  cursor: pointer;
}

.field input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  filter: invert(38%) sepia(85%) saturate(2200%) hue-rotate(340deg) brightness(97%) contrast(96%);
}

.field input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background: rgba(255, 107, 53, 0.12);
}

/* ============================================================
   Searchable combobox (labourer / material / project pickers)
   ============================================================ */

.combo-wrap { position: relative; }

.combo-panel {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 260;
  padding: 5px;
  display: none;
}

.combo-panel.show { display: block; }

.combo-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 5px;
  cursor: pointer;
}

.combo-option:hover, .combo-option.active { background: var(--surface-2); }

.combo-option .combo-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.combo-option .combo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.combo-option .combo-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-option .combo-sub {
  font-size: 11px;
  color: var(--muted);
}

.combo-empty {
  padding: 16px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   Restricted-access overlay
   ============================================================ */

.perm-restricted-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 20, 28, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.perm-restricted-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  max-width: 380px;
  text-align: center;
  border-top: 4px solid var(--danger);
}

.perm-restricted-icon {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.perm-restricted-icon svg { width: 26px; height: 26px; }

.perm-restricted-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.perm-restricted-card p { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.perm-restricted-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.perm-restricted-actions .btn { flex: 1; }

/* ============================================================
   Dashboard — module strip, progress rings, charts
   ============================================================ */

.module-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.module-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius-lg);
  color: #fff;
  overflow: hidden;
  transition: transform 0.15s ease;
  border-bottom: 3px solid rgba(0, 0, 0, 0.15);
}

.module-card:hover {
  transform: translateY(-3px);
}

.module-card.c1 { background: var(--accent-2); }
.module-card.c2 { background: var(--navy); }
.module-card.c3 { background: var(--success); }
.module-card.c4 { background: #db2777; }

.module-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.module-icon svg { width: 22px; height: 22px; }

.module-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.module-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.module-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  margin: 2px 0 1px;
}

.module-sub {
  display: block;
  font-size: 11px;
  opacity: 0.85;
}

.module-arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform 0.15s ease;
}

.module-arrow svg { width: 14px; height: 14px; }

.module-card:hover .module-arrow {
  transform: translateX(3px);
}

/* ---------- Chart panels ---------- */

.chart-bar-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 190px;
  padding: 10px 4px 0;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  height: 100%;
  gap: 8px;
}

.bar-col .bar-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.bar-col .bar-shape {
  width: 60%;
  max-width: 34px;
  border-radius: 3px 3px 1px 1px;
  background: var(--accent-2);
  transition: filter 0.15s ease;
  min-height: 4px;
}

.bar-col:hover .bar-shape { filter: brightness(1.15); }

.bar-col .bar-label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 6px 4px 0;
}

.donut-wrap svg { flex-shrink: 0; }

.donut-center-value {
  font-size: 20px;
  font-weight: 800;
  fill: var(--text);
}

.donut-center-label {
  font-size: 10px;
  fill: var(--muted);
  font-weight: 600;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 11px;
  flex: 1;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}

.donut-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.donut-legend-label {
  flex: 1;
  color: var(--text);
  font-weight: 600;
}

.donut-legend-value {
  font-weight: 800;
  color: var(--muted);
}

.chart-empty {
  text-align: center;
  padding: 40px 10px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Progress ring (project completion) ---------- */

.progress-ring-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}

.progress-ring-wrap svg { flex-shrink: 0; }

.progress-ring-value {
  font-size: 20px;
  font-weight: 800;
  fill: var(--text);
}

.progress-ring-meta strong {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  margin-bottom: 2px;
}

.progress-ring-meta span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   Inline "add row" forms
   ============================================================ */

.inline-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.inline-add-form .field {
  flex: 1;
  min-width: 120px;
  margin-bottom: 0;
}

.inline-add-form .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .inline-add-form { flex-direction: column; align-items: stretch; }
  .inline-add-form .field { min-width: 0; }
  .inline-add-form .btn { width: 100%; }
}
