@media (max-width:600px) {
  /* Base mobile typography */
  body {
    font-size: 16px !important;
    line-height: 1.5 !important;
  }
  
  /* Sticky mobile dropdown for quick navigation */
  #mobileSectionDropdownWrapper {
    position: sticky;
    top: 0;
    z-index: 1200;
    background: var(--bg);
    padding: 8px 0;
  }
  
  /* Stack question table rows and cells for mobile readability */
  .table tbody[data-questions] tr,
  .table tbody[data-evidence] tr,
  .table tbody[data-findings] tr {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 10px;
    background: var(--bg-elev);
  }
  
  /* Mobile-friendly search input */
  #sidebarSearch {
    font-size: 16px !important;
    padding: 12px 16px !important;
    height: 44px !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    -webkit-border-radius: 12px !important;
  }
  
  /* Prevent zoom on iOS when focusing input */
  #sidebarSearch:focus {
    font-size: 16px !important;
  }
  
  /* Better touch targets for nav items on mobile */
  .nav-item {
    padding: 14px 16px !important;
    min-height: 48px !important;
    font-size: 15px !important;
  }
  
  .nav-item .nav-icon {
    font-size: 18px !important;
    margin-right: 12px !important;
  }
  
  /* Better photo button for mobile */
  .photo-upload-actions {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }
  .photo-upload-button {
    width: 48% !important;
    max-width: 140px !important;
    padding: 7px 10px !important;
    font-size: 11px !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }
  
  /* Responsive photo grid */
  .photos-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  }
  
  /* Better comment styling on mobile */
  .photo-comment {
    font-size: 14px !important;
    min-height: 50px !important;
    padding: 10px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 8px !important;
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    background: white !important;
    color: #333 !important;
    resize: vertical !important;
  }
  
  /* Ensure photo containers stack properly on mobile */
  .photo-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }
  
  /* Mobile textarea height - 120px for questions, but General Notes stays 200px */
  textarea {
    min-height: 90px !important;
  }
  
  /* Keep General Notes textarea at 200px on mobile */
  #meta-notes {
    min-height: 200px !important;
  }
  
  /* Ensure touch targets meet 44px height */
  button,
  .photo-upload-button,
  .table .secondary,
  .table .danger {
    min-height: 44px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  
  /* Add breathing room between stacked controls */
  .row-actions,
  .table tbody[data-findings] td:last-child,
  .table tbody[data-questions] td:last-child,
  .table tbody[data-evidence] td:last-child {
    margin-top: 8px !important;
  }
  
  .table tbody[data-questions] td,
  .table tbody[data-evidence] td,
  .table tbody[data-findings] td {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
    padding: 8px 8px 0 8px;
    border: none;
  }
  .table tbody[data-questions] td:last-child,
  .table tbody[data-evidence] td:last-child,
  .table tbody[data-findings] td:last-child {
    margin-top: 6px;
    padding-bottom: 10px;
  }
  .table tbody[data-questions] ~ thead,
  .table thead { display: none; }
  
  /* Wrap long IDs/labels instead of squeezing */
  .table td,
  .table td .readonly-cell,
  .table td textarea {
    word-break: break-word !important;
  }
  
  /* Question text wrapping on mobile */
  .table td:nth-child(2) .readonly-cell {
    max-width: none;
    width: 100%;
  }

  /* Sticky actions on mobile */
  .row-actions {
    width: 100% !important;
    padding: 6px 0 !important;
    position: sticky;
    bottom: 12px;
    z-index: 900;
    background: var(--bg);
    box-shadow: 0 -6px 20px rgba(0,0,0,0.35);
    margin-top: 10px !important;
  }
  .row-actions button {
    width: 100% !important;
  }

  /* Inputs and selects with lighter borders on mobile */
  input, select, textarea {
    border-color: rgba(255,255,255,0.12) !important;
    box-shadow: none !important;
  }

  /* Full-width primary actions */
  .row-actions {
    width: 100% !important;
    padding: 6px 0 !important;
  }
  .row-actions button {
    width: 100% !important;
  }

  /* Photo overlays: avoid overlapping delete and zoom hint on mobile */
  .photo-delete {
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
  }
  .photo-zoom-hint {
    left: 50% !important;
    bottom: 8px !important;
    transform: translateX(-50%) !important;
    font-size: 11px !important;
    padding: 4px 8px !important;
  }
  
  /* Taller photo thumbnails for easier tapping */
  .photo-thumbnail {
    height: 170px !important;
  }
  
  /* Mobile sidebar sections separation */
  .sidebar-header {
    font-size: 14px !important;
    padding: 8px 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #60a5fa !important;
  }
  
  #sidebarDocuments {
    padding-bottom: 16px !important;
    margin-bottom: 16px !important;
    border-bottom: 2px solid rgba(96,165,250,0.3) !important;
    position: relative !important;
  }
  
  #sidebarDocuments::after {
    content: '' !important;
    position: absolute !important;
    bottom: -2px !important;
    left: 0 !important;
    right: 0 !important;
    height: 2px !important;
    background: linear-gradient(90deg, transparent, rgba(96,165,250,0.5), transparent) !important;
  }
}
/* ---------------------------------------------
   Professional Compact UI — drop-in replacement
   Works with your existing HTML + app.js IDs/classes
   --------------------------------------------- */



