/*
 * MX-Lager im Aussehen des Officemanagers (Flux/Tailwind-Optik):
 * Instrument Sans, Grautöne „zinc“, blauer Akzent, Seitenleiste links,
 * kompakte Karten und Listen. Die Teams der Saison färben den Akzent
 * wie die Mandantenfarbe im Officemanager.
 *
 * Gilt für alle Seiten. Lager- und Saisonseite legen ihre eigenen
 * Bausteine darüber, die Zugangsseiten nutzen zugang.css.
 */

@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/instrument-sans-400.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/instrument-sans-500.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 600 700; font-display: swap; src: url("fonts/instrument-sans-600.woff2") format("woff2"); }

:root {
    --om-bg: #ffffff;
    --om-side: #fafafa;
    --om-muted: #f5f5f5;
    --om-hover: rgba(24, 24, 27, .05);
    --om-line: #e5e5e5;
    --om-line-2: #d4d4d4;
    --om-text: #171717;
    --om-text-2: #525252;
    --om-text-3: #737373;
    --om-text-4: #a3a3a3;
    --om-accent: #2563eb;
    --om-accent-hover: #1d4ed8;
    --om-accent-text: #1d4ed8;
    --om-accent-on: #ffffff;
    --om-accent-soft: rgba(37, 99, 235, .09);
    --om-success: #16a34a;
    --om-success-soft: rgba(22, 163, 74, .10);
    --om-danger: #dc2626;
    --om-danger-soft: rgba(220, 38, 38, .08);
    --om-warning: #d97706;
    --om-warning-soft: rgba(217, 119, 6, .10);
    --om-shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
    --om-shadow-lg: 0 10px 30px -8px rgba(0, 0, 0, .25), 0 0 0 1px rgba(0, 0, 0, .04);
    --om-font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --om-r: 8px;
    --om-r-lg: 12px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --om-bg: #171717; --om-side: #171717; --om-muted: #262626; --om-hover: rgba(255, 255, 255, .06);
        --om-line: #333333; --om-line-2: #404040;
        --om-text: #f5f5f5; --om-text-2: #d4d4d4; --om-text-3: #a3a3a3; --om-text-4: #737373;
        --om-accent: #60a5fa; --om-accent-hover: #93c5fd; --om-accent-text: #93c5fd; --om-accent-on: #0a0a0a;
        --om-accent-soft: rgba(96, 165, 250, .14);
        --om-success: #4ade80; --om-success-soft: rgba(74, 222, 128, .12);
        --om-danger: #f87171; --om-danger-soft: rgba(248, 113, 113, .12);
        --om-warning: #fbbf24; --om-warning-soft: rgba(251, 191, 36, .12);
        --om-shadow-xs: none; --om-shadow-lg: 0 12px 40px -8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --om-bg: #171717; --om-side: #171717; --om-muted: #262626; --om-hover: rgba(255, 255, 255, .06);
    --om-line: #333333; --om-line-2: #404040;
    --om-text: #f5f5f5; --om-text-2: #d4d4d4; --om-text-3: #a3a3a3; --om-text-4: #737373;
    --om-accent: #60a5fa; --om-accent-hover: #93c5fd; --om-accent-text: #93c5fd; --om-accent-on: #0a0a0a;
    --om-accent-soft: rgba(96, 165, 250, .14);
    --om-success: #4ade80; --om-success-soft: rgba(74, 222, 128, .12);
    --om-danger: #f87171; --om-danger-soft: rgba(248, 113, 113, .12);
    --om-warning: #fbbf24; --om-warning-soft: rgba(251, 191, 36, .12);
    --om-shadow-xs: none; --om-shadow-lg: 0 12px 40px -8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
    color-scheme: dark;
}

