/* ===================================================
   CARDIO DIAGNÓSTICA — Sistema de Notificação
   Design Hospitalar Profissional
   =================================================== */

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

:root {
  /* Paleta Principal */
  --primary:       #0A4DA1;
  --primary-dark:  #073580;
  --primary-light: #EBF2FF;
  --secondary:     #00A878;
  --accent:        #E63946;

  /* Semáforo */
  --grade-1:       #F59E0B;
  --grade-1-bg:    #FFFBEB;
  --grade-2:       #F97316;
  --grade-2-bg:    #FFF7ED;
  --grade-3:       #EF4444;
  --grade-3-bg:    #FEF2F2;
  --grade-4:       #7C3AED;
  --grade-4-bg:    #F5F3FF;

  /* Neutros */
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Status */
  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #EF4444;
  --info:    #3B82F6;

  /* Layout */
  --radius:   8px;
  --radius-lg: 12px;
  --shadow:   0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
}

/* ===================== HEADER ===================== */
.site-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.logo-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
}

.logo-text p {
  font-size: 11px;
  opacity: .75;
  margin-top: 1px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  transition: all .15s ease;
  color: rgba(255,255,255,.85);
  background: transparent;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(255,255,255,.18);
  color: #fff;
}

.nav-btn i { font-size: 14px; }

