:root {
    color-scheme: dark;
    --app-bg: #0f0f10;
    --surface: #1f2022;
    --surface-2: #292b2f;
    --surface-3: #33363b;
    --sidebar: #2d2f34;
    --sidebar-strong: #050505;
    --line: #393b40;
    --line-strong: #46546a;
    --text: #f4f4f5;
    --muted: #a8abb3;
    --subtle: #777d89;
    --blue: #0ea5e9;
    --blue-strong: #16a3e8;
    --green: #20c775;
    --red: #f06464;
    --amber: #f4b84a;
    --sidebar-width: 230px;
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
        --app-bg: #f3f5f8;
        --surface: #ffffff;
        --surface-2: #f7f8fa;
        --surface-3: #eceff4;
        --sidebar: #f4f6f9;
        --sidebar-strong: #111827;
        --line: #d9dee8;
        --line-strong: #b7c3d6;
        --text: #1f2937;
        --muted: #566070;
        --subtle: #7b8494;
    }
}

* {
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-body {
    min-height: 100vh;
    margin: 0;
    background: var(--app-bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 18%, rgba(14, 165, 233, .12), transparent 34%),
        var(--app-bg);
}

.login-card {
    width: min(100%, 460px);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
    padding: 40px;
}

.login-brand {
    display: grid;
    justify-items: center;
    gap: 4px;
    margin-bottom: 34px;
    color: var(--text);
}

.login-wordmark {
    color: var(--text);
    font-size: 36px;
    line-height: .9;
    font-weight: 950;
    letter-spacing: -0.08em;
}

.login-subtitle {
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
}

.login-form {
    display: grid;
    gap: 18px;
}

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

.login-field label {
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
}

.login-input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    padding: 10px 13px;
    font-size: 15px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.login-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .18);
}

.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    box-shadow: 0 0 0 1000px var(--surface-2) inset;
    transition: background-color 9999s ease-in-out 0s;
}

.login-submit {
    min-height: 46px;
    border: 1px solid var(--blue);
    border-radius: 6px;
    background: var(--blue);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: filter .16s ease, transform .16s ease;
}

.login-submit:hover {
    filter: brightness(1.08);
}

.login-submit:active {
    transform: translateY(1px);
}

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

.dashboard-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    color: var(--text);
    overflow: visible;
}

.edition-banner {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--sidebar-strong);
    color: #fff;
    font-size: 17px;
    letter-spacing: .01em;
}

.edition-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #d7dce5;
    color: #111827;
    font-size: 13px;
    line-height: 1;
}

.brand-block {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 23px 24px;
}

.brand-link {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    color: inherit;
    text-decoration: none;
}

.brand-compact {
    display: none;
    color: #fff;
    font-size: 34px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: -0.08em;
}

.brand-wordmark {
    color: #fff;
    font-size: 42px;
    line-height: .9;
    font-weight: 950;
    letter-spacing: -0.08em;
}

@media (prefers-color-scheme: light) {
    .brand-wordmark {
        color: #18202b;
    }
}

.brand-subtitle {
    margin-top: 6px;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
}

.brand-subtitle::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 5px;
    background: #ff69d8;
}

.sidebar-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    background: rgba(0, 0, 0, .35);
    color: #dce3ef;
    font-weight: 800;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background .16s ease, transform .16s ease;
}

.lucide {
    display: block;
    height: 1em;
    width: 1em;
    color: inherit;
}

.sidebar-collapse:hover {
    background: rgba(255, 255, 255, .15);
}

.sidebar-collapse:active {
    transform: scale(0.92);
}

.dashboard-shell--collapsed,
.dashboard-sidebar--collapsed {
    --sidebar-width: 90px;
}

