/* ============================================================
   Page transitions (CSS View Transitions API)
   Eliminates the "flash of reload" when navigating between pages.
   Falls back gracefully in browsers that don't support it yet.
   ============================================================ */
@view-transition {
  navigation: auto;
}

/* ============================================================
   Self-hosted Google Fonts
   ============================================================ */

/* JetBrains Mono 400 */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-400-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-400-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-400-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-400-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* JetBrains Mono 500 */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/jetbrains-mono-500-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/jetbrains-mono-500-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/jetbrains-mono-500-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/jetbrains-mono-500-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/jetbrains-mono-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/jetbrains-mono-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Unbounded 500 */
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/unbounded-500-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/unbounded-500-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/unbounded-500-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/unbounded-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/unbounded-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Unbounded 700 */
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/unbounded-700-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/unbounded-700-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/unbounded-700-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/unbounded-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/unbounded-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Work Sans 400 */
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/work-sans-400-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/work-sans-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/work-sans-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Work Sans 500 */
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/work-sans-500-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/work-sans-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/work-sans-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Work Sans 600 */
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/work-sans-600-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/work-sans-600-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/work-sans-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-soft: #eef3fb;
    --ink: #0f1b2e;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --border: rgba(15, 23, 42, 0.08);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 20px -10px rgba(16, 24, 40, 0.14);
    --radius: 16px;
    --nav-height: 78px;
    --side-width: clamp(260px, 25vw, 320px);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Work Sans", sans-serif;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
}

strong {
    color: var(--accent);
}

a {
    color: inherit;
    text-decoration: none;
}

.login-body {
    overflow: hidden;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 24px 64px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

body.has-side-panel .page {
    max-width: none;
    padding-left: calc(var(--side-width) + 32px);
    padding-right: 32px;
}


.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    min-height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(247, 251, 255, 0.94);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Unbounded", sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    min-width: 0;
}

.brand-logo {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px;
    max-height: 42px;
    flex: 0 0 42px;
    object-fit: contain;
    object-position: left center;
    display: block;
}


.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 18px rgba(76, 226, 180, 0.4);
}

.brand-link {
    font-family: "Unbounded", sans-serif;
    font-size: 1.05rem;
    line-height: 1.1;
    white-space: nowrap;
}

.nav-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.nav-actions.is-hidden {
    display: none;
}

.notif-btn {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(234, 243, 255, 0.75);
    display: grid;
    place-items: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.notif-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(126, 200, 255, 0.55);
    box-shadow: 0 10px 16px rgba(26, 42, 58, 0.18);
}

.notif-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--ink);
    stroke-width: 1.8;
    fill: none;
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #0a1411;
    font-size: 0.65rem;
    font-weight: 700;
    text-align: center;
    border: 1px solid rgba(26, 42, 58, 0.3);
    display: none;
}

.notif-badge.is-visible {
    display: inline-block;
}

.nav-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(76, 226, 180, 0.18);
    color: var(--accent);
    font-weight: 700;
    border: 1px solid rgba(76, 226, 180, 0.35);
    background-size: cover;
    background-position: center;
}

body.customer-portal .nav-avatar {
    display: none;
}

body.customer-portal .chat-self-avatar {
    display: none;
}

.nav-user {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
    font-family: "JetBrains Mono", ui-monospace, monospace;
}

body.customer-portal .nav-user {
    opacity: 0;
}

body.customer-portal.profile-ready .nav-user {
    opacity: 1;
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 24px;
    background:
        linear-gradient(140deg, rgba(247, 251, 255, 0.92), rgba(233, 244, 255, 0.96)),
        radial-gradient(circle at 20% 20%, rgba(126, 200, 255, 0.22) 0%, transparent 50%),
        var(--bg);
}

.auth-card {
    width: min(440px, 100%);
    background: var(--panel);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: grid;
    gap: 18px;
}

.eyebrow {
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--muted);
    margin: 0;
}

h1,
h2,
h3 {
    margin: 0 0 10px;
    font-family: "Unbounded", sans-serif;
    font-weight: 700;
}

.lead {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 1rem;
    max-width: 520px;
}

.form-grid {
    display: grid;
    gap: 12px;
}

.field {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--muted);
}

.file-upload {
    gap: 10px;
}

.file-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--accent);
    color: #0a1411;
    font-weight: 600;
    width: fit-content;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(126, 200, 255, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.file-upload:hover .file-upload-button {
    transform: translateY(-1px);
    background: var(--accent-dark);
}

.file-upload:focus-within .file-upload-button {
    box-shadow: 0 0 0 2px rgba(126, 200, 255, 0.5);
}

.file-upload-hint {
    font-size: 0.8rem;
    color: var(--muted);
}

.field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font: inherit;
    color: var(--ink);
    background: var(--panel-soft);
}

.field select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font: inherit;
    color: var(--ink);
    background: var(--panel-soft);
}

