/* ============================================================
   ITGC Audit Management — Premium Dark UI Design System
   ============================================================ */

/* --- Google Fonts loaded via base.html --- */

/* ============================================================
   1. CSS Variables (Design Tokens)
   ============================================================ */
:root {
  color-scheme: dark;
  /* Backgrounds */
  --bg-base:      #0d1117;
  --bg-surface:   #161b27;
  --bg-surface2:  #1e2435;
  --bg-surface3:  #252c3f;
  --bg-hover:     #2a3149;

  /* Borders */
  --border:       #2e3650;
  --border-light: #374160;

  /* Accent */
  --accent:       #4f7ef8;
  --accent-hover: #3a6ae0;
  --accent-glow:  rgba(79, 126, 248, 0.25);
  --accent-dim:   rgba(79, 126, 248, 0.12);

  /* Semantic */
  --success:      #22c55e;
  --success-bg:   rgba(34, 197, 94, 0.12);
  --warning:      #f59e0b;
  --warning-bg:   rgba(245, 158, 11, 0.12);
  --danger:       #ef4444;
  --danger-bg:    rgba(239, 68, 68, 0.12);
  --info:         #38bdf8;
  --info-bg:      rgba(56, 189, 248, 0.12);
  --teal:         #14b8a6;
  --teal-bg:      rgba(20, 184, 166, 0.12);
  --purple:       #a78bfa;
  --purple-bg:    rgba(167, 139, 250, 0.12);

  /* Text */
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-accent:    #7aa2fb;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.3);
  --shadow:     0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Sidebar */
  --sidebar-width: 240px;
}

/* ============================================================
   2. Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  background-color: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-accent); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

h1, h2, h3, h4, h5 {
  margin: 0 0 12px 0;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }

p { margin: 0 0 12px 0; color: var(--text-secondary); }

/* ============================================================
   3. App Shell Layout
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   4. Header
   ============================================================ */
.app-header {
  background: linear-gradient(135deg, #0d1117 0%, #161b27 50%, #1a2040 100%);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0 24px;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border), var(--shadow-sm);
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header-logo-img {
  height: 22px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  filter: brightness(1.05);
}

.app-header-divider {
  width: 1px;
  height: 22px;
  background: var(--border-light);
  margin: 0 4px;
}

.app-header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.app-header-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app-header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.header-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.header-user-name {
  font-weight: 500;
  color: var(--text-primary);
}

.role-badge {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-admin    { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.role-auditor  { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.role-client   { background: var(--accent-dim); color: #7aa2fb; border: 1px solid rgba(79,126,248,0.3); }

.logout-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}
.logout-link:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239,68,68,0.4);
  text-decoration: none;
}

/* ============================================================
   5. Body Layout (Sidebar + Main)
   ============================================================ */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Header Sidebar Toggle Button */
.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  margin-right: 12px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent-border);
  transform: scale(1.05);
}
.sidebar-toggle-btn:active {
  transform: scale(0.95);
}

/* ============================================================
   6. Sidebar
   ============================================================ */
.sidebar {
  background: var(--bg-surface);
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  padding: 12px 0 20px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.24s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.24s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.18s ease;
  will-change: width, opacity;
}

.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px 20px;
}

.sidebar-section-label {
  padding: 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sidebar-collapse-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  padding: 0;
}
.sidebar-collapse-icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

/* Collapsed State */
.app-body.sidebar-collapsed .sidebar,
html.sidebar-is-collapsed .sidebar {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 12px 0 !important;
  overflow: hidden !important;
  border-right: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.app-body.sidebar-collapsed .main-content,
html.sidebar-is-collapsed .main-content {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 100% !important;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 450;
  border-left: 3px solid transparent;
  transition: all 0.18s ease;
  position: relative;
}

.sidebar a .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-left-color: var(--border-light);
  text-decoration: none;
}

.sidebar a.active,
.sidebar a[aria-current="page"] {
  background: var(--accent-dim);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-disabled {
  color: var(--text-muted) !important;
  cursor: not-allowed;
  opacity: 0.5;
}

.sidebar-disabled:hover {
  background: transparent !important;
  border-left-color: transparent !important;
}

/* ============================================================
   7. Main Content
   ============================================================ */
.main-content {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
  overflow-x: auto;
}

/* ============================================================
   8. Page Header
   ============================================================ */
.page-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-header h2 { margin-bottom: 4px; font-size: 22px; }
.page-header p  { margin: 0; font-size: 13px; color: var(--text-muted); }

/* ============================================================
   9. Cards
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;  /* don't block clicks on child elements */
}

