/* ===== Theme System ===== */
:root {
    /* Dark Theme (Default) */
    --bg: #0f1115;
    --bg-alpha: #0f1115cc;
    --card: #171a21;
    --card-hover: #1c2029;
    --surface: #12151c;
    --text: #e7ecf4;
    --text-secondary: #cbd3e6;
    --muted: #8b93a7;
    --border: #ffffff12;
    --border-light: #ffffff18;
    --border-medium: #ffffff22;
    --brand: #91a7ff;
    --brand-glow: #91a7ff22;
    --ok: #78d6a4;
    --ok-bg: #0e1a14;
    --ok-border: #1f5b3d;
    --warn: #ffd084;
    --warn-bg: #1c160e;
    --warn-border: #6e5a24;
    --err: #ff8e8e;
    --err-bg: #1f1212;
    --err-border: #5b1f1f;
    --radius: 14px;
    --shadow: 0 6px 18px rgba(0,0,0,.35);
    --shadow-lg: 0 12px 28px rgba(0,0,0,.35);
}

/* Light Theme */
[data-theme="light"] {
    --bg: #f5f7fa;
    --bg-alpha: #f5f7faee;
    --card: #ffffff;
    --card-hover: #f0f2f5;
    --surface: #ffffff;
    --text: #1a1d24;
    --text-secondary: #3d4555;
    --muted: #6b7280;
    --border: #00000012;
    --border-light: #00000018;
    --border-medium: #00000022;
    --brand: #5872d1;
    --brand-glow: #5872d122;
    --ok: #22a85f;
    --ok-bg: #ecfdf5;
    --ok-border: #86efac;
    --warn: #d97706;
    --warn-bg: #fffbeb;
    --warn-border: #fcd34d;
    --err: #dc2626;
    --err-bg: #fef2f2;
    --err-border: #fca5a5;
    --shadow: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font:16px/1.45 system-ui,Segoe UI,Roboto,Inter,Arial,sans-serif}
