/* ---- Mitarbeiter: Rollen & Team-Zugänge ---- */
.team-page {
    --team-admin: #8b5cf6;
    --team-ersteller: #3b82f6;
    --team-mitarbeiter: var(--accent-solid);
    --team-card: var(--profile-white);
    --team-card-soft: #fafaf8;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-bottom: 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--profile-text);
}

.team-page button {
    font-family: inherit;
}

/* Hero */
.team-hero {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    overflow: hidden;
    border: 1px solid var(--profile-border);
    border-radius: 22px;
    background:
        radial-gradient(600px 220px at 0% 0%, rgba(21, 144, 121, 0.12), transparent 70%),
        radial-gradient(500px 220px at 100% 100%, rgba(139, 92, 246, 0.08), transparent 70%),
        var(--team-card);
}

.team-hero.is-compact {
    padding: 22px 24px;
}

.team-hero-main {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    flex: 1 1 380px;
    min-width: 0;
}

.team-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 10px 24px var(--accent-shadow);
}

.team-hero-icon.is-admin { background: var(--team-admin); box-shadow: 0 10px 24px rgba(139, 92, 246, 0.3); }
.team-hero-icon.is-ersteller { background: var(--team-ersteller); box-shadow: 0 10px 24px rgba(59, 130, 246, 0.3); }

.team-hero-icon svg {
    width: 26px;
    height: 26px;
}

.team-hero-title {
    margin: 2px 0 6px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.team-hero-sub {
    margin: 0;
    max-width: 560px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--profile-text-muted);
}

.team-hero-side {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.team-code,
.team-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid var(--profile-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--team-card) 80%, transparent);
    backdrop-filter: blur(6px);
}

.team-code-label,
.team-stat-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--profile-text-muted);
}

.team-code-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-code-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--profile-text);
}

.team-stat {
    min-width: 96px;
    align-items: center;
}

.team-stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-solid);
}

.team-stat-value small {
    font-size: 14px;
    font-weight: 600;
    color: var(--profile-text-muted);
}

.team-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--profile-border);
    border-radius: 10px;
    background: var(--profile-surface);
    color: var(--profile-text-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.team-icon-btn svg {
    width: 16px;
    height: 16px;
}

.team-icon-btn:hover:not(:disabled) {
    color: var(--accent-solid);
    border-color: var(--accent-solid);
}

.team-icon-btn.is-done {
    color: #fff;
    background: var(--accent-solid);
    border-color: var(--accent-solid);
}

.team-icon-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.team-code-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: 2px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--profile-text-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease;
}

.team-code-change svg {
    width: 13px;
    height: 13px;
    transition: transform 0.4s ease;
}

.team-code-change:hover:not(:disabled) {
    color: var(--accent-solid);
}

.team-code-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.team-code-rules {
    margin-top: -12px;
    text-align: left;
}

.team-code-change.is-confirm,
.team-code-change.is-confirm:hover {
    color: var(--profile-danger);
}

.team-code-change:disabled {
    opacity: 0.6;
    cursor: default;
}

.team-hero-error {
    flex-basis: 100%;
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--profile-danger-bg);
    color: var(--profile-danger);
    font-size: 13.5px;
}

/* Schritte */
.team-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: -8px 0 0;
    padding: 0;
    list-style: none;
}

.team-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px dashed var(--profile-border);
    border-radius: 16px;
}

.team-steps li > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: rgba(21, 144, 121, 0.12);
    color: var(--accent-solid);
    font-size: 13px;
    font-weight: 700;
}

.team-steps b {
    display: block;
    margin-bottom: 3px;
    font-size: 14px;
    color: var(--profile-text);
}

.team-steps p {
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--profile-text-muted);
}

/* Abschnitt */
.team-section-head h2 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--profile-text);
}

.team-section-head p {
    margin: 0;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--profile-text-muted);
}

.team-section-head {
    margin-bottom: -12px;
}

/* Rollenkarten */
.team-roles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.team-role {
    --role: var(--team-mitarbeiter);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    overflow: hidden;
    border: 1px solid var(--profile-border);
    border-radius: 20px;
    background: var(--team-card);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.team-role::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--role), color-mix(in srgb, var(--role) 20%, transparent));
}

.team-role::after {
    content: "";
    position: absolute;
    top: -80px;
    right: -80px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--role) 14%, transparent), transparent 70%);
    pointer-events: none;
}

.team-role:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--role) 45%, var(--profile-border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--role) 10%, transparent), 0 14px 32px rgba(16, 24, 40, 0.08);
}

.team-role.is-admin { --role: var(--team-admin); }
.team-role.is-ersteller { --role: var(--team-ersteller); }

.team-role.is-own {
    border-color: var(--role);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--role) 14%, transparent);
}

.team-role-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.team-role-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--role) 14%, transparent);
    color: var(--role);
}

