/*
 * YCS — application terrain / team
 * --------------------------------------------------------------------------
 * CSS autonome pour public/team : ne dépend pas des classes dashboard.
 * Objectif : éviter le rendu "page web brute" quand app.css ne contient pas
 * les classes team-shell/team-card ou quand le cache assets est en retard.
 */
:root {
    --team-bg: #f4f1e8;
    --team-panel: #fffcf5;
    --team-panel-2: #f7f1e6;
    --team-ink: #182a24;
    --team-muted: #64756d;
    --team-faint: #91a09a;
    --team-line: rgba(24, 42, 36, .11);
    --team-line-soft: rgba(24, 42, 36, .07);
    --team-forest: #214c3d;
    --team-forest-dark: #12352b;
    --team-forest-soft: #e0ece5;
    --team-ochre: #d8a045;
    --team-ochre-dark: #a87522;
    --team-ochre-soft: #f6e7c7;
    --team-bordeaux: #8c3f4d;
    --team-bordeaux-soft: #f4dfe3;
    --team-ok: #2f6d4f;
    --team-shadow: 0 18px 45px -28px rgba(18, 53, 43, .42), 0 1px 2px rgba(18, 53, 43, .06);
    --team-radius-lg: 28px;
    --team-radius-md: 20px;
}

html { min-height: 100%; }
body.space-team {
    min-height: 100vh;
    margin: 0 !important;
    font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    color: var(--team-ink) !important;
    background:
        radial-gradient(760px 520px at 10% -10%, rgba(216, 160, 69, .20), transparent 64%),
        radial-gradient(820px 600px at 92% 0%, rgba(33, 76, 61, .14), transparent 62%),
        linear-gradient(180deg, #fbf8f0 0%, var(--team-bg) 100%) !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.space-team *,
body.space-team *::before,
body.space-team *::after { box-sizing: border-box; }

body.space-team a { -webkit-tap-highlight-color: transparent; }

body.space-team > header,
body.space-team .team-app-header {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 18px 18px !important;
    background:
        linear-gradient(135deg, rgba(33, 76, 61, .96), rgba(18, 53, 43, .98)) !important;
    color: #fff !important;
    border-radius: 0 0 28px 28px;
    box-shadow: 0 22px 48px -34px rgba(18, 53, 43, .75);
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 14px !important;
}

.team-app-header-main,
body.space-team > header > div {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.team-avatar {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    flex: none;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 800;
    letter-spacing: .02em;
}

.team-kicker,
body.space-team > header div:first-child div:first-child {
    margin: 0 0 2px !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
    text-transform: uppercase;
    letter-spacing: .105em;
    color: rgba(255, 255, 255, .72) !important;
    font-weight: 800;
}

.team-user-name,
body.space-team > header strong {
    display: block;
    min-width: 0;
    max-width: min(72vw, 350px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff !important;
    font-size: 15px !important;
    line-height: 1.25 !important;
    font-weight: 800 !important;
}

.team-icon-btn,
body.space-team > header a {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    display: inline-grid !important;
    place-items: center;
    flex: none;
    color: #fff !important;
    text-decoration: none !important;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .16);
    opacity: 1 !important;
}

.team-shell {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 18px 16px calc(104px + env(safe-area-inset-bottom, 0px));
}

.team-hero {
    position: relative;
    overflow: hidden;
    padding: 22px 20px !important;
    border-radius: 30px !important;
    background:
        radial-gradient(300px 170px at 95% -20%, rgba(216, 160, 69, .20), transparent 70%),
        linear-gradient(135deg, #fffdf8, #f8f1e5) !important;
}
.team-hero::after {
    content: "";
    position: absolute;
    right: -34px;
    bottom: -54px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 1px dashed rgba(33, 76, 61, .22);
}
.team-hero-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.team-hero h1 {
    margin: 4px 0 7px;
    color: var(--team-forest-dark);
    font-size: clamp(26px, 7vw, 38px);
    line-height: .98;
    letter-spacing: -.04em;
    font-weight: 850;
}
.team-hero p {
    margin: 0;
    max-width: 32rem;
    color: var(--team-muted);
    font-size: 14px;
    line-height: 1.45;
}
.team-date-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--team-forest-soft);
    color: var(--team-forest);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.team-quick-number {
    min-width: 70px;
    padding: 12px 10px;
    border-radius: 20px;
    background: var(--team-forest);
    color: #fff;
    text-align: center;
    box-shadow: var(--team-shadow);
}
.team-quick-number b { display: block; font-size: 28px; line-height: 1; }
.team-quick-number span { display: block; margin-top: 3px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; font-weight: 800; }
.team-stat-row {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 18px;
}
.team-stat {
    min-width: 0;
    padding: 10px 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--team-line-soft);
}
.team-stat b { display: block; font-size: 19px; line-height: 1; color: var(--team-forest); }
.team-stat span { display: block; margin-top: 5px; color: var(--team-faint); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

.team-card {
    background: var(--team-panel) !important;
    border: 1px solid var(--team-line) !important;
    border-radius: var(--team-radius-md) !important;
    padding: 16px !important;
    box-shadow: var(--team-shadow) !important;
    color: var(--team-ink) !important;
}

a.team-card {
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
a.team-card:active { transform: scale(.985); }
@media (hover: hover) {
    a.team-card:hover {
        transform: translateY(-2px);
        border-color: rgba(33, 76, 61, .25) !important;
        box-shadow: 0 24px 56px -34px rgba(18, 53, 43, .55), 0 1px 2px rgba(18, 53, 43, .06) !important;
    }
}

.team-section-title,
body.space-team h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 26px 2px 10px !important;
    color: var(--team-faint) !important;
    font-size: 11.5px !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
    text-transform: uppercase !important;
    letter-spacing: .13em !important;
}
.team-section-title::after,
body.space-team h2::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--team-line-soft);
}

.team-mission-link { margin-bottom: 10px; }
.team-mission-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}
.team-mission-main { flex: 1; min-width: 0; }
.team-card-title {
    color: var(--team-forest-dark) !important;
    font-weight: 850;
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: -.01em;
}
.team-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
    color: var(--team-muted) !important;
    font-size: 13px !important;
    line-height: 1.35;
}
.team-time-pill {
    min-width: 64px;
    padding: 9px 10px;
    border-radius: 16px;
    background: var(--team-forest-soft);
    color: var(--team-forest-dark);
    font-size: 17px;
    line-height: 1;
    font-weight: 900;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.badge,
body.space-team .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px !important;
    border-radius: 999px !important;
    border: 1px solid transparent;
    font-size: 10.5px !important;
    line-height: 1.1 !important;
    font-weight: 900 !important;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.badge-ochre { background: var(--team-ochre-soft) !important; color: var(--team-ochre-dark) !important; }
.badge-stone { background: #ebe5da !important; color: #6f6658 !important; }
.badge-forest { background: var(--team-forest-soft) !important; color: var(--team-forest-dark) !important; }
.badge-bordeaux { background: var(--team-bordeaux-soft) !important; color: var(--team-bordeaux) !important; }

.team-empty {
    text-align: center;
    padding: 32px 22px !important;
}
.team-empty-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 14px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: var(--team-forest-soft);
    color: var(--team-forest);
    font-size: 32px;
}
.team-empty h3 {
    margin: 0 0 8px;
    color: var(--team-forest-dark);
    font-size: 20px;
}
.team-empty p {
    margin: 0;
    color: var(--team-muted);
    font-size: 14px;
    line-height: 1.45;
}

.team-incident-card {
    border-left: 0 !important;
    position: relative;
    overflow: hidden;
}
.team-incident-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--incident-color, var(--team-ochre));
}
.team-action-card {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-style: dashed !important;
    color: var(--team-bordeaux) !important;
    background: linear-gradient(135deg, #fffdf8, #fbf0f2) !important;
    font-weight: 900;
}

.team-checklist {
    list-style: none !important;
    margin: 14px 0 0 !important;
    padding: 0 !important;
    display: grid;
    gap: 8px;
}
.team-checklist li {
    margin: 0 !important;
    padding: 12px 12px !important;
    border: 1px solid var(--team-line-soft);
    border-radius: 18px;
    background: #fffdf8;
}
.team-checklist button[type="submit"] {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 14px !important;
    background: var(--team-forest-soft) !important;
    color: var(--team-forest) !important;
}
.team-progress {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #eadfce;
    margin-top: 12px;
}
.team-progress > span {
    display: block;
    height: 100%;
    width: var(--progress, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--team-forest), #4d7d64);
}

.space-team .form-group { margin-bottom: 15px; }
.space-team .form-group.mb-0 { margin-bottom: 0; }
.space-team .form-label {
    display: block;
    margin-bottom: 7px;
    color: var(--team-forest-dark);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.space-team .form-control,
.space-team .form-select,
.space-team input[type="email"],
.space-team input[type="password"],
.space-team input[type="text"],
.space-team select,
.space-team textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--team-line) !important;
    border-radius: 17px !important;
    background: #fffdf8 !important;
    color: var(--team-ink) !important;
    padding: 12px 14px !important;
    font: inherit !important;
    outline: none;
    box-shadow: none !important;
}
.space-team textarea.form-control,
.space-team textarea { min-height: 128px; resize: vertical; }
.space-team .form-control:focus,
.space-team .form-select:focus,
.space-team input:focus,
.space-team select:focus,
.space-team textarea:focus {
    border-color: rgba(33, 76, 61, .42) !important;
    box-shadow: 0 0 0 4px rgba(33, 76, 61, .09) !important;
}