.card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 0 1px rgba(79, 126, 248, 0.15);
}

.card:hover::before { opacity: 1; }

.card-icon {
  position: relative;
  z-index: 1;
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.card h4 {
  position: relative;
  z-index: 1;
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 600;
}

.card p {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.card a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s ease;
}

.card a:hover {
  background: var(--accent-hover);
  text-decoration: none;
  transform: none;
}

.card-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ============================================================
   10. Tables
   ============================================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-top: 16px;
}

table {
  border-collapse: collapse;
  width: 100%;
  background: var(--bg-surface);
  margin-top: 0;
  font-size: 13px;
}

table th {
  background: var(--bg-surface2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
  font-size: 13px;
}

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

table tbody tr:hover td {
  background: var(--bg-hover);
}

table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.015);
}

table tbody tr:nth-child(even):hover td {
  background: var(--bg-hover);
}

/* Wrap tables for proper rounded corners & horizontal scrolling */
.table-wrap {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: 16px;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table { margin-top: 0; }

/* ============================================================
   11. Status Badges
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-completed,
.status-accepted {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-under-review,
.status-in-progress,
.status-in-discussion {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.status-evidence-requested,
.status-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-clarification-required,
.status-open {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-not-started {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.status-remarks-provided {
  background: var(--teal-bg);
  color: var(--teal);
  border: 1px solid rgba(20, 184, 166, 0.25);
}

.status-received {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-not-received {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Risk Rating badges */
.risk-high   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.3); }
.risk-medium { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.risk-low    { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }

/* ============================================================
   12. Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-surface3);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239,68,68,0.35);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-surface2);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(34,197,94,0.35);
}
.btn-success:hover { background: rgba(34,197,94,0.2); }

.btn-teal {
  background: var(--teal-bg);
  color: var(--teal);
  border-color: rgba(20,184,166,0.35);
}
.btn-teal:hover { background: rgba(20,184,166,0.22); }

/* Auditor assignment tags & mini forms */
.auditor-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.auditor-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(129, 140, 248, 0.45);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.auditor-tag-remove-btn {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  cursor: pointer;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  margin-left: 2px;
  transition: all 0.15s ease;
}

.auditor-tag-remove-btn:hover {
  color: #ffffff;
  background: #ef4444;
  border-color: #ef4444;
  transform: scale(1.1);
}

.auditor-assign-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.auditor-assign-select {
  font-size: 12px;
  padding: 5px 9px;
  background-color: #1e293b;
  border: 1px solid #475569;
  border-radius: var(--radius-sm);
  color: #ffffff;
  max-width: 170px;
  outline: none;
  cursor: pointer;
  color-scheme: dark;
}

.auditor-assign-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.auditor-assign-select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  padding: 8px 10px;
}

select {
  color-scheme: dark;
  background-color: #1e293b;
  color: #f8fafc;
}

select option {
  background-color: #0f172a;
  color: #f8fafc;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

/* Default form button override */
form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}
form button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Download button */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: linear-gradient(135deg, #1d4ed8, var(--accent));
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(79,126,248,0.35);
}
.btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79,126,248,0.45);
  text-decoration: none;
  color: #fff;
}

/* Full System Dump button */
.btn-full-dump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #4f46e5 100%);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
  white-space: nowrap;
}
.btn-full-dump:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.5);
  color: #fff;
  text-decoration: none;
  filter: brightness(1.08);
}
.btn-full-dump:active {
  transform: translateY(0);
}

/* ============================================================
   13. Forms & Inputs
   ============================================================ */
.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 520px;
}

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

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

form input[type="text"],
form input[type="password"],
form input[type="email"],
form input[type="number"],
form select,
form textarea,
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  width: 260px;
  max-width: 100%;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  outline: none;
}

form input[type="text"]:focus,
form input[type="password"]:focus,
form input[type="email"]:focus,
form input[type="number"]:focus,
form select:focus,
form textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

form select,
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

form textarea,
textarea {
  resize: vertical;
  min-height: 70px;
  width: 100%;
}