/* Teams der Saison = Mandantenfarbe */
:root[data-team="friesi"] { --om-accent: #0e7490; --om-accent-hover: #155e75; --om-accent-text: #0e7490; --om-accent-soft: rgba(14, 116, 144, .10); }
:root[data-team="si"] { --om-accent: #b93a33; --om-accent-hover: #9b2f29; --om-accent-text: #b93a33; --om-accent-soft: rgba(185, 58, 51, .09); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"])[data-team="friesi"] { --om-accent: #22b8e0; --om-accent-hover: #67d0ec; --om-accent-text: #67d0ec; --om-accent-soft: rgba(34, 184, 224, .14); }
    :root:not([data-theme="light"])[data-team="si"] { --om-accent: #ef7b74; --om-accent-hover: #f5a29d; --om-accent-text: #f5a29d; --om-accent-soft: rgba(239, 123, 116, .14); }
}
:root[data-theme="dark"][data-team="friesi"] { --om-accent: #22b8e0; --om-accent-hover: #67d0ec; --om-accent-text: #67d0ec; --om-accent-soft: rgba(34, 184, 224, .14); }
:root[data-theme="dark"][data-team="si"] { --om-accent: #ef7b74; --om-accent-hover: #f5a29d; --om-accent-text: #f5a29d; --om-accent-soft: rgba(239, 123, 116, .14); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--om-bg); color: var(--om-text);
    font-family: var(--om-font); font-size: 14px; line-height: 1.5;
    -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}
a { color: var(--om-accent-text); }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--om-accent); outline-offset: 2px; }
svg.om-i { width: 20px; height: 20px; flex: none; }

/* ---------- Rahmen: Seitenleiste + Inhalt ---------- */
.om { display: flex; min-height: 100vh; min-height: 100dvh; }
.om-side {
    position: sticky; top: 0; height: 100vh; height: 100dvh; width: 232px; flex: none;
    display: flex; flex-direction: column; gap: 12px; padding: 12px;
    background: var(--om-side); border-right: 1px solid var(--om-line); overflow-y: auto;
    z-index: 60;
}
.om-brand { display: flex; align-items: center; gap: 9px; padding: 4px; text-decoration: none; color: var(--om-text); }
.om-brand img { width: 26px; height: 26px; border-radius: 6px; }
.om-brand b { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.om-brand small { display: block; font-size: 11px; color: var(--om-text-3); font-weight: 500; margin-top: -2px; }
.om-side .om-close { margin-left: auto; display: none; }

.om-nav { display: grid; gap: 2px; }
.om-nav-h { font-size: 12px; font-weight: 500; color: var(--om-text-3); padding: 10px 8px 4px; }
.om-item, .om-nav .tab {
    display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 6px 8px;
    border: 1px solid transparent; border-radius: var(--om-r); background: transparent;
    color: var(--om-text-2); font: inherit; font-size: 13px; font-weight: 500; text-align: left;
    text-decoration: none; cursor: pointer; white-space: nowrap;
}
.om-item svg { width: 18px; height: 18px; color: var(--om-text-4); flex: none; }
.om-item:hover, .om-nav .tab:hover { background: var(--om-hover); color: var(--om-text); }
.om-item[aria-current="page"], .om-item[aria-pressed="true"], .om-nav .tab[aria-pressed="true"] {
    background: var(--om-bg); border-color: var(--om-line); box-shadow: var(--om-shadow-xs); color: var(--om-text);
}
.om-item[aria-current="page"] svg, .om-nav .tab[aria-pressed="true"] svg { color: var(--om-accent); }
.om-item .om-badge, .om-item .n { margin-left: auto; }
.om-item.hot { color: var(--om-danger); }
.om-item.hot svg { color: var(--om-danger); }
.om-nav .tab svg { width: 18px; height: 18px; color: var(--om-text-4); flex: none; }
.om-sep { height: 1px; background: var(--om-line); margin: 2px 0; }
.om-spacer { flex: 1 1 auto; }

.om-badge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--om-muted); color: var(--om-text-2);
    font-variant-numeric: tabular-nums;
}
.om-badge.rot { background: var(--om-danger-soft); color: var(--om-danger); }
.om-badge.gelb { background: var(--om-warning-soft); color: var(--om-warning); }

/* Profil unten in der Seitenleiste */
.om-profile { position: relative; }
.om-profile > summary {
    list-style: none; display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: var(--om-r); cursor: pointer;
}
.om-profile > summary::-webkit-details-marker { display: none; }
.om-profile > summary:hover { background: var(--om-hover); }
.om-avatar {
    width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center;
    background: var(--om-accent-soft); color: var(--om-accent-text); font-size: 13px; font-weight: 600; text-transform: uppercase;
}
.om-profile .om-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.om-profile svg { width: 16px; height: 16px; color: var(--om-text-4); }
.om-menu {
    position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 70;
    background: var(--om-bg); border: 1px solid var(--om-line); border-radius: var(--om-r-lg); box-shadow: var(--om-shadow-lg);
    padding: 6px; display: grid; gap: 1px;
}
.om-menu a, .om-menu button {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px;
    background: transparent; color: var(--om-text); font: inherit; font-size: 13px; text-decoration: none; text-align: left; cursor: pointer;
}
.om-menu a:hover, .om-menu button:hover { background: var(--om-hover); }
.om-menu svg { width: 16px; height: 16px; color: var(--om-text-4); }
.om-menu form { margin: 0; }
.om-menu-h { font-size: 12px; color: var(--om-text-3); font-weight: 500; padding: 6px 8px 2px; }
.om-menu .om-sep { margin: 4px 0; }
.om-menu button[aria-pressed="true"]::after { content: "✓"; margin-left: auto; color: var(--om-accent); font-weight: 600; }

