/* ============================================================
   SiteForge — base.css
   Modern, clean, utility-first. No frameworks.
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --brand:      #0D1F2D;
  --brand-dk:   #071420;
  --brand-lt:   #e4edf2;
  --accent:     #0EA5A0;
  --accent-dk:  #0c8f8a;
  --accent-lt:  #e4f6f5;

  --bg:         #EEEEF0;
  --surface:    #FFFFFF;
  --surface-2:  #F7F8F7;
  --border:     #E2E6E3;
  --border-dk:  #C8CEC9;

  --text:       #111A14;
  --text-2:     #3D4A3F;
  --text-3:     #7A8C7D;

  --nav-h:      58px;
  --nav-bg:     #0D1F2D;

  --radius:     8px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 6px rgba(0,0,0,0.04);
  --shadow:     0 4px 16px rgba(0,0,0,0.09), 0 1px 4px rgba(0,0,0,0.05);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.14);

  --font:       'DM Sans', system-ui, sans-serif;
  --mono:       'DM Mono', monospace;
  --page-pad:   32px;
  --max-w:      1100px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1,h2,h3,h4,h5,h6 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
p { margin: 0; }
ul { margin: 0; padding: 0; }

/* ── Top nav ────────────────────────────────────────────────── */
.topnav {
  background: var(--nav-bg);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 var(--page-pad);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(14,165,160,0.18), 0 2px 20px rgba(0,0,0,0.28);
}
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.025em;
  margin-right: 28px;
  flex-shrink: 0;
  opacity: 0.95;
  transition: opacity 0.1s;
}
.topnav-brand:hover { opacity: 1; }
.topnav-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(14,165,160,0.18);
  border: 1px solid rgba(14,165,160,0.30);
  padding: 3px;
  box-shadow: 0 0 10px rgba(14,165,160,0.20);
}
.topnav-brand-icon img {
  width: 100%; height: 100%; display: block;
  filter: brightness(0) invert(1);
}
.topnav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.topnav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.58);
  font-size: 13.5px;
  font-weight: 450;
  transition: background 0.12s, color 0.12s;
}
.topnav-link:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.topnav-link.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 550; }
.topnav-link i { font-size: 14px; opacity: 0.7; }
.topnav-link.active i { opacity: 1; }

.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.topnav-new {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.12s, transform 0.1s;
  letter-spacing: -0.01em;
}
.topnav-new:hover { background: var(--accent-dk); color: #fff; }
.topnav-new:active { transform: scale(0.98); }

/* User menu */
.user-menu { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.12s;
  color: rgba(255,255,255,0.75);
  font-size: 12.5px;
  border: 1px solid rgba(255,255,255,0.1);
}
.user-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); }
.user-avatar {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown-email {
  padding: 11px 14px;
  font-size: 11.5px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface-2);
}
.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  color: var(--text-2);
  font-size: 13px;
  transition: background 0.1s;
}
.user-dropdown a:hover { background: var(--surface-2); color: var(--text); }
.user-dropdown a i { font-size: 13px; color: var(--text-3); width: 15px; }
.dd-divider { height: 1px; background: var(--border); }
.user-limit {
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  background: var(--surface-2);
}

/* Mobile nav */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 9px;
  margin-left: auto;
  border-radius: var(--radius);
  transition: background 0.1s;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,0.08); }
