/* ============================================================
   GobDigital – Municipal Platform Design System
   ============================================================ */

/* Google Fonts already loaded via HTML */
:root {
  /* === Core Palette === */
  --primary: #1a3a6b;
  --primary-light: #2557a7;
  --primary-dark: #0f2347;
  --accent: #e8a020;
  --accent-light: #f5b942;
  --secondary: #2d9cdb;
  --secondary-light: #56b8f5;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #2980b9;

  /* === Neutrals === */
  --bg-base: #f0f4f9;
  --bg-surface: #ffffff;
  --bg-muted: #e8eef5;
  --bg-dark: #0d1b35;
  --bg-card: #ffffff;
  --border: #d0dae8;
  --border-light: #e8eef5;

  /* === Text === */
  --text-primary: #0d1b35;
  --text-secondary: #4a5b78;
  --text-muted: #8a9bb5;
  --text-white: #ffffff;

  /* === Status Colors === */
  --status-submitted: #9b59b6;
  --status-received: #2980b9;
  --status-registered: #1abc9c;
  --status-assigned: #3498db;
  --status-review: #f39c12;
  --status-technical: #e67e22;
  --status-observed: #e74c3c;
  --status-waiting: #95a5a6;
  --status-approved: #27ae60;
  --status-rejected: #c0392b;
  --status-forwarded: #8e44ad;
  --status-final: #16a085;
  --status-finalized: #1e8449;

  /* === Spacing === */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-xxl: 48px;

  /* === Radii === */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* === Shadows === */
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --shadow-xl: 0 16px 64px rgba(0,0,0,.18);

  /* === Transitions === */
  --t-fast: .15s ease;
  --t-normal: .25s ease;
  --t-slow: .4s ease;

  /* === Font === */
  --font: 'Inter', system-ui, sans-serif;
  --fw-light: 300;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semi: 600;
  --fw-bold: 700;
  --fw-black: 800;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg-base); color: var(--text-primary); font-size: 14px; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, textarea, select { font-family: var(--font); font-size: 14px; }
img { max-width: 100%; }

/* ============================================================
   APP SCREENS
   ============================================================ */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }
.app-screen.active { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1b35 0%, #1a3a6b 40%, #2557a7 70%, #1a3a6b 100%);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.landing-bg::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(37,87,167,.3) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(232,160,32,.15) 0%, transparent 50%);
}
.landing-overlay {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.landing-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: var(--sp-xl); gap: var(--sp-xxl); }
.landing-logo { display: flex; align-items: center; gap: var(--sp-lg); color: white; text-align: center; }
.logo-icon { width: 80px; height: 80px; background: rgba(255,255,255,.15); backdrop-filter: blur(10px); border-radius: var(--r-xl); display: flex; align-items: center; justify-content: center; font-size: 36px; border: 1px solid rgba(255,255,255,.2); }
.logo-text h1 { font-size: 42px; font-weight: var(--fw-black); letter-spacing: -1px; }
.logo-text p { font-size: 16px; color: rgba(255,255,255,.7); font-weight: var(--fw-light); }
.landing-cards { display: flex; gap: var(--sp-xl); flex-wrap: wrap; justify-content: center; }
.portal-card {
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r-xl);
  padding: var(--sp-xl) var(--sp-xxl);
  color: white;
  cursor: pointer;
  transition: all var(--t-normal);
  max-width: 380px;
  display: flex; flex-direction: column; gap: var(--sp-md); align-items: center; text-align: center;
}
.portal-card:hover { background: rgba(255,255,255,.14); transform: translateY(-6px); box-shadow: 0 20px 60px rgba(0,0,0,.3); border-color: rgba(255,255,255,.3); }
.portal-card-icon { font-size: 48px; margin-bottom: var(--sp-sm); }
.citizen-card .portal-card-icon { color: var(--accent-light); }
.staff-card .portal-card-icon { color: var(--secondary-light); }
.portal-card h2 { font-size: 22px; font-weight: var(--fw-bold); }
.portal-card p { color: rgba(255,255,255,.75); font-size: 14px; }
.portal-features { display: flex; flex-direction: column; gap: var(--sp-xs); width: 100%; }
.portal-features span { font-size: 13px; color: rgba(255,255,255,.8); display: flex; align-items: center; gap: var(--sp-sm); }
.portal-features i { color: var(--accent-light); }
.landing-footer { display: flex; gap: var(--sp-xl); color: rgba(255,255,255,.5); font-size: 13px; flex-wrap: wrap; justify-content: center; }
.landing-footer span { display: flex; align-items: center; gap: var(--sp-sm); }

