/* ═══════════════════════════════════════════════════════════════
   UQAC SecureReport — TOPOMAP Technologies
   Brand: Red #EC333B, Navy #1A2B4A
   Design System: Premium dark dashboard (Linear/Notion tier)
   ═══════════════════════════════════════════════════════════════ */

/* Fonts loaded locally — no external requests */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-variable-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --red: #EC333B;
  --red-hover: #d42d35;
  --red-light: rgba(236,51,59,0.10);
  --red-glow: rgba(236,51,59,0.25);
  --red-soft: rgba(236,51,59,0.06);
  --navy: #1A2B4A;
  --grey: #5D6D7E;

  --bg: #0a0d12;
  --bg-sidebar: #0e1218;
  --bg-card: rgba(17,22,30,0.85);
  --bg-card-solid: #11161e;
  --bg-card-hover: #161d28;
  --bg-input: rgba(22,29,40,0.9);
  --bg-input-focus: #1c2536;
  --bg-elevated: #151c26;

  --text: #f0f2f5;
  --text-2: #8b95a5;
  --text-3: #515c6b;
  --text-4: #3a4350;

  --border: rgba(255,255,255,0.05);
  --border-2: rgba(255,255,255,0.08);
  --border-3: rgba(255,255,255,0.12);

  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.10);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.10);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.10);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,0.10);
  --purple: #a855f7;
  --purple-bg: rgba(168,85,247,0.10);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 2px 8px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3);

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

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.2s var(--ease);

  --sidebar-w: 256px;
}

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

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--red-light);
  color: var(--text);
}

a { color: var(--info); text-decoration: none; transition: color var(--transition); }
a:hover { color: #60a5fa; }

/* Global SVG fallback — prevent unsized inline SVGs from exploding */
svg:not([width]):not([class]):not(.donut-svg) { width: 18px; height: 18px; flex-shrink: 0; }

/* ═══════════ LOGIN ═══════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 25% 40%, rgba(236,51,59,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 25%, rgba(26,43,74,0.14) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(236,51,59,0.03) 0%, transparent 40%);
  pointer-events: none;
}
/* subtle grid pattern */
.login-page::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.login-box {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 420px;
  max-width: 92vw;
  box-shadow: var(--shadow-xl);
  text-align: center;
  position: relative;
  z-index: 1;
}
.login-box .logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--red), #ff5a5f);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 4px 16px var(--red-glow);
}
.login-box .logo-icon svg { width: 28px; height: 28px; color: #fff; }
.login-box .logo { margin-bottom: 6px; }
.login-box .logo h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
.login-box .logo h1 span { color: var(--red); }
.login-box .subtitle {
  font-size: 0.85rem; color: var(--text-2); margin-bottom: 32px; font-weight: 400;
}
.login-box .error-msg {
  background: var(--danger-bg); border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px;
  font-size: 0.85rem; color: var(--danger); display: none;
}
.login-box .version-tag {
  margin-top: 24px; font-size: 0.72rem; color: var(--text-3); font-weight: 400;
  letter-spacing: 0.02em;
}

/* ═══════════ FORMS ═══════════ */
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label {
  display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-2);
  margin-bottom: 6px; letter-spacing: 0.02em;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; background: var(--bg-input);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.9rem; font-family: inherit;
  transition: all var(--transition);
}
.form-group input::placeholder, .form-group textarea::placeholder {
  color: var(--text-3);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--red); background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--red-light);
}
.form-group input:hover, .form-group select:hover, .form-group textarea:hover {
  border-color: var(--border-3);
}
.form-group textarea { resize: vertical; min-height: 100px; line-height: 1.65; }
.form-group select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ═══════════ BUTTONS ═══════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border: none; border-radius: var(--radius-sm); font-size: 0.85rem;
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 100%);
  pointer-events: none;
  border-radius: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--red); color: #fff;
  box-shadow: 0 1px 3px rgba(236,51,59,0.3);
}
.btn-primary:hover {
  background: var(--red-hover);
  box-shadow: 0 4px 16px var(--red-glow);
}
.btn-secondary {
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-3); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 1px 3px rgba(34,197,94,0.3); }
.btn-success:hover { background: #16a34a; box-shadow: 0 4px 12px rgba(34,197,94,0.25); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 1px 3px rgba(239,68,68,0.3); }
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,0.25); }
.btn-sm { padding: 7px 14px; font-size: 0.78rem; }
.btn-icon { padding: 7px 9px; min-width: 32px; justify-content: center; }
.btn-icon svg { width: 15px; height: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-outline { background: transparent; border: 1px solid var(--border-2); color: var(--text-2); }
.btn-outline:hover { background: var(--bg-card-hover); color: var(--text); border-color: var(--border-3); }
.btn-outline::after { display: none; }
.btn-ghost { background: transparent; border: none; color: var(--text-2); padding: 7px 10px; }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.btn-ghost::after { display: none; }

/* ═══════════ LAYOUT ═══════════ */
.app-layout {
  min-height: 100vh;
}

/* ═══════════ SIDEBAR ═══════════ */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--red), #ff5a5f);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--red-glow);
}
.sidebar-brand .brand-icon svg { width: 18px; height: 18px; color: #fff; }
.sidebar-brand h1 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.sidebar-brand h1 span { color: var(--red); }
.sidebar-brand h1 small { display: block; font-size: 0.65rem; font-weight: 400; color: var(--text-3); letter-spacing: 0.04em; margin-top: 1px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
}
.sidebar-user .user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--navy), #2a4060);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.sidebar-user .user-meta { flex: 1; min-width: 0; }
.sidebar-user .user-name {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .user-role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 0.62rem; font-weight: 600; background: var(--red-light);
  color: var(--red); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  padding: 16px 20px 6px; font-size: 0.62rem; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  margin: 1px 8px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 0.85rem; cursor: pointer;
  transition: all 0.15s var(--ease); font-weight: 450;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: var(--red-light); color: var(--text);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--red);
}
.nav-item .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-item .nav-icon svg { width: 18px; height: 18px; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 0.62rem; font-weight: 700; padding: 2px 7px; border-radius: 10px;
  min-width: 20px; text-align: center;
}
.nav-divider { height: 1px; background: var(--border); margin: 8px 20px; }

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.sidebar-footer svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer .btn { gap: 8px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ═══════════ MAIN CONTENT ═══════════ */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 28px 32px;
  min-height: 100vh;
  max-width: 100%;
}

