/* ==========================================================================
   Kunden (Liste, Neuer Kunde, Detail, Maßprofile) & Kalender
   Präfixe: cu- / cal-  ·  Farben nur über Variablen aus styles.css
   ========================================================================== */

/* ---------- Seitenrahmen ---------- */
.cu-page, .cal-page { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.cu-page > .page-head, .cal-page > .page-head { margin-bottom: 0; }
.cu-page > .toolbar, .cal-page > .toolbar { margin-bottom: 0; }
.cu-page .tabs-line { margin-top: -4px; }

/* ---------- Kundenliste ---------- */
.cu-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cu-who a.strong:hover { color: var(--blue); }
.cu-row-actions { display: inline-flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cu-table td:first-child { min-width: 220px; }

/* ---------- Neuer Kunde – Drawer ---------- */
.cu-steps { list-style: none; margin: 0 0 20px; padding: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cu-steps button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.cu-steps b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; background: var(--sky); color: var(--navy); border: 1px solid var(--line-2); }
.cu-steps button.active { color: var(--navy); }
.cu-steps button.active b { background: var(--navy); border-color: var(--navy); color: #fff; }
.cu-steps button.done b { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok); }
.cu-steps-sep { flex: 0 1 48px; height: 1px; background: var(--line-2); }

.cu-form { display: flex; flex-direction: column; gap: 22px; }
.cu-section { display: flex; flex-direction: column; gap: 14px; }
.cu-section + .cu-section { padding-top: 22px; border-top: 1px solid var(--line); }
.cu-section-head .eyebrow { margin-bottom: 2px; }
.cu-sub-block { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); }
.cu-check { align-self: flex-start; }

.cu-street { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 14px; }

/* Fehlerzustand */
.field input.cu-invalid { border-color: var(--danger); background: var(--danger-bg); }
.field input.cu-invalid ~ .field-hint { color: var(--danger); font-weight: 600; }

/* Eingabe mit Einheit (cm / kg) */
.cu-unit { position: relative; }
.cu-unit input { padding-right: 42px; }
.cu-unit i { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); pointer-events: none; }

