:root {
    --color-slate: #64748b;
    --color-red: #ef4444;
    --color-orange: #f97316;
    --color-amber: #f59e0b;
    --color-emerald: #10b981;
    --color-teal: #14b8a6;
    --color-cyan: #06b6d4;
    --color-blue: #3b82f6;
    --color-indigo: #6366f1;
    --color-purple: #a855f7;
    --color-pink: #ec4899;
    --color-rose: #f43f5e;
}

/* Card theme accents -- applied to border-top */
.card-theme-slate   { border-top: 4px solid var(--color-slate); }
.card-theme-red     { border-top: 4px solid var(--color-red); }
.card-theme-orange  { border-top: 4px solid var(--color-orange); }
.card-theme-amber   { border-top: 4px solid var(--color-amber); }
.card-theme-emerald { border-top: 4px solid var(--color-emerald); }
.card-theme-teal    { border-top: 4px solid var(--color-teal); }
.card-theme-cyan    { border-top: 4px solid var(--color-cyan); }
.card-theme-blue    { border-top: 4px solid var(--color-blue); }
.card-theme-indigo  { border-top: 4px solid var(--color-indigo); }
.card-theme-purple  { border-top: 4px solid var(--color-purple); }
.card-theme-pink    { border-top: 4px solid var(--color-pink); }
.card-theme-rose    { border-top: 4px solid var(--color-rose); }

/* Placeholder icon tiles */
.card-icon-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.card-icon-placeholder.card-theme-slate   { background-color: var(--color-slate); }
.card-icon-placeholder.card-theme-red     { background-color: var(--color-red); }
.card-icon-placeholder.card-theme-orange  { background-color: var(--color-orange); }
.card-icon-placeholder.card-theme-amber   { background-color: var(--color-amber); }
.card-icon-placeholder.card-theme-emerald { background-color: var(--color-emerald); }
.card-icon-placeholder.card-theme-teal    { background-color: var(--color-teal); }
.card-icon-placeholder.card-theme-cyan    { background-color: var(--color-cyan); }
.card-icon-placeholder.card-theme-blue    { background-color: var(--color-blue); }
.card-icon-placeholder.card-theme-indigo  { background-color: var(--color-indigo); }
.card-icon-placeholder.card-theme-purple  { background-color: var(--color-purple); }
.card-icon-placeholder.card-theme-pink    { background-color: var(--color-pink); }
.card-icon-placeholder.card-theme-rose    { background-color: var(--color-rose); }

/* Uploaded icon sizing */
.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Application Access management */
.access-panel {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    max-width: 720px;
}

.access-table th {
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 600;
    text-transform: none;
}

.access-user-inactive {
    opacity: 0.6;
}

.access-btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
}

.access-btn:focus-visible,
.access-row .form-check-input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.access-row .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.access-app-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.access-theme-slate   { background-color: var(--color-slate); }
.access-theme-red     { background-color: var(--color-red); }
.access-theme-orange  { background-color: var(--color-orange); }
.access-theme-amber   { background-color: var(--color-amber); }
.access-theme-emerald { background-color: var(--color-emerald); }
.access-theme-teal    { background-color: var(--color-teal); }
.access-theme-cyan    { background-color: var(--color-cyan); }
.access-theme-blue    { background-color: var(--color-blue); }
.access-theme-indigo  { background-color: var(--color-indigo); }
.access-theme-purple  { background-color: var(--color-purple); }
.access-theme-pink    { background-color: var(--color-pink); }
.access-theme-rose    { background-color: var(--color-rose); }

/* Group card styling */
.group-card {
    background-color: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    height: 100%;
}

.group-card .card-header {
    background-color: transparent;
    border-bottom: 1px solid #e2e8f0;
}

.group-card .card-body .card {
    background-color: #fff;
}

/* Launcher stack: single left-aligned column, controlled width,
   natural card heights. The open right workspace is intentional and
   reserves room for a future left-sidebar / workspace arrangement. */
.card-grid {
    display: grid;
    grid-template-columns: minmax(0, 660px);
    justify-content: start;
    gap: 1.5rem;
}

