/* ============================================================
   Business Dashboard – Design System
   Mobile-first, BEM, CSS Custom Properties
   ============================================================ */

/* === Variables === */
:root {
    --accent:       #2563eb;
    --accent-dark:  #1d4ed8;
    --accent-light: #dbeafe;

    --success: #10b981;
    --warning: #f59e0b;
    --danger:  #ef4444;
    --info:    #6366f1;

    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --sidebar-w: 240px;
    --radius:    8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow:    0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);

    --font: "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", Consolas, monospace;

    --transition: 150ms ease;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-50);
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--gray-100); padding: 2px 5px; border-radius: var(--radius-sm); }

/* === Layout === */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--gray-900);
    color: var(--gray-300);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 200;
    transition: transform var(--transition);
}

.main { min-height: 100vh; padding: 24px; }
.main--with-sidebar { margin-left: var(--sidebar-w); }

/* === Sidebar === */
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgb(255 255 255 / .08);
}
.sidebar__logo { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar__brand-name { font-weight: 700; font-size: 16px; color: white; }

.sidebar__dashboard-name {
    padding: 12px 16px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gray-500);
}

.sidebar__nav { padding: 4px 8px; flex: 1; }
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius);
    color: var(--gray-400);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.sidebar__link svg { width: 16px; height: 16px; flex-shrink: 0; fill: currentColor; }
.sidebar__link:hover { background: rgb(255 255 255 / .06); color: white; text-decoration: none; }
.sidebar__link.active { background: var(--accent); color: white; }
.sidebar__link--admin { margin-top: 8px; border-top: 1px solid rgb(255 255 255 / .08); border-radius: 0; padding-top: 16px; }

.sidebar__footer {
    padding: 12px 16px 20px;
    border-top: 1px solid rgb(255 255 255 / .08);
}
.sidebar__user { margin-bottom: 10px; }
.sidebar__user-name { display: block; font-weight: 600; color: white; font-size: 13px; }
.sidebar__user-role { display: block; font-size: 11px; color: var(--gray-500); }

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 300;
    background: var(--gray-900);
    border: none;
    border-radius: var(--radius);
    padding: 8px;
    flex-direction: column;
    gap: 4px;
    width: 36px; height: 36px;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle span {
    display: block;
    width: 16px; height: 2px;
    background: white;
    border-radius: 1px;
    transition: transform var(--transition);
}

/* === Auth Pages === */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}
.auth-card__header { text-align: center; margin-bottom: 28px; }
.auth-card__logo { width: 48px; height: 48px; margin: 0 auto 16px; }
.auth-card__header h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.auth-card__header p { font-size: 14px; color: var(--gray-500); }

/* === Page Header === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header__title { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.page-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* === Cards === */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card--full { grid-column: 1 / -1; }

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
    gap: 8px;
}
.card__title { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.card__header-actions { display: flex; gap: 8px; align-items: center; }
.card__body { padding: 20px; }

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stats-grid--small { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
}
.stat-card--primary { border-left-color: var(--accent); }
.stat-card--success { border-left-color: var(--success); }
.stat-card--danger  { border-left-color: var(--danger); }
.stat-card--info    { border-left-color: var(--info); }
.stat-card--warning { border-left-color: var(--warning); }

.stat-card__icon { width: 40px; height: 40px; flex-shrink: 0; }
.stat-card__icon svg { width: 40px; height: 40px; fill: var(--gray-300); }

.stat-card__label { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-bottom: 4px; }
.stat-card__value { font-size: 20px; font-weight: 700; color: var(--gray-900); }

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* === Two-Column Grid === */
.two-col-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* === Tables === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--gray-50); }
.table tfoot td { border-top: 2px solid var(--gray-200); font-weight: 600; }
.table--compact th, .table--compact td { padding: 7px 10px; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-400); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

