:root {
    --bg: #f8fafc;
    --paper: #fff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --green: #047857;
    --green-2: #d1fae5;
    --mint: #34d399;
    --navy: #020617;
    --amber: #9a5b08;
    --red: #a3342e;
    --shadow: 0 1px 2px rgb(15 23 42 / 5%);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
    color: var(--green);
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.app-page {
    min-height: 100vh;
}

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

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    border-right: 1px solid #1e293b;
    background: var(--navy);
    color: #f1f5f9;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 80px;
    padding: 0 24px;
    border-bottom: 1px solid #1e293b;
    color: #fff;
}

.sidebar-brand img {
    width: 44px;
    height: 44px;
    border-radius: 11px;
}

.sidebar-brand span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.sidebar-brand strong {
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.sidebar-brand small {
    color: #94a3b8;
    font-size: 12px;
}

.sidebar-nav,
.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
}

.nav-link {
    padding: 10px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 150ms ease, color 150ms ease;
}

.nav-link:hover {
    background: #1e293b;
    color: #fff;
}

.nav-link.active {
    background: var(--mint);
    color: #020617;
}

.sidebar-account {
    padding: 16px;
    border-top: 1px solid #1e293b;
}

.user-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
}

.user-summary > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.user-summary strong,
.user-summary small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-summary strong {
    color: #f1f5f9;
    font-size: 14px;
    font-weight: 500;
}

.user-summary small {
    color: #94a3b8;
    font-size: 12px;
}

.user-avatar {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    overflow: hidden;
    border: 1px solid #475569;
    border-radius: 50%;
    background: #1e293b;
    color: #94a3b8;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar svg {
    width: 100%;
    height: 100%;
    padding: 8px;
}

.logout-button {
    width: 100%;
    margin-top: 12px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
}

.logout-button:hover {
    background: #1e293b;
    color: #fff;
}

.app-main {
    min-width: 0;
}

.mobile-header {
    display: none;
}

.container {
    display: flex;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    flex-direction: column;
    padding: 40px;
}

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.page-heading h1 {
    margin: 3px 0 6px;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.025em;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--green) !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

.button.primary {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
}

.button.danger {
    border-color: #e6b8b5;
    color: var(--red);
}

.wide {
    width: 100%;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stats article,
.panel {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.stats article {
    padding: 22px;
}

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

.stats strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -.025em;
}

.stats .small-value {
    font-size: 18px;
}

.grid {
    display: grid;
    gap: 22px;
}

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

.panel {
    padding: 22px;
}

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

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

.panel-title h2 {
    margin: 0;
}

.row-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-top: 1px solid var(--line);
    color: var(--ink);
}