.mobile-nav { display: none; position: fixed; inset: 0; z-index: 200; }
.mobile-nav.open { display: block; }
.mobile-nav-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); }
.mobile-nav-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 270px;
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  animation: slideLeft 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: -8px 0 32px rgba(0,0,0,0.2);
}
@keyframes slideLeft { from { transform: translateX(100%); } to { transform: translateX(0); } }
.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.mobile-nav-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius);
  line-height: 1;
}
.mobile-nav-close:hover { background: rgba(255,255,255,0.14); color: #fff; }
.mobile-nav-body { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  color: rgba(255,255,255,0.68);
  font-size: 14px;
  border-radius: var(--radius);
  transition: background 0.1s, color 0.1s;
  font-weight: 450;
}
.mobile-nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.mobile-nav-link i { font-size: 15px; width: 18px; opacity: 0.8; }
.mobile-nav-link.accent {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  margin-bottom: 6px;
}
.mobile-nav-link.accent:hover { background: var(--accent-dk); }
.mobile-nav-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 8px 0; }
.mobile-nav-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.mobile-nav-email {
  font-size: 11.5px;
  color: rgba(255,255,255,0.35);
  font-family: var(--mono);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-nav-plan {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  font-family: var(--mono);
}

/* ── Main content ───────────────────────────────────────────── */
.main-content { min-height: calc(100vh - var(--nav-h)); display: flex; flex-direction: column; }

/* ── Page structure ─────────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px var(--page-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.page-header h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.025em; }
.page-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }
.page-body { flex: 1; padding: 24px var(--page-pad); margin-left: auto; margin-right: auto; width: 100%; box-sizing: border-box; }
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
  display: block;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-header i { color: var(--text-3); font-size: 14px; }
.card-body { padding: 18px; }

/* ── Grids ──────────────────────────────────────────────────── */
.doc-grid      { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 14px; }
.client-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 10px; }
.activity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 10px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }

