@import url('https://fonts.bunny.net/css?family=instrument-sans:400,500,600,700|space-grotesk:500,700');

:root {
    color-scheme: dark;
    --bg: #050b08;
    --bg-deep: #020604;
    --panel: rgba(10, 18, 14, 0.84);
    --panel-strong: rgba(12, 24, 18, 0.96);
    --panel-muted: rgba(8, 16, 12, 0.92);
    --text: #ecfff2;
    --muted: #87a793;
    --line: rgba(77, 255, 163, 0.14);
    --line-strong: rgba(77, 255, 163, 0.24);
    --accent: #39ff90;
    --accent-strong: #0df072;
    --accent-soft: rgba(57, 255, 144, 0.12);
    --accent-glow: 0 0 0 1px rgba(57, 255, 144, 0.22), 0 0 28px rgba(13, 240, 114, 0.14);
    --danger: #ff6b6b;
    --danger-soft: rgba(255, 107, 107, 0.12);
    --success: #39ff90;
    --success-soft: rgba(57, 255, 144, 0.12);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --shadow-lg: 0 26px 60px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.34);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Instrument Sans', 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(57, 255, 144, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(11, 104, 49, 0.24), transparent 24%),
        linear-gradient(180deg, #06110b 0%, var(--bg) 44%, var(--bg-deep) 100%);
    position: relative;
}

body.menu-open {
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(57, 255, 144, 0.03), rgba(57, 255, 144, 0.03)),
        linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(57, 255, 144, 0.03) calc(100% - 1px)),
        linear-gradient(transparent 0, transparent calc(100% - 1px), rgba(57, 255, 144, 0.03) calc(100% - 1px));
    background-size: auto, 24px 24px, 24px 24px;
    opacity: 0.65;
}

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

img {
    max-width: 100%;
    display: block;
}

code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    background: rgba(57, 255, 144, 0.08);
    border: 1px solid rgba(57, 255, 144, 0.16);
    color: #cbffde;
    padding: 0.14rem 0.36rem;
    border-radius: 8px;
}

small,
.muted,
.eyebrow,
.field span,
.field-hint {
    color: var(--muted);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.7rem;
}

.shell {
    min-height: 100vh;
    display: grid;
    align-items: start;
}

.mobile-toolbar {
    position: sticky;
    top: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    backdrop-filter: blur(18px);
    background: rgba(6, 13, 10, 0.84);
    border-bottom: 1px solid rgba(77, 255, 163, 0.12);
}

.mobile-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.24), transparent 42%),
        linear-gradient(135deg, #0b1a12 0%, #0b4122 35%, #39ff90 100%);
    color: #02110b;
    font-weight: 800;
    box-shadow: var(--accent-glow);
}

.mobile-brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-brand-copy strong {
    font-family: 'Space Grotesk', 'Instrument Sans', sans-serif;
    letter-spacing: -0.03em;
    line-height: 1.02;
}

.mobile-brand-copy small {
    line-height: 1.1;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(2, 6, 4, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    z-index: 59;
}

body.menu-open .mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.sidebar,
.card,
.stat-card,
.auth-card {
    backdrop-filter: blur(20px);
    background: linear-gradient(180deg, rgba(12, 23, 17, 0.88), rgba(7, 13, 10, 0.92));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 320px);
    z-index: 65;
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 16px 14px 18px;
    border-left: 0;
    border-top: 0;
    border-bottom: 0;
    overflow-y: auto;
    transform: translateX(-104%);
    transition: transform 220ms ease;
}

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

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

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.26), transparent 42%),
        linear-gradient(135deg, #0b1a12 0%, #0b4122 35%, #39ff90 100%);
    color: #02110b;
    font-weight: 800;
    box-shadow: var(--accent-glow);
}

.brand strong,
.section-heading h2,
.topbar h1,
.auth-card h1,
.stat-card strong {
    font-family: 'Space Grotesk', 'Instrument Sans', sans-serif;
    letter-spacing: -0.03em;
}

.brand span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.brand strong {
    font-size: 1rem;
    line-height: 1.05;
}

.brand small {
    line-height: 1.1;
}

.nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.nav a {
    min-height: 50px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(77, 255, 163, 0.12);
    background: rgba(9, 17, 13, 0.88);
    color: #d7efe0;
    transition: 180ms ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    line-height: 1.1;
    text-align: left;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.nav a:hover,
.nav a.is-active {
    color: var(--accent);
    border-color: rgba(57, 255, 144, 0.34);
    background:
        linear-gradient(135deg, rgba(57, 255, 144, 0.14), rgba(57, 255, 144, 0.06)),
        rgba(8, 15, 12, 0.98);
    box-shadow: 0 0 0 1px rgba(57, 255, 144, 0.18), 0 10px 24px rgba(13, 240, 114, 0.12);
}

.sidebar-footer {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(8, 17, 12, 0.88), rgba(6, 12, 9, 0.96));
    border: 1px solid rgba(77, 255, 163, 0.12);
}