.field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font: inherit;
    color: var(--ink);
    background: var(--panel-soft);
    resize: vertical;
    line-height: 1.55;
}

.auth-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--muted);
    font-family: "JetBrains Mono", ui-monospace, monospace;
}

.hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
    align-items: center;
}

.hero-card {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.hero-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.95rem;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    font: inherit;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn.small {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.btn.tiny {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.btn.primary {
    background: var(--accent);
    color: #0a1411;
    box-shadow: 0 12px 22px rgba(126, 200, 255, 0.24);
}

.btn.primary:hover {
    transform: translateY(-1px);
    background: var(--accent-dark);
}

.btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--ink);
}

.btn.ghost:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 16px rgba(26, 42, 58, 0.18);
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.tile {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    display: grid;
    gap: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.tile:hover {
    transform: translateY(-3px);
    border-color: rgba(126, 200, 255, 0.45);
}

.tile-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-dark);
    border: 1px solid rgba(126, 200, 255, 0.45);
    width: fit-content;
}

.tile.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.side-layout {
    position: relative;
    width: 100%;
    display: block;
    gap: 20px;
}

.side-panel {
    background: var(--panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 18px;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    bottom: 0;
    width: var(--side-width);
    border-radius: 0 18px 18px 0;
    max-height: calc(100vh - var(--nav-height));
    overflow: auto;
    display: grid;
    gap: 12px;
    align-content: start;
}

.side-panel__header h3 {
    margin: 2px 0 6px;
}

.side-panel__hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.side-panel__nav {
    display: grid;
    gap: 10px;
    align-content: start;
}

body.customer-portal .side-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
}

body.customer-portal .side-panel__nav {
    margin-top: 0;
}

body.customer-portal .side-link {
    min-height: 54px;   /* kompakter als früher (92px), aber noch mit Luft */
}

.side-link {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-soft);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.side-link:hover {
    transform: translateY(-2px);
    border-color: rgba(126, 200, 255, 0.45);
    box-shadow: 0 12px 18px rgba(26, 42, 58, 0.08);
}

.side-link--disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(0.3);
}

.side-link__badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--border);
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.side-link__row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.side-link__label {
    font-weight: 600;
}

.side-link__desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.side-link--child {
    background: rgba(234, 243, 255, 0.7);
    border-style: dashed;
}

.side-link--summary {
    list-style: none;
    cursor: pointer;
}

.side-link--summary::-webkit-details-marker {
    display: none;
}

.side-group {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 2px;
}

.side-group summary {
    outline: none;
}

.side-group__children {
    display: grid;
    gap: 8px;
    margin: 8px 4px 4px 10px;
    border-left: 2px solid rgba(126, 200, 255, 0.35);
    padding-left: 10px;
}

.side-panel__content {
    background: var(--panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px;
    display: grid;
    gap: 16px;
    margin-left: 0;
}

.content-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.content-card {
    background: var(--panel-soft);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    display: grid;
    gap: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid var(--border);
}

.pill--new {
    color: var(--accent-dark);
    border-color: rgba(126, 200, 255, 0.6);
    background: rgba(126, 200, 255, 0.12);
}

.pill--active {
    color: #0a1411;
    border-color: rgba(76, 226, 180, 0.5);
    background: rgba(76, 226, 180, 0.2);
}

.pill--soon {
    color: var(--muted);
    border-color: rgba(26, 42, 58, 0.25);
    background: rgba(26, 42, 58, 0.06);
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgba(126, 200, 255, 0.14);
    border: 1px solid rgba(126, 200, 255, 0.4);
    color: var(--ink);
    margin: 0 6px 6px 0;
}

.responsible-display {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 17, 26, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 20px;
}

.modal-backdrop.is-open {
    display: flex;
}

.modal-card {
    width: min(560px, 100%);
    background: var(--panel);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-rows: auto 1fr auto;
    max-height: min(80vh, 720px);
    overflow: hidden;
}

.modal-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-body {
    padding: 16px 18px;
    display: grid;
    gap: 12px;
    overflow: auto;
}

.modal-actions {
    padding: 16px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.responsible-list {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow: auto;
    padding-right: 6px;
}

.responsible-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    cursor: pointer;
}

.responsible-item input {
    width: 16px;
    height: 16px;
}

.responsible-name {
    font-weight: 600;
}

.responsible-sub {
    font-size: 0.8rem;
    color: var(--muted);
}

.chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 20px;
    align-items: stretch;
}

.chat-main {
    background: var(--panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: clamp(520px, 70vh, 760px);
}

.chat-header {
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.chat-target {
    font-family: "Unbounded", sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
}

.chat-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.chat-self {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--muted);
}

.chat-self-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(76, 226, 180, 0.18);
    color: var(--accent);
    font-weight: 700;
    border: 1px solid rgba(76, 226, 180, 0.35);
    background-size: cover;
    background-position: center;
}

