/* assets/app.css — gemeinsames Aussehen von ULTools
 *
 * Farben wie das App-Icon: Waldgrün + Gold. Alle Klassen beginnen mit "ul-",
 * damit sie sich nicht mit dem seitenindividuellen Tailwind-Styling beißen.
 *
 * - Oben (ab Tablet/PC): helle Menüleiste mit Logo, Bereichen, Sprache, Benutzer
 * - Unten (Handy):       Tab-Leiste wie bei iPhone-Apps + "Mehr"-Blatt
 */

html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }

:root {
  --ul-green: #0F4C2C;
  --ul-green-soft: #E3F4E8;
  --ul-gold: #D4AF37;
  --ul-bg: #F4F5F2;
  --ul-text: #111827;
  --ul-muted: #6B7280;
  --ul-line: #E7E9E4;
  --ul-tabbar-h: 64px;
  --ul-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ─── Menüleiste oben ───────────────────────────────────────────────────── */
.ul-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  height: 60px; padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--ul-line);
  font-family: var(--ul-font); color: var(--ul-text);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
}
.ul-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ul-text); text-decoration: none; white-space: nowrap; }
.ul-brand img { width: 34px; height: 34px; border-radius: 9px; }
.ul-links { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; }
.ul-links a { padding: 8px 13px; border-radius: 10px; color: #374151; font-size: 15px; text-decoration: none; white-space: nowrap; }
.ul-links a:hover { background: #F1F3EF; }
.ul-links a.ul-on { background: var(--ul-green-soft); color: var(--ul-green); font-weight: 600; }
.ul-right { display: flex; align-items: center; gap: 6px; }

/* Aufklapp-Menüs (Sprache, Benutzer) — ohne JavaScript über <details> */
.ul-menu { position: relative; }
.ul-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; font-size: 14px; color: #374151; user-select: none; }
.ul-menu > summary::-webkit-details-marker { display: none; }
.ul-menu > summary:hover { background: #F1F3EF; }
.ul-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid var(--ul-line); border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 6px; z-index: 60; }
.ul-pop a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: var(--ul-text); text-decoration: none; font-size: 15px; }
.ul-pop a:hover { background: #F4F5F2; }
.ul-pop a.ul-on { color: var(--ul-green); font-weight: 600; }
.ul-pop .ul-sep { height: 1px; background: var(--ul-line); margin: 6px 4px; }
.ul-pop .ul-who { padding: 10px 12px 8px; font-size: 13px; color: var(--ul-muted); }
.ul-pop .ul-who b { display: block; color: var(--ul-text); font-size: 15px; }
.ul-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ul-green); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.ul-role { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: #FBF3DC; color: #8a6200; }
.ul-danger { color: #B42318 !important; }

/* Unterleiste eines Bereichs (z.B. Verwaltung) */
.ul-subbar { display: flex; gap: 6px; overflow-x: auto; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--ul-line); font-family: var(--ul-font); }
.ul-subbar a { padding: 8px 14px; border-radius: 999px; background: #F1F3EF; color: #374151; font-size: 14px; text-decoration: none; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; }
.ul-subbar a.ul-on { background: var(--ul-green); color: #fff; font-weight: 600; }

/* ─── Tab-Leiste unten (Handy) ─────────────────────────────────────────── */
.ul-tabbar { display: none; }

@media (max-width: 767px) {
  .ul-topbar { display: none; }
  .ul-tabbar {
    display: flex; justify-content: space-around; align-items: flex-start;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    height: calc(var(--ul-tabbar-h) + max(env(safe-area-inset-bottom), 8px));
    padding: 7px max(4px, env(safe-area-inset-right)) max(env(safe-area-inset-bottom), 8px) max(4px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--ul-line);
    -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
    font-family: var(--ul-font);
  }
  .ul-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; padding-top: 2px; color: #8A8F87; font-size: 11px; text-decoration: none; background: none; border: 0; cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent; }
  .ul-tab svg { width: 26px; height: 26px; }
  .ul-tab.ul-on { color: var(--ul-green); font-weight: 600; }
  /* Platz schaffen, damit nichts hinter der Tab-Leiste verschwindet */
  body.ul-has-tabbar { padding-bottom: calc(var(--ul-tabbar-h) + max(env(safe-area-inset-bottom), 8px) + 12px) !important; }
}

/* "Mehr"-Blatt (Handy) */
.ul-sheet-bg { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .4); display: none; align-items: flex-end; justify-content: center; font-family: var(--ul-font); }
.ul-sheet-bg.ul-open { display: flex; }
.ul-sheet { width: 100%; max-width: 520px; background: #fff; border-radius: 22px 22px 0 0; padding: 10px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); max-height: 88vh; overflow-y: auto; animation: ul-up .22s ease-out; }
@keyframes ul-up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.ul-grab { width: 40px; height: 5px; border-radius: 3px; background: #D1D5DB; margin: 0 auto 12px; }
.ul-sheet .ul-who { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; }
.ul-sheet .ul-who b { display: block; font-size: 17px; color: var(--ul-text); }
.ul-sheet .ul-who span { font-size: 13px; color: var(--ul-muted); }
.ul-group { background: #F4F5F2; border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.ul-group a { display: flex; align-items: center; gap: 12px; padding: 15px 16px; min-height: 52px; color: var(--ul-text); text-decoration: none; font-size: 16px; border-top: 1px solid #E4E7E1; }
.ul-group a:first-child { border-top: 0; }
.ul-group a::after { content: "›"; margin-left: auto; color: #B5BAB1; font-size: 22px; line-height: 1; }
.ul-langs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 2px 14px; }
.ul-langs a { padding: 9px 14px; min-height: 40px; border-radius: 999px; background: #EEF1EC; color: #1f2937; text-decoration: none; font-size: 15px; }
.ul-langs a.ul-on { background: var(--ul-green); color: #fff; font-weight: 600; }
.ul-label { font-size: 13px; color: var(--ul-muted); padding: 4px 4px 6px; }
.ul-close { display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px; font-size: 16px; font-weight: 600; background: #EEF1EC; color: var(--ul-text); cursor: pointer; font-family: inherit; }

/* ─── Bausteine für Seiten im neuen Design ──────────────────────────────── */
body.ul-body { margin: 0; background: var(--ul-bg); color: var(--ul-text); font-family: var(--ul-font); -webkit-font-smoothing: antialiased; }
.ul-page { max-width: 1100px; margin: 0 auto; padding: 22px 18px 32px; }
.ul-eyebrow { color: var(--ul-muted); font-size: 14px; }
.ul-title { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.5px; margin: 4px 0 18px; }
.ul-section { font-size: 13px; font-weight: 600; color: var(--ul-muted); text-transform: uppercase; letter-spacing: .05em; margin: 22px 4px 8px; }
.ul-card { background: #fff; border-radius: 18px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 14px; }
.ul-card-title { font-size: 19px; font-weight: 700; margin: 4px 0 12px; }
.ul-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border: 0; border-radius: 15px; padding: 14px 18px; font-size: 17px; font-weight: 700; text-decoration: none; cursor: pointer; font-family: inherit; box-sizing: border-box; }
.ul-btn-primary { background: var(--ul-green); color: #fff; }
.ul-btn-primary:hover { background: #0b3d23; }
.ul-btn-light { background: #EEF1EC; color: var(--ul-text); }
.ul-btn-danger { background: #FDE4E4; color: #B42318; }
.ul-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 768px) { .ul-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ul-tile { background: #fff; border-radius: 18px; padding: 16px; min-height: 118px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); text-decoration: none; color: var(--ul-text); transition: transform .12s, box-shadow .12s; }
.ul-tile:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.ul-tile b { display: block; font-size: 16px; }
.ul-tile span { font-size: 13px; color: var(--ul-muted); }
.ul-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ul-ico svg { width: 22px; height: 22px; }
.ul-ico-green { background: #E3F4E8; color: var(--ul-green); }
.ul-ico-gold { background: #FBF3DC; color: #9A6B00; }
.ul-ico-blue { background: #E4EEFD; color: #1D4ED8; }
.ul-ico-gray { background: #EEF0EC; color: #444; }
.ul-ico-red { background: #FDE4E4; color: #B42318; }
.ul-list { background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; margin-bottom: 14px; }
.ul-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 56px; border-top: 1px solid var(--ul-line); color: var(--ul-text); text-decoration: none; }
.ul-row:first-child { border-top: 0; }
a.ul-row:hover { background: #FAFBF9; }
.ul-row .ul-grow { flex: 1; min-width: 0; }
.ul-row .ul-grow b { display: block; font-size: 16px; }
.ul-row .ul-grow span { display: block; font-size: 13px; color: var(--ul-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ul-chev { color: #C4C8C0; font-size: 24px; line-height: 1; }
.ul-badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.ul-badge-green { background: #E3F4E8; color: #1E7A3C; }
.ul-badge-amber { background: #FDF1D8; color: #9A6B00; }
.ul-badge-red { background: #FDE4E4; color: #B42318; }
.ul-badge-blue { background: #E4EEFD; color: #1D4ED8; }
.ul-badge-gray { background: #EEF0EC; color: #4B5563; }
.ul-count { min-width: 30px; height: 30px; padding: 0 9px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.ul-status-live { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #1E7A3C; font-weight: 600; }
.ul-status-live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #30A46C; box-shadow: 0 0 0 4px rgba(48,164,108,.18); }
.ul-empty { text-align: center; color: var(--ul-muted); padding: 24px 12px; font-size: 15px; }

/* ─── Tabellen am Handy als Karten (Klasse ul-rtable an <table>) ────────── */
@media (max-width: 767px) {
  table.ul-rtable thead { display: none; }
  table.ul-rtable, table.ul-rtable tbody { display: block; width: 100%; }
  table.ul-rtable tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 14px 16px; border-bottom: 1px solid var(--ul-line); }
  table.ul-rtable tr:last-child { border-bottom: 0; }
  table.ul-rtable td { display: block; padding: 0 !important; border: 0 !important; text-align: left !important; font-size: 14px; color: var(--ul-muted); max-width: 100%; overflow-wrap: anywhere; }
  table.ul-rtable td:first-child, table.ul-rtable td:nth-child(2) { color: var(--ul-text); font-size: 16px; font-weight: 600; }
  table.ul-rtable td:last-child { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; justify-content: flex-start !important; }
  table.ul-rtable td:last-child button, table.ul-rtable td:last-child a { min-height: 40px; padding-left: 14px !important; padding-right: 14px !important; }
  table.ul-rtable td[colspan] { flex: 1 0 100%; text-align: center !important; }

  /* Formulare in Fenstern: einspaltig statt gequetscht */
  .fixed .grid.grid-cols-2:not(.ut-keep-cols), .fixed .grid.grid-cols-3, .fixed .grid.grid-cols-4 { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ─── Rückmeldungen (ersetzen die grauen Browser-Fenster) ──────────────── */
.ul-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 100000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; font-family: var(--ul-font); }
body.ul-has-tabbar .ul-toasts { bottom: calc(var(--ul-tabbar-h) + max(env(safe-area-inset-bottom), 8px) + 14px); }
.ul-toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; background: #111827; color: #fff; border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.4; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: ul-toast-in .2s ease-out; white-space: pre-line; }
.ul-toast.ul-toast-error { background: #B42318; }
.ul-toast.ul-toast-ok { background: #0F4C2C; }
.ul-toast button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 0 0 8px; }
@keyframes ul-toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Kopfbereich der Fuhrpark-Seiten (hell statt türkis) ──────────────── */
.ul-fleet-head { background: #fff; border-bottom: 1px solid var(--ul-line); }
.ul-back { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; background: #F1F3EF; color: var(--ul-text); font-size: 20px; text-decoration: none; }
.ul-back:hover { background: #E4E8E1; }

/* iPhone zoomt beim Antippen in Felder mit Schrift unter 16px – am Handy verhindern */
@media (max-width: 767px) {
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
}

/* Offline-Modus: gelber Streifen „Kein Netz · x warten" (assets/offline.js) */
.ul-offbar { display: flex; align-items: center; gap: 10px; background: #FFF4D6; border: 1px solid #F0D58A; border-radius: 14px; padding: 9px 12px; margin: 0 0 12px; color: #5c4300; font-size: 14px; line-height: 1.3; cursor: pointer; }
.ul-offbar-fixed { position: fixed; z-index: 60; left: 12px; right: 12px; top: calc(8px + env(safe-area-inset-top)); max-width: 560px; margin: 0 auto; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.ul-offbar-dot { width: 28px; height: 28px; border-radius: 50%; background: #F5C542; color: #4a3600; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ul-offbar-busy .ul-offbar-dot { animation: ul-spin 1s linear infinite; }
@keyframes ul-spin { to { transform: rotate(360deg); } }
.ul-offbar-txt { flex: 1; min-width: 0; }
.ul-offbar-txt b { display: block; color: #4a3600; font-size: 14.5px; }
.ul-offbar-cnt { background: #B42318; color: #fff; border-radius: 999px; font-weight: 700; font-size: 13px; padding: 3px 10px; white-space: nowrap; flex: 0 0 auto; }

/* Offline-Modus: Schild „wartet“ an noch nicht gesendeten Werkzeugen (assets/werkzeuge-offline.js) */
.ll-wait { display: inline-block !important; width: auto !important; margin-left: 6px; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 8px; background: #FFF4D6; color: #8a5a00; vertical-align: 1px; white-space: nowrap; }

/* Offline-Modus: Frage „Rote Zahl auf dem App-Symbol?“ (assets/offline.js) */
.ul-ask-bg { position: fixed; inset: 0; z-index: 100001; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.ul-ask { background: #fff; border-radius: 22px; padding: 22px 20px 16px; max-width: 420px; width: 100%; text-align: center; font-family: var(--ul-font); box-shadow: 0 -8px 30px rgba(0,0,0,.18); }
.ul-ask-ico { width: 64px; height: 64px; border-radius: 16px; background: #0F4C2C url(icons/icon-192.png) center/cover; margin: 0 auto 12px; position: relative; }
.ul-ask-ico span { position: absolute; top: -8px; right: -10px; background: #FF3B30; color: #fff; border-radius: 999px; min-width: 26px; height: 26px; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.ul-ask b { display: block; font-size: 19px; margin-bottom: 6px; color: #111827; }
.ul-ask p { color: #4b5563; font-size: 15px; line-height: 1.45; margin: 0 0 16px; }
.ul-ask button { display: block; width: 100%; border: 0; border-radius: 14px; padding: 14px; font-size: 17px; font-weight: 700; font-family: inherit; cursor: pointer; margin-top: 8px; }
.ul-ask-yes { background: #0F4C2C; color: #fff; }
.ul-ask-no { background: #EEF1EC; color: #111827; }
/* „?“ oben auf den Seiten → passende Hilfe (help.php) */
.ul-help-q { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; background: #EEF1EC; color: var(--ul-green); font-weight: 800; font-size: 17px; text-decoration: none; line-height: 1; }
.ul-help-q:hover { background: #E3F4E8; }
