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

/* Reset & primitives */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    height: 100%;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-strong);
    background: linear-gradient(180deg, #f9fbff 0%, #f3f6fc 45%, #f8f9fc 100%);
}

:root {
    --bg: #f5f7fb;
    --bg-accent: #eaf0ff;
    --card: #ffffff;
    --card-soft: #f9fbff;
    --border: #dbe2f3;
    --border-strong: #c4d0eb;
    --shadow-lg: 0 24px 54px rgba(15, 23, 42, 0.1);
    --shadow-md: 0 18px 30px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.06);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --text-strong: #0f172a;
    --text-muted: #5b6b82;
    --text-soft: #94a3b8;
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.1);
    --primary-bg: rgba(37, 99, 235, 0.18);
    --success: #16a34a;
    --danger: #dc2626;
    --mono: 'Space Grotesk', 'Inter', monospace;
}

a {
    color: inherit;
    text-decoration: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

button {
    font-family: inherit;
}

/* Layout */
.page-shell {
    position: relative;
    padding: clamp(32px, 6vw, 64px) clamp(16px, 5vw, 72px);
    touch-action: pan-y pinch-zoom;
}

.orb {
    position: absolute;
    width: clamp(240px, 40vw, 420px);
    aspect-ratio: 1;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    pointer-events: none;
}

.orb--one {
    top: -120px;
    right: clamp(-90px, -8vw, 120px);
    background: rgba(37, 99, 235, 0.18);
}

.orb--two {
    bottom: clamp(-140px, -12vw, 70px);
    left: clamp(-120px, -10vw, 120px);
    background: rgba(14, 165, 233, 0.18);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(16px, 4vw, 48px);
    padding: clamp(18px, 3vw, 28px) clamp(18px, 4vw, 36px);
    border-radius: var(--radius-lg);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.brand {
    display: flex;
    align-items: center;
    gap: clamp(14px, 2vw, 20px);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(48px, 7vw, 60px);
    height: clamp(48px, 7vw, 60px);
    border-radius: 18px;
    background: linear-gradient(140deg, #4f8bfd 0%, #2563eb 100%);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    letter-spacing: 0.14em;
    color: white;
    font-weight: 600;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.24);
}

.brand-mark--logo {
    background: none;
    box-shadow: none;
    object-fit: contain;
    padding: 0;
    cursor: pointer;
}

.brand a {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s ease;
}

.brand a:hover .brand-mark--logo {
    opacity: 0.85;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.brand-label {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 600;
}

.brand-subtitle {
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: clamp(16px, 3vw, 28px);
}

.header-contact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.contact-label {
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-soft);
    font-weight: 500;
    opacity: 0.8;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0.08) 100%);
    color: var(--primary-strong);
    border: 1px solid rgba(37, 99, 235, 0.2);
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.contact-link:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18) 0%, rgba(37, 99, 235, 0.12) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.3);
}

