/* =========================================================================
   portal.css — Shared Portal Components for felmar.phnx.dev
   Coral-Cream Brand System (mobile-first)
   =========================================================================
   Sections:
     1.  CSS Variables (Coral-Cream Brand)
     2.  Reset & Base
     3.  Layout (body, .portal-container, .portal-header, .portal-main)
     4.  Bottom-Nav (5 items: Home, Services, +, Stats, Settings)
     5.  Plus-Button-Popup (Halbkreis 180deg)
     6.  Settings-Submenu (right-aligned popup)
     7.  Language-Switcher (DE / EN / ES / FR)
     8.  Cards (.service-card, .kpi-card, .status-card)
     9.  Buttons (.btn-primary, .btn-secondary, .btn-ghost)
     10. Forms (input, textarea, select, label)
     11. Modals / Popups
     12. Utilities & Reduced-Motion
   ========================================================================= */


/* =========================================================================
   1. CSS VARIABLES (Coral-Cream Brand)
   ========================================================================= */
:root {
    /* Coral-Skala */
    --coral: #d96858;
    --coral-dark: #c45848;
    --coral-light: #e89485;

    /* Cream-Skala */
    --cream: #fff5e9;
    --cream-warm: #fae6cc;
    --sand: #f0e6d2;

    /* Surfaces */
    --card-bg: #fffbf5;

    /* Ink (Text) */
    --ink: #2c2825;
    --ink-soft: #6b5e54;

    /* Status-Farben */
    --green: #2d8a4d;
    --amber: #b8842a;
    --red: #c0392b;

    /* Shadows (Dual-Shadow Neumorphism-Light) */
    --shadow-soft: -4px -4px 12px rgba(255, 255, 255, 0.6),
                    4px 4px 12px rgba(212, 104, 88, 0.08);
    --shadow-lift: -4px -4px 12px rgba(255, 255, 255, 0.7),
                    6px 8px 20px rgba(212, 104, 88, 0.15);

    /* Spacing / Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    /* Transitions */
    --t-fast: 150ms ease;
    --t-base: 200ms ease;
    --t-slow: 350ms ease;

    /* Bottom-Nav Höhe */
    --nav-h: 72px;
}


/* =========================================================================
   2. RESET & BASE
   ========================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    background: linear-gradient(180deg, #FFF5E9 0%, #FAE6CC 100%);
    background-attachment: fixed;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh; /* Fallback für iOS Safari: dynamic viewport height, schließt iOS URL-Bar automatisch aus */
    padding-top: env(safe-area-inset-top, 0px); /* Dynamic Island / Notch (iPhone) oder Status-Bar (Android) */
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); /* Bottom-Nav 72px + Home-Indicator (iPhone 34px, Android 0px) — URL-Bar-Position egal, das ist nur System-Chrome */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    font-size: 16px;
}

a {
    color: var(--coral);
    text-decoration: none;
}

a:hover {
    color: var(--coral-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}


/* =========================================================================
   3. LAYOUT
   ========================================================================= */

/* --- .portal-container: Haupt-Wrapper --- */
.portal-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
    min-height: calc(100dvh - 80px);
}

/* --- .portal-header: Top-Nav mit Logo + Actions --- */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 20px;
    gap: 12px;
}

.portal-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.portal-header .logo img,
.portal-header .logo svg {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
}

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

.portal-header .header-actions .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink-soft);
    box-shadow: var(--shadow-soft);
    transition: all var(--t-fast);
    font-size: 18px;
}

.portal-header .header-actions .icon-btn:hover,
.portal-header .header-actions .icon-btn:active {
    color: var(--coral);
    transform: translateY(-1px);
}

/* --- .portal-main: Content-Bereich --- */
.portal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 24px;
}