/* Maßformular */
.cu-measure-form { display: flex; flex-direction: column; gap: 18px; }
.cu-presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); }
.cu-presets .muted { margin-right: 4px; font-weight: 600; }
.cu-details { border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.cu-details > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 13px 16px; cursor: pointer; font-weight: 700; color: var(--navy); }
.cu-details > summary::-webkit-details-marker { display: none; }
.cu-details > summary .cu-chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.cu-details[open] > summary { border-bottom: 1px solid var(--line); }
.cu-details[open] > summary .cu-chev { transform: rotate(180deg); }
.cu-details > .form-grid { padding: 16px; }
.cu-details-open { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Kunden-Detail ---------- */
.cu-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; background: linear-gradient(135deg, #fff 55%, var(--sky) 100%); }
.cu-hero-main { display: flex; align-items: center; gap: 18px; min-width: 0; }
.cu-hero-main .avatar.lg { background: var(--navy); }
.cu-hero-copy { min-width: 0; }
.cu-hero-copy h2 { font-size: 26px; overflow-wrap: anywhere; }
.cu-hero-copy p { margin-top: 2px; overflow-wrap: anywhere; }
.cu-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.cu-focus { display: flex; flex-direction: column; gap: 3px; padding: 14px 18px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); min-width: 240px; max-width: 360px; }
.cu-focus b { font-size: 15.5px; }

.cu-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); }
.cu-kpi { padding: 16px; }
.cu-kpi .kpi { gap: 12px; }
.cu-kpi .kpi-ic { width: 40px; height: 40px; }
.cu-kpi .kpi-value { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-kpi-copy { min-width: 0; }
.cu-kpi .kpi-delta { font-size: 12px; }

.cu-cards { align-items: start; }
.cu-span { grid-column: 1 / -1; }
.cu-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* Authentifizierung */
.cu-auth { display: flex; flex-direction: column; }
.cu-auth-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cu-auth-row:first-child { padding-top: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cu-auth-row:first-child .cu-label { margin: 0; }
.cu-auth-row .row { gap: 8px; }
.cu-auth-foot { padding-top: 14px; }

/* Adressen */
.cu-addr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cu-addr > div { padding: 14px; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); min-width: 0; }
.cu-addr-lines { display: flex; flex-direction: column; font-weight: 600; overflow-wrap: anywhere; }
.cu-addr-lines .muted { font-weight: 500; }

/* Bestellungen */
.cu-orders { display: flex; flex-direction: column; }
.cu-order { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, .8fr) auto; align-items: center; gap: 12px; padding: 11px 8px; border-bottom: 1px solid var(--line); border-radius: 8px; }
.cu-order:last-child { border-bottom: 0; }
.cu-order:hover { background: var(--sky-2); }
.cu-order-no { font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-order-sum { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Provisionen & Analyse */
.cu-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.cu-stats .stat-mini { padding: 14px 16px; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); }
.cu-stats .stat-mini small { font-size: 12px; }
.cu-analysis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding-top: 18px; }
.cu-analysis-block { min-width: 0; }
.cu-analysis-block h4 { font-size: 14.5px; }
.cu-mt { margin-top: 22px; }
.cu-none { margin-top: 10px; }
.cu-assign { display: flex; flex-direction: column; margin-top: 10px; }
.cu-assign-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.cu-assign-row:last-child { border-bottom: 0; }
.cu-assign-row > span:first-child, .cu-assign-row > .cell-2 > span { color: var(--muted); }
.cu-assign-row > b { font-weight: 700; text-align: right; }
.cu-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.cu-modal-sec { margin: 6px 0 -4px; padding-top: 12px; border-top: 1px solid var(--line); }
.cu-tops { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.cu-top { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--sky-2); }
.cu-top .cu-label { margin: 0; }
.cu-staff-list { display: flex; flex-direction: column; margin-top: 8px; }
.cu-staff { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cu-staff:last-child { border-bottom: 0; }
.cu-staff-num { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }

/* Aktivität */
.cu-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cu-timeline li { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 9px 0 9px 24px; font-size: 13.5px; }
.cu-timeline li i { position: absolute; left: 4px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px var(--sky); }
.cu-timeline li::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.cu-timeline li:first-child::before { top: 18px; }
.cu-timeline li:last-child::before { bottom: calc(100% - 18px); }
.cu-timeline time { white-space: nowrap; }

.cu-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); }

/* ---------- Kunden-Maße ---------- */
.cu-meas { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.cu-plist { display: flex; flex-direction: column; gap: 8px; position: sticky; top: calc(var(--top-h) + 24px); }
.cu-pcard { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; text-align: left; padding: 14px; border-radius: var(--r); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); transition: border-color .15s, background .15s; }
.cu-pcard:hover { border-color: var(--line-2); }
.cu-pcard.active { border-color: var(--navy); background: var(--sky-2); box-shadow: 0 0 0 2px var(--sky); }
.cu-meas-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--gap); align-items: start; min-width: 0; }
.cu-meas-form { display: flex; flex-direction: column; gap: 18px; }
.cu-meas-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.cu-meas-head h2 { overflow-wrap: anywhere; }
.cu-progress { display: flex; align-items: center; gap: 12px; }
.cu-progress .progress { flex: 1; }
.cu-progress span { white-space: nowrap; }
.cu-name-row { max-width: 520px; }
.cu-save-row { display: flex; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--line); }
.cu-preview { position: sticky; top: calc(var(--top-h) + 24px); display: flex; flex-direction: column; gap: 6px; }
.cu-preview-art { margin: 6px 0; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); padding: 10px; display: grid; place-items: center; }
.cu-preview-art svg { width: 100%; height: auto; max-height: 360px; }

/* ==========================================================================
   Kalender
   ========================================================================== */
