/* ==========================================================================
   Expenser — Simple & Clean Orange-Blue Theme
   ========================================================================== */

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

:root {
  /* Orange & Blue Theme */
  --orange: #E8730E;
  --orange-dark: #C45F08;
  --orange-light: #FFF3E8;
  --orange-border: #FCD5B0;

  --blue: #1A73E8;
  --blue-dark: #1557B0;
  --blue-light: #E8F0FE;
  --blue-border: #A8C7FA;

  /* Surfaces */
  --bg-app: #F5F6FA;
  --bg-white: #FFFFFF;
  --bg-hover: #F0F2F5;
  --bg-muted: #ECEEF2;

  /* Text */
  --text-dark: #1F2937;
  --text-mid: #6B7280;
  --text-light: #9CA3AF;
  --text-white: #FFFFFF;

  /* Borders */
  --border: #E5E7EB;
  --border-dark: #D1D5DB;

  /* Status Colors */
  --green: #059669;
  --green-light: #ECFDF5;
  --red: #DC2626;
  --red-light: #FEF2F2;
  --yellow: #D97706;
  --yellow-light: #FFFBEB;

  /* Geometry */
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Consolas", "Courier New", monospace;
}

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

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--text-dark);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Utility */
.tabular, .font-mono { font-variant-numeric: tabular-nums; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-muted { color: var(--text-mid); }
.text-inflow { color: var(--green) !important; }
.text-outflow { color: var(--red) !important; }

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

/* ---- Sidebar (Exact Match to Reference Design) ---- */
.app-sidebar {
  width: 250px;
  background: #FCFBF9;
  border-right: 1px solid #EFECE6;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform 0.2s ease, width 0.2s ease;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem 1rem 1rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: none;
}

.brand-logo-wrap {
  width: 44px;
  height: 44px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.brand-text {
  overflow: hidden;
  flex: 1;
}

.brand-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1E293B;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.brand-org {
  font-size: 0.76rem;
  color: #64748B;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Inter', sans-serif;
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: #F8FAFC;
  color: #1E293B;
  border-color: #CBD5E1;
}

.sidebar-nav {
  padding: 0.4rem 0.85rem 1.25rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #94A3B8;
  padding: 1.1rem 0.75rem 0.35rem 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: 12px;
  color: #334155;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.nav-item:hover {
  background: #F8FAFC;
  color: #0F172A;
}

.nav-item .nav-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: #334155;
  flex: 1;
  white-space: nowrap;
}

.nav-item .nav-arrow {
  width: 14px;
  height: 14px;
  color: #94A3B8;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.nav-item:hover .nav-arrow {
  color: #64748B;
  transform: translateX(2px);
}

/* Badge Icon Containers */
.nav-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.badge-orange-solid {
  background: transparent;
  color: #D97706;
}

.badge-green-circle {
  background: #E6F7F0;
}

.badge-red-circle {
  background: #FFEAEA;
}

.badge-blue-circle {
  background: #EFF6FF;
}

.badge-slate-circle {
  background: #F1F5F9;
}

/* Active State: Dashboard (Exact match to reference image) */
.nav-item.active {
  background: #FDF4EC;
  border-radius: 12px;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4.5px;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  background: #C45F08;
}

.nav-item.active .nav-text {
  color: #1E293B;
  font-weight: 600;
}

/* Manu Mam Highlight Item (as shown in reference image) */
.nav-item.manu-highlight {
  background: #F0F7FF;
  border-radius: 12px;
}

.nav-item.manu-highlight .nav-text {
  color: #1E3A8A;
  font-weight: 500;
}

.nav-item.manu-highlight .nav-arrow {
  color: #60A5FA;
}

.nav-item.manu-highlight:hover {
  background: #E5F0FF;
}

/* Sidebar Footer (Profile) */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid #EFECE6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FCFBF9;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: #475569;
  flex-shrink: 0;
}

.user-meta { overflow: hidden; }

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.65rem;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.sidebar-footer .btn-icon {
  color: #64748B;
}

.sidebar-footer .btn-icon:hover {
  color: #1E293B;
  background: #F1F5F9;
}

/* ---- Main Content ---- */
.app-main {
  flex: 1;
  margin-left: 250px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}