.space-team .btn,
.space-team button.btn,
.space-team a.btn {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 18px !important;
    padding: 13px 18px !important;
    font: inherit;
    font-weight: 900 !important;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: var(--team-shadow);
}
.space-team .btn-primary { background: var(--team-forest) !important; color: #fff !important; }
.space-team .btn-accent { background: var(--team-bordeaux) !important; color: #fff !important; }
.space-team .btn-lg { min-height: 56px; font-size: 16px !important; }
.space-team .w-100 { width: 100% !important; }

.space-team .alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--team-line);
    background: #fffdf8;
    color: var(--team-ink);
    font-size: 14px;
}
.space-team .alert-success { background: #e8f3ec; color: #24533f; border-color: rgba(36, 83, 63, .18); }
.space-team .alert-danger { background: #f9e4e8; color: #8c3f4d; border-color: rgba(140, 63, 77, .18); }
.space-team .alert-warning { background: #fff1d4; color: #8a6118; border-color: rgba(138, 97, 24, .18); }

.team-bottom-nav {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    z-index: 50;
    transform: translateX(-50%);
    width: min(calc(100vw - 24px), 528px);
    min-height: 66px;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    border: 1px solid rgba(24, 42, 36, .12);
    border-radius: 28px;
    background: rgba(255, 252, 245, .92);
    box-shadow: 0 22px 60px -28px rgba(18, 53, 43, .72), 0 1px 2px rgba(18, 53, 43, .08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.team-bottom-nav a {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 20px;
    color: var(--team-muted);
    text-decoration: none;
    font-size: 10px;
    line-height: 1.1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .035em;
}
.team-bottom-nav a i { font-size: 18px; line-height: 1; }
.team-bottom-nav a[aria-current="page"] {
    background: var(--team-forest);
    color: #fff;
}

.login-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}
.login-card {
    width: min(100%, 430px);
    padding: 28px;
    border-radius: 30px;
    background: var(--team-panel);
    border: 1px solid var(--team-line);
    box-shadow: var(--team-shadow);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand-logo { max-width: 160px; height: auto; margin: 0 auto 12px; display: block; }
.login-brand p { margin: 0; color: var(--team-muted); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.text-center { text-align: center; }
.mt-3 { margin-top: 14px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--team-muted) !important; }
.text-sm { font-size: 13px; }

/* Photo widget : rendu plus mobile, sans changer le JS existant. */
.space-team .ycs-pcw-buttons { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; }
.space-team .ycs-pcw-btn {
    min-height: 48px;
    justify-content: center;
    border-radius: 17px !important;
    font-weight: 900 !important;
}
.space-team .ycs-pcw-preview { gap: 10px !important; }
.space-team .ycs-pcw-thumb,
.space-team .ycs-pcw-thumb img { width: 88px !important; height: 88px !important; border-radius: 18px !important; }
.space-team .ycs-pcw-hint { color: var(--team-muted) !important; font-size: 12px !important; }

@media (min-width: 760px) {
    body.space-team { padding: 22px 0 0; }
    body.space-team > header,
    body.space-team .team-app-header {
        border-radius: 30px;
        max-width: 720px;
    }
    .team-shell { max-width: 720px; padding-left: 0; padding-right: 0; }
    .team-stat-row { grid-template-columns: repeat(3, 1fr); }
    .team-bottom-nav { width: min(calc(100vw - 44px), 690px); }
}

@media (min-width: 1024px) {
    body.space-team { padding-top: 28px; }
    body.space-team > header,
    body.space-team .team-app-header,
    .team-shell { max-width: 820px; }
    .team-bottom-nav { width: 520px; }
    .team-card { padding: 18px !important; }
}

@media (max-width: 390px) {
    .team-stat-row { grid-template-columns: 1fr; }
    .team-hero-top { flex-direction: column; }
    .team-quick-number { width: 100%; display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px; }
    .team-quick-number b { font-size: 24px; }
    .team-quick-number span { margin-top: 0; }
    .space-team .ycs-pcw-buttons { grid-template-columns: 1fr; }
}