/* === KANÄLE: kompakte 1-Zeile mit Status-Pills + Resync-Button === */
.vchans {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    min-height: 44px;
    background: transparent;
    border-radius: 10px;
    border: 1px solid var(--border-soft, rgba(107, 94, 84, 0.12));
}
.vchans-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.vchans-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}
.vchans-pills {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.ch-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(40, 167, 69, 0.12);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.25);
    white-space: nowrap;
}
.ch-dot.off {
    background: rgba(107, 114, 128, 0.10);
    color: #6b7280;
    border-color: rgba(107, 114, 128, 0.20);
}
.ch-dot.pending {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.30);
}
.vchans-resync {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(212, 104, 88, 0.08);
    color: var(--coral, #d96858);
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-height: 26px;
    border: 1px solid rgba(212, 104, 88, 0.18);
    transition: background 150ms ease, transform 100ms ease;
    flex-shrink: 0;
}
.vchans-resync:active {
    background: rgba(212, 104, 88, 0.16);
    transform: translateY(1px);
}
.vchans-resync svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}

/* --- Section-Title --- */
.section-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 8px 0 4px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--ink-soft);
    margin-bottom: 12px;
}


/* =========================================================================
   4. BOTTOM-NAV (5 Items)
   ========================================================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: rgba(255, 251, 245, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(212, 104, 88, 0.12);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    flex: 1;
    min-width: 0;
    height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color var(--t-fast);
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px 4px 12px;
    user-select: none;
    position: relative;
}

/* Icons: 24x24, prominent */
.bottom-nav-item .nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform var(--t-fast);
}

.bottom-nav-item .nav-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 1.8;
}

/* Labels: small, normal-case, kompakt */
.bottom-nav-item .label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bottom-nav-item:hover {
    color: var(--coral);
}

.bottom-nav-item:hover .nav-icon {
    transform: translateY(-2px);
}

.bottom-nav-item.active {
    color: var(--coral);
}

.bottom-nav-item.active .nav-icon {
    transform: translateY(-2px);
}

.bottom-nav-item.active .nav-icon svg {
    stroke-width: 2.2;
}

/* Plus-Button in der Mitte — hervorgehoben aber nicht ueberdimensioniert */
.bottom-nav-item.plus {
    flex: 0 0 60px;
    margin-top: -8px;
    position: relative;
}

.bottom-nav-item.plus .plus-circle {
    flex-shrink: 0;
    flex-grow: 0;
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    max-width: 52px;
    max-height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--coral), var(--coral-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(212, 104, 88, 0.32);
    margin: 0 auto 4px;
}

.bottom-nav-item.plus .plus-circle svg {
    width: 24px;
    height: 24px;
    color: #fff;
    stroke-width: 2.5;
}

.bottom-nav-item.plus .label {
    margin-top: 6px;
    color: var(--ink-soft);
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    width: auto;
}

.bottom-nav-item.plus:hover .plus-circle,
.bottom-nav-item.plus.active .plus-circle {
    transform: scale(1.08) rotate(90deg);
}


/* =========================================================================
   5. PLUS-BUTTON (deprecated Halbkreis — replaced by Action-Sheet, see Section 13)
   ========================================================================= */


/* =========================================================================
   6. SETTINGS-SUBMENU (right-aligned popup)
   ========================================================================= */
.settings-submenu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 200ms ease;
    z-index: 90;
}

.settings-submenu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-submenu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.settings-submenu-item .si-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
    color: var(--ink-soft);
    transition: color var(--t-fast);
}

.settings-submenu-item:hover,
.settings-submenu-item:active {
    background: var(--coral);
    color: #fff;
}

.settings-submenu-item:hover .si-icon,
.settings-submenu-item:active .si-icon {
    color: #fff;
}

.settings-submenu-item.danger {
    color: var(--red);
}

.settings-submenu-item.danger .si-icon {
    color: var(--red);
}

.settings-submenu-item.danger:hover {
    background: var(--red);
    color: #fff;
}

.settings-submenu-item.danger:hover .si-icon {
    color: #fff;
}

.settings-submenu-divider {
    height: 1px;
    background: var(--sand);
    margin: 4px 0;
}


/* =========================================================================
   7. LANGUAGE-SWITCHER (DE / EN / ES / FR)
   ========================================================================= */
.language-switcher {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px;
}

.lang-btn {
    flex: 1;
    min-width: 56px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--sand);
    background: var(--cream);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--t-fast);
    text-align: center;
    text-transform: uppercase;
}

.lang-btn:hover {
    border-color: var(--coral-light);
    color: var(--coral);
}

