/* ═══════════════════════════════════════════════════
   Factor Fifty — Canvas Design System (Redesign)
   Matches factorfifty-platform-redesign.html mockup
   ═══════════════════════════════════════════════════ */

:root {
    /* Canvas aliases → application.css tokens (single source of truth)
       Variables with the same name as application.css are inherited automatically.
       Only canvas-specific aliases are defined here. */
    --bg-primary: var(--bg-body, #0a0e1a);
    --bg-secondary: var(--bg-surface, #111827);
    --bg-tertiary: var(--bg-input, #1a2235);
    --accent-blue: var(--green, #3b82f6);
    --accent-cyan: var(--cyan, #22d3ee);
    --accent-green: #10b981;
    /* canvas-only: actual green for diff/status indicators */
    --accent-orange: var(--orange, #f59e0b);
    --accent-red: var(--red, #ef4444);
    --accent-purple: var(--purple, #8b5cf6);
    --aws-orange: var(--aws, #ff9900);
    --azure-blue: var(--azure, #0078d4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── App Shell ── */
.cv-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
}

/* When using server-rendered topnav + customer subnav, subtract their heights */
.cv-app.cv-app-with-server-nav {
    height: calc(100vh - var(--topnav-height, 48px) - 42px);
}

/* ── Top Nav ── */
.cv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 48px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cv-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.cv-logo-mark {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: white;
}

/* Green bars logo (Factor Fifty) */
.cv-logo-bars {
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.cv-logo-bars span {
    width: 3px;
    background: #2ecc71;
    border-radius: 1.5px;
}

/* 8 bars, ascending left-to-right like the original logo */
.cv-logo-bars span:nth-child(1) {
    height: 7px;
}

.cv-logo-bars span:nth-child(2) {
    height: 9px;
}

.cv-logo-bars span:nth-child(3) {
    height: 11px;
}

.cv-logo-bars span:nth-child(4) {
    height: 14px;
}

.cv-logo-bars span:nth-child(5) {
    height: 16px;
}

.cv-logo-bars span:nth-child(6) {
    height: 19px;
}

.cv-logo-bars span:nth-child(7) {
    height: 22px;
}

.cv-logo-bars span:nth-child(8) {
    height: 26px;
}

.cv-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.cv-breadcrumb span {
    opacity: 0.4;
}

.cv-breadcrumb .curr {
    color: var(--text-primary);
    font-weight: 500;
    opacity: 1;
}

.cv-top-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons — use .btn / .btn-green / .btn-ghost from application.css */

.cv-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

/* ── Screen Selector Bar ── */
.screen-selector {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.screen-selector-spacer {
    display: none;
}

.screen-selector-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
    padding: 2px 2px 4px;
}

.screen-selector-steps::-webkit-scrollbar {
    height: 4px;
}

.screen-selector-steps::-webkit-scrollbar-track {
    background: transparent;
}

.screen-selector-steps::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.28);
    border-radius: 999px;
}

.screen-selector-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    min-width: max-content;
}

.screen-selector-actions .btn {
    white-space: nowrap;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.screen-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1;
}

.screen-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.screen-btn.active {
    background: var(--accent-green);
    color: #0a0d13;
    border-color: var(--accent-green);
}

@media (max-width: 1500px) {
    .screen-selector {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 8px 10px;
    }

    .screen-selector-steps {
        justify-content: flex-start;
        gap: 6px;
    }

    .screen-selector-actions {
        justify-content: flex-end;
        overflow: visible;
        gap: 6px;
        padding-bottom: 0;
    }

    .screen-btn {
        padding: 7px 10px;
        font-size: 10px;
    }

    .screen-selector-actions .btn {
        min-height: 32px;
        padding-left: 10px;
        padding-right: 10px;
        font-size: 11px;
    }
}

@media (max-width: 900px) {
    .screen-btn {
        padding: 7px 10px;
        font-size: 10px;
    }

    .screen-selector-actions .btn {
        min-height: 32px;
        padding-left: 10px;
        padding-right: 10px;
        font-size: 11px;
    }
}

/* ── Main 3-column Grid ── */
.cv-main {
    flex: 1;
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    overflow: hidden;
}

/* ── Left: Catalog Panel ── */
.catalog-panel {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.catalog-header {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.catalog-header h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.search-input {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-blue);
}

.cloud-toggle {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.cloud-chip {
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
}

.cloud-chip.aws-on {
    background: rgba(255, 153, 0, 0.15);
    border-color: var(--aws-orange);
    color: var(--aws-orange);
}

.cloud-chip.azure-on {
    background: rgba(0, 120, 212, 0.15);
    border-color: var(--azure-blue);
    color: var(--azure-blue);
}

.catalog-modules {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.cat-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 6px 8px 4px;
}

.mod-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: grab;
    margin-bottom: 1px;
    transition: background 0.15s;
}

.mod-item:hover {
    background: var(--bg-card-hover);
}

.mod-item.dragging {
    opacity: 0.5;
}

.mod-icon {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.mod-icon.compute {
    background: rgba(255, 153, 0, 0.12);
    color: var(--aws-orange);
}

.mod-icon.database {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
}

.mod-icon.networking {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
}

.mod-icon.storage {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.mod-icon.security {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.mod-icon.monitoring {
    background: rgba(34, 211, 238, 0.12);
    color: var(--accent-cyan);
}

.mod-name {
    font-size: 11px;
    font-weight: 600;
}

.mod-desc {
    font-size: 9px;
    color: var(--text-muted);
}

.mod-zones {
    display: flex;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
}

.zone-badge {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.zone-badge.pub {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.zone-badge.prv {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.zone-badge.global {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.engine-dots {
    display: flex;
    gap: 2px;
}

.engine-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: block;
}

.engine-dots .tf {
    background: var(--accent-purple);
}

.engine-dots .cf {
    background: var(--aws-orange);
}

.engine-dots .bi {
    background: var(--azure-blue);
}

/* ── Canvas Area ── */
.cv-canvas {
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.canvas-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.25;
    pointer-events: none;
}

/* Env tabs centered at top of canvas */
.env-tabs-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    z-index: 10;
}

.env-tab {
    padding: 7px 14px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    background: none;
    border-top: none;
    border-bottom: none;
    border-left: none;
    font-family: 'DM Sans', sans-serif;
}

.env-tab:last-child {
    border-right: none;
}

.env-tab.active {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
}

.env-tab.env-dev.active {
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.08);
}

.env-tab.env-acc.active {
    color: var(--accent-orange);
    background: rgba(245, 158, 11, 0.08);
}

.env-tab.env-prd.active {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.08);
}

.env-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

/* Toolbar at top-left */
.toolbar {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.tool-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
}

.tool-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.tool-btn.active {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Subnet zones */
.subnet {
    position: absolute;
    border: 2px dashed;
    border-radius: var(--radius-lg);
}

.subnet-label {
    position: absolute;
    top: -11px;
    left: 14px;
    background: var(--bg-primary);
    padding: 1px 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 3px;
}

.subnet.pub {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.02);
}

.subnet.pub .subnet-label {
    color: var(--accent-green);
}

.subnet.prv {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.02);
}

.subnet.prv .subnet-label {
    color: var(--accent-blue);
}

.subnet.global {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.02);
}

.subnet.global .subnet-label {
    color: rgb(245, 158, 11);
}

/* Resource blocks */
.rb {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    z-index: 10;
    user-select: none;
    min-width: 130px;
}

.rb:hover {
    border-color: var(--accent-blue);
}

.rb.selected {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue);
}

.rb.connecting {
    animation: rb-pulse 1.5s infinite;
}

@keyframes rb-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 2px var(--accent-blue);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
    }
}

.rb-i {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    flex-shrink: 0;
}

.rb-n {
    font-weight: 600;
    font-size: 11px;
}

.rb-t {
    font-size: 9px;
    color: var(--text-muted);
}

.rb-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);
    }
}

.rb-xref {
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-purple);
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.rb-ghost {
    opacity: 0.35;
    border-style: dashed;
}

.rb-ghost:hover {
    opacity: 0.7;
}

/* SVG connections */
.conn-svg {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: visible;
    width: 100%;
    height: 100%;
}

.conn-line {
    stroke: var(--text-muted);
    stroke-width: 2;
    fill: none;
    opacity: 0.7;
}

.conn-line.active {
    stroke: var(--green);
    stroke-width: 2.5;
    opacity: 1;
}

.ghost-line {
    stroke: var(--accent-purple);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    opacity: 0.4;
    fill: none;
}

/* Connect mode */
.cv-canvas.connect-mode {
    cursor: crosshair;
}

.cv-canvas.connect-mode .rb {
    cursor: crosshair;
}

.connect-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: rgba(139, 92, 246, 0.15);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    color: var(--accent-purple);
    z-index: 25;
}

.connect-indicator.active {
    display: flex;
}

.connect-cancel-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}

/* Canvas transform container */
.cv-transform {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.cv-viewport {
    transform-origin: 0 0;
    position: absolute;
    width: 3000px;
    height: 3000px;
}

/* Canvas empty state */
.cv-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
    z-index: 5;
}

/* Smart placement callout */
.callout {
    position: absolute;
    background: var(--accent-blue);
    color: white;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 11px;
    line-height: 1.4;
    max-width: 220px;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.callout strong {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
}

.callout::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    transform: rotate(45deg);
    left: -4px;
    top: 12px;
}

/* Zoom controls */
.zoom-ctrl {
    position: absolute;
    bottom: 14px;
    left: 14px;
    z-index: 20;
    display: flex;
    gap: 3px;
}

.zc-btn {
    width: 30px;
    height: 30px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
}

.zc-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.zoom-level {
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    align-items: center;
}

/* Minimap */
.minimap {
    position: absolute;
    bottom: 14px;
    right: 14px;
    width: 180px;
    height: 120px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    z-index: 20;
    overflow: hidden;
    padding: 6px;
}

.mm-label {
    font-size: 7px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.mm-canvas {
    width: 100%;
    height: calc(100% - 12px);
    background: var(--bg-primary);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.mm-zone {
    position: absolute;
    border: 1px solid;
    border-radius: 2px;
}

.mm-zone.pub {
    left: 3%;
    top: 8%;
    width: 22%;
    height: 75%;
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.03);
}

.mm-zone.prv {
    left: 28%;
    top: 8%;
    width: 40%;
    height: 75%;
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.03);
}

.mm-zone.global {
    left: 71%;
    top: 8%;
    width: 26%;
    height: 75%;
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.03);
}

.mm-block {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 1px;
}

.mm-viewport {
    position: absolute;
    border: 1.5px solid var(--accent-blue);
    border-radius: 2px;
    background: rgba(59, 130, 246, 0.05);
    cursor: move;
}

/* ── Right Panel ── */
.rpanel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rp-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.rp-tab {
    flex: 1;
    padding: 9px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: 'DM Sans', sans-serif;
}

.rp-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.rp-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.rp-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: none;
}

