/* Shared parts of the later model pages (Abrechnung, Rechnungen, Empfehlen, Legitimation, Stammdaten, Einstellungen):
   buttons, cards in a grid, label/value rows, fields, switches, copy chips, a stepper line. */

.btn.sm, .btn2.sm { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 13px; gap: 6px; }
.btn2.sm .ic, .btn.sm .ic { width: 15px; height: 15px; }
.btn.danger { background: var(--bad); color: #fff; }
.btn2.danger-t { color: var(--bad); }
.btn2.danger-t:hover { background: var(--bad-soft); }
.mhead .btn .ic, .mhead .btn2 .ic { width: 16px; height: 16px; }
.dlg-ic.acc { background: var(--accent-soft); color: var(--accent-text); }
.dlg-ic.ok { background: var(--ok-soft); color: var(--ok); }
.m-page .card { padding: 20px 22px; }
.m-page .card-h h2 { margin: 0; font-size: 15px; font-weight: 600; }
.m-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.m-grid > * { grid-column: span 12; min-width: 0; }
@media (min-width: 1200px) {
  .m-grid > .w4 { grid-column: span 4; } .m-grid > .w5 { grid-column: span 5; } .m-grid > .w6 { grid-column: span 6; }
  .m-grid > .w7 { grid-column: span 7; } .m-grid > .w8 { grid-column: span 8; }
}
.m-lead { margin: 0 0 18px; max-width: 80ch; color: var(--ink2); font-size: 14px; line-height: 1.55; }

/* label/value rows */
.m-rows { margin: 0; }
.m-rows > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.m-rows > div:first-child { border-top: 0; }
.m-rows dt { color: var(--ink2); font-size: 13.5px; }
.m-rows dd { margin: 0; font-size: 14px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.m-rows .sum { border-top: 1.5px solid var(--ink); }
.m-rows .sum dt, .m-rows .sum dd { color: var(--ink); font-weight: 700; }
.m-rows .minus dd { color: var(--ok); }
.m-rows .sub dt, .m-rows .sub dd { color: var(--ink3); font-size: 13px; font-weight: 400; }
.m-rows .sub { padding: 4px 0 4px 14px; border-top: 0; }

/* facts as a two-column grid (read-only master data) */
.m-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.m-facts > div { min-width: 0; }
.m-facts .wide { grid-column: 1 / -1; }
.m-facts dt { color: var(--ink3); font-size: 12px; }
.m-facts dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }

/* click to copy */
.m-copy {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--page); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: copy;
}
.m-copy:hover { border-color: var(--accent); }
.m-copy .ic { width: 14px; height: 14px; color: var(--ink3); }
.m-copy.done .ic { color: var(--ok); }

/* fields in dialogs */
.m-fields { display: grid; gap: 14px; padding: 16px 22px 0; }
.m-fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* a row of fields inside a field group: no own padding, and not the .two helper margin of statistiken.css */
.m-fields .m-fields { padding: 0; margin-top: 0; }
.m-field { display: grid; gap: 6px; min-width: 0; }
.m-field.wide { grid-column: 1 / -1; }
.m-field > span:first-child { font-size: 13.5px; font-weight: 600; }
.m-field small { color: var(--ink3); font-size: 12px; font-weight: 400; }
.m-field input, .m-field select, .m-field textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--page); color: var(--ink); font-size: 14px;
}
.m-field textarea { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.m-field input:focus, .m-field select:focus, .m-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.m-field input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.m-err { margin: 0; color: var(--bad); font-size: 12.5px; }
.m-hint { margin: 0; color: var(--ink3); font-size: 12.5px; line-height: 1.45; }
.m-drop {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 22px 16px; border: 1.5px dashed var(--line2); border-radius: 14px;
  background: var(--page); color: var(--ink2); text-align: center; cursor: pointer;
}
.m-drop:hover, .m-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.m-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.m-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.m-drop .ic { width: 24px; height: 24px; color: var(--ink3); }
.m-drop b { color: var(--ink); }
.m-drop span { font-size: 12.5px; }

/* switch */
.m-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.m-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-ui { position: relative; flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line2); transition: background-color .15s; }
.sw-ui::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s var(--ease); }
input:checked + .sw-ui { background: var(--accent); }
input:checked + .sw-ui::after { transform: translateX(16px); }
input:focus-visible + .sw-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
input:disabled + .sw-ui { opacity: .45; }

