/* ===== Art Assistant – Light Theme ===== */

:root {
    --bg: #f5f5f7;
    --sidebar-bg: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f0f0f3;
    --border: #e2e4e9;
    --border-light: #eef0f4;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79,70,229,.08);
    --accent: #6366f1;
    --text: #1a1a2e;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --success: #16a34a;
    --success-bg: rgba(22,163,74,.08);
    --danger: #dc2626;
    --danger-bg: rgba(220,38,38,.08);
    --warning: #d97706;
    --warning-bg: rgba(217,119,6,.08);
    --info: #2563eb;
    --info-bg: rgba(37,99,235,.08);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 240px;
    --sidebar-collapsed: 60px;
    --header-height: 56px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.1);
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 17.5px; }  /* Global aufgepumpt: war 16px → skaliert alle rem-Werte */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;  /* Globaler Zeilenabstand */
}

/* Zeilenabstände für alle gängigen Textelemente */
p, li, td, th, label, input, textarea, select, button, .form-control, .btn {
    line-height: 1.55;
}
h1, h2, h3, h4, h5, h6 { line-height: 1.35; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    min-height: 100vh;
    transition: grid-template-columns .25s ease;
}
.app-layout.sidebar-collapsed { grid-template-columns: var(--sidebar-collapsed) 1fr; }

/* ===== Sidebar ===== */
.sidebar {
    grid-row: 1 / -1;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .25s ease;
    width: var(--sidebar-width);
    z-index: 100;
}
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }

.sidebar-logo {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    flex-shrink: 0;
}
.sidebar-logo .logo-icon {
    width: 32px; height: 32px; min-width: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-logo .logo-text {
    font-weight: 800; font-size: .9rem;
    white-space: nowrap; overflow: hidden;
    transition: opacity .2s;
}
.sidebar-collapsed .sidebar-logo .logo-text { opacity: 0; width: 0; }
.sidebar-collapsed .sidebar-logo {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}
.sidebar-collapsed .sidebar-logo .logo-icon {
    display: none;
}
.sidebar-collapsed .sidebar-logo > div:not(.logo-icon):not(.logo-text) {
    display: none;
}

.sidebar-nav { padding: 8px 8px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav .nav-section {
    font-size: .65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .8px; color: var(--text-dim);
    padding: 14px 8px 4px; white-space: nowrap;
    transition: opacity .2s;
}
.sidebar-collapsed .nav-section { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: .85rem; font-weight: 500;
    cursor: pointer; transition: all .15s; text-decoration: none;
    white-space: nowrap; overflow: hidden;
}
.sidebar-nav .nav-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.sidebar-nav .nav-item.active { background: var(--primary-light); color: var(--primary); }
.sidebar-nav .nav-item svg {
    width: 18px; height: 18px; flex-shrink: 0;
    stroke: currentColor; fill: none; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}
.sidebar-nav .nav-item span {
    transition: opacity .2s; overflow: hidden;
}
.sidebar-collapsed .nav-item span { opacity: 0; width: 0; }

.sidebar-footer {
    padding: 10px 14px; border-top: 1px solid var(--border);
    font-size: .78rem; color: var(--text-dim);
    white-space: nowrap; overflow: hidden;
    transition: opacity .2s;
}
.sidebar-collapsed .sidebar-footer { opacity: 0; }

/* Sidebar toggle button */
.sidebar-toggle {
    width: 28px; height: 28px; border-radius: 6px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s; flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-toggle svg { transition: transform .25s ease; }
.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* Mobile burger */
.mobile-burger {
    display: none; width: 36px; height: 36px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    cursor: pointer; align-items: center; justify-content: center;
}
.mobile-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.3); z-index: 99;
}
.mobile-overlay.active { display: block; }

/* ===== Header ===== */
.header {
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; height: var(--header-height);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 1rem; font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 12px; }

/* ===== Main Content =====
   flex-column: damit Kinder mit margin-top:auto (z.B. .sticky-save-bar) ans
   Container-Ende rutschen, auch wenn der eigentliche Inhalt kürzer als der
   Viewport ist. Hat keine Auswirkung auf normale Seiten — die Cards stapeln
   sich genauso wie zuvor. */
.main-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header {
    padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: .85rem; font-weight: 700; }
.card-body { padding: 18px; }

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}
.stat-label {
    font-size: .7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; color: var(--text-dim); margin-bottom: 4px;
}
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.stat-sub { font-size: .75rem; color: var(--text-muted); margin-top: 3px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--radius-sm);
    font-size: .82rem; font-weight: 600; border: none;
    cursor: pointer; text-decoration: none; transition: all .15s;
    font-family: inherit; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--text-muted); color: var(--text); }
