/* Kundenportal. Farben kommen aus /theme.css (Branding aus dem mStudio). */
:root {
  --brand: #0C0A06;        /* Kopfzeile */
  --accent: #C6B085;       /* Buttons, Linien */
  --on-brand: #F2EDE2;
  --on-accent: #0C0A06;
  --bg: #F6F3EC;
  --surface: #FFFFFF;
  --text: #191510;
  --muted: #5E564A;
  --line: #E4DDCF;
  --danger: #B3261E;
  --warn: #9A6700;
  --ok: #1E6B3A;
  --radius: 4px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-top: 28px; padding-bottom: 48px; }
a { color: inherit; }
h1 { font-weight: 300; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0 0 24px; letter-spacing: -0.01em; }
h2 { font-weight: 500; font-size: 19px; margin: 0 0 14px; }
p { margin: 0 0 12px; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--bg); padding: 1px 5px; border-radius: 3px; word-break: break-all; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 14px; }
.kicker { font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kicker::before { content: "/ "; color: var(--accent); }

/* Kopfzeile */
.topbar { background: var(--brand); color: var(--on-brand); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { max-height: 32px; max-width: 260px; display: block; }
.brand-name { font-size: 18px; font-weight: 500; letter-spacing: .02em; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topbar-user .muted { color: var(--on-brand); opacity: .7; }
.topbar-user form { margin: 0; }
.link-button { background: none; border: 0; color: var(--on-brand); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

.subnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.subnav-inner { display: flex; gap: 4px; overflow-x: auto; align-items: center; }
.subnav a { text-decoration: none; padding: 14px 12px; white-space: nowrap; border-bottom: 2px solid transparent; color: var(--muted); }
.subnav a.active, .subnav a:hover { color: var(--text); border-bottom-color: var(--accent); }
.subnav .crumb { padding-left: 0; }
.subnav .sep { color: var(--line); }

/* Karten und Listen */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.form-card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.form-card > summary::-webkit-details-marker { display: none; }
.form-card > summary h2 { margin: 0; }
.form-card > summary::after { content: "+"; font-size: 24px; color: var(--accent); line-height: 1; }
.form-card[open] > summary::after { content: "–"; }
.form-card[open] > summary { margin-bottom: 18px; }

.tiles { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; height: 100%; }
.tile:hover, .tile:focus-visible { border-color: var(--accent); }
.tile strong { font-weight: 500; font-size: 17px; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { border-top: 1px solid var(--line); padding: 14px 0; }
.row:first-child { border-top: 0; padding-top: 0; }
.row-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.row-main > div:first-child { min-width: 0; flex: 1 1 280px; }
.row-buttons { display: flex; gap: 8px; align-items: center; }
.row-buttons form { margin: 0; }
.row-actions { margin-top: 10px; }
.row-actions > summary { cursor: pointer; font-size: 14px; color: var(--muted); width: max-content; }
.row-actions[open] > summary { margin-bottom: 12px; color: var(--text); }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; background: var(--bg); padding: 14px; border-radius: var(--radius); }
.danger-zone .button { align-self: flex-start; }

.usage { min-width: 160px; text-align: right; }
.badge { display: inline-block; font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); margin-left: 6px; vertical-align: 2px; }
.badge.warn { color: var(--warn); border-color: currentColor; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 18px; margin: 12px 0 0; }
.facts.compact { grid-template-columns: repeat(auto-fill, minmax(200px, max-content)); margin-top: 6px; }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-family: var(--mono); }
.facts dd { margin: 0; }
.heading-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }

/* Fortschrittsbalken */
progress.meter { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border: 0; border-radius: 5px; background: var(--line); overflow: hidden; margin: 4px 0 10px; display: block; }
progress.meter.small { height: 6px; margin: 2px 0 4px; }
progress.meter::-webkit-progress-bar { background: var(--line); }
progress.meter::-webkit-progress-value { background: var(--accent); }
progress.meter::-moz-progress-bar { background: var(--accent); }
progress.meter.warn::-webkit-progress-value { background: var(--warn); }
progress.meter.warn::-moz-progress-bar { background: var(--warn); }
progress.meter.danger::-webkit-progress-value { background: var(--danger); }
progress.meter.danger::-moz-progress-bar { background: var(--danger); }

/* Formulare */
.stack { display: flex; flex-direction: column; gap: 12px; margin: 0; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 500; }
label .muted { font-weight: 400; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid #CFC6B5; border-radius: var(--radius); padding: 9px 11px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea { resize: vertical; }
fieldset.choice { border: 0; padding: 0; margin: 0; display: flex; gap: 18px; flex-wrap: wrap; }
fieldset.choice legend { font-size: 14px; font-weight: 500; margin-bottom: 6px; padding: 0; }
fieldset.choice label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 15px; }
fieldset.choice input { width: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.address-input { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.address-input .at { padding-bottom: 10px; color: var(--muted); }
@media (max-width: 520px) { .address-input { grid-template-columns: 1fr; } .address-input .at { display: none; } }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 500 14px/1 var(--sans); letter-spacing: .02em; padding: 11px 16px; border-radius: var(--radius); border: 1px solid var(--text); background: transparent; color: var(--text); cursor: pointer; text-decoration: none; align-self: flex-start; }
.button:hover { background: var(--bg); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { filter: brightness(.95); }
.button.danger { border-color: var(--danger); color: var(--danger); }
.button.danger:hover { background: var(--danger); color: #fff; }
.button.small { padding: 7px 10px; font-size: 13px; }

/* Hinweise */
.flash { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); padding: 14px 16px; border-radius: var(--radius); margin-bottom: 18px; }
.flash p { margin: 0; }
.flash-ok { border-left-color: var(--ok); }
.flash-error { border-left-color: var(--danger); }
.flash-secret { border-left-color: var(--warn); }
.secret { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.secret code { font-size: 16px; padding: 6px 10px; border: 1px dashed var(--line); background: var(--bg); }

/* Login */
.login { display: flex; justify-content: center; padding-top: 6vh; }
.login-card { width: 100%; max-width: 420px; }
.login-card .button { align-self: stretch; padding: 13px; }

.footer { border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }

@media (max-width: 600px) {
  .card { padding: 16px; }
  .usage { text-align: left; min-width: 0; width: 100%; }
  .topbar-user .muted { display: none; }
}
