:root {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --ink: #101623;
    --muted: #667085;
    --line: #dde5ef;
    --brand: #332a91;
    --brand-2: #00a9d6;
    --accent: #18a058;
    --shadow: 0 18px 44px rgba(16, 22, 35, .09);
    --radius: 8px;
    --font: "Aptos", "Manrope", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, #fbfcfe 0%, var(--bg) 50%, #eef3f8 100%);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 0%, rgba(0, 169, 214, .13), transparent 28rem),
        radial-gradient(circle at 88% 12%, rgba(51, 42, 145, .11), transparent 24rem);
    mask-image: linear-gradient(180deg, #000, transparent 72%);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

.site-header,
.site-footer,
main {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
}

.page-shell {
    position: relative;
    z-index: 1;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    border: 1px solid rgba(221, 229, 239, .92);
    border-radius: 8px;
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 10px 28px rgba(16, 22, 35, .06);
    backdrop-filter: blur(14px);
    margin-top: 16px;
    padding: 11px 13px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 800;
}

.brand img {
    width: 118px;
    height: auto;
    display: block;
}

.brand span {
    border-left: 1px solid rgba(102, 112, 133, .28);
    color: #4b5565;
    padding-left: 12px;
    font-size: 13px;
    font-weight: 800;
}

.admin-nav a,
.button {
    min-height: 40px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    font-weight: 700;
}

.admin-nav a:hover {
    background: #fff;
    box-shadow: 0 8px 18px rgba(16, 22, 35, .06);
    color: var(--brand);
}

.eyebrow {
    margin: 0 0 8px;
    color: #166a8f;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

h1 {
    max-width: 680px;
    margin-bottom: 10px;
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.08;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 24px;
    letter-spacing: 0;
}

h3 {
    margin-bottom: 4px;
    font-size: 15px;
}

.page-title {
    margin: 0;
    font-size: 30px;
}

.status-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 10px 28px rgba(16, 22, 35, .055);
    padding: 14px 16px;
}

.status-summary > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-summary strong {
    color: var(--ink);
    font-size: 16px;
}

.status-summary-text {
    display: grid;
    gap: 2px;
}

.status-summary-text em {
    color: #667085;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.service-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.service-tags span {
    border: 1px solid #dfe8f2;
    border-radius: 999px;
    background: #f8fbff;
    color: #475569;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 900;
}

.status-summary-text em.soft {
    color: #8a95a5;
    font-weight: 700;
}

.status-summary small,
.status-summary p {
    margin: 0;
    color: #667085;
    font-size: 13px;
}

.muted,
td small { color: var(--muted); }

.pulse {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 14%, transparent);
    animation: statusBlink 1.8s ease-in-out infinite;
}

.green { color: #159447; }
.yellow { color: #b7791f; }
.orange { color: #c05621; }
.red { color: #c53030; }
.blue { color: #087ea4; }
.gray { color: #64748b; }

.section-band {
    margin: 14px 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 12px 32px rgba(16, 22, 35, .06);
}

.section-title,
.panel-head,
.incident-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.incident-state {
    display: grid;
    justify-items: end;
    gap: 3px;
}

.incident-state small {
    color: #8a95a5;
    font-size: 11px;
    font-weight: 800;
}

.soft-count {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 800;
}

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

.service-group {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 26px rgba(16, 22, 35, .045);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.service-group:hover {
    border-color: rgba(0, 169, 214, .28);
    box-shadow: 0 16px 36px rgba(16, 22, 35, .075);
    transform: translateY(-1px);
}

.service-group > h3 {
    margin: 0;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fbfcff, #f5f8fc);
}

.service-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px 14px 18px;
    border-bottom: 1px solid var(--line);
    position: relative;
    transition: background .18s ease;
    overflow: hidden;
}

.service-row.green {
    background: linear-gradient(90deg, rgba(21, 148, 71, .055), #fff 46%);
}

.service-row.yellow {
    background: linear-gradient(90deg, rgba(183, 121, 31, .12), #fff 48%);
}

.service-row.orange {
    background: linear-gradient(90deg, rgba(192, 86, 33, .13), #fff 48%);
}

.service-row.red {
    background: linear-gradient(90deg, rgba(197, 48, 48, .13), #fff 48%);
}

.service-row.blue {
    background: linear-gradient(90deg, rgba(8, 126, 164, .12), #fff 48%);
}

.service-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 13px;
    bottom: 13px;
    width: 3px;
    border-radius: 0 999px 999px 0;
    background: currentColor;
    animation: serviceGlow 2.2s ease-in-out infinite;
}

.service-row::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, currentColor 5%, transparent), transparent);
    opacity: 0;
    transform: translateX(-35%);
    transition: opacity .18s ease, transform .28s ease;
    pointer-events: none;
}

.service-row:hover::after {
    opacity: 1;
    transform: translateX(35%);
}

.service-row > div {
    color: var(--ink);
}

.service-row:last-child {
    border-bottom: 0;
}

.service-row span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.status-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 900;
    animation: pillBreath 2.4s ease-in-out infinite;
}

.status-pill.green {
    border: 1px solid rgba(21, 148, 71, .22);
    background: #eefaf3;
    color: #13763b;
}

.status-pill.yellow {
    border: 1px solid rgba(183, 121, 31, .28);
    background: #fff7df;
    color: #8a5a12;
}

.status-pill.orange {
    border: 1px solid rgba(192, 86, 33, .28);
    background: #fff1e8;
    color: #9a4319;
}

.status-pill.red {
    border: 1px solid rgba(197, 48, 48, .28);
    background: #fff0f0;
    color: #a32727;
}

.status-pill.blue {
    border: 1px solid rgba(8, 126, 164, .26);
    background: #eaf8fc;
    color: #086986;
}

.status-pill.gray {
    border: 1px solid rgba(100, 116, 139, .24);
    background: #f3f6f9;
    color: #475569;
}

@keyframes serviceGlow {
    0%, 100% {
        opacity: .72;
        box-shadow: 0 0 0 color-mix(in srgb, currentColor 0%, transparent);
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 10px color-mix(in srgb, currentColor 34%, transparent);
    }
}

@keyframes pillBreath {
    0%, 100% {
        filter: saturate(1);
    }

    50% {
        filter: saturate(1.16);
    }
}

.timeline {
    display: grid;
    gap: 10px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff, #fbfcff);
    box-shadow: 0 8px 22px rgba(16, 22, 35, .04);
}

.timeline.refined {
    gap: 9px;
}

.timeline-item.current {
    border-left: 3px solid currentColor;
}

.timeline-item.history,
.timeline-item.maintenance {
    box-shadow: none;
}

.timeline-item p {
    margin-bottom: 6px;
    color: #475569;
}

.timeline-item time {
    color: var(--muted);
    font-size: 13px;
}

.incident-updates,
.update-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.incident-updates {
    border-top: 1px solid #e6edf5;
    padding-top: 12px;
}

.incident-updates article {
    position: relative;
    border: 1px solid #e2eaf3;
    border-left: 4px solid #b8c7d9;
    border-radius: 8px;
    background: #f9fbfe;
    padding: 12px 14px;
}

.incident-updates article::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 14px;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #b8c7d9;
}

.update-list article {
    border-left: 2px solid #d8e2ee;
    border-radius: 0 8px 8px 0;
    background: #f8fbff;
    padding: 10px 12px;
}

.update-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.update-meta time {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.incident-updates p,
.update-list p {
    margin: 0;
    color: #334155;
    font-size: 13px;
}

.update-list {
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.update-list h3 {
    margin: 0;
}

.dot {
    width: 9px;
    height: 9px;
    margin-top: 6px;
    border-radius: 999px;
    background: currentColor;
    animation: statusBlink 1.8s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .42;
        transform: scale(.82);
    }
}

@media (prefers-reduced-motion: reduce) {
    .pulse,
    .dot,
    .service-row::before,
    .status-pill {
        animation: none;
    }

    .service-group,
    .service-row,
    .service-row::after {
        transition: none;
    }
}

.empty-state {
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 16px;
    color: var(--muted);
    background: #fff;
}

.empty-state.success {
    border-color: rgba(21, 148, 71, .28);
    background: #f3fbf6;
    color: #177245;
}

.history-list[hidden] {
    display: none;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    padding: 24px 0 40px;
    color: var(--muted);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.pagination span {
    color: #64748b;
    font-size: 13px;
    font-weight: 900;
}

.back-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(221, 229, 239, .95);
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 14px 34px rgba(16, 22, 35, .16);
    color: var(--brand);
    cursor: pointer;
    font: 900 18px/1 var(--font);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease, background .18s ease;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #fff;
}

.button {
    border: 0;
    background: linear-gradient(135deg, var(--brand), #087ea4);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.button.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.button.secondary {
    border: 1px solid var(--line);
    background: #fff;
    color: #334155;
}

.button.danger {
    background: #c53030;
}

.button.tiny {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.notice {
    margin-bottom: 16px;
    border-radius: var(--radius);
    padding: 12px 14px;
    background: #eafaf0;
    color: #166534;
    font-weight: 700;
}

.notice.danger {
    background: #fff1f2;
    color: #be123c;
}

.notice.warning {
    background: #fffbeb;
    color: #92400e;
}

.setup-page,
.login-page {
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background:
        linear-gradient(135deg, rgba(16, 22, 35, .94), rgba(51, 42, 145, .88), rgba(0, 169, 214, .72)),
        #101623;
}

.setup-card,
.login-card,
.panel,
.metric-grid article {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow);
}

.setup-card,
.login-card {
    width: min(760px, 100%);
    padding: 30px;
}

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

.setup-logo {
    width: 160px;
    margin-bottom: 22px;
}

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

.form-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stack-form {
    display: grid;
    gap: 14px;
}

label,
fieldset {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
    font: inherit;
}

textarea {
    resize: vertical;
}

.wide {
    grid-column: 1 / -1;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkline input,
.check-grid input {
    width: auto;
    min-height: auto;
}

.check-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}

.check-grid legend {
    padding: 0 8px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    background:
        linear-gradient(135deg, rgba(51, 42, 145, .07), transparent 34%),
        #f5f7fb;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    padding: 22px;
}

.admin-sidebar .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
}

.admin-nav {
    display: grid;
    gap: 6px;
}

.admin-nav a {
    justify-content: flex-start;
}

.admin-nav a.active {
    background: linear-gradient(135deg, rgba(51, 42, 145, .12), rgba(0, 169, 214, .1));
    color: var(--brand);
}

.admin-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
}

.admin-main {
    width: min(1180px, calc(100% - 32px));
    padding: 28px 0 42px;
}

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

.admin-top h1 {
    margin-bottom: 0;
    font-size: 32px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-grid article {
    padding: 18px;
    border-top: 4px solid var(--brand-2);
}

.metric-grid span {
    color: var(--muted);
    font-weight: 800;
}

.metric-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 34px;
}

.panel {
    padding: 20px;
    margin-bottom: 18px;
}

.table-wrap {
    overflow-x: auto;
}

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

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td strong,
td small {
    display: block;
}

.actions {
    text-align: right;
    white-space: nowrap;
}

.actions form {
    display: inline-flex;
    margin: 0 0 0 8px;
    vertical-align: middle;
}

.actions > .button {
    vertical-align: middle;
}

@media (max-width: 820px) {
    main {
        display: flex;
        flex-direction: column;
    }

    .incident-current {
        order: 1;
    }

    .maintenance-section {
        order: 2;
    }

    .status-summary {
        order: 0;
    }

    #services {
        order: 4;
    }

    .incident-history {
        order: 5;
    }

    .site-header,
    .section-title,
    .panel-head,
    .admin-top {
        align-items: stretch;
        flex-direction: column;
    }

    .site-header,
    .service-row,
    .incident-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-header {
        margin-top: 10px;
        padding: 12px;
    }

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

    .brand span {
        display: none;
    }

    .status-summary {
        align-items: flex-start;
        flex-direction: column;
        margin-top: 12px;
    }

    .form-grid,
    .form-grid.compact,
    .check-grid,
    .metric-grid,
    .service-groups,
    .hero-stats {
        grid-template-columns: 1fr;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
    }

    .admin-sidebar .brand {
        flex-direction: row;
        align-items: center;
    }

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

@media (max-width: 520px) {
    .site-header,
    .site-footer,
    main,
    .admin-main {
        width: min(100% - 20px, 1120px);
    }

    h1 {
        font-size: 30px;
    }

    h2 {
        font-size: 21px;
    }

    .page-title {
        font-size: 25px;
    }

    .section-band,
    .panel,
    .setup-card,
    .login-card {
        padding: 16px;
    }

    .brand {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .brand img {
        width: 112px;
    }

    .status-summary {
        padding: 13px;
    }

    .actions {
        white-space: normal;
    }

    .actions form,
    .actions > .button {
        margin: 4px 0 0;
    }
}
