/* FoxCo - One – Basis-Stylesheet (hell/dunkel, responsiv) */
:root {
    --bg: #f5f6f8; --surface: #fff; --surface-2: #f0f2f5; --border: #e1e4e8;
    --text: #1d2330; --muted: #6b7280; --primary: #d4541c; --primary-text: #fff;
    --pos: #15803d; --neg: #c2410c; --warn: #b45309; --danger: #b91c1c;
    --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b; --surface: #1b1f27; --surface-2: #232834; --border: #2e3442;
        --text: #e6e8ec; --muted: #9aa3b2; --primary: #e8703a;
        --pos: #4ade80; --neg: #fb923c; --warn: #fbbf24; --danger: #f87171;
        --shadow: 0 1px 2px rgba(0,0,0,.4);
    }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: .5rem 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; height: 56px; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.user-chip { color: var(--text); }
.user-chip small { color: var(--muted); margin-left: .25rem; }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--text); cursor: pointer; }
.shell { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 230px; flex-shrink: 0; padding: 1rem .5rem; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar a { display: block; padding: .5rem .75rem; border-radius: 8px; color: var(--text); }
.sidebar a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar a.active { background: var(--primary); color: var(--primary-text); }
.nav-label { margin: 1rem .75rem .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.content { flex: 1; min-width: 0; padding: 1.5rem; }
.content.narrow { max-width: 640px; margin: 3rem auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-title { margin: 1.5rem 0 .75rem; }

/* Grid */
.grid { display: grid; gap: 1rem; }
.cards2 { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.cards3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.stats4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1rem; }
.main-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem 1rem; align-items: end; }
.span2 { grid-column: span 2; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; color: var(--text); }
a.card:hover { text-decoration: none; border-color: var(--primary); }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.card-head h2 { margin: 0 0 .5rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.stat span { display: block; color: var(--muted); font-size: .85rem; }
.stat strong { font-size: 1.35rem; }
.big-number { font-size: 1.6rem; font-weight: 700; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.hidden { display: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.btn.block { display: flex; width: 100%; justify-content: center; }
.btn-group, .btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-row { margin: .5rem 0; }
form.inline { display: inline; }

/* Formulare */
.form label, label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
.form label { margin-bottom: .6rem; }
label.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .45rem .6rem; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled { opacity: .75; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; padding: 0 .4rem; }
.help { color: var(--muted); font-size: .8rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .35rem 0; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 140px; }
.inline-form-row { display: flex; gap: .25rem; align-items: center; }
.w-sm { max-width: 80px; flex: 0 0 80px !important; }
.w-md { max-width: 130px; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; }
.filters.inline { margin: 0; }
.chip { display: inline-block; padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .85rem; }
.chip.active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.sep { width: 1px; height: 20px; background: var(--border); }
.code-input { font-size: 1.5rem; letter-spacing: .4em; text-align: center; }
.secret { display: inline-block; margin: .3rem 0; padding: .3rem .5rem; background: var(--surface-2); border-radius: 6px; font-size: 1rem; letter-spacing: .1em; }
.perm-grid { display: grid; grid-template-columns: 1fr; gap: .25rem; margin: .5rem 0 1rem; }
.perm-grid code { color: var(--muted); margin-left: auto; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table.compact th, .table.compact td { padding: .3rem .4rem; }
.table tfoot th { text-transform: none; font-size: .95rem; color: var(--text); }
tr.inactive, .inactive { opacity: .55; }
.right { text-align: right !important; }
.nowrap { white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn-text { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; word-break: break-word; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }

/* Badges & Meldungen */
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 500; vertical-align: middle; }
.badge.ok { background: rgba(21,128,61,.15); color: var(--pos); }
.badge.warn { background: rgba(180,83,9,.15); color: var(--warn); }
.badge.danger { background: rgba(185,28,28,.15); color: var(--danger); }
.badge.lvl-owner { background: var(--primary); color: var(--primary-text); }
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.success { background: rgba(21,128,61,.1); border-color: rgba(21,128,61,.4); }
.flash.error { background: rgba(185,28,28,.1); border-color: rgba(185,28,28,.4); }
.flash.warning { background: rgba(180,83,9,.1); border-color: rgba(180,83,9,.4); }
.flash.info { background: rgba(47,111,222,.1); border-color: rgba(47,111,222,.4); }
.pager { display: flex; gap: .25rem; flex-wrap: wrap; margin: 1rem 0; }
.pager a, .pager span { padding: .2rem .6rem; border: 1px solid var(--border); border-radius: 6px; }
.pager .current { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a { padding: .55rem .85rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.danger-zone { border-color: var(--danger); }
.danger-zone summary { cursor: pointer; color: var(--danger); }
.muted-details summary { cursor: pointer; color: var(--muted); margin-top: 1rem; }

/* Haustiere */
.pet-card { display: flex; gap: 1rem; }
.pet-card h2 { margin: 0; }
.pet-card p { margin: .25rem 0; }
.pet-avatar { flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: var(--primary-text); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.3rem; }
.pet-avatar.big { width: 64px; height: 64px; font-size: 1.8rem; }
.pet-title { display: flex; gap: 1rem; align-items: center; }
.pet-title p { margin: .2rem 0 0; }
.stars { color: #f59e0b; }

/* Balken, Mini-Diagramme */
.bar-row { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: .5rem; align-items: center; font-size: .85rem; margin: .3rem 0; }
.bar { display: block; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--neg); border-radius: 4px; }
.bar.bar-pos > span { background: var(--pos); }
.budget-note { margin: -.2rem 0 .4rem; text-align: right; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 70px; padding: .25rem 0; }
.spark span { flex: 1; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .8; }
.month-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: .4rem; height: 200px; align-items: end; }
.mc-col { display: flex; flex-direction: column; height: 100%; }
.mc-bars { flex: 1; display: flex; align-items: flex-end; gap: 2px; justify-content: center; }
.mc-bars span { width: 40%; border-radius: 3px 3px 0 0; }
.mc-in, .pos-bg { background: var(--pos); }
.mc-out, .neg-bg { background: var(--neg); }
.mc-label { text-align: center; font-size: .75rem; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 .2rem 0 .6rem; vertical-align: middle; }

/* Historie */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 1rem .75rem; }
.timeline li::before { content: ""; position: absolute; left: -1.42rem; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.tl-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .9rem; }
.changes { font-size: .82rem; margin-top: .3rem; border-collapse: collapse; }
.changes th { text-align: left; color: var(--muted); font-weight: 500; padding: .1rem .6rem .1rem 0; vertical-align: top; }
.changes td { padding: .1rem .3rem; word-break: break-word; }
.changes .old { text-decoration: line-through; color: var(--muted); }
.changes .new { color: var(--pos); }

/* Kalender */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-head { background: var(--surface-2); padding: .4rem; text-align: center; font-weight: 600; font-size: .85rem; }
.cal-day { background: var(--surface); min-height: 110px; padding: .3rem; }
.cal-day.empty { background: var(--surface-2); }
.cal-day.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-num { font-size: .8rem; color: var(--muted); }
.cal-ev { display: block; font-size: .75rem; padding: .1rem .3rem; margin: .15rem 0; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.legend .cal-ev { display: inline-block; }
.ev-appt { background: rgba(47,111,222,.18); }
.ev-tour { background: rgba(245,158,11,.22); }
.ev-warn { background: rgba(194,65,12,.2); }
.ev-card { background: rgba(21,128,61,.18); }
.ev-muted { background: var(--surface-2); text-decoration: line-through; }

/* Kanban */
.kanban { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kb-col { flex: 0 0 290px; background: var(--surface-2); border-radius: var(--radius); padding: .6rem; display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.kb-col.done .kb-col-head { color: var(--pos); }
.kb-col-head { display: flex; justify-content: space-between; font-weight: 600; padding: .2rem .3rem .6rem; }
.kb-col-head.over { color: var(--neg); }
.kb-count { font-weight: 400; color: var(--muted); font-size: .85rem; }
.kb-col-head.over .kb-count { color: var(--neg); font-weight: 700; }
.kb-cards { flex: 1; overflow-y: auto; min-height: 40px; display: flex; flex-direction: column; gap: .5rem; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 8px; padding: .55rem .65rem; cursor: grab; box-shadow: var(--shadow); }
.kb-card.dragging { opacity: .4; }
.kb-title { display: block; color: var(--text); font-weight: 500; }
.kb-meta { display: flex; flex-wrap: wrap; gap: .25rem; margin: .3rem 0; }
.kb-foot { display: flex; gap: .6rem; align-items: center; font-size: .8rem; }
.kb-foot .avatar { margin-left: auto; }
.kb-add { margin-top: .5rem; }
.kb-add input { background: transparent; border-style: dashed; }
.label { font-size: .72rem; padding: .05rem .45rem; border-radius: 4px; background: rgba(47,111,222,.15); color: var(--text); }
.label.pet { background: rgba(245,158,11,.2); }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--primary-text); display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; }
.prio-border-low { border-left-color: #94a3b8; }
.prio-border-normal { border-left-color: var(--primary); }
.prio-border-high { border-left-color: #f59e0b; }
.prio-border-urgent { border-left-color: var(--danger); }
.prio { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; background: var(--primary); }
.prio-high { background: #f59e0b; } .prio-urgent { background: var(--danger); } .prio-low { background: #94a3b8; }
.comment { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.comment-head { margin-bottom: .2rem; }

/* Anmeldung & Installer */
.auth-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 720px; }
.auth-card h1 { margin-bottom: 1rem; }
.auth-brand { font-weight: 700; font-size: 1.2rem; margin-bottom: 1.5rem; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin: 1.2rem 0; font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.checklist { list-style: none; padding: 0; }
.checklist .ok { color: var(--pos); }
.checklist .fail { color: var(--danger); }
.checklist .warn { color: var(--warn); }
.brand-icon { font-size: 1.2em; }
.steps { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.25rem; }
.steps li { flex: 1; padding: .45rem .7rem; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: .9rem; }
.steps li.active { background: var(--primary); color: var(--primary-text); }
.steps li.done { color: var(--pos); }
details.card > summary { cursor: pointer; }

/* Mobil */
@media (max-width: 900px) {
    .nav-toggle { display: block; }
    .sidebar { position: fixed; top: 56px; bottom: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
    .sidebar.open { transform: none; }
    .content { padding: 1rem; }
    .main-side, .grid2, .grid3 { grid-template-columns: 1fr; }
    .span2 { grid-column: auto; }
    .cards2, .cards3 { grid-template-columns: 1fr; }
    .user-chip small { display: none; }
    .cal-day { min-height: 70px; }
    .cal-ev { font-size: .65rem; }
}
@media print {
    .topbar, .sidebar, .btn, .filters, .tabs { display: none !important; }
    .card { box-shadow: none; break-inside: avoid; }
}