/* ═══════════ PAGE HEADER ═══════════ */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text);
}
.page-header .actions { display: flex; gap: 8px; align-items: center; }

/* ═══════════ STAT CARDS ═══════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
}
.stat-card.accent-red::before { background: var(--red); }
.stat-card.accent-warning::before { background: var(--warning); }
.stat-card.accent-info::before { background: var(--info); }
.stat-card.accent-danger::before { background: var(--danger); }
.stat-card.accent-success::before { background: var(--success); }
.stat-card.accent-purple::before { background: var(--purple); }

.stat-card:hover {
  transform: translateY(-2px); border-color: var(--border-2);
  box-shadow: var(--shadow-lg);
}
.stat-card .stat-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.stat-card .stat-icon-wrap {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card .stat-icon-wrap svg { width: 20px; height: 20px; }
.stat-card .stat-value {
  font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 0.78rem; color: var(--text-2); font-weight: 450;
}
.stat-card.clickable { cursor: pointer; }

/* ═══════════ CARDS ═══════════ */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-2); }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ═══════════ TABLES ═══════════ */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th {
  background: rgba(255,255,255,0.02); padding: 10px 16px;
  text-align: left; font-size: 0.7rem; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
table td {
  padding: 11px 16px; font-size: 0.85rem;
  border-bottom: 1px solid var(--border); color: var(--text);
  vertical-align: middle;
}
table td svg, table th svg { max-width: 18px; max-height: 18px; flex-shrink: 0; }
table tr { transition: background 0.1s var(--ease); }
table tr:hover { background: rgba(255,255,255,0.015); }
table tr:last-child td { border-bottom: none; }
table tr.clickable { cursor: pointer; }
table tr.clickable:hover { background: var(--red-soft); }

.td-number {
  font-weight: 600; font-variant-numeric: tabular-nums;
  font-size: 0.82rem; color: var(--text);
}

/* ═══════════ BADGES ═══════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 100px; font-size: 0.7rem; font-weight: 600; white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.badge-draft { background: rgba(100,116,139,0.12); color: #94a3b8; }
.badge-draft .badge-dot { background: #94a3b8; }
.badge-submitted { background: var(--info-bg); color: #60a5fa; }
.badge-submitted .badge-dot { background: #60a5fa; }
.badge-approved { background: var(--success-bg); color: #4ade80; }
.badge-approved .badge-dot { background: #4ade80; }
.badge-rejected { background: var(--danger-bg); color: #f87171; }
.badge-rejected .badge-dot { background: #f87171; }
.badge-archived { background: rgba(100,116,139,0.08); color: #64748b; }
.badge-archived .badge-dot { background: #64748b; }

.badge-low { background: rgba(34,197,94,0.10); color: #4ade80; }
.badge-low .badge-dot { background: #4ade80; }
.badge-medium { background: var(--warning-bg); color: #fbbf24; }
.badge-medium .badge-dot { background: #fbbf24; }
.badge-high { background: rgba(249,115,22,0.10); color: #fb923c; }
.badge-high .badge-dot { background: #fb923c; }
.badge-critical { background: var(--danger-bg); color: #f87171; }
.badge-critical .badge-dot { background: #f87171; }

.badge-new { background: var(--info-bg); color: #60a5fa; }
.badge-new .badge-dot { background: #60a5fa; }
.badge-assigned { background: var(--purple-bg); color: #c084fc; }
.badge-assigned .badge-dot { background: #c084fc; }
.badge-in_progress { background: var(--warning-bg); color: #fbbf24; }
.badge-in_progress .badge-dot { background: #fbbf24; }
.badge-resolved { background: var(--success-bg); color: #4ade80; }
.badge-resolved .badge-dot { background: #4ade80; }
.badge-closed { background: rgba(100,116,139,0.08); color: #64748b; }
.badge-closed .badge-dot { background: #64748b; }

.category-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}

/* ═══════════ FILTERS BAR ═══════════ */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px; align-items: center;
}
.filters-bar input, .filters-bar select {
  padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.82rem; font-family: inherit;
  transition: all var(--transition);
}
.filters-bar input:hover, .filters-bar select:hover { border-color: var(--border-3); }
.filters-bar input:focus, .filters-bar select:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
}
.filters-bar .search-input {
  flex: 1; min-width: 220px;
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23515c6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.filters-bar select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
  cursor: pointer;
}

