:root {
    --bg: #f6f7f9;
    --panel: #fff;
    --line: #d9dee7;
    --text: #18202b;
    --muted: #687386;
    --accent: #1167b1;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

[x-cloak] {
    display: none !important;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 10px;
    align-items: center;
    min-height: 64px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
}

.brand {
    justify-self: center;
    font-weight: 800;
}

.sub,
.eyebrow,
.empty,
.meta span,
.row-card span {
    color: var(--muted);
}

.sub,
.eyebrow {
    font-size: 12px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 20px;
}

.logout {
    justify-self: end;
}

.sidebar {
    position: fixed;
    inset: 64px auto 0 0;
    z-index: 30;
    width: min(82vw, 280px);
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    border-right: 1px solid var(--line);
    background: #fff;
}

.sidebar.open {
    transform: translateX(0);
}

.scrim {
    position: fixed;
    inset: 64px 0 0;
    z-index: 25;
    background: rgba(15, 23, 42, 0.24);
}

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

.nav a {
    padding: 12px;
    border-radius: 8px;
    color: var(--muted);
    white-space: nowrap;
}

.nav a.active {
    background: #e8f1fb;
    color: var(--accent);
    font-weight: 700;
}

.main,
.state-page,
.state-panel {
    display: grid;
    align-content: start;
    gap: 14px;
}

.main {
    padding: 14px;
}

.eyebrow {
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.notice {
    margin: 0;
    color: #1b6b3a;
    font-size: 14px;
}

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

.stats article,
.panel,
.login-panel form {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.stats article {
    display: grid;
    gap: 4px;
    padding: 14px;
}

.stats span {
    color: var(--muted);
    font-size: 12px;
}

.stats strong {
    font-size: 26px;
}

.panel {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 12px;
}

.panel h2 {
    margin: 0;
    font-size: 16px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.panel-head a {
    color: var(--accent);
    font-size: 14px;
}

.work-grid {
    display: grid;
    gap: 14px;
}

.state-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.state-tabs .pure-button {
    flex: 1 1 88px;
}

.state-tabs .pure-button.active {
    background: #e8f1fb;
    color: var(--accent);
    font-weight: 700;
}

.state-tabs .pure-button:disabled {
    opacity: 0.45;
}

.compact-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}

.compact-form .form-fields {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 10px;
}

.compact-form .form-cell {
    flex: 1 1 140px;
    min-width: 140px;
}

.compact-form label.form-cell {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.compact-form label.form-cell>input,
.compact-form label.form-cell>select {
    min-width: 0;
}

.compact-form input,
.compact-form select,
.search-field input {
    width: 100%;
    min-height: 2rem;
}

.compact-form>.pure-button-primary {
    flex: 1 1 100%;
    width: 100%;
    margin-bottom: 0.25rem;
}

.compact-form>a.pure-button {
    flex: 1 1 100%;
    width: 100%;
    margin-bottom: 0.25rem;
}

.compact-form button {
    width: 100%;
}

.compact-form .form-fields button,
.compact-form .form-fields .pure-button {
    width: auto;
    align-self: flex-end;
    margin-bottom: 7px;
}

.compact-form .form-actions-inline button {
    width: auto;
}

.form-actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    padding-bottom: 0.3em;
}

.form-actions-inline>* {
    flex: 1 1 120px;
}

.search-panel {
    padding: 10px 12px;
}

.form-panel {
    padding: 10px 12px;
}

.search-form {
    margin: 0 -5px;
}

.search-field {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
    padding: 0 5px 10px;
    color: var(--muted);
    font-size: 13px;
}

.search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 5px 10px;
}

.search-actions>* {
    flex: 1 1 120px;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-top: 1rem;
}

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

.page-info {
    color: var(--muted);
    font-size: 13px;
}

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

.desktop-list {
    display: none;
}

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

.data-table {
    width: 100%;
    background: #fff;
}

.data-table th,
.data-table td {
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.data-table td {
    overflow-wrap: anywhere;
}

.data-table td.log-cell {
    white-space: normal;
}

.data-table tr.alert-row td {
    background: #fff7f6;
}

.data-table .action-col {
    width: 1%;
}

.pure-table-striped tr:nth-child(2n-1) td {
    background: transparent;
}

.pure-table-striped tr:nth-child(2n) td {
    background: #f7f8fa;
}

.row-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.row-card.alert-row {
    border-color: var(--danger);
    background: #fff7f6;
}

.row-card>div {
    min-width: 0;
}

.row-card-main>div {
    min-width: 0;
}

.row-card-main>.row-primary,
.row-card-main>.meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 4px;
}

.row-card strong,
.row-card b {
    overflow-wrap: anywhere;
}

.cell-link {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cell-copy-button {
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
}

.meta {
    font-size: 13px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
}

.row-actions-grid {
    margin: 0 -4px;
}

.row-actions-grid>div {
    padding: 0 4px;
}

.row-actions form {
    margin: 0;
}

.row-actions>* {
    flex: 1 1 84px;
    min-width: 0;
}

.row-actions .pure-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.35em;
    line-height: 1.2;
}

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

.op-panel {
    display: grid;
    gap: 12px;
}

.op-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.op-panel-head .notice {
    text-align: right;
}

.site-preview-frame {
    display: block;
    width: 100%;
    height: 70vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: clip;
    background: #fff;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.32);
}

.modal-panel {
    display: grid;
    gap: 12px;
    width: min(100%, 360px);
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.modal-panel h2,
.modal-panel p {
    margin: 0;
}

.modal-panel h2 {
    font-size: 16px;
}

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

.modal-actions .pure-button {
    width: auto;
    min-width: 0;
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 16px;
    background: #fff;
}

.login-panel {
    width: min(100%, 360px);
}

.login-panel form {
    display: grid;
    gap: 10px;
    padding: 18px;
}

.login-panel form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.login-panel input {
    width: 100%;
}

.login-panel h1 {
    margin: 0 0 8px;
}

@media (min-width: 48em) {
    .hub-shell {
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr);
        min-height: 100vh;
    }

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

    .brand {
        justify-self: start;
    }

    .icon-button,
    .scrim {
        display: none;
    }

    .sidebar {
        position: sticky;
        top: 64px;
        z-index: 1;
        width: max-content;
        height: calc(100vh - 64px);
        transform: none;
    }

    .main {
        padding: 20px;
    }

    .state-tabs .pure-button {
        flex: 0 0 auto;
    }

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

    .compact-form label.form-cell {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
    }

    .compact-form button {
        width: auto;
    }

    .form-actions-inline {
        flex-wrap: nowrap;
    }

    .form-actions-inline>* {
        flex: 0 0 auto;
    }

    .search-field {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
    }

    .search-actions {
        flex-wrap: nowrap;
    }

    .search-actions>* {
        flex: 0 0 auto;
    }

    .mobile-list {
        display: none;
    }

    .desktop-list {
        display: block;
    }

    .row-actions {
        display: flex;
        flex-wrap: nowrap;
        justify-content: end;
        margin-top: 0.5rem;
    }

    .row-actions>* {
        flex: 0 0 auto;
    }

    .row-actions .pure-button {
        width: auto;
    }
}
