:root {
  --brand: #e8482b;
  --ink: #1a1a1a;
  --text: #1f2933;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f6f7f9;
  --card: #ffffff;
  --pass: #15803d;
  --fail: #b91c1c;
  --na: #6b7280;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* Header */
.app-header {
  background: var(--ink);
  color: #fff;
  padding: 16px 0;
}
.app-header .wrap { display: flex; align-items: baseline; gap: 12px; }
.brand-link {
  display: flex; align-items: baseline; gap: 12px;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; color: #fff; }
.brand-sub { color: rgba(255, 255, 255, .7); font-size: 13px; }

/* Navigation affordances */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.panel-head h1 { margin: 0; }
.back-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); font: inherit; margin-bottom: 8px;
}
.back-link:hover { color: var(--ink); }
.muted-line { color: var(--muted); }

/* Panels */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 40px;
}
.panel h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.01em; }
.panel h2 { font-size: 17px; margin: 28px 0 4px; }
.lead { color: var(--muted); margin: 0 0 20px; }

/* Form */
.field { display: block; margin-bottom: 18px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.auth-fields {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px 2px;
  margin: 0 0 18px;
}
.auth-fields legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.field-narrow { max-width: 260px; }

/* Buttons */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(0.94); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: var(--fail); }
.btn-danger:hover { color: #fff; background: var(--fail); border-color: var(--fail); }

/* Site list */
.site-list { display: flex; flex-direction: column; gap: 12px; }
.site-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.site-name { margin: 0; font-size: 16px; }
.site-meta { margin: 4px 0 0; font-size: 13px; color: var(--text); }
.site-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.auth-tag { color: var(--ink); font-weight: 600; }
.site-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* History table */
#historyBody { overflow-x: auto; } /* the row keeps its shape on narrow panels */
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th, .history-table td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.history-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.history-table td.num, .history-table th.num { text-align: right; }
.history-table .status-running { color: var(--muted); }
.history-table .status-error { color: var(--fail); }
.sev-badge {
  display: inline-block; font-size: 11px; font-weight: 700; color: #fff;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
}
.history-table td:first-child { white-space: nowrap; }
.history-table td.row-actions { text-align: right; white-space: nowrap; }
.history-table .row-actions .btn { margin-left: 6px; }
.review-state { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.review-when { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.review-state.review-complete { color: var(--pass); font-weight: 600; }
.review-state.review-draft { color: var(--ink); font-weight: 600; }
.sev-critical { background: var(--fail); }
.sev-serious { background: #c2410c; }
.sev-moderate { background: #b45309; }
.sev-minor { background: #3b82f6; }

.form-error {
  color: var(--fail);
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin: 0 0 16px;
}

/* Progress */
.progress {
  height: 12px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 20px 0 10px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width .4s ease;
}
.progress-text { font-size: 13px; color: var(--muted); word-break: break-all; }

/* Summary cards */
.summary-cards { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.card {
  flex: 1;
  min-width: 130px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.card-value { display: block; font-size: 28px; font-weight: 800; line-height: 1; }
.card-label { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.card.band-good .card-value { color: var(--pass); }
.card.band-moderate .card-value { color: #b45309; }
.card.band-poor .card-value { color: var(--fail); }
.overview {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text);
}
.review-hint { font-size: 13px; color: var(--muted); margin: 4px 0 18px; }
.review-sub { font-size: 13px; color: var(--muted); margin: -8px 0 16px; }

/* AI-assist */
.manual-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; }
.manual-head h2 { margin: 0; }
.ai-status {
  font-size: 13px;
  color: var(--text);
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 16px;
}
.ai-status.ai-error { color: var(--fail); background: #fef2f2; border-color: #fecaca; }

/* AI-assist page picker */
.ai-picker {
  border: 1px solid #ddd6fe;
  background: #faf9ff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
}
.ai-picker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ai-picker-title { font-weight: 700; font-size: 14px; }
.ai-picker-count { font-size: 12px; font-weight: 700; color: #6d28d9; white-space: nowrap; }
.ai-picker-hint { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.ai-picker-filter {
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  margin: 0 0 8px;
}
.ai-picker-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}
.ai-page {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.ai-page:last-child { border-bottom: none; }
.ai-page:hover { background: #faf9ff; }
.ai-page[hidden] { display: none; }
.ai-page-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-page-reason {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ede9fe;
  color: #6d28d9;
  white-space: nowrap;
}
.ai-page-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
/* At the cap, the unchecked rows read as unavailable rather than silently ignoring clicks. */
.ai-page input:disabled + .ai-page-path { color: var(--muted); }
.ai-picker-empty { padding: 10px; font-size: 13px; color: var(--muted); }
.ai-picker-actions { display: flex; gap: 8px; margin-top: 12px; }
.check.ai-suggested { border-color: #c4b5fd; box-shadow: 0 0 0 1px #ddd6fe inset; }
.ai-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: #ede9fe;
  color: #6d28d9;
}
.ai-badge.conf-low { opacity: 0.75; }

/* Estimates screen */
.est-totals { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.est-total {
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}
.est-total strong { font-size: 15px; }
.est-total-hours { border-color: var(--brand); color: var(--brand); }
.est-total-warn { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.est {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 12px;
  background: var(--card);
}
.est.ai-suggested { border-color: #c4b5fd; box-shadow: 0 0 0 1px #ddd6fe inset; }
.est-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.est-title { flex: 1; font-weight: 700; font-size: 14px; min-width: 200px; }
.est-title a { color: inherit; }
.est-sev { font: inherit; font-size: 12px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
/* Automated rows keep axe's rating, shown as a chip rather than an editable select. */
.severity-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}
.severity-critical { background: #b91c1c; }
.severity-serious { background: #c2410c; }
.severity-moderate { background: #b45309; }
.severity-minor { background: #3b82f6; }
.est-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 10px; font-size: 12px; color: var(--muted); }
.est-src { font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; }
.est-src-manual { background: #ecfdf5; color: #065f46; }
.est-rec { width: 100%; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; resize: vertical; }
.est-controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.est-hours-field { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.est-hours { width: 84px; font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.est-owner { display: flex; gap: 8px; }
.est-empty { font-size: 14px; color: var(--muted); }

/* Manual checks */
.check {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px;
}
.check-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.check-title { font-size: 15px; font-weight: 700; padding: 0; }
.check-wcag { font-size: 11px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.check-guidance { font-size: 13px; color: var(--muted); margin: 6px 0 12px; }
.check-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.radio:has(input:checked) { color: #fff; border-color: transparent; }
.radio-pass:has(input:checked) { background: var(--pass); }
.radio-fail:has(input:checked) { background: var(--fail); }
.radio-na:has(input:checked) { background: var(--na); }
/* Owner toggle on the estimates screen — the base rule above whitens the label,
   so each pill must bring its own background. */
.radio-agency:has(input:checked) { background: var(--ink); }
.radio-client:has(input:checked) { background: var(--brand); }
.radio input { accent-color: var(--brand); }
.check-notes {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  min-height: 38px;
}
.check-notes:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.submit-row { display: flex; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }
.submit-status { font-size: 13px; color: var(--muted); }
.save-state { font-size: 13px; color: var(--muted); margin-left: auto; }
.save-state.save-error { color: var(--fail); }

@media (max-width: 560px) {
  .field-row { flex-direction: column; gap: 0; }
  .panel { padding: 20px; }
  .site-card { flex-direction: column; align-items: stretch; }
  .site-actions { justify-content: flex-start; }
  .panel-head { flex-direction: column; align-items: flex-start; }
}

/* Laravel port fix: `.btn { display: inline-block }` above beats the UA stylesheet's
   [hidden] rule, so hidden buttons (e.g. the AI buttons without an API key) still showed. */
[hidden] { display: none !important; }

/* --- Laravel port additions: sign-out control + login screen --- */
.signout { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.signout-user { color: rgba(255, 255, 255, .7); }
.signout .btn-ghost { color: rgba(255, 255, 255, .85); border-color: rgba(255, 255, 255, .35); }
.signout .btn-ghost:hover { color: #fff; border-color: #fff; }
.login-panel { max-width: 420px; margin: 48px auto 0; }
.login-panel .submit-row { margin-top: 8px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 18px; }
@media (max-width: 560px) {
  .app-header .wrap { flex-wrap: wrap; }
  .signout-user { display: none; }
}