/* Inline table inputs */
table input[type="text"],
table input[type="number"],
table select,
table textarea {
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: var(--font);
  font-size: 12px;
  width: 100%;
  min-width: unset;
  max-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

table input[type="text"]:focus,
table input[type="number"]:focus,
table select:focus,
table textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

table textarea {
  resize: vertical;
  min-height: 60px;
}

/* ============================================================
   14. Flash Messages
   ============================================================ */
.flash-list {
  margin-bottom: 20px;
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 450;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flash-success {
  background: var(--success-bg);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.3);
}

.flash-error {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}

.flash-warning {
  background: var(--warning-bg);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.3);
}

.flash-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(56,189,248,0.3);
}

/* ============================================================
   15. Login Page
   ============================================================ */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 20% 30%, rgba(79,126,248,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 600px 500px at 80% 70%, rgba(129,140,248,0.06) 0%, transparent 70%);
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.3;
}

.login-box {
  position: relative;
  z-index: 1;
  background: rgba(22, 27, 39, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 400px;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(79,126,248,0.08);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px 20px;
  background: rgba(30, 36, 53, 0.6);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.login-logo-img {
  max-width: 220px;
  height: auto;
  max-height: 44px;
  object-fit: contain;
}

.login-brand h1 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-brand p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.login-box h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 20px;
  display: none; /* replaced by login-brand */
}

.login-box label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.login-box .input-group {
  position: relative;
  margin-bottom: 16px;
}

.login-box input[type="text"],
.login-box input[type="password"] {
  width: 100%;
  background: var(--bg-surface2);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-box button[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #1d4ed8, var(--accent));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(79,126,248,0.3);
}

.login-box button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(79,126,248,0.45);
}

/* ============================================================
   16. Workspace Header & Section Tabs
   ============================================================ */
.workspace-header {
  margin-bottom: 20px;
}

.workspace-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.workspace-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.workspace-breadcrumb a:hover { color: var(--accent); }

.workspace-breadcrumb .sep { opacity: 0.4; }

.workspace-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.18s ease;
  text-decoration: none;
  margin-top: 8px;
}
.back-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface2);
  text-decoration: none;
}

/* Section tabs (horizontal pill nav) */
.section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}

.section-tabs a {
  padding: 7px 16px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.18s ease;
  white-space: nowrap;
}

.section-tabs a:hover {
  background: var(--bg-surface2);
  color: var(--text-primary);
  text-decoration: none;
}

.section-tabs a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79,126,248,0.35);
}

/* Category tabs (secondary level) */
.category-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cat-tab {
  padding: 6px 14px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  transition: all 0.18s ease;
  cursor: pointer;
  white-space: nowrap;
}

.cat-tab:hover {
  background: var(--bg-surface2);
  color: var(--text-primary);
  border-color: var(--border-light);
  text-decoration: none;
}

.cat-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(79, 126, 248, 0.45);
  font-weight: 600;
}

/* Sub-tabs */
.category-tabs.sub-tabs {
  margin-left: 0;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ============================================================
   17. Data Requirements
   ============================================================ */
.muted {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

.dr-add-row {
  margin: 16px 0 0 0;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dr-add-row strong {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dr-add-row input {
  min-width: unset !important;
}

/* Upload history items */
.upload-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-surface3);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 12px;
}

.upload-item a { color: var(--text-accent); }
.upload-item small { color: var(--text-muted); }

/* ============================================================
   18. Walkthrough
   ============================================================ */
.wt-question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.comment-auditor {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--accent-dim);
  border: 1px solid rgba(79,126,248,0.2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  line-height: 1.5;
}

.comment-client {
  font-size: 12px;
  color: #4ade80;
  background: var(--success-bg);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  line-height: 1.5;
}

/* → Obs convert button */
.btn-convert-obs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: var(--teal-bg);
  color: var(--teal);
  border: 1px solid rgba(20,184,166,0.35);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.18s ease;
}
.btn-convert-obs:hover {
  background: rgba(20,184,166,0.22);
  box-shadow: 0 0 8px rgba(20,184,166,0.2);
}

/* Abbreviations panel */
.abbrev-panel {
  margin-top: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.abbrev-panel summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 14px 18px;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.abbrev-panel summary::before { content: '📘'; }
.abbrev-panel summary:hover { color: var(--text-primary); }
.abbrev-panel[open] summary { border-bottom: 1px solid var(--border); }
.abbrev-panel table { margin-top: 0; border-radius: 0; }

/* ============================================================
   19. Observations
   ============================================================ */
.obs-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.obs-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Download feedback banner */
.download-feedback-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  animation: slideDown 0.25s ease;
}

.download-feedback-banner h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--warning);
}

