:root {
    --surface: #ffffff;
    --surface-soft: #f3f6f8;
    --surface-muted: #eef3f5;
    --line: #d7dee8;
    --line-strong: #c2ccd8;
    --text: #172026;
    --muted: #64727d;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #eef7f6;
    --accent: #2563eb;
    --accent-soft: #eef4ff;
    --warning: #b45309;
    --warning-bg: #fff7ed;
    --danger: #b42318;
    --danger-soft: #fff1f3;
    --brand-strong: var(--brand-dark);
    --ink: var(--text);
    --soft: var(--brand-soft);
    --warn: var(--warning);
    font-family: "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: #f6f8f9;
    color: var(--ink);
    overflow-x: hidden;
}

html {
    height: 100%;
}

body {
    min-height: 100dvh;
}

a {
    color: inherit;
}

.tenant-shell {
    min-height: 100dvh;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
    overflow-x: hidden;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr);
    grid-template-areas: "brand logo actions";
    align-items: center;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: var(--brand);
    color: #fff;
    border-bottom: 1px solid color-mix(in srgb, var(--brand-dark) 70%, #fff);
    max-width: 100vw;
    overflow: hidden;
}

.app-header .brand {
    grid-area: brand;
}

.app-header .header-logo {
    grid-area: logo;
}

.app-header .header-actions {
    grid-area: actions;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.unit-picker {
    display: grid;
    gap: 3px;
    min-width: min(360px, 46vw);
    font-size: .78rem;
}

.unit-picker span {
    color: rgba(255, 255, 255, .78);
}

.unit-picker .text-input {
    min-height: 38px;
    padding: 7px 10px;
    font-size: .9rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 800;
    flex: 0 0 auto;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    min-width: 0;
    overflow: hidden;
}

.header-logo-img {
    max-height: 40px;
    max-width: min(180px, 32vw);
    object-fit: contain;
}

.header-logo-img.header-logo-transparent {
    background: #fff;
    border-radius: 4px;
    padding: 2px 6px;
}

.header-logo-img.header-logo-transparent.header-logo-filter-safe {
    filter: brightness(0) invert(1);
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.header-logo-img.header-logo-opaque {
    background: #fff;
    border-radius: 4px;
    padding: 2px 6px;
}

.brand small,
.list-row span,
.meter-card small,
.quick-tile span:not(.tile-icon),
.page-title-band p,
.login-copy {
    color: var(--muted);
}

.app-header .brand small {
    color: rgba(255, 255, 255, .75);
}

.brand span:last-child {
    display: grid;
    line-height: 1.25;
    min-width: 0;
}

.brand strong,
.brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 18px 14px 28px;
}

.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 1fr);
    overflow-x: auto;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 20px rgba(23, 32, 38, 0.08);
    scrollbar-width: thin;
}