.chat-messages {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    min-height: 0; /* required so CSS grid constrains the height instead of growing with content */
    background: linear-gradient(180deg, rgba(234, 243, 255, 0.6), rgba(247, 251, 255, 0.95));
}

.chat-bubble {
    max-width: 70%;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    display: grid;
    gap: 6px;
}

.chat-bubble.mine {
    margin-left: auto;
    background: rgba(126, 200, 255, 0.22);
    border-color: rgba(126, 200, 255, 0.45);
}

.chat-bubble.theirs {
    margin-right: auto;
}

/* Datums-Trenner zwischen Nachrichten verschiedener Tage */
.chat-date-divider {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px 0 6px;
}
.chat-date-divider span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid var(--border);
    padding: 3px 12px;
    border-radius: 999px;
}

.chat-text {
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-time {
    font-size: 0.75rem;
    color: var(--muted);
}

.chat-input {
    padding: 16px 20px 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    border-top: 1px solid var(--border);
}

.chat-input input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font: inherit;
    color: var(--ink);
    background: var(--panel-soft);
}

.chat-sidebar {
    background: var(--panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-rows: auto 1fr;
    height: clamp(520px, 70vh, 760px);
}

.chat-sidebar-header {
    padding: 16px 18px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.chat-sidebar h3 {
    margin: 0;
}

.user-list {
    padding: 14px 12px 18px;
    display: grid;
    gap: 10px;
    overflow-y: auto;
    align-content: start;
    min-height: 0; /* required so CSS grid constrains the height instead of growing with content */
}

.user-list.is-scrollable {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 6px;
}

.scroll-frame {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 6px;
}

.user-item {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    border-radius: 14px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.member-item {
    grid-template-columns: auto 1fr auto;
}

.member-remove {
    white-space: nowrap;
}

.user-item:hover {
    transform: translateY(-1px);
    border-color: rgba(126, 200, 255, 0.45);
}

.user-item.active {
    border-color: rgba(126, 200, 255, 0.7);
    box-shadow: 0 12px 20px rgba(26, 42, 58, 0.2);
}

.avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: rgba(76, 226, 180, 0.18);
    color: var(--accent);
    font-weight: 700;
    background-size: cover;
    background-position: center;
}

.user-info {
    display: grid;
    gap: 2px;
}

.user-name {
    font-weight: 600;
}

.employee-label {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.employee-label:hover {
    color: var(--accent-dark);
}

.customer-units-label {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.customer-units-label:hover {
    color: var(--accent-dark);
}

.user-sub {
    font-size: 0.8rem;
    color: var(--muted);
}

.user-time {
    font-size: 0.75rem;
    color: rgba(154, 163, 160, 0.7);
}

.chat-empty {
    color: var(--muted);
    padding: 12px;
    text-align: center;
}

.settings-card {
    width: 100%;
    max-width: none;
}

.avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 20px;
    background: rgba(76, 226, 180, 0.18);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.8rem;
    border: 1px solid rgba(76, 226, 180, 0.35);
    background-size: cover;
    background-position: center;
}

.divider {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.avatar img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
    flex-shrink: 0;
}

.workspace {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.admin-grid {
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.6fr);
    align-items: start;
}

.user-list-card {
    min-height: 520px;
}

.user-list-card .table-wrap {
    max-height: 420px;
    overflow-y: auto;
}

.card {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: grid;
    gap: 12px;
}

.employee-profile-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 20, 30, 0.62);
    z-index: 1200;
}

.employee-profile-modal.is-open {
    display: flex;
}

.employee-profile-card {
    width: min(520px, 100%);
    max-height: min(80vh, 600px);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 20px;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.employee-profile-body {
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}

.employee-profile-close {
    position: absolute;
    right: 12px;
    top: 12px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    color: var(--ink);
    border-radius: 999px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-weight: 700;
}

.employee-profile-head {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: center;
}

.employee-profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: rgba(76, 226, 180, 0.18);
    border: 1px solid rgba(76, 226, 180, 0.32);
    background-size: cover;
    background-position: center;
    display: grid;
    place-items: center;
    color: var(--accent-dark);
    font-weight: 700;
    font-size: 1.6rem;
}

.employee-profile-bio a {
    color: #1d5fd0;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}

.employee-profile-bio a:hover {
    color: #0b4bb8;
}

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

.dropzone {
    border: 1px dashed rgba(26, 42, 58, 0.2);
    border-radius: 16px;
    padding: 26px;
    background: linear-gradient(135deg, rgba(234, 243, 255, 0.9), rgba(247, 251, 255, 0.98));
    text-align: center;
    display: grid;
    gap: 14px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone.dragover {
    border-color: var(--accent);
    background: rgba(126, 200, 255, 0.22);
}

.dropzone strong {
    font-size: 1.1rem;
}

.dropzone small {
    color: var(--muted);
}

.file-meta {
    font-size: 0.95rem;
    color: var(--muted);
    background: var(--panel-soft);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

input[type="file"] {
    display: none;
}

.variables-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}

.variables-table th,
.variables-table td {
    text-align: left;
    padding: 8px 0;
    font-size: 0.95rem;
}

.variables-table th {
    color: var(--muted);
    font-weight: 600;
}

.variables-table input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font: inherit;
    color: var(--ink);
    background: var(--panel-soft);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    min-width: 1080px;
}

@media (max-width: 820px) {
    .user-table {
        min-width: 640px; /* still scrollable but less extreme on tablets */
        font-size: 0.82rem;
    }
    .user-table th,
    .user-table td {
        padding: 8px 8px;
    }
}

.user-table th,
.user-table td {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.95rem;
}

.user-table th {
    color: var(--muted);
    font-weight: 600;
    background: rgba(234, 243, 255, 0.9);
    position: sticky;
    top: 0;
}

.user-table input[type="text"],
.user-table input[type="password"],
.user-table input[type="email"],
.user-table input[type="date"] {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font: inherit;
    color: var(--ink);
    background: var(--panel-soft);
}

.user-table select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font: inherit;
    color: var(--ink);
    background: var(--panel-soft);
}

.table-empty {
    color: var(--muted);
    padding: 16px 0;
}

.row-actions {
    text-align: right;
}

.user-table tbody tr {
    border-bottom: 1px solid var(--border);
}

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

.mono {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.9rem;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.note {
    font-size: 0.85rem;
    color: var(--muted);
}

.status {
    display: grid;
    gap: 12px;
}

.terminal {
    background: #f2f7ff;
    color: var(--ink);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.terminal-header {
    background: #e3efff;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.terminal textarea {
    width: 100%;
    height: 160px;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 14px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.9rem;
    resize: none;
}

[data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    animation: fade-up 0.7s ease forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes fade-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 820px) {
    body.has-side-panel .page {
        padding-left: 24px;
        padding-right: 24px;
    }

    /* ── Single-row navbar on mobile ──────────────────────────────
       Brand text is hidden; the logo alone identifies the app.
       nav-actions fills the rest of the row so the sidebar.js burger
       + centred items + logout layout works as intended.             */
    .navbar {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 10px 14px;
    }

    .navbar .brand-link {
        display: none;
    }

    .nav-actions {
        flex: 1;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .chat-layout {
        grid-template-columns: 1fr;
    }

    /* sidebar.js injects the mobile drawer styles directly, so we only need
       to reset the desktop fixed-position here. The injected CSS takes over. */
    .side-panel {
        position: static;
        width: 100%;
        border-radius: var(--radius);
        max-height: none;
        top: 0;
        bottom: auto;
    }
}

@media (max-width: 820px) {
    /* On tablet+mobile: hide username pill — avatar alone is sufficient */
    .nav-user {
        display: none;
    }
}

@media (max-width: 520px) {
    /* (nav-user already hidden above) */

    /* Make Settings button more compact so it fits alongside Logout */
    .navbar #settingsBtn {
        padding: 0 10px;
        font-size: 0.78rem;
        min-height: 30px;
        height: 30px;
    }

    /* Responsive page headings — Unbounded font at full size is very wide */
    .page h1,
    .hero h1 {
        font-size: clamp(1.35rem, 7vw, 2rem);
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Hero lead text can afford a touch smaller */
    .hero .lead {
        font-size: 0.93rem;
    }

    /* Tighten hero padding on small screens */
    .hero {
        gap: 16px;
    }

    /* Card headers stack but keep a bit of breathing room */
    .card-header h2 {
        font-size: clamp(1rem, 5vw, 1.2rem);
    }
}

@media (max-width: 720px) {
    .actions {
        width: 100%;
        justify-content: center;
    }

    .actions .btn {
        flex: 1 1 auto;
        text-align: center;
    }

    /* Form buttons full-width on all mobile sizes (not only sub-480px) */
    .form-grid > .btn {
        width: 100%;
    }

    .auth-meta {
        flex-direction: column;
        gap: 6px;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    /* Buttons inside a stacked card-header should be centered */
    .card-header .btn {
        align-self: center;
        width: fit-content;
    }
}

@media (max-width: 480px) {
    /* Tighter card padding on phones so content has more room */
    .card {
        padding: 14px 14px;
    }

    /* Workspace sections closer together */
    .workspace {
        padding-left: 14px;
        padding-right: 14px;
    }

    /* Page horizontal padding tighter */
    body.has-side-panel .page {
        padding-left: 14px;
        padding-right: 14px;
    }

    /* Modals: full padding reduction */
    .ob-modal {
        padding: 12px;
    }
}

/* ================================================================
   MOBILE – additional responsive polish
   ================================================================ */

/* ── Ticket table: denser on small screens ─────────────────────── */
@media (max-width: 640px) {
    .ticket-table th {
        font-size: .67rem;
        padding: 8px 10px;
    }
    .ticket-table td {
        font-size: .78rem;
        padding: 8px 10px;
    }
    .status-badge {
        font-size: .67rem;
        padding: 2px 7px;
    }
}

/* ── Bottom-sheet modals on small phones (≤ 480px) ────────────────
   Modals that center a floating card on desktop become full-width
   sheets docked to the bottom of the screen on phones, which feels
   more native and avoids content being clipped.                    */
@media (max-width: 480px) {
    /* Generic modal-backdrop (user-verwaltung, etc.) */
    .modal-backdrop {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }

    /* gruppe-verwalten */
    .group-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .group-modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }

    /* kunden-verwalten create + unit-assign */
    .create-customer-modal,
    .unit-assign-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .create-customer-card,
    .unit-assign-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }

    /* tickets detail modal + transfer popup */
    .modal-overlay,
    .transfer-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .modal-box,
    .transfer-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }

    /* generic simple-modal (kunden-ablage, dokumentenablage, etc.) */
    .simple-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .simple-modal .card,
    .simple-modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }

    /* leads modals */
    .leads-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .leads-modal-card,
    .leads-modal-card-sm {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
}

/* ── Property-header action buttons: compact on phones ────────── */
@media (max-width: 480px) {
    .property-header {
        gap: 8px;
        padding: 12px 10px;
    }
    .property-actions .btn {
        padding: 6px 8px;
        font-size: .78rem;
    }
    .unit-item {
        flex-wrap: wrap;
    }
    .unit-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ── Navbar: extra compact on phones ──────────────────────────── */
@media (max-width: 480px) {
    .navbar {
        padding: 8px 12px;
    }

    /* nav-actions fits in one row now: [burger][bell][avatar][logout] */
    .nav-actions {
        gap: 6px;
    }
}

/* ── Document / ablage items: stack on tiny phones ─────────────── */
@media (max-width: 380px) {
    .doc-item {
        grid-template-columns: auto 1fr !important;
    }
    .doc-actions {
        grid-column: 1 / -1;
        justify-content: flex-start !important;
    }
}

/* ── faq-verwalten: prevent horizontal overflow on mobile ─────────── */
@media (max-width: 820px) {
    /* Grid items default to min-width:auto, which lets them grow past 1fr.
       Force cards to stay inside their grid cell. */
    .faq-workspace > * {
        min-width: 0;
        width: 100%;
    }
    .faq-workspace .card {
        overflow: hidden;
        box-sizing: border-box;
    }
    /* Long compound words (e.g. "Willkommensnachricht") must wrap */
    .faq-workspace .card *,
    .faq-workspace .card-header h2 {
        word-break: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
}

/* ── faq-verwalten: doc action buttons stack below filename on phones */
@media (max-width: 540px) {
    .faq-workspace .doc-item {
        display: grid !important;
        grid-template-columns: auto 1fr !important;
        grid-template-rows: auto auto !important;
        grid-template-areas: "icon info" ".    btns" !important;
        align-items: start !important;
        gap: 4px 10px !important;
    }
    .faq-workspace .doc-icon   { grid-area: icon !important; padding-top: 2px; }
    .faq-workspace .doc-info   { grid-area: info !important; min-width: 0 !important; }
    .faq-workspace .doc-delete { grid-area: btns !important; display: flex !important; flex-wrap: wrap !important; gap: 6px !important; }
}

/* ── ob-modal (Objektbestand/Wohnungsdaten/Unit modals) ─────────── */
@media (max-width: 480px) {
    .ob-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .ob-modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
}

/* ── faq-edit-modal & edit-customer-modal ────────────────────────── */
@media (max-width: 480px) {
    .faq-edit-modal,
    .edit-customer-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .faq-edit-card,
    .edit-customer-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
}

/* ── Unit action buttons: wrap on mobile (5 buttons in a row) ───── */
@media (max-width: 640px) {
    .unit-actions {
        flex-wrap: wrap !important;
        gap: 5px !important;
    }
    .unit-actions .btn {
        font-size: .75rem !important;
        padding: 5px 8px !important;
    }
}

/* ── card-header with many buttons: wrap on mobile ──────────────── */
@media (max-width: 520px) {
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .card-header-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
    .card-header-actions .btn {
        flex: 1 1 auto;
        text-align: center;
        min-width: 0;
    }
}

/* ── Touch targets: minimum 44×44px for interactive elements ────── */
@media (max-width: 820px) {
    .icon-btn {
        width: 44px !important;
        height: 44px !important;
    }
    /* notification bell and nav buttons */
    .notif-btn {
        min-width: 44px;
        min-height: 44px;
    }
    /* Side-panel links already large enough; unit-actions handled above */
}

/* ── Welcome popup: fit to mobile screen ────────────────────────── */
@media (max-width: 480px) {
    #welcomePopupOverlay > div {
        padding: 20px 16px !important;
        max-height: 95vh !important;
        border-radius: 18px 18px 0 0 !important;
        align-self: flex-end !important;
    }
    #welcomePopupOverlay {
        align-items: flex-end !important;
    }
}

/* ================================================================
   MOBILE/TABLET DEEP-OPTIMISATION
   ================================================================ */

/* ── Touch targets: .btn minimum 44px on all touch devices ─────── */
@media (max-width: 820px) {
    .btn {
        min-height: 44px;
        padding: 11px 18px;
    }
    .btn.small {
        min-height: 40px;
        padding: 9px 14px;
    }
    /* .btn.tiny stays compact but gets wider tap area via min-width */
    .btn.tiny {
        min-height: 36px;
    }
    /* Burger: 44×44 */
    .side-panel-burger {
        width: 44px !important;
        height: 44px !important;
    }
}

/* ── Tables: prevent extreme horizontal scroll on phones ────────── */
@media (max-width: 480px) {
    /* user-table: allow narrower, rely on horizontal scroll wrapper */
    .user-table {
        min-width: 480px;
        font-size: 0.78rem;
    }
    .user-table th,
    .user-table td {
        padding: 7px 6px;
    }
    /* ticket-table font already reduced; tighten padding */
    .ticket-table th,
    .ticket-table td {
        padding: 7px 6px;
    }
    /* leads-table */
    .leads-table {
        font-size: 0.78rem;
    }
    .leads-table th,
    .leads-table td {
        padding: 7px 6px;
    }
}

/* ── Chat: bubbles wider + sidebar height unconstrained ─────────── */
@media (max-width: 820px) {
    .chat-sidebar {
        height: auto;
        min-height: 280px;
        max-height: 50vh;
    }
}
@media (max-width: 480px) {
    .chat-bubble {
        max-width: 92%;
    }
    .chat-input {
        padding: 10px 12px 14px;
        gap: 8px;
    }
    .chat-input input {
        padding: 10px 12px;
    }
}

/* ── Forms: slightly larger text & better spacing on mobile ─────── */
@media (max-width: 480px) {
    .field {
        gap: 6px;
    }
    .field label,
    .field > span:first-child {
        font-size: 0.88rem;
    }
    .field input,
    .field select,
    .field textarea {
        font-size: 1rem;   /* prevents iOS auto-zoom on focus */
        padding: 11px 12px;
    }
}

/* ── kf-modal (Kontaktformular) bottom-sheet on mobile ──────────── */
@media (max-width: 480px) {
    .kf-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .kf-modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
}

/* ── Kontaktformular type-card grid: 2 columns on phone ─────────── */
@media (max-width: 480px) {
    .ticket-type-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .type-card {
        padding: 12px 8px !important;
        font-size: 0.8rem !important;
    }
    .type-card-icon {
        font-size: 1.4rem !important;
    }
}

/* ── profil / customer dashboard ───────────────────────────────── */
@media (max-width: 480px) {
    .dash-main {
        gap: 12px;
    }
    .dash-left-col {
        gap: 12px;
    }
    .dash-card-header {
        gap: 8px;
    }
    .dash-stat-card {
        padding: 10px 10px;
    }
}

/* ── Objektbestand / property cards ────────────────────────────── */
@media (max-width: 480px) {
    .property-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    /* unit-actions already wraps; increase tap size */
    .unit-actions .btn {
        min-height: 40px !important;
        padding: 8px 10px !important;
        font-size: 0.82rem !important;
    }
}

/* ── Sidebar drawer overlay covers full viewport ────────────────── */
@media (max-width: 820px) {
    .side-panel {
        /* ensure it doesn't protrude sideways as static element */
        max-width: 100%;
    }
}

/* ── Tiny phones (≤380px): tightest padding ─────────────────────── */
@media (max-width: 380px) {
    body.has-side-panel .page {
        padding-left: 10px;
        padding-right: 10px;
    }
    .card {
        padding: 12px 10px;
    }
    .modal-backdrop {
        padding: 0 !important;
    }
    .modal-card {
        max-height: 95vh !important;
    }
}

/* ================================================================
   WEITERE MODALS ALS BOTTOM-SHEET (≤480px)
   ================================================================ */

/* ── Bild-Vorschau im Chat ──────────────────────────────────────── */
@media (max-width: 480px) {
    .image-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .image-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        overflow-y: auto;
    }
    .image-modal-content img {
        max-height: 60vh;
    }
    /* Close-Button 44px Touch-Target */
    .image-modal-close {
        width: 44px !important;
        height: 44px !important;
    }
}

/* ── Dokument-Vorschau (faq-verwalten) ─────────────────────────── */
@media (max-width: 480px) {
    .doc-preview-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .doc-preview-panel {
        width: 100% !important;
        height: 90vh !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
}

/* ── Wertentwicklung-Modal (Objektbestand) ──────────────────────── */
@media (max-width: 480px) {
    #valueTrackingModal.ob-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    #valueTrackingModal .ob-modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92vh !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
    /* Scrollbereich innerhalb des Modals */
    .vt-scroll {
        max-height: 45vh !important;
    }
}

/* ── Inline-Prompt (Datei umbenennen, Kundenablage) ─────────────── */
@media (max-width: 480px) {
    #inlinePromptOverlay {
        align-items: flex-end !important;
    }
    #inlinePromptOverlay > div {
        width: 100% !important;
        max-width: 100% !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        padding: 20px 16px 28px !important;
    }
}

