:root {
  /* Companies24-Blau #00143F (Vorgabe 23.10.2026), Akzent weiß – keine zweite Farbe */
  --navy: #00143F; --navy-2: #0A2A66; --blue: #00143F; --bg: #F3F5F9; --card: #FFFFFF; --text: #152238; --muted: #6B7A90; --line: #E3E8F0;
  --green: #2E9E5B; --yellow: #E0A800; --red: #D64545; --grey: #9AA5B5; --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #B8C4DC; border-color: var(--blue); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--blue); background: var(--blue); color: #fff; font-weight: 600; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--blue); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.app { min-height: 100vh; display: flex; flex-direction: column; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* Kopfzeile */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; height: 56px; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; white-space: nowrap; min-width: 0; }
.brand small { font-weight: 500; opacity: .75; }
.brand .logo { height: 34px; width: 34px; filter: brightness(0) invert(1); }   /* dunkelblaues Logo auf dunkelblauer Leiste → weiß */
.topbar .user { position: relative; }
.avatar { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.avatar:hover { background: rgba(255,255,255,.12); }
.menu { position: absolute; right: 0; top: 44px; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,20,63,.18); min-width: 220px; padding: 8px; z-index: 20; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.topbar .user .menu button { width: 100%; text-align: left; background: transparent; border: none; padding: 8px 10px; border-radius: 6px; color: var(--navy); font-weight: 600; font-size: 14px; }
.topbar .user .menu button:hover { background: var(--bg); }
.avatar.bell { position: relative; margin-right: 8px; }
.badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--navy); }
.item.unread { border-left: 3px solid var(--blue); }
.item .body { font-size: 14px; color: var(--text); }
textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); resize: vertical; }
/* Ampel: Rot pulsiert langsam, Gelb blinkt dezent, Grün steht ruhig */
@keyframes c24-pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(.55); } }
@keyframes c24-blink { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(.45); } }
.light.red span:nth-child(1) { animation: c24-pulse 1.6s ease-in-out infinite; }
.light.yellow span:nth-child(2) { animation: c24-blink 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .light span { animation: none !important; } }
.flag { display: inline-block; vertical-align: -2px; line-height: 1; }
.flag img { height: 1em; width: auto; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,20,63,.15); vertical-align: -2px; }
.footer a { color: var(--muted); text-decoration: underline; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,20,63,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); padding: 20px; max-width: 720px; width: 100%; max-height: 85vh; overflow: auto; color: var(--text); }
.q { margin: 12px 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
label.radio { text-transform: none; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; margin: 6px 16px 0 0; }
label.radio input { width: auto; }
.login { padding-top: 40px; }
.login-logo { text-align: center; margin-bottom: 18px; }
.login-logo img { width: 120px; height: 120px; }
.topbar .user { font-size: 13px; opacity: .85; display: flex; gap: 12px; align-items: center; min-width: 0; }
.topbar .user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .user button { flex: 0 0 auto; }
.topbar .user button { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 13px; }

/* Layout */
.wrap { max-width: 1080px; width: 100%; margin: 0 auto; padding: 20px 16px 60px; }
.wrap.narrow { max-width: 440px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 160px; }
.row.tight > * { flex: 0 0 auto; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi .value.green { color: var(--green); } .kpi .value.red { color: var(--red); }
.error { background: #FDECEC; border: 1px solid #F3B5B5; color: var(--red); padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.notice { background: #EEF4FD; border: 1px solid #C9DBF5; color: var(--navy); padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: 13px; }
.success { background: #E8F6EE; border: 1px solid #B9E3C8; color: #1E6B3C; padding: 10px 12px; border-radius: 8px; margin: 10px 0; }

/* Ampel */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--grey); vertical-align: middle; margin-right: 6px; }
.dot.green { background: var(--green); } .dot.yellow { background: var(--yellow); } .dot.red { background: var(--red); }
/* Ampel nach Jörgs Vorlage (25.10.): dunkelgraues Gehäuse, glänzende Lampen mit Fassung, aktive Lampe leuchtet */
.light { display: inline-flex; flex-direction: column; gap: 4px; padding: 5px; background: linear-gradient(#5a5a5a, #353535); border: 1px solid #222; border-radius: 7px; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 3px rgba(0,0,0,.45); }
.light span { position: relative; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #8a8a8a 0%, #555 45%, #2c2c2c 100%); box-shadow: inset 0 0 0 1.5px #1c1c1c, inset 0 2px 3px rgba(0,0,0,.55); }
.light span::after { content: ''; position: absolute; left: 22%; top: 10%; width: 46%; height: 32%; border-radius: 50%; background: linear-gradient(rgba(255,255,255,.8), rgba(255,255,255,0)); }
.light.red span:nth-child(1) { background: radial-gradient(circle at 38% 32%, #ff9a9a 0%, #ec2a2a 50%, #9a0e0e 100%); box-shadow: inset 0 0 0 1.5px #1c1c1c, 0 0 10px 2px rgba(255,50,50,.65); }
.light.yellow span:nth-child(2) { background: radial-gradient(circle at 38% 32%, #fffbb0 0%, #f7e600 50%, #a89a00 100%); box-shadow: inset 0 0 0 1.5px #1c1c1c, 0 0 10px 2px rgba(255,230,0,.6); }
.light.green span:nth-child(3) { background: radial-gradient(circle at 38% 32%, #c4ffaa 0%, #45d845 50%, #128a12 100%); box-shadow: inset 0 0 0 1.5px #1c1c1c, 0 0 10px 2px rgba(60,220,60,.6); }
.light.lg { gap: 6px; padding: 7px; border-radius: 9px; }
.light.lg span { width: 26px; height: 26px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--navy); border-bottom-color: var(--blue); }
.tabs button .lock { font-size: 11px; opacity: .7; margin-left: 4px; }

/* Listen */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.item.clickable { cursor: pointer; } .item.clickable:hover { border-color: #BFD4F5; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 700; }
.item .sub { font-size: 13px; color: var(--muted); }
.amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount.income { color: var(--green); } .amount.expense { color: var(--text); }
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; background: #EEF2F7; color: var(--navy); font-size: 12px; font-weight: 600; }
.chip.on { background: var(--navy); color: #fff; }
.chip.green { background: #E8F6EE; color: #1E6B3C; } .chip.red { background: #FDECEC; color: var(--red); } .chip.yellow { background: #FFF6DB; color: #8A6400; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
td, th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.bar { height: 8px; background: #EEF2F7; border-radius: 4px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--blue); }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--muted); background: #FAFBFD; }
.drop.over { border-color: var(--blue); background: #EEF4FD; }
.code-input { font-size: 28px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.module-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--card); display: flex; flex-direction: column; }
.module-card > :last-child { margin-top: auto; align-self: flex-start; }
.module-card p { margin-bottom: 12px; }
.module-card h4 { margin: 0 0 4px; font-size: 16px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }
@media (max-width: 640px) {
  .wrap { padding: 12px 12px 60px; } .card { padding: 14px; } .kpi .value { font-size: 20px; }
  .topbar { padding: 0 12px; height: 52px; }
  .brand small { display: none; }
  .brand .logo { height: 30px; width: 30px; }
  .login { padding-top: 24px; } .login-logo img { width: 96px; height: 96px; }
  .row > * { flex: 1 1 100%; }                              /* Formularfelder untereinander */
  .row.tight > * { flex: 0 0 auto; }
  .row.head { flex-wrap: wrap; }
  h2 { font-size: 20px; }
  .tabs button { padding: 10px 10px; font-size: 14px; }
  .light { transform: scale(.85); transform-origin: left center; }
  table { font-size: 13px; } td, th { padding: 7px 4px; }
  .tx-table td:nth-child(3) select { max-width: 120px; }
  .module-card { padding: 14px; }
}

/* Checkbox-Zeilen (Einwilligung, Ja/Nein-Felder der Akte) */
label.check { text-transform: none; font-weight: 500; display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; }
label.check input { width: auto; margin-top: 3px; }

/* Embed-Modus (iframe auf der Website) */
html.embed, html.embed body { background: transparent; }
.login.embed { padding-top: 0; }
.login.embed .card { box-shadow: none; }
label.check.role { align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); text-transform: none; font-weight: 500; }
label.check.role input { margin-top: 4px; }

/* Verwaltung */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.card.kpi { margin: 0; padding: 14px 16px; }
.card.kpi .num { font-size: 28px; font-weight: 700; color: var(--navy); line-height: 1.2; display: flex; gap: 8px; align-items: center; }
.card.kpi .num .dot { width: 14px; height: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin: 0 0 12px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

/* Suche läuft: Spinner + Hinweis */
.searching { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 14px; }
/* C24-Zähler im Logo-Stil: offener C-Ring steht fest, innen läuft die 24 herunter; jede Zahl pulst kurz, die 0 dauerhaft (wie Ampel rot) */
.c24-timer { position: relative; width: 52px; height: 52px; flex: 0 0 auto; display: inline-block; }
.c24-timer svg { width: 100%; height: 100%; overflow: visible; display: block; }
.c24-timer .track { display: none; }
.c24-timer .arc { fill: none; stroke: var(--navy); stroke-width: 11; stroke-dasharray: 201 300; }
.c24-timer .count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 4px 0 0; font-size: 22px; font-weight: 500; color: var(--navy); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.c24-timer .count::after { content: 's'; font-size: 11px; font-weight: 400; margin-left: 1px; align-self: flex-end; padding-bottom: 5px; opacity: .8; }
.c24-timer .count.zero::after { content: ''; }
.c24-timer .count.tick { animation: c24-tick .5s ease-out; }
.c24-timer .count.zero { animation: c24-pulse 1.6s ease-in-out infinite; color: var(--red); }
@keyframes c24-tick { 0% { transform: scale(1.25); opacity: .5; } 100% { transform: scale(1); opacity: 1; } }
@keyframes c24-spin { to { transform: rotate(360deg); } }
.status-red, .status-yellow, .status-green, .status-grey { font-weight: 700; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 2px; line-height: 1.3; }
.status-red { color: #ec2a2a; }      /* = rote Lampe */
.status-yellow { color: #d9c300; }   /* = gelbe Lampe, minimal dunkler für Lesbarkeit */
.status-green { color: #2fbf2f; }    /* = grüne Lampe */
.status-grey { color: var(--muted); }

/* Textzeilen auf die drei Lampen gerastert: gleiche Höhe wie die Ampel, drei gleich hohe Zeilen, jede mittig zur Lampe */
.lamp-rows { display: grid; grid-template-rows: repeat(3, 1fr); align-items: center; min-height: 66px; align-self: stretch; }
.lamp-rows.lg { min-height: 104px; }
.lamp-rows > * { margin: 0 !important; }
.item .lamp-rows .title, .item .lamp-rows .sub { line-height: 1.25; }