.rp-body.active {
    display: block;
}

.rp-section {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-top: 14px;
}

.rp-section:first-child {
    margin-top: 0;
}

.rp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(36, 48, 73, 0.4);
    font-size: 12px;
}

.rp-row .rl {
    color: var(--text-secondary);
}

.rp-row .rv {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 3px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.rp-row select {
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 3px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

/* Toggle switch */
.rp-toggle {
    width: 32px;
    height: 17px;
    background: var(--bg-tertiary);
    border-radius: 9px;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--border);
    display: inline-block;
    appearance: none;
    padding: 0;
}

.rp-toggle.on {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.rp-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 11px;
    height: 11px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s;
}

.rp-toggle.on::after {
    left: 17px;
}

/* Validation items */
.vi {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 6px;
    border-left: 3px solid;
    font-size: 11px;
    line-height: 1.4;
}

.vi.err {
    border-left-color: var(--accent-red);
}

.vi.wrn {
    border-left-color: var(--accent-orange);
}

.vi.ok {
    border-left-color: var(--accent-green);
}

.vi-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    flex-shrink: 0;
    color: white;
}

.vi.err .vi-icon {
    background: var(--accent-red);
}

.vi.wrn .vi-icon {
    background: var(--accent-orange);
}

.vi.ok .vi-icon {
    background: var(--accent-green);
}