.team-role-icon svg {
    width: 23px;
    height: 23px;
}

.team-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.team-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.team-status.is-on {
    background: rgba(21, 144, 121, 0.12);
    color: var(--accent-solid);
}

.team-status.is-on i {
    box-shadow: 0 0 0 3px rgba(21, 144, 121, 0.2);
    animation: teamPulse 2s ease-in-out infinite;
}

@keyframes teamPulse {
    50% { box-shadow: 0 0 0 5px rgba(21, 144, 121, 0); }
}

.team-status.is-off {
    background: var(--profile-surface);
    color: var(--profile-text-muted);
}

.team-status.is-own {
    background: color-mix(in srgb, var(--role) 14%, transparent);
    color: var(--role);
}

.team-role-name {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--profile-text);
}

.team-role-tagline {
    margin: 0 0 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--role);
}

.team-role-text {
    margin: 0;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--profile-text-muted);
}

.team-perms {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 16px 0 0;
    border-top: 1px solid var(--profile-border);
    list-style: none;
}

.team-perms li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--profile-text);
}

.team-perms li.is-no {
    color: var(--profile-text-muted);
    opacity: 0.7;
}

.team-perm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 6px;
}

.team-perm-icon svg {
    width: 12px;
    height: 12px;
}

.is-yes .team-perm-icon {
    background: rgba(21, 144, 121, 0.14);
    color: var(--accent-solid);
}

.is-no .team-perm-icon {
    background: var(--profile-surface);
    color: var(--profile-text-muted);
}

.team-role-foot {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.team-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.team-btn svg {
    width: 16px;
    height: 16px;
}

.team-btn.is-primary {
    flex: 1;
    border: none;
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 6px 16px var(--accent-shadow);
}

.team-btn.is-primary:hover {
    filter: brightness(1.08);
}

.team-btn.is-ghost {
    border: 1px solid var(--profile-border);
    background: transparent;
    color: var(--profile-text-muted);
}

.team-btn.is-ghost:hover,
.team-btn.is-ghost.is-confirm {
    border-color: var(--profile-danger);
    background: var(--profile-danger-bg);
    color: var(--profile-danger);
}

.team-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Skeleton */
.team-skel {
    border-radius: 20px;
    background: linear-gradient(100deg, var(--profile-surface) 30%, var(--profile-hover-bg) 50%, var(--profile-surface) 70%);
    background-size: 200% 100%;
    animation: instrShimmer 1.3s ease-in-out infinite;
}

.team-skel-hero { height: 130px; }
.team-skel-card { height: 380px; }

/* Passwort-Fenster */
.team-pw-modal {
    max-width: 480px;
}

.team-pw-brand.is-admin { background: #8b5cf6; box-shadow: 0 8px 22px rgba(139, 92, 246, 0.35); }
.team-pw-brand.is-ersteller { background: #3b82f6; box-shadow: 0 8px 22px rgba(59, 130, 246, 0.35); }

.team-pw-input {
    position: relative;
    display: flex;
}

.team-pw-input input {
    flex: 1;
    padding-right: 96px;
}

.team-pw-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    height: 34px;
    padding: 0 12px;
    border: none;
    border-radius: 9px;
    background: var(--profile-surface);
    color: var(--profile-text-label);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.team-pw-toggle:hover {
    color: var(--accent-solid);
}

.team-pw-meter {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: -10px;
}

.team-pw-meter i {
    height: 4px;
    border-radius: 4px;
    background: var(--profile-border);
    transition: background 0.2s ease;
}

.team-pw-meter[data-level="1"] i:nth-child(-n+1) { background: #e5484d; }
.team-pw-meter[data-level="2"] i:nth-child(-n+2) { background: #f59e0b; }
.team-pw-meter[data-level="3"] i:nth-child(-n+3) { background: #22b07d; }
.team-pw-meter[data-level="4"] i { background: var(--accent-solid); }

.team-pw-generate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    border: 1.5px dashed var(--profile-border);
    border-radius: 12px;
    background: transparent;
    color: var(--accent-solid);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.team-pw-generate svg {
    width: 16px;
    height: 16px;
}

.team-pw-generate:hover {
    border-color: var(--accent-solid);
    background: rgba(21, 144, 121, 0.06);
}

.team-pw-hint {
    margin: -8px 0 0;
    font-size: 12.5px;
    color: var(--profile-text-muted);
    text-align: center;
}

/* Dark Mode */
body.dark .team-page {
    --team-card: #242424;
}

body.dark .team-hero {
    background:
        radial-gradient(600px 220px at 0% 0%, rgba(21, 144, 121, 0.16), transparent 70%),
        radial-gradient(500px 220px at 100% 100%, rgba(139, 92, 246, 0.1), transparent 70%),
        #242424;
}

body.dark .team-role:hover {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--role) 14%, transparent), 0 14px 32px rgba(0, 0, 0, 0.35);
}

body.dark .team-code,
body.dark .team-stat {
    background: rgba(255, 255, 255, 0.03);
}

body.dark .team-steps li {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Responsiv */
@media (max-width: 1100px) {
    .team-roles {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 820px) {
    .team-roles,
    .team-steps {
        grid-template-columns: 1fr;
    }

    .team-hero {
        padding: 20px;
    }

    .team-hero-side {
        width: 100%;
    }

    .team-code {
        flex: 1;
    }
}

/* ---- Gesperrt / leer ---- */
.team-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 64px 24px;
    border: 1px dashed var(--profile-border);
    border-radius: 20px;
    text-align: center;
}

.team-locked-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 6px;
    border-radius: 20px;
    background: rgba(21, 144, 121, 0.12);
    color: var(--accent-solid);
}

.team-locked-icon svg {
    width: 30px;
    height: 30px;
}

.team-locked h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--profile-text);
}

.team-locked p {
    margin: 0;
    max-width: 400px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--profile-text-muted);
}

/* ---- Verlauf ---- */
.team-log-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.team-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--profile-surface);
}

