:root {
    --bg: #f4f7f5;
    --panel: #ffffff;
    --panel-muted: #eef4f0;
    --text: #173127;
    --muted: #5c7067;
    --line: #d6e3db;
    --brand: #0f8b62;
    --brand-dark: #0b5d45;
    --green: #168b5f;
    --amber: #c68409;
    --orange: #d06220;
    --red: #c73a35;
    --blue: #466da9;
    --shadow: 0 24px 80px rgba(18, 45, 35, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(15, 139, 98, 0.12), transparent 32%),
        radial-gradient(circle at top right, rgba(70, 109, 169, 0.09), transparent 28%),
        var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    box-shadow: 0 14px 28px rgba(15, 139, 98, 0.28);
}

.brand-copy small,
.eyebrow,
.muted {
    color: var(--muted);
}

.brand-copy strong {
    display: block;
    font-size: 1.1rem;
}

.status-hero,
.card,
.admin-grid section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.status-hero {
    padding: 28px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.status-hero::after {
    content: "";
    position: absolute;
    inset: auto -30px -30px auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 139, 98, 0.18), transparent 64%);
}

.hero-grid,
.cards-2,
.cards-3 {
    display: grid;
    gap: 20px;
}

.hero-grid {
    grid-template-columns: 2fr 1fr;
}

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

.cards-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--panel-muted);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.green { background: rgba(22, 139, 95, 0.12); color: var(--green); }
.green .dot { background: var(--green); }
.amber { background: rgba(198, 132, 9, 0.12); color: var(--amber); }
.amber .dot { background: var(--amber); }
.orange { background: rgba(208, 98, 32, 0.12); color: var(--orange); }
.orange .dot { background: var(--orange); }
.red { background: rgba(199, 58, 53, 0.12); color: var(--red); }
.red .dot { background: var(--red); }
.blue { background: rgba(70, 109, 169, 0.12); color: var(--blue); }
.blue .dot { background: var(--blue); }

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

.card {
    padding: 22px;
}

.group-list,
.incident-list,
.maintenance-list,
.history-list {
    display: grid;
    gap: 18px;
}

.service-row,
.mini-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.service-row:first-child,
.mini-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.service-row:last-child,
.mini-row:last-child {
    padding-bottom: 0;
}

.timeline {
    border-left: 2px solid var(--line);
    margin-left: 4px;
    padding-left: 18px;
    display: grid;
    gap: 14px;
}

.timeline-item time {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

.empty {
    padding: 18px;
    border-radius: 18px;
    background: var(--panel-muted);
    color: var(--muted);
}

.footer {
    margin-top: 24px;
    color: var(--muted);
    text-align: center;
    font-size: 0.92rem;
}

.admin-shell {
    max-width: 1480px;
}

.admin-grid {
    display: grid;
    gap: 20px;
}

.admin-grid section {
    padding: 24px;
}

.admin-grid h2,
.admin-grid h3,
.status-hero h1,
.card h2 {
    margin-top: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px 10px;
    border-top: 1px solid var(--line);
    vertical-align: top;
}

thead th {
    border-top: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

form.inline,
.stack {
    display: grid;
    gap: 12px;
}

.inline-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.92rem;
}

input,
textarea,
select,
button {
    font: inherit;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    background: white;
    color: var(--text);
    border-radius: 14px;
    padding: 11px 12px;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button,
.button-link {
    border: 0;
    border-radius: 14px;
    padding: 11px 16px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: white;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.button-muted {
    background: var(--panel-muted);
    color: var(--text);
}

.flash {
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(15, 139, 98, 0.1);
    color: var(--brand-dark);
}

.errors {
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(199, 58, 53, 0.1);
    color: var(--red);
}

.small {
    font-size: 0.88rem;
}

@media (max-width: 980px) {
    .hero-grid,
    .cards-2,
    .cards-3,
    .inline-grid,
    .inline-grid-2 {
        grid-template-columns: 1fr;
    }

    .topbar,
    .service-row {
        align-items: flex-start;
        flex-direction: column;
    }

    table,
    thead,
    tbody,
    tr,
    td,
    th {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        border-top: 1px solid var(--line);
        padding-top: 12px;
        margin-top: 12px;
    }

    td {
        border-top: 0;
        padding: 8px 0;
    }
}