/* ============================================================
   AUTH SCREENS
   ============================================================ */
.auth-container {
  max-width: 480px; margin: auto; padding: var(--sp-xl);
  display: flex; flex-direction: column; gap: var(--sp-lg);
  background: var(--bg-surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  margin-top: 60px; margin-bottom: 40px;
}
.screen:not(.app-screen) { align-items: center; justify-content: flex-start; background: linear-gradient(135deg, #0f2347 0%, #1a3a6b 100%); padding: var(--sp-lg); }
.auth-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--sp-sm); }
.auth-brand-icon { width: 64px; height: 64px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; font-size: 28px; color: white; }
.auth-brand-icon.citizen { background: linear-gradient(135deg, var(--accent), var(--accent-light)); }
.auth-brand-icon.staff { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.auth-brand h2 { font-size: 22px; font-weight: var(--fw-bold); color: var(--text-primary); }
.auth-brand p { color: var(--text-muted); font-size: 13px; }
.auth-tabs { display: flex; gap: 2px; background: var(--bg-muted); border-radius: var(--r-md); padding: 4px; }
.auth-tab { flex: 1; padding: 8px; border-radius: var(--r-sm); font-size: 14px; font-weight: var(--fw-medium); color: var(--text-secondary); transition: all var(--t-fast); }
.auth-tab.active { background: var(--bg-surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.auth-form { display: flex; flex-direction: column; gap: var(--sp-md); }
.auth-form.hidden { display: none; }
.btn-back { background: none; color: rgba(255,255,255,.7); font-size: 13px; margin-top: var(--sp-sm); align-self: center; transition: color var(--t-fast); }
.btn-back:hover { color: white; }
.btn-back i { margin-right: var(--sp-xs); }
.demo-credentials { background: var(--bg-muted); border-radius: var(--r-md); padding: var(--sp-md); font-size: 12px; }
.demo-credentials p { color: var(--text-secondary); margin-bottom: var(--sp-sm); }
.cred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-xs); }
.cred-grid span { background: var(--bg-surface); border-radius: var(--r-sm); padding: 4px 8px; cursor: pointer; color: var(--primary); font-family: monospace; font-size: 11px; border: 1px solid var(--border); transition: background var(--t-fast); }
.cred-grid span:hover { background: var(--primary); color: white; }
.staff-auth { border-top: 4px solid var(--primary); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: var(--sp-xs); }
.form-group label { font-size: 13px; font-weight: var(--fw-medium); color: var(--text-secondary); display: flex; align-items: center; gap: var(--sp-xs); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,87,167,.12);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }
.error-msg { color: var(--danger); font-size: 12px; min-height: 18px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  padding: 10px 20px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: var(--fw-semi);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-sm);
  transition: all var(--t-fast);
  cursor: pointer;
  border: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-light), #3068c5); }