.cart-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--card-soft);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cart-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.cart-chip .icon {
    width: 22px;
    height: 22px;
    fill: var(--primary-strong);
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(140deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    font-weight: 600;
    font-size: 12px;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

.main-shell {
    display: flex;
    flex-direction: column;
    gap: clamp(32px, 6vw, 56px);
    margin-top: clamp(36px, 6vw, 64px);
}

.hero {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(24px, 5vw, 48px);
    align-items: stretch;
}

.hero>* {
    flex: 1 1 minmax(260px, 1fr);
}

/* Search-first layout on ALL screen sizes (desktop + mobile) */
.hero-intro {
    order: 2;
}

.hero-search {
    order: 1;
}

.hero-intro {
    padding: clamp(24px, 4vw, 32px);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #ffffff 0%, #f3f6ff 100%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}

.hero h1 {
    margin: clamp(18px, 2vw, 26px) 0;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(32px, 4.8vw, 46px);
    line-height: 1.12;
}

.hero-meta {
    margin: 0;
    font-size: clamp(15px, 1.4vw, 17px);
    line-height: 1.65;
    color: var(--text-muted);
}

.hero-tags {
    margin-top: clamp(18px, 3vw, 26px);
    display: none;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-tags span {
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--card-soft);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

.hero-search {
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-grid {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: row;
    gap: 20px;
}

.search-card {
    flex: 1 1 0;
    min-width: 280px;
    padding: clamp(18px, 3vw, 24px);
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.search-label {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.search-control {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.search-control input {
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card-soft);
    font-size: 16px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.search-control input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    outline: none;
}

.search-control button {
    padding: 14px 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 18px 26px rgba(37, 99, 235, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-control button:hover {
    transform: translateY(-1px);
    box-shadow: 0 24px 36px rgba(37, 99, 235, 0.3);
}

.search-hint {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
}

.workspace {
    padding: clamp(24px, 4vw, 36px);
    border-radius: var(--radius-lg);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(280px, 32vw, 340px);
    gap: clamp(24px, 5vw, 40px);
}

.panel {
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: clamp(20px, 3vw, 26px);
}

.results-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.results-stack>* {
    animation: fadeIn 0.3s ease;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 3vw, 26px);
}

.panel-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.panel-title {
    font-size: 13px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.panel-subtitle {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 13px;
}

.panel-link {
    font-size: 13px;
    color: var(--primary-strong);
    font-weight: 600;
}

.panel-link:hover {
    text-decoration: underline;
}

.panel-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(203, 213, 225, 0.2) 0%, rgba(203, 213, 225, 0.05) 100%);
}

.panel-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 999px;
    background: var(--card-soft);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}

.toggle-pill input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.cart-shell {
    min-height: 160px;
}

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

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.cart-summary {
    margin-right: auto;
    color: var(--text-muted);
    font-size: 14px;
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--card-soft);
    border: 1px solid var(--border);
}

.cart-item>div:last-child {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.cart-item .btn-link {
    white-space: nowrap;
    min-width: fit-content;
}

.btn-link {
    padding: 6px 10px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 13px;
    border: none;
    cursor: pointer;
}

.btn-link:hover {
    background: rgba(37, 99, 235, 0.22);
}

.btn-primary,
#cart-container button.btn-primary,
#cart-page button.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 28px rgba(37, 99, 235, 0.28);
}

.btn-secondary,
#cart-container button.btn-secondary,
#cart-page button.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.floating-cart {
    position: fixed;
    right: clamp(16px, 4vw, 32px);
    bottom: clamp(24px, 6vw, 48px);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 24px 48px rgba(37, 99, 235, 0.38);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    z-index: 1000;
}

.floating-cart:hover {
    transform: translateY(-3px);
    box-shadow: 0 28px 52px rgba(37, 99, 235, 0.42);
}

.floating-cart__icon {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.floating-cart__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 26px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ffffff;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.2);
}

.cart-chip.is-pulsing,
.floating-cart.is-pulsing {
    animation: cartPulse 0.6s ease;
}

@keyframes cartPulse {
    0% {
        transform: scale(1);
        box-shadow: var(--shadow-sm);
    }

    30% {
        transform: scale(1.12);
        box-shadow: 0 18px 30px rgba(37, 99, 235, 0.28);
    }

    55% {
        transform: scale(0.96);
        box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
    }

    100% {
        transform: scale(1);
        box-shadow: var(--shadow-sm);
    }
}

@media (prefers-reduced-motion: reduce) {

    .cart-chip.is-pulsing,
    .floating-cart.is-pulsing {
        animation: none;
    }
}

.btn-small {
    padding: 8px 12px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.btn-small:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.results-stack .card,
.panel .card {
    background: var(--card-soft);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: clamp(18px, 3vw, 24px);
}

.table {
    width: 100%;
    border-spacing: 0;
    border-radius: 16px;
    overflow: hidden;
    font-size: 15px;
    border: 1px solid var(--border);
    table-layout: auto;
}

.table thead {
    background: #f1f5ff;
    color: var(--text-muted);
}

.table th,
.table td {
    padding: 16px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background: rgba(37, 99, 235, 0.06);
}

.table thead th {
    position: sticky;
    top: 0;
    background: #f1f5ff;
    z-index: 2;
}

.mono {
    font-family: var(--mono);
    letter-spacing: 0.03em;
}

.split {
    display: grid;
    grid-template-columns: minmax(320px, 380px) 1fr;
    gap: 16px;
    align-items: start;
}

.split>* {
    min-width: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.diagram-card {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.diagram-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.diagram-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.diagram-card.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

#diagram-list {
    padding-right: 6px;
    -webkit-overflow-scrolling: touch;
}

#diagram-viewer {
    min-height: 60vh;
}

#diagram-preview-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    touch-action: pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}

.viewer-title {
    margin-bottom: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--card-soft);
    border: 1px solid var(--border);
    font-weight: 600;
}

.quick-toolbar {
    position: sticky;
    top: 16px;
    z-index: 5;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

#diagram-parts-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#diagram-parts-container .card {
    overflow-x: auto;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}


.chip {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s ease, border 0.2s ease, transform 0.2s ease;
}

.chip.is-active,
.chip:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-strong);
    transform: translateY(-1px);
}

.part-row--highlight {
    animation: rowGlow 1.2s ease;
}

@keyframes rowGlow {
    0% {
        box-shadow: 0 0 0 rgba(37, 99, 235, 0);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.18);
    }

    100% {
        box-shadow: 0 0 0 rgba(37, 99, 235, 0);
    }
}