.btn-ghost { background: transparent; color: var(--primary); padding: 4px 8px; }
.btn-ghost:hover { background: var(--primary-light); }
.btn-sm { padding: 5px 10px; font-size: .75rem; }
.btn-lg { padding: 10px 20px; font-size: .9rem; }
.btn-icon { padding: 7px; }
.w-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block; font-size: .72rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: 5px;
    text-transform: uppercase; letter-spacing: .5px;
}
.form-control {
    width: 100%; padding: 9px 12px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: .875rem; font-family: inherit; transition: border .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-control::placeholder { color: var(--text-dim); }
.form-control[readonly] { background: #fff; border: 1px solid var(--border-light); cursor: default; }
.form-control[readonly]:focus { box-shadow: none; border-color: var(--border-light); }
input.form-control[readonly] { pointer-events: none; }
/* Readonly-Textareas: genauso wie readonly-Inputs kein Text-Caret/Cursor zeigen,
   damit im Ansichtsmodus nicht der Eindruck entsteht, man koenne tippen. */
textarea.form-control[readonly] { pointer-events: none; user-select: none; }
input[readonly]::-webkit-inner-spin-button,
input[readonly]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[readonly][type="number"] { -moz-appearance: textfield; }
select.form-control:disabled { background: #fff; border: 1px solid var(--border-light); -webkit-appearance: none; -moz-appearance: none; appearance: none; cursor: default; pointer-events: none; opacity: 1; color: var(--text); }
textarea.form-control { resize: none; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-hint { font-size: .72rem; color: var(--text-dim); margin-top: 3px; }
.form-section { border-top: 1px solid var(--border-light); padding-top: 16px; margin-top: 16px; }

/* ===== Alerts ===== */
.alert {
    padding: 10px 14px; border-radius: var(--radius-sm);
    font-size: .82rem; margin-bottom: 14px;
    display: flex; align-items: flex-start; gap: 8px;
}
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(37,99,235,.15); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(22,163,74,.15); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,.15); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(217,119,6,.15); }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th {
    text-align: left; padding: 9px 14px; font-weight: 600;
    font-size: .72rem; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-dim); border-bottom: 1px solid var(--border);
    white-space: nowrap; background: var(--bg);
}
td { padding: 9px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tr:hover td { background: var(--surface-hover); }
tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 9px; border-radius: 20px;
    font-size: .72rem; font-weight: 600;
}
.badge-available { background: var(--success-bg); color: var(--success); }
.badge-sold { background: var(--danger-bg); color: var(--danger); }
.badge-exhibition { background: var(--info-bg); color: var(--info); }
.badge-reserved { background: var(--warning-bg); color: var(--warning); }

/* ===== Artwork Grid ===== */
.artwork-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.artwork-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    cursor: pointer; transition: transform .15s, box-shadow .15s;
    box-shadow: var(--shadow-sm);
}
.artwork-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.artwork-card-img {
    width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg);
}
.artwork-card-body { padding: 12px; }
.artwork-card-title {
    font-size: .85rem; font-weight: 600; margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artwork-card-meta {
    font-size: .75rem; color: var(--text-muted);
    display: flex; align-items: center; justify-content: space-between;
}

/* ===== Lightbox ===== */
.lightbox-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.85); z-index: 2000;
    align-items: center; justify-content: center;
    cursor: zoom-out;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img {
    max-width: 90vw; max-height: 90vh; object-fit: contain;
    border-radius: 4px; cursor: default;
}
.lightbox-close {
    position: absolute; top: 16px; right: 16px;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.15); color: #fff;
    border: none; cursor: pointer; font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,.25); }