/* Sortable columns */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--accent); }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.2;
}
.btn--primary  { background: var(--accent); color: white; }
.btn--primary:hover { background: var(--accent-dark); text-decoration: none; color: white; }
.btn--danger   { background: var(--danger); color: white; }
.btn--danger:hover { background: #dc2626; text-decoration: none; color: white; }
.btn--success  { background: var(--success); color: white; }
.btn--ghost    { background: transparent; border-color: var(--gray-300); color: var(--gray-700); }
.btn--ghost:hover { background: var(--gray-50); text-decoration: none; }
.btn--sm  { padding: 6px 12px; font-size: 12px; }
.btn--xs  { padding: 4px 8px; font-size: 11px; }
.btn--lg  { padding: 11px 22px; font-size: 15px; }
.btn--full { width: 100%; justify-content: center; }

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
}
.badge--default { background: var(--gray-100); color: var(--gray-600); }
.badge--success { background: #d1fae5; color: #065f46; }
.badge--danger  { background: #fee2e2; color: #991b1b; }
.badge--warning { background: #fef3c7; color: #92400e; }
.badge--info    { background: #e0e7ff; color: #3730a3; }

/* === Status === */
.status { font-size: 14px; }
.status--ok { color: var(--success); }
.status--pending { color: var(--gray-400); }

.status-toggle {
    background: none;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--gray-400);
    cursor: pointer;
    transition: all var(--transition);
}
.status-toggle--on { background: var(--success); border-color: var(--success); color: white; }
.status-toggle:hover { border-color: var(--accent); }

/* === Forms === */
.form { display: flex; flex-direction: column; gap: 16px; }
.form--wide { max-width: 100%; }
.form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.form__group { display: flex; flex-direction: column; gap: 4px; }
.form__group--inline { flex-direction: row; align-items: center; gap: 10px; }

.form__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.required { color: var(--danger); }

.form__input, .form__select, .form__textarea {
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-800);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}
.form__input:focus, .form__select:focus, .form__textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form__input--sm { padding: 6px 10px; font-size: 13px; width: auto; }
.form__textarea { resize: vertical; min-height: 80px; }
.form__hint { font-size: 11px; color: var(--gray-500); }
.form__static { font-size: 14px; color: var(--gray-700); padding: 9px 0; }

.form__password-wrap { position: relative; }
.form__password-wrap .form__input { padding-right: 40px; }
.form__password-toggle {
    position: absolute;
    right: 0; top: 0;
    height: 100%;
    padding: 0 10px;
    background: none;
    border: none;
    color: var(--gray-400);
}
.form__password-toggle svg { width: 18px; height: 18px; fill: currentColor; }

.form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}
.form__actions--sticky {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 16px 0;
    border-top: 1px solid var(--gray-100);
    margin: 24px -20px -20px;
    padding: 16px 20px;
    justify-content: flex-start;
}

/* === Checkboxes & Radios === */
.checkbox, .radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.checkbox input, .radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox__mark, .radio__mark {
    width: 16px; height: 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    flex-shrink: 0;
    transition: all var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.radio__mark { border-radius: 50%; }
.checkbox input:checked + .checkbox__mark {
    background: var(--accent); border-color: var(--accent);
}
.checkbox input:checked + .checkbox__mark::after {
    content: '';
    display: block;
    width: 8px; height: 5px;
    border-left: 2px solid white; border-bottom: 2px solid white;
    transform: rotate(-45deg) translateY(-1px);
}
.radio input:checked + .radio__mark {
    border-color: var(--accent);
}
.radio input:checked + .radio__mark::after {
    content: '';
    display: block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.checkbox__label, .radio__label { font-size: 14px; color: var(--gray-700); }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.checkbox-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.radio-group { display: flex; flex-wrap: wrap; gap: 16px; }

/* === Modals === */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal--open { display: flex; }
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / .5);
    backdrop-filter: blur(2px);
}
.modal__box {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 200ms ease;
}
.modal__box--lg { max-width: 680px; }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}
.modal__title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.modal__close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    line-height: 1;
    padding: 0 4px;
}
.modal__close:hover { color: var(--gray-700); }
.modal .form { padding: 20px; }

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 4px solid transparent;
}
.alert--success { background: #d1fae5; color: #065f46; border-left-color: var(--success); }
.alert--error   { background: #fee2e2; color: #991b1b; border-left-color: var(--danger); }

/* === Admin Layout === */
.admin-layout { display: flex; flex-direction: column; gap: 20px; }
.admin-nav {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 0;
}
.admin-nav__item {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
}
.admin-nav__item:hover { color: var(--accent); text-decoration: none; }
.admin-nav__item.active { color: var(--accent); border-bottom-color: var(--accent); }

/* === Module Layout === */
.module-layout { display: flex; flex-direction: column; gap: 20px; }
.module-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* === Row states === */
.row--warning td { background: #fffbeb !important; }
.row--blacklisted td { opacity: 0.6; text-decoration: line-through; }

/* === Progress Bar === */
.progress-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}
.progress-bar__fill { height: 100%; border-radius: 3px; transition: width .3s; }
.progress-bar--success .progress-bar__fill { background: var(--success); }
.progress-bar--danger  .progress-bar__fill { background: var(--danger); }

/* === Icon Gallery === */
.icon-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}
.icon-gallery__item {
    position: relative;
    text-align: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--gray-50);
}
.icon-gallery__item img { width: 48px; height: 48px; object-fit: contain; margin: 0 auto 6px; }
.icon-gallery__name { font-size: 10px; color: var(--gray-500); word-break: break-all; }
.icon-gallery__delete {
    position: absolute;
    top: 4px; right: 4px;
    padding: 2px 5px;
    line-height: 1;
}

