/* ===== Persistent top nav ===== */
.top-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}
.top-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 16px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.top-nav a:hover { color: var(--text-color); }
.top-nav a:focus-visible { outline: 2px solid var(--primary-color); outline-offset: -2px; }
.top-nav a[aria-current="page"] {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.theme-toggle { font-size: 14px; }

/* ===== Page root ===== */
.page-root {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.page-root:focus { outline: none; }

/* Generic page heading bar used by Projects / Settings pages */
.page-head {
    padding: 20px 28px 16px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}
.page-head h1 { font-size: 19px; color: var(--text-color); }
.page-head .page-sub { font-size: 12px; color: var(--text-light); flex: 1; }
.page-head:focus { outline: none; }
.page-body { flex: 1; overflow-y: auto; padding: 24px 28px; }

/* ===== Badges (region / status) — always paired with a text label ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 5px;
    padding: 2px 7px;
    white-space: nowrap;
}
.badge-region-IN { background: var(--region-in-bg); color: var(--region-in-fg); }
.badge-region-EU { background: var(--region-eu-bg); color: var(--region-eu-fg); }
.badge-region-US { background: var(--region-us-bg); color: var(--region-us-fg); }
.badge-region-CN { background: var(--region-cn-bg); color: var(--region-cn-fg); }

.badge-status-quotation { background: var(--status-draft-bg); color: var(--status-draft-fg); }
.badge-status-approval  { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.badge-status-released  { background: var(--status-approved-bg); color: var(--status-approved-fg); }

/* ===== Editor page ===== */
.editor-page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.editor-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.editor-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.editor-project-name { font-size: 13px; font-weight: 600; color: var(--text-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-topbar-spacer { flex: 1; }

/* Topbar select "pills" — revision switcher + drawing-style picker */
.select-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 11px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-bg);
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.select-pill:hover, .select-pill:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.select-pill > i { font-size: 11px; color: var(--text-light); pointer-events: none; }
.select-pill .select-pill-caret { font-size: 9px; }
.select-pill-sm { height: 26px; padding: 0 10px; }
.select-pill-sm select { font-size: 12px; font-weight: 500; }
.select-pill select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    outline: none;
}

/* Blocking in-page loader (revision switch / spec fetch) */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--background-color) 55%, transparent);
    backdrop-filter: blur(2px);
}
.page-loader-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
    animation: menu-in var(--duration-normal) var(--ease-out);
}
.page-loader-card i { color: var(--primary-color); font-size: 15px; }
.export-wrap { position: relative; }
.export-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 100;
    overflow: hidden;
    animation: menu-in var(--duration-fast) var(--ease-out);
}
.editor-page .app-body { flex: 1; min-height: 0; }

/* ===== Projects page ===== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    cursor: pointer;
    transition: box-shadow var(--duration-fast) ease, border-color var(--duration-fast) ease, transform var(--duration-fast) ease;
}
.project-card:hover { box-shadow: var(--shadow); border-color: var(--primary-color); transform: translateY(-1px); }
.project-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.project-card-name { font-size: 13.5px; font-weight: 600; color: var(--text-color); }
.project-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.project-card-meta select {
    font-family: var(--font-sans);
    font-size: 11px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px 6px;
    background: var(--surface-sunken);
    color: var(--text-color);
}
.project-card-updated { font-size: 11px; color: var(--text-light); margin-left: auto; }
.project-card-actions { display: flex; gap: 6px; border-top: 1px solid var(--border-color); padding-top: 10px; }

.empty-state {
    max-width: 480px;
    margin: 8vh auto 0;
    text-align: center;
}
.empty-state-icon {
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
}
.empty-state h2 { font-size: 17px; margin-bottom: 8px; }
.empty-state p { font-size: 12.5px; color: var(--text-light); line-height: 1.6; margin-bottom: 20px; }
.empty-state-actions { display: flex; gap: 10px; justify-content: center; }

.new-project-form { max-width: 640px; }

.setup-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--status-progress-bg);
    color: var(--status-progress-fg);
    border-radius: var(--border-radius);
    padding: 14px 18px;
    margin-bottom: 20px;
}
.setup-banner > i { font-size: 22px; flex-shrink: 0; }
.setup-banner > div { flex: 1; }
.setup-banner b { font-size: 13px; }
.setup-banner p { font-size: 12px; margin-top: 3px; line-height: 1.5; }
.setup-banner .btn { flex-shrink: 0; background: var(--status-progress-fg); }
.setup-banner .btn:hover { opacity: 0.9; }

/* ===== Settings pages ===== */
.settings-layout { display: flex; gap: 28px; align-items: flex-start; }
.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 24px;
}
.settings-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}
.settings-nav a:hover { background: var(--surface-sunken); color: var(--text-color); }
.settings-nav a[aria-current="page"] { background: var(--primary-light); color: var(--primary-color); font-weight: 600; }
.settings-content { flex: 1; min-width: 0; max-width: 780px; }
/* Template Studio's 3-column gallery/form/preview layout needs the full
   available width — the 780px reading-width cap above is for the simpler
   single-column settings pages only. */
