/* ==========================================================================
   TemplatePilot - page and feature specific styles
   ========================================================================== */

/* ==========================================================================
   Login
   ========================================================================== */

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--surface);
}

.auth-form-side {
    display: flex;
    flex-direction: column;
    padding: var(--space-8) var(--space-8) var(--space-6);
}

.auth-form-inner {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding-block: var(--space-8);
}

.auth-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.auth-brand .brand-name { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.02em; }
.auth-brand .brand-tag { font-size: 0.6875rem; color: var(--text-3); letter-spacing: 0.05em; }

.auth-title { font-size: 1.625rem; font-weight: 650; letter-spacing: -0.025em; margin-bottom: 6px; }
.auth-sub { color: var(--text-3); font-size: 0.875rem; margin-bottom: var(--space-6); }

.auth-foot { text-align: center; font-size: 0.75rem; color: var(--text-4); }

/* Google sign-in button and the "or" divider under it. */
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-google .google-mark { width: 20px; height: 20px; flex: 0 0 auto; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: var(--space-5) 0; font-size: 0.75rem; color: var(--text-4); }
.auth-divider::before,
.auth-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--border); }

/* Contact form: honeypot field that people never see and bots fill in. */
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-form .field-error { font-size: 0.75rem; color: var(--danger, #dc2626); margin-top: 4px; min-height: 0; }
.contact-form .is-invalid { border-color: var(--danger, #dc2626); }
#renameForm .field-error { min-height: 1.125rem; margin-top: 4px; color: var(--danger); font-size: 0.75rem; }

/* Illustration side */
.auth-visual {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    background: radial-gradient(120% 120% at 20% 0%, var(--navy-700) 0%, var(--navy-900) 45%, var(--navy-950) 100%);
    color: #fff;
}

.auth-visual::before,
.auth-visual::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

.auth-visual::before { width: 420px; height: 420px; top: -120px; right: -110px; background: rgba(37, 99, 235, 0.42); }
.auth-visual::after { width: 340px; height: 340px; bottom: -120px; left: -80px; background: rgba(249, 115, 22, 0.3); }

.auth-grid-lines {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
}

.auth-visual-inner { position: relative; z-index: 1; width: 100%; max-width: 480px; }

.auth-headline { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.025em; line-height: 1.25; color: #fff; }
.auth-copy { margin-top: var(--space-3); color: rgba(226, 232, 240, 0.72); font-size: 0.9375rem; }

.auth-points { list-style: none; margin: var(--space-6) 0 0; padding: 0; display: grid; gap: 12px; }
.auth-points li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.875rem; color: rgba(226, 232, 240, 0.86); }
.auth-points i { color: #7ea9ff; font-size: 1rem; margin-top: 1px; }

/* Floating mock window */
.mock-window {
    margin-top: var(--space-8);
    border-radius: var(--radius-lg);
    background: rgba(10, 21, 38, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: floaty 7s ease-in-out infinite;
}

@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
}

.mock-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
.mock-bar .dot { width: 9px; height: 9px; border-radius: 50%; }
.mock-bar .url { margin-left: 10px; font-size: 0.6875rem; color: rgba(226, 232, 240, 0.5); font-family: var(--font-mono); }
.mock-body { display: grid; grid-template-columns: 96px 1fr 118px; gap: 1px; background: rgba(255, 255, 255, 0.07); min-height: 168px; }
.mock-pane { background: rgba(7, 15, 29, 0.72); padding: 11px; }
.mock-row { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); margin-bottom: 7px; }
.mock-row.is-brand { background: rgba(96, 165, 250, 0.5); }
.mock-row.is-accent { background: rgba(249, 115, 22, 0.55); }
.mock-row.is-added { background: rgba(22, 163, 74, 0.5); }
.mock-row.is-removed { background: rgba(220, 38, 38, 0.45); }
.mock-chat { display: flex; flex-direction: column; gap: 8px; }
.mock-bubble { padding: 7px 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.07); font-size: 0.625rem; color: rgba(226, 232, 240, 0.7); line-height: 1.4; }
.mock-bubble.is-user { background: rgba(37, 99, 235, 0.32); color: #dbeafe; }

@media (max-width: 991.98px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
}

/* ==========================================================================
   Project cards
   ========================================================================== */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
}

.project-card {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--border-strong); }
.project-card.is-menu-open { position: relative; z-index: 30; overflow: visible; }
.project-card.is-menu-open .project-thumb { overflow: visible; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.project-card.is-menu-open .dropdown-menu { z-index: 31; }

.project-thumb {
    position: relative;
    height: 148px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.project-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 26px 26px;
}

.project-thumb .thumb-mock {
    position: relative;
    z-index: 1;
    width: 74%;
    border-radius: 7px 7px 0 0;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
    padding: 8px;
    transform: translateY(14px);
    transition: transform var(--dur-slow) var(--ease);
}

.project-card:hover .thumb-mock { transform: translateY(8px); }
.thumb-mock .m-bar { height: 5px; border-radius: 3px; background: #cbd5e1; margin-bottom: 5px; }
.thumb-mock .m-bar.is-wide { width: 62%; background: #94a3b8; }
.thumb-mock .m-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 7px; }
.thumb-mock .m-cell { height: 20px; border-radius: 3px; background: #e2e8f0; }

/* Share modal: people with access and open invitations. */
/* Share modal (Views/Projects/_Share.cshtml) */
.share-dialog { max-width: 600px; }
.share-head { display: flex; align-items: flex-start; gap: 14px; }
.share-head .modal-icon { flex: 0 0 auto; }
.share-head .btn-close { flex: 0 0 auto; margin: 2px 0 0; }
.share-foot { justify-content: space-between; }
.share-foot-note { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 0.8125rem; }
.share-foot-note i { color: var(--success); }

.share-project { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); }
.share-project-thumb { flex: 0 0 auto; width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.06); }
.share-project-name { font-weight: 600; color: var(--text); }
.share-project-meta { color: var(--text-3); font-size: 0.8125rem; }

.share-invite-row { display: flex; gap: 8px; }
.share-invite-field { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; height: 42px; padding-left: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.share-invite-field:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.share-invite-field > i { color: var(--text-4); }
.share-invite-field input { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0 10px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 0.9375rem; }
.share-invite-field input::placeholder { color: var(--text-4); }
.share-role-select { flex: 0 0 auto; height: 100%; padding: 0 10px; border: 0; border-left: 1px solid var(--border); border-radius: 0 var(--radius-md) var(--radius-md) 0; background: transparent; color: var(--text-2); font-size: 0.875rem; font-weight: 500; cursor: pointer; outline: 0; }
.share-role-select:hover { background: var(--surface-2); }
.share-invite-row .btn { flex: 0 0 auto; height: 42px; }

.share-section { margin-top: 26px; }
.share-section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.share-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); font-size: 0.6875rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.share-people { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-md); }
.share-person { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; transition: background-color var(--dur-fast) var(--ease); }
.share-person + .share-person, .share-person + .share-empty { border-top: 1px solid var(--border); }
.share-person:first-child { border-top-left-radius: calc(var(--radius-md) - 1px); border-top-right-radius: calc(var(--radius-md) - 1px); }
.share-person:last-child { border-bottom-left-radius: calc(var(--radius-md) - 1px); border-bottom-right-radius: calc(var(--radius-md) - 1px); }
.share-person:hover { background: var(--surface-2); }
.share-person .avatar { flex: 0 0 auto; width: 36px; height: 36px; font-size: 0.75rem; }
.share-avatar-pending { background: var(--surface-3); color: var(--text-3); font-size: 0.9375rem !important; }
.share-person-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.share-person-name { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text); font-size: 0.875rem; font-weight: 600; }
.share-person-meta { color: var(--text-3); font-size: 0.8125rem; }
.share-tag { flex: 0 0 auto; padding: 1px 7px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-3); font-size: 0.6875rem; font-weight: 600; }
.share-tag.is-pending { background: var(--warning-soft); color: var(--warning); }
.share-role-static { flex: 0 0 auto; padding: 0 10px; color: var(--text-3); font-size: 0.8125rem; font-weight: 500; }
.share-role { flex: 0 0 auto; }
.share-role-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); font-size: 0.8125rem; font-weight: 500; transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.share-role-btn i { font-size: 0.6875rem; color: var(--text-4); transition: transform var(--dur-fast) var(--ease); }
.share-role-btn:hover, .share-role-btn[aria-expanded="true"] { border-color: var(--border); background: var(--surface); color: var(--text); }
.share-role-btn[aria-expanded="true"] i { transform: rotate(180deg); }
.share-role-btn:focus-visible { outline: 0; box-shadow: var(--ring); border-color: var(--brand); }
.share-role-menu { min-width: 250px; }
.share-role-option { align-items: flex-start; }
.share-role-option > span { display: flex; flex: 1 1 auto; flex-direction: column; }
.share-role-option strong { color: var(--text); font-size: 0.875rem; font-weight: 600; }
.share-role-option small { color: var(--text-3); font-size: 0.75rem; }
.share-role-option > i { margin-top: 2px; visibility: hidden; color: var(--brand) !important; }
.share-role-option.is-selected > i { visibility: visible; }
.share-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; color: var(--text-3); font-size: 0.8125rem; }

