:root {
  --grey: #808080; --lightgrey: #D9D9D9; --blue: #C6D9F1; --pink: #FF8AD8; --purple: #5F497A;
  --txtgrey: #7F7F7F; --red: #FF0000;
  --ui: #1f2937; --ui-bg: #f3f4f6; --accent: #1F497D;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ui-bg); color: var(--ui); font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; }
button, .btn { font: inherit; padding: 6px 12px; border: 1px solid #c7ccd4; background: #fff; border-radius: 6px; cursor: pointer; color: var(--ui); text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: #eef2f7; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
input { font: inherit; padding: 6px 8px; border: 1px solid #c7ccd4; border-radius: 6px; }
.hidden { display: none !important; }
body:not(.admin) .adm { display: none !important; }

.appbar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand img { height: 28px; }
.appbar nav { display: flex; gap: 4px; }
.appbar nav button { border: none; background: transparent; }
.appbar nav button.active { background: var(--ui-bg); font-weight: 600; }
.auth { margin-left: auto; display: flex; gap: 8px; align-items: center; color: #6b7280; }

.toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 16px; flex-wrap: wrap; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 49px; z-index: 19; }
.toolbar .sep { width: 1px; height: 22px; background: #e5e7eb; margin: 0 4px; }
.zoom { display: flex; align-items: center; gap: 6px; color: #6b7280; }
.savestate { margin-left: auto; color: #6b7280; font-size: 12px; }

/* ===== Seite wie Excel-Seitenlayoutansicht ===== */
.paper-wrap { padding: 20px; overflow: auto; }
.paper { background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); padding: 14px 0 30px; width: max-content; margin: 0 auto; zoom: .85; }
.pageheader { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding: 0 12px 6px; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 32px; color: #000; }
.ph-left img { width: 148px; height: auto; display: block; }
.ph-center { text-align: center; }
.ph-right { text-align: right; }

table.xl { border-collapse: collapse; table-layout: fixed; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 16px; color: #000; }
table.xl td { padding: 0 2px; height: 28px; overflow: hidden; white-space: nowrap; border: none; vertical-align: middle; }
table.xl tr.h31 td { height: 31px; }
table.xl td.note { border: 2px solid var(--red); color: var(--txtgrey); font-style: italic; text-align: center; vertical-align: top; white-space: normal; font-size: 12px; line-height: 1.15; }
table.xl td.kwlabel { border: 2px solid #000; border-right: none; font-size: 32px; color: var(--txtgrey); text-align: right; }
table.xl td.kwnum { border: 2px solid #000; border-left: none; font-size: 32px; color: var(--txtgrey); text-align: center; }
table.xl td.daybox1 { border: 2px solid #000; border-bottom: none; text-align: center; vertical-align: top; }
table.xl td.daybox2 { border-left: 2px solid #000; border-right: 2px solid #000; text-align: center; }
table.xl td.hdr { background: var(--grey); color: #fff; font-weight: bold; text-align: center; border-top: 2px solid #000; }
table.xl td.hdr.hol { background: var(--pink); }
table.xl td.hdr.cust { background: var(--purple); }
table.xl td.ist-h { background: var(--blue); text-align: center; border: 2px solid #000; border-bottom: none; }
table.xl td.namehdr { border: 1px solid #000; border-left: 2px solid #000; border-top: 2px solid #000; }
table.xl td.wo-h { background: var(--grey); color: #fff; font-weight: bold; text-align: center; border: 2px solid #000; }
table.xl td.nm { border-left: 2px solid #000; border-top: 1px solid #000; border-bottom: 1px solid #000; background: var(--lightgrey); }
table.xl td.nm.first { background: var(--grey); color: #fff; font-weight: bold; border-top: 2px solid #000; }
table.xl td.nm.last { border-bottom: 2px solid #000; }
table.xl td.c { border: 1px solid #000; padding: 0; }
table.xl tr.r1 td.c { border-top: 2px solid #000; }
table.xl tr.r3 td.c { border-bottom: 2px solid #000; }
table.xl td.ist { background: var(--blue); text-align: right; padding-right: 4px; }
table.xl td.wo { border-right: 2px solid #000; text-align: right; padding-right: 4px; }
table.xl tr.r1 td.wo { border-top: 2px solid #000; border-bottom: 3px double #000; }
table.xl td.wo2 { border-right: 2px solid #000; border-bottom: 2px solid #000; text-align: center; font-size: 12px; line-height: 1.2; white-space: normal; color: #444; }
.wo2 .plus { color: #008000; } .wo2 .minus { color: #C00000; }

table.xl input { width: 100%; height: 100%; border: none; border-radius: 0; background: transparent; font: inherit; color: inherit; padding: 0 3px; outline: none; }
table.xl td.c input { text-align: left; }
table.xl td.txt input { text-align: center; }
table.xl input:focus { outline: 2px solid #217346; outline-offset: -2px; background: #fff; }
table.xl input[readonly]:focus { outline-color: #9ca3af; }
table.xl input.mk { font-weight: bold; font-style: italic; }
table.xl td.daybox1 input, table.xl td.daybox2 input { text-align: center; }

/* ===== Verwaltungsseiten ===== */
.card { background: #fff; margin: 16px auto; max-width: 980px; border-radius: 10px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card h3 { font-size: 14px; margin: 18px 0 8px; color: #374151; }
.hint { color: #6b7280; margin: 0 0 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.row.end { justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid2 label, .grid4 label { display: flex; flex-direction: column; gap: 4px; color: #4b5563; font-size: 13px; }
label.check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #f0f0f0; gap: 8px; }
ul.plain li button { padding: 0 8px; }
.chip { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.chip.pink { background: var(--pink); } .chip.purple { background: var(--purple); }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-weight: 600; color: #6b7280; font-size: 12px; padding: 6px; border-bottom: 1px solid #e5e7eb; }
table.list td { padding: 4px 6px; border-bottom: 1px solid #f0f0f0; }
table.list td input[type=text], table.list td input[type=number] { width: 100%; }
table.list tr.inactive td { opacity: .5; }
table.list .mv button { padding: 2px 6px; }
dialog { border: none; border-radius: 10px; padding: 20px; width: 320px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog input { width: 100%; }
dialog h2 { margin-top: 0; font-size: 18px; }
.err { color: #c00; min-height: 1em; margin: 6px 0; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; }
#toast.show { opacity: 1; }

@media (max-width: 700px) {
  .grid2, .grid4, .cols2 { grid-template-columns: 1fr; }
  .toolbar { top: 0; position: static; }
}

/* ===== Druck: eine Seite A4 quer, wie Excel (Skalierung ~60 %) ===== */
@page { size: A4 landscape; margin: 6mm 0 4mm 0; }
@media print {
  html, body { background: #fff; }
  .noprint, .appbar, .toolbar, #toast { display: none !important; }
  .view:not(#view-plan) { display: none !important; }
  .paper-wrap { padding: 0; overflow: visible; }
  .paper { box-shadow: none; padding: 0; zoom: .56 !important; margin: 0 auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.xl input::placeholder { color: transparent; }
}

body:not(.soll-on) .soll-only { display: none !important; }
dialog label.dlgl { display: block; margin-bottom: 10px; color: #4b5563; font-size: 13px; }
dialog label.dlgl input { margin-top: 4px; }