.btn-secondary { background: linear-gradient(135deg, var(--secondary), var(--secondary-light)); color: white; }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: white; }
.btn-success { background: linear-gradient(135deg, #1e8449, var(--success)); color: white; }
.btn-danger { background: linear-gradient(135deg, #c0392b, var(--danger)); color: white; }
.btn-warning { background: linear-gradient(135deg, #ca8a04, var(--warning)); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { background: var(--bg-muted); border-color: var(--primary-light); color: var(--primary); transform: none; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-muted); transform: none; box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--r-lg); }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--r-sm); }

/* ============================================================
   TOP NAV
   ============================================================ */
.top-nav {
  height: 64px;
  display: flex; align-items: center;
  padding: 0 var(--sp-xl);
  gap: var(--sp-lg);
  z-index: 100;
  flex-shrink: 0;
}
.citizen-nav { background: linear-gradient(90deg, var(--primary-dark), var(--primary)); box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.staff-nav { background: linear-gradient(90deg, #0d1b35, #1a3a6b); box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.nav-brand { display: flex; align-items: center; gap: var(--sp-sm); color: white; font-size: 16px; font-weight: var(--fw-bold); flex-shrink: 0; }
.nav-brand i { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: var(--sp-xs); flex: 1; }
.nav-link { color: rgba(255,255,255,.7); padding: 8px 14px; border-radius: var(--r-md); font-size: 13px; font-weight: var(--fw-medium); display: flex; align-items: center; gap: var(--sp-xs); transition: all var(--t-fast); white-space: nowrap; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.12); }
.nav-user { display: flex; align-items: center; gap: var(--sp-sm); color: white; flex-shrink: 0; }
.user-avatar { width: 36px; height: 36px; border-radius: var(--r-full); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.citizen-avatar { background: var(--accent); color: white; }
.staff-avatar { background: rgba(255,255,255,.2); color: white; }
.user-info { display: flex; flex-direction: column; }
.user-info span { font-size: 13px; font-weight: var(--fw-semi); line-height: 1; }
.user-info small { font-size: 11px; color: rgba(255,255,255,.6); }
.btn-logout { color: rgba(255,255,255,.6); font-size: 18px; padding: 6px; border-radius: var(--r-sm); transition: color var(--t-fast); }
.btn-logout:hover { color: var(--danger); }
.badge { background: var(--danger); color: white; font-size: 10px; font-weight: var(--fw-bold); border-radius: var(--r-full); padding: 2px 6px; min-width: 18px; text-align: center; }
.badge.hidden { display: none; }

/* ============================================================
   STAFF LAYOUT
   ============================================================ */
.staff-layout { display: flex; flex: 1; overflow: hidden; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg-dark);
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: var(--sp-md) 0;
}
.sidebar-section { padding: 0 var(--sp-md); margin-bottom: var(--sp-md); }
.sidebar-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,.3); padding: var(--sp-sm) var(--sp-md); margin-bottom: var(--sp-xs); }
.sidebar-link {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: 10px var(--sp-md);
  color: rgba(255,255,255,.6);
  font-size: 13px; font-weight: var(--fw-medium);
  border-radius: var(--r-md); margin: 2px var(--sp-sm);
  transition: all var(--t-fast);
  cursor: pointer;
}
.sidebar-link:hover { color: white; background: rgba(255,255,255,.08); }
.sidebar-link.active { color: white; background: var(--primary-light); }
.sidebar-link i { width: 18px; text-align: center; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.app-main { flex: 1; overflow-y: auto; padding: var(--sp-xl); }
.staff-main { background: var(--bg-base); }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-xl); flex-wrap: wrap; gap: var(--sp-md); }
.page-title { font-size: 24px; font-weight: var(--fw-bold); color: var(--text-primary); }
.page-title small { display: block; font-size: 13px; font-weight: var(--fw-normal); color: var(--text-muted); margin-top: 2px; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; }

/* ============================================================
   CARDS
   ============================================================ */
.card { background: var(--bg-card); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border-light); }
.card-header { padding: var(--sp-lg); border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 16px; font-weight: var(--fw-semi); color: var(--text-primary); display: flex; align-items: center; gap: var(--sp-sm); }
.card-body { padding: var(--sp-lg); }
.card-footer { padding: var(--sp-md) var(--sp-lg); border-top: 1px solid var(--border-light); }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-md); margin-bottom: var(--sp-xl); }
.stat-card {
  background: var(--bg-card); border-radius: var(--r-lg);
  padding: var(--sp-lg);
  display: flex; align-items: center; gap: var(--sp-md);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
  transition: all var(--t-normal);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon { width: 52px; height: 52px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: var(--fw-black); color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-change { font-size: 12px; margin-top: var(--sp-xs); font-weight: var(--fw-medium); }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* === Stat Colors === */
.stat-blue .stat-icon { background: rgba(37,87,167,.12); color: var(--primary-light); }
.stat-green .stat-icon { background: rgba(39,174,96,.12); color: var(--success); }
.stat-orange .stat-icon { background: rgba(243,156,18,.12); color: var(--warning); }
.stat-red .stat-icon { background: rgba(231,76,60,.12); color: var(--danger); }
.stat-purple .stat-icon { background: rgba(142,68,173,.12); color: #8e44ad; }
.stat-teal .stat-icon { background: rgba(22,160,133,.12); color: var(--status-final); }

/* ============================================================
   TABLES
   ============================================================ */
.table-container { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--bg-muted); padding: 12px 16px; text-align: left; font-size: 12px; font-weight: var(--fw-semi); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border-light); transition: background var(--t-fast); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-muted); }
tbody td { padding: 12px 16px; font-size: 13px; color: var(--text-primary); }
.td-id { font-family: monospace; color: var(--primary); font-weight: var(--fw-semi); }
.table-actions { display: flex; gap: var(--sp-xs); }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 11px; font-weight: var(--fw-semi);
  white-space: nowrap;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-submitted { background: rgba(155,89,182,.15); color: var(--status-submitted); }
.badge-submitted::before { background: var(--status-submitted); }
.badge-received { background: rgba(41,128,185,.15); color: var(--status-received); }
.badge-received::before { background: var(--status-received); }
.badge-registered { background: rgba(26,188,156,.15); color: var(--status-registered); }
.badge-registered::before { background: var(--status-registered); }
.badge-assigned { background: rgba(52,152,219,.15); color: var(--status-assigned); }
.badge-assigned::before { background: var(--status-assigned); }
.badge-review { background: rgba(243,156,18,.15); color: var(--status-review); }
.badge-review::before { background: var(--status-review); }
.badge-technical { background: rgba(230,126,34,.15); color: var(--status-technical); }
.badge-technical::before { background: var(--status-technical); }
.badge-observed { background: rgba(231,76,60,.15); color: var(--status-observed); }
.badge-observed::before { background: var(--status-observed); }
.badge-waiting { background: rgba(149,165,166,.15); color: #7f8c8d; }
.badge-waiting::before { background: var(--status-waiting); }
.badge-approved { background: rgba(39,174,96,.15); color: var(--status-approved); }
.badge-approved::before { background: var(--status-approved); }
.badge-rejected { background: rgba(192,57,43,.15); color: var(--status-rejected); }
.badge-rejected::before { background: var(--status-rejected); }
.badge-forwarded { background: rgba(142,68,173,.15); color: var(--status-forwarded); }
.badge-forwarded::before { background: var(--status-forwarded); }
.badge-final { background: rgba(22,160,133,.15); color: var(--status-final); }
.badge-final::before { background: var(--status-final); }
.badge-finalized { background: rgba(30,132,73,.15); color: var(--status-finalized); }
.badge-finalized::before { background: var(--status-finalized); }

/* ============================================================
   WORKFLOW TIMELINE
   ============================================================ */
.workflow-timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: var(--sp-md); position: relative; }
.timeline-line { display: flex; flex-direction: column; align-items: center; }
.timeline-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  border: 2px solid;
}
.timeline-dot.done { background: var(--success); border-color: var(--success); color: white; }
.timeline-dot.current { background: var(--primary-light); border-color: var(--primary-light); color: white; box-shadow: 0 0 0 4px rgba(37,87,167,.2); }
.timeline-dot.pending { background: var(--bg-muted); border-color: var(--border); color: var(--text-muted); }
.timeline-connector { width: 2px; flex: 1; background: var(--border); min-height: 20px; margin: 4px 0; }
.timeline-connector.done { background: var(--success); }
.timeline-body { flex: 1; padding-bottom: var(--sp-lg); }
.timeline-header { display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-xs); }
.timeline-title { font-weight: var(--fw-semi); font-size: 14px; }
.timeline-meta { font-size: 12px; color: var(--text-muted); }
.timeline-comment { background: var(--bg-muted); border-radius: var(--r-sm); padding: var(--sp-sm) var(--sp-md); font-size: 13px; color: var(--text-secondary); margin-top: var(--sp-sm); border-left: 3px solid var(--primary-light); }