.dashboard-shell--collapsed .brand-wordmark,
.dashboard-sidebar--collapsed .brand-wordmark,
.dashboard-shell--collapsed .brand-subtitle,
.dashboard-sidebar--collapsed .brand-subtitle,
.dashboard-shell--collapsed .brand-subtitle::before,
.dashboard-sidebar--collapsed .brand-subtitle::before,
.dashboard-shell--collapsed .sidebar-label,
.dashboard-sidebar--collapsed .sidebar-label {
    display: none;
}

.dashboard-shell--collapsed .brand-compact,
.dashboard-sidebar--collapsed .brand-compact {
    display: inline-flex;
}

.dashboard-shell--collapsed .brand-block,
.dashboard-sidebar--collapsed .brand-block {
    justify-content: center;
    padding: 22px 0 26px;
}

.dashboard-shell--collapsed .sidebar-link,
.dashboard-sidebar--collapsed .sidebar-link {
    justify-content: center;
    width: 48px;
    min-height: 48px;
    padding: 9px;
}

.dashboard-shell--collapsed .sidebar-section-title,
.dashboard-sidebar--collapsed .sidebar-section-title,
.dashboard-shell--collapsed .endpoint-card .sidebar-label,
.dashboard-sidebar--collapsed .endpoint-card .sidebar-label,
.dashboard-sidebar--collapsed .sidebar-footer,
.dashboard-shell--collapsed .sidebar-footer {
    display: none;
}

.dashboard-shell--collapsed .edition-banner,
.dashboard-sidebar--collapsed .edition-banner {
    font-size: 0;
}

.dashboard-shell--collapsed .edition-icon,
.dashboard-sidebar--collapsed .edition-icon {
    font-size: 13px;
}

.dashboard-shell--collapsed .sidebar-collapse,
.dashboard-sidebar--collapsed .sidebar-collapse {
    position: absolute;
    top: 26px;
    right: -15px;
    z-index: 5;
    transform: rotate(.5turn);
}

.dashboard-shell--collapsed .endpoint-card,
.dashboard-sidebar--collapsed .endpoint-card {
    justify-content: center;
    width: 48px;
    min-height: 86px;
    margin: 22px auto 0;
    padding: 12px 0;
}

.dashboard-shell--collapsed .sidebar-nav,
.dashboard-sidebar--collapsed .sidebar-nav {
    justify-items: center;
    padding: 0 0;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
    padding: 0 24px;
}

.sidebar-link {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 6px;
    padding: 9px 14px;
    color: var(--text);
    font-size: 14px;
    text-decoration: none;
}

.sidebar-link--active {
    background: rgba(255, 255, 255, .13);
}

.sidebar-link--disabled {
    cursor: default;
    opacity: .75;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    color: #eef2f7;
}

@media (prefers-color-scheme: light) {
    .sidebar-icon {
        color: #273244;
    }
}

.sidebar-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-section-title {
    padding: 28px 38px 10px;
    color: var(--text);
    font-size: 17px;
}

.endpoint-card {
    margin: 0 24px;
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .08);
}

.docker-mark {
    width: 26px;
    height: 19px;
    color: #0ea5e9;
    font-size: 24px;
    line-height: .6;
}

.endpoint-card strong,
.endpoint-card span:last-child {
    display: block;
}

.endpoint-card strong {
    font-size: 17px;
}

.endpoint-card span:last-child {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.sidebar-footer {
    margin: auto 0 20px;
    padding: 0 38px;
    color: var(--muted);
    font-size: 12px;
}

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

.dashboard-topbar {
    min-height: 79px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 32px 0 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.breadcrumb-line {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #d8dce3;
    font-size: 17px;
    font-weight: 500;
}

@media (prefers-color-scheme: light) {
    .breadcrumb-line {
        color: #374151;
    }
}

.breadcrumb-home,
.breadcrumb-home svg {
    width: 18px;
    height: 18px;
    color: inherit;
}

.breadcrumb-separator {
    color: var(--subtle);
    font-size: 28px;
    line-height: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
}

.theme-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--muted);
    font-size: 12px;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .11);
    color: var(--text);
    font-weight: 700;
}

