:root {
    --bg: #000000;
    --surface: #0a0a0a;
    --surface-2: #111111;
    --surface-3: #161616;
    --border: #222222;
    --border-strong: #2d2d2d;
    --text: #ededed;
    --text-muted: #9a9a9a;
    --text-soft: #777777;
    --accent: #ffffff;
    --accent-strong: #f3f3f3;
    --success: #30a46c;
    --warning: #f5a623;
    --error: #e5484d;
    --info: #0091ff;
    --radius: 20px;
    --radius-lg: 28px;
    --radius-sm: 12px;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    --content-width: 1600px;
    --sidebar-width: 268px;
    color-scheme: dark;
}

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

html {
    background: var(--bg);
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(245, 166, 35, 0.08), transparent 28%),
        radial-gradient(circle at top right, rgba(0, 145, 255, 0.08), transparent 26%),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

body.no-scroll {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

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

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

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

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.eyebrow {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 0 0 0.25rem;
}

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

.login-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    max-width: 430px;
    padding: 2rem;
    width: 100%;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.login-brand img {
    border-radius: 18px;
    height: 64px;
    object-fit: cover;
    width: 64px;
}

.login-brand h1 {
    font-size: 28px;
    letter-spacing: -0.04em;
    margin: 0;
}

.login-copy {
    color: var(--text-muted);
    margin: 0 0 1.25rem;
}

.login-divider {
    background: var(--border);
    height: 1px;
    margin: 1.25rem 0;
}

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

.sidebar {
    background: rgba(10, 10, 10, 0.94);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 1rem;
    position: sticky;
    top: 0;
}

.sidebar-top {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.brand {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    display: flex;
    gap: 0.9rem;
    padding: 0;
    text-align: left;
}

.brand img {
    border-radius: 16px;
    height: 54px;
    width: 54px;
}

.brand strong {
    font-size: 20px;
    letter-spacing: -0.04em;
}

.sidebar-close,
.mobile-only {
    display: none;
}

.sidebar-nav {
    display: grid;
    gap: 0.35rem;
}

.nav-item {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    font-weight: 600;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    transition: 180ms ease;
}

.nav-item:hover,
.nav-item.is-active {
    background: var(--surface-3);
    border-color: var(--border);
    color: var(--text);
}

.nav-pill {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    min-width: 24px;
    padding: 0.15rem 0.45rem;
    text-align: center;
}

.nav-pill.danger {
    background: rgba(229, 72, 77, 0.16);
    color: #ff9aa1;
}

.sidebar-footer {
    display: grid;
    gap: 1rem;
    margin-top: auto;
}

.connection-stack {
    display: grid;
    gap: 0.55rem;
}

.connection-row {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    padding: 0.75rem 0.9rem;
}

.connection-meta {
    align-items: center;
    display: flex;
    gap: 0.6rem;
}

.dot {
    border-radius: 999px;
    height: 10px;
    width: 10px;
}

.dot.success { background: var(--success); box-shadow: 0 0 16px rgba(48, 164, 108, 0.5); }
.dot.warning { background: var(--warning); }
.dot.error { background: var(--error); }
.dot.muted { background: #555555; }

.sidebar-user {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    padding: 0.9rem 1rem;
}

.sidebar-user-label {
    color: var(--text-soft);
    margin: 0 0 0.15rem;
}

.badge {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    gap: 0.35rem;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.75rem;
    text-transform: uppercase;
}

.badge-neutral { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }
.badge-success { background: rgba(48, 164, 108, 0.16); color: #84d7ad; }
.badge-warning { background: rgba(245, 166, 35, 0.18); color: #ffd08a; }
.badge-danger { background: rgba(229, 72, 77, 0.18); color: #ff9aa1; }
.badge-info { background: rgba(0, 145, 255, 0.16); color: #8bc7ff; }

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    align-items: center;
    backdrop-filter: blur(14px);
    background: rgba(0, 0, 0, 0.75);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    padding: 1.2rem 1.6rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-left,
.topbar-actions {
    align-items: center;
    display: flex;
    gap: 1rem;
}

.topbar-left h2 {
    font-size: 28px;
    letter-spacing: -0.05em;
    margin: 0;
}

.page-description {
    color: var(--text-muted);
    margin: 0.2rem 0 0;
}

.content-shell {
    margin: 0 auto;
    max-width: var(--content-width);
    padding: 1.5rem;
    width: 100%;
}

.view {
    display: none;
    gap: 1.25rem;
}

.view.is-active {
    display: grid;
}

.section-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.section-grid-hero {
    align-items: stretch;
}

.card {
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    min-width: 0;
    overflow: hidden;
}

.card-span-4 { grid-column: span 4; }
.card-span-5 { grid-column: span 5; }
.card-span-7 { grid-column: span 7; }
.card-span-8 { grid-column: span 8; }
.card-span-12 { grid-column: span 12; }

.card-head {
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1.1rem;
}

.card-head h3 {
    font-size: 18px;
    letter-spacing: -0.03em;
    margin: 0;
}

.card-body {
    padding: 1rem 1.1rem 1.1rem;
}

.card-body.no-pad {
    padding: 0;
}

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

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

.stat-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    position: relative;
}

.stat-card::before {
    border-radius: 999px;
    content: "";
    height: 3px;
    left: 1rem;
    position: absolute;
    right: 1rem;
    top: 0.7rem;
}

.stat-card.info::before { background: var(--info); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.success::before { background: var(--success); }
.stat-card.danger::before { background: var(--error); }
.stat-card.neutral::before { background: rgba(255,255,255,0.2); }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.06em;
    margin-top: 0.6rem;
}

.stat-label {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.btn,
.icon-btn {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    gap: 0.5rem;
    justify-content: center;
    transition: 160ms ease;
}

.btn {
    padding: 0.75rem 1rem;
}

.btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
}

.btn:active,
.icon-btn:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.55rem 0.8rem;
}

.btn-primary {
    background: var(--accent);
    color: #050505;
}

.btn-primary:hover {
    background: var(--accent-strong);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover,
.segmented-btn:hover,
.tab-btn:hover {
    background: var(--surface-3);
}

.btn-ghost,
.icon-btn {
    background: transparent;
    border-color: var(--border);
    color: var(--text-muted);
}

.icon-btn {
    border-radius: 14px;
    font-size: 20px;
    height: 42px;
    width: 42px;
}

.btn-row,
.controls-row,
.pipeline-controls {
    display: flex;
    gap: 0.75rem;
}

.pipeline-controls,
.controls-row {
    align-items: flex-end;
    flex-wrap: wrap;
}

.segmented,
.tab-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    display: inline-flex;
    padding: 0.2rem;
}

.segmented-btn,
.tab-btn {
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 700;
    padding: 0.55rem 0.9rem;
}

.segmented-btn.is-active,
.tab-btn.is-active {
    background: var(--surface-3);
    color: var(--text);
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field span {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    min-height: 46px;
    padding: 0.8rem 0.9rem;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(255,255,255,0.45);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
    outline: none;
}

.field.compact {
    min-width: 190px;
}

.notice {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.85rem 1rem;
}

.notice.danger {
    background: rgba(229, 72, 77, 0.12);
    border-color: rgba(229, 72, 77, 0.25);
    color: #ffb0b4;
}

.notice.info {
    background: rgba(0, 145, 255, 0.12);
    border-color: rgba(0, 145, 255, 0.24);
    color: #9cd3ff;
}

.list-stack {
    display: grid;
    gap: 0.8rem;
}

.list-item,
.activity-item,
.approval-item,
.schedule-item,
.audit-item,
.user-item,
.backup-item,
.integration-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem;
}

.list-item-head,
.activity-head,
.approval-head,
.schedule-head,
.user-head,
.audit-head {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.list-item-title,
.approval-title,
.schedule-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.list-item-copy,
.activity-copy,
.approval-copy,
.schedule-copy {
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.meta-row {
    color: var(--text-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    margin-top: 0.65rem;
}

.meta-chip {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.empty-state {
    border: 1px dashed var(--border-strong);
    border-radius: 18px;
    color: var(--text-muted);
    padding: 2rem 1rem;
    text-align: center;
}

.table-wrap {
    overflow: auto;
}

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

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.95rem 1rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--text-soft);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background 160ms ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.table-footer {
    align-items: center;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    padding: 0.9rem 1rem;
}

.kanban-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(6, minmax(220px, 1fr));
    overflow: auto;
}

.kanban-column {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    min-width: 220px;
    padding: 0.75rem;
}

.kanban-column h4 {
    align-items: center;
    display: flex;
    font-size: 13px;
    justify-content: space-between;
    margin: 0 0 0.85rem;
    text-transform: uppercase;
}

.kanban-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 18px;
    cursor: pointer;
    margin-bottom: 0.7rem;
    padding: 0.85rem;
}

.kanban-card:last-child {
    margin-bottom: 0;
}

.modal-shell {
    align-items: center;
    backdrop-filter: blur(12px);
    background: rgba(0, 0, 0, 0.76);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1.25rem;
    position: fixed;
    z-index: 50;
}

.modal-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2.5rem);
    max-width: min(94vw, 760px);
    overflow: hidden;
    width: 100%;
}

.modal-card-sm { max-width: min(92vw, 560px); }
.modal-card-md { max-width: min(92vw, 720px); }
.modal-card-xl { max-width: min(96vw, 1120px); }

.modal-head {
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.1rem;
}

.modal-head h3 {
    font-size: 24px;
    letter-spacing: -0.04em;
    margin: 0;
}

.modal-body {
    overflow: auto;
    padding: 1rem 1.1rem 1.2rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.detail-panel {
    display: none;
    padding-top: 1rem;
}

.detail-panel.is-active {
    display: block;
}

.detail-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem;
}

.detail-card h4 {
    font-size: 12px;
    letter-spacing: 0.06em;
    margin: 0 0 0.75rem;
    text-transform: uppercase;
}

.detail-row {
    display: grid;
    gap: 0.2rem;
    margin-bottom: 0.7rem;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.timeline {
    display: grid;
    gap: 0.8rem;
}

.timeline-item {
    align-items: flex-start;
    display: flex;
    gap: 0.8rem;
}

.timeline-dot {
    border: 2px solid var(--border-strong);
    border-radius: 999px;
    flex-shrink: 0;
    height: 14px;
    margin-top: 0.25rem;
    width: 14px;
}

.timeline-dot.done { background: var(--success); border-color: var(--success); }
.timeline-dot.current { background: var(--warning); border-color: var(--warning); }
.timeline-dot.pending { background: transparent; }

.shortcut-list {
    display: grid;
    gap: 0.9rem;
}

.shortcut-list div {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.stack-split {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.grid-two {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.text-danger {
    color: #ff9aa1;
}

.text-success {
    color: #84d7ad;
}

.text-warning {
    color: #ffd08a;
}

.pre-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-muted);
    margin: 0;
    overflow: auto;
    padding: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.inline-link {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

kbd {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    min-width: 34px;
    padding: 0.35rem 0.55rem;
    text-align: center;
}

.toast-region {
    display: grid;
    gap: 0.75rem;
    inset: auto 1rem 1rem auto;
    position: fixed;
    width: min(420px, calc(100vw - 2rem));
    z-index: 80;
}

.toast {
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.35rem;
    padding: 0.95rem 1rem;
}

.toast.success { border-color: rgba(48, 164, 108, 0.35); }
.toast.error { border-color: rgba(229, 72, 77, 0.35); }
.toast.info { border-color: rgba(0, 145, 255, 0.35); }

.overlay-spinner {
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 90;
}

.spinner-card {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-width: 220px;
    padding: 1.4rem;
}

.spinner {
    animation: spin 900ms linear infinite;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: var(--accent);
    border-radius: 999px;
    height: 36px;
    width: 36px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    animation: pulse 1.2s ease-in-out infinite;
    background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.08), rgba(255,255,255,0.05));
    background-size: 200% 100%;
    border-radius: 14px;
    height: 16px;
}

@keyframes pulse {
    0% { background-position: 0 50%; }
    100% { background-position: 200% 50%; }
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pill {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    padding: 0.45rem 0.75rem;
}

.mobile-shadow {
    display: none;
}

@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

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

    .card-span-4,
    .card-span-5,
    .card-span-7,
    .card-span-8 {
        grid-column: span 6;
    }

    .kanban-grid {
        grid-template-columns: repeat(3, minmax(240px, 1fr));
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        inset: 0 auto 0 0;
        max-width: 320px;
        position: fixed;
        transform: translateX(-105%);
        transition: transform 180ms ease;
        width: min(88vw, 320px);
        z-index: 60;
    }

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

    .sidebar-close,
    .mobile-only {
        display: inline-flex;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
    }

    .topbar-left,
    .topbar-actions {
        width: 100%;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

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

    .card-span-4,
    .card-span-5,
    .card-span-7,
    .card-span-8,
    .card-span-12 {
        grid-column: span 1;
    }

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

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

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

    .table-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.8rem;
    }
}
