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

:root {
  --ink: #1a2129; --ink-2: #5b6672; --ink-3: #8b95a1;
  --line: #e4e8ec; --line-2: #eef1f4;
  --bg: #f7f8fa; --card: #ffffff;
  --shell: #14181d; --shell-2: #1c2128; --shell-ink: #e8ebef; --shell-muted: #9aa4af;
  --accent: #d95b1e; --accent-ink: #b34712; --accent-soft: #fdf0e8;
  --ok: #1a7a4d; --ok-soft: #e4f3ec;
  --warn: #a06508; --warn-soft: #faf0dc;
  --error: #bb3a32; --error-soft: #fae8e6;
  --info: #2563a8; --info-soft: #e7eef7;
  --radius: 10px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 29, .05);
  --shadow-md: 0 4px 16px -4px rgba(20, 24, 29, .1);
  --focus: 0 0 0 3px rgba(217, 91, 30, .25);
}

html { scroll-behavior: smooth; }
body {
  font-family: "Outfit", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--accent); }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--shell); color: var(--shell-ink);
  display: flex; align-items: center; gap: 22px;
  padding: 0 22px; min-height: 58px; flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand a { color: #fff; font-weight: 800; letter-spacing: .22em; font-size: 15px; }
.brand a:hover { color: #fff; }
.brand-tag {
  background: var(--shell-2); border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px; padding: 2px 9px; font-size: 11.5px; font-weight: 500;
  color: var(--shell-muted); letter-spacing: .02em; white-space: nowrap;
}
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; }
.topbar nav a {
  color: var(--shell-muted); padding: 7px 11px; border-radius: 7px;
  font-size: 13.5px; font-weight: 500; transition: color .18s ease, background .18s ease;
}
.topbar nav a:hover { background: var(--shell-2); color: #fff; }
.topbar nav a.active { background: var(--shell-2); color: #fff; }
.topbar nav a.active::after { content: ""; display: block; height: 2px; margin: 2px 2px -6px; border-radius: 2px; background: var(--accent); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.userbox .muted { color: var(--shell-muted); font-size: 13px; font-weight: 500; }
.userbox .muted:hover { color: #fff; }

.container { max-width: 1240px; margin: 0 auto; padding: 30px 24px 56px; }
.footer { text-align: center; color: var(--ink-3); font-size: 12px; padding: 22px; letter-spacing: .04em; }

/* ---------- Type ---------- */
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; text-wrap: balance; }
.sub { color: var(--ink-2); margin-bottom: 22px; font-size: 14px; max-width: 62ch; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 26px 0 12px; }
.card h2, .point-card h2 { margin-top: 0; }

/* ---------- KPI ---------- */
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, transform .2s ease;
}
.kpi:hover { box-shadow: var(--shadow-md); }
.kpi .n { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-2); font-size: 12.5px; font-weight: 500; margin-top: 2px; }
.kpi.alert .n { color: var(--error); }

/* ---------- Cards / tables ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.table-wrap { overflow-x: auto; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; vertical-align: middle; }
th { color: var(--ink-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; background: transparent; }
tbody tr, table tr { transition: background .15s ease; }
table tr:hover td { background: #fafbfc; }
tr:last-child td { border-bottom: none; }
td { font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 2px 9px; font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--line-2); color: var(--ink-2); }

/* ---------- Forms ---------- */
form.stack { display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: block; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; margin-top: 4px; color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
textarea { min-height: 72px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; color: var(--ink); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--shell); color: #fff; border: 1px solid transparent; border-radius: 8px;
  padding: 9px 18px; font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background .18s ease, transform .12s ease, box-shadow .18s ease; letter-spacing: .01em;
}
.btn:hover { background: var(--shell-2); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-ink); }
.btn-line { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-line:hover { background: var(--bg); color: var(--ink); border-color: var(--ink-3); }
.btn-danger { background: #fff; color: var(--error); border-color: var(--line); }
.btn-danger:hover { background: var(--error-soft); border-color: var(--error); color: var(--error); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.25); color: var(--shell-ink); }
.btn-ghost:hover { background: var(--shell-2); border-color: rgba(255,255,255,.4); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.inline { display: inline; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius); padding: 11px 15px; margin-bottom: 18px; font-size: 13.5px; font-weight: 500; border: 1px solid transparent; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: #c4e3d2; }
.alert-error { background: var(--error-soft); color: var(--error); border-color: #eec7c4; }
.cred-box {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.cred-box code {
  background: var(--bg); border: 1px solid var(--line); padding: 3px 9px; border-radius: 6px;
  font-size: 13.5px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---------- Auth ---------- */
.auth-body { min-height: 100dvh; display: grid; place-items: center; background: var(--shell); padding: 24px; }
.auth-panel { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; font-weight: 800; letter-spacing: .3em; font-size: 22px; color: #fff; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--shell-muted); font-size: 13px; margin-bottom: 26px; }
.auth-card { background: var(--card); border-radius: var(--radius-lg); padding: 26px; box-shadow: 0 24px 60px -12px rgba(0,0,0,.5); }
.auth-foot { text-align: center; color: var(--shell-muted); font-size: 12px; margin-top: 18px; }
.auth-foot a { color: var(--shell-muted); text-decoration: underline; }

/* ---------- Landing ---------- */
.landing-hero { background: var(--shell); color: #fff; padding: 90px 24px 100px; }
.landing-hero .inner { max-width: 860px; margin: 0 auto; text-align: left; }
.landing-kicker { color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 18px; }
.landing-hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.12; letter-spacing: -.03em; margin-bottom: 18px; max-width: 17ch; }
.landing-hero p { color: var(--shell-muted); font-size: 16.5px; max-width: 54ch; margin-bottom: 30px; }
.landing-features { max-width: 1100px; margin: -46px auto 0; padding: 0 24px 70px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feature {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-md);
}
.feature .f-num { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .12em; margin-bottom: 10px; }
.feature h3 { font-size: 15.5px; font-weight: 600; margin-bottom: 6px; letter-spacing: -.01em; }
.feature p { color: var(--ink-2); font-size: 13.5px; }

/* ---------- Damage points ---------- */
.point-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px;
  margin-bottom: 12px; background: var(--card); box-shadow: var(--shadow-sm);
}
.point-card .point-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.photo-thumb { max-width: 170px; max-height: 128px; border-radius: 8px; border: 1px solid var(--line); display: block; transition: transform .18s ease; }
.photo-thumb:hover { transform: scale(1.02); }

/* ---------- Risk ---------- */
.risk-big { font-size: 42px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.risk-low { color: var(--ok); } .risk-mid { color: var(--warn); } .risk-high { color: var(--error); }

/* ---------- Utility ---------- */
.muted { color: var(--ink-2); }
.mt { margin-top: 14px; }
.right { text-align: right; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
details summary { cursor: pointer; color: var(--accent-ink); font-size: 13px; font-weight: 500; }
details summary:hover { color: var(--accent); }
details[open] { margin-bottom: 8px; }
.empty { color: var(--ink-3); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
@media (max-width: 720px) { .topbar { padding-bottom: 10px; } .container { padding: 22px 16px 44px; } }
