/* Verkäuferhandbuch – Stile für das iPad im Design von gruber-kg.de
   (Schrift Muli/Mulish, Gruber-Rot, Lindgrün, eckige Kanten, kursive Versal-Überschriften) */

/* Mulish = frei lizenzierte Muli (SIL OFL), lokal für den Offline-Betrieb */
@font-face { font-family: "Mulish"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/mulish-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/mulish-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/mulish-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-style: normal; font-weight: 900; font-display: swap; src: url(fonts/mulish-latin-900-normal.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-style: italic; font-weight: 800; font-display: swap; src: url(fonts/mulish-latin-800-italic.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-style: italic; font-weight: 900; font-display: swap; src: url(fonts/mulish-latin-900-italic.woff2) format("woff2"); }

:root {
  /* Markenfarben (gruber-kg.de) */
  --gruber-red: #e2000f;
  --gruber-green: #b4c71a;
  --gruber-green-dark: #5f6a00;
  --gruber-green-soft: #f1f5d1;
  --gruber-grey: #575656;

  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --text: #222222;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --accent: var(--gruber-red);       /* Links, Hervorhebungen */
  --accent-soft: #fde6e7;
  --danger: var(--gruber-red);       /* Fehlertexte */
  --hit: rgb(180 199 26 / 0.55);
  --hit-cur: rgb(226 0 15 / 0.35);
  --viewer-bg: #525659;
  --radius: 2px;
  --tap: 48px;
  --font: "Mulish", "Muli", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

/* Dunkel: entweder per Schalter (data-theme="dark") oder automatisch nach iPad-Einstellung,
   solange nicht ausdrücklich "hell" gewählt ist. Beide Blöcke müssen gleich bleiben. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161616;
  --surface: #222222;
  --surface-2: #2c2c2c;
  --text: #ececec;
  --muted: #a5a5a5;
  --line: #363636;
  --accent: #ff5a63;
  --accent-soft: #3a1a1c;
  --danger: #ff5a63;
  --gruber-green-soft: #2e3310;
  --gruber-green-dark: #c9da45;
  --viewer-bg: #1f2124;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161616;
    --surface: #222222;
    --surface-2: #2c2c2c;
    --text: #ececec;
    --muted: #a5a5a5;
    --line: #363636;
    --accent: #ff5a63;
    --accent-soft: #3a1a1c;
    --danger: #ff5a63;
    --gruber-green-soft: #2e3310;
    --gruber-green-dark: #c9da45;
    --viewer-bg: #1f2124;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
body.viewer-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
button, input { font-family: inherit; }
button { font-size: inherit; color: inherit; }
.muted { color: var(--muted); font-weight: 400; font-style: normal; }
.small { font-size: 14px; }
.pad { padding: 0 20px; }
.grow { flex: 1; }
.boot { padding: 40vh 20px 0; text-align: center; color: var(--muted); }

.ic { width: 24px; height: 24px; flex: none; }
.ic.inline { width: 20px; height: 20px; vertical-align: -4px; }
.spin .ic, .ic.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Buttons (wie auf gruber-kg.de: eckig, Versalien, fett) ------------------ */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); height: var(--tap);
  border: 0; background: none; color: var(--text); border-radius: var(--radius); cursor: pointer; padding: 0 8px;
}
.iconbtn:active { background: var(--surface-2); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  font-weight: 800; text-transform: uppercase; letter-spacing: .03em; font-size: 15px;
}
.btn .ic { width: 20px; height: 20px; }
.btn.primary { background: var(--gruber-green); border-color: var(--gruber-green); color: #1f2400; }
.btn.primary:active { background: #a2b315; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.big { width: 100%; font-size: 17px; min-height: 56px; }
.btn:disabled { opacity: .6; }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 12px; }

/* --- Kopfzeile: immer weiß wie auf der Website, grüne Linie darunter --------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: #fff; color: #222;
  border-bottom: 4px solid var(--gruber-green);
  padding: calc(var(--safe-top) + 8px) 12px 0;
}
.top-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 12px; color: #222; padding: 0 4px; }
.brand .logo { height: 46px; width: auto; display: block; }
.brand span {
  font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 18px; letter-spacing: .01em;
  border-left: 2px solid #e3e3e3; padding-left: 12px; line-height: 1.1;
}
.top .iconbtn { color: #222; }
.top .iconbtn:active { background: #f1f1f1; }
.stand {
  border: 0; border-radius: var(--radius); padding: 7px 12px; font-weight: 800; font-size: 14px; cursor: pointer;
  background: var(--gruber-green); color: #1f2400; white-space: nowrap; font-family: inherit;
}
.stand.warn { background: #ffd43b; color: #4a3500; }
.stand.alert { background: var(--gruber-red); color: #fff; }
.stand.has-error::after { content: " ⚠︎"; }
.net { display: inline-flex; align-items: center; gap: 4px; color: var(--gruber-red); font-size: 14px; font-weight: 700; }
.net .ic { width: 20px; height: 20px; }

.searchbox {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: #f4f4f4; border: 2px solid #e3e3e3; border-radius: var(--radius); padding: 0 12px; height: 48px;
}
.searchbox:focus-within { border-color: var(--gruber-green); }
.searchbox .ic { color: #6b6b6b; width: 20px; height: 20px; }
.searchbox input {
  flex: 1; border: 0; background: none; outline: none; color: #222;
  font-size: 17px; height: 100%; min-width: 0;
}
.searchbox input::placeholder { color: #8a8a8a; }

.progress { display: flex; align-items: center; gap: 12px; padding: 0 4px 8px; font-size: 14px; color: #555; }
.progress .bar { flex: 0 0 35%; height: 8px; background: #ececec; overflow: hidden; }
.progress .bar div { height: 100%; width: 0; background: var(--gruber-green); transition: width .3s; }

.tabs { display: flex; gap: 2px; margin: 0 -12px -4px; overflow-x: auto; }
.tabs a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); color: #6b6b6b; font-weight: 800; font-size: 14px;
  text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 4px solid transparent; white-space: nowrap; padding: 0 8px;
}
.tabs a .ic { width: 20px; height: 20px; }
.tabs a.active { color: #222; border-bottom-color: var(--gruber-red); }
.tabs .count:not(:empty) {
  background: var(--gruber-red); color: #fff; font-size: 12px; padding: 1px 7px; min-width: 20px; text-align: center;
}

/* --- Hinweise --------------------------------------------------------------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: 15px; }
.banner span { flex: 1; }
.banner.alert { background: var(--gruber-red); color: #fff; }
.banner.alert a { color: #fff; text-decoration: underline; }
.banner.info { background: var(--gruber-green-soft); color: var(--text); }
#toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 24px); transform: translate(-50%, 40px);
  background: #222; color: #fff; padding: 12px 20px; border-radius: var(--radius); font-size: 15px;
  border-left: 5px solid var(--gruber-green);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: .96; transform: translate(-50%, 0); }

/* --- Inhalt --------------------------------------------------------------- */
main { max-width: 1100px; margin: 0 auto; padding: 8px 0 calc(var(--safe-bottom) + 40px); }
/* Überschriften wie auf der Website: schwarz, 900, kursiv, Versalien */
.title {
  font-size: 19px; font-weight: 900; font-style: italic; text-transform: uppercase;
  color: var(--text); margin: 26px 20px 10px; letter-spacing: .01em;
}
.title .muted { font-size: 15px; font-weight: 700; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 12px 14px 8px; font-size: 16px; }
.crumbs a { padding: 8px 6px; color: var(--accent); display: inline-flex; font-weight: 700; }
.crumbs a:last-child {
  color: var(--text); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 18px;
}
.crumbs .sep .ic { width: 16px; height: 16px; color: var(--muted); }

.list { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (min-width: 700px) { .list { margin: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; } }
.row {
  display: flex; align-items: center; gap: 14px; min-height: 66px; padding: 8px 8px 8px 16px;
  color: var(--text); border-top: 1px solid var(--line); border-left: 4px solid transparent;
}
.row:first-child { border-top: 0; }
.row:active { background: var(--surface-2); border-left-color: var(--gruber-green); }
.rico { width: 42px; height: 42px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex: none; }
.rico.folder { background: var(--gruber-green); color: #1f2400; }
.rico.pdf { background: var(--gruber-red); color: #fff; }
.rmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rname { font-weight: 700; overflow-wrap: anywhere; }
.rsub { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.snip { font-size: 14px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.snip mark { background: var(--hit); color: var(--text); padding: 0 2px; }
.chev .ic { color: var(--muted); width: 20px; height: 20px; }
.badge {
  font-size: 12px; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .03em;
  padding: 4px 9px; border-radius: var(--radius); white-space: nowrap;
}
.badge.neu { background: var(--gruber-red); color: #fff; }
.badge.geaendert { background: var(--gruber-green); color: #1f2400; }
.badge.dot { background: var(--gruber-red); color: #fff; min-width: 26px; text-align: center; font-style: normal; }
.star { border: 0; background: none; width: var(--tap); height: var(--tap); display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; flex: none; }
.star.on { color: var(--gruber-red); }

.empty { text-align: center; color: var(--muted); padding: 40px 24px; }
.empty .ic { width: 44px; height: 44px; margin-bottom: 8px; color: var(--gruber-green); }
.empty .btn { margin-top: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 14px 14px; padding: 6px 18px; }
.card.actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 18px; }
.kv { display: grid; grid-template-columns: minmax(160px, 40%) 1fr; margin: 0; }
.kv dt, .kv dd { padding: 11px 0; border-top: 1px solid var(--line); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 600; }
.kv dt:first-of-type, .kv dt:first-of-type + dd { border-top: 0; }
.kv dd.err { color: var(--danger); }

/* --- Einrichtung ------------------------------------------------------------ */
.setup {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 20px) 16px 20px;
  background: linear-gradient(to bottom, var(--bg) 0, var(--bg) 75%, var(--gruber-green) 75%);
}
.setup-card {
  background: var(--surface); padding: 36px 32px 32px; max-width: 540px; width: 100%;
  border-top: 6px solid var(--gruber-red); box-shadow: 0 10px 40px rgb(0 0 0 / .12);
}
.setup-card h1 { margin: 18px 0 12px; font-size: 26px; font-weight: 900; font-style: italic; text-transform: uppercase; }
.setup-logo { display: block; height: 80px; width: auto; }
:root[data-theme="dark"] .setup-logo { background: #fff; padding: 8px 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .setup-logo { background: #fff; padding: 8px 12px; } }

/* Auswahl Automatisch / Hell / Dunkel in den Einstellungen */
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button {
  border: 0; background: var(--surface); color: var(--text); min-height: 44px; padding: 0 16px; cursor: pointer;
  font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .03em;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button + button { border-left: 2px solid var(--line); }
.seg button .ic { width: 18px; height: 18px; }
.seg button.on { background: var(--gruber-green); color: #1f2400; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; }
.setting-row .label { font-weight: 700; }
.steps { padding-left: 22px; line-height: 1.6; }
.steps li { margin-bottom: 6px; }
.hint { font-size: 15px; color: var(--muted); background: var(--surface-2); border-left: 4px solid var(--gruber-green); padding: 12px 14px; }
.code-input {
  width: 100%; font: 700 26px/1 ui-monospace, Menlo, monospace; letter-spacing: .08em; text-align: center;
  padding: 16px 10px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--text); margin: 8px 0;
}
.code-input:focus { outline: none; border-color: var(--gruber-green); }
.error { color: var(--danger); min-height: 1.4em; margin: 4px 0 12px; font-size: 15px; font-weight: 700; }
.fatal { max-width: 520px; margin: 20vh auto; padding: 24px; text-align: center; }
.fatal .ic { width: 48px; height: 48px; color: var(--danger); }

/* --- PDF-Viewer ------------------------------------------------------------- */
.viewer { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--viewer-bg); }
.vbar {
  display: flex; align-items: center; gap: 2px; background: #fff; color: #222;
  border-bottom: 4px solid var(--gruber-green);
  padding: calc(var(--safe-top) + 4px) 6px 4px;
}
.vbar .iconbtn { color: #222; }
.vtitle { flex: 1; min-width: 0; padding: 0 8px; }
.vname { font-weight: 900; font-style: italic; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vpage { font-size: 13px; color: #6b6b6b; }
.vsearch { display: flex; align-items: center; gap: 6px; background: var(--surface); border-bottom: 1px solid var(--line); padding: 6px 10px; }
.vsearch input {
  flex: 1; min-width: 0; height: 44px; border: 2px solid var(--line); border-radius: var(--radius); padding: 0 12px;
  background: var(--surface-2); color: var(--text); font-size: 16px;
}
.vsearch input:focus { outline: none; border-color: var(--gruber-green); }
.vinfo { font-size: 14px; color: var(--muted); white-space: nowrap; }
.vscroll { position: relative; flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.vpages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; width: max-content; min-width: 100%; }
.vpg { position: relative; background: #fff; box-shadow: 0 2px 10px rgb(0 0 0 / .3); flex: none; }
.vpg canvas { display: block; position: absolute; inset: 0; }
.vpg .textLayer span.vhit { background: var(--hit); }
.vpg .textLayer span.vhit-cur { background: var(--hit-cur); }
.verror { color: #fff; text-align: center; padding: 60px 24px; }
.verror .ic { width: 48px; height: 48px; }

@media (max-width: 700px) {
  .brand span { display: none; }
  .brand .logo { height: 38px; }
}
@media (max-width: 600px) {
  .tabs a span { display: none; }
}