.bottom-nav a {
    padding: 12px 6px calc(12px + env(safe-area-inset-bottom));
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.bottom-nav a.active {
    color: var(--brand-strong);
}

.login-view {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 22px 14px;
    background: linear-gradient(160deg, #e8f4f2 0%, #f9fbfb 58%, #eaf2f7 100%);
}

.login-card,
.section-block,
.quick-tile,
.meter-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(23, 32, 38, 0.06);
}

.login-card {
    width: min(430px, 100%);
    padding: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(1.8rem, 8vw, 2.6rem);
    line-height: 1.05;
}

h2 {
    margin-bottom: 0;
    font-size: 1.1rem;
}

.login-form,
.compose-panel form,
.damage-form form,
.self-service-form form {
    display: grid;
    gap: 10px;
}

label {
    font-weight: 700;
}

.text-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.area {
    min-height: 116px;
    resize: vertical;
}

.primary-action,
.ghost-button,
.small-button,
.link-action {
    min-height: 42px;
    border-radius: 6px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.primary-action {
    width: 100%;
    background: var(--brand);
    color: #fff;
}

.primary-action.inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 0 14px;
    text-decoration: none;
}

.secondary-action {
    min-height: 42px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand-strong);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.compact-action {
    width: auto;
    min-height: 36px;
    padding: 0 12px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    font-weight: 700;
}

.checkbox-row input {
    width: 20px;
    height: 20px;
    accent-color: var(--brand);
}

.service-group {
    display: grid;
    gap: 8px;
    margin: 2px 0 6px;
}

.service-group-title {
    font-weight: 800;
    color: var(--ink);
}

.service-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.service-option {
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 0.92rem;
}

.service-option:has(input:checked) {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 9%, #fff);
}

.service-option:has(input:disabled) {
    color: var(--muted);
}

.form-message {
    border-radius: 6px;
    padding: 10px 12px;
    background: #f5f7fa;
    color: var(--ink);
    font-weight: 700;
}

.form-message.success {
    background: #e8f7ef;
    color: #126b3a;
}

.form-message.error {
    background: #fff0f0;
    color: var(--brand-strong);
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ticket-edit {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.photo-picker {
    display: grid;
    gap: 8px;
}

.photo-picker-title {
    font-weight: 700;
}

.photo-picker-actions,
.photo-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo-picker-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    cursor: pointer;
}

.photo-picker-button.disabled {
    cursor: progress;
    opacity: .62;
}

.photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.photo-selection span {
    max-width: 100%;
    padding: 6px 9px;
    border-radius: 6px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.ghost-button,
.small-button {
    background: #fff;
    border-color: var(--line);
    color: var(--brand-strong);
}

.small-button {
    min-height: 36px;
    padding: 0 12px;
}

.small-button:disabled {
    cursor: wait;
    opacity: .65;
}

.link-action {
    background: transparent;
    color: var(--brand-strong);
}

.validation-message,
.info-message,
.inline-alert {
    padding: 10px 12px;
    border-radius: 6px;
    font-weight: 700;
}

.validation-message {
    background: #fff7ed;
    color: var(--warn);
}

.inline-alert {
    margin-bottom: 8px;
    background: #fff7ed;
    color: var(--warn);
}

.muted-text {
    color: var(--muted);
    margin: 0;
}

.info-message {
    background: var(--soft);
    color: var(--brand-strong);
}

.hero-band,
.page-title-band {
    margin: 0 0 18px;
    padding: 24px 18px;
    background: #dcefed;
    border: 1px solid #c7dfdc;
    border-radius: 8px;
}

.hero-band h1,
.page-title-band h1 {
    margin-bottom: 8px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.quick-tile {
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 14px;
    text-decoration: none;
}

.tile-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--brand-strong);
    font-weight: 800;
}

.quick-tile small {
    color: var(--brand-strong);
    font-weight: 800;
}

.section-block {
    margin-bottom: 16px;
    padding: 14px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.section-heading a {
    color: var(--brand-strong);
    font-weight: 800;
    text-decoration: none;
}

.list-row {
    display: grid;
    gap: 4px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.list-row:first-child {
    border-top: 0;
}

.document-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.document-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.ticket-row {
    gap: 7px;
}

.ticket-row p {
    margin-bottom: 0;
    color: var(--muted);
}

.damage-ticket-card {
    display: grid;
    border-top: 1px solid var(--line);
}

.damage-ticket-card:first-of-type {
    border-top: 0;
}

.damage-ticket-card.expanded {
    margin-inline: -8px;
    border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--line));
    border-radius: 8px;
    background: #fff;
}

.damage-ticket-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.damage-ticket-card.expanded .damage-ticket-toggle {
    padding: 12px 14px;
}

.damage-ticket-toggle div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.damage-ticket-toggle strong,
.damage-ticket-toggle span {
    overflow-wrap: anywhere;
}

.damage-ticket-toggle span,
.damage-ticket-date {
    color: var(--muted);
}

.damage-ticket-date {
    white-space: nowrap;
    font-size: .9rem;
}

.damage-ticket-details {
    display: grid;
    gap: 8px;
    padding: 0 14px 14px;
}

.damage-ticket-details p {
    margin-bottom: 0;
    color: var(--muted);
}

.ticket-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ticket-photo-upload-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.photo-icon-button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
    border-radius: 8px;
    background: #fff;
    color: var(--brand-strong);
    cursor: pointer;
}

.photo-icon-button:hover,
.photo-icon-button:focus-visible {
    border-color: var(--brand);
    background: var(--soft);
    outline: 0;
}

.photo-icon-button:disabled {
    cursor: progress;
    opacity: .62;
}

.photo-icon {
    display: block;
    fill: currentColor;
}

.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;
}