.sidebar-user {
    min-width: 0;
}

.sidebar-user p,
.sidebar-user strong,
.sidebar-user small {
    margin: 0;
    display: block;
    line-height: 1.1;
}

.sidebar-user small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer form {
    margin: 0;
}

.content {
    width: min(100%, 1320px);
    margin: 0 auto;
    display: grid;
    gap: 14px;
    padding: 12px 14px 20px;
}

.topbar {
    display: grid;
    gap: 8px;
}

.topbar h1 {
    margin: 2px 0 0;
    font-size: clamp(1.75rem, 6.3vw, 3rem);
    line-height: 0.98;
}

.topbar-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.76rem;
    border: 1px solid rgba(77, 255, 163, 0.12);
    background: rgba(57, 255, 144, 0.08);
    color: #d9ffe6;
}

.badge-success,
.badge-live {
    color: var(--accent);
    background: rgba(57, 255, 144, 0.08);
    border-color: rgba(57, 255, 144, 0.26);
    box-shadow: 0 0 18px rgba(13, 240, 114, 0.12);
}

.badge-muted {
    color: var(--muted);
    background: rgba(135, 167, 147, 0.08);
    border-color: rgba(135, 167, 147, 0.14);
    box-shadow: none;
}

.stats-grid,
.card-grid,
.form-grid,
.architecture {
    display: grid;
    gap: 14px;
}

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

.stat-card,
.card,
.auth-card {
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.stat-card::before,
.card::before,
.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(57, 255, 144, 0.08), transparent 34%);
}

.stat-card {
    padding: 18px;
    display: grid;
    gap: 8px;
}

.stat-card small {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.68rem;
}

.stat-card strong {
    font-size: 2rem;
}

.card {
    padding: 16px;
}

.section-heading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
}

.section-heading h2 {
    margin: 6px 0 0;
    font-size: 1.35rem;
}

.button {
    min-height: 44px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 13px;
    font: inherit;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:focus-visible,
.menu-toggle:focus-visible,
.menu-close:focus-visible,
.mobile-backdrop:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(57, 255, 144, 0.2), 0 0 0 5px rgba(57, 255, 144, 0.08);
}

.button-primary {
    color: #031009;
    border-color: rgba(57, 255, 144, 0.32);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 42%),
        linear-gradient(135deg, #17ff7d 0%, #39ff90 52%, #8dffb9 100%);
    box-shadow: 0 14px 30px rgba(13, 240, 114, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.button-secondary {
    color: #e7fff0;
    border-color: rgba(57, 255, 144, 0.16);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 60%),
        rgba(8, 15, 12, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.button-secondary:hover {
    border-color: rgba(57, 255, 144, 0.3);
    box-shadow: 0 12px 26px rgba(13, 240, 114, 0.08);
}

.button-danger {
    color: #ffd0d0;
    border-color: rgba(255, 107, 107, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 60%),
        rgba(54, 18, 18, 0.78);
}

.button-danger:hover {
    box-shadow: 0 12px 24px rgba(255, 107, 107, 0.12);
}

.button-block {
    width: 100%;
}

.menu-toggle,
.menu-close {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(57, 255, 144, 0.14);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 60%),
        rgba(8, 15, 12, 0.94);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.menu-toggle:hover,
.menu-close:hover {
    transform: translateY(-1px);
    border-color: rgba(57, 255, 144, 0.28);
    box-shadow: 0 12px 26px rgba(13, 240, 114, 0.08);
}

.menu-toggle {
    flex-direction: column;
    gap: 4px;
}

.menu-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.menu-close {
    font-size: 1.5rem;
    line-height: 1;
}

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

.list-card,
.architecture-step {
    position: relative;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(57, 255, 144, 0.12);
    background: linear-gradient(180deg, rgba(8, 18, 12, 0.92), rgba(6, 12, 9, 0.96));
}

.list-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.list-card p,
.architecture-step p,
.lead,
.callout p {
    margin: 4px 0 0;
    line-height: 1.62;
    color: var(--muted);
}

.table-wrap {
    overflow: visible;
}

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

.table thead {
    display: none;
}

.table tbody {
    display: grid;
    gap: 10px;
}

.table tr {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(57, 255, 144, 0.12);
    background: linear-gradient(180deg, rgba(8, 17, 12, 0.96), rgba(6, 12, 9, 1));
}

.table td {
    display: grid;
    grid-template-columns: minmax(96px, 0.62fr) minmax(0, 1fr);
    gap: 8px;
    padding: 0;
    border: 0;
    font-size: 0.95rem;
}

.table td::before {
    content: attr(data-label);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.68rem;
}

.table .actions-cell {
    display: block;
}

.table .actions-cell::before {
    display: none;
}

.action-cluster {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid rgba(57, 255, 144, 0.12);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 55%),
        rgba(8, 15, 12, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    max-width: 100%;
    width: max-content;
}

.action-cluster > a,
.action-cluster > form {
    width: auto;
    flex: 0 0 auto;
}

.action-cluster > form {
    margin: 0;
}

.action-cluster > form .button,
.action-cluster > a.button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 12px;
    font-size: 0.92rem;
}

.action-button-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.action-button-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.action-button-label {
    display: none;
    white-space: nowrap;
}

.action-cluster > a.button.button-secondary {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 62%),
        rgba(10, 19, 15, 0.98);
}

.action-cluster > form .button-danger {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 62%),
        rgba(58, 20, 20, 0.84);
}

