:root {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: #172033;
    background: #f3f6fa;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    background: #f3f6fa;
}

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

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 440px);
    background: #fff;
    border: 1px solid #e4e9f1;
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(30, 45, 70, 0.08);
}

.brand,
.sidebar-brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand {
    margin-bottom: 28px;
}

.brand h1,
.brand p {
    margin: 0;
}

.brand p {
    color: #748096;
    margin-top: 4px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #183b6b;
    color: #fff;
    font-weight: 800;
    font-size: 22px;
}

.form-stack,
.dialog-card {
    display: grid;
    gap: 18px;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 600;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d8dfeb;
    border-radius: 9px;
    padding: 10px 12px;
    color: #172033;
    background: #fff;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #315f9d;
    box-shadow: 0 0 0 3px rgba(49, 95, 157, 0.1);
}

.button {
    border: 0;
    border-radius: 9px;
    padding: 10px 15px;
    font-weight: 700;
}

.button.primary {
    background: #183b6b;
    color: #fff;
}

.button.secondary {
    background: #edf1f6;
    color: #273750;
}

.button.danger {
    background: #fff0f0;
    color: #ad2222;
}

.button.full {
    width: 100%;
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
    background: #12233d;
    color: #fff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar-brand {
    padding: 0 8px 24px;
}

.sidebar-brand div:last-child {
    display: grid;
}

.sidebar-brand span {
    color: #9eb1cd;
    font-size: 12px;
    margin-top: 3px;
}

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

.nav-item {
    text-align: left;
    border: 0;
    border-radius: 9px;
    padding: 11px 12px;
    background: transparent;
    color: #c7d3e4;
}

.nav-item:hover,
.nav-item.active {
    background: #1d3555;
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 12px;
}

.current-user {
    color: #c7d3e4;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.content {
    padding: 28px;
    min-width: 0;
}

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

.topbar h1 {
    margin: 0 0 4px;
}

.muted {
    color: #748096;
}

.topbar p {
    margin: 0;
}

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

.metric-card {
    background: #fff;
    border: 1px solid #e4e9f1;
    border-radius: 14px;
    padding: 20px;
}

.metric-card span {
    display: block;
    color: #748096;
    font-size: 13px;
    margin-bottom: 9px;
}

.metric-card strong {
    font-size: 30px;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.toolbar input {
    max-width: 420px;
}

.recorder-toolbar select {
    width: auto;
    min-width: 150px;
}

.badge {
    margin-left: auto;
    white-space: nowrap;
    background: #e9eef5;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.table-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid #e4e9f1;
    border-radius: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 840px;
}

th,
td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid #edf0f5;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: #58677d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

td {
    font-size: 14px;
}

tr:last-child td {
    border-bottom: 0;
}

.status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status.ok {
    background: #e9f7ee;
    color: #267240;
}

.status.off {
    background: #f0f2f5;
    color: #687386;
}

.status.warn {
    background: #fff5dc;
    color: #8b650a;
}

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

.actions .button {
    padding: 7px 9px;
    font-size: 12px;
}

.message {
    border-radius: 9px;
    padding: 11px 13px;
    margin-bottom: 16px;
    font-size: 14px;
}

.message.error {
    background: #fff0f0;
    color: #9b1c1c;
    border: 1px solid #ffd2d2;
}

.message.success {
    background: #edf9f1;
    color: #236a3c;
    border: 1px solid #ccecd7;
}

dialog {
    width: min(92vw, 520px);
    border: 0;
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 30px 90px rgba(18, 35, 61, 0.25);
}

dialog::backdrop {
    background: rgba(18, 35, 61, 0.55);
}

.dialog-card {
    padding: 24px;
}

.dialog-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.dialog-card h2 {
    margin: 0;
}

.icon-button {
    border: 0;
    background: transparent;
    font-size: 28px;
    color: #6c7789;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

@media (max-width: 1000px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        min-height: auto;
    }

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

    .sidebar-footer {
        margin-top: 18px;
    }

    .content {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
    }

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

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar input,
    .recorder-toolbar select {
        max-width: none;
        width: 100%;
    }

    .badge {
        margin-left: 0;
        align-self: flex-start;
    }
}

/* EMSA Health Admin UI - physical site management */

.sort-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.sort-indicator {
    display: inline-block;
    min-width: 12px;
    margin-left: 3px;
    font-size: 9px;
}

.filter-row th {
    padding: 7px;
    background: #fbfcfe;
}

.filter-row input,
.filter-row select {
    min-width: 80px;
    padding: 7px 8px;
    font-size: 12px;
    text-transform: none;
}

.site-name-uppercase,
.uppercase-input {
    text-transform: uppercase;
}

input[readonly] {
    background: #f3f5f8;
    color: #66758a;
    cursor: default;
}