.topbar-user {
    font-size: 20px;
}

.logout-button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
}

.logout-button:hover,
.secondary-button:hover,
.table-action:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.dashboard-content {
    width: 100%;
    min-height: calc(100vh - 79px);
    padding: 15px 20px 40px;
}

.flash {
    margin: 0 0 14px;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
}

.flash--notice {
    border: 1px solid rgba(32, 199, 117, .35);
    background: rgba(32, 199, 117, .12);
    color: var(--green);
}

.flash--alert {
    border: 1px solid rgba(240, 100, 100, .35);
    background: rgba(240, 100, 100, .12);
    color: var(--red);
}

.home-page {
    display: grid;
    gap: 28px;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.page-heading h1 {
    margin: 0;
    color: var(--text);
    font-size: 23px;
    font-weight: 500;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.page-actions,
.quick-actions,
.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-actions {
    gap: 4px;
}

.quick-action {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--blue);
    padding: 0;
    cursor: pointer;
    transition: background .14s ease, color .14s ease;
}

.quick-action svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.quick-action:hover:not(:disabled) {
    background: rgba(14, 165, 233, .14);
}

.quick-action--success {
    color: var(--green);
}

.quick-action--success:hover:not(:disabled) {
    background: rgba(32, 199, 117, .14);
}

.quick-action--danger {
    color: var(--red);
}

.quick-action--danger:hover:not(:disabled) {
    background: rgba(240, 100, 100, .14);
}

.quick-action--disabled,
.quick-action:disabled {
    color: var(--subtle);
    cursor: not-allowed;
    opacity: .55;
}

.terminal-modal {
    width: min(95vw, 1100px);
    height: min(85vh, 700px);
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    background: #0f1115;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
    overflow: hidden;
}

.terminal-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #272a31;
    color: #4ade80;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.terminal-modal__close {
    border: 0;
    background: transparent;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
}

.terminal-modal__close:hover {
    color: #fff;
}

.terminal-modal__frame {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
}

.primary-button,
.secondary-button,
.table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 7px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.primary-button {
    border: 1px solid #fff;
    background: #fff;
    color: #171717;
    padding: 0 15px;
    font-size: 14px;
}

@media (prefers-color-scheme: light) {
    .primary-button {
        border-color: var(--blue);
        background: var(--blue);
        color: #fff;
    }
}

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

.secondary-button {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    padding: 0 14px;
    font-size: 14px;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface);
    overflow: hidden;
}

.summary-tile {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-right: 1px solid var(--line);
    color: var(--muted);
}

.summary-tile:last-child {
    border-right: 0;
}

.summary-tile--active {
    box-shadow: inset 0 -4px 0 var(--blue);
}

.summary-tile strong {
    color: var(--text);
    font-size: 32px;
    font-weight: 700;
}

.summary-tile span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: .03em;
}

.summary-dot,
.status-pill span {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.summary-dot--running,
.status-pill--running span {
    background: var(--green);
}

.summary-dot--stopped,
.status-pill--stopped span {
    background: var(--red);
}

.summary-dot--unknown,
.status-pill--unknown span {
    background: #8490a5;
}

.inventory-card,
.empty-state-card {
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: 0 14px 35px rgba(0, 0, 0, .16);
    overflow: hidden;
}

.inventory-toolbar {
    min-height: 89px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px;
}

.inventory-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inventory-title h2 {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
}

.inventory-title p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.inventory-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: #344157;
    color: #e8edf5;
}

.inventory-icon svg {
    width: 22px;
    height: 22px;
}

.inventory-search {
    width: min(100%, 260px);
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 13px;
    color: var(--muted);
}

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

.instances-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    color: var(--text);
}

.instances-table thead {
    background: var(--surface-3);
}

