@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── VARIABLES & THEME ────────────────────────────────────────────────────── */

:root {
    --color-background-primary: #ffffff;
    --color-background-secondary: #f4f5f7;
    --color-background-tertiary: #fafafb;

    --color-text-primary: #111827;
    --color-text-secondary: #4b5563;

    --color-border-secondary: #9ca3af;
    --color-border-tertiary: #d1d5db;
}

/* ── BASE & RESET ─────────────────────────────────────────────────────────── */

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

body {
    font-family: 'DM Sans', sans-serif;
    color: var(--color-text-primary);
    background: var(--color-background-tertiary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-background-tertiary);
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ── APP LAYOUT ───────────────────────────────────────────────────────────── */

.shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.3s ease;
}

.main {
    padding: 3rem 4rem;
    overflow-y: auto;
}

.sidebar {
    background: #161616;
    padding: 1.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar::-webkit-scrollbar-track {
    background: #161616;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #333;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.mobile-toggle {
    display: none;
    background: #161616;
    color: #fff;
    border: none;
    padding: 1rem;
    cursor: pointer;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
    text-align: left;
    font-size: 1.2rem;
    border-bottom: 1px solid #333;
}

/* ── NAVIGATION & SIDEBAR ─────────────────────────────────────────────────── */

.logo {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #2e2e2e;
    display: flex;
    justify-content: center;
}

.logo img {
    max-width: 130px;
    height: auto;
    display: block;
}

.nav-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: #666;
    text-transform: uppercase;
    padding: 0.7rem 0 0.35rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #999;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: #222;
    color: #ddd;
}

.nav-item.active {
    background: #262626;
    color: #fff;
}

.nav-item .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #333;
    flex-shrink: 0;
    transition: background 0.15s;
}

.nav-item.active .dot {
    background: #B8960C;
}

.sidebar-divider {
    height: 1px;
    background: #2a2a2a;
    margin: 180px 0 1.5rem;
}

.sidebar-actions {
    margin-top: 1.5rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #2e2e2e;
}

.github-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem;
    color: #666;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.github-link:hover {
    color: #fff;
}

.github-link svg {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.github-link:hover svg {
    opacity: 1;
}

/* ── PROGRESS & FEEDBACK ─────────────────────────────────────────────────── */

.pbar {
    height: 3px;
    background: #2a2a2a;
    margin: 1.5rem 0;
    border-radius: 2px;
    overflow: hidden;
}

.pfill {
    height: 100%;
    background: #B8960C;
    border-radius: 2px;
    transition: width 0.4s ease-in-out;
}

.toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #181818;
    color: #fff;
    padding: 0.85rem 1.5rem;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    border: 1px solid #333;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.toast.show {
    display: flex;
    animation: slideDownToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── CARD-BASED FORM SECTIONS ────────────────────────────────────────────── */

.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
    color: var(--color-text-primary);
}

.section-sub {
    font-size: 13.5px;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

.card {
    background: var(--color-background-primary);
    border-radius: 12px;
    border: 1px solid var(--color-border-tertiary);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.card-title {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.field-row.single {
    grid-template-columns: 1fr;
}

.field-row.triple {
    grid-template-columns: 1fr 1fr 1fr;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.field input,
.field textarea {
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    color: var(--color-text-primary);
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border-tertiary);
    border-radius: 8px;
    padding: 0.75rem 0.85rem;
    outline: none;
    transition: all 0.2s ease;
    resize: vertical;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.field input:focus,
.field textarea:focus {
    border-color: #B8960C;
    background: var(--color-background-primary);
    box-shadow: 0 0 0 4px rgba(184, 150, 12, 0.1);
}

.field textarea {
    min-height: 96px;
    line-height: 1.6;
}

.block-item {
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border-tertiary);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.block-tag {
    font-size: 12px;
    font-weight: 600;
    color: #B8960C;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rm-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 18px;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.rm-btn:hover {
    color: #e24b4a;
    background: rgba(226, 75, 74, 0.1);
}

.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.85rem 1rem;
    border: 1.5px dashed var(--color-border-secondary);
    border-radius: 8px;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 0.5rem;
}

.add-btn:hover {
    border-color: #B8960C;
    color: #B8960C;
    background: rgba(184, 150, 12, 0.04);
}

.panel {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.panel.active {
    display: block;
}

/* ── SKILLS COMPONENTS ────────────────────────────────────────────────────── */

.skills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
}

.skill-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-background-primary);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--color-border-tertiary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.skill-chip button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

.skill-chip button:hover {
    color: #e24b4a;
}

.ski-row {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
}

.ski-row input {
    flex: 1;
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--color-border-tertiary);
    border-radius: 8px;
    background: var(--color-background-secondary);
    outline: none;
    color: var(--color-text-primary);
    transition: all 0.2s ease;
}

.ski-row input:focus {
    border-color: #B8960C;
    box-shadow: 0 0 0 4px rgba(184, 150, 12, 0.1);
}

.ski-row button {
    padding: 0.65rem 1.25rem;
    background: #161616;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ski-row button:hover {
    background: #2a2a2a;
}

/* ── TEMPLATE SELECTION INTERFACE ────────────────────────────────────────── */

.tpl-section {
    margin-bottom: 0.5rem;
}

.tpl-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    height: 224px;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    margin-bottom: -150px;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: #555 transparent;
}