/* ── Doc card ───────────────────────────────────────────────── */
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.doc-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-dk);
  transform: translateY(-1px);
}
.doc-card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.doc-card-client { font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.doc-card-title  { font-weight: 600; font-size: 14px; margin-bottom: 4px; color: var(--text); }
.doc-card-loc    { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.doc-card-rows   { font-size: 12px; color: var(--text-3); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.doc-card-actions { display: flex; gap: 6px; }

/* ── Client card ────────────────────────────────────────────── */
.client-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.client-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-lt); }

/* ── Activity cards ─────────────────────────────────────────── */
.activity-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  cursor: pointer;
  background: var(--surface);
  text-align: center;
  position: relative;
  transition: all 0.15s;
}
.activity-card:hover {
  border-color: var(--activity-color, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--activity-color, var(--accent)), transparent 80%);
  transform: translateY(-1px);
}
.activity-card.selected {
  border-color: var(--activity-color, var(--accent));
  background: color-mix(in srgb, var(--activity-color, var(--accent)), white 92%);
}
.activity-card.selected::after {
  content: '✓';
  position: absolute; top: 8px; right: 10px;
  font-size: 12px; font-weight: 700;
  color: var(--activity-color, var(--accent));
}
.activity-icon  { font-size: 22px; margin-bottom: 8px; display: block; }
.activity-label { font-weight: 600; font-size: 13px; margin-bottom: 3px; color: var(--text); }
.activity-desc  { font-size: 11.5px; color: var(--text-3); line-height: 1.35; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  background: none;
  letter-spacing: -0.01em;
}
.btn:hover { filter: brightness(0.93); }
.btn:active { filter: brightness(0.86); transform: scale(0.99); }
.btn:disabled, .btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn-primary   { background: var(--accent);  color: #fff; border-color: var(--accent); }
.btn-accent    { background: var(--accent);  color: #fff; border-color: var(--accent); }
.btn-brand     { background: var(--brand);   color: #fff; border-color: var(--brand); }
.btn-success   { background: #166534;        color: #fff; border-color: #166534; }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-dk); }
.btn-ghost     { background: transparent;    color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-danger    { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.btn-sm  { padding: 4px 10px; font-size: 12.5px; }
.btn-lg  { padding: 11px 22px; font-size: 15px; font-weight: 600; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}
.form-text  { font-size: 12px; color: var(--text-3); margin-top: 4px; display: block; }
.form-error { font-size: 12px; color: #991b1b; margin-top: 4px; display: block; }

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-dk);
  border-radius: var(--radius);
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
}
.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}
textarea { resize: vertical; }
.form-control-sm { padding: 5px 9px; font-size: 13px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-draft     { background: #f3f4f6; color: #6b7280; }
.badge-generated { background: #dbeafe; color: #1e40af; }
.badge-finalised { background: #d1fae5; color: #065f46; }
.badge-low       { background: #d1fae5; color: #065f46; }
.badge-medium    { background: #fef3c7; color: #92400e; }
.badge-high      { background: #fee2e2; color: #991b1b; }
.badge-critical  { background: #b91c1c; color: #fff; }
.ai-badge {
  font-size: 10px;
  font-weight: 600;
  background: #ede9fe;
  color: #5b21b6;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
}

/* ── Step bar ───────────────────────────────────────────────── */
.step-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.step-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 450;
  color: var(--text-3);
  text-decoration: none;
  transition: all 0.12s;
}
.step-indicator:hover:not(.active):not(.pending) { background: var(--surface-2); color: var(--text-2); }
.step-indicator.active  { background: var(--accent); color: #fff; font-weight: 600; }
.step-indicator.done    { background: var(--accent-lt); color: var(--accent-dk); font-weight: 500; }
.step-indicator.pending { pointer-events: none; }
.step-num {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  background: rgba(0,0,0,0.07);
  flex-shrink: 0;
}
.step-indicator.active .step-num { background: rgba(255,255,255,0.22); color: #fff; }
.step-indicator.done   .step-num { background: var(--accent); color: #fff; }
.step-chevron { color: var(--border-dk); font-size: 11px; flex-shrink: 0; }

/* ── Risk table ─────────────────────────────────────────────── */
.risk-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }
.risk-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.risk-table th {
  padding: 9px 11px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand);
  border-right: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}
.risk-table th:last-child { border-right: none; }
.risk-table td { padding: 9px 11px; border-bottom: 1px solid var(--border); vertical-align: top; }
.risk-table tbody tr:nth-child(even) td { background: var(--surface-2); }
.risk-table tbody tr:hover td { background: var(--accent-lt); cursor: pointer; }
.risk-table tbody tr:last-child td { border-bottom: none; }
.score-cell { text-align: center; font-weight: 700; font-family: var(--mono); }
.score-low    { background: #d1fae5; color: #065f46; }
.score-medium { background: #fef3c7; color: #92400e; }
.score-high   { background: #fee2e2; color: #991b1b; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 780px; max-height: 90vh;
  display: flex; flex-direction: column;
  transform: translateY(10px) scale(0.99); transition: transform 0.18s;
  border: 1px solid var(--border);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-header {
  background: var(--brand); color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 14px; font-weight: 600; color: #fff; }
.modal-close {
  background: rgba(255,255,255,0.1); border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px; cursor: pointer; padding: 4px 7px;
  border-radius: 6px; line-height: 1; transition: background 0.1s;
}
.modal-close:hover { background: rgba(255,255,255,0.2); color: #fff; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Toasts ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: 16px; right: 16px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 360px;
}
.toast-msg {
  background: var(--text); color: #fff;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
  animation: toastIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255,255,255,0.08);
}
.toast-msg.success { background: #14532d; }
.toast-msg.error   { background: #7f1d1d; }
.toast-close {
  margin-left: auto; background: none; border: none;
  color: rgba(255,255,255,0.55); cursor: pointer;
  font-size: 18px; padding: 0; line-height: 1;
}
.toast-close:hover { color: #fff; }
@keyframes toastIn { from { opacity:0; transform:translateX(16px) scale(0.96); } to { opacity:1; transform:translateX(0) scale(1); } }

/* ── Spinners ───────────────────────────────────────────────── */
.spinner {
  display: inline-block; border-radius: 50%; border-style: solid;
  border-color: var(--accent-lt); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-md { width: 24px; height: 24px; border-width: 3px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth pages ─────────────────────────────────────────────── */
.public-wrap {
  min-height: calc(100vh - var(--nav-h));
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%; max-width: 420px;
  overflow: hidden;
}
.auth-card-header {
  background: linear-gradient(150deg, #0A1D28 0%, #0F2A3A 100%);
  color: #fff;
  padding: 28px 24px 24px;
  border-radius: 0;
  text-align: center;
  position: relative;
}
.auth-card-header .brand-mark {
  width: 48px; height: 48px;
  background: rgba(14,165,160,0.18);
  border: 1px solid rgba(14,165,160,0.35);
  border-radius: 12px;
  margin: 0 auto 12px;
  padding: 8px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 14px rgba(14,165,160,0.25);
}
.auth-card-header .brand-mark img {
  width: 100%; height: 100%;
  filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(14,165,160,0.6));
}
.auth-card-header .brand   { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.auth-card-header .tagline { font-size: 12.5px; opacity: 0.65; margin-top: 4px; }
.auth-card-body { padding: 26px; }

/* ── Drop zone ──────────────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--border-dk);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  background: var(--surface-2);
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-lt);
}
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }

/* ── YN toggles ─────────────────────────────────────────────── */
.yn-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 5px;
  background: var(--surface);
  transition: border-color 0.1s;
}
.yn-row:hover { border-color: var(--border-dk); }
.yn-label { font-size: 13.5px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 8px; }
.yn-group { display: flex; gap: 5px; }
.yn-btn {
  min-width: 46px; padding: 5px 8px;
  border-radius: var(--radius); font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border-dk);
  background: var(--surface-2); color: var(--text-3);
  cursor: pointer; transition: all 0.1s; font-family: var(--font);
}
.yn-btn.yes.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.yn-btn.no.active  { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.yn-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

/* ── Flag icons ─────────────────────────────────────────────── */
.flag-icon {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.flag-icon.warning { background: #fef3c7; color: #92400e; }
.flag-icon.danger  { background: #fee2e2; color: #991b1b; }
.flag-icon.info    { background: #dbeafe; color: #1e40af; }
.flag-icon.neutral { background: var(--surface-2); color: var(--text-3); }

/* ── Reveal panels ──────────────────────────────────────────── */
.reveal {
  display: none;
  margin-top: 10px; margin-left: 0;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ── Entry rows (step 2) ────────────────────────────────────── */
.entry-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.rm-btn {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 13px; padding: 5px;
  border-radius: var(--radius); transition: all 0.1s;
}
.rm-btn:hover { background: #fee2e2; color: #991b1b; }

/* ── COSHH items ────────────────────────────────────────────── */
.coshh-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.coshh-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  cursor: pointer; background: var(--surface);
  transition: all 0.12s;
  display: flex; justify-content: space-between; align-items: center;
}
.coshh-item:hover { border-color: var(--border-dk); background: var(--surface-2); }
.coshh-item.active { border-color: #ef4444; background: #fef2f2; }
.coshh-label { font-size: 13px; font-weight: 500; }
.coshh-check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-dk);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; transition: all 0.12s; flex-shrink: 0;
}
.coshh-item.active .coshh-check { background: #ef4444; border-color: #ef4444; color: #fff; }

/* ── Extracted preview ──────────────────────────────────────── */
.extracted-card {
  background: var(--accent-lt);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.extracted-field { display: flex; gap: 10px; margin-bottom: 4px; align-items: flex-start; }
.extracted-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  min-width: 100px; padding-top: 2px;
  text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0;
}
.extracted-value { font-size: 13px; color: var(--text); flex: 1; }

/* ── Stream / generation ────────────────────────────────────── */
.stream-banner {
  background: var(--accent-lt);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: none;
}
.stream-preview-row {
  font-size: 12px; color: var(--text-2);
  padding: 3px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--accent), transparent 70%);
  animation: fadeIn 0.2s ease;
}
.error-banner {
  display: none;
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #991b1b;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* ── New / details panels ───────────────────────────────────── */
.new-panel {
  background: var(--surface-2);
  border: 1.5px dashed var(--border-dk);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.details-panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 8px;
}

/* ── Home page ──────────────────────────────────────────────── */
.home-hero {
  display: flex; align-items: center; justify-content: center;
  padding: 72px 24px 56px;
  text-align: center;
  flex: 1;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}
.home-hero-inner { max-width: 560px; }
.home-mark {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 88px; height: 88px;
  background: var(--brand);
  border-radius: 22px;
  margin-bottom: 28px;
  box-shadow: 0 8px 24px rgba(27,58,75,0.25);
}
.home-mark img {
  width: 58px; height: 58px;
  filter: brightness(0) invert(1);
}
.home-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-lt); color: var(--accent-dk);
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600; margin-bottom: 18px;
}
.home-h1 {
  font-size: 48px; font-weight: 800; letter-spacing: -0.04em;
  line-height: 1.08; margin: 0 0 16px; color: var(--text);
}
.home-lead {
  font-size: 17px; color: var(--text-3); line-height: 1.6;
  margin: 0 auto 32px; max-width: 440px;
}
.home-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.home-small { font-size: 12px; color: var(--text-3); margin-top: 14px; letter-spacing: 0.01em; }
.home-features {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px var(--page-pad);
  flex-shrink: 0;
}
.home-features-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: repeat(3,1fr); gap: 32px; text-align: center;
}
.feature-icon {
  width: 44px; height: 44px; background: var(--accent-lt); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
}
.feature-title { font-weight: 600; margin-bottom: 5px; font-size: 14.5px; }
.feature-desc  { font-size: 13.5px; color: var(--text-3); line-height: 1.55; }

/* ── Utilities ──────────────────────────────────────────────── */
.mono            { font-family: var(--mono); }
.muted           { color: var(--text-3); }
.small           { font-size: 12.5px; }
.text-center     { text-align: center; }
.text-right      { text-align: right; }
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-1 { gap: 4px; }  .gap-2 { gap: 8px; }
.gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }   .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }  .mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }  .mb-2 { margin-bottom: 8px; }
.w-full { width: 100%; }
.score-big {
  font-size: 26px; font-weight: 800;
  font-family: var(--mono); text-align: center;
}

/* ════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .grid-4        { grid-template-columns: 1fr 1fr; }
  .coshh-grid    { grid-template-columns: 1fr 1fr; }
  .activity-grid { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); }
  .home-features-inner { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 768px) {
  :root { --page-pad: 16px; }

  .topnav-links  { display: none; }
  .topnav-right .user-menu { display: none; }
  .topnav-right .topnav-new { display: none; }
  .topnav-right .topnav-link { display: none; }
  .mobile-menu-btn { display: block; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr 1fr; }
  .entry-row { grid-template-columns: 1fr 30px; }
  .step-chevron { display: none; }
  .step-indicator { font-size: 12px; padding: 4px 7px; }
  .modal-overlay { padding: 0; align-items: flex-end; backdrop-filter: none; }
  .modal-box { max-width: 100%; max-height: 95vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; transform: translateY(20px); }
  .toast-container { left: 12px; right: 12px; top: 12px; max-width: none; }
  .auth-card { max-width: 100%; }
  .activity-grid { grid-template-columns: 1fr 1fr; }
  .home-h1 { font-size: 32px; }
  .home-lead { font-size: 15px; }
  .home-hero { padding: 48px 20px 40px; }
  .home-mark { width: 72px; height: 72px; border-radius: 18px; margin-bottom: 22px; }
  .home-mark img { width: 46px; height: 46px; }
  .home-features { padding: 36px var(--page-pad); }
}

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

/* ── Site footer ────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px var(--page-pad);
  margin-top: 48px;
}
.site-footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}
.site-footer-brand img { width: 24px; height: 24px; border-radius: 6px; }
.site-footer-tagline { font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}
.site-footer-links a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
}
.site-footer-links a:hover { color: var(--accent); }
.site-footer-copy {
  width: 100%;
  max-width: var(--max-w);
  margin: 14px auto 0;
  color: var(--text-3);
  font-size: 12px;
}

/* ── Legal / static content pages ───────────────────────────── */
.legal {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px var(--page-pad) 64px;
}
.legal-head { margin-bottom: 28px; }
.legal-head h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.legal-updated { color: var(--text-3); font-size: 13px; }
.legal-body { color: var(--text-2); font-size: 15px; line-height: 1.7; }
.legal-body h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 10px;
  letter-spacing: -0.01em;
}
.legal-body h3 {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  margin: 22px 0 8px;
}
.legal-body p { margin: 0 0 14px; }
.legal-body ul { margin: 0 0 16px; padding-left: 22px; }
.legal-body li { margin-bottom: 7px; }
.legal-body a { color: var(--accent); }
.legal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 20px;
  font-size: 14px;
}
.legal-body th, .legal-body td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
.legal-body th { background: var(--surface-2); font-weight: 600; color: var(--text); }
.legal-toc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 28px;
}
.legal-toc strong { display: block; font-size: 13px; color: var(--text-3); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.legal-toc ol { margin: 0; padding-left: 20px; columns: 2; }
.legal-toc a { color: var(--text-2); text-decoration: none; font-size: 13.5px; }
.legal-toc a:hover { color: var(--accent); }
.legal-address {
  font-style: normal;
  line-height: 1.6;
  margin: 0 0 14px;
  color: var(--text-2);
}
/* Wrap wide tables so they scroll horizontally on small screens
   instead of forcing the whole page to overflow. */
.legal-body .table-wrap { margin: 8px 0 20px; }
.legal-body .table-wrap table { margin: 0; }

/* ── Cookie consent banner ──────────────────────────────────── */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  max-width: 720px;
  margin: 0 auto;
  background: var(--brand);
  color: #eaf1f6;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 18px 22px;
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.cookie-banner.show { display: flex; }
.cookie-banner-text { flex: 1 1 280px; font-size: 13.5px; line-height: 1.55; }
.cookie-banner-text a { color: #fff; text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cookie-banner-actions .btn { white-space: nowrap; }
.btn-cookie-accept {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-cookie-accept:hover { background: var(--accent-dk); }
.btn-cookie-reject {
  background: transparent;
  color: #eaf1f6;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-cookie-reject:hover { border-color: #fff; }

@media (max-width: 640px) {
  .legal { padding: 28px var(--page-pad) 48px; }
  .legal-head { margin-bottom: 22px; }
  .legal-head h1 { font-size: 26px; }
  .legal-body { font-size: 14.5px; }
  .legal-body h2 { font-size: 17.5px; margin: 26px 0 9px; }
  .legal-toc { padding: 14px 16px; }
  .legal-toc ol { columns: 1; }
  /* Let wide tables scroll sideways within their wrapper rather than
     pushing the layout wider than the viewport. */
  .legal-body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .legal-body .table-wrap table { min-width: 460px; }
  .legal-body th, .legal-body td { padding: 8px 10px; font-size: 13px; }
  .site-footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .site-footer-brand { flex-direction: column; align-items: flex-start; gap: 4px; }
  .site-footer-tagline { font-size: 12px; font-weight: 400; color: var(--text-3); max-width: 280px; line-height: 1.5; }
  .site-footer-links { gap: 14px; }
  .site-footer-copy { margin-top: 6px; }
  .cookie-banner { padding: 16px; }
  .cookie-banner-actions { width: 100%; }
  .cookie-banner-actions .btn-cookie-accept,
  .cookie-banner-actions .btn-cookie-reject { flex: 1; }
}
