/* Paketportal POSTUNDVERSAND · CI: Navy #16365C, Rot #E30613, Orange #F0531F */
:root {
  --navy: #16365C;
  --navy-2: #0F2742;
  --red: #E30613;
  --orange: #F0531F;
  --ink: #1B2530;
  --muted: #6B7885;
  --fine: #8A939C;
  --line: #E4E8EC;
  --fill: #F5F7F9;
  --bg: #EEF1F4;
  --ok: #1E7F4F;
  --ok-bg: #E6F4EC;
  --warn: #8A5A00;
  --warn-bg: #FFF4DB;
  --err: #B3121F;
  --err-bg: #FDECEE;
  --radius: 10px;
  --font: 'Segoe UI', Inter, Arial, Helvetica, sans-serif;
  --mono: Consolas, 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--navy); }
a:hover { color: var(--red); }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; color: var(--navy); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.02rem; margin: 0 0 .9rem; color: var(--navy); font-weight: 650; display: flex; align-items: center; gap: .5rem; }
code, .mono { font-family: var(--mono); font-size: .92em; }
h1.mono { font-size: 1.45rem; letter-spacing: .02em; }
.small { font-size: .82rem; }
.muted { color: var(--muted); margin: 0; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }

/* ---------- Modusleiste ---------- */
.modebar { text-align: center; font-size: .82rem; font-weight: 600; padding: .35rem 1rem; color: #fff; letter-spacing: .02em; }
.mode-mock { background: repeating-linear-gradient(135deg, var(--red) 0 14px, #C70511 14px 28px); }
.mode-sandbox { background: var(--orange); }

/* ---------- Kopf ---------- */
.top { display: flex; align-items: center; gap: 1rem; background: #fff; padding: .6rem 1.4rem; }
.brand { display: flex; align-items: center; gap: .9rem; text-decoration: none; color: var(--ink); }
.logo-li { height: 30px; width: auto; }
.logo-lf { height: 34px; width: auto; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; border-left: 1px solid var(--line); padding-left: .9rem; }
.brand-txt strong { color: var(--navy); font-size: 1.05rem; }
.brand-txt small { color: var(--muted); font-size: .7rem; letter-spacing: .12em; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.who { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.who span { display: flex; flex-direction: column; line-height: 1.15; }
.who small { color: var(--muted); font-size: .75rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid !important; place-items: center; font-weight: 700; }
.navtoggle { display: none; background: none; border: 0; color: var(--navy); cursor: pointer; padding: .3rem; }
.cibar { display: flex; height: 4px; }
.cibar span:nth-child(1) { flex: 0 0 90px; background: var(--red); }
.cibar span:nth-child(2) { flex: 0 0 90px; background: var(--orange); }
.cibar span:nth-child(3) { flex: 1; background: var(--line); }

/* ---------- Gerüst ---------- */
.shell { display: flex; min-height: calc(100vh - 110px); }
.side { flex: 0 0 236px; background: var(--navy); padding: 1rem .7rem; display: flex; flex-direction: column; gap: 2px; }
.side a { display: flex; align-items: center; gap: .65rem; color: #C9D5E3; text-decoration: none; padding: .55rem .75rem; border-radius: 8px; font-size: .93rem; }
.side a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.on { background: #fff; color: var(--navy); font-weight: 600; }
.side a.on svg { color: var(--red); }
.side-h { color: #7F95AD; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; padding: 1.1rem .75rem .35rem; }
.side-foot { margin-top: auto; padding: 1rem .75rem 0; color: #8FA3B9; font-size: .78rem; border-top: 1px solid rgba(255,255,255,.1); }
.side-foot a { color: #C9D5E3; padding: 0; display: inline; }
.main { flex: 1; min-width: 0; padding: 1.6rem 2rem 3rem; max-width: 1400px; }
.foot { background: #fff; color: var(--fine); font-size: .78rem; padding: .8rem 2rem; border-top: 1px solid var(--line); }

/* ---------- Bausteine ---------- */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.crumb { margin: 0 0 .15rem; font-size: .85rem; color: var(--muted); }
.crumb a { color: var(--muted); }
.card { background: #fff; border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.2rem; box-shadow: 0 1px 2px rgba(22,54,92,.06), 0 0 0 1px rgba(22,54,92,.05); }
.card.narrow { max-width: 760px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card.danger { border-left: 4px solid var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; align-items: start; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.grid2, .grid3 { margin-bottom: 1.2rem; }
.col { display: flex; flex-direction: column; gap: 1.2rem; }
.col > .card { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.cards .card { margin: 0; }
.empty { color: var(--muted); padding: 1rem 0; margin: 0; }
.addr { margin: 0; line-height: 1.6; }
.count { background: var(--fill); color: var(--navy); border-radius: 20px; padding: .05rem .55rem; font-size: .8rem; }
.plainlist { margin: 0; padding-left: 1.1rem; line-height: 1.8; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; margin-bottom: 1.2rem; }
.kpi { background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: 0 0 0 1px rgba(22,54,92,.05); position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--navy); }
.kpi:nth-child(2)::before { background: var(--orange); }
.kpi:nth-child(3)::before { background: var(--red); }
.kpi span { display: block; color: var(--muted); font-size: .82rem; }
.kpi strong { display: block; font-size: 2rem; color: var(--navy); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi a { font-size: .82rem; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 1rem; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.bar-f { width: 100%; max-width: 32px; background: var(--navy); border-radius: 4px 4px 0 0; min-height: 2px; height: 2px; transition: height .4s; }
.bar:last-child .bar-f { background: var(--red); }
.bar-v { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-l { font-size: .7rem; color: var(--fine); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.quick a { display: block; padding: .9rem 1rem; border-radius: 8px; background: var(--fill); text-decoration: none; color: var(--ink); border: 1px solid transparent; }
.quick a:hover { border-color: var(--navy); }
.quick strong { display: block; color: var(--navy); }
.quick span { font-size: .82rem; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .92rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid #C9D2DB; background: #fff; color: var(--navy); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--navy); color: var(--navy); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #B8050F; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); font: inherit; cursor: pointer; padding: .4rem .6rem; border-radius: 6px; }
.btn-ghost:hover { background: var(--fill); color: var(--red); }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-lg { padding: .75rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; line-height: 1; padding: .2rem .45rem; border-radius: 6px; }
.icon-btn:hover { background: var(--err-bg); color: var(--err); }
form.inline { display: inline; }

/* Formulare */
.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; margin-bottom: .8rem; min-width: 0; }
.field.grow { flex: 1 1 220px; }
.w-xs { flex: 0 0 70px; width: 70px; } .w-s { flex: 0 0 90px; } .w-m { flex: 0 0 120px; } .w-l { flex: 0 0 180px; } .w-xl { flex: 0 0 240px; }
.field label { font-size: .8rem; color: var(--muted); margin-bottom: .25rem; font-weight: 600; }
.req { color: var(--red); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #C9D2DB; border-radius: 7px; padding: .5rem .65rem; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(22,54,92,.25); border-color: var(--navy); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--navy); }
input[type=file] { padding: .4rem; background: var(--fill); }
.has-err input, .has-err select { border-color: var(--err); background: #FFFBFB; }
.hint { color: var(--fine); font-size: .75rem; margin-top: .2rem; }
.err { color: var(--err); font-size: .78rem; margin-top: .2rem; display: block; }
.err-txt { color: var(--err); font-size: .85rem; }
.check { display: flex; align-items: flex-start; gap: .55rem; margin: .35rem 0 .7rem; cursor: pointer; }
.check input { margin-top: .25rem; }
.check span { display: flex; flex-direction: column; }
.check small { color: var(--fine); font-size: .76rem; }
.check.inline { margin: 0; align-items: center; }
.check.inline input { margin-top: 0; }
.stack .field { margin-bottom: 1rem; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.actions .muted { margin-right: auto; }
.actions.sticky { position: sticky; bottom: 0; background: rgba(238,241,244,.94); backdrop-filter: blur(6px); padding: .8rem 0; margin: 0; z-index: 5; border-top: 1px solid var(--line); }
.filter { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-start; padding-bottom: .4rem; }
.filter .push { margin-left: auto; }
.pricegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 .8rem; }

.seg { display: inline-flex; background: var(--fill); border-radius: 9px; padding: 3px; margin-bottom: 1rem; flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: .42rem 1rem; border-radius: 7px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(22,54,92,.15); }
.seg input:focus-visible + span { outline: 2px solid var(--navy); }

.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .75rem; }
.formgrid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 1.2rem; align-items: start; margin-bottom: 1.2rem; }
.formgrid > .card { margin: 0; }
.adrpick select { min-width: 240px; font-size: .88rem; padding: .35rem .5rem; }
.zoll { border-top: 4px solid var(--orange); }
.is-hidden { display: none !important; }

.kundenwahl { display: flex; align-items: center; gap: .7rem; background: #fff; border-radius: var(--radius); padding: .55rem .9rem; margin-bottom: 1.1rem; box-shadow: 0 0 0 1px rgba(22,54,92,.05); }
.kundenwahl label { font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.kundenwahl select { max-width: 420px; }

/* Tabellen */
.tablewrap { overflow-x: auto; }
.tablewrap.tall { max-height: 460px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .55rem .6rem; border-bottom: 2px solid var(--line); background: #fff; position: sticky; top: 0; }
.tbl td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:hover td { background: #FAFBFC; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.tbl .sub { display: block; color: var(--muted); font-size: .8rem; }
.tbl .sub.warn { color: var(--warn); }
.tbl-form td { padding: .35rem .3rem; border-bottom: 0; }
.tbl-form input, .tbl-form select { padding: .4rem .5rem; font-size: .88rem; }
.tbl-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; gap: 1rem; }
tr.row-err td { background: #FFF8F8; }
.tbl th.r, .tbl td.r { text-align: right; }

.badge { display: inline-block; font-size: .74rem; font-weight: 700; padding: .12rem .55rem; border-radius: 20px; vertical-align: middle; letter-spacing: .02em; font-family: var(--font); }
.b-open { background: #FFF1E9; color: #B2400F; }
.b-done { background: var(--ok-bg); color: var(--ok); }
.b-cancel { background: #EEF0F2; color: var(--muted); text-decoration: line-through; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.preview iframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 8px; background: var(--fill); }

.pager { display: flex; gap: .3rem; flex-wrap: wrap; }
.pager a { padding: .35rem .7rem; border-radius: 6px; background: #fff; text-decoration: none; }
.pager a.on { background: var(--navy); color: #fff; }

/* Meldungen */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; border-left: 4px solid; }
.flash ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.flash-ok { background: var(--ok-bg); border-color: var(--ok); color: #124D30; }
.flash-warn { background: var(--warn-bg); border-color: #E3A21A; color: var(--warn); }
.flash-err { background: var(--err-bg); border-color: var(--err); color: var(--err); }

/* Anmeldung */
body.plain { background: var(--navy); background-image: radial-gradient(circle at 20% 0%, #1E4677 0, transparent 55%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.login-card { background: #fff; border-radius: 14px; padding: 2rem 2.2rem 1.8rem; width: 100%; max-width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-card .cibar { margin: 1.2rem -2.2rem 1.4rem; }
.login-logos { display: flex; justify-content: space-between; align-items: center; }
.login-logos .logo-li { height: 40px; } .login-logos .logo-lf { height: 48px; }
.login-card h1 { margin-bottom: .3rem; }
.login-card .muted { margin-bottom: 1.3rem; }
.mode-note { text-align: center; color: var(--red); font-weight: 700; font-size: .8rem; margin: 1rem 0 0; letter-spacing: .04em; }
.login-foot { color: #9FB3C8; font-size: .82rem; margin-top: 1.2rem; }
.login-foot a { color: #DCE6F0; }

/* Mobil */
@media (max-width: 1100px) {
  .formgrid, .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .navtoggle { display: block; }
  .brand-txt, .who span:not(.avatar) { display: none; }
  .logo-li { height: 24px; } .logo-lf { height: 28px; }
  .top { padding: .5rem 1rem; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .side.open { transform: none; }
  .main { padding: 1rem 1rem 3rem; }
  .grid3, .kpis, .quick { grid-template-columns: 1fr; }
  .w-l, .w-xl { flex: 1 1 160px; }
  .kundenwahl { flex-direction: column; align-items: stretch; }
  .adrpick select { min-width: 0; width: 100%; }
}
@media print {
  .side, .top, .cibar, .modebar, .foot, .actions, .btn { display: none !important; }
  body { background: #fff; }
}
.keybox { display: block; margin-top: .4rem; padding: .5rem .7rem; background: #fff; border: 1px dashed #E3A21A; border-radius: 6px; word-break: break-all; user-select: all; color: var(--ink); }
.tbl tbody.grp { border-top: 2px solid var(--line); }
.tbl tr.subtotal td { font-weight: 650; background: var(--fill); color: var(--navy); }
.card > p.muted { margin-bottom: .8rem; }
.setup-card { max-width: 520px; }
.checklist { list-style: none; margin: 0 0 1.2rem; padding: 0; font-size: .88rem; }
.checklist li { padding: .45rem .6rem .45rem 1.9rem; border-radius: 6px; margin-bottom: .3rem; position: relative; }
.checklist li::before { position: absolute; left: .6rem; font-weight: 700; }
.ck-ok { background: var(--ok-bg); color: #124D30; } .ck-ok::before { content: '✓'; }
.ck-warn { background: var(--warn-bg); color: var(--warn); } .ck-warn::before { content: '!'; }
.ck-err { background: var(--err-bg); color: var(--err); word-break: break-all; } .ck-err::before { content: '×'; }