/* ═══════════ MODAL ═══════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; visibility: hidden;
  transition: all 0.2s var(--ease);
  backdrop-filter: blur(6px);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-card-solid); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); width: 720px; max-width: 95vw; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(12px);
  transition: transform 0.25s var(--ease);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--bg-card-solid); z-index: 1;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  padding: 4px; line-height: 1; transition: all 0.15s var(--ease);
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; background: var(--bg-card-solid); z-index: 1;
}

/* ═══════════ REPORT DETAIL ═══════════ */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.detail-item { padding: 10px 0; }
.detail-item label {
  display: block; font-size: 0.68rem; font-weight: 500; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px;
}
.detail-item span { font-size: 0.9rem; color: var(--text); }
.detail-section { margin-bottom: 24px; }
.detail-section h4 {
  font-size: 0.78rem; font-weight: 600; color: var(--text-2); margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 8px;
}
.detail-section h4 svg { width: 14px; height: 14px; color: var(--text-3); }
.detail-section p, .detail-section .content {
  font-size: 0.9rem; color: var(--text); white-space: pre-wrap; line-height: 1.7;
}

/* Report detail title */
.report-detail-title {
  font-size: 1.15rem; font-weight: 700; margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* Rejection alert */
.rejection-alert {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 16px;
  font-size: 0.85rem; color: #f87171;
  display: flex; align-items: flex-start; gap: 10px;
}
.rejection-alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* Workflow steps */
.workflow-steps { display: flex; gap: 0; margin-bottom: 24px; position: relative; }
.workflow-step {
  flex: 1; text-align: center; padding: 12px 8px; position: relative;
  font-size: 0.75rem; color: var(--text-3);
}
.workflow-step::after {
  content: '';
  position: absolute; right: -1px; top: 50%; width: 0; height: 0;
  border: 8px solid transparent; border-left-color: var(--border); transform: translateY(-50%);
}
.workflow-step:last-child::after { display: none; }
.workflow-step.active { color: var(--text); font-weight: 600; }
.workflow-step .step-dot {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.04); border: 2px solid var(--border-2);
  margin: 0 auto 6px; font-size: 0.72rem; font-weight: 700;
  transition: all 0.3s var(--ease);
}
.workflow-step .step-dot svg { width: 14px; height: 14px; }
.workflow-step.completed .step-dot { background: var(--success); border-color: var(--success); color: #fff; }
.workflow-step.active .step-dot { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 0 12px var(--red-glow); }

/* ═══════════ CHARTS ═══════════ */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.chart-canvas-container { padding: 16px 20px; min-height: 240px; display: flex; flex-direction: column; }
.chart-bars { flex: 1; display: flex; align-items: flex-end; gap: 6px; padding-top: 10px; }
.chart-bar-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 0;
}
.chart-bar {
  width: 100%; max-width: 44px; border-radius: 5px 5px 0 0; min-height: 4px;
  transition: height 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.2s;
  opacity: 0.8;
  position: relative;
}
.chart-bar:hover { opacity: 1; filter: brightness(1.15); }
.chart-bar-label {
  font-size: 0.62rem; color: var(--text-3); text-align: center;
  max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 450;
}
.chart-bar-value {
  font-size: 0.7rem; font-weight: 700; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* Donut */
.donut-container { display: flex; align-items: center; gap: 24px; padding: 16px 20px; }
.donut-svg { width: 140px; height: 140px; flex-shrink: 0; }
.donut-svg path, .donut-svg circle {
  transition: opacity 0.2s;
}
.donut-svg path:hover, .donut-svg circle:hover { opacity: 0.85; filter: brightness(1.1); }
.donut-legend { flex: 1; min-width: 0; }
.donut-legend-item {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  font-size: 0.8rem; color: var(--text-2);
}
.donut-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend-value { font-weight: 700; color: var(--text); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.donut-legend-pct { font-size: 0.7rem; color: var(--text-3); margin-left: 4px; }

/* ═══════════ TOAST ═══════════ */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-card-solid); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 12px 18px; min-width: 300px; max-width: 420px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center;
  gap: 10px; animation: toastIn 0.35s var(--ease-bounce); font-size: 0.85rem;
  backdrop-filter: blur(12px);
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--success); }
.toast.success svg { color: var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.error svg { color: var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast.info svg { color: var(--info); }
@keyframes toastIn {
  from { transform: translateX(100%) scale(0.95); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
.toast-dismiss {
  margin-left: auto; background: none; border: none; color: var(--text-3);
  cursor: pointer; padding: 2px; display: flex; transition: color 0.15s;
}
.toast-dismiss:hover { color: var(--text); }
.toast-dismiss svg { width: 14px; height: 14px; }

/* ═══════════ AUTO-SAVE ═══════════ */
.autosave-indicator {
  font-size: 0.72rem; color: var(--text-3); display: flex; align-items: center; gap: 6px;
  margin-top: 8px;
}
.autosave-indicator svg { width: 14px; height: 14px; }
.autosave-indicator.saving { color: var(--warning); }
.autosave-indicator.saved { color: var(--success); }

/* ═══════════ LOADING ═══════════ */
.loading-spinner {
  display: block;
  width: 28px; height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════ EMPTY STATE ═══════════ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-state .empty-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.empty-state .empty-icon svg { width: 24px; height: 24px; color: var(--text-3); }
.empty-state p { font-size: 0.88rem; }
.empty-state .empty-sub { font-size: 0.78rem; color: var(--text-4); margin-top: 4px; }

/* ═══════════ CATEGORY TREE ═══════════ */
.cat-tree-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); transition: background 0.1s var(--ease);
}
.cat-tree-item:last-child { border-bottom: none; }
.cat-tree-item:hover { background: rgba(255,255,255,0.02); }
.cat-tree-item.child { padding-left: 42px; }
.cat-color-dot { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.cat-tree-item .cat-name { flex: 1; font-size: 0.9rem; font-weight: 500; }
.cat-tree-item .cat-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.cat-tree-item:hover .cat-actions { opacity: 1; }

/* ═══════════ TAB BAR ═══════════ */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-item {
  padding: 10px 20px; font-size: 0.85rem; color: var(--text-3);
  cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s var(--ease); font-weight: 500;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--text); border-bottom-color: var(--red); font-weight: 600; }

/* ═══════════ PORTAL ═══════════ */
.portal-page {
  min-height: 100vh; background: var(--bg);
  display: flex; flex-direction: column;
  position: relative;
}
.portal-page::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(236,51,59,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 60%, rgba(26,43,74,0.06) 0%, transparent 40%);
  pointer-events: none;
}
.portal-page::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.portal-header {
  width: 100%; background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
  padding: 20px 24px; text-align: center; position: relative; z-index: 1;
}
.portal-header-inner {
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.portal-header .portal-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--red), #ff5a5f);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px var(--red-glow);
}
.portal-header .portal-logo svg { width: 20px; height: 20px; color: #fff; }
.portal-header h1 { font-size: 1.25rem; font-weight: 700; }
.portal-header h1 span { color: var(--red); }
.portal-header p { font-size: 0.85rem; color: var(--text-2); margin-top: 4px; }

.portal-content {
  width: 640px; max-width: 95vw; margin: 32px auto; padding: 0 16px;
  position: relative; z-index: 1; flex: 1;
}
.portal-form-card {
  background: var(--bg-card); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); padding: 32px;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(12px);
}
.portal-form-card h2 { font-size: 1.1rem; margin-bottom: 4px; font-weight: 700; }
.portal-form-card .form-intro { font-size: 0.85rem; color: var(--text-2); margin-bottom: 24px; line-height: 1.6; }

.portal-trust-bar {
  display: flex; align-items: center; justify-content: center; gap: 24px;
  margin-bottom: 24px; padding: 12px 0;
}
.portal-trust-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.75rem; color: var(--text-3);
}
.portal-trust-item svg { width: 14px; height: 14px; color: var(--success); }