.settings-content.settings-content-wide { max-width: none; }
.settings-content h3 { font-size: 13px; margin: 18px 0 10px; }
.settings-content h3:first-child { margin-top: 0; }
.settings-warning-banner {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--status-hold-bg);
    color: var(--status-hold-fg);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 16px;
}
.settings-content .field-grid { display: grid; gap: 10px; margin-bottom: 10px; }

/* ===== Template browse page (Settings > Templates) ===== */
.tpl-browse-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    min-height: 520px;
}
.tpl-list { border-right: 1px solid var(--border-color); padding-right: 14px; overflow-y: auto; max-height: 80vh; }
.tpl-list-group {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 14px 0 6px;
}
.tpl-list-group:first-child { margin-top: 0; }
.tpl-list-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    padding: 7px 9px;
    margin-bottom: 3px;
    cursor: pointer;
    font-family: var(--font-sans);
}
.tpl-list-item:hover { background: var(--surface-sunken); }
.tpl-list-item-active { border-color: var(--primary-color); background: var(--primary-light); }
.tpl-list-item-name { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-color); }
.tpl-list-item-meta { display: block; font-size: 10.5px; color: var(--text-light); margin-top: 1px; }
.tpl-list-item-desc {
    display: block;
    font-size: 10.5px;
    color: var(--text-light);
    line-height: 1.35;
    margin-top: 4px;
}
.tpl-list-item-badges { display: inline-flex; gap: 6px; margin-top: 3px; font-size: 10px; color: var(--primary-color); }

.tpl-detail { min-width: 0; display: flex; flex-direction: column; }
.tpl-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.tpl-detail-title { font-size: 17px; margin: 0; }
.tpl-detail-meta { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.tpl-detail-desc {
    max-width: 760px;
    font-size: 12.5px;
    color: var(--text-color);
    line-height: 1.5;
    margin-top: 8px;
}
.tpl-detail-badges { display: flex; gap: 6px; margin-top: 8px; }
.tpl-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tpl-detail-preview {
    flex: 1;
    overflow-y: auto;
    background: var(--surface-sunken);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    max-height: 72vh;
}
.tpl-preview-page {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    width: 100%;
}

.tpl-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 7px;
    border-radius: 999px;
}
.tpl-badge-company { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.tpl-badge-project { background: var(--primary-light); color: var(--primary-color); }

/* ===== Company Master (Settings > Company) ===== */
.co-browse-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
}
.co-list { border-right: 1px solid var(--border-color); padding-right: 14px; overflow-y: auto; max-height: 80vh; }
.co-list-group {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 6px;
}
.co-list-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px 9px;
    margin-bottom: 3px;
    cursor: pointer;
    font-family: var(--font-sans);
}
.co-list-item:hover { background: var(--surface-sunken); }
.co-list-item-active { border-color: var(--primary-color); background: var(--primary-light); }
.co-list-item-name { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-color); }
.co-list-item-meta { display: block; font-size: 10.5px; color: var(--text-light); margin-top: 1px; }
.co-list-add { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-color); }
.co-list-add input {
    width: 100%;
    font-size: 12.5px;
    padding: 7px 9px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    box-sizing: border-box;
}
.co-list-add-actions { display: flex; gap: 6px; }
.co-list-add-actions .btn { flex: 1; }