/* ===================== MAIN WRAP ===================== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ===================== PAGE HEADER ===================== */
.page-header {
  margin-bottom: 32px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.page-header p {
  color: var(--gray-500);
  font-size: 14px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb i { font-size: 10px; }

/* ===================== CARD ===================== */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.card-header-icon.red    { background: #FEF2F2; color: #EF4444; }
.card-header-icon.orange { background: #FFF7ED; color: #F97316; }
.card-header-icon.blue   { background: #EFF6FF; color: #3B82F6; }
.card-header-icon.green  { background: #F0FDF4; color: #10B981; }
.card-header-icon.purple { background: #F5F3FF; color: #7C3AED; }

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-header p {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.card-body { padding: 24px; }

/* ===================== HOME PAGE ===================== */
.home-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #1a6bc4 100%);
  border-radius: var(--radius-lg);
  padding: 40px 40px 40px 48px;
  color: #fff;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: '';
  position: absolute;
  right: -60px;
  top: -60px;
  width: 280px;
  height: 280px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}

.home-hero::after {
  content: '';
  position: absolute;
  right: 40px;
  bottom: -80px;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}

.home-hero h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.2;
}

.home-hero p {
  font-size: 14px;
  opacity: .85;
  max-width: 560px;
  line-height: 1.6;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}

.hero-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

/* ===================== SELECTION CARDS ===================== */
.selection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.select-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 2px solid var(--gray-200);
  padding: 32px;
  cursor: pointer;
  transition: all .2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.select-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  transition: all .2s ease;
}

.select-card.danger::before  { background: var(--danger); }
.select-card.warning::before { background: var(--warning); }

.select-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.select-card.danger:hover  { border-color: var(--danger); }
.select-card.warning:hover { border-color: var(--warning); }

.select-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.select-card.danger  .select-card-icon { background: #FEF2F2; color: var(--danger); }
.select-card.warning .select-card-icon { background: #FFF7ED; color: var(--warning); }

.select-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.select-card p {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 16px;
}

.select-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.tag {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-600);
}

.select-card.danger  .tag { background: #FEF2F2; color: #B91C1C; }
.select-card.warning .tag { background: #FFF7ED; color: #B45309; }

.select-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.select-card.danger  .select-card-action { color: var(--danger); }
.select-card.warning .select-card-action { color: var(--warning); }

/* ===================== SEVERITY ALERT BOX ===================== */
.severity-info {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 24px;
  margin-bottom: 24px;
}

.severity-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.severity-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.severity-item {
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.severity-item .grade-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.severity-item h5 { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.severity-item p  { font-size: 11px; opacity: .8; line-height: 1.4; }

.s1 { background: var(--grade-1-bg); color: #92400E; }
.s1 .grade-badge { background: var(--grade-1); color: #fff; }
.s2 { background: var(--grade-2-bg); color: #9A3412; }
.s2 .grade-badge { background: var(--grade-2); color: #fff; }
.s3 { background: var(--grade-3-bg); color: #991B1B; }
.s3 .grade-badge { background: var(--grade-3); color: #fff; }
.s4 { background: var(--grade-4-bg); color: #4C1D95; }
.s4 .grade-badge { background: var(--grade-4); color: #fff; }

/* ===================== FORMS ===================== */
.form-wrap {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.form-section {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  margin-bottom: 16px;
  overflow: hidden;
}

.form-section-header {
  background: var(--gray-50);
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-number {
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.form-section-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

.form-section-body {
  padding: 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 4px;
}

label .required { color: var(--danger); font-size: 13px; }

input[type="text"],
input[type="date"],
input[type="time"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,77,161,.1);
}

input::placeholder, textarea::placeholder { color: var(--gray-400); }

textarea { resize: vertical; min-height: 90px; }

select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
}

/* Grade select colors */
select.grade-select option[value="1"] { color: #92400E; }
select.grade-select option[value="2"] { color: #9A3412; }
select.grade-select option[value="3"] { color: #991B1B; }
select.grade-select option[value="4"] { color: #4C1D95; }

.grade-indicator {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  align-items: center;
  gap: 8px;
}

.grade-indicator.visible { display: flex; }
.grade-indicator.g1 { background: var(--grade-1-bg); color: #92400E; border: 1px solid #FDE68A; }
.grade-indicator.g2 { background: var(--grade-2-bg); color: #9A3412; border: 1px solid #FED7AA; }
.grade-indicator.g3 { background: var(--grade-3-bg); color: #991B1B; border: 1px solid #FECACA; }
.grade-indicator.g4 { background: var(--grade-4-bg); color: #4C1D95; border: 1px solid #DDD6FE; }

/* Toggle */
.toggle-group {
  display: flex;
  gap: 8px;
}

.toggle-option {
  flex: 1;
  position: relative;
}

.toggle-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  transition: all .15s;
  width: 100%;
}

.toggle-option input:checked + label {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-group span {
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
}

/* Alert box */
.alert-rca {
  display: none;
  background: var(--grade-4-bg);
  border: 1px solid #DDD6FE;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--grade-4);
  font-weight: 500;
  align-items: flex-start;
  gap: 8px;
}

.alert-rca.visible { display: flex; }
.alert-rca i { margin-top: 2px; flex-shrink: 0; }

/* ===================== SIDE PANEL ===================== */
.side-panel .card { margin-bottom: 16px; }

.protocol-box {
  background: var(--primary-light);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}

.protocol-box .prot-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.protocol-box .prot-number {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-dark);
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
}

.protocol-box .prot-date {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 6px;
}

.sla-list { display: flex; flex-direction: column; gap: 10px; }

.sla-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.sla-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sla-dot.green  { background: var(--success); }
.sla-dot.yellow { background: var(--warning); }
.sla-dot.red    { background: var(--danger); }
.sla-dot.purple { background: var(--grade-4); }

.sla-item-text { flex: 1; }
.sla-item-text strong { font-size: 12px; font-weight: 600; display: block; color: var(--gray-800); }
.sla-item-text span   { font-size: 11px; color: var(--gray-500); }

/* ===================== SUBMIT BUTTONS ===================== */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all .15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(10,77,161,.3); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #DC2626; box-shadow: 0 4px 12px rgba(239,68,68,.3); }

.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover { background: #D97706; }

.btn-outline {
  background: transparent;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}
.btn-outline:hover { background: var(--gray-100); }

.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

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

/* ===================== SUCCESS MODAL ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
  animation: modalIn .3s ease;
}

@keyframes modalIn {
  from { transform: scale(.9); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.modal-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
}

.modal-icon.success { background: #D1FAE5; color: var(--success); }
.modal-icon.warning { background: var(--grade-4-bg); color: var(--grade-4); }

.modal-box h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.modal-box p {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 6px;
  line-height: 1.6;
}

.modal-protocol {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 16px;
  margin: 20px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
}

.modal-protocol span {
  font-size: 20px;
  display: block;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  margin-top: 4px;
}

.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ===================== DASHBOARD (PAINEL) ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.red    { background: #FEF2F2; color: var(--danger); }
.stat-icon.orange { background: #FFF7ED; color: var(--grade-2); }
.stat-icon.blue   { background: #EFF6FF; color: var(--info); }
.stat-icon.green  { background: #F0FDF4; color: var(--success); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 2px;
}

.stat-label { font-size: 11px; color: var(--gray-500); font-weight: 500; }

/* ===================== TABLE ===================== */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 13px;
}

.search-box input {
  padding-left: 32px;
}

.filter-group {
  display: flex;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

thead {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.g1 { background: var(--grade-1-bg); color: #92400E; }
.badge.g2 { background: var(--grade-2-bg); color: #9A3412; }
.badge.g3 { background: var(--grade-3-bg); color: #991B1B; }
.badge.g4 { background: var(--grade-4-bg); color: #4C1D95; }

.badge.status-open  { background: #FEF2F2; color: #991B1B; }
.badge.status-prog  { background: #FFF7ED; color: #9A3412; }
.badge.status-done  { background: #F0FDF4; color: #065F46; }
.badge.status-ver   { background: #EFF6FF; color: #1E40AF; }

.badge.type-ea   { background: #FEF2F2; color: #991B1B; }
.badge.type-nm   { background: #FFFBEB; color: #92400E; }
.badge.type-nc   { background: #FFF7ED; color: #9A3412; }

.table-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}

.table-empty i { font-size: 36px; display: block; margin-bottom: 12px; }
.table-empty p { font-size: 14px; }

/* ===================== TABS ===================== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
  width: fit-content;
}

.tab-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-600);
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===================== PAGINATION ===================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

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

.pagination-btns {
  display: flex;
  gap: 6px;
}

.page-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: all .15s;
}

.page-btn:hover     { background: var(--gray-100); }
.page-btn.active    { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled  { opacity: .4; cursor: not-allowed; }

/* ===================== LOADING ===================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(2px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

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

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay p {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
}

/* ===================== FOOTER ===================== */
.site-footer {
  background: var(--gray-800);
  color: var(--gray-400);
  padding: 20px 0;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

/* ===================== TOAST ===================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--gray-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn .2s ease;
}

.toast.success { background: #065F46; border-left: 3px solid var(--success); }
.toast.error   { background: #7F1D1D; border-left: 3px solid var(--danger); }
.toast.warning { background: #78350F; border-left: 3px solid var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1024px) {
  .form-wrap { grid-template-columns: 1fr; }
  .side-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .severity-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .main-content { padding: 20px 16px 48px; }
  .home-hero { padding: 28px 24px; }
  .home-hero h2 { font-size: 20px; }
  .selection-grid { grid-template-columns: 1fr; }
  .form-grid.cols-2,
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .side-panel { grid-template-columns: 1fr; }
  .hero-meta { flex-wrap: wrap; gap: 10px; }
  .nav-btn span { display: none; }
  .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .severity-grid { grid-template-columns: 1fr; }
}

/* ===================== DETAIL VIEW ===================== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

.detail-item { }
.detail-item .dl { font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.detail-item .dv { font-size: 13px; color: var(--gray-800); }

.rca-alert {
  background: var(--grade-4-bg);
  border: 1px solid #DDD6FE;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--grade-4);
  font-weight: 500;
}

.notif-urgent {
  background: linear-gradient(135deg, #7F1D1D, #991B1B);
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%       { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}