/* ============================================================
   PROCEDURE CARD (Citizen)
   ============================================================ */
.procedure-card {
  background: var(--bg-card); border-radius: var(--r-lg); padding: var(--sp-lg);
  border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: var(--sp-sm);
  transition: all var(--t-normal);
}
.procedure-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.procedure-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-sm); }
.procedure-card-id { font-size: 12px; font-family: monospace; color: var(--primary); font-weight: var(--fw-semi); background: rgba(37,87,167,.08); padding: 3px 8px; border-radius: var(--r-sm); }
.procedure-card-type { font-size: 16px; font-weight: var(--fw-semi); color: var(--text-primary); }
.procedure-card-date { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.procedure-card-progress { height: 4px; background: var(--bg-muted); border-radius: var(--r-full); overflow: hidden; }
.procedure-card-progress-bar { height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--primary-light), var(--secondary)); transition: width var(--t-slow); }
.procedure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-md); }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notification-item { display: flex; gap: var(--sp-md); padding: var(--sp-md); border-radius: var(--r-md); background: var(--bg-muted); border-left: 4px solid; transition: all var(--t-fast); }
.notification-item:hover { box-shadow: var(--shadow-sm); }
.notification-item.unread { background: rgba(37,87,167,.05); border-left-color: var(--primary-light); }
.notification-item.read { border-left-color: var(--border); }
.notification-icon { width: 36px; height: 36px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.notification-body { flex: 1; }
.notification-title { font-size: 13px; font-weight: var(--fw-medium); color: var(--text-primary); }
.notification-msg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.notification-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   DOCUMENT ITEMS
   ============================================================ */
.doc-item { display: flex; align-items: center; gap: var(--sp-md); padding: var(--sp-md); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-surface); transition: all var(--t-fast); }
.doc-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.doc-icon { width: 40px; height: 40px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(231,76,60,.1); color: var(--danger); flex-shrink: 0; }
.doc-icon.pdf { background: rgba(231,76,60,.1); color: var(--danger); }
.doc-icon.img { background: rgba(52,152,219,.1); color: var(--secondary); }
.doc-icon.generic { background: rgba(37,87,167,.1); color: var(--primary-light); }
.doc-info { flex: 1; }
.doc-name { font-size: 13px; font-weight: var(--fw-medium); color: var(--text-primary); }
.doc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.doc-actions { display: flex; gap: var(--sp-xs); }