* { box-sizing: border-box; }

/* THEME TOKENS */


:root {
  --bg:         #0b1220;
  --bg-elev:    #0e172a;
  --text:       #fff;
  --muted:      #cbd5e1;
  --primary:    #60a5fa;
  --primary-600:#3b82f6;
  --primary-100:#0b2a63;
  --border:     #1f2a44;
  --card:       #0e172a;
  --shadow:     0 10px 30px rgba(0,0,0,.35);
  --shadow-sm:  0 6px 20px rgba(0,0,0,.25);
  --danger:     #dc2626;
  --danger-100: #4c1d1d;
  --success:    #16a34a;
  --success-100:#0f2f22;
  --warning:    #d97706;
  --warning-100:#3b2d12;
  --focus:      rgba(96,165,250,.35);
  --radius:     14px;
  --radius-sm:  10px;
  
  /* New enhancement variables */
  --glow-primary: 0 0 20px rgba(96,165,250,.3);
  --glow-success: 0 0 20px rgba(22,163,74,.3);
  --glow-danger: 0 0 20px rgba(220,38,38,.3);
  --glass-bg: rgba(14,23,42,.6);
  --glass-border: rgba(255,255,255,.1);
}
}

/* BASE */

html,body{height:100%}
body {
  margin:0;
  background: var(--bg);
  color:var(--text);
  font-family: Inter, system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: thin;
  scrollbar-color: rgba(96,165,250,0.6) rgba(6,11,23,0.9);
}

body::-webkit-scrollbar {
  width: 12px;
  background: transparent;
}

body::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(8, 13, 26, 0.95), rgba(15, 23, 42, 0.85));
  border-radius: 999px;
}

body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  border-radius: 999px;
  border: 2px solid rgba(8, 13, 26, 0.9);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #7dd3fc, var(--primary));
  box-shadow: 0 4px 10px rgba(56, 189, 248, 0.45);
}

/* Ensure emojis render properly */
.nav-icon, .icon {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  color: #fff;
}

.title h2 {
  color: #fff;
}

.wrap{max-width:1180px;margin:0 auto;padding:16px}

/* HEADER */

.header-bar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 0; position:sticky; top:0; z-index:1200;
  backdrop-filter: saturate(180%) blur(10px);
  background: linear-gradient(to bottom, rgba(14,23,42,.7), rgba(14,23,42,.45));
  border-bottom: 1px solid var(--border);
}

h1{margin:0;font-size:20px;font-weight:700;letter-spacing:.2px}
.muted{color:var(--muted)}

/* HEADER ACTIONS */
.actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

/* LAYOUT */
.layout{
  display:grid;grid-template-columns:280px 1fr;gap:20px;
  min-height:calc(100vh - 70px);
}

/* SIDEBAR */
.sidebar{
  background: var(--bg-elev);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky; top:84px;
  overflow: hidden;
}

.sidebar-inner{ padding:14px; }
.sidebar-header{
  font-weight:600;color:var(--text);margin-bottom:10px;font-size:13px;
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #60a5fa;
}

/* Documents Section Styling */
#sidebarDocuments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 2px solid rgba(96,165,250,0.3);
  position: relative;
}

#sidebarDocuments::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(96,165,250,0.5), transparent);
}

/* Systems Section Styling */
#sidebarNav{
  display:flex;
  flex-direction:column;
  gap:8px; 
  max-height: calc(100vh - 400px); 
  overflow:auto; 
  padding-right:4px;
}
#sidebarNav::-webkit-scrollbar{ width:8px; }
#sidebarNav::-webkit-scrollbar-thumb{ background:rgba(100,116,139,.3); border-radius:999px; }