/* Tablet and below: let the stack use the available width */
@media (max-width: 991.98px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

@media (max-width: 767.98px) {
    .card-grid {
        gap: 1rem;
    }
}

/* App card styling */
.app-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.app-card:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Launch button styling */
.btn-launch {
    font-weight: 500;
    font-size: 0.9375rem;
    min-height: 44px;
    padding: 0.625rem 1rem;
    border-color: #cbd5e1;
    color: #0f172a;
    background-color: #ffffff;
    border-radius: 8px;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-launch:hover {
    background-color: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.btn-launch:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Unconfigured URL placeholder */
.unconfigured-badge {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Empty state card */
.empty-state-card {
    border: 2px dashed #cbd5e1;
    background-color: #f8fafc;
    border-radius: 12px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #e2e8f0;
    color: #64748b;
}

@media (prefers-reduced-motion: reduce) {
    .app-card,
    .btn-launch {
        transition: none;
        transform: none !important;
    }
}

/* Server Room -- "Cold-Aisle Console" owner workspace */
.sr-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.sr-bay {
    background-color: #090d12;
    border: 1px solid #2d333b;
    border-radius: 12px;
    padding: 1rem 1rem 0.5rem;
}

.sr-aisle {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding: 0.5rem 0.25rem 1rem;
    scroll-behavior: smooth;
    align-items: stretch;
}

.sr-floor {
    height: 6px;
    margin: 0 0.25rem;
    border-radius: 0 0 10px 10px;
    background: linear-gradient(180deg, #14181f, #090d12);
}

.sr-enclosure {
    background-color: #14181f;
    border: 1px solid #2d333b;
    border-radius: 10px;
    padding: 0.6rem;
    flex-shrink: 0;
    align-self: flex-start;
}

/* Standalone apps get their own compact enclosure (one rack wide) */
.sr-enclosure-standalone {
    width: max-content;
}

.sr-enclosure-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #f0f6fc;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.sr-enclosure-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.sr-enclosure-slots {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* Server rack unit */
.sr-rack {
    display: flex;
    width: 170px;
    border: 1px solid #2d333b;
    border-radius: 8px;
    background-color: #14181f;
    text-decoration: none;
    color: #f0f6fc;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

.sr-rack:hover {
    border-color: #444c56;
    text-decoration: none;
    color: #f0f6fc;
}

.sr-rack:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

.sr-rack-rails {
    width: 8px;
    background-color: #2d333b;
    border-radius: 0;
}
.sr-rack-rails:first-child { border-radius: 7px 0 0 7px; }
.sr-rack-rails:last-child  { border-radius: 0 7px 7px 0; }

.sr-rack-body {
    flex: 1;
    padding: 0.55rem 0.6rem;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.025) 0 2px,
            transparent 2px 7px
        );
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sr-led {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}
.sr-led-power { background-color: #06b6d4; box-shadow: 0 0 6px rgba(6, 182, 212, 0.7); }

.sr-theme-emerald .sr-led-theme { background-color: #10b981; }
.sr-theme-blue    .sr-led-theme { background-color: #3b82f6; }
.sr-theme-amber   .sr-led-theme { background-color: #f59e0b; }
.sr-theme-purple  .sr-led-theme { background-color: #a855f7; }
.sr-theme-slate .sr-led-theme,
.sr-enclosure-light.sr-theme-slate { background-color: #64748b; }
.sr-enclosure-light.sr-theme-blue { background-color: #3b82f6; }
.sr-enclosure-light.sr-theme-emerald { background-color: #10b981; }
.sr-enclosure-light.sr-theme-amber { background-color: #f59e0b; }
.sr-enclosure-light.sr-theme-purple { background-color: #a855f7; }
.sr-theme-teal .sr-led-theme, .sr-enclosure-light.sr-theme-teal { background-color: #14b8a6; }
.sr-theme-cyan .sr-led-theme, .sr-enclosure-light.sr-theme-cyan { background-color: #06b6d4; }
.sr-theme-indigo .sr-led-theme, .sr-enclosure-light.sr-theme-indigo { background-color: #6366f1; }
.sr-theme-red .sr-led-theme, .sr-enclosure-light.sr-theme-red { background-color: #ef4444; }
.sr-theme-orange .sr-led-theme, .sr-enclosure-light.sr-theme-orange { background-color: #f97316; }
.sr-theme-pink .sr-led-theme, .sr-enclosure-light.sr-theme-pink { background-color: #ec4899; }
.sr-theme-rose .sr-led-theme, .sr-enclosure-light.sr-theme-rose { background-color: #f43f5e; }

.sr-rack-name {
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.2;
    word-break: break-word;
}

.sr-rack-meta {
    color: #8b949e;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

.sr-rack-vents {
    margin-top: auto;
    height: 14px;
    border-radius: 3px;
    background: repeating-linear-gradient(
        to right,
        #2d333b 0 3px,
        transparent 3px 7px
    );
}

.sr-rack-selected {
    border: 2px solid #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25), 0 10px 24px rgba(0, 0, 0, 0.45);
    transform: translateY(-4px) scale(1.02);
}

.sr-rack-selected-label {
    align-self: flex-start;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #06b6d4;
    border: 1px solid #06b6d4;
    border-radius: 4px;
    padding: 1px 5px;
}

/* Operations console */
.sr-console {
    border: 1px solid #2d333b;
    border-radius: 12px;
    background-color: #0d1117;
    padding: 1rem;
}

.sr-console-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #30363d;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    color: #f0f6fc;
}

.sr-badge-theme {
    border: 1px solid #2d333b;
    color: #f0f6fc;
    background-color: #14181f;
}

.sr-badge-theme.sr-theme-emerald { color: #34d399; }
.sr-badge-theme.sr-theme-blue    { color: #60a5fa; }
.sr-badge-theme.sr-theme-amber   { color: #fbbf24; }
.sr-badge-theme.sr-theme-purple  { color: #c084fc; }

.sr-panel {
    border: 1px solid #30363d;
    border-radius: 10px;
    background-color: #14181f;
    padding: 1rem;
}

.sr-panel-title {
    color: #8b949e;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.sr-id-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid #21262d;
}
.sr-id-list div:last-child { border-bottom: none; }
.sr-id-list dt { color: #8b949e; font-weight: 500; font-size: 0.8rem; }
.sr-id-list dd {
    color: #f0f6fc;
    margin-bottom: 0;
    font-size: 0.8rem;
    text-align: right;
    word-break: break-word;
}

.sr-op-label {
    color: #f0f6fc;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    display: block;
}

.sr-op-desc { color: #8b949e; margin-bottom: 0.3rem; }

.sr-console .ops-input.form-control {
    font-family: monospace;
    background-color: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
    font-size: 0.82rem;
}
.sr-console .ops-input.form-control:focus {
    background-color: #0d1117;
    color: #e6edf3;
    border-color: #06b6d4;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.25);
}
.sr-console .ops-input.form-control::placeholder { color: #484f58; }

.sr-console .text-muted,
.sr-bay .text-muted { color: #8b949e !important; }

.sr-console .alert-secondary {
    background-color: #14181f;
    border-color: #30363d;
    color: #8b949e;
}

.sr-console .modal-content {
    background-color: #14181f;
    border: 1px solid #30363d;
    color: #f0f6fc;
}
.sr-console .modal .table { color: inherit; border-color: #30363d; }
.sr-console .modal .text-muted { color: #8b949e !important; }

@media (max-width: 991.98px) {
    .sr-aisle { padding-bottom: 0.75rem; }
}

@media (max-width: 767.98px) {
    .sr-rack { width: 150px; }
    .sr-console { padding: 0.75rem; }
    .copy-btn { min-height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
    .sr-aisle { scroll-behavior: auto; }
    .sr-rack { transition: none; }
    .sr-rack-selected {
        transform: none;
        box-shadow: none;
        border: 2px solid #06b6d4;
    }
}

.sr-icon,
.sr-icon-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sr-icon {
    object-fit: cover;
}

.sr-icon-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