/* ============================================================
   QR CODE DISPLAY
   ============================================================ */
.qr-card { text-align: center; padding: var(--sp-xl); display: flex; flex-direction: column; align-items: center; gap: var(--sp-md); }
.qr-frame { background: white; padding: var(--sp-md); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); border: 3px solid var(--primary); }
.qr-id { font-family: monospace; font-size: 18px; font-weight: var(--fw-bold); color: var(--primary); letter-spacing: 2px; }
.qr-label { font-size: 13px; color: var(--text-secondary); }

/* ============================================================
   SEARCH & FILTERS
   ============================================================ */
.search-bar { display: flex; gap: var(--sp-sm); align-items: center; flex-wrap: wrap; padding: var(--sp-md); background: var(--bg-surface); border-radius: var(--r-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.search-input { flex: 1; min-width: 200px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md); font-size: 14px; outline: none; transition: border-color var(--t-fast); }
.search-input:focus { border-color: var(--primary-light); }
.filter-select { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--r-md); font-size: 13px; outline: none; background: var(--bg-surface); color: var(--text-primary); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(13,27,53,.6); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: var(--sp-lg); }
.modal-overlay.hidden { display: none; }
.modal-box { background: var(--bg-surface); border-radius: var(--r-xl); box-shadow: var(--shadow-xl); max-width: 700px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; padding: var(--sp-xl); }
.modal-close { position: absolute; top: var(--sp-md); right: var(--sp-md); width: 32px; height: 32px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 16px; transition: all var(--t-fast); }
.modal-close:hover { background: var(--bg-muted); color: var(--text-primary); }
.modal-title { font-size: 20px; font-weight: var(--fw-bold); margin-bottom: var(--sp-lg); color: var(--text-primary); padding-right: 40px; }
.modal-section { margin-bottom: var(--sp-lg); }
.modal-section-title { font-size: 13px; font-weight: var(--fw-semi); text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: var(--sp-md); padding-bottom: var(--sp-sm); border-bottom: 1px solid var(--border); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container { position: fixed; bottom: var(--sp-xl); right: var(--sp-xl); z-index: 2000; display: flex; flex-direction: column; gap: var(--sp-sm); pointer-events: none; }
.toast {
  min-width: 300px; max-width: 400px;
  background: var(--bg-dark); color: white;
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  display: flex; align-items: center; gap: var(--sp-md);
  animation: slideInRight .3s ease, fadeOut .3s ease 3.7s forwards;
  pointer-events: all;
  border-left: 4px solid var(--primary-light);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: var(--fw-semi); }
.toast-msg { font-size: 12px; color: rgba(255,255,255,.7); margin-top: 2px; }

@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

/* ============================================================
   PROCEDURE SUBMISSION FORM
   ============================================================ */
.procedure-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-md); margin-bottom: var(--sp-lg); }
.type-btn {
  background: var(--bg-surface); border: 2px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-lg) var(--sp-md);
  text-align: center; cursor: pointer;
  transition: all var(--t-normal);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-sm);
}
.type-btn:hover { border-color: var(--primary-light); background: rgba(37,87,167,.05); }
.type-btn.selected { border-color: var(--primary); background: rgba(37,87,167,.08); box-shadow: 0 0 0 3px rgba(37,87,167,.15); }
.type-btn-icon { font-size: 28px; }
.type-btn-label { font-size: 12px; font-weight: var(--fw-medium); color: var(--text-secondary); }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg); padding: var(--sp-xxl);
  text-align: center; cursor: pointer;
  transition: all var(--t-normal);
  background: var(--bg-muted);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary-light); background: rgba(37,87,167,.05); }