/* ===== Modal ===== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 1000;
    backdrop-filter: blur(4px);
    align-items: flex-start; justify-content: center;
    padding: 40px 20px; overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; width: 100%; max-width: 900px;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-close {
    width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg);
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* ===== Upload Area ===== */
.upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 36px; text-align: center; cursor: pointer; transition: all .2s;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary); background: var(--primary-light);
}
.upload-area svg { margin-bottom: 10px; color: var(--text-dim); }
.upload-area p { color: var(--text-muted); font-size: .875rem; }
.upload-area .upload-hint { font-size: .75rem; color: var(--text-dim); margin-top: 4px; }

/* ===== Image Preview Grid ===== */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px; margin-top: 14px;
}
.image-preview-item {
    position: relative; border-radius: var(--radius-sm);
    overflow: hidden; aspect-ratio: 1; cursor: pointer;
    border: 1px solid var(--border);
}
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-btn {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(0,0,0,.6); color: #fff; border: none;
    cursor: pointer; font-size: .7rem;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .15s;
}
.image-preview-item:hover .remove-btn { opacity: 1; }
.main-img-wrap { position: relative; line-height: 0; font-size: 0; }
.main-img-wrap img { display: block; }  /* verhindert Baseline-Lücke unter dem img */
.main-img-wrap .img-del {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,0,0,.6); color: #fff; border: none;
    cursor: pointer; font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .15s; z-index: 2;
}
.main-img-wrap:hover .img-del { opacity: 1; }

/* ===== Tag Chips ===== */
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 20px; font-size: .75rem; color: var(--text-muted);
}