.portal-footer {
  text-align: center; padding: 24px; font-size: 0.78rem; color: var(--text-3);
  position: relative; z-index: 1;
  border-top: 1px solid var(--border);
}
.portal-footer a { color: var(--red); font-weight: 500; }

.success-card {
  background: var(--bg-card); border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius-lg); padding: 48px 32px; text-align: center;
  backdrop-filter: blur(12px);
}
.success-card .check-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--success-bg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.success-card .check-icon svg { width: 32px; height: 32px; color: var(--success); }
.success-card h2 { color: var(--success); margin-bottom: 8px; font-size: 1.2rem; }
.success-card p { color: var(--text-2); font-size: 0.9rem; }
.success-card .signal-num {
  font-size: 1.5rem; font-weight: 800; color: var(--red);
  margin: 16px 0; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.success-card .signal-hint {
  font-size: 0.82rem; color: var(--text-3); margin-top: 8px;
}

/* ═══════════ PAGINATION ═══════════ */
.pagination-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--border);
  flex-wrap: wrap; gap: 8px;
}
.pagination-info { font-size: 0.8rem; color: var(--text-3); }
.pagination-buttons { display: flex; gap: 4px; align-items: center; }
.pagination-btn { min-width: 32px; justify-content: center; padding: 6px 10px; }

/* ═══════════ SCROLLBAR ═══════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ═══════════ TOOLTIPS ═══════════ */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 5px 10px; background: #1e2638; border: 1px solid var(--border-2);
  border-radius: 6px; font-size: 0.72rem; color: var(--text);
  white-space: nowrap; z-index: 50; pointer-events: none;
  box-shadow: var(--shadow);
  animation: tooltipIn 0.15s var(--ease);
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .app-layout { grid-template-columns: 1fr; }
}
