:root {
  --ink: #0e2434;
  --ink-soft: #486170;
  --nav: #0b2134;
  --nav-2: #13364f;
  --paper: #f3f6f7;
  --line: #dce5e9;
  --blue: #126caa;
  --blue-soft: #e9f4fb;
  --green: #16795c;
  --green-soft: #e8f6f0;
  --amber: #b96a00;
  --amber-soft: #fff4dd;
  --red: #b73a35;
  --red-soft: #fdeceb;
  --violet: #684c9e;
  --shadow: 0 10px 28px rgba(16, 44, 63, .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-width: 320px; background: var(--paper); }
button, select, input { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { background: var(--nav); color: #d8e6ee; padding: 24px 16px 18px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { padding: 0 10px 22px; border-bottom: 1px solid rgba(232, 245, 250, .14); margin-bottom: 15px; }
.brand-mark { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; letter-spacing: -.025em; color: #fff; }
.brand-road { width: 29px; height: 29px; background: #ffbf4e; border-radius: 8px; position: relative; transform: rotate(45deg); box-shadow: 0 0 0 5px rgba(255, 191, 78, .12); }
.brand-road::after { content: ""; position: absolute; width: 3px; height: 42px; background: repeating-linear-gradient(to bottom, #0b2134 0 5px, transparent 5px 10px); left: 13px; top: -6px; transform: rotate(-45deg); }
.brand small { display: block; margin-top: 11px; color: #9bb1c0; line-height: 1.4; font-size: 12px; }
.nav-group { margin: 8px 0 12px; }
.nav-label { margin: 0 10px 8px; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: #7f9bad; text-transform: uppercase; }
.nav-button { display: flex; width: 100%; padding: 10px; border: 0; border-radius: 9px; align-items: center; gap: 10px; color: #d0e0e9; background: transparent; text-align: left; transition: .15s; }
.nav-button:hover { background: rgba(255,255,255,.07); }
.nav-button.active { background: linear-gradient(90deg, #1b628f, #164665); color: #fff; box-shadow: inset 3px 0 #ffbf4e; }
.nav-text { font-size: 13px; font-weight: 600; }
.side-footer { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(232,245,250,.14); color: #9bb1c0; font-size: 11px; line-height: 1.55; }

.main { min-width: 0; }
.topbar { height: 76px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 32px; position: sticky; z-index: 10; top: 0; }
.crumb { flex: 1; min-width: 0; }
.crumb-title { font-size: 17px; font-weight: 760; letter-spacing: -.015em; }
.crumb-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-select { min-width: 218px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 31px 9px 11px; color: var(--ink); background: #fff; font-size: 12px; }
.icon-button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); position: relative; }
.notification-dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--red); top: 6px; right: 6px; }
.reset-button { border: 1px solid var(--line); padding: 9px 11px; border-radius: 8px; color: var(--ink-soft); background: #fff; font-size: 12px; }
.reset-button:hover { border-color: var(--blue); color: var(--blue); }
.content { max-width: 1660px; padding: 28px 32px 44px; margin: 0 auto; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.page-title { font-size: 26px; line-height: 1.12; letter-spacing: -.04em; margin: 0; font-weight: 780; }
.page-lead { margin: 7px 0 0; color: var(--ink-soft); max-width: 780px; font-size: 13px; line-height: 1.5; }
.asof { padding: 8px 11px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; white-space: nowrap; }
.asof strong { color: var(--ink); font-weight: 700; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 17px; }
.metric { background: #fff; padding: 16px; border: 1px solid var(--line); border-radius: 11px; min-width: 0; box-shadow: 0 1px 0 rgba(10, 35, 53, .02); }
.metric.highlight { border-color: #bed8e8; background: linear-gradient(140deg, #fff, #f2f9fd); }
.metric-label { font-size: 11px; color: var(--ink-soft); min-height: 30px; line-height: 1.35; }
.metric-value { font-size: 20px; font-weight: 760; letter-spacing: -.035em; margin-top: 7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-foot { color: var(--ink-soft); font-size: 11px; margin-top: 5px; }
.metric-action { width: 100%; text-align: left; border: 0; background: none; padding: 0; color: inherit; }
.metric-action:hover .metric-value { color: var(--blue); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(330px, .78fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 18px; box-shadow: 0 1px 0 rgba(10, 35, 53, .02); min-width: 0; }
.card + .card { margin-top: 16px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.card-title { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.card-subtitle { color: var(--ink-soft); font-size: 11px; line-height: 1.45; margin: 4px 0 0; }
.quiet { color: var(--ink-soft); font-size: 12px; }
.section-link { border: 0; color: var(--blue); padding: 0; background: none; font-size: 12px; font-weight: 650; }
.section-link:hover { text-decoration: underline; }

.bar-chart { display: grid; grid-template-columns: 86px 1fr 72px; gap: 9px 12px; align-items: center; }
.bar-label { font-size: 12px; color: var(--ink-soft); }
.bar-rail { height: 9px; background: #edf1f3; border-radius: 99px; overflow: hidden; }
.bar { height: 100%; border-radius: 99px; background: var(--blue); }
.bar.planned { background: #5b9dc6; }
.bar.claimed { background: #a474c2; }
.bar.verified { background: #2f8b78; }
.bar.accepted { background: #d59527; }
.bar.paid { background: #4569ab; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; }

.risk-list, .activity-list, .document-list { display: grid; gap: 8px; }
.risk-row, .activity-row, .document-row { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 8px; border: 1px solid #edf1f3; }
.risk-row:hover { border-color: #c7dce8; background: #fbfdfe; }
.risk-main { min-width: 0; flex: 1; }
.risk-title { font-size: 12px; font-weight: 700; line-height: 1.35; }
.risk-meta, .activity-meta { color: var(--ink-soft); font-size: 11px; line-height: 1.45; margin-top: 2px; }
.risk-arrow { color: var(--blue); font-size: 18px; }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 4px 7px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.good { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.danger { background: var(--red-soft); color: var(--red); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.muted { background: #eef2f4; color: #647886; }
.badge.violet { background: #f1ebfb; color: var(--violet); }

.object-map { min-height: 350px; border-radius: 10px; overflow: hidden; position: relative; background: #e8f1ed; border: 1px solid #d7e2dc; }
.object-map::before { content: ""; position: absolute; inset: 0; opacity: .44; background-image: linear-gradient(30deg, transparent 44%, #b0c5b7 45%, #b0c5b7 46%, transparent 47%), linear-gradient(-25deg, transparent 46%, #c6d3ca 47%, #c6d3ca 48%, transparent 49%), repeating-linear-gradient(90deg, rgba(120, 161, 130,.14) 0 1px, transparent 1px 48px), repeating-linear-gradient(0deg, rgba(120, 161, 130,.14) 0 1px, transparent 1px 48px); }
.map-title { position: absolute; top: 15px; left: 16px; z-index: 1; background: rgba(255,255,255,.92); border: 1px solid #d4e1da; border-radius: 7px; padding: 8px 10px; font-size: 11px; color: var(--ink-soft); }
.map-title strong { display: block; color: var(--ink); margin-bottom: 2px; }
.road { position: absolute; z-index: 1; background: #67828c; height: 12px; border: 3px solid #fff; border-radius: 12px; transform-origin: left center; box-shadow: 0 1px 2px rgba(40,65,72,.2); }
.road::after { content: ""; position: absolute; inset: 2px 8px; background: repeating-linear-gradient(90deg, transparent 0 9px, #f6d78c 9px 15px); opacity: .9; }
.marker { position: absolute; z-index: 2; border: 0; background: none; padding: 0; }
.marker-dot { display: flex; align-items: center; justify-content: center; width: 29px; height: 29px; color: #fff; font-size: 10px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 3px 9px rgba(10, 41, 61,.24); }
.marker-dot.alert { background: var(--red); }
.marker-label { margin: 4px -44px 0; width: 118px; padding: 3px 5px; border-radius: 5px; background: rgba(255,255,255,.88); box-shadow: 0 1px 4px rgba(17,45,57,.12); color: var(--ink); font-size: 10px; font-weight: 680; line-height: 1.2; }

.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filter { min-width: 160px; padding: 8px 29px 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-size: 12px; }
.primary-button, .secondary-button, .danger-button { border-radius: 8px; font-size: 12px; font-weight: 700; padding: 9px 12px; }
.primary-button { color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.primary-button:hover { background: #075c94; }
.secondary-button { color: var(--blue); background: #fff; border: 1px solid #bdd7e7; }
.secondary-button:hover { background: #f3faff; }
.danger-button { color: var(--red); background: #fff; border: 1px solid #f0c5c1; }
.disabled { opacity: .52; cursor: not-allowed; }

.table-wrap { overflow: auto; border: 1px solid #e6edf0; border-radius: 9px; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { background: #f5f8f9; color: #617582; padding: 10px 12px; font-size: 10px; font-weight: 780; text-align: left; text-transform: uppercase; letter-spacing: .055em; white-space: nowrap; }
td { border-top: 1px solid #edf1f3; padding: 11px 12px; color: #243b49; vertical-align: middle; font-size: 12px; line-height: 1.35; }
tr:hover td { background: #fbfdfe; }
.cell-main { font-weight: 690; }
.cell-sub { color: var(--ink-soft); font-size: 10px; margin-top: 2px; }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-alert td { background: #fff8f7; }

.timeline { position: relative; padding-left: 23px; display: grid; gap: 13px; }
.timeline::before { content: ""; position: absolute; top: 7px; bottom: 8px; left: 6px; width: 1px; background: #d8e4e8; }
.timeline-item { position: relative; }
.timeline-dot { position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border: 3px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px #b9d5e3; }
.timeline-dot.good { background: var(--green); box-shadow: 0 0 0 1px #b8dfd0; }
.timeline-dot.danger { background: var(--red); box-shadow: 0 0 0 1px #efc2be; }
.timeline-title { font-size: 12px; font-weight: 700; }
.timeline-meta { font-size: 11px; color: var(--ink-soft); margin-top: 2px; line-height: 1.45; }

.progress-line { height: 9px; border-radius: 99px; background: #eaf0f2; overflow: hidden; margin-top: 7px; }
.progress-line > span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.split-amount { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #e5edf0; border-radius: 9px; overflow: hidden; }
.split-amount > div { padding: 13px; border-right: 1px solid #e5edf0; }
.split-amount > div:last-child { border-right: 0; }
.split-label { color: var(--ink-soft); font-size: 10px; line-height: 1.35; }
.split-value { font-size: 16px; font-weight: 760; letter-spacing: -.025em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.notice { border-radius: 8px; border-left: 3px solid var(--blue); padding: 10px 12px; background: #f4f9fc; color: #31526a; font-size: 12px; line-height: 1.5; }
.notice.warning { border-left-color: var(--amber); background: #fffaf1; color: #7e5714; }
.notice.danger { border-left-color: var(--red); background: #fff8f7; color: #893b36; }
.notice strong { color: inherit; }
.source-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; margin-top: 12px; border-top: 1px solid #edf1f3; color: var(--ink-soft); font-size: 11px; }
.source-line button { border: 0; padding: 0; background: none; color: var(--blue); font-weight: 650; font-size: 11px; }
.source-line button:hover { text-decoration: underline; }

.image-evidence { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: center; }
.image-evidence img { width: 104px; height: 76px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.evidence-title { font-size: 12px; font-weight: 700; }
.evidence-text { font-size: 11px; color: var(--ink-soft); line-height: 1.45; margin-top: 4px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(7, 22, 34, .47); padding: 20px; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 12px; padding: 22px; background: #fff; box-shadow: 0 22px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.modal-title { margin: 0; font-size: 19px; letter-spacing: -.03em; }
.modal-close { width: 30px; height: 30px; background: #f2f5f6; border: 0; border-radius: 7px; color: var(--ink); font-size: 18px; }
.modal-body { padding-top: 17px; }
.key-values { display: grid; grid-template-columns: 175px 1fr; gap: 0; border: 1px solid #e7edef; border-radius: 8px; overflow: hidden; }
.key-values div { padding: 10px 12px; border-bottom: 1px solid #e7edef; font-size: 12px; line-height: 1.4; }
.key-values div:nth-last-child(-n+2) { border-bottom: 0; }
.key { color: var(--ink-soft); background: #f7f9fa; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: grid; gap: 5px; }
.form-field.wide { grid-column: 1 / -1; }
.form-field label { color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.form-field input, .form-field select { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); }
.required { color: var(--red); }

.toast { position: fixed; z-index: 90; right: 22px; bottom: 22px; max-width: 390px; padding: 12px 14px; border-radius: 9px; background: var(--ink); box-shadow: var(--shadow); color: #fff; font-size: 12px; line-height: 1.45; animation: slide .2s ease-out; }
.toast.good { background: var(--green); }
.toast.warn { background: var(--amber); }
.toast.danger { background: var(--red); }
@keyframes slide { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .content { padding: 24px; }
  .topbar { padding: 0 24px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: 14px 10px; overflow: visible; }
  .brand { display: flex; align-items: center; gap: 15px; margin: 0; padding: 0 8px 12px; }
  .brand small { margin-top: 0; }
  .nav-group { display: flex; overflow: auto; gap: 5px; margin: 0; padding-bottom: 2px; }
  .nav-label, .side-footer { display: none; }
  .nav-button { flex: 0 0 auto; width: auto; padding: 8px; background: rgba(255,255,255,.05); }
  .nav-text { display: none; }
  .topbar { position: static; height: auto; padding: 13px 16px; flex-wrap: wrap; }
  .crumb { flex-basis: calc(100% - 48px); }
  .role-select { flex: 1; min-width: 0; }
  .reset-button { display: none; }
  .content { padding: 18px 14px 30px; }
  .page-header { display: block; }
  .asof { display: inline-block; margin-top: 10px; }
  .page-title { font-size: 23px; }
  .metrics, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-value { font-size: 17px; }
  .split-amount { grid-template-columns: 1fr; }
  .split-amount > div { border-right: 0; border-bottom: 1px solid #e5edf0; }
  .split-amount > div:last-child { border-bottom: 0; }
  .form-grid, .key-values { grid-template-columns: 1fr; }
  .key-values div:nth-last-child(2) { border-bottom: 1px solid #e7edef; }
}