/* ============================================================
   20. Stats / Info Cards
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: border-color 0.18s ease;
}

.stat-card:hover { border-color: var(--border-light); }

.stat-number {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
   21. Workflow / Progress Indicator
   ============================================================ */
.workflow-steps {
  display: flex;
  gap: 0;
  margin: 20px 0 32px;
  overflow-x: auto;
}

.workflow-step {
  flex: 1;
  min-width: 150px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-right: none;
  padding: 16px 18px;
  position: relative;
  transition: background 0.18s ease;
}

.workflow-step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.workflow-step:last-child  { border-right: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) 0; }

.workflow-step:hover { background: var(--bg-hover); }

.ws-icon { font-size: 22px; margin-bottom: 8px; display: block; }
.ws-num  { font-size: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.ws-title { font-size: 13px; font-weight: 600; margin: 2px 0 4px; }
.ws-desc  { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* ============================================================
   22. Section Headings
   ============================================================ */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-heading h3 { margin: 0; }

/* ============================================================
   23. Misc
   ============================================================ */
.text-muted  { color: var(--text-muted); font-size: 12px; }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

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

/* File input */
input[type="file"] {
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-surface2);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
  width: 100%;
}

input[type="file"]:hover { border-color: var(--accent); }

/* Checkbox */
input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============================================================
   Form Inputs & Textareas — High-Visibility & Auto-Expanding
   ============================================================ */
textarea {
  width: 100%;
  min-width: 160px;
  min-height: 68px;
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  padding: 8px 10px;
  resize: vertical;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-sizing: border-box;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: var(--bg-surface3);
}

input[type="text"], input[type="number"], input[type="password"] {
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  padding: 7px 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-sizing: border-box;
}

input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: var(--bg-surface3);
}

/* Enhanced Table Column Classes */
.col-dr-ref      { width: 95px; min-width: 90px; }
.col-dr-data     { min-width: 320px; width: 32%; }
.col-dr-sample   { min-width: 140px; width: 14%; }
.col-dr-date     { min-width: 120px; font-size: 11.5px; color: var(--text-muted); }
.col-dr-status   { min-width: 120px; }
.col-dr-remarks  { min-width: 220px; width: 22%; }
.col-dr-uploads  { min-width: 220px; width: 20%; }
.col-dr-actions  { width: 80px; min-width: 75px; text-align: center; }

.col-obs-sno     { width: 55px; min-width: 50px; text-align: center; }
.col-obs-rcm     { width: 70px; min-width: 65px; text-align: center; }
.col-obs-ctrl    { min-width: 160px; width: 12%; }
.col-obs-title   { min-width: 220px; width: 16%; }
.col-obs-crit    { min-width: 200px; width: 14%; }
.col-obs-desc    { min-width: 240px; width: 18%; }
.col-obs-risk    { min-width: 200px; width: 14%; }
.col-obs-root    { min-width: 180px; width: 13%; }
.col-obs-rec     { min-width: 200px; width: 14%; }
.col-obs-evid    { min-width: 175px; width: 15%; }
.col-obs-mgmt    { min-width: 240px; width: 18%; }
.col-obs-rating  { min-width: 110px; width: 9%; }
.col-obs-act     { width: 85px; min-width: 80px; text-align: center; }

/* Quick Inspect Button */
.btn-quick-inspect {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 4px;
  white-space: nowrap;
}
.btn-quick-inspect:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text-accent);
}

/* ============================================================
   24. High-Visibility Detail Focus Modal
   ============================================================ */
.focus-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 12, 22, 0.84);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.focus-modal-card {
  background: #141926;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.focus-modal-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #161b2a 0%, #1e243a 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.focus-modal-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.focus-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.focus-modal-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.focus-modal-close-btn:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.focus-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.focus-modal-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.focus-modal-textarea {
  width: 100%;
  min-height: 100px;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #0d111a;
  border: 1px solid var(--border);
  color: #f1f5f9;
}

.focus-modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.focus-modal-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.focus-modal-footer {
  padding: 14px 20px;
  background: #111522;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