.lang-btn.active {
    background: var(--coral);
    border-color: var(--coral);
    color: #fff;
    box-shadow: 0 2px 8px rgba(212, 104, 88, 0.3);
}

/* Compact-Variante für Header */
.language-switcher.compact .lang-btn {
    padding: 6px 10px;
    font-size: 11px;
    min-width: 40px;
}


/* =========================================================================
   8. CARDS
   ========================================================================= */

/* --- Service-Card --- */
.service-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform var(--t-base), box-shadow var(--t-base);
    cursor: pointer;
    border: 1px solid transparent;
}

.service-card:hover,
.service-card:active {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lift);
    border-color: rgba(212, 104, 88, 0.1);
}

.service-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--cream-warm) 0%, var(--sand) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.service-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.3;
}

.service-card-desc {
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.4;
}

.service-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--sand);
}

.service-card-arrow {
    color: var(--coral);
    font-size: 18px;
    transition: transform var(--t-fast);
}

.service-card:hover .service-card-arrow {
    transform: translateX(4px);
}

/* --- KPI-Card --- */
.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    transition: transform var(--t-base), box-shadow var(--t-base);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
}

.kpi-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--coral);
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.kpi-label {
    font-size: 11px;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-top: 4px;
}

.kpi-trend {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.flat { color: var(--ink-soft); }

/* KPI-Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* --- Status-Card / Status-Pill --- */
.status-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: transform var(--t-base);
}

.status-card:hover {
    transform: translateY(-2px);
}

.status-card-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.status-card-sub {
    font-size: 12px;
    color: var(--ink-soft);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.status-pill::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-pill.connected {
    background: rgba(45, 138, 77, 0.12);
    color: var(--green);
}

.status-pill.connected::before {
    background: var(--green);
}

.status-pill.pending {
    background: rgba(184, 132, 42, 0.12);
    color: var(--amber);
}

.status-pill.pending::before {
    background: var(--amber);
}

.status-pill.error {
    background: rgba(192, 57, 43, 0.12);
    color: var(--red);
}

.status-pill.error::before {
    background: var(--red);
}


/* =========================================================================
   9. BUTTONS
   ========================================================================= */
.btn-primary,
.btn-secondary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
    border: 2px solid transparent;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
}

.btn-primary {
    background: var(--coral);
    color: #fff;
    border-color: var(--coral);
    box-shadow: 0 4px 12px rgba(212, 104, 88, 0.25);
}

.btn-primary:hover,
.btn-primary:active {
    background: var(--coral-dark);
    border-color: var(--coral-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(212, 104, 88, 0.35);
}

.btn-secondary {
    background: var(--cream);
    color: var(--coral);
    border-color: var(--coral);
}

.btn-secondary:hover,
.btn-secondary:active {
    background: var(--cream-warm);
    color: var(--coral-dark);
    border-color: var(--coral-dark);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--coral);
    border-color: transparent;
    padding: 10px 16px;
}

.btn-ghost:hover,
.btn-ghost:active {
    background: rgba(212, 104, 88, 0.08);
    color: var(--coral-dark);
}

/* Button-Größen */
.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}


/* =========================================================================
   10. FORMS
   ========================================================================= */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

label {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    background: var(--cream);
    border: 2px solid var(--sand);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input::placeholder,
textarea::placeholder {
    color: var(--ink-soft);
    opacity: 0.6;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--coral);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(212, 104, 88, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b5e54' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--coral);
    cursor: pointer;
}

/* Form-Row (zwei Spalten) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Input mit Icon */
.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-soft);
    font-size: 18px;
    pointer-events: none;
}

.input-wrapper input {
    padding-left: 44px;
}

/* Toggle-Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--sand);
    border-radius: var(--radius-pill);
    transition: background var(--t-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--t-fast);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider {
    background: var(--coral);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}


/* =========================================================================
   11. MODALS / POPUPS
   ========================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
    z-index: 200;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    transform: scale(0.9) translateY(20px);
    transition: transform 200ms ease;
}

.modal-overlay.visible .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--cream);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink-soft);
    font-size: 20px;
    transition: all var(--t-fast);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--coral);
    color: #fff;
}

.modal-body {
    font-size: 15px;
    color: var(--ink);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: flex-end;
}

.modal-footer .btn {
    flex: 1;
}

/* Sheet-Variante (von unten) */
.modal-overlay.sheet {
    align-items: flex-end;
    padding: 0;
}

