/* ==========================================================================
   Lieferanten-Portal (sp-) & öffentliche Terminbuchung (bk-)
   ========================================================================== */

/* ---------- Rahmen ---------- */
.sp-portal-pill { flex: none; letter-spacing: .12em; text-transform: uppercase; font-size: 10.5px; padding: 5px 11px; }
.sp-pop-right { right: 0; }
.sp-profile-btn { border: 0; background: none; padding: 0; border-radius: 50%; }
.sp-me-pop { width: 280px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sp-me { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sp-me .cell-2 { min-width: 0; }
.sp-me .cell-2 small { overflow-wrap: anywhere; }
.sp-me-meta { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.sp-me-meta .eyebrow { margin: 0; color: var(--muted); }
.sp-content { max-width: 1440px; }
.sp-page { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.sp-page > .page-head, .sp-page > .back-link { margin-bottom: 0; }
.sp-page > .back-link { align-self: flex-start; }

.sp-admin-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: var(--gap); border-radius: var(--r); background: var(--warn-bg); color: var(--warn); border: 1px solid #f3dcc0; }
.sp-admin-banner > div { display: flex; flex-direction: column; flex: 1; min-width: 200px; line-height: 1.35; }
.sp-admin-banner small { font-size: 12.5px; opacity: .85; }
.sp-admin-ic { width: 32px; height: 32px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }

/* ---------- Dashboard ---------- */
.sp-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding: 26px 28px; border-radius: var(--r-lg); background: linear-gradient(120deg, var(--navy), var(--navy-2)); color: #fff; box-shadow: var(--shadow); }
.sp-hero > div { max-width: 640px; }
.sp-hero .eyebrow { color: var(--blue-soft); }
.sp-hero h1 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.03em; }
.sp-hero p.muted { color: #b9c8de; margin-top: 8px; font-size: 15px; }
.sp-hero .btn-primary { background: #fff; color: var(--navy); }
.sp-hero .btn-primary:hover:not(:disabled) { background: var(--sky); }
.sp-hero .btn-primary:disabled { opacity: .5; }
.sp-kpi .kpi-value { font-size: 28px; }
.sp-kpi-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.sp-kpi.warn .kpi-ic { background: var(--danger); }
.sp-dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }

.sp-queue { display: flex; flex-direction: column; gap: 10px; }
.sp-qcard { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--sky-2); }
.sp-qcard.risk { border-left: 4px solid var(--warn); }
.sp-qcard.problem { border-left: 4px solid var(--danger); background: #fff; }
.sp-qno { font-size: 22px; font-weight: 800; color: var(--blue-soft); font-variant-numeric: tabular-nums; letter-spacing: -.02em; min-width: 30px; }
.sp-qmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sp-qnum { font-weight: 800; color: var(--blue); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.sp-qnum:hover { text-decoration: underline; }
.sp-qmeta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.sp-qmeta span { display: inline-flex; align-items: center; gap: 5px; }
.sp-qproblem { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--danger); font-weight: 600; overflow-wrap: anywhere; }
.sp-qproblem .ic { margin-top: 2px; }
.sp-qside { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.sp-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sp-qside .sp-pills { justify-content: flex-end; }

.sp-shipped { display: flex; flex-direction: column; }
.sp-shipped-row { display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--line); color: var(--muted); border-radius: 10px; }
.sp-shipped-row:last-child { border-bottom: 0; }
.sp-shipped-row:hover { background: var(--sky-2); }
.sp-shipped-row .cell-2 { flex: 1; min-width: 0; color: var(--ink); }
.sp-shipped-row .cell-2 b { font-variant-numeric: tabular-nums; }
.sp-ship-ic { width: 34px; height: 34px; border-radius: 10px; background: #ece7fb; color: #5b3aa8; display: grid; place-items: center; flex: none; }

/* ---------- Auftragsliste ---------- */
.sp-filter { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.sp-table td { vertical-align: middle; }
.sp-table td .sp-pills { flex-wrap: wrap; }

/* ---------- Auftragsdetail ---------- */
.sp-detail-head { align-items: flex-end; }
.sp-detail-head h1 { font-variant-numeric: tabular-nums; }
.sp-tiles .sp-tile { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.sp-tile b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.sp-tile.warn { background: var(--danger-bg); border-color: #f4c9c6; }
.sp-tile.warn b { color: var(--danger); }
.sp-detail-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
#sp-shipping { scroll-margin-top: calc(var(--top-h) + 28px); }

.sp-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); counter-reset: none; }
.sp-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.sp-steps li::before { content: ''; position: absolute; top: 15px; left: -50%; right: 50%; height: 2px; background: var(--line); z-index: 0; }
.sp-steps li:first-child::before { display: none; }
.sp-steps li.done::before, .sp-steps li.current::before { background: var(--blue); }
.sp-step-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line-2); font-size: 12.5px; font-weight: 800; color: var(--muted); }
.sp-steps li.done .sp-step-dot { background: var(--blue); border-color: var(--blue); color: #fff; }
.sp-steps li.current .sp-step-dot { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 0 0 4px var(--sky); }
.sp-steps li.done, .sp-steps li.current { color: var(--navy); }
.sp-steps.paused li.current .sp-step-dot { background: var(--danger); border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.sp-flow-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sp-notice { font-size: 13.5px; }
.sp-notice span { flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.sp-hint { margin-top: 12px; }
.sp-hint.top { margin: -4px 0 14px; }

.sp-items { display: flex; flex-direction: column; gap: 12px; }
.sp-item { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.sp-item header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: var(--sky-2); border-bottom: 1px solid var(--line); }
.sp-item header b { flex: 1; min-width: 140px; }
.sp-item-no { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.sp-fields { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-fields div { display: flex; flex-direction: column; gap: 2px; padding: 9px 14px; border-bottom: 1px solid var(--line); min-width: 0; }
.sp-fields div:nth-child(odd) { border-right: 1px solid var(--line); }
.sp-fields dt { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sp-fields dd { margin: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }

.sp-doc { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--sky-2); }
.sp-doc .cell-2 { flex: 1; min-width: 150px; }
.sp-doc-name { font-size: 13.5px; overflow-wrap: anywhere; }
.sp-doc-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; flex: none; }
.sp-labels { margin-top: 12px; }
.sp-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.sp-form input:disabled { opacity: .6; cursor: not-allowed; }
.sp-problem { padding: 12px 14px; border-radius: var(--r); background: var(--danger-bg); color: var(--danger); display: flex; flex-direction: column; gap: 4px; }
.sp-problem .kpi-label { color: var(--danger); }
.sp-problem p { font-weight: 600; overflow-wrap: anywhere; }
.sp-timeline { list-style: none; margin: 0; padding: 0 0 4px; display: flex; flex-direction: column; }
.sp-timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 14px 0; min-width: 0; }
.sp-timeline li::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.sp-timeline li:last-child::before { display: none; }
.sp-timeline .cell-2 { min-width: 0; }
.sp-timeline b { font-size: 13.5px; overflow-wrap: anywhere; }
.sp-tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--blue); margin-top: 4px; flex: none; position: relative; z-index: 1; }
.sp-timeline li:first-child .sp-tl-dot { background: var(--navy); }

@media (max-width: 1180px) {
  .sp-dash-grid, .sp-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sp-portal-pill { display: none; }
  .sp-me-pop { position: fixed; top: calc(var(--top-h) + 16px); left: 8px; right: 8px; width: auto; }
  .sp-hero { padding: 20px; }
  .sp-hero .btn { width: 100%; }
  .sp-qcard { grid-template-columns: auto minmax(0, 1fr); padding: 12px; }
  .sp-qside { grid-column: 1 / -1; align-items: stretch; }
  .sp-qside .sp-pills { justify-content: flex-start; }
  .sp-qside .btn { width: 100%; }
  .sp-fields { grid-template-columns: 1fr; }
  .sp-fields div:nth-child(odd) { border-right: 0; }
  .sp-steps li { font-size: 11px; }
  .sp-steps .sp-step-label { max-width: 70px; }
  .sp-doc .btn { width: 100%; }
  .sp-flow-actions .btn { flex: 1; }
}

/* ==========================================================================
   Öffentliche Terminbuchung
   ========================================================================== */
.bk-page { min-height: 100vh; background: var(--bg); padding: 0 16px 32px; display: flex; flex-direction: column; gap: 18px; max-width: 1160px; margin: 0 auto; overflow-x: hidden; }
.bk-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 -4px; padding: 10px 12px 10px 14px; border-radius: var(--r); background: var(--navy); color: #fff; box-shadow: var(--shadow); }
.bk-banner p { flex: 1; min-width: 200px; font-size: 13.5px; color: #d5e0ef; }
.bk-banner p b { color: #fff; margin-right: 6px; }
.bk-banner-ic { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.12); display: grid; place-items: center; flex: none; }
.bk-banner-link { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 7px 12px; border-radius: 999px; background: #fff; color: var(--navy); white-space: nowrap; }
.bk-banner-link:hover { background: var(--sky); }
.bk-banner-x { width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; color: #fff; display: grid; place-items: center; flex: none; }
.bk-banner-x:hover { background: rgba(255,255,255,.12); }
.bk-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 0; }

.bk-hero { padding: 30px 30px 26px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.bk-hero::after { content: ''; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, var(--sky) 0%, transparent 70%); pointer-events: none; }
.bk-hero h1 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -.03em; position: relative; }
.bk-hero > p { margin-top: 8px; color: var(--muted); font-size: 16px; max-width: 640px; position: relative; }
.bk-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 22px; position: relative; }
.bk-points > div { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); }
.bk-points b { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--navy); margin-top: 4px; }
.bk-points small { font-size: 13px; color: var(--muted); line-height: 1.45; }
.bk-point-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; }

.bk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); gap: 18px; align-items: start; }
.bk-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 16px; }
.bk-h2 { font-size: 20px; margin-bottom: 10px; }
.bk-copy { display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: 14px; }
.bk-advisor-head { display: flex; align-items: center; gap: 14px; }
.bk-advisor-head .eyebrow { margin: 0; }
.bk-advisor-head b { font-size: 18px; }
.bk-contact { display: flex; flex-direction: column; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.bk-contact > * { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.bk-contact > * + * { border-top: 1px solid var(--line); }
.bk-contact a:hover { background: var(--sky-2); color: var(--blue); }
.bk-contact .ic { color: var(--blue); margin-top: 1px; }

.bk-form-panel { padding: 24px; }
.bk-form-panel form { display: flex; flex-direction: column; gap: 18px; }
.bk-form-head h2 { font-size: 24px; }
.bk-form-head p { margin-top: 4px; }
.bk-err { font-size: 12px; font-weight: 600; color: var(--danger); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--danger); background: #fff; }

.bk-when { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.bk-when-side { display: flex; flex-direction: column; gap: 14px; }
.bk-cal { border: 1px solid var(--line-2); border-radius: var(--r); padding: 12px; background: #fff; }
.bk-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bk-cal-head b { font-size: 15px; text-transform: capitalize; }
.bk-cal-head .icon-round:disabled { opacity: .35; cursor: not-allowed; }
.bk-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.bk-cal-wd { text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.bk-day { aspect-ratio: 1; min-height: 34px; border-radius: 10px; border: 1px solid transparent; background: var(--sky-2); font-weight: 700; font-size: 13.5px; color: var(--navy); font-variant-numeric: tabular-nums; }
.bk-day:hover:not(:disabled) { border-color: var(--navy); background: #fff; }
.bk-day.today { border-color: var(--blue-soft); }
.bk-day.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.bk-day:disabled { background: none; color: var(--line-2); cursor: not-allowed; font-weight: 500; }
.bk-day.full:disabled { text-decoration: line-through; }
.bk-selection { display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: var(--r); background: var(--sky); }
.bk-selection b { font-size: 15px; }

.bk-types { border: 0; margin: 0; padding: 0; min-width: 0; }
.bk-types legend { padding: 0; margin-bottom: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bk-type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bk-type { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.bk-type:hover { border-color: var(--navy); }
.bk-type.active { border-color: var(--navy); box-shadow: 0 0 0 3px var(--sky); background: var(--sky-2); }
.bk-type input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.bk-type:focus-within { outline: 3px solid var(--blue-soft); outline-offset: 2px; }
.bk-type .cell-2 { min-width: 0; }
.bk-type .cell-2 small { overflow-wrap: anywhere; }
.bk-type-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--sky); color: var(--navy); display: grid; place-items: center; flex: none; }
.bk-type.active .bk-type-ic { background: var(--navy); color: #fff; }
.bk-privacy { align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.45; }
.bk-privacy input { margin-top: 1px; flex: none; }
.bk-privacy.invalid { color: var(--danger); }
.bk-submit { text-transform: uppercase; letter-spacing: .1em; font-size: 13.5px; font-weight: 800; }

.bk-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 8px; }
.bk-done h2 { font-size: 26px; }
.bk-done p { max-width: 460px; }
.bk-done-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin-bottom: 4px; }
.bk-done-actions { justify-content: center; margin-top: 8px; }
.bk-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); padding-top: 6px; }
.bk-foot a { color: var(--blue); font-weight: 700; }
.bk-missing-card { max-width: 520px; width: 100%; margin: 40px auto 0; }

@media (max-width: 980px) {
  .bk-grid { grid-template-columns: 1fr; }
  .bk-side { position: static; order: 2; }
  .bk-when { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .bk-page { padding: 0 12px 24px; gap: 14px; }
  .bk-hero { padding: 22px 18px; }
  .bk-points, .bk-type-grid { grid-template-columns: 1fr; }
  .bk-form-panel { padding: 16px; }
  .bk-banner-link { order: 3; }
  .bk-done-actions .btn { width: 100%; }
}
