/* Deutschkursebildung Operational — design tokens derived from the logo (gold #FAD430 on white) */
:root {
  --gold: #FAD430;
  --gold-100: #FFF8D6;
  --gold-200: #FDEB99;
  --gold-600: #D4B11E;
  --gold-700: #8C7009;
  --ink: #1C1B17;
  --ink-2: #2A2822;
  --ink-3: #3A372F;
  --bg: #F6F5F0;
  --surface: #FFFFFF;
  --surface-2: #FBFAF6;
  --border: #E6E2D6;
  --border-strong: #D3CEBE;
  --text: #22201B;
  --muted: #6A6659;
  --faint: #9A9585;
  --green: #2F7D4F; --green-bg: #E7F4EC;
  --blue: #2A62A8;  --blue-bg: #E6EEF9;
  --amber: #9A6A06; --amber-bg: #FDF3D7;
  --red: #B42D2D;   --red-bg: #FBE9E9;
  --gray: #5F5B50;  --gray-bg: #EFEDE6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(28, 27, 23, .06), 0 1px 1px rgba(28, 27, 23, .03);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Inter', system-ui, sans-serif;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--gold-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 .5rem; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
:focus-visible { outline: 2px solid var(--gold-600); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--ink); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--ink); color: #E9E6DC; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand img { width: 34px; height: 34px; }
.brand strong { font-family: var(--font-display); font-size: 15px; color: #fff; display: block; line-height: 1.15; }
.brand span { font-size: 11px; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; }
.nav { padding: 10px 10px 24px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group > span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #8E897A; padding: 0 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #D9D5C9; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; }
.nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--ink-3); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.sidebar-foot { padding: 12px 18px; font-size: 11.5px; color: #8E897A; border-top: 1px solid rgba(255,255,255,.06); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.topbar .title { font-family: var(--font-display); font-weight: 600; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.usermenu .who { line-height: 1.2; text-align: right; }
.usermenu .who small { display: block; font-size: 11.5px; }
.content { padding: 24px; max-width: 1360px; width: 100%; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--faint); }
.btn-primary { background: var(--gold); border-color: var(--gold-600); color: var(--ink); font-weight: 600; }
.btn-primary:hover { background: #F2C91F; border-color: var(--gold-700); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-3); }
.btn-danger { color: var(--red); border-color: #E5BDBD; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-link { border: 0; background: none; color: var(--gold-700); padding: 0; height: auto; font: inherit; cursor: pointer; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; }

/* ---------- Cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 16px 18px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack > * + * { margin-top: 16px; }

/* ---------- KPI ---------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; box-shadow: var(--shadow); }
.kpi:hover { border-color: var(--border-strong); }
.kpi .k-label { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.kpi .k-value { font-family: var(--font-display); font-size: 24px; font-weight: 600; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi a.k-link { position: absolute; inset: 0; border-radius: var(--radius); }
.kpi a.k-link:focus-visible { outline-offset: -2px; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); }
.kpi-accent { border-top: 3px solid var(--gold); }
.info-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-strong); font-size: 10px; color: var(--muted); cursor: help; position: relative; z-index: 2; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 0 10px; gap: 12px; flex-wrap: wrap; }
.section-title h2 { font-size: 15px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: var(--gray-bg); color: var(--gray); }
.tag-actual { background: var(--green-bg); color: var(--green); }
.tag-target { background: var(--blue-bg); color: var(--blue); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
th a { color: inherit; }
tbody tr:hover { background: #FCFBF7; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.row-muted td { color: var(--faint); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; gap: 4px; }
.pager a, .pager span { min-width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 12.5px; }
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .disabled { color: var(--faint); }
dl.meta { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; }
dl.meta dt { color: var(--muted); font-size: 13px; }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--ink-3); }
.field .req { color: var(--red); }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=month], input[type=search], input[type=tel], input[type=url], input[type=file], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; font: 14px var(--font); color: var(--text);
}
input[type=file] { padding: 6px; height: auto; }
textarea { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-600); box-shadow: 0 0 0 3px rgba(250, 212, 48, .35); }
.is-invalid { border-color: var(--red) !important; }
.field-error { color: var(--red); font-size: 12px; margin: 4px 0 0; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--gold-600); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 260px; }
.filters .field label { font-weight: 500; color: var(--muted); }
.filters .grow { flex: 2 1 220px; max-width: 360px; }
.rangebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.rangebar .field { min-width: 140px; }
.mini-table input, .mini-table select { height: 32px; font-size: 13px; }
.mini-table td { padding: 6px 8px; }

/* ---------- Alerts / flash / empty ---------- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.flash-success { background: var(--green-bg); border-color: #B9DEC7; color: #1F5A37; }
.flash-error { background: var(--red-bg); border-color: #EDC2C2; color: #8A2121; }
.flash-info { background: var(--blue-bg); border-color: #C3D5EE; color: #1E4A80; }
.flash-warning { background: var(--amber-bg); border-color: #EBD9A3; color: #6E4C05; }
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.alerts li:last-child { border-bottom: 0; }
.alerts .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.dot-red { background: var(--red); } .dot-amber { background: #D99A0B; } .dot-blue { background: var(--blue); } .dot-green { background: var(--green); }
.empty { text-align: center; padding: 36px 18px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.empty .btn { margin-top: 10px; }
.note { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 10px 12px; border-radius: 8px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart .bar.s1, .sw.s1 { fill: var(--gold); background: var(--gold); }
.chart .bar.s2, .sw.s2 { fill: var(--ink-3); background: var(--ink-3); }
.chart .bar.s3, .sw.s3 { fill: #B8B2A0; background: #B8B2A0; }
.chart .line { stroke-width: 2.5; }
.chart .line.s1 { stroke: var(--gold-600); } .chart .dot.s1 { fill: var(--gold-600); }
.chart .line.s2 { stroke: var(--ink-3); } .chart .dot.s2 { fill: var(--ink-3); }
.chart .line.s3 { stroke: #B8B2A0; } .chart .dot.s3 { fill: #B8B2A0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.chart-empty { color: var(--muted); text-align: center; padding: 40px 0; margin: 0; }
.bar-inline { height: 6px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; min-width: 60px; }
.bar-inline i { display: block; height: 100%; background: var(--gold-600); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--gold-600); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ---------- Dialog ---------- */
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(28,27,23,.45); }
dialog .card-body { padding: 18px; }
details.disclose summary { cursor: pointer; color: var(--gold-700); font-weight: 500; list-style: none; }
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose[open] summary { margin-bottom: 12px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); background-image: radial-gradient(circle at 20% 0%, #2E2B22 0, transparent 50%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-card .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-card .logo img { width: 44px; height: 44px; }
.auth-card .logo strong { font-family: var(--font-display); font-size: 17px; display: block; }
.auth-card .logo span { font-size: 12px; color: var(--muted); }
.auth-card .field + .field { margin-top: 14px; }
.auth-card .btn { width: 100%; margin-top: 18px; height: 40px; }
.bare { max-width: 720px; margin: 40px auto; padding: 0 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .usermenu .who { display: none; }
  dl.meta { grid-template-columns: 1fr; gap: 2px; }
  dl.meta dd { margin-bottom: 8px; }
  .filters .field { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .sidebar, .topbar, .actions, .filters, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; }
  body { background: #fff; }
}
.range-label { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
meter { width: 100%; min-width: 70px; height: 8px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-s { margin-top: 8px; }
.right { text-align: right; } .center { text-align: center; }
.w-sm { max-width: 120px; } .w-md { max-width: 220px; }
.hstack { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.pre { white-space: pre-wrap; }
.codebox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 160px; }
.big { font-size: 18px; font-weight: 600; font-family: var(--font-display); }
a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--gold-600); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink-3); padding: 0; }
fieldset.field .check + .check { margin-top: 6px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--gray-bg); padding: 1px 5px; border-radius: 4px; }
.auth-card.auth-wide { max-width: 520px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.menu-btn svg { width: 20px; height: 20px; }
.chart .axis { font-size: 12px; }