.modal-overlay.sheet .modal-content {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    transform: translateY(100%);
    transition: transform 250ms ease;
}

.modal-overlay.sheet.visible .modal-content {
    transform: translateY(0);
}


/* =========================================================================
   12. UTILITIES & REDUCED-MOTION
   ========================================================================= */

/* --- Utilities --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-coral { color: var(--coral); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
.text-soft { color: var(--ink-soft); }

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* --- Spacing Helper für Listen --- */
.stack > * + * {
    margin-top: 12px;
}

/* --- Divider --- */
.divider {
    height: 1px;
    background: var(--sand);
    border: none;
    margin: 16px 0;
}

/* --- Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--cream-warm);
    color: var(--ink-soft);
}

.badge-coral {
    background: rgba(212, 104, 88, 0.12);
    color: var(--coral);
}

.badge-green {
    background: rgba(45, 138, 77, 0.12);
    color: var(--green);
}

.badge-amber {
    background: rgba(184, 132, 42, 0.12);
    color: var(--amber);
}

.badge-red {
    background: rgba(192, 57, 43, 0.12);
    color: var(--red);
}

/* --- Spinner --- */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--sand);
    border-top-color: var(--coral);
    border-radius: 50%;
    animation: portal-spin 0.8s linear infinite;
}

@keyframes portal-spin {
    to { transform: rotate(360deg); }
}

/* --- Empty-State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--ink-soft);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}

.empty-state-desc {
    font-size: 14px;
    color: var(--ink-soft);
}


/* =========================================================================
   REDUCED MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .action-sheet,
    .action-sheet-overlay,
    .settings-submenu,
    .modal-overlay,
    .modal-content,
    .bottom-nav-item .nav-icon,
    .plus-circle,
    .service-card,
    .kpi-card,
    .status-card {
        transition: none !important;
    }

    .spinner {
        animation: none;
        border-top-color: var(--sand);
        border-left-color: var(--coral);
    }
}


/* =========================================================================
   DESKTOP / WIDE-SCREEN (ab 768px)
   ========================================================================= */
@media (min-width: 768px) {
    .portal-container {
        padding: 32px 24px;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .section-title {
        font-size: 26px;
    }

    .service-card {
        padding: 22px;
    }

    .bottom-nav {
        max-width: 720px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

/* =========================================================================
   PROFESSIONAL DASHBOARD EXTENSIONS (Linear/Notion/Stripe Style)
   - Sticky Header
   - Service List (compact, replaces hub-cards)
   - Welcome Section (serif H1)
   - Action Sheet (slide-up, replaces Halbkreis-Plus-Popup)
   ========================================================================= */

/* --- Eyebrow (kleiner Label ueber H1) --- */
.eyebrow {
    font-size: 12px;
    font-weight: 600;
    color: var(--coral);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 4px;
}

/* === PROFESSIONAL STICKY HEADER === */
.portal-header.sticky-header {
    position: sticky;
    top: 0;
    height: 56px;
    background: var(--card-bg);
    border-bottom: 1px solid rgba(212, 104, 88, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 50;
    gap: 12px;
}

.portal-header.sticky-header .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.portal-header.sticky-header .brand img {
    height: 24px;
    width: auto;
}

.portal-header.sticky-header .user-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-header.sticky-header .display-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

/* F7-fixed 20260829: dead .user-avatar block removed (no .user-avatar element
 * in the DOM since the header refactor; harmless but dead weight). */

/* === STATS SECTION (Dashboard Top — Überblick) === */
.stats-section {
    padding: 16px 0 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 8px 0 4px;
}

.stat-card {
    position: relative;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-soft);
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lift);
}

.stat-card .stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    margin: 0 0 8px 0;
    padding-right: 36px; /* Platz fuer Icon */
}

.stat-card .stat-value {
    font-family: 'DM Serif Display', serif;
    font-size: 24px;
    font-weight: 400;
    color: var(--coral);
    margin: 0;
    line-height: 1.1;
}

.stat-card .stat-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(212, 104, 88, 0.08);
    color: var(--coral);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card .stat-icon svg {
    width: 16px;
    height: 16px;
}

/* Stats-Section-Title gleicher Stil wie services/pending */
.stats-section .section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

/* === WELCOME SECTION === */
.welcome-section {
    padding: 24px 0 16px;
}

.welcome-section h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    font-weight: 400;
    margin: 0;
    color: var(--ink);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.welcome-section .subtitle {
    font-size: 14px;
    color: var(--ink-soft);
    margin: 4px 0 0 0;
}

/* === SECTION TITLE (override for dashboard) === */
.services-section .section-title,
.pending-section .section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

/* === SERVICE LIST (compact list-style, replaces hub-cards) === */
.service-list-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    margin: 8px 0 20px;
}

