:root {
  --brand-blue: #3157a4;
  --brand-blue-dark: #213e7c;
  --brand-blue-soft: #eaf0fb;
  --ink: #14213a;
  --muted: #667085;
  --line: #d8e0ec;
  --surface: #ffffff;
  --background: #f3f6fa;
  --danger: #b42318;
  --success: #067647;
  --page-max-width: 72rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
html { min-height: 100%; scrollbar-gutter: stable; }
body { min-height: 100vh; margin: 0; background: var(--background); }
a { color: var(--brand-blue-dark); }
.auth-page { display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(135deg, rgba(49,87,164,.96), rgba(25,48,98,.98)), var(--brand-blue); }
.auth-shell { width: min(100%, 28rem); }
.login-card, .content-card, .user-card { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 1rem 2.5rem rgba(13,32,67,.12); }
.login-card { padding: clamp(1.5rem, 5vw, 2.75rem); text-align: center; }
.login-logo { display: block; width: min(100%, 19rem); height: auto; margin: 0 auto 2rem; }
.login-card h1 { margin: 0; font-size: clamp(1.75rem, 6vw, 2.25rem); letter-spacing: -.035em; }
.subtitle { margin: .5rem 0 2rem; color: var(--muted); }
.stacked-form { display: grid; gap: 1.1rem; text-align: left; }
.field { display: grid; gap: .45rem; }
.field[hidden] { display: none; }
label { font-size: .9rem; font-weight: 700; }
input, select { width: 100%; min-height: 2.8rem; border: 1px solid #aebbd0; border-radius: .55rem; padding: .65rem .75rem; color: var(--ink); background: #fff; font: inherit; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(49,87,164,.28); outline-offset: 2px; }
.field span, .validation-summary { color: var(--danger); font-size: .9rem; }
.validation-summary:empty { display: none; }
.validation-summary ul { margin: .5rem 0; padding-left: 1.25rem; }
small, .muted { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.65rem; border: 1px solid transparent; border-radius: .55rem; padding: .65rem 1rem; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.button-primary { background: var(--brand-blue); color: #fff; }
.button-primary:hover { background: var(--brand-blue-dark); }
.button:disabled { cursor: wait; opacity: .72; }
.button-secondary { border-color: #aebbd0; background: #fff; color: var(--ink); }
.button-secondary:hover { background: var(--brand-blue-soft); }
.button-wide { width: 100%; margin-top: .25rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.app-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2rem; min-height: 5rem; padding: .75rem clamp(1rem, 4vw, 3rem); background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .75rem; color: var(--ink); font-weight: 800; text-decoration: none; }
.brand img { width: 10rem; height: auto; }
.brand span { padding-left: .75rem; border-left: 1px solid var(--line); }
.app-header nav { display: flex; flex-wrap: wrap; gap: .4rem; }
.app-header nav a { padding: .55rem .75rem; border-radius: .45rem; text-decoration: none; font-weight: 700; }
.app-header nav a:hover { background: var(--brand-blue-soft); }
.session { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; color: var(--muted); font-size: .9rem; }
.session form { margin: 0; }
.app-main { width: min(100% - 2rem, var(--page-max-width)); margin: 0 auto; padding: clamp(2rem, 5vw, 4rem) 0; }
.page-heading { margin-bottom: 1.5rem; }
.page-heading h1 { margin: .2rem 0; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.04em; }
.page-heading p { margin: .25rem 0; color: var(--muted); }
.eyebrow { color: var(--brand-blue) !important; font-size: .78rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.heading-with-action { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.content-card { padding: clamp(1.25rem, 4vw, 2rem); box-shadow: 0 .5rem 1.5rem rgba(13,32,67,.06); }
.content-card h2 { margin-top: 0; }
.narrow-card, .form-card { max-width: 42rem; }
.notice { margin-bottom: 1rem; border-radius: .55rem; padding: .85rem 1rem; }
.notice.success { border: 1px solid #75caa7; color: var(--success); background: #ecfdf3; }
.notice.error { border: 1px solid #f3a6a0; color: var(--danger); background: #fff1f0; }
.submission-status { margin: 0; color: var(--muted); font-weight: 700; text-align: center; }
.dashboard-loading { display: flex; align-items: center; justify-content: center; min-height: 11rem; margin: 0; padding: 1.25rem; color: var(--muted); background: #f7f9fc; border: 1px dashed #c8d0dc; border-radius: .6rem; text-align: center; }
.dashboard-loading::before { width: 1rem; height: 1rem; margin-right: .65rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: dashboard-loading-spin .8s linear infinite; content: ""; }
.report-loading { min-height: 7rem; margin-block: 1rem; }
.report-loading[hidden] { display: none; }
.report-loading strong { color: var(--ink, currentColor); }
.dashboard-loading-error { color: var(--danger); }
.dashboard-loading-error::before { animation: none; border-right-color: currentColor; }
@keyframes dashboard-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dashboard-loading::before { animation: none; } }
.user-list { display: grid; gap: 1rem; }
.user-card { display: grid; grid-template-columns: minmax(12rem,1fr) 2fr; gap: 1rem; padding: 1.15rem; box-shadow: 0 .4rem 1.25rem rgba(13,32,67,.05); }
.user-identity { display: flex; align-items: flex-start; flex-direction: column; gap: .5rem; min-width: 0; }
.user-identity strong { overflow-wrap: anywhere; }
.status { border-radius: 999px; padding: .25rem .55rem; font-size: .75rem; font-weight: 800; }
.status.enabled { color: var(--success); background: #ecfdf3; }
.status.disabled { color: var(--danger); background: #fff1f0; }
.status.current { color: var(--success); background: #ecfdf3; }
.status.stale { color: #925f00; background: #fff7db; }
.status.unavailable, .status.nodata, .status.nolog, .status.noproduction, .status.neutral { color: #475467; background: #eef2f6; }
.status.sourcefailure { color: var(--danger); background: #fff1f0; }
.status.pending { color: #925f00; background: #fff7db; }
.status.accepted { color: var(--success); background: #ecfdf3; }
.status.expired, .status.revoked { color: #475467; background: #eef2f6; }
.plant-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: .75rem; }
.plant-card { display: grid; grid-template-rows: auto auto auto auto; align-content: start; gap: .4rem; min-width: 0; padding: .7rem .9rem; color: var(--ink); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: .85rem; box-shadow: 0 .4rem 1.25rem rgba(13,32,67,.05); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.plant-card:hover { border-color: #9db0d2; box-shadow: 0 .65rem 1.5rem rgba(13,32,67,.1); transform: translateY(-1px); }
.plant-card:focus-visible { outline: 3px solid rgba(49,87,164,.35); outline-offset: 3px; }
.plant-card header, .card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.plant-card h2, .card-heading h2 { margin: 0; }
.plant-card .eyebrow { margin: 0 0 .2rem; }
.plant-card-section { min-width: 0; }
.plant-card-section h3 { margin: 0 0 .2rem; color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem .55rem; margin: 0; }
.dashboard-metrics div, .dashboard-silos div { min-width: 0; }
.dashboard-metrics dt, .dashboard-silos dt { color: var(--muted); font-size: .68rem; font-weight: 700; }
.dashboard-metrics dd, .dashboard-silos dd { overflow-wrap: anywhere; margin: .08rem 0 0; font-size: .9rem; font-weight: 800; line-height: 1.25; }
.dashboard-silos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.dashboard-silos div { position: relative; padding: .3rem .5rem; background: #f7f9fc; border-radius: .5rem; }
.silo-reading-state { display: block; margin-top: .08rem; font-size: .62rem; font-weight: 700; }
.silo-reading-state.current { color: var(--success); }
.silo-reading-time { display: block; color: var(--muted); font-size: .62rem; }
.silo-reading-state.stale { color: #925f00; }
.silo-reading-state.unavailable, .silo-reading-state.nolog, .silo-reading-state.noproduction { color: var(--muted); }
.silo-reading-state.sourcefailure { color: var(--danger); }
.plant-card footer { display: flex; align-items: end; justify-content: space-between; gap: .75rem; min-width: 0; padding-top: .3rem; border-top: 1px solid var(--line); }
.plant-card footer small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .65rem; }
.card-cue { flex: none; color: var(--brand-blue-dark); font-size: .72rem; font-weight: 800; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 0; }
.metrics div { padding: .7rem; background: #f7f9fc; border-radius: .55rem; }
.metrics dt { color: var(--muted); font-size: .75rem; font-weight: 700; }
.metrics dd { margin: .2rem 0 0; font-size: 1.05rem; font-weight: 800; }
.metric-breakdown { display: block; margin-top: .25rem; font-size: .68rem; line-height: 1.35; }
.empty-state { display: flex; flex-direction: column; gap: .35rem; padding: 1rem; color: #475467; background: #f6f7f9; border: 1px dashed #c8d0dc; border-radius: .6rem; }
.empty-state span { color: var(--muted); font-size: .85rem; }
.card-link { display: flex; justify-content: space-between; padding-top: .8rem; border-top: 1px solid var(--line); font-weight: 750; text-decoration: none; }
.tab-nav { display: flex; gap: .3rem; margin: -1rem 0 1.5rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab-nav a { flex: none; padding: .75rem 1rem; border-bottom: 3px solid transparent; text-decoration: none; font-weight: 750; }
.tab-nav a.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }
.detail-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1rem; }
.silo-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.silo-pair.wide { max-width: 45rem; }
.silo-pair.compact { gap: .5rem; }
.silo-card { display: grid; justify-items: center; gap: .45rem; padding: 1rem; text-align: center; border: 1px solid var(--line); border-radius: .7rem; }
.silo-card small { display: block; }
.silo-card > div:nth-child(2) { display: grid; gap: .2rem; }
.silo-percent { font-size: 1.15rem; font-weight: 850; }
.silo-vessel { width: 6.5rem; height: 9rem; overflow: visible; }
.silo-shell { fill: #f0f3f5; }
.silo-outline, .silo-detail, .silo-ticks { fill: none; stroke: #172b3a; stroke-linecap: round; stroke-linejoin: round; }
.silo-outline { stroke-width: 4; }
.silo-detail { stroke-width: 4; }
.silo-ticks { stroke-width: 2; }
.silo-fill { fill: #c5cdd3; }
.silo-card.green .silo-fill { fill: #2e8b57; }
.silo-card.amber .silo-fill { fill: #d78a12; }
.silo-card.red .silo-fill { fill: #c0392b; }
.silo-pair.compact .silo-card { gap: .2rem; padding: .55rem .3rem; }
.silo-pair.compact .silo-vessel { width: 4rem; height: 5.5rem; }
.silo-pair.compact .silo-card small { font-size: .67rem; }
.silo-pair.compact .silo-percent { font-size: .95rem; }
.source-time { display: block; margin-top: 1rem; }
.future-panel { display: flex; flex-direction: column; gap: .25rem; margin-top: 1.25rem; padding: 1rem; color: #475467; background: var(--brand-blue-soft); border-radius: .6rem; }
.future-panel span { font-size: .9rem; }
.silo-history { margin-top: 1rem; }
.history-filter-grid { display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: .75rem; margin: 1rem 0; }
.history-filter-grid label { display: grid; gap: .4rem; }
.chart-state { padding: 2rem; text-align: center; color: var(--muted); background: #f7f9fc; border-radius: .6rem; }
.silo-chart-wrap { position: relative; width: 100%; min-height: 340px; }
.chart-legend { display: flex; justify-content: flex-end; gap: 1rem; margin-bottom: .35rem; }
.chart-legend label { display: flex; align-items: center; gap: .35rem; font-weight: 700; }
.chart-legend input { width: 1rem; min-height: auto; }
.chart-legend span { width: 1.4rem; height: .2rem; border-radius: 999px; background: var(--brand-blue); }
.chart-legend .series-b { background: #d07816; }
.silo-chart-wrap canvas { display: block; width: 100%; }
.chart-tooltip { position: absolute; z-index: 2; max-width: 16rem; padding: .45rem .6rem; color: #fff; background: #14213a; border-radius: .4rem; font-size: .8rem; pointer-events: none; }
.chart-note { margin-bottom: 0; font-size: .8rem; }
.report-filters { margin-bottom: 1rem; }
.report-filters form { display: grid; grid-template-columns: minmax(12rem, 1.5fr) 1fr 1fr 1fr auto auto; align-items: end; gap: .75rem; }
.report-filters label { display: grid; gap: .4rem; }
.compact-plant-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.compact-plant-fieldset legend { margin: 0 0 .4rem; color: var(--muted); font-size: .85rem; font-weight: 750; }
.compact-plant-selector { min-height: 2.8rem; border: 1px solid var(--line); border-radius: .55rem; background: #fff; }
.compact-plant-selector summary { min-height: 2.8rem; padding: .75rem; cursor: pointer; font-weight: 700; }
.plant-selector-options { padding: 0 .75rem .75rem; border-top: 1px solid var(--line); }
.batch-search-filter { margin-bottom: 1rem; }
.batch-search-filter form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: .75rem; }
.batch-search-filter fieldset { grid-column: 1 / -1; min-width: 0; margin: 0; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: .6rem; }
.batch-search-filter legend { padding: 0 .35rem; color: var(--muted); font-size: .85rem; font-weight: 750; }
.batch-search-filter label { display: grid; gap: .4rem; }
.plant-choice-actions { margin: 0 0 .75rem; }
.plant-choice-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem; }
.plant-choice-grid .check-field { min-width: 0; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: .5rem; background: #f7f9fc; }
.plant-choice-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plant-choice-grid.compact .check-field { min-height: 2.25rem; padding: .25rem 0; border: 0; background: transparent; }
.availability-warning { display: grid; gap: .2rem; margin: 0 0 1rem; padding: .8rem 1rem; color: #694b00; background: #fffaf0; border-left: .2rem solid #e0a52b; border-radius: .3rem; overflow-wrap: anywhere; }
.availability-warning span { color: #7a5a16; font-size: .88rem; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.report-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .75rem; margin-bottom: 1rem; }
.report-kpis article { display: grid; gap: .25rem; padding: 1rem; background: #fff; border: 1px solid var(--line); border-radius: .7rem; }
.report-kpis span { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.report-kpis strong { font-size: 1.25rem; }
.report-quality-note { margin: 1rem 0 0; padding: .65rem .8rem; color: #694b00; background: #fffaf0; border-left: .2rem solid #e0a52b; border-radius: .3rem; font-size: .82rem; line-height: 1.45; overflow-wrap: anywhere; }
.report-notes { margin-top: 1rem; color: var(--muted); font-size: .82rem; }
.report-notes p { margin: .25rem 0; }
.history-filter { margin-bottom: 1rem; }
.history-filter form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 1rem; }
.history-filter label { display: grid; gap: .4rem; }
.history-summary { margin-bottom: 1rem; }
.date-filter { margin-bottom: 1rem; }
.date-filter form { display: grid; grid-template-columns: minmax(12rem, 20rem) auto; align-items: end; gap: 1rem; }
.date-filter label { display: grid; gap: .4rem; }
.artifact-list { display: grid; gap: .75rem; }
.artifact-list article { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: .6rem; }
.artifact-list article div { display: grid; gap: .25rem; min-width: 0; }
.artifact-select input { width: 1.2rem; min-height: auto; }
.zip-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.artifact-list span, .artifact-list small { color: var(--muted); overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }
.operations-groups { display: grid; gap: 1rem; }
.operations-actions { display: flex; justify-content: flex-end; margin: 0 0 1rem; }
.operations-group .card-heading { align-items: center; margin-bottom: .75rem; }
.operations-table small { display: block; margin-top: .15rem; font-size: .72rem; }
.button-compact { min-height: 2rem; padding: .3rem .55rem; font-size: .78rem; }
.deletion-card { max-width: 42rem; margin-top: 1rem; border-color: #f3a6a0; }
.conflict-current { display: block; margin-top: .45rem; }
.tank-editor { display: flex; align-items: center; min-width: 4.5rem; }
.tank-editor input { width: 4.5rem; min-height: 2.25rem; padding: .4rem .5rem; text-align: center; }
.tank-editor input.unsaved { border-color: var(--brand-blue); background: var(--brand-blue-soft); }
.readings-table th[scope="row"] { color: var(--ink); font-size: inherit; text-transform: none; }
.water-page .date-filter { padding: .7rem 1rem; margin-bottom: .6rem; }
.water-page .date-filter form { grid-template-columns: minmax(11rem, 16rem) auto; gap: .6rem; }
.water-page .date-filter input, .water-page .date-filter .button { min-height: 2.35rem; padding-top: .4rem; padding-bottom: .4rem; }
.water-guidance { margin: 0 0 .45rem; color: var(--muted); font-size: .82rem; }
.water-table-card { padding: .45rem .8rem; }
.readings-table { table-layout: fixed; }
.readings-table th, .readings-table td { padding: .48rem .55rem; }
.readings-table th:nth-child(1) { width: 9%; }
.readings-table th:nth-child(2) { width: 20%; }
.readings-table th:nth-child(3), .readings-table th:nth-child(4) { width: 15%; }
.readings-table th:nth-child(5) { width: 25%; }
.readings-table th:nth-child(6) { width: 16%; }
.water-save-bar { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; min-height: 3.2rem; padding-top: .55rem; }
.water-save-summary { flex: 1; color: var(--muted); font-size: .84rem; text-align: right; }
.water-save-summary.pending { color: #925f00; }
.water-save-summary.success { color: var(--success); }
.water-save-summary.error { color: var(--danger); }
.water-save-bar .button { min-width: 9.5rem; }
.report-option { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; margin-bottom: 1rem; padding: .9rem 1rem; color: var(--ink); background: var(--brand-blue-soft); border: 1px solid #c9d7ef; border-radius: .7rem; }
.report-option h2 { margin: 0 0 .2rem; font-size: 1.05rem; }
.report-option p { margin: 0; color: var(--muted); font-size: .86rem; }
.back-link { margin: -.75rem 0 1rem; }
.daily-water-breakdown { margin-bottom: 1rem; }
.daily-water-breakdown tfoot th, .daily-water-breakdown tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
.report-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.report-preview-heading .section-heading { margin: 0; }
.report-copy-actions { display: flex; align-items: center; gap: .75rem; }
.report-copy-feedback { min-width: 5rem; color: var(--muted); font-size: .85rem; font-weight: 750; }
.report-copy-feedback.success { color: var(--success); }
.report-copy-feedback.error { max-width: 24rem; color: var(--danger); }
.report-copy-feedback.pending { color: var(--muted); }
.operations-report { margin: 0; padding: 1rem; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #f7f9fc; border: 1px solid var(--line); border-radius: .55rem; font: .9rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.batch-table th:nth-child(4), .batch-table td:nth-child(4) { min-width: 12rem; white-space: normal; }
.user-controls { display: grid; grid-template-columns: minmax(10rem,1fr) minmax(10rem,1fr) auto auto; align-items: end; gap: 1rem; }
.user-controls label:not(.check-field) { display: grid; gap: .4rem; }
.check-field { display: flex; align-items: center; gap: .5rem; min-height: 2.8rem; }
.check-field input { width: 1.15rem; min-height: auto; }
.invitation-panel { margin-bottom: 2rem; }
.section-heading { margin: 0 0 1rem; }
.inline-actions { display: flex; gap: .5rem; }
.inline-actions form { margin: 0; }
.button-danger { border-color: #f3a6a0; color: var(--danger); background: #fff; }
.button-danger:hover { background: #fff1f0; }
.fixed-value { min-height: 2.8rem; border: 1px solid var(--line); border-radius: .55rem; padding: .75rem; background: #f7f9fc; overflow-wrap: anywhere; }
.invitation-card { width: min(100%, 32rem); }

@media (max-width: 780px) {
  .app-header { grid-template-columns: 1fr auto; gap: .75rem; }
  .brand img { width: 8rem; }
  .brand span { display: none; }
  .app-header nav { grid-row: 2; grid-column: 1 / -1; }
  .session span { display: none; }
  .heading-with-action { align-items: flex-start; flex-direction: column; }
  .user-card, .user-controls { grid-template-columns: 1fr; }
  .plant-grid, .detail-grid { grid-template-columns: 1fr; }
  .history-filter form, .date-filter form, .history-filter-grid, .report-filters form, .batch-search-filter form { grid-template-columns: 1fr; }
  .plant-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .report-option { align-items: stretch; flex-direction: column; }
  .report-preview-heading { align-items: stretch; flex-direction: column; }
  .report-copy-actions { align-items: flex-start; flex-direction: column; }
  .report-copy-actions .button { width: 100%; }
  .artifact-list article { align-items: stretch; flex-direction: column; }
  .zip-actions { align-items: stretch; flex-direction: column; }
  .user-controls { align-items: stretch; }
}

@media (max-width: 620px) {
  .batch-table thead { display: none; }
  .batch-table, .batch-table tbody, .batch-table tr, .batch-table td { display: block; width: 100%; }
  .batch-table tr { margin-bottom: .75rem; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: .6rem; background: #fff; }
  .batch-table td { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; white-space: normal; border: 0; }
  .batch-table td::before { content: attr(data-label); color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
  .operations-table thead { display: none; }
  .operations-table, .operations-table tbody, .operations-table tr, .operations-table td, .operations-table th[scope="row"] { display: block; width: 100%; }
  .operations-table tr { margin-bottom: .75rem; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: .6rem; background: #fff; }
  .operations-table td, .operations-table th[scope="row"] { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; text-align: right; white-space: normal; border: 0; }
  .operations-table td::before, .operations-table th[scope="row"]::before { content: attr(data-label); color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
  .operations-table td small { margin-left: auto; }
  .water-table-card { padding: .65rem; }
  .readings-table { table-layout: auto; }
  .readings-table tr { margin-bottom: .6rem; }
  .tank-editor { justify-content: flex-end; }
  .water-save-bar { position: sticky; bottom: 0; z-index: 3; margin: 0 -.625rem; padding: .65rem; background: rgba(243,246,250,.96); border-top: 1px solid var(--line); }
  .water-save-summary { text-align: left; }
}

@media (min-width: 781px) and (max-width: 1050px) {
  .plant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 640px) and (max-width: 780px) {
  .dashboard-page .plant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 639px) {
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .auth-page { padding: .75rem; }
  .login-card { border-radius: .75rem; }
  .app-main { width: min(100% - 1.25rem, var(--page-max-width)); }
}

.audit-filter form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.audit-filter label { display: grid; gap: .4rem; }
.audit-pagination { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.audit-table th:nth-child(3), .audit-table th:nth-child(4) { width: 9rem; }
.audit-table td:nth-child(3), .audit-table td:nth-child(4) { min-width: 7rem; max-width: 12rem; white-space: normal; overflow-wrap: anywhere; }
.catalogue-table { table-layout: fixed; }
.catalogue-table th, .catalogue-table td { vertical-align: middle; white-space: normal; }
.catalogue-table th:nth-child(1), .catalogue-table td:nth-child(1) { width: 51%; }
.catalogue-table th:nth-child(2), .catalogue-table td:nth-child(2) { width: 12%; }
.catalogue-table th:nth-child(3), .catalogue-table td:nth-child(3) { width: 10%; }
.catalogue-table th:nth-child(4), .catalogue-table td:nth-child(4) { width: 27%; }
.catalogue-rename-form { display: grid; grid-template-columns: minmax(10rem, 1fr) auto; align-items: center; gap: .5rem; min-width: 0; margin: 0; }
.catalogue-rename-form input { min-width: 0; }
.catalogue-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.catalogue-actions form { margin: 0; }
.catalogue-state { font-weight: 700; }

@media (max-width: 700px) {
  .catalogue-table-scroll { overflow: visible; }
  .catalogue-table, .catalogue-table tbody, .catalogue-table tr, .catalogue-table td { display: block; width: 100%; }
  .catalogue-table thead { display: none; }
  .catalogue-table tr { margin-bottom: .75rem; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: .6rem; background: #fff; }
  .catalogue-table td { display: grid; grid-template-columns: minmax(6rem, 9rem) minmax(0, 1fr); gap: .5rem; padding: .45rem 0; border: 0; }
  .catalogue-table td::before { content: attr(data-label); color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
  .catalogue-table td.catalogue-name { grid-template-columns: 1fr; }
  .catalogue-rename-form { width: 100%; }
}

@media (max-width: 420px) {
  .catalogue-rename-form { grid-template-columns: 1fr; }
  .catalogue-rename-form .button { width: 100%; }
}

.app-header nav a[aria-current] { background: var(--brand-blue); color: #fff; }
.silo-negative { color: #a62121; font-weight: 750; }
.report-totals { margin-block: 1rem 0; padding-inline-start: 1.4rem; }
.report-totals li + li { margin-top: .3rem; }