.om-main { flex: 1 1 auto; min-width: 0; width: 100%; max-width: 1500px; padding: 20px 20px 40px; }
@media (min-width: 1024px) { .om-main { padding: 24px 28px 48px; } }

/* Kopfleiste nur auf schmalen Geräten (wie im Officemanager) */
.om-top { display: none; }
.om-backdrop { display: none; }
@media (max-width: 1023px) {
    .om { display: block; }
    .om-top {
        display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 40;
        height: 56px; padding: 0 12px; padding-top: env(safe-area-inset-top, 0px); box-sizing: content-box;
        background: var(--om-bg); border-bottom: 1px solid var(--om-line);
    }
    .om-top .om-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .om-top .om-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
    .om-side {
        position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: min(280px, 85vw);
        transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--om-shadow-lg);
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
    .om-side .om-close { display: inline-flex; }
    body.om-offen .om-side { transform: none; }
    body.om-offen .om-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35); }
    .om-main { padding: 16px 16px 32px; }
}

.om-iconbtn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--om-r); border: 0;
    background: transparent; color: var(--om-text-2); cursor: pointer;
}
.om-iconbtn:hover { background: var(--om-hover); color: var(--om-text); }
.om-iconbtn svg { width: 20px; height: 20px; }

/* ---------- Seitenkopf ---------- */
.om-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.om-head h1 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.om-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--om-text-3); }
.om-crumbs > * + *::before { content: "/"; margin-right: 6px; color: var(--om-text-4); }
.om-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Knöpfe (Flux) ---------- */
.om-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
    border: 1px solid var(--om-line); border-radius: var(--om-r); background: var(--om-bg); color: var(--om-text);
    box-shadow: var(--om-shadow-xs); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none;
    cursor: pointer; white-space: nowrap;
}
.om-btn:hover { background: var(--om-muted); }
.om-btn.primary { background: var(--om-accent); border-color: transparent; color: var(--om-accent-on); }
.om-btn.primary:hover { background: var(--om-accent-hover); }
.om-btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.om-btn svg { width: 18px; height: 18px; }

/* ---------- Karte (x-karte) ---------- */
.om-card { background: var(--om-bg); border: 1px solid var(--om-line); border-radius: var(--om-r-lg); }
.om-card-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--om-line); font-size: 14px; font-weight: 500; }

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

.om-brandzeile { display: flex; align-items: center; }
.om-body { flex: 1 1 auto; min-width: 0; }

/* Aufklappbare Gruppen (je Team), wie die Gruppen im Officemanager */
.om-gruppe > summary { list-style: none; }
.om-gruppe > summary::-webkit-details-marker { display: none; }
.om-gruppe > summary .om-chev { width: 14px; height: 14px; margin-left: auto; transition: transform .15s; }
.om-gruppe[open] > summary .om-chev { transform: rotate(90deg); }
.om-gruppe-k { display: grid; gap: 2px; margin: 2px 0 4px 17px; padding-left: 8px; border-left: 1px solid var(--om-line); }
.om-teamdot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 4px; }
.om-teamdot.t-friesi { background: #0e7490; }
.om-teamdot.t-si { background: #b93a33; }
.om-item .om-badge { margin-left: auto; }
.om-item .om-badge:empty { display: none; }

/* Karten mit Inhalt, Raster für Seiten mit zwei Karten */
.om-card-b { padding: 16px; }
.om-card-h .om-badge { margin-left: auto; }
.om-raster { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) { .om-raster { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } .om-raster.halb { grid-template-columns: 1fr 1fr; } }
.om-badge:empty { display: none; }

/* Untergruppe „Texte & PDFs“: Dokumente ohne eigenes Symbol, etwas kleiner */
.om-item.om-doc { min-height: 30px; font-size: 12.5px; padding: 4px 8px; }
