:root {
    color-scheme: light;
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;
    --background: #f4f6f8;
    --surface: #ffffff;
    --text: #17202a;
    --muted: #667085;
    --border: #d9dee7;
    --primary: #1f5f8b;
    --primary-hover: #174b6e;
    --danger: #a61b1b;
    --danger-bg: #fff1f1;
    --success: #176b3a;
    --success-bg: #eefaf3;
    --shadow: 0 16px 40px rgba(16, 24, 40, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

a {
    color: var(--primary);
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: min(100%, 430px);
}

.auth-card,
.summary-card,
.property-card,
.meter-card,
.form-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.auth-card {
    padding: 34px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--primary);
    color: white;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.eyebrow {
    margin: 22px 0 5px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 10px;
}

h2 {
    font-size: 1.15rem;
}

.muted {
    color: var(--muted);
    line-height: 1.55;
}

form {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 7px;
    font-size: 0.9rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    color: var(--text);
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 95, 139, 0.14);
}

input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    margin: 0;
}

button {
    min-height: 46px;
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: 750;
}

button:hover {
    background: var(--primary-hover);
}

button:disabled {
    cursor: progress;
    opacity: 0.65;
}

.secondary-button {
    margin: 0;
    background: white;
    color: var(--primary);
    border: 1px solid var(--border);
}

.text-button {
    min-height: auto;
    padding: 3px;
    background: transparent;
    color: var(--primary);
    border: 0;
}

.text-button:hover {
    background: transparent;
    text-decoration: underline;
}

.danger-button {
    color: var(--danger);
}

.danger-text {
    color: var(--danger);
}

.message {
    margin: 18px 0;
    padding: 12px 14px;
    border: 1px solid #f3b7b7;
    border-radius: 10px;
    background: var(--danger-bg);
    color: var(--danger);
}

.success-message {
    border-color: #bce4c9;
    background: var(--success-bg);
    color: var(--success);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px clamp(20px, 5vw, 64px);
    background: white;
    border-bottom: 1px solid var(--border);
}

.app-header .eyebrow {
    margin-top: 0;
}

.app-header h1 {
    margin-bottom: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-content {
    width: min(1120px, calc(100% - 40px));
    margin: 30px auto 60px;
}

.summary-card {
    margin-bottom: 30px;
    padding: 24px;
}

.summary-title {
    margin-bottom: 5px;
    font-size: 1.2rem;
    font-weight: 800;
}

.property-grid,
.meter-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
}

.property-card,
.meter-card {
    padding: 22px;
}

.property-link {
    color: inherit;
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.property-link:hover {
    transform: translateY(-2px);
}

.property-code {
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.property-name {
    margin: 6px 0 8px;
    font-size: 1.1rem;
    font-weight: 800;
}

.back-link {
    display: inline-block;
    margin-bottom: 5px;
    text-decoration: none;
    font-size: 0.9rem;
}

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

.section-heading h2 {
    margin-bottom: 4px;
}

.meter-card.inactive {
    opacity: 0.68;
}

.meter-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.meter-card h3 {
    margin: 6px 0 0;
}

.status-badge {
    align-self: flex-start;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eaf6ee;
    color: #176b3a;
    font-size: 0.76rem;
    font-weight: 800;
}

.inactive-badge {
    background: #f0f1f3;
    color: #667085;
}

.meter-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
    margin: 22px 0 0;
}

.meter-details div {
    min-width: 0;
}

.meter-details dt {
    color: var(--muted);
    font-size: 0.76rem;
}

.meter-details dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.card-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.form-card {
    margin-top: 28px;
    padding: 26px;
}

.form-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.full-width {
    grid-column: 1 / -1;
}

.checkbox-group {
    display: grid;
    gap: 12px;
    margin: 12px 0 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 30px;
    text-align: center;
}

.icon-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    min-height: 44px;
    padding: 0;
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 1.12rem;
}

.notification-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 1px 5px;
    border-radius: 999px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    line-height: 18px;
}

.notification-shell {
    position: relative;
}

.notification-panel {
    position: absolute;
    z-index: 20;
    top: 52px;
    right: 0;
    width: min(390px, calc(100vw - 30px));
    max-height: 520px;
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
    box-shadow: var(--shadow);
}

.notification-panel-header {
    position: sticky;
    top: -14px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 4px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.notification-item {
    padding: 15px 5px;
    border-bottom: 1px solid var(--border);
}

.notification-item.unread {
    border-left: 3px solid var(--primary);
    padding-left: 10px;
}

.notification-item p {
    margin: 7px 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.notification-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.82rem;
}

.notification-empty {
    margin: 20px 4px;
    color: var(--muted);
}

@media (max-width: 700px) {
    .app-header {
        align-items: flex-start;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: auto;
    }

    .section-heading {
        align-items: flex-start;
    }
}

@media (max-width: 500px) {
    .auth-card {
        padding: 24px;
    }

    .app-header {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

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