/* segmented control */
.m-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: var(--sunken); }
.m-seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.m-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px var(--shadow-c), 0 0 0 1px var(--line); }
/* the same control as radio buttons in a plain form (no script): <label><input type="radio"><span>Text</span></label> */
.m-seg label { position: relative; display: inline-flex; }
.m-seg label input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.m-seg label span {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; color: var(--ink2); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s;
}
.m-seg label span:hover { color: var(--ink); }
.m-seg label input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px var(--shadow-c), 0 0 0 1px var(--line); }
.m-seg label input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { .m-seg label span { transition: none; } }

/* a sequence of steps (Legitimation) */
.m-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.m-steps li { position: relative; display: grid; justify-items: center; gap: 6px; padding: 0 6px; color: var(--ink3); font-size: 13px; text-align: center; }
.m-steps li::before { content: counter(s); counter-increment: s; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--sunken); color: var(--ink2); font-weight: 700; z-index: 1; }
.m-steps li::after { content: ""; position: absolute; top: 15px; left: calc(-50% + 15px); right: calc(50% + 15px); height: 2px; background: var(--line2); }
.m-steps li:first-child::after { display: none; }
.m-steps li.done { color: var(--ink); }
.m-steps li.done::before { content: "✓"; background: var(--ok); color: #fff; }
.m-steps li.done::after { background: var(--ok); }
.m-steps li.now { color: var(--ink); font-weight: 600; }
.m-steps li.now::before { background: var(--accent); color: var(--on-accent); }

/* plain tables */
.m-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.m-table th { padding: 8px 10px; border-bottom: 1px solid var(--line2); color: var(--ink3); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
.m-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.m-table .r { text-align: right; }
.m-table tr:last-child td { border-bottom: 0; }
.m-wrap { overflow-x: auto; }
.m-empty { display: grid; justify-items: center; align-content: center; gap: 6px; padding: 32px 16px; color: var(--ink2); text-align: center; }
.m-page .card:has(> .m-empty) { display: flex; flex-direction: column; }
.m-page .card > .m-empty { flex: 1; }
.m-empty > .ic { width: 24px; height: 24px; color: var(--ok); }
.m-empty b { color: var(--ink); }
.m-empty p { margin: 0; font-size: 13.5px; }
.dlg-f .spacer { flex: 1; }

@media (max-width: 700px) {
  .m-facts, .m-fields.two { grid-template-columns: minmax(0, 1fr); }
  .m-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .m-steps li:nth-child(3)::after { display: none; }
}

/* a quiet note in a page ("Konten kannst du erst nach der Legitimation verknüpfen"): on every page, not only where
   model-person.css is loaded - Plattformen, Abrechnung and Empfehlen showed it as bare text */
.pp-note { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--sunken); color: var(--ink2); font-size: 13.5px; line-height: 1.5; }
.pp-note .ic { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.pp-note.bad { background: var(--bad-soft); color: var(--ink); }
.pp-note.bad .ic { color: var(--bad); }

/* inline text links on the later model pages */
.m-page .m-hint a, .m-page .ks-links a, .m-page .pp-note a, .mpage .pp-note a { color: var(--accent-text); font-weight: 600; text-underline-offset: 2px; }
.m-page .card-h h2:has(.pp-hi) { display: flex; align-items: center; }
.m-page .card-h h2 .pp-hi { vertical-align: 0; }

/* tables that stack on phones: first cell is the title, the last one (action or date) sits on the right,
   the others become labelled lines (data-l) */
@media (max-width: 600px) {
  .m-stack thead { display: none; }
  .m-stack, .m-stack tbody { display: block; }
  .m-stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .m-stack tr:last-child { border-bottom: 0; }
  .m-stack td { padding: 2px 0; border: 0; text-align: left; }
  .m-stack td:not(:last-child) { grid-column: 1; }
  .m-stack td:last-child { grid-column: 2; grid-row: 1 / span 6; align-self: center; text-align: right; }
  .m-stack td[data-l]::before { content: attr(data-l) ": "; color: var(--ink3); font-size: 12.5px; }
  .m-stack td.r { text-align: left; }
}

/* disabled and working buttons: clearly not pressable */
.btn:disabled, .btn2:disabled { background: var(--sunken); color: var(--ink3); border-color: var(--line); cursor: not-allowed; filter: none; box-shadow: none; }
.btn.busy, .btn2.busy { cursor: progress; }
/* an empty list that is not a success: neutral symbol */
.m-empty.neutral > .ic { color: var(--ink3); }

/* overview ledger: the "Jetzt hinterlegen" link in the portal accent, not the browser's blue */
.lg-foot a.lg-link { color: var(--accent-text); font-weight: 600; text-underline-offset: 2px; }