.instances-table th {
    padding: 13px 24px;
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.instances-table td {
    padding: 17px 24px;
    border-top: 1px solid var(--line);
    color: var(--text);
    font-size: 15px;
    vertical-align: middle;
}

.instances-table tbody tr:hover {
    background: rgba(14, 165, 233, .055);
}

.text-right {
    text-align: right !important;
}

.instance-cell {
    display: flex;
    align-items: center;
    gap: 13px;
}

.instance-logo {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(14, 165, 233, .18), rgba(32, 199, 117, .1));
    color: var(--blue);
    font-weight: 800;
    text-decoration: none;
    overflow: hidden;
}

.instance-logo img {
    max-width: 38px;
    max-height: 38px;
    object-fit: contain;
}

.instance-name,
.domain-link {
    color: var(--blue-strong);
    text-decoration: none;
}

.instance-name:hover,
.domain-link:hover {
    text-decoration: underline;
}

.container-name {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
}

.skip-badge {
    margin-left: 6px;
    border-radius: 5px;
    background: var(--surface-3);
    color: var(--muted);
    padding: 2px 6px;
    font-size: 11px;
}

.branch-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 5px;
    padding: 3px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    font-weight: 700;
}

.branch-badge--production {
    background: rgba(32, 199, 117, .16);
    color: #38e18b;
}

.branch-badge--main {
    background: rgba(14, 165, 233, .17);
    color: #45c4ff;
}

.branch-badge--develop {
    background: rgba(244, 184, 74, .18);
    color: #ffd076;
}

.branch-badge--default {
    background: var(--surface-3);
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 4px 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
}

.status-pill--running {
    background: var(--green);
}

.status-pill--stopped {
    background: var(--red);
}

.status-pill--unknown {
    background: #667085;
}

.status-pill span {
    background: currentColor;
    opacity: .72;
}

.config-state {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.config-state--ready {
    background: rgba(32, 199, 117, .12);
    color: var(--green);
}

.config-state--pending {
    background: rgba(244, 184, 74, .14);
    color: var(--amber);
}

.table-action {
    min-height: 30px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    padding: 0 9px;
    font-size: 12px;
}

.table-action--success {
    border-color: rgba(32, 199, 117, .35);
    color: var(--green);
}

.table-action--danger {
    border-color: rgba(240, 100, 100, .38);
    color: var(--red);
}

.empty-state-card {
    display: grid;
    place-items: center;
    gap: 12px;
    padding: 64px 24px;
    text-align: center;
}

.empty-state-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(14, 165, 233, .15);
    color: var(--blue);
    font-size: 28px;
    font-weight: 900;
}

.empty-state-card h2 {
    margin: 0;
    font-size: 22px;
}

.empty-state-card p {
    margin: 0 0 8px;
    color: var(--muted);
}

.empty-state-card code {
    color: var(--text);
}

@media (max-width: 980px) {
    .dashboard-shell {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        position: static;
        height: auto;
    }

    .brand-block {
        padding-bottom: 14px;
    }

    .sidebar-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding-bottom: 18px;
    }

    .sidebar-section-title,
    .endpoint-card,
    .sidebar-footer {
        display: none;
    }

    .dashboard-topbar,
    .page-heading,
    .inventory-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-topbar {
        padding: 16px 20px;
    }

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

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

    .summary-tile:nth-child(2) {
        border-right: 0;
    }

    .summary-tile:nth-child(n+3) {
        border-top: 1px solid var(--line);
    }
}

@media (max-width: 640px) {
    :root {
        --sidebar-width: 100%;
    }

    .brand-wordmark {
        font-size: 34px;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

    .dashboard-content {
        padding: 14px;
    }

    .summary-strip {
        grid-template-columns: 1fr;
    }

    .summary-tile,
    .summary-tile:nth-child(2) {
        border-right: 0;
        border-top: 1px solid var(--line);
    }

    .summary-tile:first-child {
        border-top: 0;
    }
}