.ticket-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.ticket-head strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--brand-strong);
    font-size: .78rem;
    font-weight: 800;
    white-space: nowrap;
}

.preview-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    align-items: end;
    background: rgba(15, 23, 42, .42);
    padding: 12px;
}

.preview-modal {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    max-height: min(88vh, 820px);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.preview-modal-header strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.preview-close {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--brand-strong);
    font: inherit;
    font-weight: 800;
}

.preview-body {
    min-height: 360px;
    background: var(--surface-soft);
}

.camera-capture-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 14px;
    background: rgba(15, 23, 42, .72);
}

.camera-capture-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(520px, 100%);
    max-height: min(88vh, 720px);
    border-radius: 8px;
    overflow: hidden;
    background: #0f172a;
    color: #fff;
}

.camera-capture-header,
.camera-capture-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
}

.camera-capture-video {
    width: 100%;
    max-height: 62vh;
    background: #020617;
    object-fit: contain;
}

.camera-capture-close,
.camera-capture-shot {
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
    padding: 0 14px;
    font: inherit;
    font-weight: 800;
}

.camera-capture-close {
    background: transparent;
    color: #fff;
}

.camera-capture-shot {
    width: 100%;
    background: var(--brand);
    color: #fff;
}

.preview-frame,
.preview-image {
    display: block;
    width: 100%;
    height: min(74vh, 720px);
    border: 0;
}

.preview-image {
    object-fit: contain;
    padding: 10px;
}

.meter-strip,
.meter-list {
    display: grid;
    gap: 10px;
}

.meter-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meter-chip,
.meter-card {
    display: grid;
    gap: 5px;
    padding: 12px;
    border-radius: 8px;
    background: var(--soft);
}

.meter-card {
    background: #fff;
}

.meter-card b {
    color: var(--brand-strong);
    font-size: 1.5rem;
}