/* === Dropzone === */
.dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    position: relative;
}
.dropzone:hover, .dropzone--active {
    border-color: var(--accent);
    background: var(--accent-light);
}
.dropzone__icon { width: 40px; height: 40px; margin: 0 auto 10px; fill: var(--gray-400); display: block; }
.dropzone__text { font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.dropzone__hint { font-size: 12px; color: var(--gray-500); }
.dropzone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.file-preview { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.file-preview__item { font-size: 12px; color: var(--gray-600); padding: 4px 8px; background: var(--gray-100); border-radius: var(--radius-sm); }

.dropzone__preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: center; }
.file-preview__item--error { background: #fee2e2; color: var(--danger); }

/* === Rezept Cards === */
.rezept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.rezept-card .card__header { align-items: flex-start; }
.rezept-card__title { display: flex; align-items: center; gap: 10px; }
.rezept-icon { width: 32px; height: 32px; object-fit: contain; }

/* === Zutat Rows === */
.zutat-row {
    display: grid;
    grid-template-columns: 1fr 120px auto;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

/* === Price Display === */
.price-display {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    padding: 10px 0;
}

/* === Webhook row === */
.webhook-row { margin-bottom: 8px; }
.webhook-input-group { display: flex; gap: 8px; }
.webhook-input-group .form__input { flex: 1; }

/* === Settings Grid === */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    align-items: start;
}

/* === Row icons === */
.row-icon { width: 24px; height: 24px; object-fit: contain; display: inline-block; vertical-align: middle; margin-right: 6px; }

/* === Actions column === */
.actions { white-space: nowrap; }
.actions .btn + .btn { margin-left: 4px; }

/* === Empty state === */
.empty-state { color: var(--gray-400); text-align: center; padding: 24px; font-size: 13px; }

/* === Page toolbar === */
.page-toolbar { display: flex; justify-content: flex-end; gap: 8px; }

/* === Link muted === */
.link-muted { color: var(--gray-400); font-size: 11px; margin-left: 4px; }

/* === Error page === */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.error-card { text-align: center; }
.error-card__code { font-size: 80px; font-weight: 900; color: var(--gray-200); line-height: 1; }
.error-card__title { font-size: 24px; font-weight: 700; margin: 8px 0; }
.error-card__text { color: var(--gray-500); margin-bottom: 20px; }

/* === Calc result === */
.calc-result { background: var(--gray-50); border-radius: var(--radius); padding: 16px; }

/* === Produktrechner === */
.rechner-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cost-summary {
    background: var(--gray-900);
    color: white;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}
.cost-summary__label { font-size: 12px; color: var(--gray-400); margin-bottom: 4px; }
.cost-summary__value { font-size: 28px; font-weight: 700; }

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    min-width: 48px;
}
.status-pill--ok    { background: #0f4c2a; color: #34d399; border: 1px solid #065f46; }
.status-pill--fehlt { background: #4c0f0f; color: #f87171; border: 1px solid #991b1b; }

/* === Utility === */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* === Responsive === */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }

    .sidebar { transform: translateX(-240px); width: 240px; }
    .sidebar--open { transform: translateX(0); }

    .main--with-sidebar { margin-left: 0; padding-top: 64px; }

    .sidebar-toggle { display: flex; }

    .dashboard-grid,
    .two-col-grid,
    .settings-grid { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

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

    .modal__box { max-height: 95vh; }

    .zutat-row { grid-template-columns: 1fr 90px auto; }

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

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .main { padding: 16px; }
    .auth-card { padding: 24px; }
}

/* Lieferanten-Preisliste colour coding */
.preis-row--cheapest td  { background: #dcfce7 !important; }
.preis-row--cheapest .preis-cell { color: #15803d; font-weight: 700; }
.preis-row--middle   td  { background: #fff7ed !important; }
.preis-row--middle   .preis-cell { color: #c2410c; font-weight: 600; }
.preis-row--costliest td { background: #fee2e2 !important; }
.preis-row--costliest .preis-cell { color: #dc2626; font-weight: 700; }
.preis-row--hidden { display: none !important; }

/* Admin icon grid */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.icon-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 10px;
    text-align: center;
    background: var(--gray-50);
    transition: box-shadow var(--transition);
}
.icon-card:hover { box-shadow: 0 2px 8px rgb(0 0 0 / .08); }
.icon-card__img { width: 64px; height: 64px; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; }
.icon-card__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.icon-card__name { font-size: 11px; font-weight: 600; color: var(--gray-700); word-break: break-all; }
.icon-card__path { font-size: 10px; color: var(--gray-400); word-break: break-all; margin-top: 2px; display: none; }

/* Info-Bereich on dashboard overview */
.info-bereich-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--gray-700);
    white-space: pre-wrap;
}
.info-bereich-card { border-left: 4px solid var(--accent); }

/* === Site Footer === */
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 24px;
    margin-top: 32px;
    border-top: 1px solid var(--gray-200);
    font-size: 12px;
    color: var(--gray-400);
}
.main--with-sidebar ~ .site-footer { margin-left: var(--sidebar-w); }
body.auth-page > .site-footer { display: none; }

.site-footer__copy { flex: 1; }

/* === Theme Toggles === */
/* Sidebar theme toggle */
.theme-toggle-sidebar {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    background: none;
    border: 1px solid rgb(255 255 255 / .12);
    border-radius: var(--radius);
    color: var(--gray-400);
    cursor: pointer;
    padding: 7px 10px;
    font-size: 12px;
    font-family: var(--font);
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 8px;
    text-align: left;
}
.theme-toggle-sidebar:hover { border-color: rgb(255 255 255 / .28); color: white; }
.theme-toggle-sidebar svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

/* Footer theme toggle */
.theme-toggle-footer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    color: var(--gray-500);
    cursor: pointer;
    padding: 5px 10px;
    font-size: 11px;
    font-family: var(--font);
    font-weight: 500;
    transition: all var(--transition);
}
.theme-toggle-footer:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle-footer svg { width: 13px; height: 13px; fill: currentColor; }

/* Icon visibility based on theme */
.theme-icon-sun  { display: none; }
.theme-icon-moon { display: block; }
[data-theme="dark"] .theme-icon-sun  { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* === Dark Mode === */
[data-theme="dark"] { color-scheme: dark; }

[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}

[data-theme="dark"] .card,
[data-theme="dark"] .stat-card {
    background: #1e293b;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / .4);
}
[data-theme="dark"] .card__header { border-bottom-color: #334155; }
[data-theme="dark"] .card__title  { color: #f1f5f9; }
[data-theme="dark"] .stat-card__value { color: #f1f5f9; }
[data-theme="dark"] .stat-card__label { color: #94a3b8; }
[data-theme="dark"] .stat-card__icon svg { fill: #475569; }

[data-theme="dark"] .auth-card { background: #1e293b; }
[data-theme="dark"] .auth-card__header h1 { color: #f1f5f9; }
[data-theme="dark"] .auth-card__header p  { color: #94a3b8; }

[data-theme="dark"] .page-header__title { color: #f1f5f9; }

[data-theme="dark"] .table th {
    color: #94a3b8;
    border-bottom-color: #334155;
}
[data-theme="dark"] .table td {
    border-bottom-color: #1e293b;
    color: #e2e8f0;
}
[data-theme="dark"] .table tbody tr:hover td { background: #293548; }
[data-theme="dark"] .table tfoot td { border-top-color: #334155; }

[data-theme="dark"] .form__input,
[data-theme="dark"] .form__select,
[data-theme="dark"] .form__textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .form__input:focus,
[data-theme="dark"] .form__select:focus,
[data-theme="dark"] .form__textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(37 99 235 / .25);
}
[data-theme="dark"] .form__label  { color: #cbd5e1; }
[data-theme="dark"] .form__hint   { color: #64748b; }
[data-theme="dark"] .form__static { color: #94a3b8; }
[data-theme="dark"] .form__actions--sticky {
    background: #1e293b;
    border-top-color: #334155;
}

[data-theme="dark"] .checkbox__mark,
[data-theme="dark"] .radio__mark {
    background: #0f172a;
    border-color: #475569;
}
[data-theme="dark"] .checkbox__label,
[data-theme="dark"] .radio__label { color: #cbd5e1; }

[data-theme="dark"] .modal__box     { background: #1e293b; }
[data-theme="dark"] .modal__header  { background: #1e293b; border-bottom-color: #334155; }
[data-theme="dark"] .modal__title   { color: #f1f5f9; }
[data-theme="dark"] .modal__close   { color: #64748b; }
[data-theme="dark"] .modal__close:hover { color: #cbd5e1; }

[data-theme="dark"] .badge--default { background: #334155; color: #cbd5e1; }
[data-theme="dark"] .badge--success { background: #064e3b; color: #34d399; }
[data-theme="dark"] .badge--danger  { background: #7f1d1d; color: #f87171; }
[data-theme="dark"] .badge--warning { background: #78350f; color: #fbbf24; }
[data-theme="dark"] .badge--info    { background: #312e81; color: #a5b4fc; }

[data-theme="dark"] .btn--ghost { border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .btn--ghost:hover { background: #293548; color: #f1f5f9; }

[data-theme="dark"] .admin-nav { border-bottom-color: #334155; }
[data-theme="dark"] .admin-nav__item { color: #94a3b8; }

[data-theme="dark"] code { background: #293548; color: #a5b4fc; }

[data-theme="dark"] .alert--success { background: #064e3b; color: #34d399; }
[data-theme="dark"] .alert--error   { background: #7f1d1d; color: #f87171; }

[data-theme="dark"] .calc-result { background: #293548; }

[data-theme="dark"] .icon-gallery__item,
[data-theme="dark"] .icon-card {
    background: #293548;
    border-color: #475569;
}
[data-theme="dark"] .icon-card__name { color: #cbd5e1; }

[data-theme="dark"] .dropzone { border-color: #475569; }
[data-theme="dark"] .dropzone__icon { fill: #64748b; }
[data-theme="dark"] .dropzone__text { color: #cbd5e1; }
[data-theme="dark"] .dropzone:hover,
[data-theme="dark"] .dropzone--active {
    border-color: var(--accent);
    background: rgb(37 99 235 / .1);
}

[data-theme="dark"] .file-preview__item { background: #293548; color: #cbd5e1; }
[data-theme="dark"] .file-preview__item--error { background: #450a0a; color: #f87171; }

[data-theme="dark"] .row--warning td { background: #422006 !important; }

[data-theme="dark"] .progress-bar { background: #334155; }

[data-theme="dark"] .preis-row--cheapest td { background: #052e16 !important; }
[data-theme="dark"] .preis-row--cheapest .preis-cell { color: #34d399; }
[data-theme="dark"] .preis-row--middle td   { background: #431407 !important; }
[data-theme="dark"] .preis-row--middle .preis-cell   { color: #fb923c; }
[data-theme="dark"] .preis-row--costliest td { background: #450a0a !important; }
[data-theme="dark"] .preis-row--costliest .preis-cell { color: #f87171; }

[data-theme="dark"] .info-bereich-text { color: #cbd5e1; }
[data-theme="dark"] .info-bereich-card { border-left-color: var(--accent); }

[data-theme="dark"] .text-muted  { color: #64748b; }
[data-theme="dark"] .link-muted  { color: #64748b; }

[data-theme="dark"] .error-card__code { color: #334155; }

[data-theme="dark"] .site-footer {
    border-top-color: #334155;
    color: #64748b;
}
[data-theme="dark"] .theme-toggle-footer {
    border-color: #475569;
    color: #94a3b8;
}
[data-theme="dark"] .theme-toggle-footer:hover {
    border-color: var(--accent);
    color: var(--accent);
}

[data-theme="dark"] .status-toggle { border-color: #475569; color: #64748b; }
[data-theme="dark"] .page-toolbar .btn--ghost { border-color: #475569; color: #cbd5e1; }

@media (max-width: 768px) {
    .main--with-sidebar ~ .site-footer { margin-left: 0; }
}
