/* EI-TEA – Ettinger IT Ticket-Erfassungs-Assistent
   CI: Ettinger-Branding-Profil „Standard“ / „Standard Dunkel“ (Signage), Schrift DIN 2014 wie www.ettinger.de */

/* DIN 2014 ist lizenzpflichtig: Dateien nur ablegen, wenn die Web-Lizenz von ETTINGER das abdeckt (siehe README).
   Ohne Dateien greift lokal installiertes DIN 2014 und sonst Barlow (SIL Open Font License). */
@font-face { font-family: "DIN2014"; font-weight: 400; font-display: swap;
  src: local("DIN 2014"), local("DIN2014-Regular"), url("fonts/DIN2014-Regular.woff2") format("woff2"); }
@font-face { font-family: "DIN2014"; font-weight: 700; font-display: swap;
  src: local("DIN 2014 Bold"), local("DIN2014-Bold"), url("fonts/DIN2014-Bold.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/Barlow-Regular.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600 700; font-display: swap; src: url("fonts/Barlow-Bold.woff2") format("woff2"); }

:root {
  /* Palette „Standard“ */
  --primary: #0b2e59;      /* Primär – Kopfzeile, Hauptbutton */
  --secondary: #1f6fb2;    /* Sekundär – Links, Fokus, aktive Elemente */
  --accent: #f28c28;       /* Akzent – nur mit dunkler Schrift (Weiß auf Akzent 2,5:1) */
  --on-accent: #0b2e59;
  --bg: #f4f6f9;           /* Hintergrund */
  --surface: #ffffff;      /* Fläche */
  --surface-2: #eef2f7;
  --text: #14213d;         /* Text */
  --text-2: #5b6b82;       /* Text gedämpft */
  --line: #d9e0e9;
  --ok: #2e9e6a;           /* Status frei */
  --danger: #d64545;       /* Status belegt / Notfall */

  --brand: var(--primary);
  --brand-ink: var(--secondary);
  --brand-soft: #e3edf7;
  --accent-soft: #fdeedd;
  --accent-ink: #a8560c;
  --ok-soft: #e2f3ea;
  --danger-soft: #fbe7e7;
  --header-bg: var(--primary);
  --header-text: #ffffff;
  --btn-bg: var(--primary);
  --btn-bg-hover: var(--secondary);
  --shadow: 0 1px 2px rgba(11, 46, 89, .06), 0 4px 16px rgba(11, 46, 89, .07);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --font: "DIN2014", "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
/* Palette „Standard Dunkel“ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1626; --surface: #13243c; --surface-2: #1a2e4a; --text: #f4f6f9; --text-2: #9aa8bc; --line: #25395a;
    --brand: #6fa8dc; --brand-ink: #8dbbe6; --brand-soft: #173457;
    --accent-soft: #3a2712; --accent-ink: #f6a85c; --ok: #4cbb87; --ok-soft: #12301f; --danger: #ec6b6b; --danger-soft: #3a1a1c;
    --header-bg: #0b2e59; --btn-bg: #1f6fb2; --btn-bg-hover: #2b7fc6;
    --shadow: 0 1px 2px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1626; --surface: #13243c; --surface-2: #1a2e4a; --text: #f4f6f9; --text-2: #9aa8bc; --line: #25395a;
  --brand: #6fa8dc; --brand-ink: #8dbbe6; --brand-soft: #173457;
  --accent-soft: #3a2712; --accent-ink: #f6a85c; --ok: #4cbb87; --ok-soft: #12301f; --danger: #ec6b6b; --danger-soft: #3a1a1c;
  --header-bg: #0b2e59; --btn-bg: #1f6fb2; --btn-bg-hover: #2b7fc6;
  --shadow: 0 1px 2px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App-Gerüst ---------- */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--header-bg); color: var(--header-text);
}
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .04em; text-decoration: none; color: var(--header-text); font-size: 18px; }
.brandmark .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); }
.brandmark .logo svg { width: 22px; height: 22px; }
.brandmark small { display: block; font-weight: 400; font-size: 10px; letter-spacing: .28em; text-transform: uppercase; opacity: .75; margin-top: -1px; }
.topbar .spacer { flex: 1; }
.topnav { display: none; gap: 4px; margin-left: 24px; }
.user-btn {
  display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px; border-radius: 999px; cursor: pointer; color: var(--header-text);
}
.user-btn:hover { background: rgba(255,255,255,.1); }
.user-name { display: none; font-size: 14px; }
@media (min-width: 768px) { .user-name { display: inline; } }
.menu .who span { display: block; }
.view:focus { outline: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.view { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 104px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px;
  text-decoration: none; color: var(--text-2); font-size: 12px; font-weight: 600; position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--brand-ink); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab .dot {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
@media (min-width: 768px) {
  .tabbar { display: none; }
  .topnav { display: flex; }
  .topnav .tab { flex-direction: row; min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 15px; gap: 6px; color: rgba(255,255,255,.78); white-space: nowrap; }
  .topnav .tab svg { width: 18px; height: 18px; }
  .topnav .tab[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; }
  .topnav .tab[aria-current="page"]::before { display: none; }
  .topnav .tab .dot { position: static; }
  .view { padding-bottom: 48px; padding-top: 32px; }
}

/* ---------- Typografie ---------- */
.h1 { font-size: 26px; line-height: 1.15; margin: 0 0 4px; font-weight: 700; }
.h1.bar::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 2px; background: var(--accent); margin-bottom: 12px; }
.lead { color: var(--text-2); margin: 0 0 20px; }
.label { display: block; font-size: 14px; font-weight: 600; margin: 18px 0 8px; }
.hint { font-size: 13px; color: var(--text-2); margin: 6px 0 0; }
.muted { color: var(--text-2); }

/* ---------- Formular ---------- */
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b6776' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.compose {
  position: relative; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.compose:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.compose.drag { border-color: var(--brand); border-style: dashed; background: var(--brand-soft); }
.compose .textarea { border: 0; box-shadow: none; background: transparent; min-height: 140px; resize: none; padding: 16px 16px 8px; display: block; }
.compose .textarea:focus { box-shadow: none; }
.compose-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; }
.compose-bar .spacer { flex: 1; }
.compose-bar .count { font-size: 12px; color: var(--text-2); padding-right: 6px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.rec { background: var(--danger); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(192,57,43,.45); } 70% { box-shadow: 0 0 0 12px rgba(192,57,43,0); } 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0); } }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; font-size: 14px; line-height: 1;
}
.thumb.busy::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.6); }
.paste-hint { display: none; }
@media (hover: hover) and (pointer: fine) { .paste-hint { display: block; } }

