/* VertexASP – Global Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --secondary:     #4b5563;
    --success:       #16a34a;
    --danger:        #dc2626;
    --bg:            #f8fafc;
    --surface:       #ffffff;
    --border:        #e2e8f0;
    --text:          #1e293b;
    --text-muted:    #64748b;
    --radius:        6px;
    --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ── Layout ──────────────────────────────────────── */
:root {
    --sidebar-width: 240px;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.navbar {
    padding: 0 1rem;
    display: flex; align-items: center; gap: 1.5rem; height: 52px;
}
.navbar-brand {
    font-weight: 700; font-size: 1.05rem;
    color: var(--primary); text-decoration: none; letter-spacing: -.3px;
    white-space: nowrap;
}
.nav-links { list-style: none; display: flex; gap: .15rem; margin-left: auto; }
.nav-links a {
    padding: .35rem .7rem; border-radius: var(--radius);
    color: var(--text-muted); text-decoration: none; font-size: .82rem;
    transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--bg); color: var(--text); }

/* ── App-Body: Sidebar + Main ────────────────── */
.app-body {
    display: flex;
    min-height: calc(100vh - 52px);
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 52px;
    height: calc(100vh - 52px);
    overflow-y: auto;
    transition: width .2s ease, opacity .2s ease;
}
.sidebar-inner { padding: .75rem 0; }

body.sidebar-collapsed .sidebar {
    width: 0;
    opacity: 0;
    overflow: hidden;
    border-right: none;
}

/* Toggle-Button in der Navbar */
.sidebar-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; padding: .3rem .5rem;
    border-radius: var(--radius); color: var(--text-muted);
    transition: background .15s;
    margin-left: .5rem;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

/* ── Sidebar-Menü ────────────────────────────── */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-item { position: relative; }