.consumption-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.consumption-switch button {
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.consumption-switch button.active {
    background: var(--brand);
    color: #fff;
}

.consumption-periods,
.consumption-values,
.reading-list {
    display: grid;
    gap: 10px;
}

.consumption-period {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.consumption-period.expanded {
    border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
}

.consumption-period-toggle,
.reading-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.consumption-period-toggle div,
.reading-section-toggle div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.consumption-period-toggle span {
    font-weight: 900;
}

.consumption-period-toggle small,
.reading-section-toggle small,
.consumption-value small,
.reading-row small {
    color: var(--muted);
}

.consumption-period-body {
    display: grid;
    gap: 10px;
    padding: 0 16px 16px;
}

.consumption-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.consumption-value {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    background: var(--soft);
}

.consumption-value-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.consumption-value span,
.comparison-bar-row small {
    font-weight: 800;
}

.consumption-value strong {
    color: var(--brand-strong);
    font-size: 1.35rem;
    line-height: 1.1;
}

.consumption-value .trend-up {
    color: var(--warn);
}

.consumption-value .trend-down {
    color: #047857;
}

.consumption-bars {
    display: grid;
    gap: 7px;
}

.comparison-bar-row {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.comparison-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f7;
}

.comparison-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

.comparison-bar-row.previous .comparison-bar span {
    background: #607080;
}

.reading-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.reading-row:first-child {
    border-top: 0;
}

.reading-main {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.reading-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.reading-row small {
    overflow-wrap: anywhere;
}

.reading-row b {
    color: var(--brand-strong);
    white-space: nowrap;
}

.reading-section {
    padding: 0;
    overflow: hidden;
}

.reading-section .reading-list,
.reading-section > .muted-text {
    margin: 0;
    padding: 0 18px 16px;
}

.reading-section-toggle h2 {
    margin: 0;
}

.meter-device-icon {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #eef2f7;
    border: 1px solid #d7e0ea;
}

.meter-device-icon::before,
.meter-device-icon::after {
    content: "";
    display: block;
}

.meter-device-icon.warmwater::before,
.meter-device-icon.coldwater::before {
    width: 12px;
    height: 16px;
    border-radius: 60% 60% 60% 0;
    transform: rotate(-45deg);
}

.meter-device-icon.warmwater {
    background: #fff1f2;
    border-color: #fecdd3;
}

.meter-device-icon.warmwater::before {
    background: #dc2626;
}

.meter-device-icon.coldwater {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.meter-device-icon.coldwater::before {
    background: #2563eb;
}

.meter-device-icon.hkv {
    background: #fff7ed;
    border-color: #fed7aa;
}

.meter-device-icon.hkv::before {
    width: 4px;
    height: 17px;
    border-radius: 3px;
    background: #b91c1c;
    box-shadow: -7px 4px 0 #ef4444, 7px 4px 0 #ef4444;
}

.meter-device-icon.heatmeter {
    background: #fefce8;
    border-color: #fde68a;
}

.meter-device-icon.heatmeter::before {
    width: 16px;
    height: 16px;
    border: 3px solid #d97706;
    border-radius: 50%;
}

.meter-device-icon.heatmeter::after {
    position: absolute;
    width: 9px;
    height: 2px;
    background: #d97706;
    transform: rotate(-38deg);
    transform-origin: right center;
}

.portal-icon-shell {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    max-width: 34px;
    min-height: 34px;
    max-height: 34px;
    overflow: hidden;
}

.portal-icon-shell.room {
    color: #171635;
}

.portal-room-icon {
    display: block;
    width: 30px;
    height: 30px;
    max-width: 30px;
    max-height: 30px;
    fill: currentColor;
    flex: 0 0 auto;
}

.portal-tree-icon {
    display: block;
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
    object-fit: contain;
    filter: contrast(1.16) saturate(.65);
    flex: 0 0 auto;
}

.self-reading-list {
    display: grid;
    gap: 8px;
}

.self-reading-card {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.self-reading-card.expanded {
    border-color: color-mix(in srgb, var(--brand) 48%, var(--line));
}

.self-reading-card.has-error {
    border-color: #ef4444;
}

.self-reading-toggle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.self-reading-icons {
    display: grid;
    grid-template-columns: repeat(2, 34px);
    width: 76px;
    max-width: 76px;
    gap: 8px;
    align-items: center;
    flex: 0 0 76px;
}

.self-reading-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.self-reading-toggle strong {
    overflow-wrap: anywhere;
}

.self-reading-plausi {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand) 8%, #fff);
    color: var(--brand-strong);
    font-size: .78rem;
    font-weight: 800;
}

.self-reading-row-error {
    width: fit-content;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    background: #fff1f2;
    color: #b00000;
    font-size: .92rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.self-reading-toggle .self-reading-copy > span:not(.self-reading-row-error),
.self-reading-last span {
    color: var(--muted);
}

.self-reading-toggle-icon {
    display: grid;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--brand-strong);
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
}

.self-reading-details {
    display: grid;
    gap: 12px;
    padding: 0 14px 14px;
}

.self-reading-meta,
.self-reading-last {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.self-reading-meta {
    color: var(--muted);
    font-size: .9rem;
}

.self-reading-inputs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.empty-state,
.loading-state {
    padding: 32px 0;
    text-align: center;
}

.empty-module {
    display: grid;
    gap: 6px;
}

.startup-loader {
    display: grid;
    min-height: 100vh;
    place-items: center;
    color: var(--brand-strong);
    font-weight: 800;
}

#blazor-error-ui {
    display: none;
}

@media (max-width: 1100px) {
    .app-header {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "logo"
            "actions";
        align-items: center;
        gap: 8px 12px;
    }

    .app-header .brand {
        display: none;
    }

    .header-logo {
        justify-content: center;
        min-height: 34px;
    }

    .header-logo-img {
        max-height: 36px;
        max-width: min(220px, 70vw);
    }

    .unit-picker {
        min-width: 0;
        flex: 1 1 auto;
    }
}

@media (max-width: 720px) {
    .self-reading-meta,
    .self-reading-last,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .self-reading-inputs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-header {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "logo"
            "actions";
        align-items: stretch;
        gap: 6px;
        padding: calc(8px + env(safe-area-inset-top)) 10px 10px;
    }

    .header-logo {
        justify-content: center;
        min-height: 28px;
    }

    .header-logo-img {
        max-height: 30px;
        max-width: min(170px, 70vw);
    }

    .header-actions {
        align-items: stretch;
        gap: 6px;
        min-width: 0;
    }

    .unit-picker {
        min-width: 0;
        flex: 1;
        font-size: .68rem;
    }

    .unit-picker .text-input {
        min-height: 34px;
        padding: 5px 8px;
        font-size: .8rem;
    }

    .ghost-button {
        padding-inline: 10px;
        min-height: 34px;
        font-size: .82rem;
        flex: 0 0 auto;
    }

    .brand {
        gap: 8px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
    }

    .brand strong {
        font-size: .96rem;
    }

    .brand small {
        font-size: .78rem;
    }

    .content {
        width: 100%;
        padding: 10px 8px 18px;
    }

    .hero-band,
    .page-title-band {
        margin-bottom: 10px;
        padding: 13px 12px;
    }

    .hero-band .eyebrow,
    .page-title-band .eyebrow {
        margin-bottom: 4px;
        font-size: .7rem;
    }

    .hero-band h1,
    .page-title-band h1 {
        margin-bottom: 4px;
        font-size: 1.9rem;
        line-height: 1.02;
    }

    .hero-band p:last-child,
    .page-title-band p:last-child {
        margin-bottom: 0;
        font-size: .88rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .quick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 10px;
    }

    .quick-tile {
        gap: 5px;
        min-height: 84px;
        padding: 9px;
    }

    .quick-tile strong {
        font-size: .9rem;
        line-height: 1.12;
        overflow-wrap: anywhere;
    }

    .quick-tile span:not(.tile-icon) {
        display: none;
    }

    .quick-tile small {
        font-size: .78rem;
    }

    .tile-icon {
        width: 28px;
        height: 28px;
        border-radius: 7px;
    }

    .meter-strip {
        grid-template-columns: 1fr;
    }

    .consumption-values {
        grid-template-columns: 1fr;
    }

    .document-row {
        grid-template-columns: 1fr;
    }

    .document-actions {
        justify-content: stretch;
    }

    .document-actions .small-button {
        flex: 1 1 120px;
    }
}

@media (max-width: 430px) {
    .content {
        padding: 8px 7px 16px;
    }

    .app-header {
        padding-inline: 8px;
    }

    .hero-band,
    .page-title-band {
        padding: 11px 10px;
    }

    .hero-band h1,
    .page-title-band h1 {
        font-size: 1.65rem;
    }

    .quick-grid {
        gap: 7px;
    }

    .quick-tile {
        min-height: 78px;
        padding: 8px;
    }

    .tile-icon {
        width: 26px;
        height: 26px;
    }
}

@media (min-width: 1180px) {
    .tenant-shell {
        padding-bottom: 0;
    }

    .bottom-nav {
        top: 88px;
        right: auto;
        bottom: auto;
        left: max(18px, calc((100vw - 1120px) / 2));
        width: 180px;
        grid-auto-flow: row;
        grid-auto-columns: auto;
        grid-template-columns: 1fr;
        overflow-x: visible;
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: none;
        overflow: hidden;
    }

    .bottom-nav a {
        padding: 14px;
        text-align: left;
    }

    .preview-backdrop {
        align-items: center;
        padding: 24px;
    }

    .preview-modal {
        max-width: 980px;
        margin: 0 auto;
    }
}
