/* Bullet Journal – eigenes Design */
:root {
    --bg: #f7f4ee;
    --paper: #fffdf7;
    --ink: #2b2b2b;
    --muted: #8a867e;
    --line: #e5ded2;
    --accent: #c9a227;
    --accent-dark: #a8871d;
    --green: #2e7d32;
    --red: #c62828;
    --blue: #1565c0;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

/* Topbar */
.topbar { background: var(--ink); color: #fff; }
.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: .8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.nav { display: flex; gap: .5rem; flex-wrap: wrap; }
.nav a { color: #e0dccf; text-decoration: none; padding: .3rem .6rem; border-radius: 4px; }
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-admin { color: var(--accent) !important; font-weight: 600; }
.user-area { display: flex; align-items: center; gap: .8rem; }
.username { color: #e0dccf; font-size: .9rem; }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap;
}
h1 { margin: 0 0 .2rem; font-size: 1.6rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; color: var(--accent-dark); }
.muted { color: var(--muted); }

/* Cards */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow);
}

/* Flash */
.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash-success { background: #e8f5e9; color: var(--green); border: 1px solid #a5d6a7; }
.flash-danger { background: #fdecea; color: var(--red); border: 1px solid #ef9a9a; }
.flash-warning { background: #fff8e1; color: #8d6e00; border: 1px solid #ffe082; }
.flash-info { background: #e3f2fd; color: var(--blue); border: 1px solid #90caf9; }

/* Buttons */
.btn {
    display: inline-block; cursor: pointer; border: 1px solid var(--line);
    background: #fff; color: var(--ink); padding: .5rem .9rem;
    border-radius: 6px; text-decoration: none; font-size: .9rem;
    line-height: 1.2;
}
.btn:hover { background: #f6f1e6; }
.btn-primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-small { padding: .3rem .6rem; font-size: .8rem; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b71c1c; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #1b5e20; }
.btn-future { background: #f0e6c8; border-color: var(--accent); }
.btn-link { background: none; border: none; color: #e0dccf; cursor: pointer; font-size: .9rem; }
.btn-link:hover { text-decoration: underline; }

/* Formulare */
.stack { display: flex; flex-direction: column; gap: .8rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
input, select {
    padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px;
    font-size: .95rem; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--accent); }
.grow { flex: 1; }
.note-form-row { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.note-form-row label { flex: 0 1 auto; }
.checkbox-label { flex-direction: row; align-items: center; gap: .4rem; }
.inline { display: inline-flex; gap: .4rem; align-items: center; }

/* Wöchentliche Übersicht (Dashboard) */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .6rem; }
.day-card {
    background: #fdfaf2; border: 1px solid var(--line); border-radius: 8px;
    padding: .6rem; text-align: center; text-decoration: none; color: var(--ink);
    display: flex; flex-direction: column; gap: .3rem;
}
.day-card:hover { border-color: var(--accent); background: #fffdf4; }
.day-name { font-weight: 600; font-size: .8rem; }
.day-date { font-size: .75rem; color: var(--muted); }
.day-stats { display: flex; flex-direction: column; gap: .2rem; margin-top: auto; }
.pill { font-size: .7rem; padding: .15rem .4rem; border-radius: 20px; }
.pill.open { background: #fff3cd; color: #8d6e00; }
.pill.done { background: #e8f5e9; color: var(--green); }
.pill.none { background: #f0ece3; color: var(--muted); }

/* Notiz-Liste */
.note-list { list-style: none; margin: 0; padding: 0; }
.note-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .5rem 0; border-bottom: 1px dashed var(--line);
}
.note-item:last-child { border-bottom: none; }
.bullet { font-weight: 700; width: 1.4rem; text-align: center; font-size: 1.05rem; }
.bullet-x { color: var(--red); }
.bullet-- { color: var(--blue); }
.note-text { flex: 1; }
.note-date { color: var(--muted); font-size: .8rem; }
.note-item.is-done .note-text { text-decoration: line-through; color: var(--muted); }

/* 3-Spalten Tabelle (Tagesansicht) */
.notes-table { display: flex; flex-direction: column; }
.notes-header, .notes-row {
    display: grid; grid-template-columns: 70px 1fr 110px 340px; gap: .6rem;
    align-items: center; padding: .5rem .2rem;
}
.notes-header { font-weight: 600; font-size: .8rem; color: var(--muted); border-bottom: 2px solid var(--line); }
.notes-row { border-bottom: 1px dashed var(--line); }
.notes-row:last-child { border-bottom: none; }
.notes-row.is-done .note-text { text-decoration: line-through; color: var(--muted); }
.priority-badge { justify-self: center; font-size: .75rem; padding: .15rem .5rem; border-radius: 20px; }
.priority-0 { background: #eceff1; color: var(--muted); }
.priority-1 { background: #fff3cd; color: #8d6e00; }
.priority-2 { background: #fdecea; color: var(--red); }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.move-date { padding: .3rem; font-size: .8rem; width: 130px; }

/* Tabellen */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }
.num { text-align: center; }
.open { color: #b26a00; font-weight: 600; }
.done { color: var(--green); font-weight: 600; }
.table-actions { display: flex; gap: .4rem; align-items: center; }

/* Statistik */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.stat-card {
    background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
    padding: 1.2rem; text-align: center; box-shadow: var(--shadow);
}
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--accent-dark); }
.stat-label { color: var(--muted); font-size: .85rem; }

/* Auth */
.auth-card {
    max-width: 380px; margin: 3rem auto; background: var(--paper);
    border: 1px solid var(--line); border-radius: 10px; padding: 2rem;
    box-shadow: var(--shadow);
}
.auth-card h1 { text-align: center; }

/* Footer */
.footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: .8rem; }

/* --- Footer Links --- */
.footer-links { margin-top: .3rem; font-size: .85rem; }
.footer-links a { color: var(--accent-dark); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-links span { margin: 0 .4rem; }

/* --- Rechtliche Seiten (Impressum/Datenschutz) --- */
.legal h1 { font-size: 1.5rem; margin-bottom: 1rem; }
.legal h2 { font-size: 1.05rem; margin-top: 1.2rem; }
.legal p, .legal li { line-height: 1.6; }
.legal ul { padding-left: 1.2rem; }
.legal a { color: var(--blue); }

/* Responsive */
@media (max-width: 720px) {
    .week-grid { grid-template-columns: repeat(2, 1fr); }
    .notes-header, .notes-row { grid-template-columns: 40px 1fr; }
    .notes-header span:nth-child(3), .notes-header span:nth-child(4),
    .notes-row .priority-badge, .notes-row .actions { grid-column: 2; }
    .stat-grid { grid-template-columns: 1fr; }
}

/* --- Monatsübersicht --- */
.page-actions { display: flex; gap: .5rem; }
.month-grid { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.month-grid-head, .month-grid-row {
    display: grid; grid-template-columns: repeat(7, 1fr);
}
.month-grid-head span {
    padding: .5rem; text-align: center; font-size: .75rem; font-weight: 600;
    color: var(--muted); background: #faf7ef; border-bottom: 1px solid var(--line);
}
.month-grid-row:not(:last-child) { border-bottom: 1px solid var(--line); }
.month-cell {
    min-height: 92px; padding: .4rem; border-right: 1px solid var(--line);
    cursor: pointer; background: var(--paper);
}
.month-cell:nth-child(7) { border-right: none; }
.month-cell.outside { background: #f6f3ec; opacity: .6; }
.month-cell.today { outline: 2px solid var(--accent); }
.month-cell:hover { background: #fffaf0; }
.month-daynum { display: inline-block; font-weight: 700; font-size: .85rem; margin-bottom: .3rem; }
.month-note {
    display: flex; align-items: center; gap: .25rem; font-size: .72rem;
    margin-bottom: .15rem; white-space: nowrap; overflow: hidden;
}
.month-note.is-done .month-note-text { text-decoration: line-through; color: var(--muted); }
.month-note-text { overflow: hidden; text-overflow: ellipsis; }
.month-more { font-size: .7rem; color: var(--muted); }

/* --- Verweise (refs) --- */
.refs { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.ref {
    display: inline-flex; align-items: center; gap: .2rem;
    background: #eef3fb; color: var(--blue); border: 1px solid #cfddf2;
    border-radius: 16px; padding: .05rem .5rem; font-size: .72rem;
    text-decoration: none;
}
.ref:hover { background: #e3ebf9; }
.ref-hint { font-size: .75rem; align-self: center; }

/* --- Wochenübersicht Mini-Einträge --- */
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.day-head h2 { margin-bottom: 0; }
.day-head-stats { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.pill.moved { background: #ede7f6; color: #6a1b9a; }
.mini-notes { margin-top: .6rem; }
.mini-note {
    display: grid; grid-template-columns: 30px 1fr 90px auto; gap: .6rem;
    align-items: center; padding: .45rem 0; border-bottom: 1px dashed var(--line);
}
.mini-note:last-child { border-bottom: none; }
.mini-note.is-done .mini-note-text { text-decoration: line-through; color: var(--muted); }
.mini-note-text { word-break: break-word; }
.mini-note .refs { margin-top: 0; }
.moved-hint { font-size: .72rem; color: #6a1b9a; }
.mini-actions { display: flex; gap: .4rem; align-items: center; }

/* --- Move-Steuerung (Tag) --- */
.move-ctrl { display: inline-flex; gap: .3rem; align-items: center; }
.move-btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Drucken / PDF --- */
@media print {
    .topbar, .footer, .no-print, .page-actions, .mini-actions,
    .move-ctrl, .actions, .flash, .nav { display: none !important; }
    body { background: #fff; color: #000; }
    .container { max-width: 100%; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    .month-cell { min-height: 70px; }
}

/* --- Report-Generator --- */
.report-form { display: flex; flex-direction: column; gap: .9rem; }
.report-block {
    display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
    padding: .6rem; background: #fdfaf2; border: 1px solid var(--line); border-radius: 8px;
}
.report-block-title {
    font-weight: 600; font-size: .8rem; color: var(--accent-dark);
    flex-basis: 100%; margin-bottom: .1rem;
}
.report-block label { flex-direction: row; align-items: center; gap: .3rem; font-size: .85rem; }
.report-block label.grow { flex: 1 1 180px; }
.report-actions { display: flex; gap: .5rem; }
.chk { display: inline-flex; }
.report-exports { display: flex; gap: .5rem; }

/* Textarea */
textarea {
    width: 100%; padding: .5rem .6rem; border: 1px solid var(--line);
    border-radius: 6px; font-size: .95rem; font-family: inherit;
}
textarea:focus { outline: 2px solid var(--accent); }
