/* newio Patientenportal v2 – modern, warm, praxisnah */
:root {
    --brand-primary: #02463a;
    --brand-secondary: #ff0046;
    --portal-bg: #ffffff;
    --portal-surface: #ffffff;
    --portal-border: #e4e9ef;
    --portal-muted: #64748b;
    --portal-text: #1e293b;
    --portal-radius: 16px;
    --portal-radius-lg: 22px;
    --portal-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --portal-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.1);
}

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

.portal-body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--portal-bg);
    color: var(--portal-text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

.portal-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Header ---- */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--portal-surface);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.portal-header-top {
    border-bottom: 1px solid var(--portal-border);
}

.portal-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.portal-header-nav {
    background: var(--brand-primary);
}

.portal-header-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.portal-logo {
    height: 44px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.portal-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.portal-brand-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--brand-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.portal-brand-sub {
    font-size: 13px;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: stretch;
}

.portal-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 0;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.92);
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    border-bottom: 3px solid transparent;
}

.portal-nav-link i {
    font-size: 14px;
    opacity: 1;
    width: 1.1em;
    text-align: center;
}

.portal-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.portal-nav-link.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-bottom-color: var(--brand-secondary);
}

.portal-nav-toggle {
    border: none;
    background: color-mix(in srgb, var(--brand-primary) 10%, #fff);
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.portal-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--brand-primary);
    border-radius: 2px;
    transition: transform 0.2s;
}

.portal-nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.portal-nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.portal-nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.portal-nav-mobile {
    display: flex;
    flex-direction: column;
    padding: 8px;
    background: var(--brand-primary);
    border-bottom: 1px solid color-mix(in srgb, var(--brand-primary) 80%, #000);
}

.portal-nav-mobile[hidden] { display: none !important; }

.portal-nav-mobile .portal-nav-link {
    border-radius: 8px;
    padding: 12px 14px;
    border-bottom: none;
}

.portal-nav-mobile .portal-nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 3px 0 0 var(--brand-secondary);
}

.portal-nav-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    transition: background 0.15s, color 0.15s;
}

.portal-nav-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.portal-nav-logout--mobile {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: 4px;
    border-radius: 8px;
}

.portal-termin-item {
    flex-wrap: wrap;
    align-items: flex-start;
}

.portal-termin-main {
    flex: 1;
    min-width: 0;
}

.portal-termin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.portal-termin-badge {
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    flex-shrink: 0;
}

.portal-termin-badge.status-accepted { background: #059669; color: #fff; }
.portal-termin-badge.status-declined { background: #dc2626; color: #fff; }
.portal-termin-badge.status-pending { background: #64748b; color: #fff; }
.portal-termin-badge.status-reminder { background: #6366f1; color: #fff; }
.portal-termin-badge.status-tentative { background: #d97706; color: #fff; }
.portal-termin-badge.status-declined-praxis,
.portal-termin-badge.status-noshow { background: #475569; color: #fff; }

@media (max-width: 575.98px) {
    .portal-termin-item {
        flex-direction: column;
        align-items: stretch;
    }
    .portal-termin-badge { align-self: flex-start; }
    .portal-termin-actions .btn { flex: 1 1 calc(50% - 4px); }
    .portal-header-nav-inner { flex-wrap: wrap; }
    .portal-nav-logout {
        border-left: none;
        width: 100%;
        justify-content: center;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }
}

/* ---- Main layout ---- */
.portal-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 20px 56px;
    background: #f8fafc;
    border-radius: 0;
}

.portal-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
}

@media (min-width: 992px) {
    .portal-layout {
        grid-template-columns: 1fr 300px;
    }
}

.portal-content { min-width: 0; }

.portal-page { max-width: 100%; }

/* ---- Alerts ---- */
.portal-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--portal-radius);
    font-size: 14px;
    margin-bottom: 20px;
}

.portal-alert--ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.portal-alert--err {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ---- Hero welcome ---- */
.portal-hero {
    background: linear-gradient(135deg, var(--brand-primary) 0%, color-mix(in srgb, var(--brand-primary) 78%, #000) 100%);
    border-radius: var(--portal-radius-lg);
    padding: 28px 28px 32px;
    color: #fff;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.portal-hero::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 280px;
    height: 280px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    pointer-events: none;
}

.portal-hero-inner { position: relative; z-index: 1; }

.portal-hero h1 {
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    font-weight: 700;
    margin: 0 0 6px;
    color: #fff;
}

.portal-hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 15px;
}

.portal-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

/* ---- Practice card (sidebar) ---- */
.portal-practice-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius-lg);
    overflow: hidden;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
    position: sticky;
    top: 88px;
}

.portal-practice-banner {
    margin: 0 0 16px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--portal-border);
    background: color-mix(in srgb, var(--brand-primary) 6%, #fff);
}

.portal-practice-banner img {
    width: 100%;
    height: auto;
    max-height: 140px;
    object-fit: cover;
    display: block;
}

.portal-practice-card-body { padding: 22px 20px 24px; }

.portal-practice-logo {
    height: 48px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    margin-bottom: 12px;
}

.portal-practice-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0 0 4px;
    line-height: 1.3;
}

.portal-practice-specialty {
    font-size: 13px;
    color: var(--portal-muted);
    margin: 0 0 18px;
}

.portal-practice-contact {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
}

.portal-practice-contact li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.45;
}