.cal-view button { display: inline-flex; align-items: center; gap: 6px; }
.cal-slot-form { display: flex; flex-direction: column; gap: 14px; }
.cal-slots { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.cal-slot-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.cal-slot { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--sky-2); min-width: 0; }
.cal-slot.past { opacity: .6; }
.cal-slot-ic { width: 34px; height: 34px; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--navy); display: grid; place-items: center; flex: none; }
.cal-slot-copy { flex: 1; min-width: 0; }
.cal-slot-copy b, .cal-slot-copy small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-del { width: 32px; height: 32px; color: var(--danger); }
.cal-del:hover { border-color: var(--danger); background: var(--danger-bg); }

.cal-status { width: auto; min-width: 180px; height: 44px; border-radius: 999px; background-color: #fff; }
.cal-table td { vertical-align: top; }
.cal-table td:first-child { min-width: 190px; }
.cal-svc { min-width: 240px; max-width: 380px; }
.cal-svc b { text-transform: lowercase; }
.cal-meta { display: flex; flex-direction: column; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.cal-select { max-width: 260px; }

/* Wochenansicht */
.cal-weeknav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-weektitle { display: flex; flex-direction: column; min-width: 150px; text-align: center; line-height: 1.3; }
.cal-weektitle b { font-size: 16px; }
.cal-weeknav .btn { margin-left: auto; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-day { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--sky-2); min-height: 180px; }
.cal-day.today { border-color: var(--navy); box-shadow: 0 0 0 2px var(--sky); }
.cal-day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.cal-day-head span { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cal-day.today .cal-day-head { background: var(--navy); color: #fff; border-radius: calc(var(--r) - 1px) calc(var(--r) - 1px) 0 0; }
.cal-day.today .cal-day-head span { color: #fff; }
.cal-day-body { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.cal-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px 9px; border-radius: 10px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--blue); font-size: 12.5px; line-height: 1.3; min-width: 0; }
.cal-card b { overflow-wrap: anywhere; }
.cal-card .pill { font-size: 10px; padding: 2px 7px; }
.cal-card-time { font-weight: 800; font-size: 11.5px; color: var(--navy); font-variant-numeric: tabular-nums; }
.cal-card.tone-line-warn { border-left-color: var(--warn); }
.cal-card.tone-line-green { border-left-color: var(--ok); }
.cal-card.tone-line-gray { border-left-color: var(--line-2); }
.cal-card.tone-line-red { border-left-color: var(--danger); opacity: .75; }
.cal-free { background: transparent; border-style: dashed; border-left-style: dashed; border-left-color: var(--line-2); color: var(--muted); }
.cal-empty { padding: 4px 2px; }
.cal-week-note { margin-top: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .cu-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cu-meas-main { grid-template-columns: minmax(0, 1fr); }
  .cu-preview { position: static; }
  .cu-preview-art svg { max-height: 300px; }
  .cal-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .cu-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cu-meas { grid-template-columns: minmax(0, 1fr); }
  .cu-plist { position: static; }
  .cu-analysis { grid-template-columns: minmax(0, 1fr); }
  .cal-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cu-kpis, .cu-stats, .cu-addr, .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cu-span { grid-column: auto; }
  .cu-street { grid-template-columns: minmax(0, 1fr) 96px; }
  .cu-hero { flex-direction: column; align-items: stretch; }
  .cu-hero-main { align-items: flex-start; }
  .cu-hero-copy h2 { font-size: 22px; }
  .cu-focus { max-width: none; min-width: 0; }
  .cu-order { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .cu-assign-row { flex-wrap: wrap; }
  .cu-top { grid-template-columns: minmax(0, 1fr) auto; }
  .cu-top .cu-label { grid-column: 1 / -1; }
  .cu-timeline li { flex-direction: column; gap: 0; }
  .cu-row-actions { flex-wrap: nowrap; }
  .cu-save-row .btn { width: 100%; }
  .cu-toolbar .searchbox, .cal-toolbar .searchbox { min-width: 0; width: 100%; }
  .cal-status { width: 100%; }
  .cal-slot-list { grid-template-columns: minmax(0, 1fr); }
  .cal-day { min-height: 0; }
  .cal-weektitle { flex: 1; }
}
@media print {
  .cu-row-actions, .cu-save-row, .cu-plist, .cal-slot-form { display: none !important; }
}
