/* Alarmbeteiligung: Ergänzungen zum Design der Gefahrgut-App (style.css) */

/* ---------- Startseite (ohne Anmeldung) ---------- */
.landing-box { width: 520px; max-width: 94vw; }
.landing-box h1 { margin-bottom: 0; }
.landing-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.up-card { margin-top: 14px; padding: 16px; border: 2px dashed #c9ced6; border-radius: 12px; background: #f8fafb; }
.up-card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.up-buttons { display: grid; gap: 10px; margin: 12px 0; }
.btn.big { display: block; text-align: center; padding: 16px 14px; font-size: 1.08rem; border-radius: 12px; cursor: pointer; }
.up-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.up-thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: #e5e7eb; border: 1px solid #cfd4da; }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-thumb .up-ph { display: grid; place-items: center; height: 100%; font-size: 2rem; }
.up-thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; }
.up-note { display: grid; gap: 4px; margin: 8px 0; text-align: left; font-size: .9rem; }
.up-bar { height: 8px; background: #e5e7eb; border-radius: 4px; margin: 10px 0 4px; overflow: hidden; }
.up-bar div { height: 8px; width: 0; background: #b3141b; transition: width .2s; }
.up-ok { color: #1a7f37; font-weight: 600; font-size: 1rem; }
.up-err { color: #b3141b; font-weight: 600; }

/* ---------- Alarmbeteiligung (Tabelle wie in der Excel-Liste) ---------- */
.stat-tiles { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 12px; }
.stat { background: #fff; border: 1px solid #e3e6ea; border-left: 4px solid #b3141b; border-radius: 10px; padding: 10px 16px; display: grid; min-width: 130px; }
.stat .n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat .l { font-size: .8rem; color: #6b7280; }
.mx-wrap { overflow: auto; max-height: 76vh; border: 1px solid #d6dae0; border-radius: 10px; background: #fff; }
table.mx { border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.mx th, table.mx td { border-right: 1px solid #e6e8ec; border-bottom: 1px solid #e6e8ec; padding: 0 4px; text-align: center; white-space: nowrap; height: 27px; min-width: 38px; background: #fff; }
table.mx thead th { position: sticky; background: #fbe4e5; z-index: 2; font-weight: 600; color: #4a0f12; }
table.mx thead tr:nth-child(1) th { top: 0; height: 28px; background: #b3141b; color: #fff; }
table.mx thead tr:nth-child(2) th { top: 28px; height: 28px; background: #f4c3c6; }
table.mx thead tr:nth-child(3) th { top: 56px; height: 78px; padding: 4px 0; font-weight: 600; }
table.mx thead tr:nth-child(4) th { top: 134px; height: 28px; }
table.mx thead tr:nth-child(5) th { top: 162px; height: 28px; background: #f4c3c6; }
.mx-k span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; max-height: 72px; overflow: hidden; font-size: 10.5px; letter-spacing: 0; }
.mx-h a { color: inherit; text-decoration: underline dotted; }
.mx-month { font-size: 13px; letter-spacing: .02em; }
table.mx .c1, table.mx .c2, table.mx .c3, table.mx .c4 { position: sticky; z-index: 3; background: #fff; text-align: left; }
table.mx thead .c1, table.mx thead .c3, table.mx thead .c4 { z-index: 5; background: #8f0f15; color: #fff; text-align: center; top: 0; }
table.mx .c1 { left: 0; min-width: 120px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
table.mx .c2 { left: 120px; min-width: 100px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
table.mx .c3 { left: 220px; min-width: 44px; text-align: center; font-weight: 700; }
table.mx .c4 { left: 264px; min-width: 66px; text-align: center; border-right: 2px solid #b3141b; }
table.mx td.on { background: #f8d4d6; color: #b3141b; font-weight: 700; }
/* dicker Strich vor jedem neuen Monat */
table.mx th.mstart, table.mx td.mstart { border-left: 3px solid #b3141b; }
table.mx tbody tr:hover th, table.mx tbody tr:hover td:not(.on) { background: #fff1cf; }
table.mx tbody tr.left th, table.mx tbody tr.left td { color: #8b9096; }
.left-tag { font-size: .72rem; background: #eceef1; border-radius: 6px; padding: 1px 5px; color: #555; }

/* ---------- Einsatz erfassen ---------- */
.inc-edit { display: grid; gap: 16px; align-items: start; }
.inc-edit.with-img { grid-template-columns: minmax(280px, 420px) 1fr; }
@media (max-width: 900px) { .inc-edit.with-img { grid-template-columns: 1fr; } }
.zettel { position: sticky; top: 8px; max-height: calc(100vh - 80px); overflow: auto; background: #fff; border: 1px solid #e3e6ea; border-radius: 10px; padding: 12px; }
@media (max-width: 900px) { .zettel { position: static; max-height: none; } }
.zimg { margin: 0 0 12px; }
.zimg img { width: 100%; height: auto; display: block; border: 1px solid #cfd4da; border-radius: 6px; cursor: zoom-in; transition: transform .2s; }
.zimg img.turned { max-width: 70%; margin: 40px auto; }
.zimg figcaption { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.zoom-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); z-index: 100; display: grid; place-items: center; }
.zoom-bg[hidden] { display: none; }
.zoom-bg img { max-width: 96vw; max-height: 88vh; transition: transform .2s; }
.zoom-bar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.date-pick { display: grid; grid-template-columns: 80px minmax(120px, 1fr) 100px minmax(110px, 1fr); gap: 10px; margin-top: 4px; }
@media (max-width: 560px) { .date-pick { grid-template-columns: 1fr 1fr; } }
.date-pick label { display: grid; gap: 4px; }
.kw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.chip { display: inline-block; border: 1px solid #b3141b; color: #b3141b; background: #fff; border-radius: 14px; padding: 1px 10px; font-size: .85rem; font-weight: 600; }
button.chip { cursor: pointer; }
button.chip:hover { background: #b3141b; color: #fff; }
.chip .x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; padding: 0 0 0 4px; }
.role-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.count-badge { display: inline-block; min-width: 28px; text-align: center; background: #b3141b; color: #fff; border-radius: 14px; padding: 0 9px; font-size: .95rem; vertical-align: middle; }
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.p-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid #d6dae0; border-radius: 8px; background: #fff; cursor: pointer; user-select: none; }
.p-item[hidden] { display: none; }
.p-item input { width: 20px; height: 20px; flex: none; accent-color: #b3141b; }
.p-item span { display: grid; line-height: 1.15; }
.p-item small { color: #6b7280; }
.p-item:has(input:checked) { background: #d9f0d9; border-color: #3a9a4a; font-weight: 600; }
.p-item.is-left { opacity: .75; }
.sticky-actions { position: sticky; bottom: 0; background: #fff; padding: 10px 0; border-top: 1px solid #e3e6ea; margin-top: 14px; }

/* ---------- Eingang ---------- */
.inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.inbox-card.done { opacity: .7; }
.inbox-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-bottom: 8px; }
.inbox-thumbs img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; border: 1px solid #cfd4da; }
.inbox-meta { margin-bottom: 8px; }
.is-left { color: #8b9096; }
.perm-table td, .perm-table th { vertical-align: middle; }

/* ---------- Dunkelmodus ---------- */
html[data-theme="dark"] .up-card { background: #1b1f25; border-color: #3a414b; }
html[data-theme="dark"] .up-thumb { background: #262b33; border-color: #3a414b; }
html[data-theme="dark"] .stat, html[data-theme="dark"] .mx-wrap, html[data-theme="dark"] .zettel, html[data-theme="dark"] .p-item { background: #1b1f25; border-color: #333a44; }
html[data-theme="dark"] table.mx th, html[data-theme="dark"] table.mx td { background: #1b1f25; border-color: #2e343d; }
html[data-theme="dark"] table.mx thead th { background: #3a1517; color: #f3d6d8; }
html[data-theme="dark"] table.mx thead tr:nth-child(1) th, html[data-theme="dark"] .mx-month { background: #b3141b !important; color: #fff; }
html[data-theme="dark"] table.mx thead tr:nth-child(2) th, html[data-theme="dark"] table.mx thead tr:nth-child(5) th { background: #4a1a1d; }
html[data-theme="dark"] table.mx thead .c1, html[data-theme="dark"] table.mx thead .c3, html[data-theme="dark"] table.mx thead .c4 { background: #8f0f15; color: #fff; }
html[data-theme="dark"] table.mx td.on { background: #5a1c20; color: #ffb3b8; }
html[data-theme="dark"] table.mx tbody tr:hover th, html[data-theme="dark"] table.mx tbody tr:hover td:not(.on) { background: #3a3317; }
html[data-theme="dark"] .p-item:has(input:checked) { background: #1f4d2b; border-color: #3a9a4a; }
html[data-theme="dark"] .sticky-actions { background: #14171b; border-color: #333a44; }
html[data-theme="dark"] .chip { background: transparent; }
html[data-theme="dark"] .left-tag { background: #2a2f37; color: #aab; }

/* ---------- Druck ---------- */
@media print {
  .topbar, .sidebar, .no-print, .nav-backdrop, .theme-float { display: none !important; }
  .content { padding: 0 !important; }
  .mx-wrap { max-height: none; overflow: visible; border: 0; }
  table.mx { font-size: 8px; }
  table.mx th, table.mx td { height: auto; min-width: 0; padding: 0 2px; }
  table.mx thead th, table.mx .c1, table.mx .c2, table.mx .c3, table.mx .c4 { position: static; }
  table.mx thead th { background: #fbe4e5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.mx td.on { background: #f8d4d6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.mx th.mstart, table.mx td.mstart { border-left: 2px solid #b3141b; }
}

/* Farbmarkierung der Beteiligung je Person */
table.mx td.c3.g-best, table.mx td.c4.g-best, .lg.g-best { background: #cdeccf; color: #14532d; font-weight: 700; }
table.mx td.c3.g-mid, table.mx td.c4.g-mid, .lg.g-mid { background: #ffe0b3; color: #8a4b00; }
table.mx td.c3.g-low, table.mx td.c4.g-low, .lg.g-low { background: #f6a6ab; color: #7a0b10; font-weight: 700; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
.lg { padding: 1px 10px; border-radius: 10px; font-size: .8rem; }
html[data-theme="dark"] table.mx td.c3.g-best, html[data-theme="dark"] table.mx td.c4.g-best, html[data-theme="dark"] .lg.g-best { background: #1f5a2c; color: #d4f5dc; }
html[data-theme="dark"] table.mx td.c3.g-mid, html[data-theme="dark"] table.mx td.c4.g-mid, html[data-theme="dark"] .lg.g-mid { background: #6a4410; color: #ffe2b0; }
html[data-theme="dark"] table.mx td.c3.g-low, html[data-theme="dark"] table.mx td.c4.g-low, html[data-theme="dark"] .lg.g-low { background: #8f1d24; color: #ffd6d8; }
@media print { table.mx td.g-best, .lg { -webkit-print-color-adjust: exact; print-color-adjust: exact; } table.mx td.g-mid, table.mx td.g-low { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* Alarm während eines Termins: ganze Spalte orange */
table.mx thead tr th.ev { background: #ffd9a8 !important; color: #5a2d00 !important; }
table.mx td.ev { background: #fff0db; }
table.mx td.on.ev { background: #f5b56b; color: #7a0b10; }
.lg.g-ev { background: #ffd9a8; color: #5a2d00; }
html[data-theme="dark"] table.mx thead tr th.ev { background: #6a4410 !important; color: #ffe2b0 !important; }
html[data-theme="dark"] table.mx td.ev { background: #3a2a10; }
html[data-theme="dark"] table.mx td.on.ev { background: #a8651a; color: #fff3e0; }
html[data-theme="dark"] .lg.g-ev { background: #6a4410; color: #ffe2b0; }
@media print { table.mx th.ev, table.mx td.ev { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
table.mx .c1 a, table.mx .c2 a { color: inherit; text-decoration: none; }
table.mx .c1 a:hover, table.mx .c2 a:hover { text-decoration: underline; }

/* Kalender */
.ak-nav { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; flex-wrap: wrap; }
.ak-nav h2 { margin: 0 8px; min-width: 190px; text-align: center; }
.ak-wrap { overflow-x: auto; }
.ak-grid { display: grid; grid-template-columns: repeat(7, minmax(112px, 1fr)); gap: 1px; background: #d6dae0; border: 1px solid #d6dae0; border-radius: 10px; overflow: hidden; min-width: 800px; }
.ak-h { background: #b3141b; color: #fff; text-align: center; font-weight: 600; padding: 6px 0; }
.ak-d { background: #fff; min-height: 96px; padding: 4px 5px; display: flex; flex-direction: column; gap: 3px; }
.ak-d.out { background: #f4f5f7; color: #9aa0a8; }
.ak-d.today { box-shadow: inset 0 0 0 2px #b3141b; }
.ak-n { font-weight: 700; display: flex; justify-content: space-between; align-items: center; font-size: .9rem; }
.ak-add { opacity: 0; text-decoration: none; color: #b3141b; font-weight: 700; padding: 0 6px; border-radius: 6px; }
.ak-d:hover .ak-add { opacity: 1; }
.ak-ev, .ak-inc { display: block; border-radius: 6px; padding: 1px 6px; font-size: .78rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.ak-ev { background: #fff0db; border-left: 3px solid #f08c00; color: #5a2d00; }
.ak-inc { background: #fde2e2; border-left: 3px solid #b3141b; color: #7a0b10; font-weight: 600; }
.lg.ak-ev, .lg.ak-inc { display: inline-block; }
.wd-boxes { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; }
.wd-boxes[hidden], #evIntWrap[hidden], #evUntilWrap[hidden], #evFortWrap[hidden] { display: none; }
@media (max-width: 800px) { .ak-grid { min-width: 720px; } }
html[data-theme="dark"] .ak-grid { background: #333a44; border-color: #333a44; }
html[data-theme="dark"] .ak-d { background: #1b1f25; }
html[data-theme="dark"] .ak-d.out { background: #14171b; color: #66707c; }
html[data-theme="dark"] .ak-ev { background: #3a2a10; color: #ffe2b0; }
html[data-theme="dark"] .ak-inc { background: #4a1a1d; color: #ffd6d8; }
@media print { .ak-add, .ak-nav .btn { display: none !important; } }

/* Personenstatistik */
.pst-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.pst { background: #fff; border: 1px solid #e3e6ea; border-left: 4px solid #b3141b; border-radius: 10px; padding: 12px 16px; }
.pst.ev { border-left-color: #f08c00; }
.pst.ok { border-left-color: #2f9e44; }
.pst h3 { margin: 0 0 4px; font-size: .9rem; color: #6b7280; font-weight: 600; }
.pst .big { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.pst .sub { font-size: .85rem; color: #6b7280; }
.bar { height: 8px; background: #eceef1; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 8px; background: #b3141b; }
.pst.ev .bar i { background: #f08c00; }
tr.row-ev td { background: #fff0db; }
tr.row-was td:first-child { box-shadow: inset 3px 0 0 #2f9e44; }
html[data-theme="dark"] .pst { background: #1b1f25; border-color: #333a44; }
html[data-theme="dark"] .bar { background: #2a2f37; }
html[data-theme="dark"] tr.row-ev td { background: #3a2a10; }

.pst .big small { font-size: .95rem; font-weight: 500; color: #6b7280; }

/* Personenstatistik: Druck */
.print-only { display: none; }
@media print {
  .print-only { display: block !important; }
  .no-print-h, .page-head .badge { display: none !important; }
  .prt-head { border-bottom: 3px solid #b3141b; margin-bottom: 10px; padding-bottom: 6px; }
  .prt-org { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #b3141b; font-weight: 700; }
  .prt-head h2 { margin: 2px 0; font-size: 20px; color: #000; }
  .prt-meta { font-size: 11px; color: #444; }
  .pst-tiles { grid-template-columns: repeat(4, 1fr) !important; gap: 8px; margin: 6px 0 10px; }
  .pst { padding: 6px 10px; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pst .big { font-size: 1.4rem; }
  .bar, .bar i, tr.row-ev td, .chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.grid.compact { font-size: 10.5px; }
  table.grid.compact th, table.grid.compact td { padding: 2px 5px; }
  table.grid tr { break-inside: avoid; }
  .page { max-width: none !important; padding: 0 !important; }
}

/* Alles drucken */
.screen-only-h { margin: 18px 0 4px; font-size: 1.1rem; color: #b3141b; }
.person-page { margin-top: 18px; padding-top: 8px; border-top: 2px dashed #d6dae0; }
@media print {
  .screen-only-h { display: none !important; }
  .person-page { margin: 0; padding: 0; border: 0; }
  .pg-land .mx-wrap { max-height: none; overflow: visible; }
}

/* Druck: Kopfzellen der Tabelle in Rot mit weißer Schrift (nicht rosa auf weiß) */
@media print {
  table.mx thead tr:nth-child(1) th, table.mx thead th.c1, table.mx thead th.c3, table.mx thead th.c4 {
    background: #b3141b !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.mx thead th.c1, table.mx thead th.c3, table.mx thead th.c4 { background: #8f0f15 !important; }
  table.mx th.mx-h a { color: inherit !important; }
}

/* Abzeichen Löschzug 2 */
.patch-big { display: block; width: 150px; height: 150px; margin: 0 auto 6px; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .35)); }
.landing-box .patch-big { width: 170px; height: 170px; }
.logo-top.patch { height: 46px; width: 46px; border-radius: 50%; }