.upload-zone i { font-size: 36px; color: var(--text-muted); margin-bottom: var(--sp-sm); }
.upload-zone p { color: var(--text-secondary); font-size: 14px; }
.upload-zone small { color: var(--text-muted); font-size: 12px; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container { position: relative; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: var(--sp-lg); margin-bottom: var(--sp-xl); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: var(--sp-xxl); color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: var(--sp-md); opacity: .4; }
.empty-state h3 { font-size: 18px; font-weight: var(--fw-semi); color: var(--text-secondary); margin-bottom: var(--sp-sm); }
.empty-state p { font-size: 14px; }

/* ============================================================
   ROUTING/FORWARD DEPARTMENT DISPLAY
   ============================================================ */
.route-trail { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-sm); }
.route-dept { background: rgba(37,87,167,.1); color: var(--primary); padding: 4px 12px; border-radius: var(--r-full); font-size: 12px; font-weight: var(--fw-medium); }
.route-arrow { color: var(--text-muted); font-size: 14px; }
.route-dept.current { background: var(--primary); color: white; }

/* ============================================================
   DEPARTMENT BADGE
   ============================================================ */
.dept-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-full); font-size: 11px; font-weight: var(--fw-semi); background: rgba(37,87,167,.1); color: var(--primary); }

/* ============================================================
   STEP INDICATOR
   ============================================================ */
.step-indicator { display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-xl); }
.step { display: flex; align-items: center; gap: var(--sp-sm); }
.step-num { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: var(--fw-bold); border: 2px solid var(--border); color: var(--text-muted); }
.step.active .step-num { border-color: var(--primary); background: var(--primary); color: white; }
.step.done .step-num { border-color: var(--success); background: var(--success); color: white; }
.step-label { font-size: 12px; font-weight: var(--fw-medium); color: var(--text-muted); }
.step.active .step-label { color: var(--primary); }
.step-sep { flex: 1; height: 2px; background: var(--border); max-width: 40px; }

/* ============================================================
   ROLE PERMISSIONS TABLE
   ============================================================ */
.perm-check { color: var(--success); font-size: 16px; }
.perm-x { color: var(--danger); font-size: 16px; }

/* ============================================================
   AUDIT LOG
   ============================================================ */
.audit-item { display: flex; gap: var(--sp-md); padding: var(--sp-md); border-bottom: 1px solid var(--border-light); font-size: 13px; }
.audit-time { color: var(--text-muted); white-space: nowrap; font-family: monospace; font-size: 12px; }
.audit-user { font-weight: var(--fw-semi); color: var(--primary); }
.audit-action { color: var(--text-secondary); }
.audit-target { color: var(--text-primary); font-weight: var(--fw-medium); }

/* ============================================================
   MESSAGING
   ============================================================ */
.message-bubble { background: var(--bg-muted); border-radius: var(--r-md); padding: var(--sp-md); margin-bottom: var(--sp-sm); }
.message-bubble.sent { background: rgba(37,87,167,.1); margin-left: var(--sp-xl); }
.message-bubble.received { margin-right: var(--sp-xl); }
.message-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-xs); }
.message-sender { font-size: 12px; font-weight: var(--fw-semi); color: var(--primary); }
.message-time { font-size: 11px; color: var(--text-muted); }
.message-text { font-size: 13px; color: var(--text-primary); }

/* ============================================================
   TRACKING PAGE
   ============================================================ */
.tracking-search { display: flex; gap: var(--sp-sm); align-items: center; margin-bottom: var(--sp-xl); }
.tracking-search input { flex: 1; }

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }
.mb-sm { margin-bottom: var(--sp-sm); }
.mb-md { margin-bottom: var(--sp-md); }
.mb-lg { margin-bottom: var(--sp-lg); }
.mb-xl { margin-bottom: var(--sp-xl); }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.font-mono { font-family: monospace; }
.font-bold { font-weight: var(--fw-bold); }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-md); }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .landing-cards { gap: var(--sp-md); }
  .portal-card { max-width: 100%; padding: var(--sp-lg); }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .logo-text h1 { font-size: 28px; }
  .app-main { padding: var(--sp-md); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-container { margin-top: var(--sp-lg); }
}