/* ── Sidebar: Safe-Area für iPhone Home-Indicator ───────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 820px) {
        .side-panel__nav {
            padding-bottom: max(16px, env(safe-area-inset-bottom));
        }
    }
}

/* ═══════════════════════════════════════════════════════════════════
   iPad-Bereich: 821–1100px
   ─ Sidebar:  320px breit (Einträge nicht abgeschnitten)
   ─ Navbar:   Logo-Text + Username ausgeblendet, kein horizontales Scrollen
   ─ Chat:     Chat-Fenster oben, Userliste darunter – beide wachsen mit
               dem Viewport (3fr / 2fr-Split der verfügbaren Höhe)
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 821px) and (max-width: 1100px) {

    /* ── Sidebar breiter ─────────────────────────────────────────── */
    :root {
        --side-width: 320px;
    }

    body.has-side-panel .page {
        padding-left: calc(320px + 32px);
    }

    /* ── Navbar: kein Overflow ───────────────────────────────────── */
    .navbar {
        padding: 12px 18px;
        overflow: hidden;
    }

    .navbar .brand-link {
        display: none;
    }

    .nav-user {
        display: none;
    }

    /* ── Chat: Chat oben, Userliste darunter ─────────────────────── */
    /* Layout füllt den verfügbaren Platz unterhalb der Navbar aus.  */
    /* Chat bekommt 60 %, Userliste 40 % der Höhe.                    */
    .chat-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 3fr 2fr;
        height: calc(100dvh - var(--nav-height) - 48px);
        gap: 14px;
    }

    /* Chat-Main: Höhe vom Grid gesteuert, nicht mehr hardcoded */
    .chat-main {
        height: auto;
        min-height: 0;
    }

    /* Userliste: wächst auf 40 % der Gesamthöhe, scrollt intern */
    .chat-sidebar {
        min-height: 0;
        max-height: none;
        overflow: hidden;
        grid-template-rows: auto auto 1fr !important;
    }

    .chat-sidebar .user-list {
        overflow-y: auto;
        min-height: 0;
    }
}