.vi strong {
    display: block;
    margin-bottom: 1px;
    font-size: 11px;
}

.vi span {
    color: var(--text-secondary);
    font-size: 10px;
}

/* Cross-env ref panel */
.xref-card {
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.xref-card .xdir {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}

.xref-card .xlink {
    font-size: 11px;
    color: var(--text-secondary);
}

.xref-card .xlink strong {
    color: var(--text-primary);
}

.xref-card .xval {
    font-size: 9px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
}

/* Resource list in right panel */
.res-list-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 6px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 1px;
    transition: background 0.1s;
}

.res-list-item:hover {
    background: var(--bg-card-hover);
}

.res-list-item.active {
    background: rgba(59, 130, 246, 0.08);
}

.rli-i {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 700;
    flex-shrink: 0;
}

.rli-name {
    font-size: 10px;
    font-weight: 600;
    flex: 1;
}

.rli-type {
    font-size: 8px;
    color: var(--text-muted);
}

.rli-ghost {
    font-size: 7px;
    color: var(--accent-purple);
    font-weight: 600;
}

/* Properties form fields */
.rp-field {
    margin-bottom: 8px;
}

.rp-field-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rp-field-label .req {
    color: var(--accent-red);
}

.rp-input {
    width: 100%;
    padding: 5px 8px;
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.rp-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.rp-select {
    width: 100%;
    padding: 5px 8px;
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
}

.rp-combobox {
    position: relative;
    width: 100%;
}

.rp-select.rp-select--native {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 1px;
    padding: 0;
    margin: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.rp-combobox-toggle {
    width: 100%;
    min-height: 28px;
    padding: 5px 28px 5px 8px;
    font-size: 11px;
    text-align: left;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    position: relative;
}

.rp-combobox-toggle::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 6px;
    height: 6px;
    border-right: 1px solid var(--text-muted);
    border-bottom: 1px solid var(--text-muted);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

.rp-combobox.open .rp-combobox-toggle,
.rp-combobox-toggle:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.rp-combobox-toggle:disabled {
    cursor: default;
    opacity: 0.7;
}

.rp-combobox.is-empty .rp-combobox-label {
    color: var(--text-muted);
}

.rp-combobox-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-combobox-menu {
    position: absolute;
    z-index: 80;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    padding: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

.rp-combobox-search {
    width: 100%;
    min-height: 26px;
    padding: 5px 7px;
    margin-bottom: 5px;
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
}

.rp-combobox-search:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.rp-combobox-options {
    max-height: 190px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.rp-combobox-option {
    display: block;
    width: 100%;
    padding: 5px 7px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-combobox-option:hover,
.rp-combobox-option:focus {
    outline: none;
    background: rgba(88, 166, 255, 0.12);
    color: var(--text-primary);
}

.rp-combobox-option[aria-selected="true"] {
    background: rgba(59, 130, 246, 0.16);
    color: var(--blue);
}

.rp-combobox-empty {
    padding: 6px 7px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Dynamic multi-select pills */
.rp-multi-select {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.rp-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.rp-pill:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.rp-pill.active {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--blue);
    color: var(--blue);
}

.rp-number {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rp-number-btn {
    width: 24px;
    height: 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.rp-number-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.rp-number-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    min-width: 30px;
    text-align: center;
}

.rp-actions {
    display: flex;
    gap: 6px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.rp-btn {
    padding: 5px 12px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    border: none;
}

.rp-btn-save {
    background: var(--accent-blue);
    color: white;
}

.rp-btn-save:hover {
    background: #2563eb;
}

.rp-btn-del {
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.rp-btn-del:hover {
    background: rgba(239, 68, 68, 0.1);
}

.rp-btn-connect {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.rp-btn-connect:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.field-error {
    font-size: 8px;
    color: var(--accent-red);
    margin-top: 2px;
}

/* Command palette overlay */
.cmd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
    display: none;
}

.cmd-overlay.open {
    display: flex;
}

.cmd-panel {
    width: 500px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.cmd-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 13px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    outline: none;
}

.cmd-results {
    max-height: 300px;
    overflow-y: auto;
    padding: 6px;
}

.cmd-section {
    font-size: 7px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 6px 10px 3px;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
}

.cmd-item:hover,
.cmd-item.highlighted {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
}

.cmd-item-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 700;
    flex-shrink: 0;
}

.cmd-item-name {
    flex: 1;
    font-weight: 600;
}

.cmd-item-hint {
    font-size: 9px;
    color: var(--text-muted);
}

.cmd-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
}

/* Drag preview */
.drag-preview {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    background: var(--bg-card);
    border: 1px solid var(--accent-blue);
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    opacity: 0.9;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ═══════════════════════════════════════════════════
   Screen 2: Business Rules
   ═══════════════════════════════════════════════════ */
.rules-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    flex: 1;
    overflow: hidden;
}

.rules-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
}

.rcat-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin: 14px 0 6px;
}

.rcat-title:first-child {
    margin-top: 0;
}

.rnav {
    padding: 7px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
}

.rnav:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.rnav.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.rnav .rc {
    font-size: 9px;
    font-weight: 600;
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 6px;
    color: var(--text-muted);
}

.rules-main {
    padding: 24px;
    overflow-y: auto;
}

.rules-main h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.rules-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.rule-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 12px;
}

.rule-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sev {
    padding: 2px 7px;
    font-size: 9px;
    font-weight: 700;
    border-radius: 3px;
    text-transform: uppercase;
}

.sev-block {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.sev-warn {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.sev-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.rule-name {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.rule-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}

.rule-code {
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent-cyan);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    line-height: 1.6;
    white-space: pre-line;
}

.rule-meta {
    display: flex;
    gap: 14px;
    font-size: 10px;
    color: var(--text-muted);
}

.scope-badge {
    padding: 2px 7px;
    font-size: 9px;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
}

.scope-badge.platform {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.scope-badge.customer {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* ── rule pseudo-code keyword highlighting ──────── */
.rc-keyword {
    color: var(--accent-blue);
    font-weight: 700;
}

/* ── rule builder (create modal) ────────────────── */
.builder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.builder-section {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.builder-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.builder-group {
    margin-bottom: 12px;
}

.builder-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.builder-keyword {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-blue);
    min-width: 40px;
    text-align: right;
}

.builder-select,
.builder-input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 11px;
    padding: 5px 8px;
    font-family: 'JetBrains Mono', monospace;
}

.builder-select {
    min-width: 130px;
}

.builder-select--op {
    min-width: 90px;
}

.builder-input {
    flex: 1;
    min-width: 0;
}

.builder-select:focus,
.builder-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.builder-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.builder-remove:hover {
    color: var(--accent-red);
}

.builder-add {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 10px;
    padding: 4px 10px;
    cursor: pointer;
    margin-top: 4px;
}

.builder-add:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.builder-actions {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 4px;
}

.builder-action-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.builder-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    padding: 3px 8px;
    cursor: pointer;
}

.builder-chip:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.builder-chip.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.builder-preview {
    margin-top: 12px;
}

.builder-preview-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════
   Screen 3: Promote & Sync
   ═══════════════════════════════════════════════════ */
.promote-layout {
    padding: 28px;
    max-width: 1100px;
    margin: 0 auto;
    overflow-y: auto;
    flex: 1;
}

.promote-layout h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.promote-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 28px;
}

.pipeline {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
    gap: 0;
}

.stage {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.stage.active-s {
    border-color: var(--accent-blue);
}

.stage-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.stage-name {
    font-size: 13px;
    font-weight: 600;
}

.stage-ver {
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    margin-left: auto;
}

.stage-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.stage-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.chip {
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 600;
    background: var(--bg-tertiary);
    border-radius: 3px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.chip.new {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.arrow-col {
    width: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
}

.arrow-line {
    width: 30px;
    height: 2px;
    background: var(--border);
    position: relative;
}

.arrow-line::after {
    content: '▶';
    position: absolute;
    right: -7px;
    top: -7px;
    font-size: 10px;
    color: var(--accent-blue);
}

.promote-btn2 {
    padding: 3px 8px;
    font-size: 9px;
    font-weight: 700;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'DM Sans', sans-serif;
}

.arrow-note {
    font-size: 8px;
    color: var(--text-muted);
}

.diff-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.diff-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.diff-head h3 {
    font-size: 13px;
    font-weight: 600;
}

.diff-stats {
    display: flex;
    gap: 10px;
    font-size: 11px;
}

.diff-stats .a {
    color: var(--accent-green);
}

.diff-stats .m {
    color: var(--accent-orange);
}

.diff-stats .r {
    color: var(--accent-red);
}

.diff-body {
    padding: 14px 18px;
}

.ditem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    margin-bottom: 3px;
    font-size: 12px;
}

.ditem.da {
    background: rgba(16, 185, 129, 0.07);
}

.ditem.dm {
    background: rgba(245, 158, 11, 0.07);
}

.ditem.dr {
    background: rgba(239, 68, 68, 0.07);
}

.dbadge {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 2px;
    text-transform: uppercase;
}

.ditem.da .dbadge {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.ditem.dm .dbadge {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-orange);
}

.ditem.dr .dbadge {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

/* ═══════════════════════════════════════════════════
   Screen 4: Templates
   ═══════════════════════════════════════════════════ */
.tpl-layout {
    padding: 28px;
    max-width: 1200px;
    margin: 0 auto;
    overflow-y: auto;
    flex: 1;
}

.tpl-layout h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.tpl-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.fchip {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}

.fchip.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.tpl-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.tpl-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.tpl-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.tpl-card-empty {
    border-style: dashed;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
}

.tpl-preview {
    height: 110px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 14px;
    position: relative;
}

.tpl-block {
    width: 34px;
    height: 34px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
}

.tpl-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 700;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.5);
}

.tpl-badge.aws {
    color: var(--aws-orange);
}

.tpl-badge.azure {
    color: var(--azure-blue);
}

.tpl-badge.multi {
    color: var(--accent-cyan);
}

.tpl-body {
    padding: 14px;
}

.tpl-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.tpl-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 10px;
}

.tpl-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tpl-tags {
    display: flex;
    gap: 3px;
}

.tpl-tag {
    padding: 1px 5px;
    font-size: 9px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    color: var(--text-muted);
}

.tpl-uses {
    font-size: 10px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════
   Screen 5: Import
   ═══════════════════════════════════════════════════ */
.import-layout {
    padding: 22px;
    max-width: none;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    overflow-y: auto;
    flex: 1;
}

.import-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.import-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.import-title-row svg {
    color: var(--accent-cyan);
}

.import-title-row h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.import-subtitle {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 5px;
}

.import-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.import-toolbar .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.spin {
    animation: import-spin 0.8s linear infinite;
}

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

.import-date {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.import-date input,
.import-filters select,
.import-search input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    height: 30px;
    font-size: 12px;
    font-family: var(--font-sans);
}

.import-date input {
    padding: 0 8px;
}

.import-error,
.import-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.import-error {
    border: 1px solid rgba(248, 113, 113, 0.26);
    background: rgba(248, 113, 113, 0.08);
    color: var(--red);
}

.import-notice {
    border: 1px solid rgba(74, 222, 128, 0.24);
    background: rgba(74, 222, 128, 0.08);
    color: var(--green);
}

.import-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.import-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 12px;
}

.import-stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.18);
}

.import-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.import-stat-label {
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.import-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 170px 170px 170px;
    gap: 8px;
    margin-bottom: 10px;
}

.import-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 10px;
    min-width: 0;
}

.import-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.import-search input {
    border: 0;
    background: transparent;
    flex: 1;
    min-width: 0;
    padding: 0;
    outline: none;
}

.import-filters select {
    padding: 0 8px;
    width: 100%;
}

.import-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.import-selection-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.import-selection-meta svg {
    color: var(--accent-cyan);
}

.import-selection-meta strong {
    color: var(--text);
}

.import-action-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.import-action-buttons .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.import-action-hint {
    margin: -4px 0 12px;
    color: var(--amber);
    font-size: 11px;
    font-weight: 600;
}

.import-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 12px;
    align-items: start;
}

