:root {
  --primary: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-dark: #1e40af;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --perceivable: #7c3aed;
  --operable: #2563eb;
  --understandable: #16a34a;
  --robust: #ea580c;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 70px;
}

#app-header {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

#app-header h1 { font-size: 18px; font-weight: 600; }

.header-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
}

#main-content {
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
}

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 6px 0;
  z-index: 100;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  padding: 4px 8px;
  cursor: pointer;
  gap: 2px;
}

.nav-btn.active { color: var(--primary); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
}

.btn:hover { opacity: 0.9; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

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

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text-secondary); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pass { background: #dcfce7; color: #166534; }
.badge-fail { background: #fee2e2; color: #991b1b; }
.badge-not-tested { background: #f1f5f9; color: #475569; }
.badge-na { background: #e0e7ff; color: #3730a3; }
.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-major { background: #fef3c7; color: #92400e; }
.badge-minor { background: #e0e7ff; color: #3730a3; }
.badge-found { background: #fee2e2; color: #991b1b; }
.badge-in-progress { background: #fef3c7; color: #92400e; }
.badge-fixed { background: #dcfce7; color: #166534; }
.badge-verified { background: #dbeafe; color: #1e40af; }
.badge-high { background: #fee2e2; color: #991b1b; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-low { background: #e0e7ff; color: #3730a3; }

@media (prefers-color-scheme: dark) {
  .badge-pass { background: #166534; color: #dcfce7; }
  .badge-fail { background: #991b1b; color: #fee2e2; }
  .badge-not-tested { background: #334155; color: #94a3b8; }
  .badge-na { background: #3730a3; color: #e0e7ff; }
  .badge-critical { background: #991b1b; color: #fee2e2; }
  .badge-major { background: #92400e; color: #fef3c7; }
  .badge-minor { background: #3730a3; color: #e0e7ff; }
  .badge-found { background: #991b1b; color: #fee2e2; }
  .badge-in-progress { background: #92400e; color: #fef3c7; }
  .badge-fixed { background: #166534; color: #dcfce7; }
  .badge-verified { background: #1e40af; color: #dbeafe; }
  .badge-high { background: #991b1b; color: #fee2e2; }
  .badge-medium { background: #92400e; color: #fef3c7; }
  .badge-low { background: #3730a3; color: #e0e7ff; }
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.accordion { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  border: none;
  width: 100%;
  color: var(--text);
  text-align: left;
}

.accordion-header::after { content: '\25BC'; font-size: 10px; transition: transform 0.2s; }
.accordion.open .accordion-header::after { transform: rotate(180deg); }

.accordion-body { display: none; padding: 0; }
.accordion.open .accordion-body { display: block; }

.criterion-item {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.criterion-item:hover { background: var(--bg); }

.criterion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.criterion-number { font-weight: 600; font-size: 13px; min-width: 40px; }
.criterion-title { flex: 1; font-size: 13px; }

.criterion-detail {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.criterion-item.expanded .criterion-detail { display: block; }

.issue-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
}

.issue-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

.severity-icon { width: 20px; height: 20px; flex-shrink: 0; }

.status-steps {
  display: flex;
  gap: 4px;
  margin: 12px 0;
}

.status-step {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
}

.status-step.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.status-step.completed { background: var(--success); color: #fff; border-color: var(--success); }

.donut-chart { display: block; margin: 0 auto; }

.score-large { font-size: 36px; font-weight: 700; text-align: center; }
.score-label { font-size: 14px; color: var(--text-secondary); text-align: center; }

.principle-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.principle-bar-label { width: 110px; font-size: 12px; font-weight: 500; }
.principle-bar-track { flex: 1; height: 12px; background: var(--border); border-radius: 6px; overflow: hidden; }
.principle-bar-fill { height: 100%; border-radius: 6px; }
.principle-bar-value { width: 36px; font-size: 12px; font-weight: 600; text-align: right; }

.timeline-event {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.timeline-line {
  position: absolute;
  left: 5px;
  top: 16px;
  bottom: -16px;
  width: 2px;
  background: var(--border);
}

.audit-log-entry {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}

.audit-log-entry .log-num { color: var(--text-secondary); margin-right: 8px; }
.audit-log-entry .log-date { color: var(--primary); margin-right: 8px; }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-secondary);
}

.empty-state svg { opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(29,78,216,0.4);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title { font-size: 18px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.summary-item {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg);
  border-radius: var(--radius);
}

.summary-item .num { font-size: 24px; font-weight: 700; }
.summary-item .lbl { font-size: 11px; color: var(--text-secondary); }

.activity-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.activity-item .act-date { color: var(--text-secondary); font-size: 11px; white-space: nowrap; }

.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 12px; }

.tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

@media (min-width: 480px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
}
