/* =========================================================
   AS NORD — MOBILE APP UI
   Vollflächiges App-Feel auf Android & iPhone
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;

    --text: #0f172a;
    --text-soft: #334155;
    --muted: #64748b;
    --muted-light: #94a3b8;

    --border: #e5e9f0;
    --border-strong: #cbd5e1;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --primary-dark: #1e40af;

    --success: #16a34a;
    --success-soft: #dcfce7;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12);

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;

    --tap: 48px;

    --header-h: 56px;
    --bottom-nav-h: 68px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

/* iOS Zoom-on-Focus verhindern */
input, textarea, select, button {
    font-family: inherit;
    font-size: 16px;
}

button { cursor: pointer; }
a { color: inherit; }

/* =========================================================
   APP SHELL (Header + Main + Bottom Nav)
   ========================================================= */

.app-body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* ---------- App Header ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;

    padding-top: var(--safe-top);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.app-header-inner {
    max-width: 760px;
    margin: 0 auto;
    height: var(--header-h);
    padding: 0 max(16px, var(--safe-left)) 0 max(16px, var(--safe-right));

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.app-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.4px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.app-brand-name {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 0;
    background: transparent;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.header-icon-btn:hover,
.header-icon-btn:active {
    background: var(--primary-soft);
    color: var(--primary);
}

.header-icon-btn svg { width: 22px; height: 22px; }

/* ---------- Main ---------- */
.app-main {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding:
        16px
        max(16px, var(--safe-right))
        calc(var(--bottom-nav-h) + var(--safe-bottom) + 24px)
        max(16px, var(--safe-left));
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;

    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);

    padding-bottom: var(--safe-bottom);
}

.bottom-nav-inner {
    max-width: 760px;
    margin: 0 auto;
    height: var(--bottom-nav-h);
    padding: 0 max(8px, var(--safe-left)) 0 max(8px, var(--safe-right));

    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: stretch;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;

    text-decoration: none;
    color: var(--muted);
    background: transparent;
    border: 0;

    padding: 6px 2px;
    border-radius: 12px;
    margin: 6px 2px;

    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1px;

    transition: color 0.15s ease, background 0.15s ease;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.nav-item:hover { color: var(--text-soft); }

.nav-item.is-active {
    color: var(--primary);
    background: var(--primary-soft);
}

.nav-item.is-active svg { stroke-width: 2.4; }

/* Label-Schutz: 5 Spalten, lange Texte dürfen nicht überlaufen */
.nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================================
   LOGIN PAGE (eigenes Vollbild-Layout)
   ========================================================= */
.login-body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;

    background:
        radial-gradient(1200px 600px at 50% -200px, #dbeafe 0%, transparent 60%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    padding:
        max(var(--safe-top), 24px)
        max(20px, var(--safe-right))
        max(var(--safe-bottom), 24px)
        max(20px, var(--safe-left));
}

.login-shell {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
}

.login-card {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: var(--radius-xl);
    padding: 36px 28px 32px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    width: 76px;
    height: 76px;
    margin: 0 auto 22px;

    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.6px;

    box-shadow:
        0 14px 28px rgba(37, 99, 235, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.login-title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.login-subtitle {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 15px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.form-block {
    display: block;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.login-input {
    width: 100%;
    min-height: 54px;
    padding: 14px 16px;

    background: #fff;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);

    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.login-input::placeholder { color: var(--muted-light); }

.primary-btn,
.login-submit {
    width: 100%;
    min-height: 54px;
    margin-top: 6px;

    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    border-radius: var(--radius);

    font-size: 16px;
    font-weight: 700;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    transition: background 0.15s ease, transform 0.05s ease;
}

.primary-btn:hover,
.login-submit:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.primary-btn:active,
.login-submit:active { transform: translateY(1px); }

.login-hint {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
}

/* Auf kleinen Screens: Card als Vollbild */
@media (max-width: 480px) {
    .login-body {
        background: #ffffff;
        padding:
            max(var(--safe-top), 28px)
            max(18px, var(--safe-right))
            max(var(--safe-bottom), 28px)
            max(18px, var(--safe-left));
    }

    .login-shell { max-width: 100%; }

    .login-card {
        border: none;
        box-shadow: none;
        padding: 12px 6px;
        background: transparent;
    }

    .login-logo { width: 80px; height: 80px; border-radius: 24px; font-size: 26px; }
    .login-title { font-size: 28px; }
}

/* =========================================================
   PAGE COMPONENTS (innerhalb .app-main)
   ========================================================= */

/* ---------- Hero / Page Heads ---------- */
.hero, .page-head {
    margin-bottom: 18px;
}

.hero-title, .page-title {
    margin: 0 0 6px;
    font-size: clamp(24px, 6vw, 30px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.hero-sub, .page-sub {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.45;
}

/* ---------- Card ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    margin-bottom: 16px;
}

.card-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
}

.card-sub {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 14px;
}

/* Form innerhalb von Hero (passt zu deinem app.html) */
.hero form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    margin-top: 4px;
}

/* ---------- Search ---------- */
.search-wrap { position: relative; }

.search-field {
    position: relative;
    min-height: 60px;
    background: var(--surface-soft);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.search-field:focus-within {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--primary-soft);
}


.search-field input {
    width: 100%;
    min-height: 60px;
    padding: 12px 16px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    border-radius: var(--radius);
}

.search-field input::placeholder { color: var(--muted-light); }

.search-results {
    margin-top: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px;
    max-height: 280px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.search-results:empty { display: none; }

.search-result, .suggestion-item {
    display: block;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-size: 15px;
    line-height: 1.35;
}

.search-result:hover, .suggestion-item:hover { background: var(--primary-soft); }

/* Status-Text */
#status, .status {
    margin-top: 10px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
}

.green { color: var(--success); }
.red { color: var(--danger); }
.amber { color: var(--warning); }

/* ---------- Form Fields (allgemein in .hero) ---------- */
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 20px; }
.mt-5 { margin-top: 28px; }

.hero label, .card label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.hero input[type="date"],
.hero input[type="text"],
.hero input[type="search"],
.hero textarea,
.card input,
.card textarea,
input.login-input,
textarea.login-input {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 14px;

    background: #fff;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);

    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hero textarea, textarea.login-input {
    min-height: 110px;
    resize: vertical;
    line-height: 1.45;
}

.hero input:focus,
.hero textarea:focus,
.card input:focus,
.card textarea:focus,
input.login-input:focus,
textarea.login-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: var(--tap);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;

    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;

    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.btn:active { transform: translateY(1px); }

.btn-action { width: 100%; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-outline-primary {
    background: #fff;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary-soft); }

/* Bestehende Buttons in app.html werden automatisch erfasst */
.hero button[type="submit"] {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    min-height: var(--tap);
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.hero button[type="submit"]:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.hero a.btn-outline-primary { width: 100%; }

/* "Einträge anzeigen" Toggle-Button */
.mt-5 > button {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 18px;
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
}
.mt-5 > button:hover { background: var(--primary-soft); }

/* ---------- Tabelle (Einträge) ---------- */
#tableContainer {
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th, .table td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

.table tr:last-child td { border-bottom: 0; }

@media (max-width: 540px) {
    .table { min-width: 560px; }
}

/* =========================================================
   DASHBOARD (Dummy-Seite)
   ========================================================= */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.stat-icon svg { width: 20px; height: 20px; }

.stat-icon.is-success { background: var(--success-soft); color: var(--success); }
.stat-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.is-danger  { background: var(--danger-soft);  color: var(--danger); }

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.1;
}

.stat-trend {
    color: var(--muted);
    font-size: 12px;
}

/* Section title innerhalb main */
.section-title {
    margin: 22px 0 12px;
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

/* List items für Anlagen-Dummy */
.list-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.list-item-icon svg { width: 22px; height: 22px; }

.list-item-body { flex: 1; min-width: 0; }

.list-item-title {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-sub {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-ok      { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }

/* ---------- Empty / Hinweise ---------- */
.empty-state {
    text-align: center;
    padding: 28px 16px;
    color: var(--muted);
    font-size: 14px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 540px) {
    .app-header-inner { padding-left: 14px; padding-right: 14px; }
    .app-brand-name { font-size: 16px; }
    .app-main {
        padding-left: 14px;
        padding-right: 14px;
    }
    .hero-title { font-size: 26px; }
    .hero form, .card { padding: 16px; border-radius: 18px; }
    .stat-grid { gap: 10px; }
    .stat-value { font-size: 22px; }
}

@media (max-width: 380px) {
    .nav-item { font-size: 9.5px; }
    .nav-item svg { width: 20px; height: 20px; }
    .stat-value { font-size: 20px; }
}

/* Auf großen Screens etwas mehr Luft */
@media (min-width: 720px) {
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   EXPORT-BEREICH (Dashboard)
   ========================================================= */
.export-card { padding: 18px; }

.export-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.export-head-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.export-head-icon svg { width: 20px; height: 20px; }

.export-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.export-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.export-dates label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.export-dates input[type="date"] {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 14px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.export-dates input[type="date"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.export-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text-soft);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}

.chip.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.export-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

@media (min-width: 560px) {
    .export-actions {
        flex-direction: row;
    }
    .export-actions .btn {
        flex: 1;
    }
}

/* =========================================================
   KLICKBARE TABELLE (Einträge anzeigen)
   ========================================================= */
.table-hint {
    margin: 0 0 6px 0;
    color: var(--muted);
    font-size: 13px;
}

.table-clickable tr {
    cursor: pointer;
    transition: background 0.12s ease;
}

.table-clickable tbody tr:hover,
.table-clickable tr:not(:first-child):hover {
    background: var(--primary-soft);
}

.table-clickable .td-action {
    color: var(--primary);
    text-align: right;
    width: 36px;
    white-space: nowrap;
}

/* =========================================================
   EINZELBERICHT-LISTE (Dashboard)
   ========================================================= */
.einzel-liste {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.einzel-empty {
    padding: 20px 8px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.einzel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;

    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;

    transition: border-color 0.12s ease, background 0.12s ease, transform 0.05s ease;
}

.einzel-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.einzel-item:active {
    transform: translateY(1px);
}

.einzel-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.einzel-body {
    flex: 1;
    min-width: 0;
}

.einzel-title {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    color: var(--text);

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.einzel-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.einzel-arrow {
    color: var(--muted-light);
    flex-shrink: 0;
}

.einzel-item:hover .einzel-arrow {
    color: var(--primary);
}

/* Flash-Nachricht in der App-Seite */
.flash-msg {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
}

/* =========================================================
   SAFARI iOS FIXES
   ========================================================= */

/* Suchfeld: Safaris Default-Border vom Input wegmachen,
   aber den äußeren .search-field Container nicht anfassen */
.search-field input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
}

.search-field input[type="search"]::-webkit-search-decoration,
.search-field input[type="search"]::-webkit-search-cancel-button,
.search-field input[type="search"]::-webkit-search-results-button,
.search-field input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}

/* Datumsfelder: Safari iOS richtet Text rechts aus */
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
    -webkit-text-fill-color: var(--text);
    line-height: 1.2;
}

input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    margin-left: auto;
    cursor: pointer;
}

/* =========================================================
   ANDROID FIXES
   Additive rules — keep iOS untouched.
   ========================================================= */

/* Horizontales Scrollen der gesamten Seite verhindern,
   wenn ein Kind (z.B. die Tabelle mit min-width: 560px) überläuft.
   iOS überläuft nicht — daher kein Einfluss dort. */
html, body {
    overflow-x: clip;
    max-width: 100%;
}

/* Android-System-Schriftskalierung neutralisieren.
   iOS hat das bereits über -webkit-text-size-adjust. */
html, body {
    text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Stable Viewport: 'small' viewport ändert sich nicht mit URL-Leiste.
   Chrome Android profitiert; iOS unterstützt svh ebenfalls. */
@supports (height: 100svh) {
    .app-body { min-height: 100svh; }
    .login-body { min-height: 100svh; }
}

/* Flex- und Grid-Kinder, die Text enthalten können, dürfen nicht
   ihre Eltern auseinander drücken (Android-typisches Verhalten). */
.app-header-inner,
.app-brand,
.export-head,
.einzel-item,
.list-item,
.list-item-body,
.search-field,
.stat-card {
    min-width: 0;
}

/* Container darf nie breiter als sein Eltern werden. */
.app-main {
    width: 100%;
    min-width: 0;
}

/* Bilder/SVGs niemals breiter als der Container. */
img, svg {
    max-width: 100%;
}

/* Tabelle: Scroll-Container kapselt min-width statt es nach oben durchzureichen.
   contain: paint isoliert den Overflow auf Android Chrome. */
#tableContainer {
    contain: paint;
    max-width: 100%;
}

/* Inputs: Android rendert manchmal mit eigener Border/Background,
   die das Layout größer macht. Vereinheitlichen. */
input, textarea, select {
    -webkit-appearance: none;
    appearance: none;
    max-width: 100%;
}

/* Buttons im Hero-Bereich dürfen nicht ihr Eltern aufblähen,
   wenn der Inhalt länger ist als gedacht. */
.btn, .btn-action {
    max-width: 100%;
    min-width: 0;
}

/* Lange Wörter / URLs / Fabriknummern brechen auf Android sauber um. */
.einzel-title,
.list-item-title,
.einzel-meta,
.search-result,
.suggestion-item {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Stat-Grid: auf sehr schmalen Android-Geräten (<360px) ggf. einspaltig,
   damit Werte nicht beschnitten werden. iOS-Geräte sind alle ≥375px. */
@media (max-width: 359px) {
    .stat-grid { grid-template-columns: 1fr; }
}
