:root {
  color-scheme: light;
  --ink: #10284a;
  --ink-soft: #61716f;
  --primary: #001c62;
  --primary-dark: #001344;
  --primary-pale: #e8edf7;
  --aqua: #01b542;
  --brand-green: #01b542;
  --brand-green-dark: #087b35;
  --brand-green-pale: #e6f7ec;
  --brand-sage: #b5ccbd;
  --gold: #e8a637;
  --gold-pale: #fff2d8;
  --danger: #bd4a42;
  --danger-pale: #fbe8e6;
  --good: #087b35;
  --good-pale: #e6f7ec;
  --surface: #ffffff;
  --canvas: #f4f7f4;
  --line: #d9e2dc;
  --line-strong: #c4d2ca;
  --shadow: 0 16px 40px rgba(0, 28, 98, 0.09);
  --radius: 18px;
  --sidebar: 260px;
  font-family: Aptos, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { width: 1.2em; height: 1.2em; display: block; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: var(--sidebar); padding: 25px 18px 20px;
  display: flex; flex-direction: column; color: var(--primary);
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.62), transparent 34%),
    linear-gradient(165deg, #c4d7cb 0%, var(--brand-sage) 70%, #a8c2b3 100%);
  border-right: 1px solid rgba(0,28,98,.12);
  box-shadow: 8px 0 28px rgba(0,28,98,.055);
}
.brand { display: grid; gap: 6px; padding: 0 9px; color: var(--primary); text-decoration: none; }
.brand-logo { width: 100%; max-width: 178px; height: auto; display: block; }
.brand-product { display: flex; align-items: center; gap: 8px; color: rgba(0,28,98,.72); font-size: 9px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.brand-product::before { content: ""; width: 24px; height: 3px; flex: 0 0 auto; background: var(--brand-green); border-radius: 99px; }
.nav-list { display: grid; gap: 2px; margin-top: 16px; overflow-y: auto; padding-right: 2px; }
.nav-item { width: 100%; min-height: 40px; padding: 0 13px; display: flex; align-items: center; gap: 12px; color: rgba(0,28,98,.72); background: transparent; border: 0; border-radius: 12px; cursor: pointer; text-align: left; transition: .2s ease; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: var(--primary); background: rgba(255,255,255,.38); }
.nav-item.is-active { color: white; background: var(--primary); box-shadow: inset 4px 0 var(--brand-green), 0 8px 18px rgba(0,28,98,.13); }
.nav-group { display: grid; gap: 3px; }
.nav-group-main .nav-group-arrow { width: 14px; height: 14px; margin-left: auto; transform: rotate(90deg); }
.nav-group-main > span:nth-child(2) { white-space: nowrap; font-size: 13px; }
.nav-group-main.has-active-child { color: var(--primary); background: rgba(255,255,255,.42); font-weight: 750; }
.nav-submenu { margin: 0 0 4px 26px; padding-left: 12px; display: grid; gap: 2px; border-left: 1px solid rgba(0,28,98,.18); }
.nav-subitem { min-height: 29px; padding: 4px 10px; color: rgba(0,28,98,.7); background: transparent; border: 0; border-radius: 8px; cursor: pointer; text-align: left; font-size: 10px; }
.nav-subitem:hover { color: var(--primary); background: rgba(255,255,255,.38); }
.nav-subitem.is-active { color: white; background: var(--primary); font-weight: 750; }
.sidebar-footer { margin-top: auto; }
.sync-indicator { display: flex; align-items: center; gap: 8px; margin: 18px 12px 0; color: rgba(0,28,98,.58); font-size: 11px; }
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; background: var(--brand-green); border-radius: 999px; box-shadow: 0 0 0 4px rgba(1,181,66,.13); }
.status-dot.is-offline { background: var(--gold); }