/* Collapsed sidebar mode */
.app-sidebar.collapsed {
  width: 72px;
}
.app-sidebar.collapsed .brand-text,
.app-sidebar.collapsed .nav-text,
.app-sidebar.collapsed .nav-arrow,
.app-sidebar.collapsed .nav-label,
.app-sidebar.collapsed .user-meta {
  display: none !important;
}
.app-sidebar.collapsed .sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.4rem;
  gap: 0.6rem;
}
.app-sidebar.collapsed .sidebar-collapse-btn {
  display: flex !important;
  transform: rotate(180deg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  background: #FFFFFF;
}
.app-sidebar.collapsed .sidebar-collapse-btn:hover {
  background: #FFF7ED;
  color: #D97706;
  border-color: #FDBA74;
}
.app-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.6rem 0.25rem;
}
.app-sidebar.collapsed .sidebar-footer {
  justify-content: center;
  padding: 0.75rem 0.25rem;
}
.app-main.sidebar-collapsed {
  margin-left: 72px;
}

/* Floating reveal button (visible on mobile or when menu is hidden) */
.menu-reveal-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 50;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: #1E293B;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.menu-reveal-btn:hover {
  background: #F8FAFC;
  color: #D97706;
}
.app-main.sidebar-collapsed .menu-reveal-btn {
  display: flex;
}

/* Header (Hidden for clean dashboard aesthetic) */
.app-header {
  display: none !important;
}

.app-content {
  padding: 1.75rem 2rem;
  flex: 1;
  max-width: 1460px;
  width: 100%;
}

/* ==========================================================================
   DASHBOARD REDESIGN (Exact Match to User Reference Image)
   ========================================================================== */

.dash-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.dash-title-group .dash-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
}

.dash-title-group .dash-subtitle {
  font-size: 0.85rem;
  color: #64748B;
  margin-top: 4px;
}

