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

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f5f5f5;
  line-height: 1.5;
}

/* Nav */
nav {
  background: #1e3a5f;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 48px;
}
nav a { color: #cdd9e5; text-decoration: none; font-size: 13px; }
nav a:hover { color: #fff; }
nav a.active { color: #fff; font-weight: 600; border-bottom: 2px solid #4da6ff; padding-bottom: 2px; }
nav .brand { color: #fff; font-weight: 700; font-size: 15px; margin-right: 1rem; }

/* Main */
main { max-width: 1200px; margin: 1.5rem auto; padding: 0 1.5rem; }

/* Flash messages */
.flash { padding: .6rem 1rem; margin-bottom: 1rem; border-radius: 4px; font-size: 13px; }
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Page header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.page-header h1 { font-size: 1.4rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin: 1.5rem 0 .8rem; }

/* Buttons */
.btn {
  display: inline-block; padding: .4rem .9rem; border-radius: 4px; font-size: 13px;
  text-decoration: none; border: 1px solid #ccc; background: #fff; cursor: pointer; color: #333;
}
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.btn-primary:hover { background: #163050; }
.btn-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-danger:hover { background: #c82333; }
.btn-link { background: none; border: none; color: #1e3a5f; cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; }
.btn-danger-link { color: #dc3545; }

/* Filter bar */
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filter-bar input, .filter-bar select { padding: .35rem .6rem; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }
.filter-bar input { min-width: 200px; }

/* Table */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: .5rem; }
th { background: #2c4a6e; color: #fff; padding: .6rem .8rem; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td { padding: .55rem .8rem; border-bottom: 1px solid #eee; vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }
tr.row-warning td { background: #fff3cd; }
table a { color: #1e3a5f; text-decoration: none; }
table a:hover { text-decoration: underline; }
.count { font-size: 12px; color: #666; margin-bottom: 1rem; }
.compact { font-size: 13px; }
.compact th, .compact td { padding: .35rem .6rem; }

/* Badges */
.badge { display: inline-block; padding: .2rem .5rem; border-radius: 3px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.badge-high    { background: #f8d7da; color: #721c24; }
.badge-serious { background: #fff3cd; color: #856404; }
.badge-medium  { background: #cce5ff; color: #004085; }
.badge-low     { background: #d4edda; color: #155724; }
.badge-status  { background: #e9ecef; color: #495057; }

/* Forms */
.form-card { background: #fff; border-radius: 6px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); max-width: 800px; }
.form-group { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
label { font-size: 12px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: .04em; }
input[type=text], input[type=date], select, textarea {
  padding: .45rem .6rem; border: 1px solid #ccc; border-radius: 4px;
  font-size: 13px; font-family: inherit; background: #fff;
}
input[readonly] { background: #f5f5f5; color: #666; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #1e3a5f; box-shadow: 0 0 0 2px rgba(30,58,95,.15); }
.form-actions { display: flex; gap: .5rem; margin-top: .5rem; }

/* RAC display */
.rac-display { padding: .45rem .6rem; border-radius: 4px; border: 1px solid #ccc; font-weight: 700; background: #f5f5f5; min-height: 32px; }
.rac-high    { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.rac-serious { background: #fff3cd; color: #856404; border-color: #ffeeba; }
.rac-medium  { background: #cce5ff; color: #004085; border-color: #b8daff; }
.rac-low     { background: #d4edda; color: #155724; border-color: #c3e6cb; }

/* Detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.detail-section { background: #fff; border-radius: 6px; padding: 1.2rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.detail-section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: #555; margin-bottom: .8rem; }
dl { display: grid; grid-template-columns: 120px 1fr; gap: .4rem .8rem; }
dt { font-weight: 600; color: #666; font-size: 12px; }
dd { color: #1a1a1a; }
.detail-list { background: #fff; border-radius: 6px; padding: 1.2rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 1.2rem; }
.findings-box { background: #fff; border-radius: 6px; padding: 1.2rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); white-space: pre-wrap; }

/* Reports */
.report-summary { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: 6px; padding: 1rem 1.2rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); min-width: 180px; }
.stat-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #555; margin-bottom: .6rem; }

/* Confirm delete */
.confirm-delete { background: #fff; border-radius: 6px; padding: 2rem; max-width: 500px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.confirm-delete h1 { margin-bottom: 1rem; }
.confirm-delete p { margin-bottom: .8rem; }
.warning { color: #856404; background: #fff3cd; padding: .5rem .8rem; border-radius: 4px; }
.confirm-delete form { margin-top: 1.2rem; display: flex; gap: .5rem; }

/* Query page */
.query-layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.query-examples { background: #fff; border-radius: 6px; padding: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); min-width: 180px; max-width: 200px; }
.query-examples h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #555; margin-bottom: .6rem; }
.example-btn { display: block; width: 100%; text-align: left; background: none; border: none; padding: .35rem .4rem; font-size: 12px; color: #1e3a5f; cursor: pointer; border-radius: 3px; margin-bottom: .2rem; }
.example-btn:hover { background: #eef2f7; }
.query-main { flex: 1; }
#sql-input { width: 100%; padding: .6rem; border: 1px solid #ccc; border-radius: 4px; font-family: 'Courier New', monospace; font-size: 13px; background: #fff; }
.query-actions { display: flex; align-items: center; gap: 1rem; margin: .6rem 0; }
#query-status { font-size: 12px; color: #666; }
#query-results { overflow-x: auto; }
.hint { font-size: 12px; color: #666; margin-bottom: 1rem; }

.empty { color: #888; font-size: 13px; margin: 1rem 0; }

@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; }
  .query-layout { flex-direction: column; }
  .query-examples { max-width: 100%; min-width: unset; width: 100%; }
}