.content-shell { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { min-height: 98px; padding: 24px clamp(24px, 4vw, 54px) 18px; display: flex; align-items: center; justify-content: space-between; background: rgba(247,250,247,.91); border-bottom: 1px solid rgba(181,204,189,.7); backdrop-filter: blur(12px); }
.topbar-title { display: flex; align-items: center; gap: 10px; }
.topbar-symbol { display: none; }
.topbar h1 { margin: 2px 0 0; font-size: clamp(24px, 3vw, 32px); line-height: 1.1; letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--brand-green-dark); font-size: 11px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.farm-control { height: 42px; padding: 6px 10px; display: grid; align-content: center; background: white; border: 1px solid var(--line); border-radius: 11px; }
.farm-control span { color: var(--ink-soft); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.farm-control select { max-width: 120px; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 12px; font-weight: 750; }
.avatar-button { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--primary); border: 3px solid white; border-radius: 50%; box-shadow: 0 5px 15px rgba(0,28,98,.16); font-size: 12px; font-weight: 800; cursor: default; }
main { padding: 30px clamp(24px, 4vw, 54px) 60px; outline: none; }

.page-head { margin-bottom: 24px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.page-head h2 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.page-head p { max-width: 680px; margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.button { min-height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: 13px; font-weight: 750; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--primary); box-shadow: 0 8px 18px rgba(0,28,98,.18); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { color: var(--brand-green-dark); background: var(--brand-green-pale); }
.button-ghost { color: var(--ink); background: white; border-color: var(--line); }
.button-danger { color: var(--danger); background: var(--danger-pale); }
.button svg { width: 16px; height: 16px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.kpi-card { min-height: 136px; padding: 20px; position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 20px rgba(29,64,60,.035); }
.kpi-card::after { content: ""; position: absolute; width: 72px; height: 72px; right: -25px; bottom: -28px; background: var(--primary-pale); border-radius: 50%; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kpi-label { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.kpi-icon { width: 34px; height: 34px; display: grid; place-items: center; color: var(--primary); background: var(--primary-pale); border-radius: 10px; }
.kpi-value { margin-top: 13px; font-size: 30px; font-weight: 850; letter-spacing: -.045em; }
.kpi-note { margin-top: 2px; color: var(--ink-soft); font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
.kpi-card.is-alert .kpi-icon { color: #a76d12; background: var(--gold-pale); }
.kpi-card.is-danger .kpi-icon { color: var(--danger); background: var(--danger-pale); }

.alert-strip { margin-top: 18px; padding: 16px 18px; display: flex; align-items: center; gap: 13px; background: linear-gradient(90deg, #fff5e3, #fff9ef); border: 1px solid #efdaad; border-radius: 14px; }
.alert-strip.is-danger { background: linear-gradient(90deg, #fcedeb, #fff7f5); border-color: #edcac6; }
.alert-strip-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; color: #9f6811; background: rgba(232,166,55,.17); border-radius: 11px; }
.alert-strip.is-danger .alert-strip-icon { color: var(--danger); background: var(--danger-pale); }
.alert-strip strong { display: block; font-size: 13px; }
.alert-strip p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; }
.alert-strip .button { margin-left: auto; flex: 0 0 auto; }

.dashboard-grid { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 20px; }
.stack { display: grid; gap: 20px; align-content: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 20px rgba(29,64,60,.035); }
.panel-header { min-height: 62px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.panel-header h3 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.panel-header p { margin: 3px 0 0; color: var(--ink-soft); font-size: 11px; }
.text-button { padding: 6px; color: var(--primary); background: transparent; border: 0; cursor: pointer; font-size: 12px; font-weight: 750; }
.panel-body { padding: 18px 20px; }

.well-list { display: grid; gap: 11px; }
.well-row { padding: 14px 0; display: grid; grid-template-columns: auto minmax(160px, 1.5fr) minmax(110px, .9fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.well-row:first-child { padding-top: 0; }
.well-row:last-child { padding-bottom: 0; border-bottom: 0; }
.well-code { width: 43px; height: 43px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--primary) 10%, #083783 76%, var(--brand-green) 145%); border-radius: 13px; font-size: 12px; font-weight: 850; }
.well-main strong, .well-row-cell strong { display: block; font-size: 13px; }
.well-main small, .well-row-cell small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.chevron { color: #8aa19e; }

.status-pill { width: fit-content; padding: 5px 9px; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-pill::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.status-good { color: var(--good); background: var(--good-pale); }
.status-warning { color: #9a6718; background: var(--gold-pale); }
.status-danger { color: var(--danger); background: var(--danger-pale); }
.status-neutral { color: #607572; background: #edf2f1; }

.schedule-list { display: grid; gap: 1px; }
.schedule-item { padding: 13px 0; display: grid; grid-template-columns: 46px 1fr; gap: 12px; border-bottom: 1px solid var(--line); }
.schedule-item:last-child { border-bottom: 0; padding-bottom: 0; }
.date-tile { height: 46px; display: grid; place-items: center; align-content: center; color: var(--primary); background: var(--primary-pale); border-radius: 11px; }
.date-tile strong { font-size: 16px; line-height: 1; }
.date-tile small { margin-top: 2px; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.schedule-copy strong { display: block; font-size: 12px; line-height: 1.35; }
.schedule-copy p { margin: 3px 0; color: var(--ink-soft); font-size: 10px; }
.schedule-copy .overdue { color: var(--danger); font-weight: 750; }

.mini-chart { height: 175px; padding: 18px 8px 0; display: flex; align-items: end; justify-content: space-around; gap: 16px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 43px, #edf2f1 44px); }
.bar-group { min-width: 54px; height: 100%; display: flex; align-items: end; justify-content: center; gap: 5px; position: relative; }
.bar { width: 15px; min-height: 3px; border-radius: 6px 6px 0 0; background: var(--primary); }
.bar.secondary { background: var(--aqua); }
.bar-group label { position: absolute; bottom: -24px; color: var(--ink-soft); font-size: 9px; font-weight: 700; }
.chart-legend { margin: 32px 0 0; display: flex; justify-content: center; gap: 16px; color: var(--ink-soft); font-size: 10px; }
.legend-swatch { width: 8px; height: 8px; display: inline-block; margin-right: 5px; background: var(--primary); border-radius: 2px; }
.legend-swatch.secondary { background: var(--aqua); }

.toolbar { margin-bottom: 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.search-box { width: min(100%, 360px); height: 42px; padding: 0 13px; display: flex; align-items: center; gap: 9px; background: white; border: 1px solid var(--line); border-radius: 11px; }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,28,98,.08); }
.search-box input { width: 100%; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--ink); font-size: 13px; }
.search-box svg { color: var(--ink-soft); }
.filter-select { min-height: 42px; padding: 0 34px 0 12px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 11px; font-size: 12px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.well-card { padding: 19px; background: white; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.well-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.well-card-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.well-card .well-code { width: 48px; height: 48px; }
.well-card h3 { margin: 15px 0 2px; font-size: 17px; }
.well-card > p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.well-card-metrics { margin-top: 18px; padding-top: 15px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); }
.metric small { display: block; color: var(--ink-soft); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
.metric strong { display: block; margin-top: 4px; font-size: 12px; }
.well-card-footer { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); font-size: 10px; }

.data-table-wrap { overflow: auto; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th { padding: 13px 16px; color: var(--ink-soft); background: #f8faf9; border-bottom: 1px solid var(--line); font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .055em; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { cursor: pointer; transition: background .15s ease; }
.data-table tbody tr:hover { background: #f8fbfa; }
.table-primary { display: block; font-weight: 750; }
.table-secondary { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.money { font-variant-numeric: tabular-nums; text-align: right; }

.empty-state { padding: 50px 22px; display: grid; place-items: center; text-align: center; }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; color: var(--primary); background: var(--primary-pale); border-radius: 17px; }
.empty-state h3 { margin: 14px 0 4px; font-size: 16px; }
.empty-state p { max-width: 390px; margin: 0 0 16px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }

.timeline { position: relative; display: grid; gap: 2px; }
.timeline::before { content: ""; position: absolute; top: 24px; bottom: 24px; left: 75px; width: 1px; background: var(--line-strong); }
.timeline-item { padding: 14px 0; display: grid; grid-template-columns: 56px 20px 1fr; gap: 10px; align-items: start; position: relative; }
.timeline-date { text-align: right; }
.timeline-date strong { display: block; font-size: 18px; line-height: 1; }
.timeline-date small { color: var(--ink-soft); font-size: 9px; text-transform: uppercase; }
.timeline-dot { width: 12px; height: 12px; margin: 2px auto 0; z-index: 1; background: var(--primary); border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 2px var(--primary); }
.timeline-dot.warning { background: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.timeline-dot.danger { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.timeline-card { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: white; border: 1px solid var(--line); border-radius: 13px; }
.timeline-card strong { display: block; font-size: 13px; }
.timeline-card p { margin: 4px 0 0; color: var(--ink-soft); font-size: 11px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-card { padding: 22px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.settings-icon { width: 42px; height: 42px; display: grid; place-items: center; color: var(--primary); background: var(--primary-pale); border-radius: 12px; }
.settings-card h3 { margin: 16px 0 5px; font-size: 16px; }
.settings-card p { min-height: 40px; margin: 0 0 17px; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.settings-card .button { margin-right: 6px; margin-bottom: 6px; }

.prototype-note { margin-bottom: 18px; padding: 14px 16px; display: flex; align-items: start; gap: 11px; color: #72521e; background: var(--gold-pale); border: 1px solid #efd9a8; border-radius: 13px; font-size: 11px; line-height: 1.55; }
.prototype-note svg { flex: 0 0 auto; margin-top: 1px; }
.prototype-note .button { margin-left: auto; flex: 0 0 auto; }
.status-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.status-well { padding: 19px; background: white; border: 1px solid var(--line); border-left: 5px solid var(--good); border-radius: var(--radius); }
.status-well.well-warning { border-left-color: var(--gold); }
.status-well.well-danger { border-left-color: var(--danger); }
.status-well.well-neutral { border-left-color: #8aa19e; }
.status-well-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.status-well-head h3 { margin: 0; font-size: 17px; }
.status-well-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 11px; }
.status-meta { margin-top: 15px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.status-meta div { padding: 10px; background: #f7faf9; border-radius: 10px; }
.status-meta small { display: block; color: var(--ink-soft); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }
.status-meta strong { display: block; margin-top: 3px; font-size: 11px; }
.due-list { margin-top: 14px; display: grid; gap: 8px; }
.due-item { padding: 10px 12px; display: grid; grid-template-columns: minmax(130px, 1fr) auto auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 11px; }
.due-item strong { font-size: 11px; }
.due-item small { color: var(--ink-soft); }
.status-well-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

.asset-card { padding: 19px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.asset-card-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.asset-card h3 { margin: 0; font-size: 16px; }
.asset-card p { margin: 4px 0 0; color: var(--ink-soft); font-size: 11px; }
.asset-specs { margin-top: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.asset-specs div { padding: 9px; background: #f7faf9; border-radius: 9px; }
.asset-specs small { display: block; color: var(--ink-soft); font-size: 8px; text-transform: uppercase; }
.asset-specs strong { display: block; margin-top: 3px; font-size: 11px; }
.asset-actions { margin-top: 15px; padding-top: 13px; display: flex; gap: 7px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.reservoir-level { margin-top: 12px; padding: 11px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; background: var(--primary-pale); border-radius: 10px; }
.reservoir-level span { display: block; color: var(--ink-soft); font-size: 8px; text-transform: uppercase; }
.reservoir-level strong { display: block; margin-top: 3px; font-size: 11px; }

.activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.activity-card { padding: 20px; display: grid; grid-template-columns: auto 1fr; gap: 14px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.activity-card h3 { margin: 0; font-size: 16px; }
.activity-card p { min-height: 36px; margin: 5px 0 8px; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.activity-card > div > strong { color: var(--brand-green-dark); font-size: 11px; }
.activity-card-actions { grid-column: 1 / -1; padding-top: 13px; display: flex; gap: 8px; border-top: 1px solid var(--line); }
.interval-badge { padding: 6px 9px; display: inline-flex; color: var(--primary); background: var(--primary-pale); border-radius: 8px; font-weight: 800; }

.plan-card { padding: 20px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.plan-card-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.plan-card h3 { margin: 0; font-size: 17px; }
.plan-card p { margin: 5px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.plan-stats { margin-top: 16px; display: flex; gap: 18px; color: var(--ink-soft); font-size: 10px; }
.plan-stats strong { color: var(--ink); }
.plan-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.reference-badge { margin-top: 12px; padding: 5px 9px; display: inline-flex; color: var(--brand-green-dark); background: var(--brand-green-pale); border-radius: 999px; font-size: 9px; font-weight: 800; }
.print-tools { margin-bottom: 16px; padding: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: linear-gradient(135deg, var(--primary-pale), white); border: 1px solid #cbd5e8; border-radius: 14px; }
.print-tools > div { min-width: 240px; margin-right: auto; }
.print-tools strong { display: block; font-size: 13px; }
.print-tools span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.print-tools .button span { margin: 0; color: inherit; }
.item-table { width: 100%; border-collapse: collapse; }
.item-table th, .item-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; vertical-align: top; }
.item-table th { color: var(--ink-soft); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }
.item-table tr:last-child td { border-bottom: 0; }
.version-badge { padding: 4px 8px; color: var(--primary); background: var(--primary-pale); border-radius: 999px; font-size: 9px; font-weight: 800; }

.reading-value { font-size: 18px; font-weight: 850; letter-spacing: -.02em; }
.reading-value small { font-size: 10px; font-weight: 700; }
.history-line { position: relative; display: grid; gap: 10px; }
.history-entry { padding: 12px 14px; background: #f7faf9; border-left: 3px solid var(--primary); border-radius: 0 10px 10px 0; }
.history-entry strong { display: block; font-size: 11px; }
.history-entry p { margin: 4px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.5; }
.audit-entry { padding: 14px 0; display: grid; grid-template-columns: 140px 120px 1fr auto; gap: 12px; border-bottom: 1px solid var(--line); font-size: 11px; }
.audit-entry:last-child { border-bottom: 0; }
.audit-entry small { display: block; margin-top: 3px; color: var(--ink-soft); }
.audit-diff { max-width: 100%; padding: 10px; overflow: auto; color: #42605d; background: #f3f7f6; border-radius: 8px; font: 9px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.role-card { padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #f7faf9; border: 1px solid var(--line); border-radius: 11px; }
.role-card strong { display: block; font-size: 12px; }
.role-card small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.role-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.permission-option { min-height: 48px; padding: 10px 11px; display: flex; align-items: flex-start; gap: 9px; color: var(--ink); background: #f7faf9; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.permission-option input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--primary); }
.permission-option input:disabled { cursor: not-allowed; }
.permission-option span { min-width: 0; }
.permission-option strong { font-size: 11px; line-height: 1.35; }
.permission-option small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 9px; }
.permission-note { min-height: 0 !important; margin: 0 0 10px !important; padding: 9px 11px; color: var(--ink-soft); background: var(--primary-pale); border-radius: 9px; font-size: 10px !important; }
.solar-grid-explanation { padding-top: 25px; line-height: 1.45; }
.grid-only[hidden] { display: none !important; }
.readonly-banner { margin-bottom: 15px; padding: 12px 15px; color: #6f4c16; background: var(--gold-pale); border: 1px solid #efd9a8; border-radius: 11px; font-size: 11px; font-weight: 700; }
.checkbox-row { padding: 10px 11px; display: grid; grid-template-columns: auto minmax(120px, 1fr) minmax(130px, .7fr); gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; }
.checkbox-row label { font-size: 11px; font-weight: 700; }
.checkbox-row select { min-height: 36px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 10px; }
.photo-preview { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-preview img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }

.app-dialog { width: min(720px, calc(100% - 24px)); max-height: min(88vh, 900px); padding: 0; background: transparent; border: 0; overflow: visible; }
.app-dialog::backdrop { background: rgba(8,42,40,.48); backdrop-filter: blur(4px); }
.dialog-card { max-height: 88vh; overflow: auto; background: white; border-radius: 22px; box-shadow: 0 24px 80px rgba(8,42,40,.25); }
.dialog-header { padding: 21px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 2; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.dialog-header h2 { margin: 3px 0 0; font-size: 22px; letter-spacing: -.025em; }
.dialog-content { padding: 23px 24px 24px; }
.form-section { margin: 0 0 23px; padding: 0; border: 0; }
.form-section:last-of-type { margin-bottom: 8px; }
.form-section legend { width: 100%; margin-bottom: 14px; padding-bottom: 8px; color: var(--primary); border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-field { display: grid; gap: 6px; }
.form-field.span-2 { grid-column: 1 / -1; }
.form-field label { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--ink); background: #fbfcfc; border: 1px solid var(--line-strong); border-radius: 10px; outline: 0; font-size: 13px; }
.form-field textarea { min-height: 94px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,28,98,.08); }
.form-help { margin: 0; color: var(--ink-soft); font-size: 10px; }
.test-measurement { grid-column: 1 / -1; padding: 15px; background: #f7faf8; border: 1px solid var(--line); border-radius: 13px; }
.test-measurement h3 { margin: 0 0 12px; color: var(--primary); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.test-measurement-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.calculated-box { padding: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; background: var(--primary-pale); border-radius: 12px; }
.calculated-box.reservoir-calculation { grid-template-columns: repeat(3, 1fr); }
.calculated-box small { display: block; color: var(--ink-soft); font-size: 9px; text-transform: uppercase; }
.calculated-box strong { display: block; margin-top: 3px; font-size: 13px; }

.detail-hero { padding: 22px 24px; display: flex; align-items: center; gap: 15px; background: linear-gradient(135deg, var(--brand-green-pale), #f8faf9); }
.detail-hero .well-code { width: 58px; height: 58px; font-size: 14px; border-radius: 17px; }
.detail-hero h3 { margin: 0 0 3px; font-size: 20px; }
.detail-hero p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.detail-sections { padding: 4px 24px 24px; }
.detail-section { padding: 19px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section h4 { margin: 0 0 12px; color: var(--primary); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; }
.detail-item small { display: block; color: var(--ink-soft); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.detail-item strong { display: block; margin-top: 4px; font-size: 12px; line-height: 1.35; }
.detail-actions { padding-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 8px; }
.toast { min-width: 250px; max-width: 360px; padding: 13px 15px; display: flex; align-items: center; gap: 10px; color: white; background: var(--primary); border-radius: 12px; box-shadow: 0 14px 36px rgba(0,28,98,.24); font-size: 12px; animation: toast-in .22s ease; }
.toast.is-error { background: #943d38; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.auth-gate {
  position: fixed; inset: 0; z-index: 1000; padding: 24px;
  display: grid; place-items: center; overflow-y: auto;
  background:
    radial-gradient(circle at 15% 8%, rgba(255,255,255,.72), transparent 34%),
    linear-gradient(145deg, #c8dbcf 0%, var(--brand-sage) 55%, #9ebcac 100%);
}
.auth-gate[hidden] { display: none; }
.auth-card { width: min(100%, 430px); padding: 34px; background: rgba(255,255,255,.96); border: 1px solid rgba(0,28,98,.1); border-radius: 24px; box-shadow: 0 28px 80px rgba(0,28,98,.18); }
.auth-logo { width: 210px; max-width: 72%; height: auto; display: block; }
.auth-product { margin-top: 10px; display: flex; align-items: center; gap: 9px; color: rgba(0,28,98,.7); font-size: 10px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.auth-product span { width: 25px; height: 3px; background: var(--brand-green); border-radius: 99px; }
.auth-copy { margin-top: 32px; }
.auth-copy h1 { margin: 5px 0 8px; color: var(--primary); font-size: 28px; letter-spacing: -.035em; }
.auth-copy > p:last-child { min-height: 20px; margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.auth-copy > p.is-error { color: var(--danger); font-weight: 700; }
.auth-form { margin-top: 22px; display: grid; gap: 15px; }
.auth-form label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 750; }
.auth-form input { width: 100%; height: 46px; padding: 0 13px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 11px; outline: 0; }
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,28,98,.09); }
.auth-form .button { width: 100%; margin-top: 3px; }
.auth-form :disabled { cursor: wait; opacity: .72; }
.auth-gate[data-state="loading"] .auth-form { display: none; }
.auth-help { margin-top: 18px; display: block; color: var(--ink-soft); font-size: 10px; line-height: 1.5; text-align: center; }
.auth-logout-button { min-height: 38px; padding-inline: 12px; }

.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .status-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  :root { --radius: 16px; }
  .sidebar { display: none; }
  .content-shell { margin-left: 0; }
  .topbar { min-height: 78px; padding: calc(14px + env(safe-area-inset-top)) 17px 13px; position: sticky; top: 0; z-index: 15; }
  .topbar-symbol { width: 43px; height: 35px; padding: 5px; display: block; object-fit: contain; background: var(--brand-sage); border: 1px solid rgba(0,28,98,.1); border-radius: 10px; }
  .topbar h1 { font-size: 23px; }
  .topbar .eyebrow { font-size: 9px; }
  .avatar-button { width: 38px; height: 38px; }
  .auth-logout-button { display: none; }
  .auth-gate { padding: 14px; }
  .auth-card { padding: 28px 23px; border-radius: 20px; }
  .auth-copy { margin-top: 26px; }
  .auth-copy h1 { font-size: 25px; }
  .farm-control { display: none; }
  .install-button span:last-child { display: none; }
  main { padding: 21px 15px calc(92px + env(safe-area-inset-bottom)); }
  .page-head { align-items: start; }
  .page-head h2 { font-size: 20px; }
  .page-head p { font-size: 12px; }
  .page-head .button-primary { width: 42px; padding: 0; }
  .page-head .button-primary span:last-child { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { min-height: 136px; padding: 15px; }
  .kpi-value { font-size: 25px; }
  .alert-strip { align-items: start; padding: 14px; }
  .alert-strip .button { display: none; }
  .dashboard-grid { gap: 14px; }
  .panel-header, .panel-body { padding-left: 15px; padding-right: 15px; }
  .well-row { grid-template-columns: auto 1fr auto; gap: 10px; }
  .well-row-cell.optional { display: none; }
  .card-grid, .settings-grid, .activity-grid { grid-template-columns: 1fr; }
  .status-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .due-item { grid-template-columns: 1fr auto; }
  .due-item small { grid-column: 1 / -1; }
  .asset-specs { grid-template-columns: repeat(2, 1fr); }
  .audit-entry { grid-template-columns: 1fr; gap: 5px; }
  .checkbox-row { grid-template-columns: auto 1fr; }
  .checkbox-row select { grid-column: 2; }
  .well-card-metrics { gap: 4px; }
  .toolbar { align-items: stretch; }
  .print-tools { align-items: stretch; }
  .print-tools > div { width: 100%; }
  .print-tools .button { flex: 1 1 150px; }
  .search-box { width: 100%; }
  .filter-select { max-width: 145px; }
  .mobile-nav { min-height: calc(66px + env(safe-area-inset-bottom)); padding: 7px 8px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; inset: auto 0 0; z-index: 30; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(29,64,60,.08); backdrop-filter: blur(14px); }
  .mobile-nav-item { min-width: 0; display: grid; place-items: center; align-content: center; gap: 3px; color: #788b86; background: transparent; border: 0; font-size: 18px; }
  .mobile-nav-item small { font-size: 8px; font-weight: 700; }
  .mobile-nav-item.is-active { color: var(--primary); }
  .mobile-nav-action span { width: 42px; height: 42px; margin-top: -25px; display: grid; place-items: center; color: white; background: var(--primary); border: 4px solid white; border-radius: 50%; box-shadow: 0 7px 18px rgba(0,28,98,.24), 0 0 0 2px var(--brand-green); }
  .mobile-nav-action small { margin-top: -1px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.span-2 { grid-column: auto; }
  .permission-grid { grid-template-columns: 1fr; }
  .solar-grid-explanation { padding-top: 0; }
  .test-measurement { grid-column: auto; }
  .test-measurement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .test-time-field { grid-column: 1 / -1; }
  .dialog-header, .dialog-content { padding-left: 18px; padding-right: 18px; }
  .prototype-note { flex-wrap: wrap; }
  .prototype-note .button { width: 100%; margin-left: 0; }
  .app-dialog { width: calc(100% - 14px); max-height: 94vh; }
  .dialog-card { max-height: 94vh; border-radius: 19px; }
  .calculated-box { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .timeline::before { left: 63px; }
  .timeline-item { grid-template-columns: 45px 16px 1fr; gap: 8px; }
  .timeline-card { align-items: start; flex-direction: column; }
  .toast-region { right: 12px; bottom: 82px; left: 12px; }
  .toast { min-width: 0; max-width: none; }
}

@media (max-width: 410px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-label { font-size: 10px; }
  .kpi-note { font-size: 9px; }
  .panel-header h3 { font-size: 14px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