.team-chip {
    height: 34px;
    padding: 0 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--profile-text-muted);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.team-chip:hover {
    color: var(--profile-text);
}

.team-chip.active {
    background: var(--team-card);
    color: var(--profile-text);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 4px 12px rgba(16, 24, 40, 0.06);
}

.team-btn.is-ghost.is-neutral:hover {
    border-color: var(--accent-solid);
    background: rgba(21, 144, 121, 0.08);
    color: var(--accent-solid);
}

.team-log-wrap {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.team-log-day {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--profile-text-muted);
}

.team-log-day span {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--profile-surface);
    font-size: 11px;
    letter-spacing: 0;
}

.team-log {
    margin: 0;
    padding: 6px;
    overflow: hidden;
    border: 1px solid var(--profile-border);
    border-radius: 18px;
    background: var(--team-card);
    list-style: none;
}

.team-log-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    transition: background 0.15s ease;
}

.team-log-item:hover {
    background: var(--profile-surface);
}

.team-log-item + .team-log-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 66px;
    right: 14px;
    height: 1px;
    background: var(--profile-border);
}

.team-log-avatar {
    --role: var(--accent-solid);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--role) 16%, transparent);
    color: var(--role);
    font-size: 13.5px;
    font-weight: 700;
}

.team-log-avatar.is-owner,
.team-log-avatar.is-admin,
.team-log-role.is-owner,
.team-log-role.is-admin { --role: var(--team-admin); }
.team-log-avatar.is-ersteller,
.team-log-role.is-ersteller { --role: var(--team-ersteller); }

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

.team-log-text {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--profile-text-muted);
    overflow-wrap: anywhere;
}

.team-log-text b {
    font-weight: 600;
    color: var(--profile-text);
}

.team-log-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--profile-text-muted);
}

.team-log-role {
    --role: var(--accent-solid);
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--role) 12%, transparent);
    color: var(--role);
    font-weight: 600;
}

.team-log-dot {
    opacity: 0.6;
}

.team-log-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

.team-log-icon svg {
    width: 16px;
    height: 16px;
}

.team-log-icon.is-green { background: rgba(21, 144, 121, 0.12); color: var(--accent-solid); }
.team-log-icon.is-amber { background: rgba(245, 158, 11, 0.14); color: #d97706; }
.team-log-icon.is-red { background: rgba(229, 72, 77, 0.12); color: #e5484d; }
.team-log-icon.is-violet { background: rgba(139, 92, 246, 0.14); color: #8b5cf6; }
.team-log-icon.is-blue { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.team-log-icon.is-grey { background: var(--profile-surface); color: var(--profile-text-muted); }

.team-log-skel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-log-skel .team-skel {
    height: 64px;
    border-radius: 14px;
}

/* Nachlade-Anker am Ende des Verlaufs (nächste 20 Einträge beim Scrollen) */
.team-log-more {
    display: flex;
    justify-content: center;
    padding: 18px 0 6px;
}

.team-log-spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid var(--profile-border);
    border-top-color: var(--accent-solid);
    animation: teamLogSpin 0.8s linear infinite;
}

@keyframes teamLogSpin {
    to { transform: rotate(360deg); }
}

body.dark .team-chip.active {
    background: #333;
    box-shadow: none;
}

body.dark .team-log-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

body.dark .team-log-icon.is-amber { color: #f59e0b; }

.team-log-avatar.has-img {
    overflow: hidden;
    background: var(--profile-surface);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--role) 45%, transparent);
}

.team-log-avatar.has-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


@media (max-width: 820px) {
    .team-log-icon {
        display: none;
    }
}
