/* =========================================================
   Aktenschrank – Stylesheet
   ========================================================= */

:root {
    --blau:        #2563eb;
    --blau-dunkel: #1d4ed8;
    --blau-hell:   #eff6ff;
    --tinte:       #1e293b;
    --grau:        #64748b;
    --grau-hell:   #94a3b8;
    --linie:       #e2e8f0;
    --hintergrund: #f1f5f9;
    --weiss:       #ffffff;
    --rot:         #dc2626;
    --rot-hell:    #fef2f2;
    --radius:      12px;
    --schatten:    0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--tinte);
    background: var(--hintergrund);
}

a { color: var(--blau); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 0; }

.versteckt { display: none !important; }
.dezent { color: var(--grau); font-size: .9em; }
.rechts { text-align: right; }
.hinweis { color: var(--grau); }

/* ------------------------------------------------------ Kopfzeile ----- */

.topbar {
    background: var(--weiss);
    border-bottom: 1px solid var(--linie);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.marke {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--tinte);
}
.marke:hover { text-decoration: none; color: var(--blau); }

/* ------------------------------------------------------ Grundlayout --- */

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}
.container-schmal { max-width: 640px; }

.seitenkopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.seitenkopf-aktionen { display: flex; gap: 8px; flex-wrap: wrap; }

.karte {
    background: var(--weiss);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
}

.brotkrumen { margin: 0 0 12px; font-size: .9rem; }

/* ------------------------------------------------------ Buttons ------- */

.btn {
    display: inline-block;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.3;
    transition: background .12s, border-color .12s;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--blau); color: #fff; }
.btn-primary:hover { background: var(--blau-dunkel); }

.btn-leise {
    background: var(--weiss);
    border-color: var(--linie);
    color: var(--tinte);
}
.btn-leise:hover { border-color: var(--grau-hell); background: #f8fafc; }

.btn-breit { width: 100%; }

.link-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: .85rem;
    color: var(--grau);
    cursor: pointer;
}
.link-btn:hover { color: var(--blau); text-decoration: underline; }
.link-rot:hover { color: var(--rot); }

/* ------------------------------------------------------ Formulare ----- */

label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: var(--tinte);
    margin-bottom: 12px;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
input[type="password"],
textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 9px 11px;
    font: inherit;
    font-weight: 400;
    color: var(--tinte);
    background: var(--weiss);
    border: 1px solid var(--linie);
    border-radius: 8px;
}
input:focus, textarea:focus {
    outline: 2px solid var(--blau);
    outline-offset: -1px;
    border-color: var(--blau);
}
textarea { resize: vertical; }

.feld-zeile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ------------------------------------------------------ Suche/Chips --- */

.suchzeile { margin-bottom: 12px; }
.suchzeile input { max-width: 380px; }

.chip {
    display: inline-block;
    padding: 2px 10px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--blau);
    background: var(--blau-hell);
    border-radius: 999px;
    white-space: nowrap;
}
.chip-grau { color: var(--grau); background: #f1f5f9; border: 1px solid var(--linie); }

.chip-filter {
    border: 1px solid var(--linie);
    background: var(--weiss);
    color: var(--grau);
    cursor: pointer;
    padding: 5px 12px;
    font-size: .85rem;
}
.chip-filter:hover { border-color: var(--grau-hell); }
.chip-filter.aktiv {
    background: var(--blau);
    border-color: var(--blau);
    color: #fff;
}

.filterbereich {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0 12px;
}
.filterbereich input[type="search"] { max-width: 420px; margin: 0; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------ Tabelle ------- */

.tabelle-karte { overflow: hidden; }

.tabelle {
    width: 100%;
    border-collapse: collapse;
}
.tabelle th {
    text-align: left;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--grau);
    padding: 12px 16px;
    border-bottom: 1px solid var(--linie);
    background: #f8fafc;
}
.tabelle th.rechts { text-align: right; }
.tabelle td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--linie);
    vertical-align: middle;
}
.tabelle tbody tr:last-child td { border-bottom: none; }

tr.klickbar { cursor: pointer; }
tr.klickbar:hover { background: var(--blau-hell); }
.pfeil { color: var(--grau-hell); font-size: 1.2rem; }

.leer-hinweis { padding: 20px; margin: 0; color: var(--grau); text-align: center; }

.leer-karte {
    padding: 40px 24px;
    text-align: center;
}
.leer-karte p { margin: 0 0 10px; }
.leer-karte .btn { margin-top: 8px; }

/* ------------------------------------------------------ Akte-Kopf ----- */