/* ============================================================
   Visual polish & micro-interactions (global, alle Seiten)
   GPU-freundlich (nur transform/opacity), hover nur auf
   Hover-fähigen Geräten, voll mobil/tablet-tauglich.
   ============================================================ */

/* Sanftere Reveal-Kurve beim Laden */
[data-reveal] { animation-timing-function: cubic-bezier(.22,.61,.36,1); }

/* Weiches Scrollen */
html { scroll-behavior: smooth; }

/* ── Buttons: Lift + Press-Feedback ─────────────────────────── */
.btn {
    transition: transform .15s cubic-bezier(.4,0,.2,1),
                box-shadow .2s ease, background-color .2s ease,
                border-color .2s ease, filter .2s ease;
}
@media (hover: hover) {
    .btn:hover        { transform: translateY(-1px); }
    .btn.primary:hover{ box-shadow: 0 8px 22px rgba(74,168,242,.35); filter: brightness(1.04); }
    .btn.ghost:hover  { box-shadow: 0 4px 14px rgba(26,42,58,.10); }
}
.btn:active { transform: translateY(0) scale(.97); }

/* ── Cards: dezenter Hover-Lift (nur Desktop) ───────────────── */
.card {
    transition: transform .25s cubic-bezier(.4,0,.2,1),
                box-shadow .25s ease, border-color .2s ease;
}
@media (hover: hover) and (min-width: 821px) {
    .card:hover { transform: translateY(-3px); box-shadow: 0 24px 50px rgba(26,42,58,.16); }
}