.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1; min-height: var(--tap); border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  padding: 8px 6px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-2); line-height: 1.2;
  display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; transition: all .15s;
}
.seg-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.seg-btn.urgent[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.seg-btn .ico { font-size: 18px; }

/* Bereich Software/Hardware: große Kacheln */
.area-seg .seg-btn { flex-direction: column; min-height: 76px; gap: 4px; font-size: 15px; }
.area-seg .seg-btn svg { width: 28px; height: 28px; }
.area-seg .seg-btn small { font-weight: 400; font-size: 12px; color: var(--text-2); }
.area-seg .seg-btn[aria-pressed="true"] small { color: inherit; opacity: .8; }

/* Kategorien: Schnellwahl als Chips + Auswahlmenü */
.label .opt { font-weight: 400; color: var(--text-2); font-size: 13px; margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.chip:hover { border-color: var(--brand-ink); }
.chip[aria-pressed="true"] { border-color: var(--brand-ink); background: var(--brand-soft); color: var(--brand-ink); }
.chip[aria-pressed="true"]::before { content: "✓"; font-weight: 700; }
.select.more-cats { margin-top: 10px; min-height: 44px; font-size: 15px; color: var(--text-2); }
.select.more-cats.picked { color: var(--brand-ink); border-color: var(--brand-ink); background-color: var(--brand-soft); font-weight: 600; }

details.more { margin-top: 16px; }
details.more summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; list-style: none; min-height: 32px; display: flex; align-items: center; gap: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 18px; }
details.more[open] summary::before { transform: rotate(90deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: 14px; border: 1.5px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-primary { background: var(--btn-bg); color: #fff; }
.btn-primary:hover { background: var(--btn-bg-hover); }
.btn-secondary { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn-block { width: 100%; margin-top: 24px; }
.btn + .btn { margin-top: 10px; }
.btn svg { width: 20px; height: 20px; }
.link-btn { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; padding: 8px 0; font-size: 14px; }

/* ---------- Karten & Listen ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.ticket {
  display: block; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px;
  text-decoration: none; color: var(--text); border: 1.5px solid transparent;
}
.ticket:hover { border-color: var(--line); }
.ticket .t-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.ticket .t-title { font-weight: 600; margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ticket .t-head .when { margin-left: auto; }
.ticket.wait { border-color: var(--accent); }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title.attn { color: var(--accent-ink); }
.list-head { display: flex; align-items: center; gap: 8px; }
.list-head .h1 { flex: 1; margin: 0; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-open { background: var(--brand-soft); color: var(--brand-ink); }
.b-progress { background: #efe7fb; color: #6a3fb5; }
.b-wait { background: var(--accent-soft); color: var(--accent-ink); }
.b-ext { background: #fff4d6; color: #8a6200; }
.b-test { background: #e3f4f6; color: #116b77; }
.b-done { background: var(--ok-soft); color: var(--ok); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .b-progress { background: #2a2140; color: #c4a8f0; }
  :root:not([data-theme="light"]) .b-ext { background: #352c12; color: #f0cd6b; }
  :root:not([data-theme="light"]) .b-test { background: #12313a; color: #7fd3de; }
}

.callout { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }
.callout-wait { background: var(--accent-soft); color: var(--accent-ink); }
.callout-info { background: var(--brand-soft); color: var(--brand-ink); }
.callout-error { background: var(--danger-soft); color: var(--danger); }
.callout svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }

/* ---------- Detail ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); text-decoration: none; font-weight: 600; font-size: 14px; min-height: 36px; }
.detail-title { font-size: 21px; font-weight: 700; margin: 6px 0 8px; line-height: 1.25; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.desc { white-space: pre-wrap; word-wrap: break-word; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 12px; }
.gallery a { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: block; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.msg { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); max-width: 92%; }
.msg.me { align-self: flex-end; background: var(--brand-soft); }
.msg .who { font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }
.msg .txt { white-space: pre-wrap; word-wrap: break-word; }
.event { align-self: center; font-size: 12px; color: var(--text-2); background: var(--surface-2); padding: 4px 10px; border-radius: 999px; }

/* ---------- Login & Erfolg ---------- */
.hero { text-align: center; padding: 28px 0 12px; }
.hero .logo-big { width: 76px; height: 76px; border-radius: 20px; background: var(--primary); color: var(--accent); display: grid; place-items: center; margin: 0 auto 16px; box-shadow: 0 10px 28px rgba(11,46,89,.3); }
.hero .logo-big svg { width: 44px; height: 44px; }
.hero h1 { font-size: 30px; margin: 0; letter-spacing: .04em; }
.hero .tag { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--text-2); margin-top: 2px; }
.hero p { color: var(--text-2); margin: 6px 0 0; }
.success { text-align: center; padding: 48px 0 8px; }
.success .check { width: 88px; height: 88px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 20px; animation: pop .35s ease-out; }
.success .check svg { width: 46px; height: 46px; }
.success h1 { font-size: 26px; margin: 0 0 8px; }
.success .num { color: var(--brand); }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 80% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }

.empty { text-align: center; color: var(--text-2); padding: 48px 16px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- Toast & Lade-Zustand ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: #1b2430; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: up .2s ease-out;
}
.toast.error { background: var(--danger); }
@keyframes up { from { transform: translate(-50%, 12px); opacity: 0; } }
.spinner { width: 20px; height: 20px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.loading { display: flex; justify-content: center; padding: 48px; color: var(--brand); }
.loading .spinner { width: 28px; height: 28px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: var(--radius); height: 72px; }
@keyframes sh { to { background-position: -200% 0; } }

.menu { position: absolute; right: 12px; top: calc(100% + 4px); background: var(--surface); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.18); padding: 6px; min-width: 220px; z-index: 30; }
.menu .who { padding: 10px 12px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .who b { display: block; color: var(--text); font-size: 15px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