.row-card > div {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.row-card small,
td small {
    display: block;
    color: var(--muted);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #999;
}

.status-dot.online {
    background: #28a36b;
    box-shadow: 0 0 0 4px #e1f3ea;
}

.pill {
    display: inline-flex;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef0ed;
    color: #53605b;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pill.large {
    padding: 7px 13px;
    font-size: 13px;
}

.pill.ok,
.status-succeeded {
    background: var(--green-2);
    color: var(--green);
}

.pill.bad,
.status-failed {
    background: #fae6e5;
    color: var(--red);
}

.status-pending,
.status-claimed,
.status-running {
    background: #fff0d7;
    color: var(--amber);
}

.status-cancelled {
    background: #eee;
    color: #666;
}

.notice {
    margin-bottom: 20px;
    padding: 13px 16px;
    border-radius: 9px;
}

.notice.success {
    background: var(--green-2);
    color: var(--green);
}

.notice.error {
    background: #fae6e5;
    color: var(--red);
}

.empty {
    padding: 18px 0;
    color: var(--muted);
}

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

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

th {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
}

th,
td {
    padding: 13px 11px;
    border-bottom: 1px solid var(--line);
}

.details {
    display: grid;
    grid-template-columns: minmax(120px, .45fr) 1fr;
    margin: 0;
}

.details dt,
.details dd {
    margin: 0;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.details dt {
    color: var(--muted);
    text-transform: capitalize;
}

.details pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-grid label,
.inline-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.form-grid input,
.form-grid select,
.inline-form input {
    padding: 10px 11px;
    border: 1px solid #cfd6d1;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

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

.form-hint {
    padding: 12px;
    border-radius: 8px;
    background: #eef3ef;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 10px;
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 8px;
}

.danger-zone {
    margin-top: 20px;
}

.error-text {
    color: var(--red);
}

.login-page {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    overflow: hidden;
    padding: 48px 24px;
    background:
        radial-gradient(circle at 50% -20%, rgb(52 211 153 / 10%) 0, transparent 42%),
        radial-gradient(circle at 105% 110%, rgb(37 99 235 / 10%) 0, transparent 38%),
        #020617;
}

.login-card {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(512px, 100%);
    gap: 32px;
    padding: 48px;
    border: 1px solid rgb(51 65 85 / 70%);
    border-radius: 32px;
    background: rgb(15 23 42 / 65%);
    box-shadow: 0 25px 50px -12px rgb(2 6 23 / 70%);
    color: #f8fafc;
    text-align: center;
    backdrop-filter: blur(20px);
}

.login-intro {
    display: grid;
    justify-items: center;
    gap: 28px;
}

.login-logo-frame {
    display: flex;
    width: 128px;
    height: 128px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(51 65 85 / 80%);
    border-radius: 32px;
    background: rgb(15 23 42 / 50%);
    box-shadow: 0 20px 25px -5px rgb(6 78 59 / 20%);
}

.login-logo {
    display: block;
    width: 96px;
    height: 96px;
    border-radius: 24px;
}

.login-copy {
    display: grid;
    gap: 16px;
}

.login-product {
    margin: 0;
    color: var(--mint) !important;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .32em;
    text-transform: uppercase;
}

.login-card h1 {
    max-width: 420px;
    margin: 0 auto;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.025em;
}

.login-lead {
    margin: 0 !important;
    color: #94a3b8 !important;
    font-size: 18px;
    line-height: 1.75;
}

.login-error {
    border: 1px solid rgb(255 132 122 / 28%);
    background: rgb(122 35 41 / 37%) !important;
    color: #ffc5c0 !important;
    text-align: left;
}

.login-button {
    min-height: 56px;
    padding: 16px 20px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(90deg, #34d399, #5eead4);
    box-shadow: 0 10px 15px -3px rgb(6 78 59 / 30%);
    color: #020617;
    font-size: 16px;
    font-weight: 700;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.login-button:hover {
    box-shadow: 0 16px 44px rgb(39 217 158 / 30%);
    transform: translateY(-1px);
}

.login-button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 4px;
}

.login-provider {
    display: block;
    color: #64748b;
    font-size: 14px;
    overflow-wrap: anywhere;
}

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

    .sidebar {
        display: none;
    }

    .mobile-header {
        position: sticky;
        z-index: 20;
        top: 0;
        display: block;
        padding: 12px 16px;
        border-bottom: 1px solid var(--line);
        background: rgb(255 255 255 / 95%);
        backdrop-filter: blur(12px);
    }

    .mobile-header summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        cursor: pointer;
        list-style: none;
    }

    .mobile-header summary::-webkit-details-marker {
        display: none;
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        color: var(--ink);
        font-size: 16px;
        font-weight: 650;
    }

    .mobile-brand img {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .menu-button {
        padding: 6px 12px;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        color: #334155;
        font-size: 14px;
    }

    .mobile-nav {
        padding-top: 16px;
    }

    .mobile-nav .nav-link {
        color: #475569;
    }

    .mobile-nav .nav-link:hover {
        background: #f1f5f9;
        color: var(--ink);
    }

    .mobile-nav .nav-link.active {
        background: var(--mint);
        color: #020617;
    }

    .mobile-user {
        margin-top: 8px;
        padding: 12px;
        border-radius: 12px;
        background: #f1f5f9;
    }

    .mobile-user strong {
        color: var(--ink);
    }

    .mobile-user small {
        color: var(--muted);
    }

    .mobile-nav .logout-button {
        color: #475569;
    }

    .mobile-nav .logout-button:hover {
        background: #f1f5f9;
        color: var(--ink);
    }

    .container {
        padding: 24px;
    }

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

    .page-heading {
        align-items: start;
    }
}

@media (max-width: 560px) {
    .stats,
    .grid.two,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-heading {
        flex-direction: column;
    }

    .full {
        grid-column: auto;
    }

    .login-page {
        padding: 32px 16px;
    }

    .login-card {
        gap: 28px;
        padding: 32px 24px;
        border-radius: 32px;
    }

    .login-logo-frame {
        width: 112px;
        height: 112px;
        border-radius: 28px;
    }

    .login-logo {
        width: 84px;
        height: 84px;
        border-radius: 21px;
    }

    .login-intro {
        gap: 24px;
    }

    .login-card h1 {
        font-size: 30px;
    }

    .login-lead {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-button {
        transition: none;
    }
}
