:root {
  --ink: #17201e;
  --ink-soft: #53605d;
  --paper: #f5f3ed;
  --panel: #fffefb;
  --line: #dedbd2;
  --honey: #d89520;
  --honey-dark: #a86608;
  --green: #286958;
  --red: #a64036;
  --blue: #315f7b;
  --shadow: 0 18px 50px rgba(36, 42, 39, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.muted { color: var(--ink-soft); }
.eyebrow { color: var(--honey-dark); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.topbar { height: 72px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; background: #17382f; color: white; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #17382f; background: #f2b84b; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 800; }
.brand strong { display: block; font-size: .94rem; letter-spacing: .01em; }
.brand small { display: block; margin-top: 2px; color: #b7d0c7; font-size: .7rem; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions form { margin: 0; }
.user-pill { padding: 7px 11px; border: 1px solid rgba(255,255,255,.18); border-radius: 99px; color: #dce9e4; font-size: .78rem; }
.demo-ribbon { padding: 7px 16px; background: #f5d891; color: #6e4706; text-align: center; font-size: .78rem; font-weight: 700; }

.page-shell { width: min(1460px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 70px; }
.page-shell.narrow { width: min(920px, calc(100% - 40px)); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading h1, .detail-heading h1 { margin: 5px 0 6px; font-family: Georgia, Cambria, serif; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 600; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--ink-soft); }
.mode-chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid #b9d0c9; border-radius: 99px; color: var(--green); background: #e9f3ef; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.mode-chip i, .match-ok i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mode-chip.mode-live { color: #8a3b31; border-color: #e1b4ad; background: #f9e7e3; }
.safety-banner { margin-bottom: 22px; padding: 14px 17px; border-left: 4px solid var(--green); border-radius: 8px; background: #eaf2ee; color: #315248; font-size: .88rem; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 6px 20px rgba(36,42,39,.035); }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--honey); }
.metric-blue::before { background: var(--blue); }.metric-red::before { background: var(--red); }.metric-green::before { background: var(--green); }
.metric-label { color: var(--ink-soft); font-size: .78rem; font-weight: 750; }
.metric-value { margin: 5px 0 1px; font-family: Georgia, serif; font-size: 2.2rem; line-height: 1; }
.metric-helper { color: #7b8582; font-size: .7rem; }

.panel, .detail-card { margin-top: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.panel-secondary { margin-top: 24px; box-shadow: none; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 15px; }
.panel-heading h2 { margin: 0 0 3px; font-family: Georgia, serif; font-size: 1.3rem; }
.panel-heading p { margin: 0; color: var(--ink-soft); font-size: .76rem; }
.panel-count { color: var(--ink-soft); font-size: .72rem; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f7f5f0; color: #68736f; font-size: .65rem; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 14px; border-bottom: 1px solid #ebe8e0; vertical-align: middle; font-size: .79rem; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfaf6; }
.data-table td small { display: block; max-width: 230px; margin-top: 4px; overflow: hidden; color: #79837f; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.data-table.compact td { padding-top: 11px; padding-bottom: 11px; }
.ticket-link { color: #245e50; font-weight: 800; text-decoration: none; }
.ticket-link:hover { text-decoration: underline; }
.plate { display: inline-block; padding: 5px 8px; border: 2px solid #282d2b; border-radius: 4px; background: #f6c945; color: #151817; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; font-weight: 900; letter-spacing: .04em; white-space: nowrap; }
.match-ok { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 700; white-space: nowrap; }
.date { color: var(--ink-soft); white-space: nowrap; }
.actions { text-align: right; }

.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 99px; font-size: .67rem; font-weight: 800; white-space: nowrap; }
.badge-attention { color: #7a4b03; background: #f8e7bb; }.badge-warning { color: #765413; background: #f2e8ca; }
.badge-danger { color: #84352d; background: #f5dfdb; }.badge-info { color: #28536c; background: #deebf2; }
.badge-success { color: #235e4e; background: #dfeee8; }.badge-muted { color: #596460; background: #e9ebe8; }

.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid #b9bdb9; border-radius: 8px; background: white; color: var(--ink); font-weight: 750; text-decoration: none; cursor: pointer; }
.button:hover { border-color: #7f8884; background: #faf9f5; }
.button-primary { border-color: #17382f; background: #17382f; color: white; }.button-primary:hover { background: #245244; }
.button-quiet { min-height: 32px; border-color: transparent; background: transparent; color: inherit; }
.topbar .button-quiet { color: #dce9e4; }
.button-small { min-height: 30px; padding: 5px 9px; font-size: .7rem; }

.alert { margin: 0 0 18px; padding: 12px 14px; border-radius: 8px; font-size: .84rem; }
.alert-danger { color: #7d3029; background: #f6dfdb; }.alert-success { color: #215a4b; background: #dfeee8; }
.empty-state { padding: 32px !important; color: var(--ink-soft); text-align: center; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--ink-soft); font-size: .8rem; text-decoration: none; }
.detail-card { padding: clamp(24px, 5vw, 46px); }
.detail-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.detail-heading h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; }
.detail-grid div { padding: 20px 4px; border-bottom: 1px solid #ebe8e0; }
.detail-grid div:nth-child(odd) { padding-right: 24px; }
.detail-grid dt { color: var(--ink-soft); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.detail-grid dd { margin: 7px 0 0; font-size: .92rem; font-weight: 650; }
.approval-box { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 28px; padding: 18px; border: 1px solid #e4c878; border-radius: 12px; background: #fff7df; }
.approval-box p { margin: 4px 0 0; color: #705c29; font-size: .78rem; }
.incident-copy, .review-panel, .decision-panel { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.section-heading h2, .decision-panel h2 { margin: 5px 0 7px; font-family: Georgia, serif; font-size: 1.45rem; }
.privacy-chip { padding: 6px 9px; border-radius: 99px; color: #315248; background: #eaf2ee; font-size: .66rem; font-weight: 800; white-space: nowrap; }
.reporter-line { margin: 14px 0 8px; color: var(--ink-soft); font-size: .78rem; }
.incident-text { max-height: 340px; overflow: auto; padding: 17px; border: 1px solid #d8d5cc; border-radius: 10px; background: #faf9f5; font-size: .86rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-panel > p { margin: 0 0 18px; font-size: .8rem; line-height: 1.55; }
.review-form { display: grid; gap: 17px; }
.form-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 12px; }
.review-form label { display: grid; gap: 7px; color: #44504c; font-size: .72rem; font-weight: 800; }
.review-form input, .review-form select, .review-form textarea { width: 100%; padding: 10px 11px; border: 1px solid #c9cdc9; border-radius: 8px; background: white; color: var(--ink); outline: none; }
.review-form input, .review-form select { height: 43px; }
.review-form textarea { resize: vertical; line-height: 1.5; }
.review-form input:focus, .review-form select:focus, .review-form textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40,105,88,.12); }
.review-form input:disabled { color: #8a918f; background: #ecece8; }
.review-submit { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px; border: 1px solid #d7d2c5; border-radius: 11px; background: #f7f5ee; }
.safety-note-inline { display: grid; gap: 3px; font-size: .74rem; }.safety-note-inline span { color: var(--ink-soft); font-size: .68rem; }
.decision-panel > p { color: var(--ink-soft); font-size: .82rem; }
.reply-preview { margin-top: 16px; padding: 16px; border-left: 4px solid var(--honey); border-radius: 8px; background: #fff8e7; }
.reply-preview p { margin: 7px 0 0; font-size: .84rem; line-height: 1.55; }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 10%, #36695a 0, #17382f 34%, #102a24 100%); }
.login-card { display: grid; width: min(940px, 100%); grid-template-columns: 1.1fr .9fr; overflow: hidden; border-radius: 22px; background: var(--panel); box-shadow: 0 28px 90px rgba(0,0,0,.28); }
.login-intro { min-height: 520px; padding: clamp(34px, 6vw, 68px); color: white; background-color: #17382f; background-image: linear-gradient(150deg, rgba(255,255,255,.04), rgba(0,0,0,.14)), repeating-linear-gradient(135deg, transparent 0 28px, rgba(255,255,255,.018) 28px 29px); }
.login-intro .eyebrow { color: #f2c365; }
.login-intro h1 { max-width: 520px; margin: 20px 0; font-family: Georgia, serif; font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 500; line-height: 1.03; letter-spacing: -.04em; }
.login-intro p { max-width: 430px; color: #cbded7; line-height: 1.65; }
.safety-note { display: flex; align-items: center; gap: 9px; margin-top: 62px; color: #d9e7e2; font-size: .75rem; }
.safety-note span { width: 8px; height: 8px; border-radius: 50%; background: #f2b84b; box-shadow: 0 0 0 5px rgba(242,184,75,.13); }
.login-form-wrap { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 6vw, 60px); }
.brand-login { margin-bottom: 42px; }.brand-login strong { font-size: .9rem; }
.login-form-wrap h2 { margin: 0 0 5px; font-family: Georgia, serif; font-size: 1.75rem; }
.login-form-wrap > p { margin: 0 0 24px; font-size: .82rem; }
.form-stack { display: grid; gap: 16px; }
.form-stack label { display: grid; gap: 7px; color: #44504c; font-size: .74rem; font-weight: 750; }
.form-stack input { width: 100%; height: 45px; padding: 0 12px; border: 1px solid #c9cdc9; border-radius: 8px; background: white; color: var(--ink); outline: none; }
.form-stack input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40,105,88,.12); }
.form-stack .button { margin-top: 4px; }
.demo-hint { margin-top: 22px !important; padding: 10px; border-radius: 7px; background: #f2eee4; text-align: center; }

@media (max-width: 980px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-card { grid-template-columns: 1fr; max-width: 560px; }
  .login-intro { min-height: auto; }.safety-note { margin-top: 32px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .topbar { height: 64px; padding: 0 16px; }.brand small, .user-pill { display: none; }
  .page-shell, .page-shell.narrow { width: min(100% - 24px, 1460px); padding-top: 28px; }
  .page-heading { align-items: start; flex-direction: column; }.page-heading h1 { font-size: 2.2rem; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 9px; }.metric-card { padding: 16px; }.metric-helper { display: none; }
  .panel { border-radius: 12px; }.panel-heading { padding: 17px 15px 12px; }
  .data-table th, .data-table td { padding-left: 11px; padding-right: 11px; }
  .detail-grid { grid-template-columns: 1fr; }.detail-grid div:nth-child(odd) { padding-right: 4px; }
  .detail-heading, .approval-box { align-items: stretch; flex-direction: column; }
  .section-heading, .review-submit { align-items: stretch; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .login-shell { padding: 12px; }.login-card { border-radius: 16px; }.login-intro { padding: 30px; }.login-intro h1 { font-size: 2.35rem; }
}
