/* Verpackungs-Konformität — hell/dunkel über CSS-Variablen, tastaturfreundlich */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #1c2430;
  --text-muted: #5b6675;
  --border: #d7dce3;
  --accent: #1f6feb;
  --accent-contrast: #ffffff;
  --ok: #1a7f37;
  --ok-bg: #e2f5e8;
  --open: #9a6700;
  --open-bg: #fff3d1;
  --fail: #c72222;
  --fail-bg: #ffe1e1;
  --info-bg: #e7f0fd;
  --shadow: 0 1px 3px rgba(16, 24, 40, .09);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151b;
    --surface: #1a2029;
    --surface-2: #232b37;
    --text: #e6eaf0;
    --text-muted: #9aa6b5;
    --border: #333d4b;
    --accent: #4c8dff;
    --accent-contrast: #0b1220;
    --ok: #4ac26b; --ok-bg: #12341d;
    --open: #e3b341; --open-bg: #3a2d10;
    --fail: #ff6b6b; --fail-bg: #43191c;
    --info-bg: #16283f;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #11151b; --surface: #1a2029; --surface-2: #232b37;
  --text: #e6eaf0; --text-muted: #9aa6b5; --border: #333d4b;
  --accent: #4c8dff; --accent-contrast: #0b1220;
  --ok: #4ac26b; --ok-bg: #12341d;
  --open: #e3b341; --open-bg: #3a2d10;
  --fail: #ff6b6b; --fail-bg: #43191c;
  --info-bg: #16283f; --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, "Segoe UI", Roboto, sans-serif;
  display: flex; min-height: 100vh; flex-direction: column;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; width: 100%; }
main.wrap { flex: 1; padding-top: 1.5rem; padding-bottom: 3rem; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--accent);
  color: var(--accent-contrast); padding: .5rem 1rem; z-index: 100; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Kopfzeile */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding-top: .6rem; padding-bottom: .6rem; flex-wrap: nowrap; }