/* ===== Tag Input Fields (individual, copyable) ===== */
.tag-field-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-field {
    display: inline-flex; align-items: center; gap: 0;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; overflow: hidden; font-size: .82rem;
    transition: border-color .15s;
}
.tag-field:hover { border-color: var(--primary); }
.tag-field input {
    border: none; background: transparent; padding: 5px 8px;
    font-size: .82rem; font-family: inherit; color: var(--text);
    min-width: 40px; outline: none;
    /* Kein max-width: die Breite wird per JS (measureTextWidth) exakt auf den Tag-Inhalt gesetzt,
       damit lange Tags nicht mehr abgeschnitten werden. */
}
.tag-field .tag-copy-btn {
    padding: 5px 6px; border: none; background: transparent;
    color: var(--text-dim); cursor: pointer; display: flex;
    align-items: center; transition: color .15s;
}
.tag-field .tag-copy-btn:hover { color: var(--primary); }
.tag-field .tag-remove-btn {
    padding: 5px 4px; border: none; background: transparent;
    color: var(--text-dim); cursor: pointer; display: flex;
    align-items: center; font-size: .7rem; transition: color .15s;
}
.tag-field .tag-remove-btn:hover { color: var(--danger); }
.tag-add-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 10px; border: 1px dashed var(--border);
    border-radius: 6px; background: transparent;
    color: var(--text-dim); cursor: pointer; font-size: .78rem;
    font-family: inherit; transition: all .15s;
}
.tag-add-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Chip Select ===== */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    padding: 5px 12px; border-radius: 20px; font-size: .8rem;
    font-weight: 600; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted);
    cursor: pointer; transition: all .15s; font-family: inherit;
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Tabs ===== */
.tabs {
    display: flex; gap: 2px;
    border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.tab {
    padding: 8px 16px; font-size: .82rem; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s; background: none;
    border-top: none; border-left: none; border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Spinner ===== */
.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Wizard Progress ===== */
.wizard-progress {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 20px;
    box-shadow: var(--shadow-sm);
}
.wizard-steps { display: flex; align-items: center; }
.wizard-step {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    font-size: .68rem; font-weight: 600; color: var(--text-dim);
    cursor: pointer; transition: color .2s; min-width: 64px;
}
.wizard-step.active { color: var(--primary); }
.wizard-step.done { color: var(--success); }
.wizard-step-icon {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--border); background: var(--surface);
    transition: all .2s;
}
.wizard-step.active .wizard-step-icon { border-color: var(--primary); background: var(--primary-light); }
.wizard-step.done .wizard-step-icon { border-color: var(--success); background: var(--success-bg); }
.wizard-line { flex: 1; height: 2px; background: var(--border); margin: 0 4px; margin-bottom: 18px; }

/* Wizard Layout */
.wizard-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.wizard-page { display: none; }
.wizard-page.active { display: block; }
.wizard-nav { display: flex; align-items: center; gap: 8px; }

/* AI Chat Sidebar */
.wizard-chat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
    height: calc(100vh - 200px); position: sticky; top: 90px;
}
.chat-header {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
    font-size: .82rem; font-weight: 700;
}
.chat-header svg { color: var(--primary); }
.chat-messages {
    flex: 1; overflow-y: auto; padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { max-width: 90%; }
.chat-ai { align-self: flex-start; }
.chat-user { align-self: flex-end; }
.chat-msg-content {
    padding: 9px 12px; border-radius: 10px; font-size: .82rem;
    line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.chat-ai .chat-msg-content { background: var(--bg); color: var(--text); }
.chat-user .chat-msg-content { background: var(--primary); color: #fff; }
.chat-input-area {
    padding: 10px; border-top: 1px solid var(--border);
    display: flex; gap: 6px; align-items: flex-end;
}
.chat-input-area textarea { flex: 1; min-height: 36px; max-height: 80px; }

/* ===== Section Edit Mode ===== */
.section-locked .form-control { background: transparent; border-color: transparent; pointer-events: none; }
.section-locked .form-control:focus { box-shadow: none; }
.section-locked textarea.form-control { background: transparent; border-color: transparent; }

/* ===== Utility ===== */
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .72rem; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .wizard-layout { grid-template-columns: 1fr; }
    .wizard-chat { position: static; height: 280px; }
    .wizard-steps { overflow-x: auto; }
}
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; left: -260px; top: 0; bottom: 0;
        width: 240px; z-index: 200; transition: left .25s;
        box-shadow: none;
    }
    .sidebar.mobile-open { left: 0; box-shadow: var(--shadow-lg); }
    .mobile-burger { display: flex; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .artwork-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Maskiertes Text-Feld (Ersatz fuer type=password, ohne Browser-Passwort-Dialog) */
.masked-input {
    -webkit-text-security: disc;
    text-security: disc;
    font-family: text-security-disc, -apple-system, BlinkMacSystemFont, sans-serif;
}
.masked-input.revealed {
    -webkit-text-security: none;
    text-security: none;
    font-family: inherit;
}
.btn-toggle-visibility {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted, #666);
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-toggle-visibility:hover { color: var(--text, #111); background: rgba(0,0,0,0.04); }

/* ===== Verkaufsorte & Galerien (Upload + Artwork Detail) ===== */
.sales-channels {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 10px;
}
.sales-check {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--bg); cursor: pointer; user-select: none;
    font-size: .85rem; color: var(--text);
    transition: background .15s, border-color .15s, color .15s;
}
/* Hover-Effekt nur im aktiven (editierbaren) Zustand, nicht wenn disabled (View-Modus) */
.sales-check:not(:has(input:disabled)):hover { border-color: var(--accent); }
.sales-check input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 14px; height: 14px; border-radius: 3px;
    border: 1.5px solid var(--border); background: var(--surface);
    cursor: pointer; position: relative; margin: 0;
}
.sales-check input[type="checkbox"]:checked {
    background: var(--accent); border-color: var(--accent);
}
.sales-check input[type="checkbox"]:checked::after {
    content: ""; position: absolute; left: 3px; top: 0px;
    width: 4px; height: 8px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.sales-check input[type="checkbox"]:disabled { cursor: default; opacity: .85; }
.sales-check:has(input:checked) {
    background: var(--primary-light); border-color: var(--accent); color: var(--accent);
}
.sales-check:has(input:disabled) { cursor: default; }
.sales-custom-row { margin-top: 4px; }
.sales-custom-list {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
}
.sales-custom-list:empty { margin-top: 0; }
.sales-custom-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px 6px 12px; border-radius: 999px;
    background: var(--primary-light); color: var(--accent);
    border: 1px solid var(--accent);
    font-size: .8rem;
}
.sales-custom-chip button {
    background: transparent; border: 0; color: var(--accent);
    cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    font-size: 14px; line-height: 1;
}
.sales-custom-chip button:hover { background: rgba(0,0,0,.08); }

/* === Fallback-Kette: zwei Drag&Drop-Zonen (aktiv / inaktiv) === */
.fallback-zones {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}
.fallback-zone {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: var(--bg, #fafafa);
    overflow: hidden;
}
.fallback-zone[data-zone="inactive"] { background: transparent; }
.fallback-zone-header {
    padding: 8px 12px;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted, #888);
    letter-spacing: .04em;
    background: var(--bg, #f5f5f5);
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.fallback-list {
    list-style: none;
    padding: 0;
    margin: 0;
    min-height: 56px;       /* Drop-Ziel auch dann verfügbar, wenn Liste leer */
}
.fallback-list.drag-target {
    background: rgba(99, 102, 241, .06);
    outline: 2px dashed var(--accent, #6366f1);
    outline-offset: -4px;
}

.fallback-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: var(--card, #fff);
    transition: background .15s;
}
.fallback-item:last-child { border-bottom: 0; }
.fallback-item.is-inactive { background: transparent; opacity: .75; }
.fallback-item.dragging { opacity: .4; }
.fallback-item.drag-over { border-top: 2px solid var(--accent, #6366f1); }

.fallback-drag {
    color: var(--text-muted, #888);
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 4px;
}
.fallback-drag:active { cursor: grabbing; }
.fallback-label { font-weight: 500; flex: 1; }
.fallback-state {
    font-size: .75rem;
    margin-left: 6px;
    font-style: italic;
}

.fallback-empty {
    padding: 14px;
    color: var(--text-muted, #888);
    font-size: .82rem;
    font-style: italic;
    text-align: center;
}
.fallback-list:has(.fallback-item) .fallback-empty { display: none; }

.fallback-actions {
    display: flex;
    gap: 2px;
}
.fallback-actions button {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted, #888);
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    font-size: 14px;
    line-height: 1;
    transition: background .15s, color .15s;
}
.fallback-actions button:hover {
    background: var(--bg, #f0f0f0);
    color: var(--text, #111);
}
.fallback-actions button:disabled {
    opacity: .3;
    cursor: not-allowed;
}
.btn-fallback-remove:hover { color: var(--danger, #ef4444) !important; }
.btn-fallback-add:hover    { color: var(--accent, #6366f1) !important; }

/* === Sticky Save-Bar ===
   Liegt AUSSERHALB der .tab-content-Divs als direktes Kind von .main-content.
   Damit klebt sie an der Unterkante des sichtbaren Scroll-Containers — egal wie
   kurz der gerade aktive Tab-Inhalt ist. Negative Margins ziehen sie bis an die
   Ränder von .main-content (das hat 20px padding), damit sie wirkt wie eine echte
   Bildschirmleiste. */
.sticky-save-bar {
    position: sticky;
    bottom: 0;
    margin-top: auto;          /* drückt die Bar bei wenig Inhalt ans untere Container-Ende */
    margin-left: -20px;        /* zieht die Bar bis an die Ränder von .main-content (20px padding) */
    margin-right: -20px;
    margin-bottom: -20px;
    padding: 14px 20px;
    background: var(--surface, #fff);
    border-top: 1px solid var(--border, #e5e7eb);
    box-shadow: 0 -4px 12px rgba(0,0,0,.04);
    display: flex;
    justify-content: flex-start;  /* linksbündig wie vom User gewünscht */
    z-index: 20;
}
@media (max-width: 640px) {
    .sticky-save-bar .btn { width: 100%; }
}