.service-list-loading,
.service-list-empty,
.service-list-error {
    padding: 32px 20px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
}

.service-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    text-decoration: none;
    color: inherit;
    transition: background 150ms;
    border-bottom: 1px solid rgba(44, 40, 37, 0.05);
}

.service-list-item:last-child {
    border-bottom: none;
}

.service-list-item:hover,
.service-list-item:active {
    background: rgba(212, 104, 88, 0.04);
}

.service-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(212, 104, 88, 0.1);
    color: var(--coral);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.service-list-icon svg {
    width: 22px;
    height: 22px;
}

.service-list-content {
    flex: 1;
    min-width: 0;
}

.service-list-content h3 {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    line-height: 1.3;
}

.service-list-content .subtitle {
    font-size: 12px;
    color: var(--ink-soft);
    margin: 2px 0 0 0;
}

.service-list-chevron {
    width: 16px;
    height: 16px;
    color: var(--ink-soft);
    flex-shrink: 0;
    opacity: 0.5;
}

/* === PENDING ITEMS (compact pill list) === */
.pending-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.pending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid rgba(212, 104, 88, 0.12);
    border-radius: 10px;
}

.pending-item-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

/* =========================================================================
   PLUS POPUP — Halbkreis (Instagram / Notion / Linear Style)
   =========================================================================
   Phillip's verbatim: "blurry im Halbkreis wie vorher. Das war cool."
   Plus-Klick oeffnet Halbkreis: Items fliegen im Bogen NACH OBEN.
   Background bleibt sichtbar (nur blur). Plus-Button wird zu X.
   Layout: JS setzt pro Item CSS vars --x / --y (offset vom Center).
   CSS nutzt transform: translate(var(--x), var(--y)) scale(1). */
.plus-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 40, 37, 0.3);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms cubic-bezier(0.32, 0.72, 0, 1);
}

.plus-popup-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Wrapper: sichtbarer Container (320x220), positioniert oberhalb Bottom-Nav.
   Center bei (160, 110). Items absolut positioniert relativ zu Center. */
.plus-popup {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 220px;
    pointer-events: none;
    z-index: 100;
}

.plus-popup.visible {
    pointer-events: auto;
}

/* Close-Button (X) — zentriert am Container-Bottom (ueber Plus-Button) */
.plus-popup-close {
    position: absolute;
    bottom: -20px;
    left: 50%;
    margin-left: -20px;
    margin-bottom: -20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(44, 40, 37, 0.1);
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(44, 40, 37, 0.15);
    transition: all 200ms cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 101;
    opacity: 0;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    transform: scale(0.8);
}

