/* ═══ HISTORY · SAAS REDESIGN ═══ */

/* ─── Topbar ─── */
.hl-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.hl-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.hl-logo-dot {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), rgba(var(--primary-rgb), 0.5));
    box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.35);
    flex-shrink: 0;
}
.hl-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    margin: 0;
    line-height: 1.15;
}
.hl-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    margin-top: 1px;
}
.hl-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 9px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.hl-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.hl-btn-ghost {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
}
.hl-btn-ghost:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.15);
    color: var(--text-main);
}
.hl-btn-danger {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.15);
    color: rgba(239,68,68,0.8);
}
.hl-btn-danger:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
}
.hl-badge {
    background: rgba(239,68,68,0.2);
    color: #f87171;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

/* ─── Stats Strip ─── */
.hl-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.hl-stat-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.2s;
}
.hl-stat-card:hover { border-color: rgba(var(--primary-rgb), 0.2); }
.hl-stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
    line-height: 1;
}
.hl-stat-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ─── Filter Panel ─── */
.hl-filter-panel {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 768px) {
    .hl-filter-panel {
        padding: 12px 14px;
        gap: 10px;
    }

    .hl-type-pills {
        gap: 5px;
    }

    .hl-pill {
        padding: 4px 10px;
        font-size: 0.7rem;
    }

    .hl-filter-field {
        padding: 0 8px;
        min-height: 36px;
    }

    .hl-input {
        padding: 6px 0;
        font-size: 0.75rem;
    }

    .hl-filter-hours {
        width: 90px;
    }

    .hl-filter-search {
        min-width: 0;
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .hl-topbar {
        flex-direction: column;
        gap: 8px;
    }

    .hl-topbar-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
    }

    .hl-title {
        font-size: 1.2rem;
    }

    .hl-topbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .hl-btn {
        padding: 6px 12px;
        font-size: 0.72rem;
        flex: 1;
        min-width: 120px;
    }
}