@media (max-width: 575.98px) {
    .share-invite-row { flex-wrap: wrap; }
    .share-invite-row .btn { flex: 1 1 100%; }
    .share-foot-note { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .share-role-btn i { transition: none; }
}

/* Uploaded thumbnail (WebP) covers the gradient and the grid overlay. */
.project-thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.project-thumb.has-image::after { display: none; }
.cell-media .thumb-img { object-fit: cover; width: 34px; }
.upload-thumb-preview { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.project-thumb .status-float { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(4px); }
.project-thumb .menu-float { position: absolute; top: 8px; right: 8px; z-index: 2; }
.project-thumb .menu-float .icon-btn { background: rgba(255, 255, 255, 0.9); color: var(--text-2); width: 30px; height: 30px; }
.project-thumb .menu-float .icon-btn:hover { background: #fff; }

.project-body { padding: var(--space-4); flex: 1 1 auto; }
.project-name { font-size: 0.9375rem; font-weight: 650; letter-spacing: -0.012em; }
.project-desc { margin: 6px 0 0; font-size: 0.8125rem; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.project-meta { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: var(--space-3); font-size: 0.75rem; color: var(--text-4); }
.project-meta span { display: inline-flex; align-items: center; gap: 5px; }

.project-domain {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: var(--space-3);
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-3);
}

.project-domain .dom-text { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-domain button { border: 0; background: transparent; color: var(--text-4); padding: 0 2px; cursor: pointer; }
.project-domain button:hover { color: var(--brand); }
.project-domain.is-public { border-color: var(--brand-soft-2); background: var(--brand-soft); color: var(--brand-700); }
.project-domain a.dom-text { color: inherit; text-decoration: none; }
.project-domain a.dom-text:hover { text-decoration: underline; }
.project-domain .domain-badge { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; padding: 1px 7px; border-radius: var(--radius-full); background: var(--brand); color: #fff; font-family: var(--font-sans); font-size: 0.625rem; font-weight: 600; letter-spacing: 0.02em; }
.btn-share-link.is-on { border-color: var(--brand-soft-2); background: var(--brand-soft); color: var(--brand-600); }
.icon-btn.btn-share-link.is-on { border-color: transparent; }
.editor-toolbar .dark-btn.btn-share-link.is-on { border-color: rgba(96, 165, 250, 0.45); background: rgba(37, 99, 235, 0.2); color: #bfdbfe; }
.editor-toolbar .dark-btn.btn-share-link.is-on:hover { background: rgba(37, 99, 235, 0.3); }

.public-link-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); cursor: pointer; }
.public-link-toggle .form-switch .form-check-input { width: 2.75em; height: 1.5em; margin: 0; cursor: pointer; }
.public-link-box { margin-top: 16px; }

/* Thumbnail dialog: same crop as the 148px card header, a little taller. */
.thumb-editor-preview { position: relative; display: grid; place-items: center; height: 190px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); }
.thumb-editor-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-editor-empty { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.9); color: var(--text-2); font-size: 0.8125rem; font-weight: 500; }
.public-link-box .input-group .form-control { background: var(--surface); font-size: 0.8125rem; }

.project-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.project-member-summary { display: flex; min-width: 0; align-items: center; gap: var(--space-2); overflow: hidden; }
.project-member-summary .avatar-stack { flex: 0 0 auto; }
.project-updated-time { min-width: 0; }
.project-card-actions { display: flex; flex: 0 0 auto; gap: var(--space-1); }

@container (max-width: 340px) {
    .project-updated-time { display: none; }
}

/* ========================================================================== 
   Upload
   ========================================================================== */

.upload-validation-content { min-width: 0; max-width: 100%; }
.upload-validation-list {
    max-height: 260px;
    max-width: 100%;
    padding-right: var(--space-3);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
}
.upload-validation-list li {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.upload-validation-list li + li { margin-top: var(--space-1); }

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 280px;
    padding: var(--space-8);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-xl);
    background: var(--surface-2);
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
    cursor: pointer;
}

.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }

.dropzone.is-dragover {
    border-color: var(--brand);
    background: var(--brand-soft);
    transform: scale(1.006);
    box-shadow: inset 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.dropzone-icon {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    background: var(--surface);
    color: var(--brand);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
    transition: transform var(--dur) var(--ease);
}

.dropzone.is-dragover .dropzone-icon { transform: translateY(-4px) scale(1.06); }
.dropzone h3 { font-size: 1.0625rem; }
.dropzone p { color: var(--text-3); font-size: 0.875rem; margin-top: 6px; }

.dz-formats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: var(--space-4); }

.upload-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}

.upload-item:last-child { border-bottom: 0; }
.upload-icon { flex: 0 0 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 1rem; }
.upload-info { flex: 1 1 auto; min-width: 0; }
.upload-name { font-size: 0.8438rem; font-weight: 600; }
.upload-meta { font-size: 0.75rem; color: var(--text-4); display: flex; align-items: center; gap: 8px; }
.upload-item .progress-thin { margin-top: 7px; }

/* ==========================================================================
   File tree
   ========================================================================== */

.file-tree { font-size: 0.8125rem; user-select: none; }
.file-tree ul { list-style: none; margin: 0; padding-left: 14px; }
.file-tree > ul { padding-left: 0; }

.tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 5px 8px;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-2);
    text-align: left;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.tree-row:hover { background: var(--surface-3); color: var(--text); }
.tree-row.is-active { background: var(--brand-soft); color: var(--brand-600); font-weight: 600; }
.tree-row .caret { flex: 0 0 12px; font-size: 0.625rem; color: var(--text-4); transition: transform var(--dur-fast) var(--ease); }
.tree-row.is-open .caret { transform: rotate(90deg); }
.tree-row .f-icon { flex: 0 0 16px; font-size: 0.875rem; text-align: center; }
.tree-row .f-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .f-tag { font-size: 0.625rem; padding: 1px 5px; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent-600); font-weight: 600; }
.tree-row .f-dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }

.tree-children { display: none; }
.tree-children.is-open { display: block; animation: treeIn 180ms var(--ease); }

@keyframes treeIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: none; }
}

