:root {
    --bg-1: #f5efe4;
    --bg-2: #e8f1f6;
    --ink: #1f2430;
    --muted: #5a6374;
    --accent: #e86b2c;
    --accent-2: #1b998b;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-strong: #ffffff;
    --shadow: 0 20px 40px rgba(26, 31, 42, 0.12);
    --radius: 18px;
    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 48px;
    --font-display: "Palatino Linotype", "Book Antiqua", Palatino, serif;
    --font-body: "Trebuchet MS", "Gill Sans", "Verdana", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    min-height: 100vh;
}

.bg-orb {
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(0px);
    opacity: 0.45;
    z-index: 0;
}

.bg-orb--one {
    top: -120px;
    right: -120px;
    background: radial-gradient(circle at 30% 30%, #f7b267, transparent 70%);
    animation: float 12s ease-in-out infinite;
}

.bg-orb--two {
    bottom: -140px;
    left: -160px;
    background: radial-gradient(circle at 30% 30%, #7bdff2, transparent 70%);
    animation: float 14s ease-in-out infinite reverse;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(31, 36, 48, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31, 36, 48, 0.05) 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.4;
    z-index: 0;
}

.app-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

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

.app-shell--auth .main {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

.sidebar {
    padding: var(--space-5) var(--space-4);
    background: linear-gradient(160deg, #1f2430 0%, #2c2f3a 100%);
    color: #f4f4f4;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brand__mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(140deg, #f7b267, #e86b2c);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 22px;
    color: #1f2430;
    font-weight: 700;
}

.brand__text {
    display: flex;
    flex-direction: column;
}

.brand__name {
    font-family: var(--font-display);
    font-size: 18px;
}

.brand__tag {
    font-size: 12px;
    color: rgba(244, 244, 244, 0.7);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.nav-link {
    color: rgba(244, 244, 244, 0.82);
    text-decoration: none;
    padding: var(--space-2) var(--space-3);
    border-radius: 12px;
    background: transparent;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(4px);
}

.nav-link.is-active {
    background: rgba(232, 107, 44, 0.2);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(232, 107, 44, 0.6);
}

.sidebar__footer {
    margin-top: auto;
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.pill {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 12px;
}

.pill--outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.main {
    padding: var(--space-6) var(--space-6) var(--space-6) var(--space-5);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(31, 36, 48, 0.15);
    background: var(--panel);
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
    border-radius: 999px;
}

.sidenav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
}

body.nav-open {
    overflow: hidden;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.topbar h1 {
    font-family: var(--font-display);
    font-size: 32px;
    margin: 0 0 6px 0;
}

.hint {
    margin: 0;
    color: var(--muted);
}

.content {
    margin-top: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.card {
    background: var(--panel);
    border-radius: var(--radius);
    padding: var(--space-5);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.auth-screen {
    display: grid;
    gap: var(--space-3);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: var(--space-5);
    align-items: center;
}

.hero h2 {
    font-family: var(--font-display);
    font-size: 26px;
    margin: 0 0 var(--space-2) 0;
}

.lead {
    margin: 0 0 var(--space-4) 0;
    color: var(--muted);
}

.hero__stack {
    display: grid;
    gap: var(--space-3);
}

.stack-card {
    background: var(--panel-strong);
    border-radius: 14px;
    padding: var(--space-3);
    box-shadow: 0 12px 24px rgba(31, 36, 48, 0.12);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stack-card span {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-3);
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 12px 20px rgba(232, 107, 44, 0.3);
}

.btn--primary:hover {
    transform: translateY(-2px);
}

.btn--ghost {
    background: transparent;
    border: 1px solid rgba(31, 36, 48, 0.15);
    color: var(--ink);
}

.btn--ghost:hover {
    border-color: rgba(232, 107, 44, 0.6);
    color: var(--accent);
}

.badge {
    background: rgba(27, 153, 139, 0.16);
    color: var(--accent-2);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.meta {
    margin-top: var(--space-3);
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notice {
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: 12px;
    background: rgba(232, 107, 44, 0.08);
    color: var(--accent);
    font-size: 14px;
}

.list {
    padding-left: 18px;
    color: var(--muted);
    display: grid;
    gap: 8px;
}

.callout {
    margin-top: var(--space-3);
    padding: var(--space-3);
    border-radius: 14px;
    background: rgba(31, 36, 48, 0.05);
    display: grid;
    gap: 6px;
}

.callout__label {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--muted);
}

code {
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
    color: var(--ink);
    word-break: break-all;
}

.form {
    display: grid;
    gap: var(--space-3);
}

.section {
    display: grid;
    gap: var(--space-2);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid rgba(31, 36, 48, 0.08);
}

.section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.form-row {
    display: grid;
    gap: 6px;
}

.form-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

input,
select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(31, 36, 48, 0.15);
    font-family: var(--font-body);
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.checkbox input {
    accent-color: var(--accent);
}

small {
    color: var(--muted);
}

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

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

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(31, 36, 48, 0.1);
    font-size: 14px;
}

.table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

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

.table-row--active {
    background: rgba(27, 153, 139, 0.08);
}

.table-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

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

.cell-meta {
    color: var(--muted);
    font-size: 12px;
}

.btn--sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 10px;
}

.badge--status {
    text-transform: capitalize;
}

.badge--draft,
.badge--archived {
    background: rgba(31, 36, 48, 0.1);
    color: var(--muted);
}

.badge--failed,
.badge--rolled-back {
    background: rgba(232, 107, 44, 0.16);
    color: #e86b2c;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin: 0 0 4px 0;
}

.stagger > * {
    animation: rise 0.6s ease both;
}

.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.1s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(16px);
    }
}

@media (max-width: 960px) {
    .nav-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }

    .app-shell {
        grid-template-columns: 1fr;
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 260px;
        max-width: 82%;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 30;
        overflow-y: auto;
    }

    .app-shell.is-nav-open .sidebar {
        transform: translateX(0);
    }

    .sidenav-backdrop {
        display: block;
    }

    .app-shell.is-nav-open .sidenav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        width: 100%;
        min-width: 0;
    }

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

@media (min-width: 961px) {
    .main > .topbar,
    .main > .content {
        width: 100%;
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .topbar h1 {
        font-size: 26px;
    }

    .card__row {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        min-width: 0;
    }

    .topbar__actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar__actions > * {
        width: 100%;
        justify-content: center;
    }

    .actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .actions > * {
        width: 100%;
    }

    .actions input,
    .actions select,
    .actions button {
        width: 100%;
        max-width: 100%;
    }

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

@media (max-width: 600px) {
    .sidebar {
        width: 280px;
        max-width: calc(100% - 16px);
        padding: var(--space-3);
    }

    .main {
        padding: var(--space-3);
    }

    .card {
        padding: var(--space-4);
    }

    .brand__mark {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .topbar__actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar__actions > * {
        width: 100%;
        justify-content: center;
    }

    .sidebar__footer {
        display: none;
    }
}

@media (max-width: 420px) {
    .topbar h1 {
        font-size: 22px;
    }

    .card {
        padding: var(--space-3);
    }

    .brand__text {
        display: none;
    }

    .btn {
        padding: 9px 14px;
    }

    .pill {
        font-size: 11px;
        padding: 4px 10px;
    }

    .nav-toggle {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .nav-toggle span {
        width: 16px;
    }
}