.akte-kopf {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.akte-kopf-text p { margin: 6px 0 0; }
.akte-kopf-aktionen { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.akte-notizen {
    margin-top: 10px !important;
    padding: 10px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: .9rem;
    max-width: 560px;
}

/* ------------------------------------------------------ Erfassen ------ */

.erfassen-raster {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
}

.dropzone {
    border: 2px dashed var(--grau-hell);
    background: var(--weiss);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 16px;
    cursor: pointer;
    transition: border-color .12s, background .12s;
    min-height: 150px;
}
.dropzone:hover, .dropzone:focus-visible {
    border-color: var(--blau);
    background: var(--blau-hell);
    outline: none;
}
.dropzone.laedt { border-color: var(--blau); background: var(--blau-hell); }
.dropzone-inhalt { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.dropzone-symbol { font-size: 1.8rem; }
.dropzone-status { margin-top: 10px; font-weight: 600; color: var(--blau); }

.kommentar-karte { padding: 16px; }
.kommentar-karte textarea { margin-top: 0; }
.kommentar-fuss {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 10px;
}
.kommentar-fuss input[type="datetime-local"] {
    width: auto;
    margin: 0;
    font-size: .88rem;
    color: var(--grau);
}

/* ------------------------------------------------------ Chronik ------- */

.chronik { margin-top: 8px; }

.tag-titel {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--grau);
    margin: 24px 0 8px;
    padding-left: 2px;
}

.eintrag {
    display: flex;
    gap: 12px;
    background: var(--weiss);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 14px 16px;
    margin-bottom: 8px;
}
.eintrag-symbol {
    font-size: 1.35rem;
    line-height: 1.3;
    flex: 0 0 auto;
}
.eintrag-inhalt { flex: 1 1 auto; min-width: 0; }

.eintrag-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 2px;
}
.eintrag-zeit { font-size: .8rem; color: var(--grau); font-weight: 600; }
.eintrag-aktionen { display: flex; gap: 12px; opacity: 0; transition: opacity .12s; }
.eintrag:hover .eintrag-aktionen,
.eintrag:focus-within .eintrag-aktionen { opacity: 1; }

.eintrag-text {
    margin: 2px 0 0;
    white-space: pre-line;
    overflow-wrap: break-word;
}

.eintrag-datei {
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
}
.datei-link { font-weight: 600; overflow-wrap: anywhere; }

/* ------------------------------------------------------ Drop-Overlay -- */

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(37, 99, 235, .12);
    backdrop-filter: blur(1px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.drop-overlay-box {
    background: var(--weiss);
    border: 2px dashed var(--blau);
    border-radius: var(--radius);
    padding: 28px 44px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--blau);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .15);
}

/* ------------------------------------------------------ Dialoge ------- */

.dialog {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
    padding: 0;
    width: min(520px, calc(100vw - 32px));
}
.dialog::backdrop { background: rgba(15, 23, 42, .4); }

.dialog-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--linie);
    margin: 0;
}
.dialog-schliessen {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--grau);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}
.dialog-schliessen:hover { background: var(--hintergrund); color: var(--tinte); }

.dialog-inhalt { padding: 18px 20px; }

.dialog-fuss {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

/* ------------------------------------------------------ Meldungen ----- */

.alert {
    background: var(--rot-hell);
    border: 1px solid #fecaca;
    color: var(--rot);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: .9rem;
}
.erfolg {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: .9rem;
}

/* ------------------------------------------------------ Konto --------- */

.formular-karte { padding: 20px 24px; }
.trenner { border: none; border-top: 1px solid var(--linie); margin: 18px 0 12px; }
.klein { font-size: .85rem; margin-top: 14px; }
.klein code { background: #e2e8f0; padding: 1px 5px; border-radius: 4px; font-size: .85em; }

/* ------------------------------------------------------ Login --------- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    background: var(--weiss);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 36px 32px;
    width: min(380px, 100%);
    text-align: center;
}
.login-logo { font-size: 2.4rem; margin-bottom: 4px; }
.login-card h1 { margin-bottom: 4px; }
.login-card .hinweis { margin: 0 0 20px; }
.login-card form { text-align: left; }
.login-card .btn { margin-top: 6px; }

/* ------------------------------------------------------ Mobil --------- */

@media (max-width: 640px) {
    .erfassen-raster { grid-template-columns: 1fr; }
    .feld-zeile { grid-template-columns: 1fr; gap: 0; }
    .tabelle th:nth-child(4), .tabelle td:nth-child(4) { display: none; }
    .filterbereich input[type="search"] { max-width: none; }
    .eintrag-aktionen { opacity: 1; }
}
