/* =====================================================================
   METROVA OS 3.0 – Premium-Dark-Feinschliff, Homescreen-Ordner, App-Bibliothek,
   gemeinsames Kit für Dienst-/Behörden-/Verwaltungs-Apps (Kennzahlen, Tabellen, Diagramme)
   ===================================================================== */

/* ---------- Premium Dark (navy/emerald): dezentere Kacheln, weniger Neon ---------- */
:root:not([data-accent="neon"]) .app-tile {
    border: 1px solid rgba(var(--a1), 0.55);
    box-shadow: inset 0 0 12px rgba(var(--a2), 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 10px rgba(var(--a1), 0.16), 0 6px 14px rgba(0, 0, 0, 0.55);
}
:root:not([data-accent="neon"]) .app-tile .ic { filter: drop-shadow(0 0 3px rgba(var(--a1), 0.55)); }
:root:not([data-accent="neon"]) .widget { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 28px rgba(0, 0, 0, 0.45); border-color: rgba(var(--a1), 0.32); }
:root:not([data-accent="neon"]) .home-logo-text { filter: drop-shadow(0 0 4px rgba(var(--a1), 0.45)) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6)); }
:root:not([data-accent="neon"]) .page-dots .dot.active { box-shadow: 0 0 6px rgba(var(--a1), 0.7); background: var(--pink-2); }
:root[data-theme="light"] .btn-primary { color: var(--on-accent); }

/* ---------- Homescreen: Ordner, Ersatzseite, Bibliothek ---------- */
.folder-tile { background: rgba(var(--t2), 0.55) !important; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); padding: 7px; }
.folder-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 100%; height: 100%; }
.fm-app { display: grid; place-items: center; border-radius: 5px; background: rgba(var(--t0), 0.75); border: 1px solid rgba(var(--a1), 0.35); color: var(--pink-2); }
.fm-app .ic { width: 10px; height: 10px; filter: none !important; }
.folder-grid { display: grid; grid-template-columns: repeat(4, 1fr); row-gap: 16px; padding: 6px 4px 10px; }
.folder-hint { font-size: 12px; text-align: center; margin: 4px 0 10px; }
.page-spare { display: none; }
.editing .page-spare { display: block; }
.spare-hint { margin: 120px 24px 16px; padding: 18px; border: 1.5px dashed rgba(var(--a1), 0.45); border-radius: 22px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; text-align: center; }
.app-grid.spare { min-height: 260px; }
.page-dots .spare-dot { display: none; }
.editing .page-dots .spare-dot { display: block; }
.page-apps { padding-top: 56px; }
.lib-cat { margin: 0 12px 14px; padding: 12px 4px 10px; border-radius: 22px; background: rgba(var(--t1), 0.55); border: 1px solid var(--line-soft); }
.lib-cat .lib-grid { padding: 0; }
.lib-cat-title { font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin: 0 0 10px 12px; }