.tpl-cards::-webkit-scrollbar {
    width: 5px;
}

.tpl-cards::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.tpl-card {
    border: 1px solid #2e2e2e;
    border-radius: 8px;
    padding: 0.6rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    display: flex;
    flex-direction: column;
}

.tpl-card:hover {
    border-color: #555;
    background: #222;
}

.tpl-card.selected {
    border-color: #B8960C;
    background: #1e1a0e;
    box-shadow: 0 0 0 1px #B8960C;
}

.tpl-card-name {
    font-size: 11px;
    color: #e5e5e5;
    font-weight: 600;
    margin-bottom: 2px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.tpl-card.selected .tpl-card-name {
    color: #B8960C;
}

.tpl-card-desc {
    font-size: 9.5px;
    color: #666;
    margin-bottom: 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.tpl-card.selected .tpl-card-desc {
    color: #8a7833;
}

.tpl-preview-container {
    width: 100%;
    aspect-ratio: 210 / 297;
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tpl-card.selected .tpl-preview-container {
    border-color: #B8960C;
    box-shadow: 0 0 10px rgba(184, 150, 12, 0.2);
}

.tpl-preview-canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.preview-tooltip {
    position: fixed;
    left: 325px;
    top: 50%;
    transform: translateY(-50%);
    width: 520px;
    max-height: 95vh;
    background: rgba(17, 17, 17, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    z-index: 10000;
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    overflow-y: auto;
    pointer-events: auto;
}

.preview-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(10px);
}

.preview-tooltip canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    margin-bottom: 15px;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.preview-tooltip canvas:last-child {
    margin-bottom: 0;
}

/* Tooltip Scrollbar */
.preview-tooltip::-webkit-scrollbar {
    width: 6px;
}
.preview-tooltip::-webkit-scrollbar-track {
    background: #111;
}
.preview-tooltip::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 10px;
}
.preview-tooltip::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ── FLOATING ACTION MENU ─────────────────────────────────────────────────── */

.floating-menu {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    z-index: 1000;
}

.floating-trigger {
    background: #161616;
    color: #999;
    border: 1px solid #333;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.floating-options {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    width: 220px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-menu:hover .floating-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-options button {
    background: transparent;
    color: #bbb;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.floating-options button:hover {
    background: #262626;
    color: #fff;
}

.floating-options button svg {
    opacity: 0.6;
}

.floating-options button:hover svg {
    opacity: 1;
    color: #B8960C;
}

.opt-divider {
    height: 1px;
    background: #333;
    margin: 4px 8px;
}

.floating-options .opt-danger {
    color: #ff6b6b;
}

.floating-options .opt-danger:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

.floating-options .opt-danger:hover svg {
    color: #ff6b6b;
}

.ats-btn {
    background: transparent;
    color: #bfa12a;
    border: 1px solid #bfa12a;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 10px;
}

.ats-btn:hover {
    background: rgba(184, 150, 12, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 150, 12, 0.15);
}

.export-btn {
    background: #B8960C;
    color: #1a1a1a;
    border: none;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(184, 150, 12, 0.2);
    width: 100%;
}

.export-btn:hover {
    background: #c9a50e;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(184, 150, 12, 0.3);
}

/* ── MODALS & DIALOGS ─────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

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

.modal-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
}

.modal-desc {
    font-size: 13px;
    color: #999;
    margin-bottom: 1.5rem;
}

.modal-textarea, 
.modal-input {
    width: 100%;
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    color: #eee;
    padding: 1rem;
    font-family: inherit;
    font-size: 13.5px;
    margin-bottom: 1.5rem;
    outline: none;
}

.modal-input {
    height: 40px;
    padding: 0 12px;
}

.modal-textarea {
    min-height: 200px;
}

.modal-input:focus, 
.modal-textarea:focus {
    border-color: #B8960C;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    background: #2a2a2a;
    color: #ccc;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

.btn-primary {
    background: #B8960C;
    color: #1a1a1a;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

/* ── ATS CHECKER INTERFACE ───────────────────────────────────────────────── */

.ats-modal-card {
    max-width: 650px;
    width: 95%;
}

.ats-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 600px) {
    .ats-layout {
        flex-direction: row;
        align-items: flex-start;
    }
}

.ats-score-section {
    flex: 0 0 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #111;
    padding: 20px 10px;
    border-radius: 12px;
    border: 1px solid #333;
}

.ats-score-circle-wrapper {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    --p: 0;
    --c: #f87171;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), #222 0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0.8);
    opacity: 0;
}

.ats-score-circle-wrapper.show {
    transform: scale(1);
    opacity: 1;
}

.ats-score-inner {
    width: 94px;
    height: 94px;
    background: #1a1a1a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.ats-score-label {
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    text-align: center;
    line-height: 1.3;
}

.ats-details-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ats-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 15px;
}