.empty {
    text-align: left;
    color: var(--muted);
}

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

.field {
    display: grid;
    gap: 8px;
}

.field-hint {
    display: block;
    line-height: 1.5;
    font-size: 0.84rem;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    appearance: none;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(57, 255, 144, 0.16);
    background: rgba(6, 14, 10, 0.92);
    color: var(--text);
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.field textarea {
    min-height: 132px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: rgba(57, 255, 144, 0.4);
    box-shadow: var(--accent-glow);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(57, 255, 144, 0.12);
    background: rgba(6, 14, 10, 0.76);
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.align-end {
    align-self: stretch;
}

.form-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

.alert,
.callout {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(57, 255, 144, 0.12);
}

.alert ul {
    margin: 10px 0 0;
    padding-left: 18px;
}

.alert-success {
    background: var(--success-soft);
    color: #beffd7;
    box-shadow: inset 0 0 0 1px rgba(57, 255, 144, 0.06);
}

.alert-danger {
    background: var(--danger-soft);
    color: #ffd7d7;
}

.architecture-step strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.02rem;
}

.auth-body {
    display: grid;
    place-items: center;
    padding: 16px;
}

.auth-shell {
    width: min(100%, 1080px);
}

.auth-card {
    padding: 22px;
    display: grid;
    gap: 20px;
}

.auth-card h1 {
    margin: 8px 0 0;
    font-size: clamp(2.2rem, 9vw, 4.2rem);
    line-height: 0.94;
}

.callout {
    background: linear-gradient(180deg, rgba(8, 16, 12, 0.94), rgba(5, 10, 8, 0.98));
}

@media (min-width: 720px) {
    .content,
    .auth-card {
        padding: 20px;
    }

    .mobile-toolbar {
        padding: 14px 18px;
    }

    .topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
    }

    .section-heading {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

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

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

    .form-actions {
        flex-direction: row;
        justify-content: flex-end;
    }

}

@media (min-width: 1120px) {
    body.menu-open {
        overflow: auto;
    }

    .mobile-toolbar,
    .mobile-backdrop,
    .menu-close {
        display: none;
    }

    .shell {
        grid-template-columns: 300px minmax(0, 1fr);
    }

    .sidebar {
        position: sticky;
        top: 0;
        left: auto;
        bottom: auto;
        width: auto;
        min-height: 100vh;
        padding: 24px;
        gap: 22px;
        border-right: 1px solid var(--line);
        border-bottom: 0;
        align-content: start;
        transform: none;
    }

    .sidebar-head {
        align-items: center;
    }

    .content {
        padding: 18px 28px 28px;
        gap: 18px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(260px, 1.2fr);
    }

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

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

    .list-card {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .table thead {
        display: table-header-group;
    }

    .table tbody {
        display: table-row-group;
    }

    .table tr {
        display: table-row;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .table td,
    .table th {
        padding: 14px 10px;
        border-bottom: 1px solid rgba(57, 255, 144, 0.08);
        text-align: left;
        vertical-align: top;
    }

    .table td {
        display: table-cell;
        font-size: 0.95rem;
    }

    .table td::before {
        display: none;
    }

    .table th {
        color: var(--muted);
        font-weight: 600;
        font-size: 0.82rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }

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

    .actions-cell {
        width: 176px;
        min-width: 176px;
        white-space: normal;
    }

    .table td.actions-cell {
        padding-top: 10px;
        padding-bottom: 10px;
        text-align: right;
    }

    .table td.actions-cell .action-cluster {
        margin-left: auto;
        max-width: none;
    }

    .sidebar-footer {
        margin-top: auto;
        display: grid;
        gap: 10px;
        align-items: stretch;
        justify-content: stretch;
    }
}