.import-table-wrap {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
    background: var(--bg-card);
    max-height: calc(100vh - 350px);
}

.import-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.import-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-secondary);
    color: var(--text-muted);
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.import-table td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(36, 48, 73, 0.55);
    color: var(--text-secondary);
    font-size: 12px;
    vertical-align: middle;
}

.import-table tr:last-child td {
    border-bottom: 0;
}

.import-table tr {
    cursor: pointer;
}

.import-table tr.active td {
    background: rgba(34, 211, 238, 0.055);
}

.import-table tr.selected td {
    box-shadow: inset 3px 0 0 rgba(74, 222, 128, 0.65);
}

.import-table tr.imported td {
    opacity: 0.76;
}

.import-select-col {
    width: 38px !important;
    text-align: center !important;
}

.import-select-col input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-green);
    cursor: pointer;
}

.import-select-col input:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.import-table th:nth-child(2),
.import-table td:nth-child(2) {
    width: 30%;
}

.import-table th:nth-child(3),
.import-table td:nth-child(3) {
    width: 18%;
}

.import-table th:nth-child(4),
.import-table td:nth-child(4) {
    width: 10%;
}

.import-table th:nth-child(5),
.import-table td:nth-child(5) {
    width: 20%;
}

.import-table th:nth-child(6),
.import-table td:nth-child(6) {
    width: 14%;
}