.nav-item{
  display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:12px;
  border:1px solid var(--border);background:linear-gradient(180deg, #0f172a, #0b1220);
  cursor:pointer;font-size:13px; transition: all .2s ease; box-shadow: var(--shadow-sm);
  justify-content: flex-start;
}
.nav-item:hover{ 
  transform: translateY(-2px); 
  border-color:rgba(96,165,250,0.5); 
  box-shadow: 0 6px 20px rgba(0,0,0,.35), 0 0 12px rgba(96,165,250,0.15);
}
.nav-item .nav-icon{ width:24px; text-align:center; font-size:18px }
.nav-item .nav-text{ flex:1; }
.nav-badge{
  min-width:34px;
  padding:3px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  text-align:center;
  line-height:1.2;
  border:1px solid rgba(255,255,255,0.12);
}
.nav-badge.idle{ background: rgba(255,255,255,0.06); color:#cbd5e1; }
.nav-badge.warn{ background: rgba(234,179,8,0.2); color:#facc15; border-color: rgba(234,179,8,0.4); }
.nav-badge.done{ background: rgba(16,185,129,0.2); color:#34d399; border-color: rgba(16,185,129,0.4); }

/* CONTENT AREA */
.content{
  min-width:0;
}

/* CARDS */
.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  margin:16px 0;
  overflow:hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.2s ease;
}
.card:hover{
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(0,0,0,.45);
  border-color: rgba(96,165,250,0.3);
}

.card-header{
  display:flex;align-items:center;gap:14px;padding:14px 16px;
  border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, rgba(14,23,42,.65), rgba(14,23,42,.4));
  border-left: 3px solid transparent;
  transition: border-left-color 0.2s ease;
}
.card[data-completed="true"] .card-header{
  border-left-color: #16a34a;
}
.card:hover .card-header{
  border-left-color: var(--primary);
}
.card-body{ padding:16px 16px 18px }


.icon{
  width:44px;height:44px;border-radius:12px;display:grid;place-items:center;
  background: var(--primary-100); border:1px solid #3b82f6; font-size:20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover .icon{
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(59,130,246,0.3);
}
.icon.global{
  background: linear-gradient(135deg, #134e4a, #0f766e);
  border-color:#0e7490;
}
.card:hover .icon.global{
  box-shadow: 0 0 16px rgba(15,118,110,0.3);
}

.title h2{margin:0;font-size:18px;letter-spacing:.2px}
.subtitle{font-size:12px;margin-top:2px;color:var(--muted)}

/* GRID + FORMS */
.grid-4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
@media (max-width:1100px){ .grid-4{grid-template-columns:repeat(2,minmax(0,1fr));} }
@media (max-width:640px){ .grid-4{grid-template-columns:1fr;} }

.metadata-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
}

.metadata-grid input[type="date"] {
  max-width: 180px;
}

@media (max-width: 768px) {
  .metadata-grid {
    grid-template-columns: 1fr;
  }
  .metadata-grid input[type="date"] {
    max-width: 100%;
  }
}

.session-switcher{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:12px;
}

.session-switcher select{
  min-width:200px;
}

.session-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.session-btn{
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color:#fff;
  border:none;
  padding:8px 12px;
  border-radius:10px;
  font-weight:600;
  font-size:12px;
  cursor:pointer;
  box-shadow: 0 4px 12px rgba(59,130,246,0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
}

.session-btn:hover{ transform: translateY(-1px); }
.session-btn:active{ transform: translateY(0); opacity:0.9; }

.session-btn.ghost{
  background: linear-gradient(135deg, #0f172a, #111827);
  color:#e2e8f0;
  border:1px solid rgba(255,255,255,0.08);
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:#fff}
input,select,textarea{
  width:100%;background:var(--bg-elev);color:var(--text);
  border:1px solid var(--border);border-radius:10px;padding:10px 12px;outline:none;
  transition: box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
input:focus,select:focus,textarea:focus{ 
  box-shadow:0 0 0 4px var(--focus), 0 4px 12px rgba(96,165,250,0.15); 
  border-color: var(--primary);
  background: rgba(14,23,42,0.8);
}
textarea{min-height:160px;resize:vertical}
.findings-textarea{min-height:260px;}
input[readonly],textarea[readonly]{background:#1e293b;color:#64748b}

/* BUTTONS */
button{
  appearance:none;background:linear-gradient(180deg,#1e293b,#0e172a); color:var(--text);
  border:1px solid var(--border);border-radius:12px;padding:10px 14px;
  cursor:pointer;transition:all .2s ease;box-shadow: var(--shadow-sm); font-weight:600;
}

button:hover{ 
  border-color:#cbd5e1; 
  transform: translateY(-2px); 
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
button:active{ transform: translateY(0); box-shadow: var(--shadow-sm); }

button.primary{
  color:white; background: linear-gradient(180deg, var(--primary), var(--primary-600));
  border-color: transparent;
}
button.primary:hover{ 
  filter: brightness(1.08); 
  box-shadow: 0 8px 24px rgba(59,130,246,.45), var(--glow-primary);
}

button.secondary{ background:linear-gradient(180deg,#1e293b,#334155) }
button.danger{ background:linear-gradient(180deg,#1e293b,#0e172a); border-color:#7f1d1d; color:#fca5a5 }
button.danger:hover{ background:#7f1d1d; border-color:#fca5a5; color:#fff }

/* TABLES */
.table{ width:100%; border-collapse:separate; border-spacing:0; table-layout:auto; }
.table thead th{
  position:sticky; top:0; z-index:1;
  background:linear-gradient(180deg,#1e293b,#0e172a);
  color:#fff; text-align:left; font-weight:700; font-size:13px;
  border-bottom:1px solid var(--border); padding:10px 8px;
}
.table td{
  border-bottom:1px solid var(--border); padding:10px 8px; vertical-align:top;
  font-size:14px;
  color: #fff;
  transition: background-color 0.15s ease;
}
.table tbody tr:hover td{
  background: rgba(96,165,250,0.06);
}
.notes-textarea{
  width:100%;
  min-height:250px;
  resize:vertical;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:linear-gradient(180deg,#0f172a,#0b1220);
  color:var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.2) inset, 0 1px 2px rgba(0,0,0,.15);
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.notes-textarea::placeholder{ color:#94a3b8 }
.notes-textarea:focus{
  outline:none;
  border-color:#3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
  background:linear-gradient(180deg,#0f172a,#0b1220);
}
.notes-textarea:disabled{ opacity:.7; cursor:not-allowed }

@media (max-width: 768px) {
  .notes-textarea{ min-height:200px; }
  .comments-textarea{ min-height:180px !important; }
}

/* PHOTO ATTACHMENTS */
.photo-block details {
  border-radius: var(--radius);
}

.photos-container {
  margin: 10px 0;
}

.photo-upload {
  margin-bottom: 15px;
}

.photo-input {
  display: none;
}

.photo-upload-button {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.photo-upload-button:hover,
.photo-upload-button:focus {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.photo-upload-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.photo-upload-button.secondary {
  background: linear-gradient(135deg, #0f172a, #111827);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

.photo-upload-button.compact {
  padding: 9px 12px;
  font-size: 12px;
  border-radius: 9px;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.photo-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-thumbnail-wrapper {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.photo-thumbnail-wrapper:active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.15);
}

.photo-thumbnail-wrapper:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
  border-color: rgba(59, 130, 246, 0.4);
}

.photo-thumbnail {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.regulation-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.regulation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0;
}

.reg-chip {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.reg-chip-remove {
  background: transparent;
  border: none;
  color: #bfdbfe;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.regulation-toggle {
  align-self: flex-start;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(59,130,246,0.25);
}

.regulation-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.regulation-menu {
  display: none;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 12px;
  padding: 12px;
  max-height: 240px;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(96, 165, 250, 0.1);
  margin-top: 6px;
  z-index: 10;
}
.regulation-menu.open {
  display: block;
}
.reg-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.4;
}
.regulation-menu .reg-option-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid rgba(96, 165, 250, 0.15);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.7)) !important;
  color: #e2e8f0 !important;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.regulation-menu .reg-option-btn:hover {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.8)) !important;
  border-color: rgba(96, 165, 250, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.regulation-menu .reg-option-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 2px 8px rgba(59, 130, 246, 0.4);
  transform: translateX(2px);
}

.summary-detail {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}
.summary-detail th {
  text-align: left;
  width: 110px;
  font-size: 11px;
  color: #cbd5e1;
  padding: 6px 8px;
  vertical-align: top;
}
.summary-detail td {
  padding: 6px 8px;
  font-size: 12px;
  color: #e5e7eb;
  border-left: 1px solid rgba(255,255,255,0.06);
  width: auto;
}
.summary-detail tr + tr td,
.summary-detail tr + tr th {
  border-top: 1px solid rgba(255,255,255,0.08);
}

.summary-detail-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 16px;
  touch-action: auto;
}

.summary-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  touch-action: auto;
  pointer-events: auto;
}

.summary-field .field-label {
  font-size: 11px;
  color: #94a3b8;
}

.findings-summary {
  width: 100%;
}
.findings-summary table {
  width: calc(100% + 32px) !important;
  margin-left: -16px;
  margin-right: -16px;
  table-layout: auto;
  display: table;
  border-collapse: collapse;
}
.finding-detail-row td {
  background: var(--bg-elev);
  border-top: none;
  touch-action: auto;
  pointer-events: auto;
}

.reg-desc-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 8px 0;
}

.description-wrapper label {
  font-size: 12px;
  color: #cbd5e1;
  display: block;
  margin-bottom: 4px;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 11px;
  color: #94a3b8;
}

.photo-delete {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #f87171, #dc2626);
  border: none;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  border-radius: 0 8px 0 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.photo-delete:hover {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  opacity: 0.95;
}

.photo-zoom-hint {
  position: absolute;
  bottom: 5px;
  left: 5px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  pointer-events: none;
}

.photo-comment-wrapper {
  width: 100%;
  margin-top: 8px;
}

.photo-comment {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border-radius: 8px;
  border: 2px solid rgba(148, 163, 184, 0.3);
  background: linear-gradient(180deg, #0f172a, #0b1220);
  color: #e2e8f0;
  padding: 10px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.photo-comment:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  outline: none;
}

.comments-textarea {
  min-height: 180px;
}

.photo-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
}

.photo-modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.photo-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 30px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.table tr:hover td{ background: rgba(2,6,23,.02); }
.readonly-cell{ font-size:13px; color:#cbd5e1; }

/* Question column text wrapping */
.table td:nth-child(2) .readonly-cell {
  word-wrap: break-word;
  white-space: normal;
  line-height: 1.4;
  max-width: 250px;
}

/* STATUS ROW COLORS */
.yes-row{ background: rgba(16,185,129,.13) }
.no-row { background: rgba(220,38,38,.13) }

/* MISC */
.block{ margin:12px 0 }
summary{ cursor:pointer; font-weight:600; margin-bottom:8px }
small.hint{ color:var(--muted); font-size:12px }
.inline{ display:flex; align-items:center; gap:10px }
.radio{ display:flex; align-items:center; gap:10px; flex-wrap:wrap }
.radio input{ margin:0 }
.sm{ font-size:13px }

.actions button{
  border:none;
  border-radius:10px;
  padding:10px 12px;
  font-weight:600;
  cursor:pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
  min-height: 38px;
}
.btn-primary{
  background:#1d4ed8;
  color:#fff;
  box-shadow: 0 4px 10px rgba(29,78,216,0.25);
}
.btn-primary:hover{ background:#1e40af; }
.btn-primary:focus-visible{ box-shadow: 0 0 0 3px rgba(29,78,216,0.35); }

.btn-secondary{
  background:#334155;
  color:#e2e8f0;
}
.btn-secondary:hover{ background:#1f2937; }
.btn-secondary:focus-visible{ box-shadow: 0 0 0 3px rgba(51,65,85,0.35); }

.btn-purple{
  background:#5b21b6;
  color:#f8fafc;
}
.btn-purple:hover{ background:#4c1d95; }
.btn-purple:focus-visible{ box-shadow: 0 0 0 3px rgba(91,33,182,0.35); }

.btn-danger{
  background:#dc2626;
  color:#fff;
}
.btn-danger:hover{ background:#b91c1c; }
.btn-danger:focus-visible{ box-shadow: 0 0 0 3px rgba(220,38,38,0.35); }

.btn-outline{
  background: transparent;
  border:1px solid #475569;
  color:#475569;
}
.btn-outline:hover{
  background:#1f2937;
  color:#e2e8f0;
}
.btn-outline:focus-visible{
  box-shadow: 0 0 0 3px rgba(71,85,105,0.35);
}

.btn-outline-orange{
  background: transparent;
  border:1px solid #d97706;
  color:#d97706;
}
.btn-outline-orange:hover{
  background:#7c2d12;
  color:#fef3c7;
}
.btn-outline-orange:focus-visible{
  box-shadow: 0 0 0 3px rgba(217,119,6,0.35);
}

/* Ensure header buttons keep intended colors */
.actions .btn-primary{ background:#1d4ed8 !important; color:#fff !important; border-color:transparent !important; }
.actions .btn-primary:hover{ background:#1e40af !important; }
.actions .btn-secondary{ background:#334155 !important; color:#e2e8f0 !important; border-color:transparent !important; }
.actions .btn-secondary:hover{ background:#1f2937 !important; }
.actions .btn-purple{ background:#5b21b6 !important; color:#f8fafc !important; border-color:transparent !important; }
.actions .btn-purple:hover{ background:#4c1d95 !important; }
.actions .btn-danger{ background:#dc2626 !important; color:#fff !important; border-color:transparent !important; }
.actions .btn-danger:hover{ background:#b91c1c !important; }
.actions .btn-outline-orange{ background:transparent !important; border:1px solid #d97706 !important; color:#d97706 !important; }
.actions .btn-outline-orange:hover{ background:#7c2d12 !important; color:#fef3c7 !important; }

/* Mobile search results */
.mobile-result-icon{ margin-right: 8px; }
.mobile-result-text{ display:inline-block; }

/* TOOLBAR (top right actions, if present) */
.toolbar{ display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap; margin:8px 0 }
.banner{
  background: var(--warning-100);
  border:1px solid #facc15; color:#fff;
  padding:10px 12px;border-radius:12px;margin:12px 0; box-shadow: var(--shadow-sm);
}

.banner-info{
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
}

.banner-success{
  background: var(--success-100);
  border-color: #22c55e;
}

.banner-warning{
  background: var(--warning-100);
  border-color: #facc15;
}

.banner-error{
  background: var(--danger-100);
  border-color: #ef4444;
}

/* Ensure answer highlights stay visible on mobile stacks */
.table tr.yes-row td { background: rgba(16,185,129,.13) !important; }
.table tr.no-row td { background: rgba(220,38,38,.13) !important; }

/* Hide noisy save banner on small screens */
@media (max-width: 768px) {
  #loadStatus { display: none; }
}

.question-line{
  display:flex;
  flex-direction: column;
  gap:4px;
  align-items:flex-start;
}
.citation-pill{
  display: inline-block;
  background: #2f3542; /* refined neutral */
  color: #e5e7eb;
  border: 1px solid #4b5563;
  border-radius:6px;
  padding:2px 8px;
  font-size:11px;
  line-height:1.3;
  white-space:normal;
  word-wrap:break-word;
  max-width:100%;
}
.citation-pill.regulation-badge{
  background: #1e293b;
  border-color: #334155;
  color: #e0f2fe;
}
.citation-pill.regulation-badge.regulation-epac{
  background: #312e81;
  border-color: #4338ca;
  color: #ede9fe;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.3);
}
.citation-pill.control-2022-badge{
  background: #111827;
  border-color: #1f2937;
  color: #c7d2fe;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.2);
}

@media (max-width: 640px) {
  .question-line{
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ANCHOR offsets for smooth scroll under sticky header */
.anchor{ position:relative; top:-78px }

/* RESPONSIVE BEHAVIOR */
@media (max-width:1000px) {
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .sidebar { position: static; top:auto; }
}

@media (max-width:600px) {
  /* Show mobile section switcher, hide sidebar */
  #mobileSectionDropdownWrapper { display: block; margin: 6px 0 2px; }
  .sidebar { display: none !important; }
}

/* Mobile section dropdown styling */
#mobileSectionDropdownWrapper select,
.section-dropdown{
  width:100%; appearance:none; background:var(--bg-elev);
  border:1px solid var(--border); border-radius:12px; padding:10px 14px;
  font-weight:600; letter-spacing:.2px;
  box-shadow: var(--shadow-sm);
  background-image:
    linear-gradient(180deg, transparent, transparent),
    radial-gradient(8px 8px at 95% 50%, rgba(2,6,23,.2) 50%, transparent 51%);
  background-repeat: no-repeat;
  background-position: right 14px center, right 42px center;
}
#mobileSectionDropdownWrapper small{ color: var(--muted); }

/* FOCUS VISIBLE */
:where(button, a, input, select, textarea):focus-visible{
  outline: none; box-shadow: 0 0 0 4px var(--focus), var(--shadow-sm);
}

/* AUTH OVERLAY */
.auth-overlay{
  position: fixed; inset:0;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(20px) saturate(180%);
  animation: fadeIn 0.3s ease;
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.matrix-canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.4;
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.25));
  pointer-events: none;
}

.auth-card{
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 20px;
  padding: 40px 36px;
  width: min(420px, 90vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(96, 165, 250, 0.1);
  color: var(--text);
  position: relative;
  z-index: 1;
  overflow: hidden;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
  animation: pulse 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.auth-card h2{
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 700;
  color: #e2e8f0;
  position: relative;
  z-index: 1;
}

.auth-brand{
  display:flex;
  align-items:center;
  justify-content: center;
  gap:12px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  position: relative;
  z-index: 1;
}

.auth-logo{
  font-size: 48px;
  filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.5));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.auth-title{
  font-weight: 700;
  font-size: 18px;
  color: #60a5fa;
  text-align: center;
  line-height: 1.4;
}

.auth-card form{
  display:flex;
  flex-direction:column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.auth-card label{
  display:flex;
  flex-direction:column;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-card input{
  padding: 14px 16px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  outline: none;
  font-size: 15px;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auth-card input:focus{
  border-color: #60a5fa;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.auth-card input::placeholder{
  color: #64748b;
}

.auth-card button{
  padding: 14px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-card button:hover{
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
}

.auth-card button:active{
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.auth-error{
  min-height: 20px;
  color: #fca5a5;
  font-size: 13px;
  text-align: center;
  padding: 10px;
  background: rgba(220, 38, 38, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(220, 38, 38, 0.3);
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.auth-error:empty{
  display: none;
}

/* Remove focus outline from completed checkbox */
input[data-completed]:focus {
  outline: none;
  box-shadow: none;
}

/* Better styling for completed checkbox */
input[data-completed] {
  accent-color: #22c55e;
  cursor: pointer;
  width: 14px;
  height: 14px;
}

input[data-completed]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #22c55e40;
}

input[data-not-checked] {
  accent-color: #94a3b8;
  cursor: pointer;
  width: 14px;
  height: 14px;
}

input[data-not-checked]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #94a3b850;
}

.completed-checkbox input[data-not-checked] {
  border-color: #475569;
  background: #0f172a;
}

.completed-checkbox input[data-not-checked]:checked {
  background: linear-gradient(135deg, #475569, #334155);
  border-color: #475569;
  box-shadow: none;
}

.completed-checkbox input[data-not-checked]:checked::after {
  color: #cbd5e1;
}

/* PRINT */
@media print{
  .header-bar, .sidebar, .toolbar, #mobileSectionDropdownWrapper { display:none !important; }
  body{ background:#fff; color:#000; }
  .card{ box-shadow:none; border-color:#cbd5e1; background:#fff; }
}

/* You kept this class earlier — leaving it for backward compat */
.hidden{ display:none }

/* ===== UI ENHANCEMENTS ===== */

/* Enhanced Card Shadows */
.card {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

/* Better Buttons */
button {
  transition: all 0.2s ease;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

button:active {
  transform: translateY(1px);
  opacity: 0.92;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Enhanced Primary Buttons */
button:not(.secondary):not(.danger):not(.photo-delete) {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
}

.ai-suggest-actions {
  margin-top: 10px;
}

.ai-suggest-btn {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(59,130,246,0.4);
  background: rgba(15,23,42,0.8);
  color: #bfdbfe;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-suggest-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.ai-sparkle {
  font-size: 15px;
}

#globalLoadingOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15000;
  backdrop-filter: blur(4px);
}

#globalLoadingOverlay .loader-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  padding: 32px 40px;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,0.3);
  box-shadow: 0 25px 60px rgba(0,0,0,0.45);
  text-align: center;
  color: #e2e8f0;
  font-size: 16px;
}

#globalLoadingOverlay .spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(148,163,184,0.4);
  border-top-color: #60a5fa;
  margin: 0 auto 16px auto;
  animation: spin 1s linear infinite;
}

#globalLoadingOverlay p {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.5px;
}

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

button:not(.secondary):not(.danger):not(.photo-delete):hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

/* Enhanced Secondary Buttons */
button.secondary {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #e2e8f0;
  color: #475569;
}

button.secondary:hover {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-color: #cbd5e1;
}

/* Enhanced Danger Buttons */
button.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
}

button.danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Tap feedback on rows */
.table tbody tr {
  transition: transform 0.1s ease, box-shadow 0.12s ease;
}

.table tbody tr:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

/* Floating Action Button Style for "Add Finding" */
button[data-add-finding] {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.3), 0 2px 4px -1px rgba(5, 150, 105, 0.2);
}

button[data-add-finding]:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateY(-2px);
  box-shadow: 0 8px 12px -2px rgba(5, 150, 105, 0.4), 0 4px 6px -1px rgba(5, 150, 105, 0.3);
}

/* Icon buttons enhancement */
button.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  border: none;
  font-size: 16px;
  transition: all 0.2s ease;
}

button.icon-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 12px rgba(99, 102, 241, 0.4);
}

/* Button group styling */
.button-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.button-group button:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.button-group button:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.button-group button:not(:first-child):not(:last-child) {
  border-radius: 0;
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes ripple-animation {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Button Ripple Effect */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}

.btn-ripple:active::before {
  width: 300px;
  height: 300px;
}

/* Success/Error Button States */
button.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
}

button.success:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

button.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
}

button.warning:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

/* Disabled button state */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

button:disabled:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Chart Container */
.chart-container {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 16px;
  text-align: center;
}

.chart-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  justify-content: center;
}

.chart-item {
  background: linear-gradient(135deg, #334155, #1e293b);
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex: 1;
  min-width: 140px;
  max-width: 180px;
}

.chart-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px -2px rgba(0, 0, 0, 0.3);
}

.chart-value {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #ffffff;
}

.chart-label {
  font-size: 12px;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Photo comment textarea styling */
.photo-comment{
  width: 100%;
  background: linear-gradient(180deg,#0f172a,#0b1220);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px; /* match .sm */
  color: var(--text);
  resize: vertical;
  min-height: 100px;
  box-sizing: border-box;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.2) inset, 0 1px 2px rgba(0,0,0,.15);
}
.photo-comment::placeholder{ color:#94a3b8 }
.photo-comment:focus{
  border-color:#3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}
@media (max-width: 768px){
  .photo-comment{ min-height: 80px; }
}

/* Classification-specific colors */
.chart-item.serious { 
  border-left: 4px solid #dc2626;
}
.chart-item.serious .chart-value { color: #dc2626; }

.chart-item.non-compliance { 
  border-left: 4px solid #ea580c;
}
.chart-item.non-compliance .chart-value { color: #ea580c; }

.chart-item.improvement { 
  border-left: 4px solid #d97706;
}
.chart-item.improvement .chart-value { color: #d97706; }

.chart-item.non-confirmation { 
  border-left: 4px solid #6b7280;
}
.chart-item.non-confirmation .chart-value { color: #6b7280; }

.chart-item.total { 
  border-left: 4px solid #3b82f6;
}
.chart-item.total .chart-value { color: #3b82f6; }

/* Enhanced Responsive Design */
@media (max-width: 768px) {
  .chart-grid {
    gap: 12px;
  }
  
  .chart-item {
    padding: 12px;
    min-width: 120px;
    flex: 1 1 calc(50% - 6px);
  }
  
  .chart-value {
    font-size: 20px;
  }
  
  .card {
    margin: 8px 0;
    border-radius: 12px;
  }
  
  button {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  /* Mobile-first button enhancements */
  .actions {
    gap: 6px;
  }
  
  .actions button {
    padding: 10px 14px;
    font-size: 12px;
    min-height: 44px; /* Touch-friendly minimum */
  }
  
  /* Stack buttons vertically on very small screens */
  @media (max-width: 480px) {
    .actions {
      flex-direction: column;
      width: 100%;
      gap: 8px;
    }
    
    .actions button {
      width: 100%;
      padding: 14px 16px;
      justify-content: center;
    }
  }
}

@media (max-width: 480px) {
  .chart-grid {
    gap: 8px;
  }
  
  .chart-item {
    min-width: 100px;
    padding: 10px;
    flex: 1 1 100%;
  }
  
  .chart-container {
    padding: 16px;
    margin: 12px 0;
  }
}

/* Responsive text area heights for findings */

/* ===== BEAUTIFUL INTERFACE ENHANCEMENTS ===== */

/* Glassmorphism Effects */
.card {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border) !important;
  position: relative;
  overflow: hidden;
}

/* Gradient Borders for Cards */
.card-header {
  position: relative;
  background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(147,51,234,.05));
  border-bottom: 1px solid var(--glass-border);
}

.card-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96,165,250,.5), transparent);
}

/* Smooth Fade-in Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.card {
  /* No animation for instant display */
}

.nav-item {
  /* No animation for instant display */
}

/* Table Row Stagger Animation */
.table tbody tr {
  /* No animation for instant display */
}

/* Enhanced Input Focus Effects */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--focus), var(--glow-primary) !important;
  transform: scale(1.01);
  transition: all 0.2s ease;
}

/* Floating Labels Effect */
.meta-row label {
  transition: all 0.2s ease;
  transform-origin: left top;
}

input:focus + label,
input:not(:placeholder-shown) + label {
  transform: translateY(-8px) scale(0.85);
  color: var(--primary);
}

/* Animated Checkbox */
input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elev);
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--primary-600), var(--primary));
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  color: white;
  font-size: 14px;
  font-weight: bold;
  animation: checkmark 0.3s ease;
}

@keyframes checkmark {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-45deg);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

/* Animated Counter for Chart Values */
.chart-value {
  animation: countUp 0.8s ease-out;
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pulse Effect for Critical Findings */
.chart-item.serious {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
  }
}

/* Enhanced Header with Gradient Animation */
.header-bar {
  background: linear-gradient(135deg, rgba(14,23,42,.95), rgba(30,41,59,.9), rgba(14,23,42,.95));
  background-size: 200% 200%;
}

/* Photo Hover Zoom */
.photo-thumbnail {
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.photo-thumbnail img {
  transition: transform 0.5s ease;
  will-change: transform;
}

.photo-thumbnail:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,.4), var(--glow-primary);
  z-index: 10;
}

.photo-thumbnail:hover img {
  transform: scale(1.1);
}

/* Success Toast Animation */
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3), var(--glow-success);
  animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  z-index: 9999;
  backdrop-filter: blur(10px);
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Enhanced Button Scale Effect */
button:active {
  transform: scale(0.95) !important;
}

/* Neon Glow for Active Elements */
.nav-item.active {
  background: linear-gradient(135deg, rgba(59,130,246,.2), rgba(147,51,234,.1));
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), #8b5cf6);
  border-radius: 0 3px 3px 0;
}

/* Improved Typography with Glow */
h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Badge Style for Classifications */
select[data-field="risk_level"],
.readonly-cell {
  transition: all 0.2s ease;
}

select[data-field="risk_level"]:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

/* Shake Animation for Errors */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error {
  animation: shake 0.5s ease;
  border-color: var(--danger) !important;
  box-shadow: var(--glow-danger) !important;
}

/* Sidebar Enhanced Glassmorphism */
.sidebar {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border) !important;
}

/* Section Expand/Collapse Animation */
details[open] summary ~ * {
  animation: slideDown 0.3s ease;
}

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

/* Enhanced Details Summary */
summary {
  transition: all 0.2s ease;
  position: relative;
}

summary:hover {
  color: var(--primary);
  transform: translateX(4px);
}

/* Loading Spinner Enhancement */
.loading::after {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3b82f6;
}

/* Better Focus Visible States */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Smooth Color Transitions */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

button, input, select, textarea, .card, .nav-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chart Item Hover Effect */
.chart-item {
  cursor: pointer;
  position: relative;
}

.chart-item::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  padding: 2px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chart-item:hover::before {
  opacity: 1;
}

/* Mobile Bottom Sheet Effect */
@media (max-width: 600px) {
  #mobileSectionDropdownWrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0,0,0,.3);
  }
}

/* ===== BEAUTIFUL FINDINGS SECTION ===== */

/* Enhanced Add Finding Button */
.btn-add-finding {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-add-finding:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.btn-add-finding .btn-icon {
  font-size: 13px;
}

/* Findings Actions Area */
.findings-actions {
  padding: 12px 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
}

/* Findings Container */
.findings-container {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Enhanced Findings Table */
.findings-table {
  background: transparent;
  border-spacing: 0 12px;
  border-collapse: separate;
}

.findings-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.findings-table thead th {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.05));
  color: #94a3b8;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  border: none;
  border-bottom: 2px solid rgba(96, 165, 250, 0.3);
}

.findings-table tbody tr {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.4));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.findings-table tbody tr:hover {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.6));
  border-color: rgba(96, 165, 250, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.findings-table tbody td {
  padding: 16px;
  border: none;
  vertical-align: middle;
}

.findings-table tbody tr td:first-child {
  border-radius: 12px 0 0 12px;
}

.findings-table tbody tr td:last-child {
  border-radius: 0 12px 12px 0;
}

/* Enhanced Select Dropdowns in Findings */
.findings-table select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: white;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.findings-table select:hover {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(15, 23, 42, 0.9);
}

.findings-table select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
  outline: none;
}

/* Enhanced Textareas in Findings */
.findings-table textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  min-height: 80px;
  transition: all 0.2s ease;
}

.findings-table textarea.findings-textarea {
  min-height: 250px;
}

.findings-table textarea:hover {
  border-color: rgba(96, 165, 250, 0.3);
}

.findings-table textarea:focus {
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

/* Finding Row Delete Button */
.findings-table button.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.findings-table button.danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Empty State for Findings */
.findings-table tbody:empty::after {
  content: 'No findings yet. Click "Add Finding" to create one.';
  display: block;
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
  font-style: italic;
  font-size: 13px;
}

/* Mobile Responsive Findings */
@media (max-width: 768px) {
  .findings-container {
    padding: 12px;
  }
  
  .btn-add-finding {
    width: 100%;
    justify-content: center;
  }
  
  .findings-table {
    border-spacing: 0 8px;
  }
  
  .findings-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }
  
  .findings-table tbody td {
    padding: 0;
    border-radius: 0 !important;
  }
  
  .findings-table thead {
    display: none;
  }
}
/* Impact badges */
.impact-badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.impact-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.impact-badge.security {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.impact-badge.safety {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.impact-badge.operation {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
}