/* ── Stat-/Listen-Elemente: feine Interaktionen ─────────────── */
.dash-stat-card, .dash-op-row, .user-item, .type-card, .customers-table-row {
    transition: transform .18s ease, box-shadow .2s ease,
                background-color .2s ease, border-color .2s ease;
}
@media (hover: hover) {
    .dash-stat-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(26,42,58,.14); }
    .dash-op-row:hover    { transform: translateX(3px); }
    .type-card:hover      { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(26,42,58,.12); }
    .side-link            { transition: transform .15s ease, background-color .2s ease, border-color .2s ease; }
    .side-link:hover      { transform: translateX(3px); }
    .nav-avatar, .notif-btn { transition: transform .15s ease; }
    .nav-avatar:hover, .notif-btn:hover { transform: scale(1.08); }
}

/* Ticket-/Tabellen-Zeilen: weicher Hover */
.ticket-table tbody tr, .leads-table tbody tr, .user-table tbody tr {
    transition: background-color .15s ease;
}

/* ── Eingabefelder: sanfter Fokus-Ring ──────────────────────── */
input, textarea, select {
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 3px rgba(126,200,255,.30);
}

/* ── Modals: Overlay-Fade + Card-Pop-in ─────────────────────── */
@keyframes overlay-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: none; }
}
.modal-overlay.is-open, .transfer-overlay.is-open, .ob-modal.is-open,
.modal-backdrop.is-open, .create-customer-modal.is-open, .edit-customer-modal.is-open,
.unit-assign-modal.is-open, .group-modal.is-open, .kf-modal.is-open,
.att-overlay:not(.is-hidden) {
    animation: overlay-fade .18s ease;
}
.modal-overlay.is-open .modal-box,
.modal-overlay.is-open .modal-card,
.modal-overlay.is-open .dialog-card,
.transfer-overlay.is-open .transfer-card,
.ob-modal.is-open .ob-modal-card,
.modal-backdrop.is-open .modal-card,
.create-customer-modal.is-open .create-customer-card,
.edit-customer-modal.is-open .edit-customer-card,
.unit-assign-modal.is-open .unit-assign-card,
.group-modal.is-open .group-modal-card,
.kf-modal.is-open .kf-modal-card,
.att-overlay:not(.is-hidden) .att-card {
    animation: modal-pop .24s cubic-bezier(.22,.61,.36,1);
}