.portal-practice-contact li:last-child { margin-bottom: 0; }

.portal-contact-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--brand-primary) 10%, transparent);
    color: var(--brand-primary);
    border-radius: 8px;
    font-size: 13px;
}

.portal-practice-contact a {
    color: var(--portal-text);
    text-decoration: none;
    word-break: break-word;
}

.portal-practice-contact a:hover { color: var(--brand-primary); }

.portal-practice-actions { margin-top: 4px; }

.portal-practice-mobile {
    margin-bottom: 24px;
}

/* ---- Section titles ---- */
.portal-section-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--brand-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-page-title {
    font-size: clamp(1.2rem, 2.5vw, 1.45rem);
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 24px;
}

/* ---- Cards & lists ---- */
.portal-card-list {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    overflow: hidden;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
}

.portal-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--portal-border);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.portal-list-item:last-child { border-bottom: none; }
.portal-list-item:hover { background: #f8fafc; }
.portal-list-item-static { cursor: default; }
.portal-list-item-static:hover { background: transparent; }

.portal-doc-icon {
    color: var(--brand-primary);
    font-weight: 600;
}

/* ---- Quick action grid ---- */
.portal-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

@media (min-width: 576px) {
    .portal-quick-grid { grid-template-columns: repeat(4, 1fr); }
}

.portal-quick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    padding: 22px 14px;
    text-decoration: none;
    color: var(--portal-text);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
    height: 100%;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    min-height: 110px;
}

.portal-quick-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--portal-shadow-lg);
    border-color: color-mix(in srgb, var(--brand-primary) 30%, transparent);
    color: var(--brand-primary);
}

.portal-quick-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--brand-primary) 10%, transparent);
    color: var(--brand-primary);
    border-radius: 12px;
    font-size: 18px;
}

/* ---- Stats, upload, forms ---- */
.portal-stat {
    background: var(--portal-surface);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
}

.portal-stat .label {
    display: block;
    font-size: 11px;
    color: var(--portal-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.portal-stat .value {
    display: block;
    font-weight: 700;
    font-size: 17px;
}

.portal-upload-box {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    padding: 24px;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
}

.portal-einwand-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---- Buttons ---- */
.portal-body .btn-portal-primary,
.portal-body .btn-portal-secondary,
.portal-body .btn-portal-outline,
.portal-body .btn-portal-danger {
    font-weight: 600;
    border-radius: 12px;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    box-shadow: none;
}

.portal-body .btn-portal-primary {
    background: var(--brand-primary);
    border: 1.5px solid var(--brand-primary);
    color: #fff;
    padding: 12px 22px;
}

.portal-body .btn-portal-primary:hover,
.portal-body .btn-portal-primary:focus,
.portal-body .btn-portal-primary:focus-visible,
.portal-body .btn-portal-primary:active {
    background: var(--brand-secondary) !important;
    border-color: var(--brand-secondary) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--brand-secondary) 35%, transparent);
}

.portal-body .btn-portal-secondary {
    background: var(--brand-secondary);
    border: 1.5px solid var(--brand-secondary);
    color: #fff;
    padding: 12px 22px;
}

.portal-body .btn-portal-secondary:hover,
.portal-body .btn-portal-secondary:focus,
.portal-body .btn-portal-secondary:focus-visible,
.portal-body .btn-portal-secondary:active {
    background: color-mix(in srgb, var(--brand-secondary) 88%, #000) !important;
    border-color: color-mix(in srgb, var(--brand-secondary) 88%, #000) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--brand-secondary) 35%, transparent);
}

.portal-body .btn-portal-outline {
    background: #fff;
    border: 1.5px solid var(--brand-primary);
    color: var(--brand-primary);
    padding: 10px 20px;
}

.portal-body .btn-portal-outline:hover,
.portal-body .btn-portal-outline:focus,
.portal-body .btn-portal-outline:focus-visible,
.portal-body .btn-portal-outline:active {
    background: var(--brand-secondary) !important;
    border-color: var(--brand-secondary) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--brand-secondary) 35%, transparent);
}

.portal-body .btn-portal-danger {
    background: #fff;
    border: 1.5px solid #dc2626;
    color: #dc2626;
    padding: 10px 20px;
}

.portal-body .btn-portal-danger:hover,
.portal-body .btn-portal-danger:focus,
.portal-body .btn-portal-danger:focus-visible,
.portal-body .btn-portal-danger:active {
    background: var(--brand-secondary) !important;
    border-color: var(--brand-secondary) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--brand-secondary) 35%, transparent);
}