.import-table th:nth-child(7),
.import-table td:nth-child(7) {
    width: 80px;
}

.import-resource-name,
.import-type {
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.import-resource-id {
    margin-top: 4px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.import-category {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.import-match {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text-secondary);
}

.import-match span:last-child {
    overflow-wrap: anywhere;
}

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

.import-confidence,
.import-state-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.import-confidence.high {
    color: var(--green);
    border-color: rgba(74, 222, 128, 0.28);
    background: rgba(74, 222, 128, 0.1);
}

.import-confidence.manual {
    color: var(--accent-cyan);
    border-color: rgba(34, 211, 238, 0.28);
    background: rgba(34, 211, 238, 0.1);
}

.import-confidence.native {
    color: var(--green);
    border-color: rgba(74, 222, 128, 0.32);
    background: rgba(74, 222, 128, 0.12);
}

.import-confidence.medium {
    color: var(--amber);
    border-color: rgba(251, 191, 36, 0.28);
    background: rgba(251, 191, 36, 0.1);
}

.import-confidence.low {
    color: var(--accent-cyan);
    border-color: rgba(34, 211, 238, 0.22);
    background: rgba(34, 211, 238, 0.08);
}

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

.import-state-chip {
    color: var(--text-muted);
    text-transform: none;
}

.import-state-chip.imported {
    color: var(--green);
    border-color: rgba(74, 222, 128, 0.28);
    background: rgba(74, 222, 128, 0.1);
}

.import-state-chip.pending {
    color: var(--text-muted);
}

.import-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.import-status em {
    max-width: 100%;
    color: var(--text-muted);
    font-style: normal;
    font-size: 10px;
    overflow-wrap: anywhere;
}

.import-row-btn,
.import-select-btn {
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
}

.import-row-btn:hover,
.import-select-btn:hover {
    border-color: rgba(34, 211, 238, 0.35);
    color: var(--text);
}

.import-select-btn.selected {
    color: #0a0d13;
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.import-select-btn:disabled {
    cursor: not-allowed;
    color: var(--green);
    background: rgba(74, 222, 128, 0.1);
    border-color: rgba(74, 222, 128, 0.24);
}

.import-empty {
    text-align: center;
    color: var(--text-muted) !important;
    padding: 34px 12px !important;
}

.import-detail-panel {
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: calc(100vh - 350px);
    overflow: auto;
    padding: 14px;
}

.import-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    justify-content: flex-end;
    background: rgba(5, 8, 15, 0.62);
}

.import-detail-drawer {
    width: min(520px, 100vw);
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    box-shadow: -18px 0 60px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
}

.import-detail-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.import-detail-drawer-title {
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
}

.import-detail-drawer-subtitle {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.import-detail-drawer-close {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.import-detail-drawer-close:hover {
    color: var(--text);
    border-color: rgba(34, 211, 238, 0.35);
}

.import-detail-drawer .import-detail-panel {
    border: 0;
    border-radius: 0;
    max-height: none;
    flex: 1;
    background: transparent;
}

.import-detail-empty {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.import-detail-empty svg {
    color: var(--accent-cyan);
    margin-bottom: 10px;
}

.import-detail-empty-title {
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 5px;
}

.import-detail-empty p {
    max-width: 260px;
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

.import-detail-head {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(36, 48, 73, 0.7);
    margin-bottom: 12px;
}

.import-detail-head > div {
    min-width: 0;
}

.import-detail-title {
    max-width: 100%;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.import-detail-subtitle {
    max-width: 100%;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.import-detail-section {
    min-width: 0;
    padding: 11px 0;
    border-bottom: 1px solid rgba(36, 48, 73, 0.5);
}

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

.import-detail-section-title {
    max-width: 100%;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.import-detail-row {
    display: grid;
    grid-template-columns: minmax(0, 105px) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-width: 0;
    max-width: 100%;
    margin-bottom: 7px;
    font-size: 11px;
}

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

.import-detail-row span {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

.import-detail-row strong {
    min-width: 0;
    max-width: 100%;
    color: var(--text-secondary);
    font-weight: 600;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.import-detail-row strong.mono {
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
    word-break: break-all;
}

.import-detail-match {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 12px;
}

.import-detail-match strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.import-manual-match {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin: 9px 0 8px;
    font-size: 11px;
}

.import-manual-match span {
    color: var(--text-muted);
}

.import-manual-match select {
    min-width: 0;
    width: 100%;
    height: 30px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
}

.import-detail-note {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
}

.import-field-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.import-field-summary em {
    color: var(--amber);
    font-style: normal;
    font-size: 10px;
}

.import-field-map {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.import-field-row {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 8px;
    align-items: start;
    padding: 7px 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.import-field-row.matched {
    border-color: rgba(74, 222, 128, 0.18);
}

.import-field-row.missing_required {
    border-color: rgba(251, 191, 36, 0.28);
    background: rgba(251, 191, 36, 0.06);
}

.import-field-row strong,
.import-field-row code,
.import-field-row span,
.import-field-row em {
    display: block;
    overflow-wrap: anywhere;
}

.import-field-row strong {
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}

.import-field-row span,
.import-field-row em {
    color: var(--text-muted);
    font-size: 10px;
    margin-top: 3px;
}

.import-field-row code {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
    white-space: normal;
}

.import-field-row em {
    font-style: normal;
}

.import-field-value {
    min-width: 0;
}

.import-field-value-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.import-field-value-head code {
    min-width: 0;
}

.import-field-icon-btn {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
}

.import-field-icon-btn:hover {
    color: var(--text);
    border-color: rgba(34, 211, 238, 0.35);
}

.import-field-override {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: start;
    margin-top: 7px;
}

.import-field-override input,
.import-field-override select,
.import-field-override textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(34, 211, 238, 0.24);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.7);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.35;
    outline: none;
}

.import-field-override input,
.import-field-override select {
    height: 28px;
    padding: 0 8px;
}

.import-field-override textarea {
    min-height: 64px;
    resize: vertical;
    padding: 7px 8px;
}

.import-field-override input:focus,
.import-field-override select:focus,
.import-field-override textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.12);
}

.import-candidates {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
}

.import-candidate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.import-candidate em {
    color: var(--text-muted);
    font-style: normal;
    font-size: 10px;
    text-transform: uppercase;
}

.import-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.import-tag {
    max-width: 100%;
    border: 1px solid rgba(34, 211, 238, 0.2);
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent-cyan);
    border-radius: 5px;
    padding: 3px 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    overflow-wrap: anywhere;
}

.import-guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(5, 8, 15, 0.72);
}

.import-guide-modal {
    width: min(1080px, calc(100vw - 24px));
    height: min(720px, calc(100dvh - 88px));
    max-height: calc(100dvh - 88px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

.import-guide-head {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.import-guide-eyebrow {
    color: var(--accent-cyan);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.import-guide-title {
    margin-top: 4px;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

.import-guide-body {
    min-height: 0;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    flex: 1;
    overflow: hidden;
}

.import-guide-steps {
    min-height: 0;
    overflow: auto;
    padding: 12px;
    border-right: 1px solid var(--border);
    background: rgba(10, 14, 26, 0.32);
}

.import-guide-step {
    width: 100%;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    margin-bottom: 7px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    font-family: var(--font-sans);
}

.import-guide-step:hover,
.import-guide-step.active {
    border-color: rgba(34, 211, 238, 0.32);
    background: rgba(34, 211, 238, 0.07);
}

.import-guide-step-index {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
}

.import-guide-step-copy {
    min-width: 0;
}

.import-guide-step-copy strong,
.import-guide-step-copy em {
    display: block;
    overflow-wrap: anywhere;
}

.import-guide-step-copy strong {
    color: var(--text);
    font-size: 12px;
    line-height: 1.25;
}

.import-guide-step-copy em {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-style: normal;
}

.import-guide-main {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px 14px;
}

.import-guide-stage-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.import-guide-stage-title {
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
}

.import-guide-stage-desc {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}

.import-guide-stage-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.import-guide-stage-stats span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.import-guide-stage-stats .warn {
    color: var(--amber);
    border-color: rgba(251, 191, 36, 0.28);
    background: rgba(251, 191, 36, 0.08);
}

.import-guide-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.import-guide-controls .btn,
.import-guide-footer-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.import-guide-list {
    min-height: 0;
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-right: 2px;
}

.import-guide-resource {
    display: grid;
    grid-template-columns: 26px minmax(0, 1.2fr) minmax(150px, 0.9fr) 88px 72px;
    gap: 10px;
    align-items: center;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
}

.import-guide-resource.selected {
    border-color: rgba(74, 222, 128, 0.28);
    box-shadow: inset 3px 0 0 rgba(74, 222, 128, 0.62);
}

.import-guide-resource.imported {
    opacity: 0.68;
}

.import-guide-resource-check {
    display: flex;
    justify-content: center;
}

.import-guide-resource-check input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-green);
}

.import-guide-resource-main,
.import-guide-resource-module,
.import-guide-resource-fields {
    min-width: 0;
}

.import-guide-resource-main strong,
.import-guide-resource-main span,
.import-guide-resource-module em {
    display: block;
    overflow-wrap: anywhere;
}

.import-guide-resource-main strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
}

.import-guide-resource-main span {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
}

.import-guide-resource-module {
    display: flex;
    align-items: center;
    gap: 7px;
}

.import-guide-resource-module em {
    color: var(--text-secondary);
    font-size: 11px;
    font-style: normal;
}

.import-guide-empty {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 12px;
}

.import-guide-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.import-guide-detail {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.import-guide-detail-head {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 14, 26, 0.32);
}

.import-guide-detail-head > div > strong,
.import-guide-detail-head > div > span {
    display: block;
    overflow-wrap: anywhere;
}

.import-guide-detail-head > div > strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.import-guide-detail-head > div > span {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
}

.import-guide-detail-body {
    min-height: 0;
    flex: 1;
    overflow: auto;
    padding: 12px;
}

.import-guide-detail-body .import-detail-panel {
    max-height: none;
    min-height: 100%;
}

.import-guide-footer-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.import-guide-footer-meta strong {
    color: var(--text);
    font-size: 13px;
}

.import-guide-footer-meta span {
    color: var(--amber);
}

.import-guide-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.import-guide-hint {
    padding: 0 16px 12px;
    color: var(--amber);
    background: var(--bg-tertiary);
    font-size: 11px;
    font-weight: 700;
}

@media (max-width: 900px) {
    .import-header {
        flex-direction: column;
        align-items: stretch;
    }

    .import-toolbar {
        justify-content: flex-start;
    }

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

    .import-filters {
        grid-template-columns: 1fr;
    }

    .import-actions-row {
        align-items: stretch;
        flex-direction: column;
    }

    .import-action-buttons {
        justify-content: flex-start;
    }

    .import-workbench {
        grid-template-columns: 1fr;
    }

    .import-detail-panel {
        max-height: none;
    }

    .import-guide-overlay {
        padding: 8px;
        align-items: stretch;
    }

    .import-guide-modal {
        width: calc(100vw - 16px);
        height: calc(100dvh - 16px);
        max-height: calc(100dvh - 16px);
    }

    .import-guide-body {
        grid-template-columns: 1fr;
    }

    .import-guide-steps {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .import-guide-step {
        min-width: 190px;
        margin-bottom: 0;
    }

    .import-guide-stage-head,
    .import-guide-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .import-guide-stage-stats,
    .import-guide-footer-actions {
        justify-content: flex-start;
    }

    .import-guide-resource {
        grid-template-columns: 24px minmax(0, 1fr);
    }

    .import-guide-resource-module,
    .import-guide-resource-fields,
    .import-guide-resource .import-row-btn {
        grid-column: 2;
    }

    .import-guide-detail-head {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

/* ═══════════════════════════════════════════════════
   Screen 6: Deploy & IaC Engine
   ═══════════════════════════════════════════════════ */
.deploy-layout {
    padding: 28px;
    max-width: 1000px;
    margin: 0 auto;
}

.deploy-layout h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.deploy-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.engine-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 28px;
}

.eng-opt {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.eng-opt:hover {
    border-color: var(--border-light);
}

.eng-opt.sel {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.04);
}

.eng-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}

.eng-logo.tofu {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
}

.eng-logo.cfn {
    background: rgba(255, 153, 0, 0.12);
    color: var(--aws-orange);
}

.eng-logo.bicep {
    background: rgba(0, 120, 212, 0.12);
    color: var(--azure-blue);
}

.eng-logo.cdk {
    background: rgba(34, 211, 238, 0.12);
    color: var(--accent-cyan);
}

.eng-name {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 1px;
}

.eng-desc {
    font-size: 10px;
    color: var(--text-muted);
}

.pipe-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.pipe-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipe-head h3 {
    font-size: 13px;
    font-weight: 600;
}

.pipe-steps {
    display: flex;
    align-items: center;
    padding: 18px;
    gap: 0;
}

.pstep {
    flex: 1;
    text-align: center;
}

.pstep-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.pstep-name {
    font-size: 11px;
    font-weight: 500;
}

.pstep-detail {
    font-size: 9px;
    color: var(--text-muted);
}

.pconnector {
    width: 30px;
    height: 2px;
    background: var(--border);
    flex-shrink: 0;
}

.pconnector--done {
    background: var(--accent-green, #4ade80);
}

/* Pipeline step states */
.pstep--done .pstep-icon {
    border-color: var(--accent-green, #4ade80);
    background: rgba(74, 222, 128, 0.12);
    color: var(--accent-green, #4ade80);
}

.pstep--active .pstep-icon {
    border-color: var(--accent-blue, #60a5fa);
    background: rgba(96, 165, 250, 0.12);
    color: var(--accent-blue, #60a5fa);
    animation: pstep-pulse 1.5s ease-in-out infinite;
}

.pstep--fail .pstep-icon {
    border-color: var(--accent-red, #f87171);
    background: rgba(248, 113, 113, 0.12);
    color: var(--accent-red, #f87171);
}

.pstep-state {
    font-size: 14px;
    font-weight: 700;
}

@keyframes pstep-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.checks-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
}

.checks-box h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
}

.chk {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(36, 48, 73, 0.4);
    font-size: 12px;
}

.chk:last-child {
    border-bottom: none;
}

.chk-s {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.chk-s.pass {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.chk-s.fail {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.chk-s.warn {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-orange);
}

.chk-s.pend {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-orange);
}

.chk span {
    color: var(--text-secondary);
}

/* Toast notifications */
.cv-toasts {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.cv-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.4;
    color: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toast-in 0.25s ease-out;
}

.cv-toast-error {
    background: var(--accent-red, #ef4444);
}

.cv-toast-warn {
    background: var(--accent-orange, #f59e0b);
}

.cv-toast-info {
    background: var(--accent-blue, #3b82f6);
}

.cv-toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    padding: 0 2px;
}

.cv-toast-close:hover {
    opacity: 1;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Modal Form Styles ── */
.modal-label {
    display: block;
    margin-bottom: 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #8b99b5);
}

.modal-input {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-tertiary, #1a2235);
    border: 1px solid var(--border, #243049);
    border-radius: 6px;
    color: var(--text-primary, #e8ecf4);
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent-blue, #3b82f6);
}

.modal-input option {
    background: var(--bg-tertiary, #1a2235);
    color: var(--text-primary, #e8ecf4);
}

/* ── App Group Filter Tabs ── */
.group-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary, #111827);
    border-bottom: 1px solid var(--border, #243049);
    overflow-x: auto;
    flex-shrink: 0;
}

.group-filter-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    border-radius: 12px;
    border: 1px solid var(--border, #243049);
    background: transparent;
    color: var(--text-secondary, #8b99b5);
    cursor: pointer;
    white-space: nowrap;
}

.group-filter-tab:hover {
    border-color: var(--text-muted, #5a6a8a);
    color: var(--text-primary, #e8ecf4);
}

.group-filter-tab.active {
    background: var(--accent-blue, #3b82f6);
    border-color: var(--accent-blue, #3b82f6);
    color: #0a0d13;
}

.group-filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.group-filter-count {
    font-size: 9px;
    opacity: 0.7;
}

/* Code panel expanded — wider right column */
.cv-main-code {
    grid-template-columns: 260px 1fr 480px;
    transition: grid-template-columns 0.2s ease;
}

/* Code panel extra-wide — for focused editing */
.cv-main-code-wide {
    grid-template-columns: 260px 1fr 700px;
    transition: grid-template-columns 0.2s ease;
}

/* ── Terraform review screen ── */
.code-review-screen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 16px;
    overflow: hidden;
    background: var(--bg-primary);
}

.code-review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.code-review-header h2 {
    font-size: 18px;
    line-height: 1.2;
    margin: 0 0 3px;
    color: var(--text-primary);
}

.code-review-header p {
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    color: var(--text-secondary);
}

.code-review-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}
