:root {
    --bg-base: #030712;
    --bg-elev: rgba(255, 255, 255, 0.05);
    --bg-elev-strong: rgba(255, 255, 255, 0.08);
    --line-soft: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --brand: #00c87a;
    --brand-strong: #00a967;
    --danger-soft: rgba(239, 68, 68, 0.16);
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --shadow-glass: 0 18px 40px rgba(2, 6, 23, 0.35);
    --shadow-soft: 0 10px 24px rgba(2, 6, 23, 0.25);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    color: var(--text-main);
    font-family: "Sora", "Inter", "Segoe UI", sans-serif;
    background: var(--bg-base);
}

.shell-backdrop {
    position: fixed;
    inset: -10%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(48% 38% at 0% 0%, rgba(0, 200, 122, 0.2), transparent 70%),
        radial-gradient(40% 34% at 100% 10%, rgba(34, 197, 94, 0.12), transparent 72%),
        radial-gradient(42% 35% at 50% 100%, rgba(17, 24, 39, 0.45), transparent 75%);
}

.mobile-nav-state {
    position: fixed;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.app-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.glass-panel,
.topbar-glass,
.main-panel,
.main-panel-sub,
.metric-card,
.table-wrap,
.modal-card {
    border: 1px solid var(--line-soft);
    background: linear-gradient(165deg, var(--bg-elev-strong), var(--bg-elev));
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-glass);
}

.sidebar-wrap {
    position: fixed;
    top: 20px;
    bottom: 20px;
    left: 20px;
    width: 280px;
    border-radius: var(--radius-xl);
    padding: 18px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
    z-index: 30;
}

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

.logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #052e1f;
    background: linear-gradient(145deg, #5df2b8, var(--brand));
    box-shadow: inset 0 -10px 22px rgba(5, 70, 45, 0.3);
}

.eyebrow {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #86efac;
}

.logo-title {
    margin: 3px 0 0;
    font-size: 18px;
    font-weight: 700;
}

.sidebar-nav {
    display: grid;
    gap: 9px;
    align-content: start;
}

.tab-btn {
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    min-height: 44px;
    padding: 10px 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    background: rgba(17, 24, 39, 0.46);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.tab-btn svg,
.btn svg,
.icon-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.tab-btn:hover {
    border-color: var(--line-strong);
    transform: translateX(2px);
    background: rgba(31, 41, 55, 0.58);
}

.tab-btn.active {
    border-color: rgba(0, 200, 122, 0.6);
    color: #d1fae5;
    background: linear-gradient(145deg, rgba(0, 200, 122, 0.18), rgba(17, 24, 39, 0.58));
}

.tab-btn-settings {
    border-color: rgba(251, 191, 36, 0.35);
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.12), rgba(17, 24, 39, 0.58));
}

.sidebar-foot {
    padding: 12px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 200, 122, 0.3);
    background: rgba(0, 200, 122, 0.08);
}

.status-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: #a7f3d0;
}

.status {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.status.ok {
    color: #6ee7b7;
}

.status.warn {
    color: #fbbf24;
}

.status.error {
    color: #fda4af;
}

.workspace-wrap {
    margin-left: 320px;
    min-height: 100vh;
    padding: 20px 20px 26px;
    display: grid;
    align-content: start;
    gap: 16px;
}

.topbar-glass {
    border-radius: var(--radius-xl);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title {
    margin: 4px 0 0;
    font-size: clamp(20px, 2.3vw, 28px);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.role-badge {
    border: 1px solid rgba(0, 200, 122, 0.45);
    border-radius: 999px;
    padding: 5px 10px;
    color: #bbf7d0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(0, 200, 122, 0.14);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #052e1f;
    background: linear-gradient(145deg, #6ee7b7, var(--brand));
}

.content-area {
    padding: 4px;
}

.tab-content {
    display: grid;
}

.tab-panel {
    display: none;
    gap: 14px;
}

.tab-panel.active {
    display: grid;
}

.main-panel,
.main-panel-sub,
.metric-card {
    border-radius: var(--radius-xl);
}

.main-panel {
    padding: 20px;
}

.main-panel-sub {
    padding: 14px;
}

.panel-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.metric-card {
    padding: 14px;
}

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

.metric-value {
    margin: 8px 0 0;
    font-size: 24px;
    font-weight: 700;
}

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

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

.input,
.textarea,
select {
    width: 100%;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    padding: 11px 12px;
    color: var(--text-main);
    background: rgba(17, 24, 39, 0.78);
    font-family: inherit;
    font-size: 14px;
}

.input:focus,
.textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(0, 200, 122, 0.6);
    box-shadow: 0 0 0 3px rgba(0, 200, 122, 0.16);
}

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

.checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.btn,
.icon-btn {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    min-height: 40px;
    padding: 9px 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    background: rgba(17, 24, 39, 0.8);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.btn:hover,
.icon-btn:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.icon-btn {
    width: 40px;
    padding: 0;
}

.btn-primary {
    color: #052e1f;
    border-color: rgba(0, 200, 122, 0.48);
    background: linear-gradient(145deg, var(--brand), var(--brand-strong));
    box-shadow: 0 10px 24px rgba(0, 200, 122, 0.25);
}

.btn-primary:hover {
    filter: brightness(1.04);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
}

.disabled-link {
    pointer-events: none;
    opacity: 0.5;
}

.table-wrap {
    border-radius: var(--radius-lg);
    overflow: auto;
}

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

.table-base th,
.table-base td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
}

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

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

.mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(2, 6, 23, 0.72);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.76);
}

.modal-card {
    width: min(680px, 100%);
    border-radius: var(--radius-xl);
    padding: 18px;
}

.modal-head,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.modal-actions {
    justify-content: flex-end;
    margin-top: 16px;
}

.is-skeleton {
    position: relative;
    overflow: hidden;
}

.is-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0) 100%);
    animation: shimmer 1.05s linear infinite;
}

@keyframes shimmer {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(100%);
    }
}

@media (max-width: 1023px) {
    .sidebar-wrap {
        left: 12px;
        top: 12px;
        bottom: 12px;
        width: min(84vw, 320px);
        transform: translateX(calc(-100% - 20px));
        transition: transform 0.24s ease;
    }

    #mobileNavToggle:checked ~ .app-shell .sidebar-wrap {
        transform: translateX(0);
    }

    #mobileNavToggle:checked ~ .app-shell .mobile-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .workspace-wrap {
        margin-left: 0;
        padding: 12px 12px 20px;
    }

    .topbar-right .btn {
        padding-inline: 10px;
    }

    .topbar-right .btn span {
        display: none;
    }

    .role-badge {
        display: none;
    }
}

@media (min-width: 1024px) {
    .mobile-overlay {
        display: none;
    }
}