.portal-body .btn-portal-primary:disabled,
.portal-body .btn-portal-secondary:disabled,
.portal-body .btn-portal-outline:disabled,
.portal-body .btn-portal-danger:disabled,
.portal-body .btn-portal-primary.disabled,
.portal-body .btn-portal-secondary.disabled,
.portal-body .btn-portal-outline.disabled {
    opacity: 0.55;
    pointer-events: none;
    box-shadow: none;
}

.portal-body .btn-sm.btn-portal-primary,
.portal-body .btn-sm.btn-portal-outline,
.portal-body .btn-sm.btn-portal-secondary {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.bg-portal { background: var(--brand-primary) !important; }
.text-portal { color: var(--brand-secondary) !important; }

.portal-form .form-control {
    border-radius: 10px;
    border-color: var(--portal-border);
    padding: 10px 14px;
}

.portal-form .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 15%, transparent);
}

/* ---- Auth split layout ---- */
.portal-auth {
    background: var(--portal-bg);
}

.portal-auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .portal-auth-split {
        grid-template-columns: minmax(320px, 42%) 1fr;
    }
}

.portal-auth-brand {
    background: var(--portal-surface);
    color: var(--portal-text);
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid var(--portal-border);
}

@media (min-width: 900px) {
    .portal-auth-brand {
        border-bottom: none;
        border-right: 1px solid var(--portal-border);
    }
}

.portal-auth-brand-inner {
    max-width: 380px;
    margin: 0 auto;
    width: 100%;
}

.portal-auth-logo {
    display: block;
    height: auto;
    max-height: 88px;
    max-width: min(240px, 100%);
    width: auto;
    object-fit: contain;
    margin-bottom: 20px;
}

.portal-auth-team {
    margin: 0 0 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--portal-border);
}

.portal-auth-team img {
    width: 100%;
    height: auto;
    max-height: 160px;
    object-fit: cover;
    display: block;
}

.portal-auth-practice-name {
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0 0 6px;
    line-height: 1.3;
}

.portal-auth-tagline {
    color: var(--portal-muted);
    font-size: 15px;
    margin: 0 0 24px;
    line-height: 1.45;
}

.portal-auth-contact {
    margin: 0;
    padding: 0;
}

.portal-auth-contact li {
    color: var(--portal-text);
    margin-bottom: 12px;
}

.portal-auth-contact a {
    color: var(--portal-text);
    text-decoration: none;
}

.portal-auth-contact a:hover {
    color: var(--brand-primary);
    text-decoration: underline;
}

.portal-gebdat-input {
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    text-align: center;
    font-size: 1.15rem;
}

.portal-auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}

.portal-auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--portal-surface);
    border-radius: var(--portal-radius-lg);
    padding: 36px 28px;
    box-shadow: var(--portal-shadow-lg);
    border: 1px solid var(--portal-border);
}

.portal-auth-header { margin-bottom: 24px; }

.portal-auth-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0 0 6px;
}

.portal-consent-box {
    background: #f8fafc;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    padding: 18px;
    font-size: 14px;
    line-height: 1.55;
    max-height: 260px;
    overflow-y: auto;
}

.portal-legal {
    line-height: 1.5;
    color: var(--portal-muted);
}

/* ---- Footer ---- */
.portal-footer {
    background: var(--portal-surface);
    border-top: 1px solid var(--portal-border);
    padding: 28px 20px;
    margin-top: auto;
}

.portal-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    font-size: 13px;
    color: var(--portal-muted);
}

.portal-footer-brand strong {
    display: block;
    color: var(--brand-primary);
    font-size: 14px;
}

.portal-footer-sub {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--portal-muted);
}

.portal-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.portal-footer-links a {
    color: var(--brand-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.portal-footer-links a:hover { text-decoration: underline; }

.portal-footer-note { font-size: 12px; opacity: 0.85; }

/* ---- Misc ---- */
.portal-coming-soon .portal-coming-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--brand-primary) 10%, transparent);
    color: var(--brand-primary);
    border-radius: 50%;
    font-size: 28px;
}

.portal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.portal-back-link:hover { text-decoration: underline; }

.portal-hint-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--brand-primary) 12%, #fff);
    color: var(--brand-primary);
    border-radius: 50%;
    font-size: 28px;
}

.portal-preview-banner {
    background: linear-gradient(90deg, var(--brand-primary), color-mix(in srgb, var(--brand-primary) 70%, var(--brand-secondary)));
    color: #fff;
    padding: 10px 16px;
}

.portal-preview-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.portal-doc-card .portal-list-item strong {
    color: var(--brand-primary);
}

.portal-section { margin-bottom: 28px; }

.badge.bg-portal { font-weight: 600; padding: 6px 10px; border-radius: 8px; }

@media (max-width: 575.98px) {
    .portal-main { padding: 20px 16px 40px; }
    .portal-header-inner { padding: 12px 16px; }
    .portal-hero { padding: 22px 20px; }
    .portal-auth-card { padding: 28px 20px; }
}