.co-detail { min-width: 0; }
.co-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.co-detail-title { font-size: 17px; margin: 0; }
.co-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ===== Template edit page (Settings > Templates > Edit) ===== */
.tpl-edit-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-light);
    text-decoration: none;
    margin-bottom: 12px;
}
.tpl-edit-back:hover { color: var(--primary-color); }
.tpl-edit-name-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.tpl-edit-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 20px;
    height: calc(100vh - 245px);
    min-height: 560px;
    min-width: 0;
    overflow: hidden;
}
.tpl-form-col {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 8px;
}
.tpl-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tpl-preview-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.tpl-preview-label { font-size: 11px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.tpl-preview {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--surface-sunken);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 14px;
}
.tpl-preview .tpl-preview-page {
    position: relative;
    width: 100%;
}
.tpl-preview-page-index {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-light);
    font-size: 10px;
    font-weight: 600;
}

/* ===== Template preview zoom (click a page → full-screen lightbox) ===== */
.tpl-preview-zoomable {
    position: relative;
    cursor: zoom-in;
    transition: box-shadow 0.15s ease;
}
.tpl-preview-zoomable:hover { box-shadow: 0 0 0 2px var(--primary-color), 0 4px 14px rgba(0, 0, 0, 0.25); }
.tpl-preview-zoom-hint {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-light);
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}
.tpl-preview-zoomable:hover .tpl-preview-zoom-hint { opacity: 1; }

.tpl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: rgba(15, 18, 24, 0.88);
    backdrop-filter: blur(2px);
}
.tpl-lightbox-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface-color, #fff);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.tpl-lightbox-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tpl-lightbox-zoom {
    min-width: 46px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}
.tpl-lightbox-viewport {
    position: relative;
    flex: 1;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}
.tpl-lightbox-viewport.panning { cursor: grabbing; }
.tpl-lightbox-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    pointer-events: none;
}
.tpl-cell-editor {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    background: var(--surface-sunken);
}
.tpl-cell-editor summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
}

.tpl-editing-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--surface-sunken);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 10px;
}
.tpl-editing-note i { margin-top: 2px; color: var(--primary-color); }
.tpl-editing-note b { color: var(--text-color); }

.xp-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 10px;
    background: var(--surface-sunken);
}
.xp-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 8px; }
.xp-row select {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 7px 8px;
    background: var(--card-bg);
    color: var(--text-color);
}
.xp-body {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 11.5px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 7px 8px;
    background: var(--card-bg);
    color: var(--text-color);
}

/* ===== Choice dialog (e.g. "where should this apply?") ===== */
.choice-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 15, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}
.choice-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    width: min(420px, 92vw);
    padding: 22px;
    animation: menu-in var(--duration-normal) var(--ease-out);
}
.choice-card h3 { font-size: 15px; margin-bottom: 8px; }
.choice-card p { font-size: 12.5px; color: var(--text-light); line-height: 1.5; margin-bottom: 18px; }
.choice-actions { display: flex; flex-direction: column; gap: 8px; }
.choice-actions .btn { justify-content: center; }

/* Prompt-dialog text fields (revision name / note, etc.) */
.choice-field { margin-top: 12px; text-align: left; }
.choice-field label {
    display: block;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}
.choice-input {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 13.5px;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--card-bg);
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.choice-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.choice-input::placeholder { color: var(--text-light); opacity: 0.7; }
.choice-card .choice-field + .choice-actions,
.choice-card .input-wrap + .choice-actions { margin-top: 18px; }