.brand { display: flex; gap: .6rem; align-items: center; color: var(--text); line-height: 1.15; white-space: nowrap; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand small { color: var(--text-muted); }
.brand-mark { font-size: 1.6rem; }
.nav-area { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.header-inner > .user-box { margin-left: auto; }
.main-nav { display: flex; gap: .15rem; flex-wrap: nowrap; }
.main-nav a { padding: .45rem .65rem; border-radius: 7px; color: var(--text); white-space: nowrap; }
.main-nav a:hover { background: var(--surface-2); text-decoration: none; }
.main-nav a.active { background: var(--accent); color: var(--accent-contrast); }
.user-box { display: flex; align-items: center; gap: .5rem; }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 7px; color: var(--text); cursor: pointer; padding: .3rem .55rem; font-size: 1rem; }
.user-menu { position: relative; }
.user-menu summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 50%; color: var(--text); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.user-menu[open] summary { background: var(--surface-2); }
.user-menu-body {
  position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
  min-width: 200px; padding: .4rem; display: flex; flex-direction: column; z-index: 50;
}
.user-menu-body a, .user-menu-body button { padding: .45rem .6rem; border-radius: 6px; color: var(--text); text-align: left; }
.user-menu-body a:hover, .user-menu-body button:hover { background: var(--surface-2); text-decoration: none; }
.user-menu-body button.linklike { padding: .45rem .6rem; color: var(--text); }
.user-menu-body button.linklike:hover { text-decoration: none; }
.user-menu-head { padding: .35rem .6rem .55rem; margin-bottom: .3rem; border-bottom: 1px solid var(--border); white-space: nowrap; line-height: 1.3; }
.user-menu-head small { color: var(--text-muted); }

/* Fußzeile */
.site-footer { border-top: 1px solid var(--border); color: var(--text-muted); font-size: .85rem; padding: .8rem 0; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Meldungen */
.messages { margin-bottom: 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.message { padding: .65rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--info-bg); }
.message.success { background: var(--ok-bg); border-color: var(--ok); }
.message.warning { background: var(--open-bg); border-color: var(--open); }
.message.error { background: var(--fail-bg); border-color: var(--fail); }

/* Überschriften & Seitenkopf */
.sub-nav { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.sub-nav a { padding: .45rem .75rem; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-muted); }
.sub-nav a:hover { color: var(--text); text-decoration: none; }
.sub-nav a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h1 { margin: 0; font-size: 1.45rem; }
.page-head .sub { color: var(--text-muted); margin-top: .15rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Karten & KPI */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.card h2 { margin: 0 0 .8rem; font-size: 1.05rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: .9rem 1.1rem; }
.kpi .num { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.kpi .lbl { color: var(--text-muted); font-size: .85rem; }
.kpi.ok .num { color: var(--ok); }
.kpi.open .num { color: var(--open); }
.kpi.fail .num { color: var(--fail); }
.kpi.deadline .num { color: var(--accent); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; white-space: nowrap; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; }

/* Status-Ampel */
.badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.badge.small { font-size: .72rem; padding: .05rem .45rem; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); }
.badge.open { background: var(--open-bg); color: var(--open); border: 1px solid var(--open); }
.badge.fail { background: var(--fail-bg); color: var(--fail); border: 1px solid var(--fail); }
.badge.neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* Formulare */
form.stacked p, .field { margin: 0 0 .9rem; }
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input[type="text"], input[type="number"], input[type="date"], input[type="password"],
input[type="email"], input[type="file"], select, textarea {
  width: 100%; max-width: 620px; padding: .5rem .6rem; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface); color: var(--text); font: inherit;
}
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.checkbox-row { display: flex; gap: .5rem; align-items: flex-start; }
.checkbox-row label { font-weight: 600; margin: 0; }
.helptext { display: block; color: var(--text-muted); font-size: .83rem; margin-top: .2rem; }
.errorlist { color: var(--fail); margin: .2rem 0 0; padding-left: 1.1rem; }

.btn {
  display: inline-block; background: var(--accent); color: var(--accent-contrast);
  border: 1px solid transparent; padding: .5rem .95rem; border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--fail); color: #fff; }
.btn.small { padding: .25rem .6rem; font-size: .84rem; }
.btn:disabled { opacity: .65; cursor: progress; filter: none; }
.spinner {
  display: inline-block; width: .9em; height: .9em; margin-right: .45em; vertical-align: -.1em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } }
button.linklike { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
button.linklike:hover { text-decoration: underline; }

/* Filterzeile */
.filter-bar { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar > div { min-width: 150px; }
.filter-bar label { font-size: .8rem; color: var(--text-muted); }
.filter-bar input, .filter-bar select { max-width: 230px; }

/* Prüfliste auf Detailseiten */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); align-items: baseline; }
.checklist li:last-child { border-bottom: none; }
.check-icon { flex: 0 0 auto; font-weight: 700; }
.check-icon.ok { color: var(--ok); }
.check-icon.open { color: var(--open); }
.check-icon.fail { color: var(--fail); }
.check-detail { color: var(--text-muted); font-size: .87rem; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.props dt { color: var(--text-muted); }
dl.props dd { margin: 0; }

.role-head td { background: var(--surface-2); font-weight: 700; color: var(--text-muted); }
.empty { color: var(--text-muted); font-style: italic; padding: 1rem 0; }

/* Login */
.login-card { max-width: 420px; margin: 8vh auto; }

/* EU-Länder & Zielmärkte */
.flag { font-size: 1.15em; margin-right: .3rem; }
.wrap.wide { max-width: none; }
.country-table { table-layout: fixed; width: 100%; }
.country-table td { font-size: .88rem; white-space: normal; overflow-wrap: anywhere; }
.country-table th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.country-table .lbl { display: block; color: var(--text-muted); font-size: .75rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--text-muted); font-size: .85rem; margin: .5rem 0 0; }
.sources { margin: 0; padding-left: 1.2rem; font-size: .88rem; }
.sources li { margin-bottom: .25rem; }
.prose { max-width: 72ch; white-space: pre-line; }
.notice { padding: .8rem 1rem; border-radius: 8px; background: var(--info-bg); border: 1px solid var(--border); margin-bottom: 1.25rem; }
.inline-form { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; min-width: 200px; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; align-items: start; }
.section-grid.two { grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)); }
.section-grid .card { margin-bottom: 0; min-width: 0; }
.section-grid dl.props { grid-template-columns: 8.5rem 1fr; }
.section-grid dl.props dd { min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.small-text { font-size: .85rem; margin-top: .15rem; }
.country-table td.country { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-table { table-layout: fixed; width: 100%; }
.market-table td, .market-table th { white-space: normal; overflow-wrap: anywhere; }
.country-table tr:has(+ .summary-row) td { border-bottom: none; }
.country-table .summary-row td { padding: 0 .65rem .9rem 2.4rem; color: var(--text-muted); font-size: .88rem; }
.country-table .summary-row .prose { max-width: 90ch; }
.country-table .summary-row:hover, .country-table tr:has(+ .summary-row):hover { background: transparent; }
.notice .prose { display: inline; }
@media (max-width: 640px) { .section-grid.two { grid-template-columns: 1fr; } .section-grid dl.props { grid-template-columns: 1fr; } }
.timeline td.date { white-space: nowrap; font-weight: 600; }
.relevance-hoch { color: var(--fail); font-weight: 700; }
.relevance-mittel { color: var(--open); font-weight: 600; }
.relevance-niedrig { color: var(--text-muted); }

/* Pflichten-Check */
.steps { display: flex; gap: .4rem; flex-wrap: wrap; list-style: none; margin: 0 0 1.1rem; padding: 0; font-size: .88rem; }
.steps li { padding: .3rem .8rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.steps li.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); font-weight: 600; }
.steps li.done { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.steps li a { color: inherit; }
.q-block { margin: 0 0 1.5rem; padding-bottom: 1.2rem; border-bottom: 1px dashed var(--border); }
.q-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.q-block h3 { margin: 0 0 .25rem; font-size: 1rem; }
.q-block > label, .q-label { display: block; font-weight: 600; margin: 0 0 .25rem; }
.q-why { color: var(--text-muted); font-size: .86rem; margin: 0 0 .6rem; max-width: 80ch; }
.choices > div { display: flex; flex-direction: column; gap: .35rem; }
.choices.grid > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.choices label { display: flex; gap: .55rem; align-items: flex-start; font-weight: 500; padding: .45rem .65rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; margin: 0; background: var(--surface); }
.choices label:hover { background: var(--surface-2); }
.choices input { margin-top: .25rem; flex: 0 0 auto; }
.choices label:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }
.choice-help { display: block; color: var(--text-muted); font-size: .82rem; font-weight: 400; margin-top: .1rem; }
.check-row { display: flex; gap: .55rem; align-items: flex-start; padding: .35rem 0; }
.check-row label { font-weight: 500; margin: 0; }
.check-row input { margin-top: .25rem; }
.country-block { border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 1.1rem; background: var(--surface); scroll-margin-top: 1rem; }
.country-block > h2 { margin: 0 0 .6rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.country-block .profile-facts { display: flex; gap: 1rem .9rem; flex-wrap: wrap; color: var(--text-muted); font-size: .85rem; margin: 0 0 .9rem; }
.country-block .profile-facts strong { color: var(--text); font-weight: 600; }
.country-block .q-block { margin-bottom: 1rem; padding-bottom: .8rem; }
.findings { list-style: none; margin: 0; padding: 0; }
.findings li { display: flex; gap: .65rem; padding: .5rem 0; border-bottom: 1px dashed var(--border); align-items: flex-start; }
.findings li:last-child { border-bottom: none; }
.findings .f-body { min-width: 0; flex: 1; }
.findings .f-title { font-weight: 600; }
.f-icon { flex: 0 0 1.55rem; height: 1.55rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; margin-top: .05rem; }
.f-icon.pflicht { background: var(--fail-bg); color: var(--fail); }
.f-icon.pruefen { background: var(--open-bg); color: var(--open); }
.f-icon.info { background: var(--info-bg); color: var(--accent); }
.f-icon.ok, .f-icon.entfaellt { background: var(--ok-bg); color: var(--ok); }
.f-detail { color: var(--text-muted); font-size: .87rem; white-space: pre-line; max-width: 90ch; overflow-wrap: anywhere; }
.f-legal { display: block; font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }
.f-legal .from { color: var(--accent); font-weight: 600; }
.f-tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; margin-left: .35rem; vertical-align: middle; }
.f-tag.pflicht { background: var(--fail-bg); color: var(--fail); }
.f-tag.pruefen { background: var(--open-bg); color: var(--open); }
.f-tag.info { background: var(--info-bg); color: var(--accent); }
.f-tag.ok, .f-tag.entfaellt { background: var(--ok-bg); color: var(--ok); }
.verdict { padding: .8rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: .9rem; }
.verdict.open { background: var(--open-bg); border-color: var(--open); }
.verdict.ok { background: var(--ok-bg); border-color: var(--ok); }
.verdict.neutral { background: var(--info-bg); }
.verdict p { margin: .35rem 0 0; max-width: 90ch; }
.answers-inline { display: flex; gap: .4rem 1.1rem; flex-wrap: wrap; font-size: .84rem; color: var(--text-muted); margin: .4rem 0 .9rem; }
.answers-inline span strong { color: var(--text); font-weight: 600; }
.rule-group { margin-bottom: 1.25rem; }
.rule-group h3 { margin: 0 0 .2rem; font-size: 1rem; }
.rule-group .legal { color: var(--text-muted); font-size: .85rem; margin: 0 0 .5rem; }
.rule-group details { margin-top: .5rem; }
.rule-group details summary { cursor: pointer; color: var(--text-muted); font-size: .88rem; }
.rule-group details .findings li { padding: .3rem 0; }
.check-table td.nowrap a { white-space: nowrap; }
.disclaimer { border-left: 3px solid var(--open); padding-left: .9rem; color: var(--text-muted); font-size: .88rem; }

@media print {
  .site-header, .site-footer, .sub-nav, .actions, .steps, .no-print, .messages, .skip-link { display: none !important; }
  body { font-size: 11.5px; background: #fff; color: #000; }
  .wrap { max-width: none; padding: 0; }
  .card, .country-block { box-shadow: none; break-inside: avoid; border-color: #bbb; }
  .kpi-grid { grid-template-columns: repeat(6, 1fr); }
  .rule-group details { display: none; }
  a { color: inherit; text-decoration: none; }
}
