/* ============ HK Angebotsportal – Verwaltung ============ */
:root {
  --primary: #085494;
  --primary-dark: #063e6e;
  --accent: #FF7C24;
  --dark: #10314e;
  --bg: #f3efe6;
  --card: #fffdf9;
  --line: #e7ded0;
  --line-soft: #efe8db;
  --ink: #2c2a24;
  --ink-2: #675f52;
  --ink-3: #9a9082;
  --ok: #2f7a46;
  --warn: #b3551a;
  --bad: #b02a37;
  --sand: #f0e8d8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(66, 52, 30, .05), 0 6px 22px rgba(66, 52, 30, .07);
  --font: 'Manrope', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --script: 'Segoe Script', 'Bradley Hand', 'Brush Script MT', 'Snell Roundhand', cursive;
}
@font-face { font-family: 'Manrope'; src: local('Manrope'); font-weight: 200 800; font-display: swap; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.55; }
.boot { padding: 60px; text-align: center; color: var(--ink-3); }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; color: var(--dark); }
p { margin: 0; }
/* Editoriale Serifen-Titel – wirkt handgemacht, nicht generiert */
.page-head h1, .auth-card h1 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.main { padding: 28px 34px 90px; max-width: 1220px; width: 100%; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--card); border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; }
.sidebar .logo img { max-height: 46px; max-width: 200px; }
.sidebar .logo .logo-text { font-weight: 800; color: var(--dark); font-size: 15px; line-height: 1.25; }
.nav-section { font-size: 10.5px; letter-spacing: .12em; font-weight: 700; color: var(--ink-3); text-transform: uppercase; padding: 18px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; cursor: pointer; margin: 1px 0; border-left: 3px solid transparent; position: relative; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: #eef3f8; color: var(--primary); }
.nav-item.active { background: #e8f1f9; color: var(--primary); border-left-color: var(--primary); }
.nav-item .badge { position: absolute; right: 10px; background: var(--accent); color: #fff; border-radius: 99px; font-size: 10.5px; font-weight: 800; padding: 1px 7px; }

/* ---------- Bausteine ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; max-width: 640px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card .hint { color: var(--ink-3); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: 1fr 1fr; } .grid.c3 { grid-template-columns: 1fr 1fr; } }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 700; padding: 8px 15px; border-radius: 10px; cursor: pointer; transition: .12s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { filter: brightness(.94); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: #fdf0f1; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--primary); background: #eef3f8; }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label.field { display: block; margin-bottom: 13px; }
label.field span.lab, .lab { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8, 84, 148, .12); }
textarea { min-height: 110px; resize: vertical; }
input[type=color] { width: 46px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.check { display: flex; gap: 9px; align-items: flex-start; margin: 8px 0; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); }
.field-hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* ---------- Statuschips & Tags ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.chip.entwurf { background: #eceff3; color: #5a6a7e; }
.chip.versendet { background: #e4eefb; color: #1258a0; }
.chip.geoeffnet { background: #e2f4ea; color: #187a42; }
.chip.termin { background: #fdeede; color: #b3551a; }
.chip.unterlagen { background: #d9f2e2; color: #116b38; }
.chip.neutral { background: #eceff3; color: #5a6a7e; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: currentColor; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f6f9fc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Dashboard ---------- */
.stat-card { padding: 18px 20px; }
.stat-card .n { font-size: 34px; font-weight: 800; line-height: 1.1; }
.stat-card .l { font-weight: 700; color: var(--ink-2); margin-top: 2px; }
.stat-card .s { font-size: 12px; color: var(--ink-3); }
.stat-card.c-blue .n { color: var(--primary); }
.stat-card.c-green .n { color: var(--ok); }
.stat-card.c-orange .n { color: var(--warn); }
.stat-card.c-red .n { color: var(--bad); }
.year-nav { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--dark); }
.year-nav .btn { padding: 4px 9px; }
.month-strip { display: flex; gap: 4px; }
.month-strip span { flex: 1; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--ink-3); padding: 5px 0; border-radius: 7px; position: relative; }
.month-strip span.has { background: #e8f1f9; color: var(--primary); }
.month-strip span.now { outline: 2px solid var(--primary); }
.feed { display: flex; flex-direction: column; gap: 0; max-height: 420px; overflow-y: auto; }
.feed-item { display: flex; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #eef2f6; align-items: flex-start; }
.feed-item:last-child { border-bottom: none; }
.feed-item .ico { width: 32px; height: 32px; border-radius: 9px; background: #e8f1f9; color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.feed-item .ico svg { width: 16px; height: 16px; }
.feed-item .t { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.feed-item b { color: var(--dark); }

/* ---------- Angebots-Editor ---------- */
.editor-head { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: 10px 0 12px; margin: -10px 0 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.editor-head .spacer { flex: 1; }
.section-card h3 { display: flex; align-items: center; gap: 10px; font-size: 15.5px; }
.section-card h3 .num { width: 26px; height: 26px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fbfcfe; }
.doc-row .doc-ico { width: 36px; height: 36px; border-radius: 9px; background: #e8f1f9; color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.doc-row .grow { flex: 1; min-width: 0; }
.doc-row .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .sz { font-size: 12px; color: var(--ink-3); }
.doc-row input.label-inp { max-width: 220px; padding: 5px 9px; font-size: 13px; }
.upload-zone { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--ink-3); cursor: pointer; transition: .15s; font-weight: 600; }
.upload-zone svg { vertical-align: -4px; margin-right: 6px; }
/* Sicherheitsnetz: kein Icon rendert riesig, falls einmal ohne Größe eingebunden */
.main svg, .modal svg { max-width: 26px; max-height: 26px; }
.main .avatar svg, .modal .avatar svg { max-width: 40px; max-height: 40px; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--primary); color: var(--primary); background: #f2f7fc; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.thumb { border: 2px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; background: #fff; }
.thumb img, .thumb video { width: 100%; height: 92px; object-fit: cover; display: block; background: #eef2f6; }
.thumb .cap { padding: 6px 9px; font-size: 12px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb.sel { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8, 84, 148, .18); }
.thumb .del { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,.92); border: none; border-radius: 8px; width: 26px; height: 26px; cursor: pointer; color: var(--bad); display: none; align-items: center; justify-content: center; }
.thumb:hover .del { display: flex; }
.thumb .audio-ico { height: 92px; display: flex; align-items: center; justify-content: center; background: #e8f1f9; color: var(--primary); }

/* Recorder */
.recorder { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fbfcfe; }
.recorder .rec-live { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--bad); }
.rec-dot { width: 12px; height: 12px; border-radius: 99px; background: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.recorder video, .recorder audio { width: 100%; max-height: 300px; border-radius: 10px; margin-top: 10px; background: #000; }
.recorder audio { background: transparent; }

/* ---------- Statistik ---------- */
.kpi { padding: 16px 18px; }
.kpi .n { font-size: 26px; font-weight: 800; color: var(--dark); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.chart-days { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 8px; }
.chart-days .bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.chart-days .bar { background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; transition: .15s; position: relative; }
.chart-days .bar.zero { background: #dde5ee; }
.chart-days .bar-col:hover .bar { background: var(--primary-dark); }
.chart-days .bar-col:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 7px; white-space: nowrap; z-index: 5; }
.chart-x { display: flex; gap: 3px; margin-top: 6px; border-top: 1px solid var(--line); padding-top: 5px; }
.chart-x span { flex: 1; text-align: center; font-size: 10.5px; color: var(--ink-3); overflow: visible; white-space: nowrap; }
.hbar-row { display: grid; grid-template-columns: 190px 1fr 74px; gap: 10px; align-items: center; padding: 7px 0; }
.hbar-row .hl { font-weight: 600; color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .track { background: #edf1f6; border-radius: 6px; height: 14px; overflow: hidden; }
.hbar-row .fill { height: 100%; background: var(--primary); border-radius: 6px 6px 6px 6px; min-width: 2px; }
.hbar-row .hv { font-size: 12.5px; font-weight: 700; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary) 0%, var(--dark) 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 18px; padding: 38px 36px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.auth-card .logo { text-align: center; margin-bottom: 18px; }
.auth-card .logo img { max-height: 60px; max-width: 260px; }
.auth-card h1 { font-size: 20px; text-align: center; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--ink-2); margin-bottom: 22px; font-size: 13.5px; }
.auth-err { background: #fbe4e6; color: var(--bad); border-radius: 9px; padding: 9px 13px; font-weight: 600; font-size: 13px; margin-bottom: 12px; display: none; }

/* ---------- Modal & Toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 25, 45, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 620px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); }
.modal .x { border: none; background: #eef2f6; width: 30px; height: 30px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-size: 16px; font-weight: 700; }
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--dark); color: #fff; padding: 11px 17px; border-radius: 11px; font-weight: 600; box-shadow: var(--shadow); animation: toast-in .2s; max-width: 380px; }
.toast.err { background: var(--bad); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Sonstiges ---------- */
.empty { text-align: center; color: var(--ink-3); padding: 34px 10px; font-weight: 600; }
.pill-note { background: #fbf1e2; border: 1px solid #ecd9bd; color: #8a5a22; border-radius: 11px; padding: 11px 15px; font-size: 13px; font-weight: 600; margin-bottom: 14px; display: flex; gap: 9px; align-items: flex-start; }
.info-note { background: #eef4f2; border: 1px solid #d5e3dd; color: #2b5c52; border-radius: 11px; padding: 11px 15px; font-size: 13px; font-weight: 600; margin-bottom: 14px; display: flex; gap: 9px; align-items: flex-start; }
.pill-note svg, .info-note svg { flex: none; width: 17px; height: 17px; margin-top: 1px; }
.info-note a { color: inherit; text-decoration: underline; }
.stars { color: #f5a623; letter-spacing: 2px; font-size: 15px; }
.avatar { width: 44px; height: 44px; border-radius: 99px; background: var(--primary); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.faq-item { border: 1px solid var(--line); border-radius: 11px; padding: 12px 15px; margin-bottom: 9px; background: #fbfcfe; }
.mini { font-size: 12px; color: var(--ink-3); }
.linkbox { display: flex; gap: 8px; align-items: center; background: #f2f6fa; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; overflow: hidden; }
.linkbox code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; color: var(--primary); font-weight: 600; }
.sep { height: 1px; background: var(--line); margin: 16px 0; border: none; }
.tag-select { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-select .tag { padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.tag-select .tag.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Ordner-Navigation in der Medienbibliothek */
.ordner-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: 13.5px; position: relative; }
.ordner-item:hover { background: #eef3f8; color: var(--primary); }
.ordner-item.on { background: #e8f1f9; color: var(--primary); }
.ordner-item svg { flex: none; opacity: .8; }
.ordner-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ordner-item b { font-size: 11.5px; color: var(--ink-3); background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
.ordner-item.on b { border-color: var(--primary); color: var(--primary); }
.ordner-item .o-menu { display: none; position: absolute; right: 4px; border: none; background: #fff; border-radius: 6px; width: 22px; height: 22px; cursor: pointer; color: var(--ink-2); font-weight: 800; }
.ordner-item:hover .o-menu { display: block; }
.thumb-move { width: calc(100% - 16px); margin: 0 8px 8px; font-size: 11.5px; padding: 3px 6px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
@media (max-width: 900px) { .main .grid[style*="250px"] { grid-template-columns: 1fr !important; } }

/* Versicherer-Suche im Angebots-Editor */
.v-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); z-index: 40; max-height: 260px; overflow-y: auto; }
.v-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 13px; cursor: pointer; font-weight: 600; border-bottom: 1px solid #f1f4f8; }
.v-item:last-child { border-bottom: none; }
.v-item:hover { background: #eef3f8; color: var(--primary); }
.v-item .mini { font-weight: 500; }