.danger-confirm-prompt { margin-bottom: 8px !important; }
.danger-confirm-input {
    width: 100%;
    font-size: 13px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    box-sizing: border-box;
    font-family: var(--font-sans);
}
.danger-confirm-input:focus-visible { outline: 2px solid var(--danger-color); outline-offset: 1px; }

/* ===== First-run coach marks =====
   Like .tooltip-bubble below, placement is owned entirely by JS
   (js/ui/coach-marks.js), which anchors the card against its target step's
   bounding rect. Declare NO left/top/right/bottom/transform here — a rule
   this file sets would silently fight the inline values (and win whenever
   the browser holds a stale copy of this stylesheet against fresh JS). */
.coach-card {
    position: fixed;
    width: min(360px, calc(100vw - 32px));
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-paper);
    padding: 16px 18px;
    z-index: 400;
    animation: menu-in var(--duration-normal) var(--ease-out);
}
/* spotlight ring on the element the current step points at */
.coach-target {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary-color) 18%, transparent);
    transition: box-shadow var(--duration-normal) var(--ease-out);
}
.coach-step { font-size: 10.5px; font-weight: 600; color: var(--primary-color); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.coach-card h3 { font-size: 14px; margin-bottom: 6px; }
.coach-card p { font-size: 12px; color: var(--text-light); line-height: 1.5; margin-bottom: 14px; }
.coach-actions { display: flex; justify-content: space-between; gap: 8px; }

/* ===== Image drop-zone (company logo / seal picker) ===== */
.img-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 92px;
    padding: 12px;
    border: 1.5px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    cursor: pointer;
    text-align: center;
    transition: border-color var(--duration-normal) var(--ease-out),
                background var(--duration-normal) var(--ease-out);
}
.img-drop:hover, .img-drop:focus-visible { border-color: var(--primary-color); }
.img-drop-over {
    border-color: var(--primary-color);
    border-style: solid;
    background: color-mix(in srgb, var(--primary-color) 7%, var(--card-bg));
}
.img-drop-busy { opacity: 0.55; pointer-events: none; position: relative; }
.img-drop-busy::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: img-drop-spin 0.7s linear infinite;
}
@keyframes img-drop-spin { to { transform: rotate(360deg); } }
.img-drop-icon { font-size: 20px; color: var(--text-light); }
.img-drop-preview {
    max-height: 44px;
    max-width: 82%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    padding: 2px 6px;
}
.img-drop-hint { font-size: 11.5px; color: var(--text-light); }
.img-drop-sub { font-size: 10.5px; color: var(--text-light); opacity: 0.8; }
.img-drop-clear { margin-top: 2px; }

/* ===== Tooltips (icon-only buttons) — hover or keyboard focus =====
   Positioned in JS (js/ui/tooltip.js) against the trigger's actual
   bounding rect, with viewport-edge collision handling — a CSS ::after
   pseudo-element can't do that reliably across every toolbar/panel layout. */
.tooltip-bubble {
    position: fixed;
    background: var(--primary-dark);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    padding: 5px 9px;
    border-radius: 5px;
    white-space: nowrap;
    max-width: 240px;
    pointer-events: none;
    z-index: 500;
    animation: tooltip-in 100ms ease;
}
@keyframes tooltip-in {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Inline help popover (jargon-heavy field labels) ===== */
.help-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    border-radius: 50%;
    border: none;
    background: var(--surface-sunken);
    color: var(--text-light);
    font-size: 10px;
    cursor: pointer;
    margin-left: 4px;
    flex-shrink: 0;
}
.help-trigger:hover, .help-trigger[aria-expanded="true"] { background: var(--primary-light); color: var(--primary-color); }
.help-popover {
    position: absolute;
    z-index: 300;
    max-width: 260px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 8px 10px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-color);
}
