:root {
  --ink: #18343d;
  --navy: #093745;
  --teal: #08727d;
  --gold: #ffae30;
  --gold-dark: #9a5900;
  --paper: #ffffff;
  --canvas: #f2f5f6;
  --line: #dce5e8;
  --muted: #607780;
  --success: #08745b;
  --danger: #a12424;
  --shadow: 0 12px 34px rgba(9, 55, 69, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
button, select, input, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 10px 14px; background: var(--navy); color: white; }
button:hover:not(:disabled) { filter: brightness(1.08); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(255, 174, 48, .45); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.alt { background: #e6edef; color: var(--navy); }
button.active { background: var(--gold); color: var(--navy); font-weight: 700; }
button.danger { background: var(--danger); }

.brand-header { background: var(--navy); color: white; padding: 14px 22px; display: flex; align-items: center; gap: 14px; }
.brand-header img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.brand-header small { display: block; color: #ffbd56; margin-top: 2px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
nav { display: flex; gap: 8px; flex-wrap: wrap; padding: 15px; background: white; border-bottom: 1px solid var(--line); }
main#app { max-width: 1200px; margin: auto; padding: 22px; }

.environment-warning { padding: 10px 22px; background: #fff4dc; color: #704200; border-bottom: 1px solid #f2d797; text-align: center; }
.auth-shell { min-height: calc(100vh - 165px); display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(100%, 440px); box-shadow: var(--shadow); }
.auth-card button[type="submit"] { width: 100%; margin-top: 14px; }
.auth-card input { width: 100%; }
.demo-access { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.demo-account { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #edf2f3; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 18px; margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; }
.card.subtle { background: #f8fafb; }
h1 { font-size: 25px; margin: 0 0 14px; }
h2 { font-size: 19px; }
h3, h4 { line-height: 1.25; }
.eyebrow { display: block; text-transform: uppercase; letter-spacing: .09em; color: var(--teal); font-weight: 750; font-size: 12px; margin-bottom: 8px; }
small, .muted { color: var(--muted); }
.metric { font-size: 27px; font-weight: 750; margin: 8px 0; }
.bar { height: 8px; background: #e1e9eb; border-radius: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: #db9b32; }
label { display: block; margin: 9px 0 4px; font-weight: 600; }
label.checkbox { font-weight: 400; display: flex; align-items: flex-start; gap: 8px; }
input:not([type="checkbox"]), select, textarea { padding: 9px; border: 1px solid #c8d5d9; border-radius: 7px; max-width: 100%; background: white; }
input[type="checkbox"] { accent-color: var(--teal); margin-top: 3px; }
textarea { min-height: 82px; resize: vertical; width: 100%; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 14px; }
.field-grid input, .field-grid select { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 10px; border-bottom: 1px solid #e5ecee; vertical-align: top; }
.scroll { overflow: auto; }
.warning, .warn { color: var(--gold-dark); }
.ok { color: var(--success); }
.error { color: var(--danger); min-height: 1.3em; }
.pill { display: inline-block; padding: 4px 9px; background: #e7eff0; border-radius: 20px; font-size: 12px; }
.pill.warning { background: #fff0d0; color: #6d4300; }
.pill.ok { background: #ddf3ea; color: #056048; }
.pill.info { background: #dff1f5; color: #075a66; }
.journey { display: grid; gap: 8px; }
.journey-step { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.journey-step.complete { border-color: #9dd7c5; background: #f2fbf7; }
.journey-number { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #e7eff0; font-weight: 700; }
.journey-step.complete .journey-number { background: var(--success); color: white; }
.document-row, .debt-row { padding: 10px 0; border-bottom: 1px solid #e5ecee; }
.empty { text-align: center; padding: 28px; color: var(--muted); }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; padding: 13px 16px; border-radius: 10px; color: white; background: var(--navy); box-shadow: var(--shadow); z-index: 10; }
.hidden { display: none !important; }
footer { padding: 20px; text-align: center; color: var(--muted); }

@media (max-width: 650px) {
  main#app { padding: 12px; }
  .brand-header { padding: 12px; align-items: flex-start; }
  .brand-header img { width: 50px; height: 50px; }
  .header-actions { flex-direction: column; align-items: flex-end; }
  nav { padding: 10px; }
  button { padding: 9px; }
  td, th { white-space: nowrap; }
  .journey-step { grid-template-columns: 32px 1fr; }
  .journey-step .pill { grid-column: 2; justify-self: start; }
  .journey-step button { grid-column: 2; justify-self: start; width: auto; }
}