.plus-popup.visible .plus-popup-close {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.plus-popup-close:hover {
    background: white;
    color: var(--coral);
    transform: scale(1.1);
}

.plus-popup-close:active {
    transform: scale(0.95);
}

.plus-popup-close svg {
    width: 20px;
    height: 20px;
}

/* Empty / loading fallback */
.plus-popup-empty {
    position: absolute;
    top: 30px;
    left: 50%;
    margin-left: -100px;
    width: 200px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 13px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(212, 104, 88, 0.2);
    opacity: 0;
    transition: opacity 200ms;
}

.plus-popup.visible .plus-popup-empty {
    opacity: 1;
}

/* Service-Item circle: absolut positioniert am Container-Center.
   JS setzt --x / --y (px offset). --index fuer stagger-delay.
   Collapsed: unten versteckt + scale(0.5).
   Visible: translate(var(--x), var(--y)) scale(1). */
.plus-popup-item {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -32px;
    margin-top: -32px;
    width: 64px;
    height: 64px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(212, 104, 88, 0.18),
                0 2px 6px rgba(44, 40, 37, 0.06);
    color: var(--coral);
    text-decoration: none;
    transition: transform 380ms cubic-bezier(0.32, 0.72, 0, 1),
                opacity 250ms cubic-bezier(0.32, 0.72, 0, 1),
                box-shadow 200ms ease-out;
    opacity: 0;
    gap: 2px;
    --x: 0px;
    --y: -100px;
    --index: 0;
    /* Collapsed: unten am Center versteckt */
    transform: translate(0px, 60px) scale(0.5);
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
}

/* When popup visible: items fly to their arc positions. */
.plus-popup.visible .plus-popup-item {
    opacity: 1;
    pointer-events: auto;
    transform: translate(var(--x), var(--y)) scale(1);
    transition-delay: calc(var(--index) * 35ms);
}

/* Hover / press feedback */
.plus-popup-item:hover {
    box-shadow: 0 8px 28px rgba(212, 104, 88, 0.32);
    transform: translate(var(--x), var(--y)) scale(1.1);
}

.plus-popup-item:active {
    box-shadow: 0 2px 8px rgba(212, 104, 88, 0.25);
    transform: translate(var(--x), var(--y)) scale(0.95);
}

.plus-popup-item svg {
    width: 24px;
    height: 24px;
}

.plus-popup-item .label {
    font-size: 9px;
    font-weight: 600;
    color: var(--ink-soft);
    line-height: 1;
    margin-top: 2px;
    text-align: center;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .plus-popup,
    .plus-popup-overlay,
    .plus-popup-item,
    .plus-popup-close {
        transition-duration: 1ms;
    }
    .plus-popup.visible .plus-popup-item {
        transition-delay: 0ms;
        opacity: 1;
        transform: translate(var(--x), var(--y)) scale(1);
    }
}



/* =========================================================================
   END portal.css
   ========================================================================= */

/* =========================================================================
   KPI-Row + Status-Pill (Service-spezifische KPIs im Dashboard)
   ========================================================================= */
.kpi-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 4px;
}

.kpi-number {
    font-size: 20px;
    font-weight: 600;
    color: var(--coral);
    line-height: 1;
}

.kpi-title {
    font-size: 12px;
    color: var(--ink-soft);
    line-height: 1;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(45, 138, 77, 0.1);
    color: #2d8a4d;
    border: 1px solid rgba(45, 138, 77, 0.15);
}

.status-pill.connected::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2d8a4d;
}

.status-pill.pending {
    background: rgba(217, 104, 88, 0.1);
    color: var(--coral-dark);
    border-color: rgba(217, 104, 88, 0.15);
}

.status-pill.pending::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--coral-dark);
}

/* Status-Pill rechts in service-list-item ausrichten */
.service-list-item .status-pill {
    flex-shrink: 0;
    align-self: center;
}

/* Mobile-Optimierung: Status-Pill bleibt kompakt */
@media (max-width: 768px) {
    .service-list-item .status-pill {
        padding: 3px 8px;
        font-size: 10px;
    }
}

/* === MESSAGE-BELL (Universal Header) === */
.msg-bell { position: relative; width: 36px; height: 36px; border-radius: 50%; background: rgba(217,104,88,0.10); color: var(--coral); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background 0.15s; }
.msg-bell:hover { background: rgba(217,104,88,0.18); }
.msg-bell svg { width: 18px; height: 18px; }
.msg-bell-dot { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--card-bg); box-sizing: content-box; line-height: 1; }
.msg-bell-dot.hidden { display: none; }

/* === BACK-LINK (unter Sticky-Header, Sub-Pages) === */
.portal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 8px 16px 0;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(217,104,88,0.10);
    color: var(--coral);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
    align-self: flex-start;
}
.portal-back-link:hover { background: rgba(217,104,88,0.18); }
.portal-back-link:active { background: rgba(217,104,88,0.25); }
.portal-back-link svg { width: 16px; height: 16px; flex-shrink: 0; }