.dash-actions-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.dash-period-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.period-select-box {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.period-select-box svg {
  color: #64748B;
  flex-shrink: 0;
}

.period-select-native {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1E293B;
  cursor: pointer;
  outline: none;
  padding-right: 1.15rem;
  appearance: none;
  -webkit-appearance: none;
}

.period-select-caret {
  position: absolute;
  right: 0.65rem;
  pointer-events: none;
}

.dash-period-range {
  font-size: 0.82rem;
  color: #64748B;
  font-weight: 500;
}

.custom-date-box {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.custom-date-box input[type="date"] {
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  color: #1E293B;
  background: #F8FAFC;
  outline: none;
  font-family: inherit;
  height: 30px;
}

.custom-date-box input[type="date"]:focus {
  border-color: #2563EB;
  background: #FFFFFF;
}

.custom-date-box .btn-date-apply {
  background: #2563EB;
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  height: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background 0.15s;
}

.custom-date-box .btn-date-apply:hover {
  background: #1D4ED8;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.hero-btn-orange {
  background: #E66A1F;
  color: #FFFFFF;
}
.hero-btn-orange:hover {
  background: #C4550F;
  box-shadow: 0 2px 8px rgba(230, 106, 31, 0.3);
}

.hero-btn-blue {
  background: #0284C7;
  color: #FFFFFF;
}
.hero-btn-blue:hover {
  background: #0369A1;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

/* 4 Wave Cards */
.dash-wave-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1200px) {
  .dash-wave-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .dash-wave-grid { grid-template-columns: 1fr; }
}

.wave-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1.85rem 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.wave-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.wave-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.wave-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-circle-green { background: #ECFDF5; color: #10B981; }
.icon-circle-red { background: #FEF2F2; color: #EF4444; }
.icon-circle-blue { background: #EFF6FF; color: #3B82F6; }
.icon-circle-purple { background: #F5F3FF; color: #8B5CF6; }

.wave-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
}

.badge-green-light {
  background: #ECFDF5;
  color: #059669;
}

.badge-red-light {
  background: #FEF2F2;
  color: #DC2626;
}

.wave-btn-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  background: #F3F4F6;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.wave-btn-link:hover {
  background: #E5E7EB;
}

.wave-card-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #64748B;
  margin-bottom: 0.25rem;
}

.wave-card-val {
  font-size: 1.65rem;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
  position: relative;
  z-index: 2;
}

.wave-card-val.text-green {
  color: #047857;
}

.wave-card-sub {
  font-size: 0.75rem;
  color: #94A3B8;
  position: relative;
  z-index: 2;
}

.card-wave-svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 52px;
  pointer-events: none;
  z-index: 1;
}

/* Secondary Horizontal Strip */
.dash-strip-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 1.15rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

@media (max-width: 900px) {
  .dash-strip-card { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}
@media (max-width: 500px) {
  .dash-strip-card { grid-template-columns: 1fr; }
}

.strip-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
}

.strip-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -0.75rem;
  top: 10%;
  bottom: 10%;
  width: 1px;
  background: #F1F5F9;
}

.strip-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bg-mint { background: #ECFDF5; }
.bg-sky { background: #EFF6FF; }
.bg-amber { background: #FFF7ED; }
.bg-slate { background: #F8FAFC; }

.strip-info { flex: 1; overflow: hidden; }

.strip-label {
  font-size: 0.78rem;
  color: #64748B;
  font-weight: 500;
  margin-bottom: 2px;
}

.strip-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
}

.strip-meta {
  font-size: 0.72rem;
  color: #94A3B8;
  margin-top: 2px;
  white-space: nowrap;
}

.strip-arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Side-by-Side Tables Row */
.dash-tables-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 992px) {
  .dash-tables-row { grid-template-columns: 1fr; }
}

.dash-table-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.dash-table-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dash-table-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dash-card-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bg-teal-soft { background: #E6F7F0; }
.bg-rose-soft { background: #FFEAEA; }

.dash-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0F172A;
}

.dash-view-all-btn {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dash-view-all-btn:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

.dash-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dash-data-table th {
  padding: 0.65rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748B;
  text-align: left;
  border-bottom: 1px solid #F1F5F9;
  white-space: nowrap;
}

.dash-data-table td {
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid #F8FAFC;
  color: #334155;
  vertical-align: middle;
  white-space: nowrap;
}

.dash-data-table td.desc-cell {
  white-space: normal;
  min-width: 170px;
  max-width: 260px;
}

.dash-data-table tr:hover td {
  background: #FAFAFC;
}

.pill-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-green { background: #DCFCE7; color: #15803D; }
.pill-blue { background: #DBEAFE; color: #1E40AF; }
.pill-purple { background: #EDE9FE; color: #6D28D9; }
.pill-orange { background: #FFEDD5; color: #C2410C; }
.pill-slate { background: #F1F5F9; color: #475569; }

.amount-green {
  font-weight: 700;
  color: #059669;
  white-space: nowrap;
}

.amount-blue {
  font-weight: 700;
  color: #0284C7;
  white-space: nowrap;
}

.desc-main {
  font-weight: 600;
  color: #0F172A;
  line-height: 1.35;
}

.desc-vendor {
  font-size: 0.72rem;
  color: #64748B;
  margin-top: 2px;
}

.row-more-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.row-more-btn:hover {
  color: #1E293B;
  background: #F1F5F9;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn svg { width: 14px; height: 14px; stroke-width: 2; flex-shrink: 0; }

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #FFF;
}
.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.btn-inflow {
  background: var(--orange);
  border-color: var(--orange);
  color: #FFF;
  font-weight: 600;
}
.btn-inflow:hover {
  background: var(--orange-dark);
  border-color: var(--orange-dark);
}

.btn-outflow {
  background: var(--blue);
  border-color: var(--blue);
  color: #FFF;
  font-weight: 600;
}
.btn-outflow:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.btn-secondary {
  background: var(--bg-white);
  border-color: var(--border);
  color: var(--text-dark);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-dark);
}

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.72rem; line-height: 1.25; }

.btn-icon {
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn-icon:hover { color: #FFF; }
.btn-icon svg { width: 16px; height: 16px; }

/* ============ FILTER BAR ============ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 1rem;
  background: var(--bg-white);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-right: 0.15rem;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-muted);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.segmented-btn {
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-mid);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmented-btn:hover { color: var(--text-dark); }

.segmented-btn.active {
  background: var(--bg-white);
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ============ FORM CONTROLS ============ */
.form-control {
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
  font-family: inherit;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

select.form-control {
  cursor: pointer;
  padding-right: 1.75rem;
  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%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  appearance: none;
}

/* ============ SUMMARY CARDS ============ */
.metrics-primary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.metric-panel {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--blue);
}

.metric-panel-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-panel-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.metric-panel-sub {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Flow Strip */
.flow-summary-strip {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  box-shadow: var(--shadow);
}

.flow-col {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-right: 1px solid var(--border);
  padding-right: 1rem;
}

.flow-col:last-child { border-right: none; padding-right: 0; }

.flow-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-light);
}

.flow-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.flow-meta {
  font-size: 0.7rem;
  color: var(--text-mid);
}

/* ============ TABLES ============ */
.table-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.table-header-box {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--bg-app);
}

.table-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.table-title svg {
  width: 16px; height: 16px;
  color: var(--orange);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

table.data-table th {
  background: var(--bg-app);
  color: var(--text-mid);
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
}

table.data-table td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dark);
  vertical-align: middle;
}

table.data-table tbody tr:hover { background: var(--blue-light); }

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

.table-code {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
}

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-mode {
  background: var(--blue-light);
  color: var(--blue);
}

.badge-recorded {
  background: var(--green-light);
  color: var(--green);
}

.badge-missing {
  background: var(--yellow-light);
  color: var(--yellow);
}

.badge-category {
  background: #F3F4F6;
  color: #4B5563;
}

.badge-staff {
  background: var(--orange-light);
  color: var(--orange-dark);
}

/* ============ FORMS ============ */
.form-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--orange);
  padding: 0.6rem 1rem;
  background: var(--orange-light);
  border-bottom: 1px solid var(--orange-border);
  border-top: 1px solid var(--orange-border);
}

.form-section-title:first-child { border-top: none; }

.form-section-body { padding: 1rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem 1rem;
}

.form-full { grid-column: span 2; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label .required { color: var(--red); margin-left: 2px; }

.form-hint { font-size: 0.7rem; color: var(--text-light); }

/* ============ MODALS ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-box {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-app);
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
}

.modal-body { padding: 1rem; }

.modal-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--bg-app);
}

/* ============ TOAST ============ */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  background: #1F2937;
  color: #FFF;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-left: 4px solid var(--border);
}

.toast.toast-error { border-left-color: var(--red); }
.toast.toast-success { border-left-color: var(--green); }

/* ============ PRINT ============ */
@media print {
  body { background: #FFF !important; color: #000 !important; font-size: 9pt; }
  .app-sidebar, .app-header, .filter-bar, .btn, .no-print, .modal-overlay, .toast-container { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 0 !important; max-width: 100% !important; }
  .table-card { border: none !important; box-shadow: none !important; }
  table.data-table { border: 1px solid #000 !important; }
  table.data-table th, table.data-table td {
    border: 1px solid #ccc !important;
    padding: 3pt 5pt !important;
    color: #000 !important;
    font-size: 8.5pt !important;
  }
  table.data-table th { background: #eee !important; }
  .print-header { display: block !important; margin-bottom: 1rem; text-align: center; border-bottom: 2px solid #000; padding-bottom: 0.5rem; }
  .print-signatures { display: flex !important; justify-content: space-between; margin-top: 2rem; page-break-inside: avoid; }
  .sig-block { text-align: center; width: 160px; border-top: 1px solid #000; padding-top: 0.2rem; font-size: 8.5pt; }
}

.print-header, .print-signatures { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .metrics-primary-grid { grid-template-columns: repeat(2, 1fr); }
  .flow-summary-strip { grid-template-columns: repeat(2, 1fr); }
  .flow-col:nth-child(2) { border-right: none; }
}

@media (max-width: 768px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .mobile-toggle { display: block; }
  .metrics-primary-grid { grid-template-columns: 1fr; }
  .flow-summary-strip { grid-template-columns: 1fr; }
  .flow-col {
    border-right: none;
    padding-right: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
  }
  .flow-col:last-child { border-bottom: none; padding-bottom: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-full { grid-column: span 1; }
}