/* Type Pills */
.hl-type-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.hl-pill {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    transition: all 0.18s ease;
    white-space: nowrap;
}
.hl-pill:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text-main);
}
.hl-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(var(--primary-rgb), 0.3);
}
.hl-pill-work.active    { background: var(--primary); border-color: var(--primary); box-shadow: 0 2px 10px rgba(var(--primary-rgb),.35); }
.hl-pill-school.active  { background: #06b6d4; border-color: #06b6d4; box-shadow: 0 2px 10px rgba(6,182,212,.35); }
.hl-pill-vacation.active{ background: #10b981; border-color: #10b981; box-shadow: 0 2px 10px rgba(16,185,129,.35); }
.hl-pill-gleittag.active{ background: #f59e0b; border-color: #f59e0b; box-shadow: 0 2px 10px rgba(245,158,11,.35); }
.hl-pill-sick.active    { background: #ef4444; border-color: #ef4444; box-shadow: 0 2px 10px rgba(239,68,68,.35); }
.hl-pill-holiday.active { background: #ec4899; border-color: #ec4899; box-shadow: 0 2px 10px rgba(236,72,153,.35); }
.hl-pill-korrektur.active { background: #64748b; border-color: #64748b; box-shadow: 0 2px 10px rgba(100,116,139,.35); }

/* Filter Row */
.hl-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.hl-filter-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 9px;
    padding: 0 10px;
    transition: border-color 0.18s;
}
.hl-filter-field svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.hl-filter-field:focus-within {
    border-color: rgba(var(--primary-rgb), 0.35);
    background: rgba(var(--primary-rgb), 0.04);
}
.hl-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 0.8rem;
    font-family: var(--font-main);
    padding: 8px 0;
    min-width: 0;
}
.hl-input::placeholder { color: var(--text-muted); }
.hl-filter-hours { width: 110px; }
.hl-filter-search { flex: 1; min-width: 200px; }
.hl-filter-sep {
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ─── Table Header (hidden — card layout now) ─── */
.hl-table-head { display: none; }

/* ─── Entry List ─── */
#entryListFull {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 62vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--primary-rgb), 0.15) transparent;
}
#entryListFull::-webkit-scrollbar { width: 4px; }
#entryListFull::-webkit-scrollbar-thumb { background: rgba(var(--primary-rgb), 0.15); border-radius: 4px; }
#entryListFull::-webkit-scrollbar-thumb:hover { background: rgba(var(--primary-rgb), 0.3); }

/* ─── Entry Row ─── */
.entry-row {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    overflow: hidden;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.18s;
    cursor: default;
    min-height: 72px;
}
/* Sanfter Fade nur beim ERSTEN Öffnen der Historie – NICHT bei jedem Filter-Rerender
   (sonst „flackert"/laggt die ganze Liste bei jeder Interaktion). */
.entry-list-animate-in .entry-row {
    animation: hlRowIn 0.28s ease-out both;
}
@keyframes hlRowIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.entry-row:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.13);
    box-shadow: 0 6px 24px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

/* ── Left section: icon + date ── */
.er-left {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    min-width: 160px;
    border-right: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.er-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.er-icon-wrap.type-work     { background: rgba(var(--primary-rgb), 0.15); }
.er-icon-wrap.type-school   { background: rgba(6,182,212,0.15); }
.er-icon-wrap.type-vacation { background: rgba(16,185,129,0.15); }
.er-icon-wrap.type-gleittag { background: rgba(245,158,11,0.15); }
.er-icon-wrap.type-sick     { background: rgba(239,68,68,0.15); }
.er-icon-wrap.type-holiday  { background: rgba(236,72,153,0.15); }
.er-icon-wrap.type-korrektur{ background: rgba(100,116,139,0.16); }

.er-date-col {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.er-weekday {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}
.er-date {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

/* ── Mid section: info + tags ── */
.er-mid {
    flex: 1;
    min-width: 0;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}
.er-info {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.er-tags {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}
.er-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}
.er-badge.type-work     { background: rgba(var(--primary-rgb),.15); color: var(--primary); }
.er-badge.type-school   { background: rgba(6,182,212,.15);  color: #06b6d4; }
.er-badge.type-vacation { background: rgba(16,185,129,.15); color: #10b981; }
.er-badge.type-gleittag { background: rgba(245,158,11,.15); color: #f59e0b; }
.er-badge.type-sick     { background: rgba(239,68,68,.15);  color: #ef4444; }
.er-badge.type-holiday  { background: rgba(236,72,153,.15); color: #ec4899; }

.er-project {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    flex-shrink: 1;
}
.er-mood { font-size: 0.9rem; flex-shrink: 0; }
.er-mood-row { display: none; }
.er-warn {
    font-size: 0.65rem;
    font-weight: 700;
    color: #ef4444;
    background: rgba(239,68,68,0.1);
    padding: 3px 8px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* ── Right section: hours + diff + actions ── */
.er-right {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-left: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.er-hours {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.er-h-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 1px;
}
.er-diff {
    padding: 5px 11px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-mono);
    white-space: nowrap;
}
.er-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}
.entry-row:hover .er-actions { opacity: 1; }

.btn-icon {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
    color: rgba(255,255,255,0.7);
}

.btn-icon svg {
    transition: stroke 0.15s ease, transform 0.15s ease;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.95);
    transform: scale(1.05);
}

.btn-icon:hover svg {
    transform: scale(1.08);
}

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

.btn-icon.danger {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.15);
    color: rgba(239,68,68,0.7);
}

.btn-icon.danger:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
}

.btn-icon.danger:hover svg {
    transform: scale(1.08);
}

/* Legacy compat */
.entry-date { font-size: 0.9rem; font-weight: 600; color: var(--text-main); font-family: var(--font-mono); }
.entry-meta { font-size: 0.85rem; color: var(--text-muted); }
.entry-type-badge { display: none; }
.entry-diff { display: none; }
.entry-btns { display: none; }
.project-tag { display: none; }

/* Empty */
.hl-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 4rem 0;
    font-size: 0.9rem;
}

/* ─── Highlight Animation ─── */
@keyframes highlightPulse {
    0%  { background: rgba(var(--primary-rgb), 0.2); box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.35); }
    70% { background: rgba(var(--primary-rgb), 0.08); box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.1); }
    100%{ background: rgba(255,255,255,0.02); box-shadow: none; }
}
.entry-highlight {
    animation: highlightPulse 2.5s ease-out forwards !important;
    border-color: rgba(var(--primary-rgb), 0.35) !important;
    transition: none !important;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .hl-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .hl-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .hl-stat-num { font-size: 1.2rem; }
    .hl-topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .hl-topbar-right { width: 100%; justify-content: flex-end; }
    .hl-filter-row { flex-direction: column; align-items: stretch; }
    .hl-filter-search { min-width: 0; }
}

/* ─── Entry Detail Bottom Sheet ─── */
.ed-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.ed-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.ed-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1101;
    background: #0e0e18;
    border-top: 1px solid rgba(168,85,247,0.18);
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 88vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 16px);
}
.ed-sheet.active {
    transform: translateY(0);
}

.ed-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.12);
    margin: 12px auto 0;
}

.ed-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ed-type-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.ed-header-text { flex: 1; min-width: 0; }
.ed-type-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}
.ed-date-line {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: var(--font-mono);
}
.ed-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.09);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.ed-close-btn:hover { background: rgba(255,255,255,0.12); color: var(--text-main); }

.ed-hero {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ed-stat-card {
    flex: 1;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 14px 16px;
}
.ed-stat-val {
    font-size: 1.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-main);
    letter-spacing: -0.03em;
    line-height: 1;
}
.ed-stat-lbl {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-top: 5px;
}

.ed-rows {
    padding: 8px 20px 16px;
}
.ed-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.ed-row:last-child { border-bottom: none; }
.ed-row-key {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    flex-shrink: 0;
    padding-top: 1px;
}
.ed-row-val {
    font-size: 0.88rem;
    color: var(--text-main);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.ed-footer {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}
.ed-btn {
    flex: 1;
    padding: 13px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.15s;
}
.ed-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.ed-btn-edit {
    background: rgba(168,85,247,0.12);
    border: 1px solid rgba(168,85,247,0.22);
    color: #c084fc;
}
.ed-btn-edit:hover { background: rgba(168,85,247,0.2); }
.ed-btn-delete {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.18);
    color: #f87171;
}
.ed-btn-delete:hover { background: rgba(239,68,68,0.16); }

/* ─── Legacy compat ─── */
.filter-grid { display: none !important; }
.filter-header { display: none !important; }
.tag { padding: 3px 8px; border-radius: 6px; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; background: rgba(255,255,255,0.05); color: var(--text-muted); }
