/* Korkly Admin – gemeinsames Grundlayout für Kunden-Admin und Super-Admin.
   Gestaltung nur über die Variablen unten; Themes setzen andere Werte. */
:root {
  --accent: #7a1f2e;
  --accent-contrast: #ffffff;
  --bg: #f6f5f3;
  --surface: #ffffff;
  --text: #1f1d1b;
  --muted: #6b6560;
  --border: #e2ddd7;
  --success: #17803d;
  --warning: #a15c00;
  --danger: #b42318;
  --info: #1d5fa8;
  --radius: 8px;
  --space: 1rem;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sidebar: 230px;
}
.theme-platform { --accent: #24435f; }
.theme-staging { --accent: #2d6a8a; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { background: #efebe6; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; word-break: break-all; }

/* Rahmen */
.banner { background: #fff1c2; color: #5a3d00; border-bottom: 2px solid #e0b100; padding: .6rem 1rem; text-align: center; font-weight: 600; }
.banner form { display: inline; margin-left: .75rem; }
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--accent); color: var(--accent-contrast); }
.topbar a { color: inherit; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; }
.env { background: rgba(255,255,255,.2); border-radius: 999px; padding: .05rem .6rem; font-size: .8rem; text-transform: uppercase; }
.spacer { flex: 1; }
.usermenu { display: flex; align-items: center; gap: .75rem; }
.user { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user small { opacity: .8; font-size: .8rem; }
.topbar .btn--ghost { color: var(--accent-contrast); border-color: rgba(255,255,255,.4); }
.nav-toggle { display: none; background: none; border: 0; color: inherit; font-size: 1.4rem; cursor: pointer; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .5rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: .55rem .8rem; border-radius: 6px; color: var(--text); text-decoration: none; }
.sidebar a:hover { background: var(--bg); }
.sidebar a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
.main { padding: 1.5rem; max-width: 1100px; width: 100%; }

/* Seitenkopf, Karten, Raster */
.page-header { margin-bottom: 1.25rem; }
.page-header__row { display: flex; gap: 1rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-header .back { display: inline-block; margin-bottom: .35rem; font-size: .9rem; text-decoration: none; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card--danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.stat__value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat__label { color: var(--muted); font-size: .9rem; }
.stat--danger .stat__value { color: var(--danger); }
.stat--success .stat__value { color: var(--success); }
.stat--warning .stat__value { color: var(--warning); }
a.stat:hover { border-color: var(--accent); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 2rem 1rem; }
.empty__title { font-weight: 600; font-size: 1.05rem; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions-col { text-align: right; white-space: nowrap; }
.table .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg); }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }

/* Badges & Hinweise */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #ece8e3; color: var(--text); white-space: nowrap; }
.badge--success { background: #dcf3e3; color: var(--success); }
.badge--warning { background: #fdf0d5; color: var(--warning); }
.badge--danger { background: #fde2df; color: var(--danger); }
.badge--info { background: #e0ecf8; color: var(--info); }
.notice { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.notice ul { margin: .25rem 0 0 1.2rem; padding: 0; }
.notice--info { background: #eef5fc; border-color: #c4dbf2; color: #18456f; }
.notice--success { background: #ecf8f0; border-color: #bde5c9; color: #135f2e; }
.notice--warning { background: #fff7e6; border-color: #f2d49b; color: #6b4200; }
.notice--danger { background: #fdeeec; border-color: #f3c1bb; color: #8a1c13; }
.notice--neutral { background: var(--surface); border-color: var(--border); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 40px; padding: .45rem 1rem; border-radius: 6px; border: 1px solid transparent; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { filter: brightness(1.1); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--accent); }
.btn--danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.btn--danger:hover { background: #fdeeec; }
.btn--ghost { background: transparent; color: inherit; border-color: var(--border); }
form.inline { display: inline; }

/* Formulare */
.form { max-width: 720px; }
.field { margin-bottom: 1rem; }
.field > label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field input:not([type="checkbox"]), .field select, .field textarea, .filterbar input, .filterbar select, .copybox input {
  width: 100%; min-height: 42px; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; font: inherit; color: inherit;
}
.field textarea { min-height: 6rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; }
.field--error input, .field--error select, .field--error textarea { border-color: var(--danger); }
.field .hint { color: var(--muted); font-size: .88rem; margin: .3rem 0 0; }
.field .error { color: var(--danger); font-size: .9rem; margin: .3rem 0 0; font-weight: 600; }
.field--check { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.field--check input { width: 1.2rem; height: 1.2rem; }
.field--check label { font-weight: 500; margin: 0; }
.field--check .hint, .field--check .error { flex-basis: 100%; }
.req { color: var(--danger); }
.preview { display: block; max-width: 180px; max-height: 180px; border-radius: 6px; margin-bottom: .5rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 1rem; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem 0; margin: 0 0 1rem; }
.fieldset legend { font-weight: 700; padding: 0 .35rem; }
.form__actions { display: flex; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.filterbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filterbar input { flex: 1 1 220px; width: auto; }
.filterbar select { width: auto; }
.copybox { display: flex; gap: .5rem; }
.copybox input { font-family: ui-monospace, monospace; font-size: .85rem; }
.codes { columns: 2; font-family: ui-monospace, monospace; padding-left: 1.2rem; }
pre.log { background: #1f1d1b; color: #e9e4dc; padding: 1rem; border-radius: var(--radius); overflow: auto; font-size: .82rem; line-height: 1.45; max-height: 60vh; }

/* Login & Co. */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; width: 100%; max-width: 420px; }
.auth-box .brand { color: var(--accent); margin-bottom: .5rem; }
.auth-box .env { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.auth-box h1 { margin-bottom: 1.25rem; }
.auth-box .btn--primary { width: 100%; }

/* Mobil */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-block; }
  .sidebar { display: none; border-right: 0; border-bottom: 1px solid var(--border); }
  body.nav-open .sidebar { display: block; }
  .user small { display: none; }
  .main { padding: 1rem; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--border); padding: .5rem 0; }
  .table td { border: 0; padding: .2rem 0; text-align: left !important; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  .table td.actions-col::before, .table td.thumb-col::before { content: ""; }
  .codes { columns: 1; }
}