.alert-stack {
    display: grid;
    gap: 16px;
}

.alert-stack .alert {
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(252, 165, 165, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #b91c1c;
}

.raw-dump {
    max-height: 320px;
    overflow: auto;
    background: var(--card-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text-muted);
}

.raw-dump pre {
    margin: 0;
}

/* Drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.08);
    backdrop-filter: none;
    z-index: 999;
    display: none;
    pointer-events: none;
}

.drawer-overlay[style*="display: block"] {
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(700px, 94vw);
    max-height: 90vh;
    overflow: auto;
    border-radius: 26px;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.16);
    padding: clamp(24px, 4vw, 32px);
    animation: modalIn 0.22s ease;
    display: none;
    -webkit-overflow-scrolling: touch;
    z-index: 1000;
    pointer-events: auto;
}

.drawer[style*="display: block"] {
    display: block;
}

@keyframes modalIn {
    0% {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 18px));
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.kv {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px 16px;
    margin-bottom: 22px;
}

.kv .k {
    color: var(--text-soft);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 12px;
}

.drawer input[type="number"] {
    width: 100px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-soft);
}

.drawer button {
    padding: 12px 20px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

/* Responsive */
@media (max-width: 768px) {
    .workspace-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .results-panel {
        order: 1;
    }

    .side-panel {
        order: 2;
        position: static;
        padding: 18px;
        border-radius: 18px;
        box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
    }
}

@media (max-width: 900px) {
    .split {
        grid-template-columns: 1fr;
    }

    #diagram-list {
        padding-right: 0;
    }

    #diagram-viewer {
        min-height: auto;
    }

    #diagram-preview-img {
        max-height: 55vh;
    }

    .viewer-title {
        position: static;
    }

    .quick-toolbar {
        position: relative;
        top: 0;
        margin-bottom: 12px;
    }
}

@media (max-width: 880px) {
    .page-shell {
        padding: 24px 16px 56px;
    }

    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
        padding: 18px 20px;
    }

    .header-actions {
        justify-content: space-between;
        width: 100%;
    }

    .header-contact {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .contact-label {
        font-size: 9px;
        letter-spacing: 0.18em;
    }

    .contact-link {
        padding: 10px 18px;
        font-size: 14px;
    }

    .hero {
        gap: 28px;
    }

    .workspace {
        padding: 20px;
        border-radius: 22px;
    }

    .search-control {
        grid-template-columns: 1fr;
    }

    .search-control button {
        width: 100%;
    }

    .search-grid {
        flex-direction: column;
    }

    .cart-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .cart-summary {
        margin-right: 0;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 20px 12px 48px;
    }

    .app-header {
        padding: 16px;
        border-radius: 22px;
    }

    .brand {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    /* Mobile: Show search bars above hero intro */
    .hero {
        flex-direction: column;
    }

    .hero-intro,
    .search-card,
    .panel {
        border-radius: 16px;
        padding: 18px;
        box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    }

    .cart-item {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .cart-item>div:nth-child(2),
    .cart-item>div:nth-child(3),
    .cart-item>div:nth-child(4) {
        justify-self: flex-start;
    }

    .cart-actions {
        gap: 10px;
    }

    .chip-row {
        gap: 6px;
    }

    .chip {
        padding: 6px 12px;
    }

    .table th,
    .table td {
        font-size: 13px;
        padding: 10px 12px;
    }

    .table.table--responsive,
    .table.table--responsive thead,
    .table.table--responsive tbody,
    .table.table--responsive tr,
    .table.table--responsive td,
    .table.table--responsive th {
        display: block;
        width: 100%;
    }

    .table.table--responsive thead {
        display: none;
    }

    .table.table--responsive tbody {
        display: block;
    }

    .table.table--responsive tr {
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 10px 12px;
        background: var(--card);
    }

    .table.table--responsive td {
        border: none;
        padding: 8px 0;
        position: relative;
    }

    .table.table--responsive td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--text-soft);
        margin-bottom: 4px;
    }

    .table.table--responsive .btn-small {
        width: 100%;
        padding: 10px 16px;
    }

    #diagram-viewer {
        position: relative;
        top: auto;
    }

    .card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .drawer {
        padding: 22px 18px;
        border-radius: 20px;
    }

    .kv {
        grid-template-columns: 1fr;
    }
}