.ext-html { color: #e34c26; }
.ext-css { color: #2965f1; }
.ext-js { color: #d6a700; }
.ext-json { color: #7c8aa0; }
.ext-img { color: #16a34a; }
.ext-font { color: #8b5cf6; }
.ext-md { color: #64748b; }

/* ==========================================================================
   Workspace shell
   ========================================================================== */

.workspace {
    display: flex;
    height: calc(100vh - var(--topbar-h));
    background: var(--surface-2);
    overflow: hidden;
}

.workspace.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1060;
    height: 100vh;
}

.ws-pane { display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.ws-pane-left { flex: 0 0 260px; border-right: 1px solid var(--border); }
.ws-pane-center { position: relative; flex: 1 1 auto; background: #0d1726; }
.ws-pane-right { flex: 0 0 380px; border-left: 1px solid var(--border); }

.ws-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    height: 46px;
    padding: 0 var(--space-3);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.ws-head-title { display: flex; align-items: center; gap: 7px; font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.ws-head-title i { color: var(--text-3); }
.ws-head .icon-btn { width: 30px; height: 30px; font-size: 0.9375rem; }

.ws-body { flex: 1 1 auto; overflow-y: auto; padding: var(--space-2); }
.ws-body.is-flush { padding: 0; }

.ws-search { padding: var(--space-2) var(--space-2) 0; }
.ws-search input { width: 100%; height: 32px; padding: 0 10px 0 29px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.8125rem; }
.ws-search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); background: var(--surface); }

.project-picker {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.project-picker:hover { background: var(--surface); border-color: var(--border-strong); }

.ws-group { margin-bottom: var(--space-3); }

.ws-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 4px;
    padding: 0 8px;
    font-size: 0.6563rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-4);
}

.ws-group-label i { font-size: 0.75rem; }

.ws-resizer {
    flex: 0 0 5px;
    cursor: col-resize;
    background: transparent;
    position: relative;
    z-index: 5;
    transition: background-color var(--dur-fast) var(--ease);
}

.ws-resizer::after {
    content: "";
    position: absolute;
    inset: 0 2px;
    border-radius: 2px;
    background: transparent;
    transition: background-color var(--dur-fast) var(--ease);
}

.ws-resizer:hover::after, .ws-resizer.is-dragging::after { background: var(--brand); }
body.is-resizing { cursor: col-resize; user-select: none; }

/* Editor tabs */
.editor-tabs {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    gap: 1px;
    height: 46px;
    background: #0a1220;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    overflow-x: auto;
    scrollbar-width: none;
}

.editor-tabs::-webkit-scrollbar { height: 0; }

.editor-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: #8fa1bb;
    font-size: 0.8125rem;
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.editor-tab:hover { background: rgba(255, 255, 255, 0.05); color: #cbd5e1; }
.editor-tab.is-active { background: #0d1726; color: #fff; border-bottom-color: var(--brand); }
.editor-tab .t-dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.editor-tab .t-close { border: 0; background: transparent; color: inherit; opacity: 0.55; padding: 0; width: 16px; height: 16px; border-radius: 3px; font-size: 0.75rem; }
.editor-tab .t-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }

.editor-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 7px var(--space-3);
    background: #0d1726;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #8fa1bb;
    font-size: 0.75rem;
}

.editor-toolbar .path { font-family: var(--font-mono); color: #7f92ad; }
.editor-toolbar .sep { opacity: 0.4; }
.editor-toolbar .spacer { margin-left: auto; }

.editor-mode-switch {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
}

.editor-mode-switch button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 9px;
    border: 0;
    border-radius: calc(var(--radius-sm) - 2px);
    background: transparent;
    color: #8fa1bb;
    font-size: 0.7188rem;
    font-weight: 600;
    cursor: pointer;
}

.editor-mode-switch button:hover { color: #e2e8f0; background: rgba(255, 255, 255, 0.06); }
.editor-mode-switch button.is-active { color: #fff; background: var(--brand); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.editor-mode-switch button:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.editor-toolbar .dark-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.04);
    color: #c9d4e5;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.editor-toolbar .dark-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.18); }
.editor-toolbar .dark-btn.is-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.editor-toolbar .dark-btn.is-primary:hover { background: var(--brand-600); }
.editor-toolbar .dark-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.editor-find {
    display: none;
    align-items: center;
    gap: 7px;
    padding: 7px var(--space-3);
    background: #101d31;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.editor-find.is-open { display: flex; }
.editor-find input {
    height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xs);
    background: rgba(0, 0, 0, 0.28);
    color: #e2e8f0;
    font-size: 0.75rem;
    width: 220px;
}
.editor-find input:focus { outline: none; border-color: var(--brand); }
.editor-find .find-count { font-size: 0.75rem; color: #7f92ad; font-variant-numeric: tabular-nums; }

/* Code editor */
.code-editor {
    position: relative;
    flex: 1 1 auto;
    overflow: auto;
    background: #0d1726;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
}

.code-editor::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); background-clip: content-box; }

.design-preview {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #f4f6f9;
}

.design-preview iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.design-preview-state {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: rgba(244, 246, 249, 0.92);
    color: var(--text-3);
    font-size: 0.8125rem;
}

.design-preview-state.is-visible { display: flex; }

.code-surface { display: flex; min-height: 100%; min-width: max-content; }

.code-gutter {
    position: sticky;
    left: 0;
    z-index: 2;
    flex: 0 0 auto;
    padding: 14px 12px 14px 16px;
    text-align: right;
    color: #4a5f7e;
    background: #0d1726;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    user-select: none;
    font-variant-numeric: tabular-nums;
}

.code-gutter div.is-current { color: #cbd5e1; }

.code-area { position: relative; flex: 1 1 auto; padding: 14px 20px 40px; }

.code-area pre {
    margin: 0;
    font: inherit;
    color: #d7e0ee;
    white-space: pre;
    tab-size: 2;
}

.code-area mark { background: rgba(249, 115, 22, 0.35); color: inherit; border-radius: 2px; padding: 0; }

/* Word wrap: long lines wrap inside the editor width instead of scrolling sideways.
   workspace.js sizes each line number to the wrapped height of its line. */
.code-editor.is-wrap .code-surface { min-width: 0; }
.code-editor.is-wrap .code-area { min-width: 0; }
.code-editor.is-wrap .code-area pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.code-editor.is-wrap .code-gutter > div { display: flex; align-items: flex-start; justify-content: flex-end; }
.code-wrap-mirror { position: absolute; top: 0; left: -99999px; visibility: hidden; pointer-events: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-toolbar .dark-btn.is-on { border-color: rgba(96, 165, 250, 0.45); background: rgba(37, 99, 235, 0.2); color: #bfdbfe; }
.editor-busy { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; gap: 10px; background: rgba(13, 23, 38, 0.78); color: #cbd5e1; font-size: 0.8125rem; font-weight: 500; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.editor-busy.is-visible { display: flex; }
.editor-busy .spinner-border { color: #93c5fd; }
.code-area mark.is-current { background: rgba(249, 115, 22, 0.75); color: #0d1726; }

/* Token colours */
.tok-tag { color: #7ea9ff; }
.tok-attr { color: #86e0c0; }
.tok-str { color: #f0b37e; }
.tok-com { color: #5b7091; font-style: italic; }
.tok-sel { color: #7ea9ff; }
.tok-prop { color: #86e0c0; }
.tok-val { color: #f0b37e; }
.tok-num { color: #d9a0ff; }
.tok-kw { color: #ff8fb1; }
.tok-fn { color: #ffd479; }
.tok-punc { color: #8fa1bb; }

.editor-status {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 5px var(--space-3);
    background: #0a1220;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #7f92ad;
    font-size: 0.6875rem;
    font-family: var(--font-mono);
}

.editor-status .spacer { margin-left: auto; }
.editor-status .is-dirty { color: #fdba74; }

.binary-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    height: 100%;
    color: #7f92ad;
    text-align: center;
    padding: var(--space-8);
}

.binary-notice i { font-size: 2.5rem; color: #4a5f7e; }

/* ==========================================================================
   AI chat
   ========================================================================== */

.chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.chat-msg { display: flex; gap: 10px; animation: msgIn var(--dur-slow) var(--ease); }

@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.chat-avatar { flex: 0 0 30px; height: 30px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 0.8125rem; }
.chat-avatar.is-ai { background: linear-gradient(140deg, var(--brand), var(--accent)); color: #fff; }
.chat-avatar.is-user { background: var(--surface-3); color: var(--text-2); }

.chat-content { flex: 1 1 auto; min-width: 0; }
.chat-name { font-size: 0.75rem; font-weight: 600; color: var(--text-2); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.chat-name .time { font-weight: 400; color: var(--text-4); }

.chat-bubble {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.8438rem;
    color: var(--text-2);
    line-height: 1.55;
}

.chat-msg.is-user .chat-bubble { background: var(--brand-soft); border-color: rgba(37, 99, 235, 0.16); color: var(--navy-800); }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble code { font-family: var(--font-mono); font-size: 0.75rem; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--brand-600); }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); animation: typing 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* AI proposal card */
.ai-proposal {
    margin-top: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.ai-proposal.is-resolved { opacity: 0.62; transition: opacity var(--dur-fast) var(--ease); }

.ai-proposal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 9px 12px;
    background: linear-gradient(90deg, var(--brand-soft), var(--accent-soft));
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--navy-800);
}

.ai-file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-2);
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}

.ai-file-row:hover { background: var(--surface-2); }
.ai-file-row .f-path { flex: 1 1 auto; font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-file-row .plus { color: var(--success); font-weight: 600; }
.ai-file-row .minus { color: var(--danger); font-weight: 600; }

.ai-proposal-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; background: var(--surface-2); }

.chat-foot { flex: 0 0 auto; border-top: 1px solid var(--border); padding: var(--space-3); background: var(--surface); }

.chat-quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chat-quick::-webkit-scrollbar { height: 0; }

.quick-chip {
    flex: 0 0 auto;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 0.75rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.quick-chip:hover { background: var(--brand-soft); border-color: rgba(37, 99, 235, 0.25); color: var(--brand-600); }

.chat-input-wrap {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.chat-input-wrap:focus-within { border-color: var(--brand); box-shadow: var(--ring); background: var(--surface); }

.chat-input-wrap textarea {
    width: 100%;
    max-height: 160px;
    padding: 10px 12px 6px;
    border: 0;
    background: transparent;
    resize: none;
    font-size: 0.8438rem;
    font-family: inherit;
    color: var(--text);
}

.chat-input-wrap textarea:focus { outline: none; }
.chat-input-bar { display: flex; align-items: center; gap: 6px; padding: 4px 8px 8px 10px; }
.chat-input-bar .model-tag { font-size: 0.6875rem; color: var(--text-4); display: inline-flex; align-items: center; gap: 5px; }
.model-picker { display: inline-flex; align-items: center; gap: 5px; color: var(--text-4); font-size: 0.6875rem; }
.model-picker select { max-width: 150px; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--text-3); font: inherit; font-weight: 600; padding: 3px 18px 3px 3px; cursor: pointer; }
.model-picker select:hover { background: var(--surface-2); color: var(--text-1); }
.model-picker select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.model-picker select:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-send { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm); background: var(--brand); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background-color var(--dur-fast) var(--ease), transform 90ms var(--ease); }
.chat-send:hover { background: var(--brand-600); }
.chat-send:active { transform: scale(0.94); }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ==========================================================================
   Diff viewer
   ========================================================================== */

.diff-viewer {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
}

.diff-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 9px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
}

.diff-head .d-path { font-family: var(--font-mono); font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diff-head .d-stat { display: inline-flex; gap: 8px; flex: 0 0 auto; }

.diff-scroll { max-height: 420px; overflow: auto; }

.diff-lines { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.65; }
.diff-lines td { padding: 0 6px; vertical-align: top; white-space: pre; }
.diff-lines .ln { width: 1%; text-align: right; color: var(--text-4); user-select: none; background: var(--surface-2); border-right: 1px solid var(--border); font-variant-numeric: tabular-nums; padding-inline: 10px; }
.diff-lines .mk { width: 1%; text-align: center; color: var(--text-4); user-select: none; padding-inline: 4px; }
.diff-lines .code { padding-right: 16px; color: var(--text-2); }

.diff-lines tr.is-added { background: #e8f8ee; }
.diff-lines tr.is-added .mk, .diff-lines tr.is-added .code { color: #14532d; }
.diff-lines tr.is-added .ln { background: #d7f0e1; color: #2f6b46; }

.diff-lines tr.is-removed { background: #fdecec; }
.diff-lines tr.is-removed .mk, .diff-lines tr.is-removed .code { color: #7f1d1d; }
.diff-lines tr.is-removed .ln { background: #fadada; color: #9b3131; }

.diff-split { display: grid; grid-template-columns: 1fr 1fr; }
.diff-split > div { min-width: 0; }
.diff-split > div + div { border-left: 1px solid var(--border); }
.diff-side-label { padding: 7px 12px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); }

@media (max-width: 767.98px) {
    .diff-split { grid-template-columns: 1fr; }
    .diff-split > div + div { border-left: 0; border-top: 1px solid var(--border); }
}

/* ==========================================================================
   AI line operations (the JSON patch Gemini returns)
   ========================================================================== */

.op-list {
    list-style: none;
    counter-reset: op;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-3);
}

.op-item {
    counter-increment: op;
    position: relative;
    padding: var(--space-3) var(--space-4) var(--space-3) var(--space-10);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.op-item::before {
    content: counter(op);
    position: absolute;
    left: var(--space-4);
    top: var(--space-3);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--text-3);
    font-size: 0.6875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.op-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.op-line { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; color: var(--text-2); }
.op-reason { font-size: 0.8125rem; color: var(--text-3); }
.op-expect { margin: 8px 0 0; font-size: 0.75rem; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.op-expect i { color: var(--success); }
.op-expect code { font-family: var(--font-mono); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }

.op-content {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--success-soft);
    border: 1px solid rgba(22, 163, 74, 0.2);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    color: #14532d;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

.json-block {
    margin: 0;
    padding: var(--space-4);
    max-height: 460px;
    overflow: auto;
    border-radius: var(--radius-md);
    background: #0d1726;
    color: #d7e0ee;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.65;
}

.json-block::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); background-clip: content-box; }

.patch-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    font-size: 0.8125rem;
    color: var(--text-2);
}

.patch-summary strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Live preview
   ========================================================================== */

.preview-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-h));
    background: var(--surface-3);
}

.preview-bar {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.preview-url {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 260px;
    min-width: 0;
    height: 36px;
    padding: 0 6px 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-3);
}

.preview-url .lock { color: var(--success); flex: 0 0 auto; }
.preview-url .u-text { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview-stage {
    flex: 1 1 auto;
    display: grid;
    place-items: center;
    padding: var(--space-6);
    overflow: auto;
    background-image: radial-gradient(circle at 1px 1px, rgba(16, 24, 40, 0.07) 1px, transparent 0);
    background-size: 22px 22px;
}

.device-frame {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: max-width var(--dur-slow) var(--ease), height var(--dur-slow) var(--ease), border-radius var(--dur-slow) var(--ease);
}

.device-frame[data-device="tablet"] { max-width: 834px; height: min(1050px, 100%); border-radius: 22px; }
.device-frame[data-device="mobile"] { max-width: 390px; height: min(844px, 100%); border-radius: 30px; }

.device-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

.device-notch {
    display: none;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 108px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--navy-950);
    z-index: 3;
}

.device-frame[data-device="mobile"] .device-notch { display: block; }
.device-frame[data-device="mobile"] iframe { padding-top: 34px; background: #fff; }

.preview-loading {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    color: var(--text-3);
    font-size: 0.8125rem;
}

.preview-loading.is-visible { display: flex; }

.preview-foot {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: 8px var(--space-4);
    background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-3);
}

.preview-foot .spacer { margin-left: auto; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); animation: pulse 2s infinite; }

@keyframes pulse {
    70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* ==========================================================================
   Version history
   ========================================================================== */

.version-list { display: flex; flex-direction: column; }

.version-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}

.version-item:hover { background: var(--surface-2); }
.version-item.is-selected { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.version-item:last-child { border-bottom: 0; }

.version-badge {
    flex: 0 0 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-size: 0.8125rem;
    font-weight: 700;
    background: var(--surface-3);
    color: var(--text-2);
}

.version-badge.is-ai { background: linear-gradient(140deg, var(--brand), var(--accent)); color: #fff; }
.version-item .v-title { font-size: 0.875rem; font-weight: 600; }
.version-item .v-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; font-size: 0.75rem; color: var(--text-4); }
.version-item .v-prompt { margin-top: 8px; padding: 7px 10px; border-left: 2px solid var(--brand); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.75rem; color: var(--text-2); font-style: italic; }
.version-item .v-files { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.file-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-3);
}

/* ==========================================================================
   Permission matrix
   ========================================================================== */

.matrix-wrap { overflow: auto; max-height: 560px; }

.matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
}

.matrix th, .matrix td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.matrix th:last-child, .matrix td:last-child { border-right: 0; }

.matrix thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 10px 12px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    min-width: 118px;
}

.matrix thead th:first-child { left: 0; z-index: 4; text-align: left; min-width: 220px; }

.matrix tbody th {
    position: sticky;
    left: 0;
    z-index: 2;
    padding: 10px 12px;
    background: var(--surface);
    text-align: left;
    font-weight: 500;
}

.matrix tbody td { padding: 8px; text-align: center; background: var(--surface); }
.matrix tbody tr:hover th, .matrix tbody tr:hover td { background: var(--surface-2); }

.perm-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.perm-toggle {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--text-4);
    font-size: 0.75rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all var(--dur-fast) var(--ease);
}

.perm-toggle:hover { border-color: var(--border-strong); color: var(--text-2); }
.perm-toggle.is-on { background: var(--brand-soft); border-color: rgba(37, 99, 235, 0.28); color: var(--brand-600); }
.perm-toggle.is-on[data-perm="edit"] { background: var(--success-soft); border-color: rgba(22, 163, 74, 0.28); color: var(--success); }
.perm-toggle.is-on[data-perm="ai"] { background: var(--accent-soft); border-color: rgba(249, 115, 22, 0.28); color: var(--accent-600); }
.perm-toggle.is-locked { background: var(--surface-3); border-style: dashed; cursor: not-allowed; color: var(--text-4); }

.matrix-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 0.75rem; color: var(--text-3); }
.matrix-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ==========================================================================
   Charts
   ========================================================================== */

.chart-box { position: relative; height: 300px; }
.chart-box.is-sm { height: 220px; }
.chart-box.is-xs { height: 150px; }

.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 0.75rem; color: var(--text-3); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.bar-row { display: flex; align-items: center; gap: var(--space-3); padding: 9px 0; }
.bar-row + .bar-row { border-top: 1px solid var(--border); }
.bar-label { flex: 0 0 148px; font-size: 0.8125rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1 1 auto; height: 8px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #60a5fa); transition: width 700ms var(--ease); }
.bar-fill.is-accent { background: linear-gradient(90deg, var(--accent), #fbbf24); }
.bar-value { flex: 0 0 84px; text-align: right; font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* ==========================================================================
   Command palette
   ========================================================================== */

.palette-dialog { max-width: 620px; }
.palette-content { border-radius: var(--radius-xl); overflow: hidden; }

.palette-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.palette-input-wrap i { color: var(--text-4); font-size: 1.0625rem; }
.palette-input-wrap input { flex: 1 1 auto; border: 0; background: transparent; font-size: 0.9375rem; color: var(--text); }
.palette-input-wrap input:focus { outline: none; }

.palette-results { max-height: 380px; overflow-y: auto; padding: 8px; }
.palette-group-label { padding: 8px 10px 4px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-4); }

.palette-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    text-align: left;
    color: var(--text-2);
    font-size: 0.875rem;
    cursor: pointer;
}

.palette-item:hover, .palette-item.is-active { background: var(--brand-soft); color: var(--brand-600); }
.palette-item i { font-size: 1rem; color: var(--text-3); }
.palette-item:hover i, .palette-item.is-active i { color: var(--brand); }
.palette-item .p-sub { margin-left: auto; font-size: 0.75rem; color: var(--text-4); }

.palette-foot { display: flex; gap: var(--space-4); padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 0.6875rem; color: var(--text-4); }
.palette-foot kbd { padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); font-size: 0.625rem; color: var(--text-3); }

/* ==========================================================================
   Workspace responsive
   ========================================================================== */

@media (max-width: 1199.98px) {
    .ws-pane-right { flex-basis: 330px; }
    .ws-pane-left { flex-basis: 224px; }
}

/* Base rules first, so the phone and tablet block below can override them. */
.ws-mobile-tabs { display: none; flex: 0 0 auto; background: var(--surface); border-bottom: 1px solid var(--border); }
.ws-mobile-tabs button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px; border: 0; background: transparent; color: var(--text-3); font-size: 0.8125rem; font-weight: 500; border-bottom: 2px solid transparent; }
.ws-mobile-tabs button.is-active { color: var(--brand); border-bottom-color: var(--brand); }

/* Phones and tablets: one pane at a time, filling the screen below the top bar.
   100dvh follows the visible height when the mobile browser bars show or hide;
   100vh is the fallback for browsers without dvh. */
@media (max-width: 991.98px) {
    .workspace { flex-direction: column; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }
    .ws-resizer { display: none; }
    .ws-mobile-tabs { display: flex; }
    .ws-pane-left, .ws-pane-center, .ws-pane-right { flex: 1 1 auto; width: 100%; min-height: 0; max-height: none; height: auto; border: 0; }
    .workspace[data-mobile-pane="files"] .ws-pane-center,
    .workspace[data-mobile-pane="files"] .ws-pane-right { display: none; }
    .workspace[data-mobile-pane="editor"] .ws-pane-left,
    .workspace[data-mobile-pane="editor"] .ws-pane-right { display: none; }
    .workspace[data-mobile-pane="chat"] .ws-pane-left,
    .workspace[data-mobile-pane="chat"] .ws-pane-center { display: none; }

    /* The code scrolls both ways with a finger, and never drags the page along. */
    .code-editor { min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x pan-y; }

    /* The toolbar keeps every button reachable by sliding it sideways. */
    .editor-toolbar { overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
    .editor-toolbar::-webkit-scrollbar { height: 0; }
    .editor-toolbar > * { flex-shrink: 0; }
}

@media (max-width: 575.98px) {
    .editor-toolbar .path, .editor-toolbar .sep { display: none; }
    .code-gutter { padding-left: 10px; padding-right: 8px; }
    .code-area { padding-left: 12px; padding-right: 16px; }
}

/* ==========================================================================
   Public pages (Home, About, Contact) - _PublicLayout.cshtml
   ========================================================================== */

.pub-body { background: var(--surface); }
html:has(.pub-body) { scroll-behavior: smooth; scroll-padding-top: 88px; }
.pub-container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }

.pub-skip { position: absolute; left: 16px; top: -48px; z-index: 1100; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--text); color: #fff; font-size: 0.875rem; transition: top var(--dur) var(--ease); }
.pub-skip:focus { top: 12px; color: #fff; }

/* Navigation */
.pub-nav { position: sticky; top: 0; z-index: 1030; background: rgba(255, 255, 255, 0.82); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid transparent; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.pub-nav.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05); }
.pub-nav-inner { display: flex; align-items: center; gap: 32px; height: 68px; }
.pub-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: 0 0 auto; }
.pub-brand:hover { color: var(--text); }
.pub-brand .brand-name { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.02em; }
.pub-links { display: flex; align-items: center; gap: 4px; }
.pub-links a { position: relative; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 0.9063rem; font-weight: 500; text-decoration: none; transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.pub-links a:hover { color: var(--text); background: var(--surface-3); }
.pub-links a.is-active { color: var(--text); font-weight: 600; }
.pub-links a.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--brand); }
.pub-links a:focus-visible, .pub-menu a:focus-visible, .pub-menu-btn:focus-visible, .pub-link-arrow:focus-visible, .pub-footer a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pub-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pub-menu-btn { display: none; width: 40px; height: 40px; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 1.25rem; transition: background-color var(--dur-fast) var(--ease); }
.pub-menu-btn:hover { background: var(--surface-3); }
.pub-menu { border-top: 1px solid var(--border); background: var(--surface); }
.pub-menu nav { display: grid; gap: 2px; padding-top: 10px; padding-bottom: 14px; }
.pub-menu a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; text-decoration: none; }
.pub-menu a i { color: var(--text-3); font-size: 1.0625rem; }
.pub-menu a:hover { background: var(--surface-3); color: var(--text); }
.pub-menu a.is-active { background: var(--brand-soft); color: var(--brand-700); }
.pub-menu a.is-active i { color: var(--brand); }

/* Hero */
.pub-hero { position: relative; overflow: hidden; padding: 72px 0 24px; }
.pub-hero-page { padding: 72px 0 48px; }
.pub-hero-glow { position: absolute; inset: -30% 0 auto; height: 720px; pointer-events: none; background: radial-gradient(40% 50% at 30% 30%, rgba(37, 99, 235, 0.13), transparent 70%), radial-gradient(35% 45% at 72% 26%, rgba(249, 115, 22, 0.09), transparent 70%); }
.pub-hero-glow::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 48px 48px; opacity: 0.45; -webkit-mask-image: radial-gradient(60% 55% at 50% 45%, #000, transparent 75%); mask-image: radial-gradient(60% 55% at 50% 45%, #000, transparent 75%); }
.pub-hero-inner { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.pub-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid var(--brand-soft-2); border-radius: var(--radius-full); background: rgba(238, 244, 255, 0.8); color: var(--brand-700); font-size: 0.8125rem; font-weight: 600; }
.pub-pill .dot-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15); }
.pub-display { max-width: 16ch; margin: 22px 0 18px; font-size: clamp(2.25rem, 5.2vw, 3.75rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.06; }
.pub-display-sm { max-width: 20ch; margin-top: 4px; font-size: clamp(2rem, 4.4vw, 3rem); }
.pub-gradient-text { background: linear-gradient(100deg, var(--brand) 5%, #3b82f6 50%, var(--accent) 115%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pub-lead { max-width: 60ch; margin: 0; color: var(--text-2); font-size: 1.125rem; line-height: 1.65; }
.pub-hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.pub-hero-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; margin: 22px 0 0; padding: 0; list-style: none; color: var(--text-3); font-size: 0.875rem; }
.pub-hero-facts i { margin-right: 6px; color: var(--success); }

/* Demo editor */
#try { position: relative; margin-top: 56px; }
.landing-demo { position: relative; overflow: hidden; border: 1px solid #1e2b40; border-radius: var(--radius-xl); background: #0d1726; box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.7), 0 2px 4px rgba(16, 24, 40, 0.06), 0 30px 80px -12px rgba(15, 30, 70, 0.35); }
.demo-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); height: 480px; background: #0d1726; }
.demo-tree { min-width: 0; padding: 12px 8px; overflow: auto; background: #0a1220; border-right: 1px solid rgba(255, 255, 255, 0.07); }
.demo-tree-head { display: flex; align-items: center; gap: 6px; margin: 0; padding: 4px 8px 10px; color: #5b7091; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.demo-tree button { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 6px 10px; border: 0; border-radius: var(--radius-xs); background: transparent; color: #8fa1bb; font-size: 0.8125rem; text-align: left; cursor: pointer; transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.demo-tree button:hover { background: rgba(255, 255, 255, 0.05); color: #cbd5e1; }
.demo-tree button.is-active { background: rgba(37, 99, 235, 0.2); color: #fff; }
.demo-tree button:focus-visible, .landing-demo .editor-tab:focus-visible, .landing-demo .dark-btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: -2px; }
.demo-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.demo-main .editor-tabs { height: 42px; }
.demo-main .code-area { display: grid; padding-bottom: 20px; }
.demo-main .code-area > * { grid-area: 1 / 1; }
.demo-input { display: block; margin: 0; padding: 0; border: 0; outline: 0; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: #e2e8f0; font: inherit; white-space: pre; tab-size: 2; }
.demo-input::selection { background: rgba(126, 169, 255, 0.3); color: transparent; }
.demo-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 18px; padding: 0 4px; color: var(--text-3); font-size: 0.875rem; }
.demo-caption > p > i { margin-right: 6px; color: var(--success); }
.demo-caption strong { color: var(--text-2); font-weight: 600; }
.pub-link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; text-decoration: none; border-radius: 4px; }
.pub-link-arrow i { transition: transform var(--dur) var(--ease); }
.pub-link-arrow:hover { color: var(--brand-700); }
.pub-link-arrow:hover i { transform: translateX(3px); }

/* Sections */
.pub-section { padding: 96px 0; }
.pub-section-alt { background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.pub-section-tight { padding: 72px 0 96px; }
.pub-section-flush { padding-top: 16px; }
.pub-section-head { max-width: 680px; margin: 0 auto 48px; text-align: center; }
.pub-eyebrow { margin: 0 0 12px; color: var(--brand); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.pub-h2 { font-size: clamp(1.625rem, 3vw, 2.25rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.pub-section-sub { max-width: 58ch; margin: 16px auto 0; color: var(--text-3); font-size: 1.0625rem; line-height: 1.6; }

.pub-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-xs); transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity 600ms var(--ease); }
.pub-card h3 { margin: 0 0 8px; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.pub-card p { margin: 0; color: var(--text-3); font-size: 0.9375rem; line-height: 1.6; }

.pub-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.pub-step-no { display: inline-block; margin-bottom: 18px; color: var(--brand); font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 600; }

.pub-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.pub-feature:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.pub-feature-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; margin-bottom: 18px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-600); font-size: 1.125rem; }

/* Call to action band */
.pub-cta { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 28px; padding: 56px; border-radius: var(--radius-xl); color: #fff; background: radial-gradient(60% 120% at 100% 100%, rgba(59, 130, 246, 0.55), transparent 60%), radial-gradient(40% 80% at 0% 0%, rgba(249, 115, 22, 0.18), transparent 60%), linear-gradient(135deg, var(--navy-900), var(--navy-700)); box-shadow: var(--shadow-lg); }
.pub-cta::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px); background-size: 40px 40px; -webkit-mask-image: linear-gradient(90deg, transparent, #000); mask-image: linear-gradient(90deg, transparent, #000); }
.pub-cta-copy, .pub-cta-actions { position: relative; z-index: 1; }
.pub-cta h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.02em; }
.pub-cta p { max-width: 48ch; margin: 10px 0 0; color: var(--navy-text); font-size: 1.0625rem; }
.pub-cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.pub-btn-light { background: #fff; border: 1px solid #fff; color: var(--text); font-weight: 600; }
.pub-btn-light:hover { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--text); }
.pub-btn-light i { transition: transform var(--dur) var(--ease); }
.pub-btn-light:hover i { transform: translateX(3px); }
.pub-btn-glass { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.22); color: #fff; font-weight: 500; }
.pub-btn-glass:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.34); color: #fff; }
.pub-btn-light:focus-visible, .pub-btn-glass:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Lists */
.pub-check-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pub-check-list li { display: flex; align-items: flex-start; gap: 10px; color: var(--text-2); }
.pub-check-list i { margin-top: 2px; color: var(--brand); }

/* About */
.pub-prose { max-width: 760px; display: grid; gap: 44px; }
.pub-prose h2 { margin-bottom: 12px; font-size: 1.375rem; font-weight: 650; letter-spacing: -0.02em; }
.pub-prose p { margin: 0; color: var(--text-2); font-size: 1.0625rem; line-height: 1.75; }
.pub-prose p a { color: var(--brand); font-weight: 500; }
.pub-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.pub-compare h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.pub-compare h3 i { color: var(--text-3); }
.pub-card-accent { border-color: var(--brand-soft-2); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 70%); }
.pub-card-accent h3 i { color: var(--brand); }

/* Contact */
.pub-contact { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.pub-contact-form { padding: 32px; box-shadow: var(--shadow-md); }
.pub-contact-side { display: grid; gap: 16px; }
.pub-contact-topic { display: flex; gap: 16px; padding: 22px; }
.pub-contact-topic .pub-feature-icon { margin-bottom: 0; }
.pub-contact-topic h3 { margin-bottom: 4px; font-size: 1rem; }
.pub-contact-topic p { font-size: 0.875rem; }

/* Footer */
.pub-footer { padding: 56px 0 28px; background: var(--surface-2); border-top: 1px solid var(--border); }
.pub-footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.pub-footer-about p { max-width: 36ch; margin: 16px 0 0; color: var(--text-3); font-size: 0.875rem; line-height: 1.6; }
.pub-footer-head { margin: 0 0 14px; color: var(--text); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.pub-footer ul { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pub-footer ul a { color: var(--text-3); font-size: 0.875rem; text-decoration: none; border-radius: 4px; transition: color var(--dur-fast) var(--ease); }
.pub-footer ul a:hover { color: var(--text); }
.pub-footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--text-4); font-size: 0.8125rem; }
.pub-footer-bottom a { color: var(--brand); text-decoration: none; }
.pub-footer-bottom a:hover { text-decoration: underline; }

/* Scroll reveal (public.js adds .has-reveal to <html>, then .is-revealed per element) */
.has-reveal [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 600ms var(--ease), transform 600ms var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.has-reveal [data-reveal].is-revealed { opacity: 1; transform: none; }
.has-reveal .pub-steps > :nth-child(2), .has-reveal .pub-features > :nth-child(3n + 2) { transition-delay: 80ms; }
.has-reveal .pub-steps > :nth-child(3), .has-reveal .pub-features > :nth-child(3n) { transition-delay: 160ms; }

@media (max-width: 991.98px) {
    .pub-links { display: none; }
    .pub-menu-btn { display: inline-grid; }
    .pub-steps, .pub-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pub-contact { grid-template-columns: minmax(0, 1fr); }
    .pub-footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .pub-footer-about { grid-column: 1 / -1; }
    .pub-cta { padding: 40px; }
}
@media (min-width: 992px) {
    .pub-menu { display: none !important; }
}
@media (max-width: 575.98px) {
    .pub-container { padding: 0 16px; }
    .pub-nav-inner { height: 60px; gap: 12px; }
    .pub-hero { padding-top: 48px; }
    .pub-hero-page { padding: 48px 0 32px; }
    .pub-hero-actions .btn { flex: 1 1 100%; }
    #try { margin-top: 40px; }
    .demo-shell { grid-template-columns: minmax(0, 1fr); height: 400px; }
    .demo-tree { display: none; }
    .pub-section { padding: 64px 0; }
    .pub-section-tight { padding: 48px 0 64px; }
    .pub-section-flush { padding-top: 8px; }
    .pub-section-head { margin-bottom: 32px; }
    .pub-steps, .pub-features, .pub-compare { grid-template-columns: minmax(0, 1fr); }
    .pub-card, .pub-contact-form { padding: 22px; }
    .pub-cta { padding: 28px 22px; }
    .pub-cta-actions, .pub-cta-actions .btn { width: 100%; }
    .pub-footer-grid { gap: 28px; }
}
@media (prefers-reduced-motion: reduce) {
    html:has(.pub-body) { scroll-behavior: auto; }
    .has-reveal [data-reveal] { opacity: 1; transform: none; transition: none; }
    .pub-link-arrow:hover i, .pub-btn-light:hover i { transform: none; }
}