.ats-checks-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #aaa;
    margin-bottom: 10px;
    border-bottom: 1px solid #333;
    padding-bottom: 6px;
}

.ats-checks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.ats-checks-list::-webkit-scrollbar { width: 4px; }
.ats-checks-list::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

.ats-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    line-height: 1.5;
    padding: 12px;
    background: #1e1e1e;
    border-radius: 8px;
    border: 1px solid #2a2a2a;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.ats-check-item:hover {
    transform: translateY(-1px);
}

.ats-check-item.pass {
    border-left: 3px solid #4ade80;
}
.ats-check-item.pass:hover {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.05);
}

.ats-check-item.fail {
    border-left: 3px solid #f87171;
}
.ats-check-item.fail:hover {
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.05);
}

.ats-check-icon {
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
}

.ats-check-text {
    color: #ddd;
}

.ats-fix-btn {
    background: linear-gradient(135deg, #B8960C, #d4b537);
    color: #1a1a1a;
    border: none;
    box-shadow: 0 4px 12px rgba(184, 150, 12, 0.2);
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.ats-fix-btn:hover {
    box-shadow: 0 6px 15px rgba(184, 150, 12, 0.4);
    transform: translateY(-2px);
}

/* ── AI CHAT INTERFACE ────────────────────────────────────────────────────── */

.ai-chat-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    background: var(--color-background-primary);
    border: 1px solid var(--color-border-tertiary);
    color: var(--color-text-primary);
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.ai-chat-fab:hover {
    border-color: #B8960C;
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(184,150,12,0.15);
}

.ai-fab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.ai-fab-dot.active { background: #4ade80; }

.ai-chat-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 100vw;
    height: 100vh;
    background: var(--color-background-primary);
    border-left: 1px solid var(--color-border-tertiary);
    box-shadow: -5px 0 25px rgba(0,0,0,0.05);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-drawer.open { right: 0; }

.ai-chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-background-secondary);
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-title-text {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text-primary);
}

.ai-chat-header-actions {
    display: flex;
    gap: 8px;
}

.ai-chat-icon-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 4px;
}

.ai-chat-icon-btn:hover { background: var(--color-border-tertiary); }

.ai-chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--color-background-tertiary);
}

.chat-bubble {
    max-width: 85%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-bubble.user {
    align-self: flex-end;
    background: #111;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.chat-bubble.ai {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--color-border-tertiary);
    color: var(--color-text-primary);
    border-bottom-left-radius: 2px;
}

.ai-typing {
    display: flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.ai-typing span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing span:nth-child(2) { animation-delay: -0.16s; }

.ai-chat-suggestions {
    padding: 0.5rem 1rem;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    background: var(--color-background-tertiary);
    scrollbar-width: none;
}

.ai-chat-suggestions::-webkit-scrollbar { display: none; }

.ai-chat-suggestions button {
    white-space: nowrap;
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border-tertiary);
    color: var(--color-text-secondary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chat-suggestions button:hover {
    background: var(--color-text-primary);
    color: var(--color-background-primary);
}

.ai-chat-input-row {
    padding: 1rem;
    border-top: 1px solid var(--color-border-tertiary);
    display: flex;
    gap: 10px;
    background: var(--color-background-primary);
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid var(--color-border-tertiary);
    border-radius: 12px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13.5px;
    resize: none;
    max-height: 120px;
    outline: none;
    background: var(--color-background-secondary);
}

.ai-chat-input:focus { border-color: #B8960C; }

.ai-chat-send-btn {
    background: #111;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.ai-chat-send-btn:hover { background: #B8960C; }

.ai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ── ANIMATIONS ───────────────────────────────────────────────────────────── */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDownToast {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ── RESPONSIVE DESIGN ────────────────────────────────────────────────────── */

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

    .sidebar {
        position: fixed;
        left: -100%;
        width: 320px;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .main {
        padding: 5rem 2rem 2rem 2rem;
    }

    .preview-tooltip {
        display: none !important;
    }

    .field-row,
    .field-row.triple {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .ai-chat-drawer { width: 100%; right: -100%; }
    .ai-chat-fab { bottom: 1rem; right: 1rem; }
    .floating-menu { bottom: 5rem; }
}