/* ── Badges: kleiner Pop beim Erscheinen ────────────────────── */
@keyframes badge-pop { 0% { transform: scale(0); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
.chat-unread-badge, .notif-badge.is-visible { animation: badge-pop .3s cubic-bezier(.34,1.56,.64,1); }

/* ── Bilder/Thumbnails: weiches Erscheinen ──────────────────── */
.chat-image-thumb, .att-thumb img { transition: transform .2s ease, filter .2s ease; }
@media (hover: hover) {
    .chat-image-thumb:hover { transform: scale(1.03); }
}

/* ============================================================
   Reduced motion: alles ruhigstellen (Barrierefreiheit)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
    [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ============================================================
   Akzent-Schicht (global) — Markenfarbe stärker zur Geltung
   bringen. Weiterhin mobil/tablet-tauglich & reduced-motion-safe.
   ============================================================ */

/* Primary-Buttons: Verlauf statt Flachfarbe + Glow */
.btn.primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #07223b;
    border: none;
}

/* Eyebrow: Akzentfarbe + kleiner führender Balken */
.eyebrow {
    color: var(--accent-dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.eyebrow::before {
    content: "";
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    display: inline-block;
}

/* Navbar: feine Akzent-Linie unten.
   (backdrop-filter wurde entfernt: eine sticky-Navbar mit Backdrop-Blur ließ den
   Hintergrund bei offenem Modal flackern, weil der Bereich pro Frame neu geblurrt
   wurde. Der deckendere Hintergrund oben ersetzt den Glas-Effekt optisch.) */
.navbar {
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg, transparent, rgba(74,168,242,.45), transparent) 1;
}

/* Section-Überschriften: dezenter Akzentbalken davor */
.card-header h2 {
    position: relative;
    padding-left: 14px;
}
.card-header h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 1em;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}

/* Aktiver Sidebar-Menüpunkt: Akzent + Glow + Leiste */
.side-link.is-current {
    background: linear-gradient(135deg, rgba(126,200,255,.18), rgba(74,168,242,.10));
    border-color: rgba(74,168,242,.45) !important;
    position: relative;
    box-shadow: 0 6px 18px rgba(74,168,242,.14);
}
.side-link.is-current::before {
    content: "";
    position: absolute;
    left: 0; top: 12%;
    height: 76%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}
.side-link.is-current .side-link__label { color: var(--accent-dark); font-weight: 700; }

/* Subtiler Akzent-Glow hinter dem Seiten-Header */
.hero { position: relative; }
.hero::before {
    content: "";
    position: absolute;
    top: -40px; right: -20px;
    width: 320px; height: 220px;
    max-width: 60vw;
    background: radial-gradient(circle at 70% 30%, rgba(126,200,255,.28), transparent 70%);
    filter: blur(8px);
    pointer-events: none;
    z-index: 0;
}
.hero > * { position: relative; z-index: 1; }

/* Textauswahl in Markenfarbe */
::selection { background: rgba(126,200,255,.45); color: #07223b; }

/* Sichtbarer, markenkonformer Fokus (Tastatur-Navigation / A11y) */
:focus-visible {
    outline: 2px solid var(--accent-dark);
    outline-offset: 2px;
    border-radius: 6px;
}