/* ---------- Kit: Kennzahlen ---------- */
.kit-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 16px; }
.kit-stat { padding: 12px 13px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-soft); min-width: 0; }
.kit-stat-top { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.kit-stat-val { font-size: 21px; font-weight: 700; margin-top: 4px; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kit-stat.tone-ok .kit-stat-val { color: var(--green); }
.kit-stat.tone-bad .kit-stat-val { color: var(--red); }
.kit-stat.tone-warn .kit-stat-val { color: var(--gold); }
.kit-stat.tone-accent { border-color: rgba(var(--a1), 0.4); }
.kit-stat.tone-accent .kit-stat-val { color: var(--pink-2); }

/* ---------- Kit: Status-Chips ---------- */
.kit-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; border: 1px solid transparent; }
.kit-pill.tone-ok { color: #6ff0b4; background: rgba(47, 208, 138, 0.14); border-color: rgba(47, 208, 138, 0.3); }
.kit-pill.tone-warn { color: #f2d27a; background: rgba(232, 201, 110, 0.13); border-color: rgba(232, 201, 110, 0.3); }
.kit-pill.tone-bad { color: #ff8a95; background: rgba(255, 77, 94, 0.14); border-color: rgba(255, 77, 94, 0.32); }
.kit-pill.tone-info { color: #a9c3ff; background: rgba(91, 140, 255, 0.14); border-color: rgba(91, 140, 255, 0.3); }
.kit-pill.tone-muted { color: var(--muted); background: var(--surface-hi); }
:root[data-theme="light"] .kit-pill.tone-ok { color: #0f8a55; }
:root[data-theme="light"] .kit-pill.tone-warn { color: #8a6500; }
:root[data-theme="light"] .kit-pill.tone-bad { color: #c0182c; }
:root[data-theme="light"] .kit-pill.tone-info { color: #234fbf; }

/* ---------- Kit: Tabellen ---------- */
.kit-table-wrap { overflow-x: auto; border-radius: 18px; border: 1px solid var(--line-soft); background: var(--surface); margin-bottom: 16px; }
.kit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kit-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.kit-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.kit-table tr:last-child td { border-bottom: 0; }
.kit-table tr.tappable { cursor: pointer; }
.kit-table tr.tappable:hover td { background: var(--surface-hi); }
.kit-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; border-radius: 18px; border: 1px dashed var(--line-soft); margin-bottom: 16px; }

/* ---------- Kit: Schlüssel/Wert ---------- */
.kit-kv { border-radius: 18px; background: var(--surface); border: 1px solid var(--line-soft); padding: 4px 14px; margin-bottom: 16px; }
.kit-kv-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.kit-kv-row:last-child { border-bottom: 0; }
.kit-k { color: var(--muted); flex: none; }
.kit-v { text-align: right; word-break: break-word; white-space: pre-wrap; }

/* ---------- Kit: Diagramme ---------- */
.kit-chart { padding: 14px 12px 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-soft); margin-bottom: 16px; }
.kit-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.kit-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.kit-bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.kit-bar { width: 42%; max-width: 12px; min-height: 2px; border-radius: 4px 4px 1px 1px; transition: height 0.5s var(--ease); }
.kit-bar.b1 { background: linear-gradient(180deg, var(--pink-2), var(--magenta)); }
.kit-bar.b2 { background: linear-gradient(180deg, #8fb0ff, #3d63c9); }
.kit-bar-label { font-size: 9.5px; color: var(--muted); margin-top: 5px; white-space: nowrap; }
.kit-legend { display: flex; gap: 14px; justify-content: center; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.kit-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.kit-legend .l1::before { background: var(--pink); }
.kit-legend .l2::before { background: #5b8cff; }
.kit-share { margin-bottom: 12px; }
.kit-share-head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 5px; }
.kit-share-track { height: 9px; border-radius: 6px; background: var(--surface-hi); overflow: hidden; }
.kit-share-fill { height: 100%; border-radius: 6px; background: var(--grad); }
.kit-share-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Kit: Kacheln, Dienst, Abschnitte ---------- */
.kit-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.kit-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 11px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-soft); text-align: left; min-height: 82px; transition: transform 0.15s, border-color 0.2s; }
.kit-tile:active { transform: scale(0.97); }
.kit-tile:hover { border-color: rgba(var(--a1), 0.4); }
.kit-tile-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(var(--a1), 0.13); color: var(--pink-2); border: 1px solid rgba(var(--a1), 0.3); }
.kit-tile-label { font-size: 12.5px; font-weight: 650; line-height: 1.2; }
.kit-tile-sub { font-size: 11px; color: var(--muted); }
.kit-tile .badge { position: absolute; top: 8px; right: 8px; }
.kit-duty { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-soft); margin-bottom: 16px; font-size: 13px; }
.kit-duty.on { border-color: rgba(47, 208, 138, 0.45); background: linear-gradient(90deg, rgba(47, 208, 138, 0.1), var(--surface)); }
.kit-duty-dot { width: 10px; height: 10px; border-radius: 50%; background: #6b7280; flex: none; }
.kit-duty.on .kit-duty-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.kit-duty-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.kit-duty-main b { font-size: 14px; }
.kit-section { margin-bottom: 18px; }
.kit-note { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.45; }
.kit-toggle-field { display: flex; align-items: center; justify-content: space-between; }
.kit-card { padding: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-soft); margin-bottom: 12px; }
.kit-card h4 { margin: 0 0 6px; font-size: 15px; }
.kit-card p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.kit-card .kit-card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.kit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.kit-actions .btn { flex: 1 1 auto; }
.kit-hero { padding: 18px 16px; border-radius: 24px; margin-bottom: 16px; background: radial-gradient(120% 120% at 0% 0%, rgba(var(--a1), 0.22), transparent 55%), radial-gradient(120% 120% at 100% 100%, rgba(var(--a2), 0.2), transparent 55%), var(--surface); border: 1px solid rgba(var(--a1), 0.3); }
.kit-hero-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.kit-hero-value { font-size: 30px; font-weight: 750; letter-spacing: -0.5px; margin-top: 4px; }
.kit-hero-sub { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.kit-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.kit-pre { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.6; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-soft); margin-bottom: 16px; }
.kit-chat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.kit-msg { max-width: 82%; padding: 9px 12px; border-radius: 16px; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line-soft); white-space: pre-wrap; word-break: break-word; }
.kit-msg.mine { align-self: flex-end; background: rgba(var(--a1), 0.16); border-color: rgba(var(--a1), 0.3); }
.kit-msg.staff { border-color: rgba(var(--a2), 0.45); }
.kit-msg small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Notruf ---------- */
.sos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.sos-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 14px; border-radius: 22px; border: 1px solid var(--line-soft); background: var(--surface); text-align: left; min-height: 108px; }
.sos-btn .sos-ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.sos-btn b { font-size: 15px; }
.sos-btn span { font-size: 12px; color: var(--muted); }
.sos-police .sos-ic { background: linear-gradient(135deg, #3d6bff, #1c3a9c); }
.sos-ems .sos-ic { background: linear-gradient(135deg, #ff5d6c, #b3172a); }
.sos-fire .sos-ic { background: linear-gradient(135deg, #ff9a3d, #c2410c); }
.sos-mechanic .sos-ic { background: linear-gradient(135deg, #9aa4b5, #4b5563); }
.sos-taxi .sos-ic { background: linear-gradient(135deg, #f5c542, #b7860b); }
.sos-security .sos-ic { background: linear-gradient(135deg, #2fd08a, #0f7a4c); }

/* ---------- MetroID-Karte ---------- */
.id-card { position: relative; border-radius: 22px; padding: 16px; overflow: hidden; margin-bottom: 16px; color: #f4f6fb;
    background: radial-gradient(130% 90% at 100% 0%, rgba(var(--a1), 0.35), transparent 50%), linear-gradient(135deg, #0f1c36, #060b16 70%); border: 1px solid rgba(var(--a1), 0.45); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.id-card::after { content: "METROVA"; position: absolute; right: -10px; bottom: -14px; font-size: 64px; font-weight: 900; letter-spacing: 4px; color: rgba(255, 255, 255, 0.04); }
.id-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: #e8c96e; margin-bottom: 12px; }
.id-body { display: flex; gap: 14px; align-items: center; }
.id-name { font-size: 19px; font-weight: 750; }
.id-line { font-size: 12.5px; color: rgba(244, 246, 251, 0.72); margin-top: 3px; }
.id-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ---------- Store ---------- */
.st-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.st-icon .app-tile { pointer-events: none; }
.st-name { font-size: 20px; font-weight: 750; }
.st-dev { font-size: 13px; color: var(--muted); margin-top: 2px; }
.st-meta { display: flex; gap: 0; margin: 4px 0 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-soft); }
.st-meta > div { flex: 1; text-align: center; padding: 10px 4px; border-right: 1px solid var(--line-soft); }
.st-meta > div:last-child { border-right: 0; }
.st-meta b { display: block; font-size: 15px; }
.st-meta span { font-size: 11px; color: var(--muted); }
.st-shots { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; scrollbar-width: none; }
.st-shots img { height: 300px; border-radius: 18px; border: 1px solid var(--line-soft); flex: none; }
.st-row-list { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; scrollbar-width: none; }
.st-card { flex: 0 0 auto; width: 92px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.st-card .st-card-name { font-size: 12px; font-weight: 600; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-card .st-card-sub { font-size: 11px; color: var(--muted); }
.st-get { padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: rgba(var(--a1), 0.18); color: var(--pink-2); }
.st-get.installed { background: var(--surface-hi); color: var(--muted); }
.stars { color: var(--gold); letter-spacing: 1px; }

/* ---------- Web-App-Host ---------- */
.webhost { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--app-bg); }
.webhost-bar { display: flex; align-items: center; gap: 8px; padding: 52px 12px 8px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.webhost-bar b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.webhost iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------- Karte ---------- */
.map-box { position: relative; height: 320px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line-soft); margin-bottom: 14px; background:
    linear-gradient(rgba(var(--a2), 0.07) 1px, transparent 1px) 0 0 / 28px 28px, linear-gradient(90deg, rgba(var(--a2), 0.07) 1px, transparent 1px) 0 0 / 28px 28px, rgb(var(--t0)); }
.map-box img.map-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.map-pin { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.map-pin i { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; background: var(--grad); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); }
.map-pin i .ic { transform: rotate(45deg); color: var(--on-accent); }
.map-pin.me i { background: linear-gradient(135deg, #8fb0ff, #3d63c9); }
.map-pin.poi i { background: linear-gradient(135deg, #9aa4b5, #4b5563); }
.map-note { position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(var(--t0), 0.8); font-size: 11.5px; color: var(--muted); text-align: center; }

/* ---------- Assistent ---------- */
.as-items { margin: 6px 0 0; padding-left: 18px; }
.as-items li { margin: 2px 0; }
.as-suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.msg-idcard { min-width: 190px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(135deg, #0f1c36, #060b16); border: 1px solid rgba(var(--a1), 0.5); color: #f4f6fb; }
.mid-head { display: flex; gap: 6px; align-items: center; font-size: 10.5px; letter-spacing: 0.8px; text-transform: uppercase; color: #e8c96e; margin-bottom: 6px; }
.mid-name { font-weight: 700; font-size: 15px; }
.mid-sub { font-size: 12px; color: rgba(244, 246, 251, 0.7); margin-top: 2px; }
.accent-dot { width: 28px; height: 28px; border-radius: 50%; flex: none; border: 2px solid rgba(255, 255, 255, 0.25); }
.accent-dot[data-a="navy"] { background: linear-gradient(135deg, #0c1a36 45%, #d4af37 55%); }
.accent-dot[data-a="emerald"] { background: linear-gradient(135deg, #0c1a36 45%, #2ec48c 55%); }
.accent-dot[data-a="neon"] { background: linear-gradient(135deg, #1a0612 45%, #ff2d95 55%); }
.theme-prev.dark { background: linear-gradient(180deg, #0c1a36, #010204); }