a{color:inherit;text-decoration:none}
.container{max-width:720px;margin:0 auto;padding:12px;padding-bottom:calc(12px + 90px + env(safe-area-inset-bottom))}
.topbar{position:sticky;top:0;z-index:5;padding:12px;background:var(--bg-alpha);backdrop-filter:blur(6px);border-bottom:1px solid var(--border)}
.brand{display:flex;justify-content:space-between;align-items:center;gap:12px}
.brand-left{display:flex;align-items:center;gap:10px}
.dot{width:10px;height:10px;border-radius:50%;background:var(--brand);box-shadow:0 0 0 6px #91a7ff22}
h1{font-size:18px;margin:0}
.nav .btn{margin-left:8px}
.search{display:flex;gap:8px;margin-top:8px}
.search input{flex:1;border:1px solid var(--border-medium);background:var(--surface);color:var(--text);border-radius:999px;padding:12px}
.btn{border:1px solid var(--border-medium);background:var(--card);color:var(--text);padding:10px 12px;border-radius:12px}
.btn.primary{background:var(--brand);color:#0b0e17;border:0;font-weight:700}
.btn.ghost{background:transparent}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.card{display:block;border:1px solid var(--border);background:var(--card);border-radius:16px;padding:14px}
.title{font-weight:700;margin-bottom:6px}
.desc{color:var(--muted);font-size:13px}
.keywords{margin-top:8px;display:flex;gap:6px;flex-wrap:wrap}
.kw{font-size:11px;background:var(--surface);border:1px solid var(--border-light);border-radius:999px;padding:2px 8px;color:var(--text-secondary)}
.panel{border:1px solid var(--border);background:var(--card);border-radius:16px;padding:16px}
.field{display:grid;gap:6px;margin-bottom:14px}
.field.two{grid-template-columns:1fr 1fr;gap:12px}
input,select,textarea{border:1px solid var(--border-medium);background:var(--surface);color:var(--text);border-radius:12px;padding:12px}
.segmented{display:flex;gap:10px}
.segmented label{display:flex;align-items:center;gap:6px;border:1px solid var(--border-medium);background:var(--surface);border-radius:999px;padding:6px 10px}
.alert{padding:10px 12px;border-radius:12px;margin:10px 0}
.alert.success{background:var(--ok-bg);border:1px solid var(--ok-border);color:var(--ok)}
.alert.warn{background:var(--warn-bg);border:1px solid var(--warn-border);color:var(--warn)}
.alert.error{background:var(--err-bg);border:1px solid var(--err-border);color:var(--err)}
.muted{color:var(--muted)}
.small{font-size:13px}
.auth{display:grid;place-items:center}
.auth-card{width:min(420px,92vw);}


/* ---- LOGIN POLISH (add-on) ---- */
.auth{ display:grid; place-items:center; min-height:100dvh; padding:24px; }

.auth-card{
    width:min(520px,92vw);
    background:linear-gradient(180deg,#171a21,#151922);
    border:1px solid #ffffff12;
    border-radius:20px;
    padding:20px 18px 18px;
    box-shadow:0 12px 28px rgba(0,0,0,.35);
}

.auth-card h1{
    margin:0 0 14px 0;
    font-size:20px; font-weight:800; letter-spacing:.2px;
}

/* Grid für Label | Input */
.form-grid{
    display:grid;
    grid-template-columns: 140px 1fr;
    gap:12px 14px;
    align-items:center;
}
.form-grid .full{ grid-column:1 / -1; }

input[type="text"], input[type="password"]{
    height:44px; padding:0 12px;
}

input:focus, select:focus, textarea:focus{
    outline:none;
    border-color:#9fb1ff;
    box-shadow:0 0 0 3px rgba(145,167,255,.25);
}

label{ color:#cbd3e6; font-weight:600; }

.btn.primary{
    background:linear-gradient(180deg,#a4b5ff,#8da3ff);
    color:#0b0e17; border:0; font-weight:800;
    height:44px; padding:0 18px; border-radius:12px;
    box-shadow:0 10px 24px rgba(145,167,255,.35);
}
.btn.primary:hover{ filter:brightness(1.06); }
.btn.primary:active{ transform:translateY(1px); }

/* Mobile: 1 Spalte */
@media (max-width:540px){
    .form-grid{ grid-template-columns:1fr; }
    .form-grid label{ margin-top:4px; }
}

/* Zurück-Button im Header */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.back-btn:hover {
    background: var(--card);
}

.back-btn svg {
    display: block;
}

/* Chips & Vorschläge */
.chips{ display:flex; gap:8px; flex-wrap:wrap; }
.chip{ display:flex; align-items:center; gap:6px;
    background:#0c0e12; border:1px solid #ffffff14; color:var(--text);
    padding:6px 10px; border-radius:999px; font-size:13px;
}
.chip button{ background:transparent; border:0; color:#b4bed6; font-size:16px; line-height:1; cursor:pointer; }
.chip-input{ display:flex; gap:8px; align-items:center; }
.suggest{ margin-top:8px; display:flex; gap:6px; flex-wrap:wrap; }
.sugg{ background:#12151c; border:1px solid #ffffff12; color:#c5cde0;
    padding:6px 10px; border-radius:999px; font-size:13px; cursor:pointer;
}
.nav a.btn {
    font-size:14px;
    padding:8px 12px;
    white-space:nowrap;
}

/* ---- MOBILE HEADER REWORK ---- */

/* Topbar: nur Hintergrund + Abstand, Inhalt kommt in .brand und .search-row */
.topbar{
    position: sticky; top: 0; z-index: 50;
    padding: calc(10px + env(safe-area-inset-top)) 12px 8px 12px;
    background: #0f1115cc; backdrop-filter: blur(8px);
    border-bottom: 1px solid #ffffff14;
}

/* Brand links oben */
.brand{
    display: flex; align-items: center; gap: 10px;
}
.brand-left{ display:flex; align-items:center; gap:10px; }
h1{ font-size: 22px; margin: 0; font-weight: 800; letter-spacing:.2px; }

/* Suche: eigene Zeile, mittig, max-width */
.search-row{
    display: flex; justify-content: center; margin-top: 10px;
}
.search-row .search{
    width: 100%; max-width: 620px;
    display:flex; gap:8px;
    padding: 0; background: transparent; border: 0; box-shadow: none;
}
.search-row .search input{
    flex: 1; border:1px solid #ffffff22; background:#12151c;
    color:var(--text); border-radius:999px; padding:12px 14px;
}
.search-row .search .btn{ border-radius:999px; }

/* Burger: schwebender Button oben rechts */
.burger{
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
    z-index: 60;
}
.burger-btn{
    width: 40px; height: 40px; border-radius: 12px;
    display:grid; place-items:center;
    background:#1a1f2a; border:1px solid #ffffff22; color: var(--text);
    box-shadow: 0 6px 18px rgba(0,0,0,.35);
}

/* Dropdown-Panel */
.menu-panel{
    position: fixed; right: calc(12px + env(safe-area-inset-right));
    top: calc(56px + env(safe-area-inset-top));
    background:#171a21; border:1px solid #ffffff22; border-radius:14px;
    box-shadow: 0 16px 40px rgba(0,0,0,.5);
    padding: 8px; width: 180px; z-index: 70; display:none;
}
.menu-panel.show{ display:block; }
.menu-panel a{ display:block; padding:10px 12px; border-radius:10px; }
.menu-panel a + a{ margin-top:6px; }
.menu-panel a:hover{ background:#0f131b; }

@media (min-width: 760px){
    h1{ font-size: 24px; }
}

/* === Responsive Header Layout === */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: calc(10px + env(safe-area-inset-top)) 14px 8px 14px;
    background: #0f1115cc;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #ffffff14;
}

/* erste Zeile: Brand + Burger */
.toprow {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.env-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 10px;
    color: var(--muted);
    line-height: 1.25;
    min-width: 140px;
    word-break: break-word;
}
.env-info .env-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.env-info .env-value {
    font-variant-numeric: tabular-nums;
}

h1 {
    font-size: 22px;
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.2px;
}

/* Burger rechts */
.burger-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #1a1f2a;
    border: 1px solid #ffffff22;
    color: var(--text);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    font-size: 22px;
}

/* Dropdownmenü */
.menu-panel {
    position: absolute;
    right: 14px;
    top: calc(100% + 10px);
    background: #171a21;
    border: 1px solid #ffffff22;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    padding: 8px;
    width: 180px;
    z-index: 70;
    display: none;
}
.menu-panel.show { display: block; }
.menu-panel a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
}
.menu-panel a + a { margin-top: 6px; }
.menu-panel a:hover { background: #0f131b; }

/* Suche: zweite Zeile, mittig */
.search-row {
    margin-top: 10px;
    display: flex;
    justify-content: center;
}
.search-row .search {
    width: 100%;
    max-width: 620px;
    display: flex;
    gap: 8px;
}
.search-row input {
    flex: 1;
    border: 1px solid #ffffff22;
    background: #12151c;
    color: var(--text);
    border-radius: 999px;
    padding: 12px 14px;
}
.search-row .btn {
    border-radius: 999px;
}

/* === History Header + Filter polish === */

/* Toprow: Back+Title links, Burger rechts */
.toprow{ display:flex; justify-content:space-between; align-items:center; }
.brand-left{ display:flex; align-items:center; gap:10px; }
.brand-left .back { padding:8px 10px; border-radius:12px; }
.page-title{ font-size:22px; font-weight:800; margin:0; }

/* Menü-Dropdown bleibt wie im Dashboard (.menu-panel, .burger-btn etc.) */

/* Filter-Toolbar als Grid statt wilde Wraps */
.toolbar-grid{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:12px;
}
.toolbar-grid .wide { grid-column: 1 / -1; }

/* Inputs kompakter */
.panel .field label{ font-weight:600; }
.panel input[type="date"]{ text-transform:lowercase; }

/* Preset-Buttons in einer Reihe */
.presets{ display:flex; gap:8px; flex-wrap:wrap; }
.presets .btn{ padding:8px 12px; border-radius:12px; }

/* Export-Buttons nebeneinander statt riesig */
.export-row{ display:flex; gap:8px; flex-wrap:wrap; }
.export-row .btn{ padding:10px 14px; border-radius:12px; }

/* Mobile: 1 Spalte */
@media (max-width:560px){
    .toolbar-grid{ grid-template-columns: 1fr; }
}

/* Kategorien-Header (re-use) */
.toprow{ display:flex; justify-content:space-between; align-items:center; }
.brand-left{ display:flex; align-items:center; gap:10px; }
.page-title{ font-size:22px; font-weight:800; margin:0; }

/* Burger & Menü nutzt schon .burger-btn / .menu-panel aus vorherigen Snippets */

/* Chips-Zeile mobil schöner umbrechen */
.chip-input{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.chip-input input{ flex:1; min-width: 180px; }
#chips{ margin-top:6px; }

/* === History Table mobile fix === */

/* Wrapper für horizontales Scrollen */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

/* Tabelle selbst */
.table {
    width: 100%;
    min-width: 720px; /* verhindert zu enge Spalten */
    border-collapse: collapse;
    border-spacing: 0;
}

/* Zellen */
.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #ffffff12;
    white-space: nowrap;
    vertical-align: top;
}

/* Kopf fixieren */
.table thead th {
    position: sticky;
    top: 0;
    background: #0f1115ee;
    backdrop-filter: blur(6px);
    z-index: 5;
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
}

/* Badge + Key-Value Chips */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #0c0e12;
    border: 1px solid #ffffff18;
    font-size: 11px;
    color: #c7d0e8;
    white-space: nowrap;
}

.kv {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.kv span {
    font-size: 12px;
    background: #0c0e12;
    border: 1px solid #ffffff18;
    border-radius: 8px;
    padding: 2px 6px;
    color: #cbd3e6;
    white-space: nowrap;
}

/* Scrollbar optisch zurückhaltend */
.table-wrap::-webkit-scrollbar {
    height: 6px;
}
.table-wrap::-webkit-scrollbar-thumb {
    background: #2a2d36;
    border-radius: 6px;
}
.table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

/* History: kompakter Header + Filter-Dropdown */
.searchbar-row{ margin-top:10px; display:flex; gap:8px; justify-content:center; }
.searchbar-row .search{ display:flex; gap:8px; width:100%; max-width:620px; }
.searchbar-row input[type="search"]{
    flex:1; border:1px solid #ffffff22; background:#12151c; color:var(--text);
    border-radius:999px; padding:12px 14px;
}
.iconbtn{
    width:42px; height:42px; display:grid; place-items:center;
    border-radius:12px; background:#1a1f2a; border:1px solid #ffffff22;
}
.iconbtn:active{ transform:translateY(1px); }

/* eingeklappter Filter */
.hidden{ display:none !important; }
.filters{
    margin-top:10px; border:1px solid #ffffff12; background:#171a21;
    border-radius:16px; padding:12px;
}
.filters .toolbar-grid{
    display:grid; grid-template-columns: 1fr 1fr; gap:12px;
}
.filters .toolbar-grid .wide{ grid-column:1 / -1; }
@media (max-width:560px){
    .filters .toolbar-grid{ grid-template-columns: 1fr; }
}

/* Kompakte Filter-Leiste */
.filter-bar {
    margin-top: 12px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.filter-bar-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-preset {
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.filter-preset:hover {
    background: var(--card-hover);
    border-color: var(--brand);
    color: var(--text);
}

.filter-preset.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #0b0e17;
    font-weight: 600;
}

.filter-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

.filter-select {
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-medium);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    min-width: 140px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-select:hover {
    border-color: var(--brand);
    background: var(--card-hover);
}

.filter-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.filter-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--card);
    color: var(--muted);
    text-decoration: none;
    font-size: 16px;
    line-height: 1;
    transition: all 0.15s ease;
    margin-left: 2px;
}

.filter-chip-remove:hover {
    background: var(--err);
    color: #fff;
    transform: scale(1.1);
}

@media (max-width: 560px) {
    .filter-controls {
        margin-left: 0;
        width: 100%;
    }
    
    .filter-select {
        flex: 1;
        min-width: 0;
    }
}

/* ==== Form-Builder ==== */
/* ==== Form-Builder Layout Fix ==== */
.builder {
    border: 1px solid #ffffff12;
    background: #171a21;
    border-radius: 16px;
    padding: 12px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Builder Kopfbereich */
.builder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.builder-head strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

/* Buttons größer & nebeneinander */
.builder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.builder-actions .btn {
    padding: 12px 18px;
    font-size: 15px;
    border-radius: 14px;
}


/* Feldliste */
.builder-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}
.builder-item {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    gap: 10px;
    align-items: start;
    border: 1px solid #ffffff18;
    background: #12151c;
    border-radius: 12px;
    padding: 10px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* Grid innerhalb eines Items */
.bi-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    box-sizing: border-box;
}
.bi-grid .full {
    grid-column: 1 / -1;
}

/* Vorschau */
.builder-preview {
    border: 1px dashed #ffffff22;
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}
.builder-empty {
    padding: 12px;
    border: 1px dashed #ffffff22;
    border-radius: 12px;
    text-align: center;
    color: #8b93a7;
    width: 100%;
    box-sizing: border-box;
}

/* Drag + Reaktion */
.builder-item .drag { cursor: grab; user-select: none; opacity: .8; margin-top: 8px; }
.builder-item.dragging { opacity: .6; }

/* Mobile-Optimierung */
@media (max-width: 700px) {
    .bi-grid { grid-template-columns: 1fr; }
    .builder { padding: 10px; }
    .builder-item { padding: 8px; }
    .builder-actions { flex-direction: column; align-items: stretch; }
}

/* Summary hübsch + Abstand zum Inhalt */
details.field > summary {
    display:flex; align-items:center; gap:8px;
    padding:10px 12px; border:1px solid #ffffff12; border-radius:12px;
    background:#171a21; cursor:pointer; user-select:none;
}
details.field > summary::-webkit-details-marker { display:none; }
details.field[open] > summary { margin-bottom:10px; }

/* Button-Row im Builder: 3 Spalten, responsive */
.builder-head { margin:0; padding:0; }
.builder-actions {
    display:grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap:10px;
    width:100%;
}
/* Bei schmalen Screens automatisch 2/1 Spalten */
@media (max-width: 640px){
    .builder-actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 420px){
    .builder-actions { grid-template-columns: 1fr; }
}
.builder-actions .btn {
    width:100%;
    padding:12px 18px;
    font-size:15px;
    border-radius:14px;
}

/* === History Card Layout === */
.entries {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.entry-card {
    border: 1px solid #ffffff12;
    background: #171a21;
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entry-card header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 600;
    color: var(--text);
}

.entry-card .time {
    font-family: monospace;
    font-size: 13px;
    color: var(--muted);
}

.entry-card .values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.entry-card .chip {
    background: #0c0e12;
    border: 1px solid #ffffff18;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    color: #c7d0e8;
}

.entry-card .note {
    border-top: 1px dashed #ffffff14;
    padding-top: 6px;
    line-height: 1.3;
}

.badge {
    background: #0c0e12;
    border: 1px solid #ffffff22;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 13px;
    font-weight: 600;
}

@media (prefers-color-scheme: light) {
    .entry-card { background: #fafafa; border-color: #ddd; }
}

/* --- iOS Zoom verhindern: Inputs >= 16px --- */
input, select, textarea { font-size:16px; }

/* --- kompaktere Segmented-Buttons --- */
.segmented { display:flex; gap:6px; flex-wrap:wrap; }
.segmented.compact label{
    display:inline-flex; align-items:center; gap:6px;
    border:1px solid #ffffff22; background:#12151c;
    border-radius:10px; padding:4px 8px; font-size:13px; line-height:1;
}
.segmented.compact input{ position:absolute; opacity:0; width:0; height:0; }
.segmented.compact label:has(input:checked){
    background:var(--brand); color:#0b0e17; border-color:transparent; font-weight:600;
}

/* --- fixe Savebar unten --- */
.formwrap { padding-bottom:96px; } /* Platz für Savebar */
.savebar{
    position:fixed; left:0; right:0;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 50;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    display:flex; justify-content:flex-end;
    backdrop-filter: blur(8px);
    background: linear-gradient(180deg, #0f1115cc, #0f1115e6);
    border-top:1px solid #ffffff14;
}
.savebar .btn{ width:100%; max-width:240px; }

/* kleine Inputs als „compact“ */
.input-compact input[type="number"],
.input-compact input[type="text"],
.input-compact select{
    padding:10px; border-radius:10px; font-size:15px;
}

/* ===== History: kompakter Card-Stack mit KV-Tabelle ===== */
.entries{
    display:flex; flex-direction:column; gap:12px; margin-top:10px;
}

.entry-card{
    border:1px solid #ffffff12; background:#171a21;
    border-radius:16px; padding:14px 16px; display:flex; flex-direction:column; gap:10px;
}

.entry-head{
    display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap;
    border-bottom:1px dashed #ffffff14; padding-bottom:6px;
}
.entry-cat{
    margin:0; font-size:20px; line-height:1.2; font-weight:800; letter-spacing:.2px;
}
.entry-meta{
    display:flex; align-items:center; gap:8px; font-weight:700;
}
.entry-meta .entry-user{ font-size:16px; }
.entry-meta .entry-time{ font-size:14px; color:var(--muted); }
.entry-meta .dot{ color:#ffffff33; }

/* Key–Value Tabelle */
.kv-table{ display:flex; flex-direction:column; gap:6px; }
.kv-row{
    display:grid; grid-template-columns: 1fr auto; gap:12px;
    background:#0c0e12; border:1px solid #ffffff18; border-radius:12px; padding:8px 10px;
}
.kv-k{ color:#c7d0e8; font-weight:600; }
.kv-v{ color:var(--text); }

/* Notizbereich */
.entry-note{
    display:grid; grid-template-columns:auto 1fr; gap:10px;
    border-top:1px dashed #ffffff14; padding-top:8px;
}
.entry-note .label{ color:#c7d0e8; font-weight:700; }
.entry-note .text{ color:var(--text); }

/* Light mode tweak */
@media (prefers-color-scheme: light){
    .entry-card{ background:#fafafa; border-color:#ddd; }
    .kv-row{ background:#fff; border-color:#ddd; }
}

/* ===== History: Kachel-Layout (Kategorie + Edit, dann Zeit+User) ===== */
.entries{ display:flex; flex-direction:column; gap:12px; margin-top:10px; }

.entry-card{
    border:1px solid #ffffff12; background:#171a21;
    border-radius:16px; padding:14px 16px;
    display:flex; flex-direction:column; gap:10px;
}

.entry-card .row-1{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.entry-cat{
    margin:0; font-size:20px; line-height:1.2; font-weight:800; letter-spacing:.2px;
}

.icon-btn{
    display:inline-flex; align-items:center; justify-content:center;
    width:36px; height:36px; border-radius:12px;
    background:#0c0e12; border:1px solid #ffffff22; color:#c7d0e8;
}
.icon-btn:active{ transform:translateY(1px); }

.entry-card .row-2{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    border-bottom:1px dashed #ffffff14; padding-bottom:6px;
}
.entry-time{ font-family:monospace; font-size:13px; color:var(--muted); }
.entry-user{ font-weight:700; font-size:15px; }

/* Key–Value Tabelle */
.kv-table{ display:flex; flex-direction:column; gap:6px; }
.kv-row{
    display:grid; grid-template-columns: 1fr auto; gap:12px;
    background:#0c0e12; border:1px solid #ffffff18; border-radius:12px; padding:8px 10px;
}
.kv-k{ color:#c7d0e8; font-weight:600; }
.kv-v{ color:var(--text); }

/* Notiz */
.entry-note{
    display:grid; grid-template-columns:auto 1fr; gap:10px;
    border-top:1px dashed #ffffff14; padding-top:8px;
}
.entry-note .label{ color:#c7d0e8; font-weight:700; }
.entry-note .text{ color:var(--text); }

/* Light mode tweak */
@media (prefers-color-scheme: light){
    .entry-card{ background:#fafafa; border-color:#ddd; }
    .kv-row{ background:#fff; border-color:#ddd; }
}

/* Zebra-Look für Karten in der Historie */
.entries {
    display: grid;
    gap: 12px;
}

/* Standardkarte */
.entry-card{
    background: var(--card);
    border: 1px solid #ffffff12;
    border-radius: 18px;
    padding: 14px;
}

/* Jede 2. Karte etwas heller */
.entries .entry-card:nth-of-type(even){
    background: #1c2029;           /* leicht heller als --card */
    border-color: #ffffff1a;
}

/* Optional: :hover etwas anheben (mobil stört nicht) */
.entry-card:hover{
    box-shadow: 0 4px 18px #00000040 inset, 0 0 0 1px #ffffff12;
}

/* Optional: dezente Trennlinie oben in jeder Karte (außer der ersten) */
.entries .entry-card + .entry-card{
    position: relative;
}
.entries .entry-card + .entry-card::before{
    content: "";
    position: absolute;
    top: -6px; left: 10px; right: 10px;
    height: 1px;
    background: #ffffff0e;
    border-radius: 999px;
}

/* ===== Toast Notification (Mobile First) ===== */
.toast-layer{
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(24px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 9999;
    width: calc(100% - 32px);
    max-width: 400px;
}

.toast{
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 15px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        0 8px 32px rgba(0,0,0,.4),
        0 2px 8px rgba(0,0,0,.2),
        inset 0 1px 0 rgba(255,255,255,.1);
    transform: translateY(100px) scale(.9);
    opacity: 0;
    will-change: transform, opacity;
    overflow: hidden;
}

/* Success Toast */
.toast.toast--success{
    background: linear-gradient(135deg, #0d2818 0%, #0a1f14 100%);
    border: 1px solid #2a7a53;
    color: #a8f0c8;
}

/* Error Toast */
.toast.toast--error{
    background: linear-gradient(135deg, #2a1515 0%, #1f1010 100%);
    border: 1px solid #8a3030;
    color: #ffc8c8;
}

.toast .toast-ico{
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.toast .toast-text{
    flex: 1;
    line-height: 1.3;
}

/* Subtiler animierter Hintergrund-Effekt */
.toast .toast-bg{
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background-size: 60px 60px;
    background-image:
        linear-gradient(135deg,
            rgba(255,255,255,.04) 25%, transparent 25%,
            transparent 50%, rgba(255,255,255,.04) 50%,
            rgba(255,255,255,.04) 75%, transparent 75%, transparent
        );
    opacity: .5;
    animation: toast-bg-move 8s linear infinite;
}

@keyframes toast-bg-move{
    to { background-position: 60px 60px; }
}

/* Rein-Animation: von unten hoch, mit Bounce */
@keyframes toast-in {
    0%   { opacity: 0; transform: translateY(100px) scale(.9); }
    50%  { opacity: 1; transform: translateY(-8px) scale(1.02); }
    70%  { transform: translateY(4px) scale(.99); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Raus-Animation: nach unten weg */
@keyframes toast-out {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(60px) scale(.9); }
}

.toast.is-in {
    animation: toast-in .5s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

.toast.is-out {
    animation: toast-out .35s ease-in forwards;
}

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce){
    .toast, .toast.is-in, .toast.is-out {
        animation: none !important;
    opacity: 1;
        transform: none;
    }
    .toast .toast-bg{ animation: none; }
}

/* ===== Admin Actions (History Cards) ===== */
.admin-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn--danger {
    background: #1f1212 !important;
    border-color: #5b2a2a !important;
    color: #ff9999 !important;
}

.icon-btn--danger:hover {
    background: #2a1515 !important;
    border-color: #8a3030 !important;
}

/* ===== Modal (Delete Confirmation) ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.modal.is-open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: linear-gradient(180deg, #1a1f2a, #151922);
    border: 1px solid #ffffff18;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.modal.is-open .modal-content {
    transform: translateY(0) scale(1);
}

.modal-content h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 800;
}

.modal-desc {
    color: var(--muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.modal-desc strong {
    color: var(--text);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
    padding: 14px 18px;
    font-weight: 600;
}

.btn--danger {
    background: linear-gradient(180deg, #6a2a2a, #4a1f1f) !important;
    border: 1px solid #8a3030 !important;
    color: #ffcccc !important;
}

.btn--danger:hover {
    background: linear-gradient(180deg, #7a3030, #5a2525) !important;
}

/* ===== Edit Page Styles ===== */
.alert--info {
    background: #0e1620;
    border: 1px solid #2a4a6a;
    color: #a8d4ff;
    padding: 14px 16px;
    border-radius: 14px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.meta-grid > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-value {
    font-weight: 600;
    color: var(--text);
}

@media (max-width: 480px) {
    .meta-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* ===== Note Field with Media Button ===== */
.note-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.note-wrapper textarea {
    padding-right: 50px; /* Platz für Media-Button */
    min-height: 80px;
    resize: vertical;
}

.media-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #2a3140, #1f2633);
    border: 1px solid #ffffff22;
    border-radius: 10px;
    color: var(--brand);
    cursor: pointer;
    transition: all .15s ease;
    z-index: 2;
}

.media-btn:hover {
    background: linear-gradient(180deg, #3a4150, #2f3643);
    border-color: var(--brand);
    transform: scale(1.05);
}

.media-btn:active {
    transform: scale(0.98);
}

.media-btn svg {
    flex-shrink: 0;
}

/* Drag & Drop Highlight */
.note-wrapper.drag-over {
    outline: 2px dashed var(--brand);
    outline-offset: -2px;
    border-radius: 12px;
}

.note-wrapper.drag-over textarea {
    background: rgba(145, 167, 255, 0.05);
}

/* ===== Image Preview ===== */
.image-preview {
    position: relative;
    margin-top: 10px;
    border-radius: 14px;
    overflow: hidden;
    background: #0c0e12;
    border: 1px solid #ffffff18;
}

.image-preview.hidden {
    display: none;
}

.image-preview img {
    display: block;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    background: #0a0c10;
}

.image-preview .pdf-preview-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px 20px;
    color: #ff6b6b;
}

.image-preview .pdf-preview-icon svg {
    opacity: 0.9;
}

.image-preview .pdf-preview-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.image-preview .pdf-preview-filename {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid #ffffff22;
    border-radius: 8px;
    color: #ff9999;
    cursor: pointer;
    transition: all .15s ease;
}

.remove-image-btn:hover {
    background: rgba(139, 0, 0, 0.8);
    color: #fff;
}

/* Upload Progress */
.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.5);
}

.upload-progress.hidden {
    display: none;
}

.upload-progress .progress-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--brand), #78d6a4);
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

/* ===== Entry Image in History ===== */
.entry-image {
    margin-top: 8px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #ffffff12;
}

.entry-image img {
    display: block;
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: #0a0c10;
    cursor: pointer;
    transition: transform .2s ease;
}

.entry-image img:hover {
    transform: scale(1.01);
}

/* ===== Entry PDF in History ===== */
.entry-document {
    margin-top: 8px;
}

.entry-pdf .pdf-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    border-radius: 12px;
    border: 1px solid #ffffff12;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all .2s ease;
    overflow: hidden;
}

.entry-pdf .pdf-preview:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--brand);
    transform: translateY(-2px);
}

.entry-pdf .pdf-thumbnail-container {
    position: relative;
    width: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0c10;
}

.entry-pdf .pdf-thumbnail {
    display: none;
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
}

.entry-pdf .pdf-thumbnail-loading {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #ff6b6b;
    opacity: 0.6;
}

.entry-pdf .pdf-thumbnail-loading svg {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.entry-pdf .pdf-label {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.05);
    width: 100%;
    text-align: center;
}

/* ===== Image Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all .25s ease;
    padding: 20px;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #ffffff22;
    border-radius: 12px;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: all .15s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== PDF Viewer ===== */
.pdf-viewer {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all .25s ease;
    padding: 20px;
}

.pdf-viewer.is-open {
    opacity: 1;
    visibility: visible;
}

.pdf-viewer-content {
    position: relative;
    width: 100%;
    max-width: 90vw;
    max-height: 90vh;
    background: #1a1d24;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pdf-viewer-content iframe {
    width: 100%;
    height: 90vh;
    min-height: 500px;
    border: none;
    background: #fff;
}

.pdf-viewer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #ffffff22;
    border-radius: 10px;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: all .15s ease;
    z-index: 10;
}

.pdf-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 600px) {
    .pdf-viewer-content {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .pdf-viewer-content iframe {
        height: 100vh;
        min-height: 100vh;
    }
}

/* ===== Upload State ===== */
.btn.is-uploading {
    background: linear-gradient(180deg, #3a4150, #2f3643) !important;
    color: var(--muted) !important;
    cursor: wait;
    position: relative;
    overflow: hidden;
}

.btn.is-uploading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), #78d6a4, var(--brand));
    background-size: 200% 100%;
    animation: upload-progress-bar 1.5s ease-in-out infinite;
}

@keyframes upload-progress-bar {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.media-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Light Theme Overrides ===== */
[data-theme="light"] .btn.primary {
    background: linear-gradient(180deg, #5872d1, #4a62b8);
    color: #fff;
    box-shadow: 0 4px 12px rgba(88, 114, 209, 0.3);
}

[data-theme="light"] .topbar {
    background: var(--bg-alpha);
    border-bottom-color: var(--border);
}

[data-theme="light"] .menu-panel {
    background: var(--card);
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .burger-btn {
    background: var(--card);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

[data-theme="light"] .entry-card {
    background: var(--card);
    border-color: var(--border);
}

[data-theme="light"] .entries .entry-card:nth-of-type(even) {
    background: var(--card-hover);
}

[data-theme="light"] .kv-row {
    background: var(--bg);
    border-color: var(--border);
}

[data-theme="light"] .modal-content {
    background: var(--card);
    border-color: var(--border);
}

[data-theme="light"] .toast {
    background: var(--card);
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .toast.toast--success {
    border-color: var(--ok);
    color: var(--ok);
}

[data-theme="light"] .toast.toast--error {
    border-color: var(--err);
    color: var(--err);
}

[data-theme="light"] .image-preview {
    background: var(--bg);
}

[data-theme="light"] .note-wrapper textarea {
    background: var(--surface);
}

[data-theme="light"] .media-btn {
    background: var(--bg);
    border-color: var(--border);
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(88, 114, 209, 0.15);
}

/* ===== Settings Page ===== */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--text);
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.theme-option {
    position: relative;
    cursor: pointer;
}

.theme-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    transition: all .2s ease;
}

.theme-option input:checked + .theme-card {
    border-color: var(--brand);
    background: var(--card);
}

.theme-preview {
    width: 100%;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.theme-preview.dark {
    background: linear-gradient(135deg, #0f1115, #171a21);
    color: #e7ecf4;
}

.theme-preview.light {
    background: linear-gradient(135deg, #f5f7fa, #ffffff);
    color: #1a1d24;
    border: 1px solid #e5e7eb;
}

.theme-preview.auto {
    background: linear-gradient(135deg, #0f1115 50%, #f5f7fa 50%);
}

.theme-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.theme-option input:checked + .theme-card .theme-name {
    color: var(--brand);
}

/* ===== Pin Feature ===== */

/* Pin Toggle in Entry Form */
.pin-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    transition: all .2s ease;
}

.pin-toggle:hover {
    border-color: var(--brand);
    background: var(--card);
}

.pin-toggle input {
    width: 20px;
    height: 20px;
    margin: 0;
    margin-right: 10px;
    accent-color: var(--brand);
}

.pin-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.pin-icon {
    opacity: 0.7;
}

.pin-toggle input:checked ~ .pin-toggle-label .pin-icon {
    opacity: 1;
    color: var(--brand);
}

/* Pin Button in History */
.entry-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pin-btn {
    transition: all .2s ease;
}

.pin-btn.is-active {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #0b0e17 !important;
}

.pin-btn:hover:not(.is-active) {
    border-color: var(--brand);
    color: var(--brand);
}

/* Pinned Card State */
.entry-card.is-pinned {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand), var(--shadow);
}

.pin-indicator {
    margin-right: 6px;
}

/* Card Highlight Animation (when scrolling to) */
.entry-card.highlight {
    animation: card-highlight 2s ease;
}

@keyframes card-highlight {
    0%, 100% { box-shadow: none; }
    20%, 80% { box-shadow: 0 0 0 3px var(--brand), 0 0 20px rgba(145, 167, 255, 0.3); }
}

/* ===== Pinned Footer ===== */
/* Action Row (Filter + Statistik Buttons) */
.action-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding: 0 4px;
}

.report-row{
    margin-top: 10px;
    padding: 0 4px;
}
.report-plan{
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}
.report-plan.is-done{
    color: var(--ok);
}
.report-btn-full{
    width: 100%;
    height: 44px;
    border-radius: 12px;
    font-weight: 800;
}
.report-panel{
    margin-top: 12px;
}
.report-panel.hidden{
    display: none;
}
.report-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.report-close{
    min-width: 38px;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: 10px;
}
.report-body{
    white-space: pre-wrap;
    line-height: 1.5;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    position: relative;
}

.action-btn:hover {
    background: var(--card-hover);
    border-color: var(--brand);
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn svg {
    flex-shrink: 0;
}

.action-label {
    flex: 1;
    text-align: center;
}

.filter-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--brand);
    border-radius: 50%;
}

/* Filter Popup */
.filter-popup {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all .25s ease;
}

.filter-popup:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.filter-popup-content {
    width: 100%;
    max-width: 720px;
    max-height: 80vh;
    background: var(--card);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.filter-popup:not(.hidden) .filter-popup-content {
    transform: translateY(0);
}

.filter-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.filter-popup-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.filter-popup-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    transition: background .15s ease;
}

.filter-popup-close:hover {
    background: var(--card-hover);
}

.filter-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Pinned Section (im Content-Flow) */
.pinned-section {
    margin-bottom: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all .3s ease;
}

.pinned-section.hidden {
    display: none;
}

.pinned-section .pinned-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.pinned-section.is-expanded .pinned-list {
    max-height: 300px;
}

.pinned-section.is-expanded .pinned-chevron {
    transform: rotate(180deg);
}

.pinned-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border);
}

.pinned-header:hover {
    background: var(--card-hover);
}

.pinned-icon {
    font-size: 18px;
}

.pinned-title {
    font-weight: 600;
    flex: 1;
}

.pinned-count {
    background: var(--brand);
    color: #0b0e17;
    font-weight: 700;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
}

.pinned-chevron {
    font-size: 12px;
    color: var(--muted);
    transition: transform .3s ease;
}

.pinned-footer.is-expanded .pinned-chevron {
    transform: rotate(0deg);
}

.pinned-footer:not(.is-expanded) .pinned-chevron {
    transform: rotate(180deg);
}

.pinned-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}

.pinned-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s ease;
}

.pinned-item:last-child {
    margin-bottom: 0;
}

.pinned-item:hover {
    background: var(--card-hover);
    border-color: var(--brand);
    transform: translateX(2px);
}

.pinned-item:active {
    transform: translateX(0) scale(0.98);
}

.pinned-item-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pinned-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pinned-item-cat {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.pinned-item-time {
    font-size: 12px;
    color: var(--muted);
    font-family: monospace;
    flex-shrink: 0;
}

.pinned-item-values {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.pinned-item-note {
    font-size: 12px;
    color: var(--text);
    font-style: italic;
    line-height: 1.4;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}


/* Light Theme Overrides for Pin */
[data-theme="light"] .pinned-footer {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .pin-btn.is-active {
    color: #fff !important;
}

/* ===== Stats & Export ===== */

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.summary-stats {
    flex: 1;
    min-width: 200px;
}

.summary-actions {
    display: flex;
    gap: 8px;
}

.stats-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #2a3a5a, #1f2d45);
    border-color: #3a5080;
    white-space: nowrap;
}

.stats-btn:hover {
    background: linear-gradient(180deg, #3a4a6a, #2a3d55);
    border-color: var(--brand);
}

.pager-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.pager-info {
    text-align: center;
}

.pager-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pager-controls .btn {
    min-width: 40px;
    padding: 8px 12px;
    font-size: 14px;
}

.pager-controls .btn.active {
    background: var(--brand);
    color: #0b0e17;
    border-color: var(--brand);
    font-weight: 700;
}

.pager-ellipsis {
    padding: 0 4px;
    color: var(--muted);
    font-size: 14px;
}

/* Stats Modal */
.stats-modal .modal-content {
    width: 95vw;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.stats-header h3 {
    margin: 0;
    font-size: 20px;
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s ease;
}

.modal-close-btn:hover {
    background: var(--err-bg);
    border-color: var(--err);
    color: var(--err);
}

.stats-body {
    flex: 1;
    overflow-y: auto;
}

/* Tabs */
.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.stats-tab {
    flex: 1;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all .2s ease;
}

.stats-tab:hover {
    border-color: var(--brand);
}

.stats-tab.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #0b0e17;
}

.stats-tab-content {
    display: none;
}

.stats-tab-content.active {
    display: block;
}

/* Loading */
.stats-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: var(--muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.stats-empty {
    text-align: center;
    padding: 40px;
    color: var(--muted);
}

/* Chart Container */
.stats-chart-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-container {
    position: relative;
    height: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

/* Category Toggles */
.category-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s ease;
}

.category-toggle:hover {
    border-color: var(--brand);
}

.category-toggle input {
    display: none;
}

.toggle-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: opacity .15s ease;
}

.category-toggle input:not(:checked) ~ .toggle-dot {
    opacity: 0.3;
}

.category-toggle input:not(:checked) ~ .toggle-name,
.category-toggle input:not(:checked) ~ .toggle-count {
    opacity: 0.5;
}

.toggle-name {
    font-weight: 600;
    font-size: 14px;
}

.category-toggle-wrapper {
    margin-bottom: 8px;
}

.toggle-chevron {
    margin-left: auto;
    font-size: 12px;
    transition: transform .2s ease;
}

.category-toggle input:checked ~ .toggle-chevron {
    transform: rotate(180deg);
}

.category-fields {
    margin-top: 8px;
    padding-top: 8px;
}

.field-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin: 4px 0;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s ease;
}

.field-toggle:hover {
    background: var(--card-hover);
    border-color: var(--border-medium);
}

.field-toggle input {
    display: none;
}

.field-toggle input:checked ~ .toggle-name {
    font-weight: 600;
    color: var(--brand);
}

.toggle-count {
    font-size: 12px;
    color: var(--muted);
    background: var(--card);
    padding: 2px 8px;
    border-radius: 999px;
}

/* Series Select */
.series-select {
    display: flex;
    align-items: center;
    gap: 10px;
}

.series-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
}

.series-select select {
    padding: 8px 12px;
    border-radius: 10px;
    min-width: 180px;
}

/* Stats Summary */
.stats-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 13px;
}

.summary-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.summary-name {
    font-weight: 600;
}

.summary-stats {
    color: var(--muted);
    font-family: monospace;
    font-size: 12px;
}

/* Export Options */
.export-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .stats-modal .modal-content {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }
    
    .chart-container {
        height: 250px;
        padding: 12px;
    }
    
    .category-toggles {
        flex-direction: column;
    }
    
    .summary-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .summary-actions {
        justify-content: stretch;
    }
    
    .stats-btn {
        flex: 1;
        justify-content: center;
    }
}

/* Light Theme */
[data-theme="light"] .stats-btn {
    background: linear-gradient(180deg, #e8f0ff, #dde7ff);
    border-color: #b8c8e8;
}

[data-theme="light"] .stats-btn:hover {
    border-color: var(--brand);
}

[data-theme="light"] .chart-container {
    background: #fff;
}

/* ===== FOOTER NAVIGATION ===== */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-alpha);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding: calc(8px + env(safe-area-inset-bottom)) 0 8px 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.footer-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 12px;
    gap: 8px;
}

.footer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 12px;
    min-width: 70px;
    min-height: 60px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.footer-btn:hover {
    background: var(--card);
    color: var(--text);
}

.footer-btn:active {
    transform: scale(0.95);
}

.footer-btn-icon {
    font-size: 28px;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    filter: grayscale(0);
    pointer-events: none;
}

.footer-btn-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.footer-btn--active {
    color: var(--brand);
}

.footer-btn--active .footer-btn-icon {
    transform: scale(1.1);
    opacity: 1;
    filter: grayscale(0) brightness(1.4);
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

/* Dark Mode: Footer-Buttons heller */
.footer-btn {
    color: var(--text);
}

.footer-btn-icon {
    filter: grayscale(0) brightness(1.1);
}

/* Footer-Menü (Burger) */
.footer-menu-panel {
    position: fixed;
    bottom: calc(85px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    max-width: 720px;
    margin: 0 auto;
    background: var(--card);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    padding: 20px 12px 12px 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 99;
    pointer-events: none;
}

.footer-menu-panel.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.footer-menu-panel::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-medium);
    border-radius: 2px;
    opacity: 0.6;
}

.footer-menu-panel a {
    display: block;
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--text);
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
    margin-bottom: 6px;
}

.footer-menu-panel a:last-child {
    margin-bottom: 0;
}

.footer-menu-panel a:hover {
    background: var(--card);
    transform: translateX(2px);
}

.footer-menu-panel a:active {
    transform: translateX(2px) scale(0.98);
}

.footer-menu-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.footer-menu-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0 16px;
}

.footer-menu-per-page {
    display: flex;
    gap: 6px;
    padding: 0 12px;
}

.footer-menu-per-page-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.footer-menu-per-page-option:hover {
    background: var(--card-hover);
    border-color: var(--brand);
    transform: translateY(-1px);
}

.footer-menu-per-page-option.active {
    background: var(--brand);
    color: #0b0e17;
    border-color: var(--brand);
}

.footer-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

/* Body-Padding für Footer */
body.has-footer {
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

/* Container zusätzliches Padding für Footer */
body.has-footer .container {
    padding-bottom: calc(24px + 90px + env(safe-area-inset-bottom));
}

/* Light Theme Footer */
[data-theme="light"] .app-footer {
    background: var(--bg-alpha);
    border-top-color: var(--border);
}

[data-theme="light"] .footer-menu-panel {
    background: var(--card);
    border-color: var(--border);
}

[data-theme="light"] .footer-menu-panel::before {
    background: var(--border-medium);
}

[data-theme="light"] .footer-btn:hover {
    background: var(--card-hover);
}

[data-theme="light"] .footer-btn {
    color: var(--text-secondary);
}

[data-theme="light"] .footer-btn-icon {
    filter: grayscale(0) brightness(0.9);
}

[data-theme="light"] .footer-btn--active .footer-btn-icon {
    filter: grayscale(0) brightness(0.9);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
}

/* Mobile: Größere Touch-Targets und mehr Abstand */
@media (max-width: 600px) {
    .footer-nav {
        padding: 0 8px;
        gap: 4px;
    }
    
    .footer-btn {
        padding: 14px 16px;
        min-width: 80px;
        min-height: 64px;
        flex: 1;
        max-width: 120px;
    }
    
    /* Menü-Button extra groß für besseres Treffen */
    #footerMenuBtn {
        min-width: 90px;
        min-height: 70px;
        padding: 16px 18px;
    }
    
    .footer-btn-icon {
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    .footer-btn-label {
        font-size: 12px;
    }
    
    .footer-btn:active {
        transform: scale(0.92);
        background: var(--card);
    }
    
    /* Mobile: Mehr Padding für Footer */
    body.has-footer {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
    
    body.has-footer .container {
        padding-bottom: calc(24px + 100px + env(safe-area-inset-bottom));
    }
}

/* Sehr kleine Screens */
@media (max-width: 400px) {
    .footer-nav {
        gap: 2px;
        padding: 0 4px;
    }
    
    .footer-btn {
        padding: 12px 8px;
        min-width: 70px;
    }
    
    .footer-btn-label {
        font-size: 11px;
    }
}

/* Such-Panel über Footer */
.footer-search-panel {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 12px;
    z-index: 101;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
}

/* Mobile: Such-Panel noch höher */
@media (max-width: 600px) {
    .footer-search-panel {
        bottom: calc(90px + env(safe-area-inset-bottom));
    }
}

.footer-search-panel.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.footer-search-panel-inner {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 16px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3);
}

.footer-search-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.footer-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.footer-search-input {
    flex: 1;
    border: 1px solid var(--border-medium);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 40px 12px 14px;
    font-size: 16px;
    width: 100%;
}

.footer-search-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.footer-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: var(--surface);
    color: var(--muted);
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all .15s ease;
}

.footer-search-clear:hover {
    background: var(--card-hover);
    color: var(--text);
}

.footer-search-close {
    align-self: flex-end;
    background: transparent;
    border: 0;
    color: var(--text);
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.footer-search-close:hover {
    background: var(--surface);
}

.search-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-nav-btn {
    min-width: 36px;
    padding: 8px 10px;
}

.search-count {
    font-size: 14px;
    color: var(--muted);
    min-width: 48px;
    text-align: center;
}

.search-hit {
    outline: 1px solid var(--brand);
    background: rgba(145, 167, 255, 0.08);
}

.search-hit-current {
    box-shadow: 0 0 0 3px var(--brand-glow);
}

[data-theme="light"] .footer-search-panel-inner {
    background: var(--card);
    border-color: var(--border);
}

/* Projekt-Grid (für Projekt-Dashboard) */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.project-card {
    display: block;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 16px;
    padding: 18px;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.project-card:hover {
    border-color: var(--brand);
    background: var(--card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.project-card-icon {
    font-size: 36px;
    line-height: 1;
    margin-bottom: 10px;
    display: block;
}

.project-card-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text);
}

.project-card-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

/* Mobile: 2 Spalten für Projekte */
@media (max-width: 600px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .project-card {
        padding: 14px;
    }
    
    .project-card-icon {
        font-size: 32px;
    }
}