.sidebar-link {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .855rem;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
    cursor: pointer;
}
.sidebar-link:hover {
    background: var(--bg);
    color: var(--text);
}
.sidebar-link.active {
    background: #eff6ff;
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.sidebar-nolink {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

/* Gruppenüberschrift / aufklappbarer Elterneintrag */
.sidebar-group-btn {
    display: flex; align-items: center; gap: .5rem;
    width: 100%;
    padding: .5rem 1rem;
    background: none; border: none; border-left: 3px solid transparent;
    color: var(--text); font-size: .855rem; font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background .12s;
}
.sidebar-group-btn:hover { background: var(--bg); }

.sidebar-group-label {
    display: flex; align-items: center; gap: .5rem;
    padding: .55rem 1rem .25rem;
    font-size: .73rem; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-muted);
}

.sidebar-chevron {
    margin-left: auto;
    display: inline-block;
    transition: transform .2s;
    font-size: .9rem;
}
.sidebar-item.open > .sidebar-group-btn .sidebar-chevron {
    transform: rotate(90deg);
}

/* Untermenü */
.sidebar-submenu {
    list-style: none;
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}
.sidebar-submenu.open { max-height: 600px; }

.sidebar-submenu .sidebar-link {
    padding-left: 2.2rem;
    font-size: .83rem;
}

.sidebar-icon { font-size: .95rem; line-height: 1; }
.sidebar-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-empty {
    padding: 1rem;
    color: var(--text-muted);
    font-size: .82rem;
    display: flex; flex-direction: column; gap: .5rem;
}
.sidebar-manage-link {
    font-size: .78rem; color: var(--primary);
    text-decoration: none; padding: .25rem .5rem;
}
.sidebar-manage-link:hover { text-decoration: underline; }

.sidebar-footer {
    padding: .75rem 1rem;
    border-top: 1px solid var(--border);
    margin-top: .5rem;
}

/* ── Main Content ────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 1.5rem;
    max-width: 100%;
}

/* ── Menü-Verwaltungsseite (Baumansicht) ─────── */
.menu-tree-container {
    display: flex; flex-direction: column; gap: .5rem;
}
.menu-tree-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.menu-tree-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .65rem 1rem; flex-wrap: wrap;
}
.menu-tree-top { background: #f8fafc; }
.menu-tree-child { background: var(--surface); border-top: 1px solid var(--border); }
.menu-tree-info {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; flex: 1;
}
.menu-tree-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.menu-tree-indent { color: var(--text-muted); font-family: monospace; padding-left: 1rem; }
.menu-item-icon { font-size: 1rem; }
.menu-item-title { font-weight: 600; font-size: .875rem; }
.menu-tree-children { border-top: 1px solid var(--border); }

/* ── Page Header ───────────────────────────────── */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 1.5rem; gap: 1rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.subtitle { color: var(--text-muted); margin-top: .25rem; }
.header-actions { display: flex; gap: .5rem; align-items: center; }
.breadcrumb { font-size: .8rem; color: var(--text-muted); margin-bottom: .4rem; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .45rem .9rem; border-radius: var(--radius);
    font-size: .875rem; font-weight: 500; border: none; cursor: pointer;
    text-decoration: none; transition: background .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn:hover { box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
/* Temporärer Erfolgszustand nach API-Aufruf */
.btn-success-flash { background: #16a34a !important; color: #fff !important; }

/* Aktionsspalte in Datentabellen */
.action-col  { width: 1%; white-space: nowrap; }
.action-btns { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }

/* Zelle leuchtet kurz auf nach AJAX-Update */
@keyframes cell-flash {
    0%   { background: #bbf7d0; }
    100% { background: transparent; }
}
.cell-updated { animation: cell-flash 1.8s ease-out forwards; }
.btn-sm        { padding: .3rem .6rem; font-size: .8rem; }
.btn-lg        { padding: .6rem 1.4rem; font-size: 1rem; }

/* ── Alerts ──────────────────────────────────── */
.alert {
    padding: .75rem 1rem; border-radius: var(--radius);
    margin-bottom: 1rem; font-size: .875rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Status Grid (Dashboard) ──────────────────── */
.status-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.status-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
    box-shadow: var(--shadow);
}
.status-icon { font-size: 1.75rem; line-height: 1; }
.status-body h3 { font-size: .9rem; font-weight: 600; margin-bottom: .2rem; }
.status-body p  { color: var(--text-muted); font-size: .85rem; }
.status-ok  { border-left: 4px solid var(--success); }
.status-err { border-left: 4px solid var(--danger); }
.status-info{ border-left: 4px solid var(--primary); }

/* ── Info Box ─────────────────────────────────── */
.info-box {
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius);
    padding: 1rem 1.25rem; margin-bottom: 1.5rem;
}
.info-box h3 { margin-bottom: .5rem; font-size: .95rem; }
.info-box pre { background: #dbeafe; padding: .5rem; border-radius: 4px; margin: .5rem 0; overflow: auto; }
.info-box code { font-size: .8rem; }

/* ── Table Grid (Tabellenliste) ───────────────── */
.table-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}
.table-count { color: var(--text-muted); font-size: .875rem; }
.table-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.table-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem;
    box-shadow: var(--shadow); transition: box-shadow .15s;
}
.table-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.table-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.table-name { font-size: .95rem; font-weight: 600; font-family: monospace; }
.table-comment { color: var(--text-muted); font-size: .8rem; margin-bottom: .75rem; }
.table-card-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border);
}
.field-count { color: var(--text-muted); font-size: .8rem; }
.table-actions { display: flex; gap: .4rem; }

/* ── Data Table ──────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: #f1f5f9; font-size: .8rem; font-weight: 600; text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.data-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); font-size: .875rem; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.flags { display: flex; gap: .25rem; flex-wrap: wrap; }
.flag { background: #e2e8f0; border-radius: 3px; padding: .1rem .35rem; font-size: .75rem; font-weight: 600; color: var(--secondary); }

/* ── Badges ──────────────────────────────────── */
.badge {
    display: inline-block; padding: .15rem .5rem; border-radius: 99px;
    font-size: .75rem; font-weight: 600; line-height: 1.5;
}
.badge          { background: #e2e8f0; color: var(--secondary); }
.badge-ok       { background: #dcfce7; color: #166534; }
.badge-error    { background: #fee2e2; color: #991b1b; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-muted    { background: #f1f5f9; color: #94a3b8; }
.badge-type     { background: #f3e8ff; color: #6b21a8; font-family: monospace; }

/* ── Form ────────────────────────────────────── */
.form-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.section-title {
    font-size: .95rem; font-weight: 700; margin-bottom: 1rem;
    padding-bottom: .6rem; border-bottom: 1px solid var(--border);
    color: var(--text);
}
.form-row { margin-bottom: .85rem; }
.form-row label {
    display: block; font-size: .8rem; font-weight: 600; margin-bottom: .3rem;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em;
}
.form-control {
    width: 100%; padding: .45rem .75rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: .875rem; background: var(--surface); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-control[readonly] { background: #f8fafc; color: var(--text-muted); }
select.form-control { appearance: auto; }
.field-hint { color: var(--text-muted); font-size: .78rem; margin-top: .3rem; display: block; }
.field-error { color: var(--danger); font-size: .78rem; display: block; margin-top: .2rem; }

.form-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.check-label {
    display: flex; flex-direction: column; gap: .15rem;
    cursor: pointer; padding: .6rem; border: 1px solid var(--border);
    border-radius: var(--radius); transition: background .1s;
}
.check-label:hover { background: #f8fafc; }
.check-label input { margin-bottom: .2rem; }
.check-label small { color: var(--text-muted); font-size: .78rem; }

.form-actions {
    display: flex; gap: .75rem; align-items: center;
    padding: 1rem 0; margin-top: .5rem;
}

.quick-actions { display: flex; gap: .75rem; margin-top: 1rem; }

/* ── Enum Table ──────────────────────────────── */
.enum-add-row {
    display: flex; gap: .5rem; align-items: center; margin-bottom: .75rem; flex-wrap: wrap;
}

/* ── Form Grid ───────────────────────────────── */
.form-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
}

/* ── Misc ────────────────────────────────────── */
code { font-family: 'Fira Code', 'Cascadia Code', monospace; font-size: .875em; background: #f1f5f9; padding: .1em .3em; border-radius: 3px; }
pre { overflow: auto; }
.required-star { color: var(--danger); margin-left: .15rem; }

/* ── Field Toolbar (Schnellsuche + Zähler) ───── */
.field-toolbar {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: .75rem; flex-wrap: wrap;
}
.ordinal-col { color: var(--text-muted); font-size: .8rem; text-align: center; width: 36px; }

/* ── Sortierbare Spaltenköpfe ─────────────────── */
.sort-th { white-space: nowrap; }
.sort-link {
    text-decoration: none; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
    transition: color .15s;
}
.sort-link:hover { color: var(--primary); }
.sort-active { color: var(--primary); }

/* ── Suchbereich (PageBuilder View) ─────────────── */
.search-section { margin-bottom: 1rem; }
.search-section-header {
    display: flex; justify-content: space-between; align-items: center;
}
.search-fields-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .5rem 1rem;
}
.form-control-sm {
    padding: .3rem .6rem; font-size: .8rem;
}

/* ── Datensatz-Tabelle (PageBuilder View) ─────── */
.records-table { font-size: .82rem; }
.records-table td { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.records-table th { font-size: .75rem; }

/* ── Read-Only Formularzeile ─────────────────── */
.form-row-readonly label { color: #94a3b8; }
.readonly-value {
    padding: .4rem .75rem;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: .875rem;
    color: var(--text-muted); min-height: 36px;
}

/* ── Typeahead / Content-API Autocomplete ─────── */
.typeahead-wrapper { position: relative; }
.typeahead-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.1);
    max-height: 260px; overflow-y: auto;
}
.typeahead-item {
    padding: .45rem .75rem; cursor: pointer; font-size: .875rem;
    border-bottom: 1px solid var(--border); transition: background .1s;
}
.typeahead-item:last-child { border-bottom: none; }
.typeahead-item:hover { background: #eff6ff; color: var(--primary); }

/* ── Page Toolbar ────────────────────────────── */
.page-toolbar {
    display: flex; align-items: center; gap: .75rem;
    margin-bottom: .5rem; flex-wrap: wrap;
}

/* ── Seiten-Sortierung (Sort-Badge) ──────────── */
.sort-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 24px; padding: 0 .35rem;
    background: #e2e8f0; color: var(--text-muted);
    border-radius: 4px; font-size: .75rem; font-weight: 700;
    font-family: monospace; flex-shrink: 0;
}

/* ── Rollen ──────────────────────────────────── */
.role-dot {
    display: inline-block;
    width: 12px; height: 12px; border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(0,0,0,.08);
}
.role-card .table-card-header { align-items: center; }

/* ── Berechtigungsmatrix ─────────────────────── */
.perm-table th, .perm-table td { vertical-align: middle; }
.perm-col {
    text-align: center; width: 88px; white-space: nowrap;
}
.perm-icon { font-size: .9rem; display: block; margin-bottom: .1rem; }
.perm-table input[type="checkbox"] {
    width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary);
}
.perm-table tbody tr:hover td { background: #f8fafc; }
.perm-table .perm-col:last-child {
    border-left: 2px solid var(--border);
    background: #f8fafc;
}

/* ── Query-Builder ────────────────────────────── */
.qb-list {
    display: flex; flex-direction: column; gap: 0;
    margin-bottom: .5rem;
}
.qb-row {
    display: flex; align-items: center; gap: .4rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .35rem .5rem;
    margin-bottom: .3rem; position: relative;
}
/* Verbinder links (AND/OR) */
.qb-connect {
    flex-shrink: 0; width: 70px; text-align: center;
    font-size: .72rem; font-weight: 800; letter-spacing: .04em;
}
.qb-connect-first {
    color: var(--text-muted); font-weight: 600; font-style: italic;
}
.qb-connect-and.form-control, .qb-connect-or.form-control {
    padding: .2rem .25rem; font-size: .72rem; font-weight: 800;
    text-align: center; cursor: pointer;
}
.qb-connect-and.form-control { color: #2563eb; background: #eff6ff; border-color: #bfdbfe; }
.qb-connect-or.form-control  { color: #d97706; background: #fffbeb; border-color: #fde68a; }

/* Feld-Zellen */
.qb-cell { flex: 1; min-width: 0; }
.qb-field-pick { flex: 2; }
.qb-op-cell    { flex: 0 0 130px; }
.qb-val-cell   { flex: 2; }

/* Gruppen-Visualisierung für ODER-Blöcke */
.qb-row.cond-group-start,
.qb-row.cond-group-mid,
.qb-row.cond-group-end {
    border-left: 3px solid #d97706 !important;
    margin-bottom: 0;
}
.qb-row.cond-group-start {
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom-color: transparent !important;
    background: #fffdf7;
}
.qb-row.cond-group-mid {
    border-radius: 0;
    border-bottom-color: transparent !important;
    border-top-color: transparent !important;
    background: #fffdf7;
}
.qb-row.cond-group-end {
    border-radius: 0 0 var(--radius) var(--radius);
    border-top-color: transparent !important;
    background: #fffdf7;
    margin-bottom: .3rem;
}

/* JOIN-Zeile */
.qb-join-type.form-control {
    padding: .25rem .3rem; font-size: .75rem; font-weight: 700;
    color: #2563eb; background: #eff6ff; border-color: #bfdbfe;
    text-align: center;
}

/* Remove-Button */
.qb-remove { flex-shrink: 0; }

/* Drag & Drop */
.qb-drag-handle {
    flex-shrink: 0; cursor: grab; color: var(--text-muted);
    font-size: 1rem; padding: 0 .15rem; user-select: none;
}
.qb-dragging {
    opacity: .4; border-style: dashed !important;
}
.qb-drag-over {
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
    background: #f0f7ff !important;
}

/* Unterer Aktionsstreifen */
.qb-addbar {
    display: flex; align-items: center; gap: .5rem;
    margin-top: .4rem; flex-wrap: wrap;
}
.qb-add-btn { border-style: dashed; }

/* Badge-Varianten für Hinweistext */
.badge-and { background: #eff6ff; color: #2563eb; }
.badge-or  { background: #fffbeb; color: #d97706; }

/* SQL-Vorschau */
.sql-preview {
    background: #1e293b; color: #e2e8f0;
    padding: 1rem 1.25rem; border-radius: 6px;
    overflow-x: auto; font-size: .78rem; line-height: 1.7;
    white-space: pre; tab-size: 4;
    margin: 0;
}

/* ── Report-Bar (auf View-Seiten) ────────────── */
.report-bar {
    display: flex; align-items: center; gap: .5rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .5rem .75rem;
    margin-bottom: .75rem; flex-wrap: wrap;
}
.report-bar-label {
    font-size: .8rem; font-weight: 700; color: var(--text-muted);
    white-space: nowrap;
}

/* ── Report-Builder ───────────────────────────── */
.report-adder summary { list-style: none; }
.report-adder summary::-webkit-details-marker { display: none; }
.report-add-form {
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: var(--radius); padding: .75rem;
    margin-top: .5rem;
}
.field-label-sm {
    display: block; font-size: .75rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: .2rem;
}
.section-sub {
    font-size: .78rem; font-weight: 400; color: var(--text-muted);
}
.badge-warn {
    background: #fef9c3; color: #92400e;
    display: inline-block; padding: .15rem .45rem;
    border-radius: 4px; font-size: .72rem; font-weight: 700;
}
/* grün für Ausführen-Button */
.btn-success {
    background: #16a34a; color: #fff; border: none;
}
.btn-success:hover { background: #15803d; }

/* ═══════════════════════════════════════════════════════════════════
   TIMER-WIDGET  (Navbar-Zeiterfassung)
   ═══════════════════════════════════════════════════════════════════ */
.timer-widget {
    display: flex; align-items: center;
    margin-left: .5rem;
}
.timer-idle {}
.timer-start-btn {
    display: inline-flex; align-items: center; gap: .35rem;
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--radius);
    padding: .3rem .75rem; font-size: .8rem; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: background .15s;
}
.timer-start-btn:hover { background: var(--primary-dark); }

.timer-running {
    display: flex; align-items: center; gap: .45rem;
    background: #fef2f2; border: 1px solid #fca5a5;
    border-radius: var(--radius); padding: .25rem .6rem;
    font-size: .82rem; white-space: nowrap;
}
.timer-dot {
    color: #dc2626; font-size: .65rem;
    animation: timerPulse 1.2s ease-in-out infinite;
}
@keyframes timerPulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

.timer-display {
    font-variant-numeric: tabular-nums; font-weight: 700;
    color: #dc2626; letter-spacing: .03em;
}
.timer-task-name {
    max-width: 140px; overflow: hidden; text-overflow: ellipsis;
    color: var(--text-muted); font-size: .78rem;
    cursor: pointer; border-bottom: 1px dotted var(--text-muted);
}
.timer-task-name:hover { color: var(--text); }
.timer-stop-btn {
    background: #dc2626; color: #fff; border: none;
    border-radius: var(--radius); padding: .2rem .55rem;
    font-size: .76rem; font-weight: 600; cursor: pointer;
    transition: background .15s;
}
.timer-stop-btn:hover { background: #b91c1c; }

/* ── Timer-Panel (Dropdown) ─────────────────────────────────────── */
.timer-panel {
    position: fixed;
    top: 54px; right: 110px;          /* rechts neben User-Badge */
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 1200;
}
.timer-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem .9rem; border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: .88rem;
}
.timer-panel-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1rem; line-height: 1;
}
.timer-panel-body { padding: .9rem; }

/* ── Buchungs-Zeit-Vorschau ─────────────────────────────────────── */
.booking-time-preview {
    font-size: .82rem; color: var(--text-muted);
    margin-top: .25rem; font-style: italic;
}

/* ── Modal (allgemein, falls noch nicht vorhanden) ──────────────── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1300;
}
.modal-box {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    width: 95vw; max-height: 90vh;
    overflow-y: auto; display: flex; flex-direction: column;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1.1rem; border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: .95rem; flex-shrink: 0;
}
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem; line-height: 1;
}
.modal-body { padding: 1.1rem; flex: 1; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: .6rem;
    padding: .8rem 1.1rem; border-top: 1px solid var(--border); flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR-STOPPUHR
   ═══════════════════════════════════════════════════════════════════ */
.sidebar-timer {
    margin: 0;
    padding: .55rem .9rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transition: background .3s, border-color .3s;
}
/* ── Laufender Zustand: auffällig hervorheben ── */
.sidebar-timer--running {
    background: #fef2f2;
    border-top-color: #fca5a5;
    border-bottom-color: #fca5a5;
    border-left: 3px solid #dc2626;
    padding-left: calc(.9rem - 3px);
    animation: sideTimerGlow 2s ease-in-out infinite;
}
@keyframes sideTimerGlow {
    0%, 100% { box-shadow: inset 3px 0 0 #dc2626; }
    50%       { box-shadow: inset 3px 0 8px #fca5a5; }
}
.sidebar-timer-start-btn {
    display: block;
    width: 100%;
    padding: .35rem .6rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background .15s;
}
.sidebar-timer-start-btn:hover { background: var(--primary-dark, #1d4ed8); }

.sidebar-timer-top {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .3rem;
}
.sidebar-timer-display {
    font-size: .95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
    flex: 1;
    color: #dc2626;
}
.sidebar-timer-stop-btn {
    padding: .2rem .45rem;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.sidebar-timer-stop-btn:hover { background: #b91c1c; }
/* Task-Name als klickbarer Button */
.sidebar-timer-task {
    display: block;
    width: 100%;
    font-size: .75rem;
    color: #b91c1c;
    cursor: pointer;
    padding: .15rem .2rem .15rem 1.15rem;
    background: none;
    border: none;
    border-radius: 3px;
    text-align: left;
    text-decoration: underline dotted #fca5a5;
    transition: background .12s, color .12s;
}
.sidebar-timer-task:hover {
    background: #fee2e2;
    color: #7f1d1d;
}
/* Collapsed-Sidebar: Timer ausblenden */
body.sidebar-collapsed .sidebar-timer { display: none; }

/* ═══════════════════════════════════════════════════════════════════
   TAGES-BUCHUNGSÜBERSICHT  (Sidebar unten)
   ═══════════════════════════════════════════════════════════════════ */
.day-tracker {
    margin: .5rem 0 0;
    padding: .75rem .9rem;
    border-top: 1px solid var(--border);
    font-size: .8rem;
}
.day-tracker-header {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: .35rem;
}
.day-tracker-title {
    font-weight: 700; font-size: .78rem; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted);
    text-decoration: none;
}
.day-tracker-title:hover { color: var(--primary); }
.day-tracker-total {
    font-weight: 700; font-size: .9rem; color: var(--text-muted);
    transition: color .2s;
}
.day-tracker-total.progress { color: var(--primary); }
.day-tracker-total.done     { color: var(--success); }

/* Fortschrittsbalken */
.day-progress-bar {
    width: 100%; height: 7px;
    background: var(--border);
    border-radius: 99px; overflow: hidden;
    margin-bottom: .3rem;
}
.day-progress-fill {
    height: 100%; border-radius: 99px;
    background: var(--primary);
    transition: width .4s ease;
    min-width: 2px;
}
.day-progress-fill.done { background: var(--success); }
.day-progress-label {
    font-size: .72rem; color: var(--text-muted);
    margin-bottom: .45rem;
}
.day-goal-done { color: var(--success); font-weight: 700; }

/* Buchungsliste */
.day-booking-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: .15rem;
    max-height: 180px; overflow-y: auto;
}
.day-booking-item {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: .4rem; padding: .18rem 0;
    border-bottom: 1px solid var(--border);
}
.day-booking-item:last-child { border-bottom: none; }
.day-booking-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; color: var(--text);
}
.day-booking-min {
    white-space: nowrap; color: var(--text-muted);
    font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.day-booking-empty {
    color: var(--text-muted); font-style: italic; font-size: .75rem;
    padding: .2rem 0;
}

/* ═══════════════════════════════════════════════════════════════════
   DRAG & DROP  –  Menü-Sortierung
   ═══════════════════════════════════════════════════════════════════ */
.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 .4rem 0 .1rem;
    user-select: none;
    flex-shrink: 0;
    opacity: .45;
    transition: opacity .15s;
}
.drag-handle:hover  { opacity: 1; color: var(--primary); }
.drag-handle:active { cursor: grabbing; }

/* Element das gerade gezogen wird */
.drag-ghost {
    opacity: .38;
    background: var(--bg) !important;
    border: 2px dashed var(--primary) !important;
}
/* Element das ausgewählt ist */
.drag-chosen {
    box-shadow: 0 4px 16px rgba(37,99,235,.18);
    border-radius: var(--radius);
}

/* Drag-Handle in Tabellenzeilen bündig ausrichten */
.menu-tree-row { display: flex; align-items: center; }
.menu-tree-top .drag-handle,
.menu-tree-child .drag-handle { align-self: center; }

/* ShowInList-Flag (T) – farblich hervorgehoben */
.flag.flag-showinlist {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════
   PageBuilder JOIN-Editor
   ═══════════════════════════════════════════════════════════════════ */
.join-editor-wrap { overflow-x: auto; }

.join-table th, .join-table td {
    padding: .35rem .5rem;
    vertical-align: middle;
}
.join-table .form-control-sm {
    font-size: .82rem;
    padding: .2rem .4rem;
    height: auto;
}
.join-del-btn { padding: .1rem .45rem; font-size: .9rem; }

/* JOIN-Spalten-Header in der Datentabelle */
.join-col-header { background: rgba(37,99,235,.05); }
.join-col-cell   { color: var(--text-muted); }
