:root {
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-heading: 'IBM Plex Sans', sans-serif;
    --bg: #f7efe5;
    --bg-strong: #f2e2cf;
    --surface: rgba(255, 250, 244, 0.9);
    --surface-strong: #fffaf5;
    --surface-soft: #f8eee1;
    --border: rgba(124, 80, 48, 0.14);
    --text: #37241a;
    --muted: #7f6657;
    --accent: #c86b39;
    --accent-strong: #ae572a;
    --accent-soft: #efbb87;
    --brown: #6d4630;
    --brown-soft: #8f654d;
    --cream: #fff4e8;
    --sage: #79a894;
    --sage-soft: #d7ebe3;
    --sun: #f5c85e;
    --danger: #cf7465;
    --shadow: 0 20px 45px rgba(92, 58, 34, 0.12);
    --shadow-soft: 0 12px 28px rgba(105, 67, 42, 0.1);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    /* Espacements systématiques */
    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 16px;
    --space-lg: 24px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 207, 150, 0.55), transparent 24%),
        radial-gradient(circle at 85% 12%, rgba(200, 107, 57, 0.18), transparent 24%),
        linear-gradient(180deg, #fbf7f2 0%, #f7efe5 48%, #f3e7d8 100%);
}

body.sidebar-open {
    overflow: hidden;
}

body.auth-locked {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a[href],
select,
summary,
label[for],
input[type="button"],
input[type="submit"],
input[type="reset"],
input[type="checkbox"],
input[type="radio"],
input[type="range"],
input[type="color"],
input[type="file"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"],
.google-calendar-main,
.google-family-primary-label,
.planner-toggle {
    cursor: pointer;
}

input:not([type]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea {
    cursor: text;
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled {
    cursor: not-allowed;
}

button {
    border: 0;
}

svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-topbar {
    display: none;
}

.mobile-overlay {
    display: none;
}

.page-shell {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
}

.sidebar,
.panel-card,
.home-board,
.toast,
.metric-card,
.shortcut-card {
    backdrop-filter: blur(16px);
}

.sidebar {
    position: sticky;
    top: 18px;
    align-self: start;
    min-height: calc(100vh - 36px);
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 32px;
    background:
        radial-gradient(circle at top right, rgba(255, 214, 165, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(87, 56, 41, 0.98), rgba(70, 46, 35, 0.98));
    color: #fff7f0;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
}

.sidebar-top,
.sidebar-bottom {
    display: grid;
    gap: 18px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-lockup.compact,
.brand-lockup.compact > div {
    min-width: 0;
}

.brand-lockup.compact h1,
.mobile-topbar h1 {
    font-size: 1.3rem;
}

#family-name-sidebar {
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: pre-line;
}

#family-name-mobile {
    font-size: 1.1rem;
    line-height: 1.2;
}

.brand-badge {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(145deg, #f6bf6a, #ca6938);
    color: #fff7ef;
    box-shadow: 0 14px 28px rgba(201, 107, 57, 0.28);
    flex-shrink: 0;
}

.brand-badge svg {
    width: 26px;
    height: 26px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
    box-shadow: 0 14px 28px rgba(201, 107, 57, 0.28);
}

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.7rem;
    opacity: 0.75;
}

.sidebar h1,
.home-heading h2,
.weather-card h3,
.ephemeris-card h3,
.section-head h2,
.section-head h3,
.metric-value,
.shortcut-card strong,
.summary-list strong,
.summary-tile strong {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-head .eyebrow,
.weather-card .eyebrow,
.ephemeris-card .eyebrow,
.home-heading .eyebrow {
    margin-bottom: 8px;
    color: var(--brown-soft);
}

.sidebar-copy {
    margin: 0;
    color: rgba(255, 244, 235, 0.78);
    line-height: 1.6;
    font-size: 0.95rem;
}

.nav-tabs {
    display: grid;
    gap: 8px;
}

.nav-tab,
.metric-card,
.shortcut-card,
.primary-btn,
.ghost-btn,
.stack-item button,
.note-item button,
.menu-toggle,
.mobile-home-btn {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-tab {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 246, 239, 0.06);
    color: inherit;
    text-align: left;
}

.nav-tab:hover,
.nav-tab.active {
    background: linear-gradient(135deg, rgba(200, 107, 57, 0.94), rgba(235, 154, 92, 0.94));
    box-shadow: 0 16px 24px rgba(200, 107, 57, 0.22);
    transform: translateX(3px);
}

.nav-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.nav-copy {
    display: flex;
    align-items: center;
}

.nav-copy strong {
    font-size: 0.98rem;
}

.status-card {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 247, 238, 0.09);
    border: 1px solid rgba(255, 245, 238, 0.06);
}

.status-title {
    font-weight: 800;
    margin-bottom: 6px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 248, 241, 0.12);
    border: 1px solid rgba(255, 248, 241, 0.08);
    color: rgba(255, 244, 235, 0.92);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.status-chip[data-state="connected"] {
    background: rgba(121, 168, 148, 0.22);
    border-color: rgba(121, 168, 148, 0.3);
}

.status-chip[data-state="setup"] {
    background: rgba(245, 200, 94, 0.18);
    border-color: rgba(245, 200, 94, 0.28);
}

.status-chip[data-state="fallback"] {
    background: rgba(200, 107, 57, 0.18);
    border-color: rgba(200, 107, 57, 0.28);
}

.google-setup-panel {
    display: grid;
    gap: 10px;
    margin: 12px 0 14px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 248, 241, 0.08);
    border: 1px solid rgba(255, 248, 241, 0.08);
}

.google-setup-row {
    display: grid;
    gap: 4px;
}

.google-setup-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 244, 235, 0.62);
}

.google-setup-row strong,
.google-setup-hint {
    color: rgba(255, 244, 235, 0.92);
    word-break: break-word;
}

.google-setup-hint {
    margin: 0;
    line-height: 1.45;
    font-size: 0.88rem;
}

.compact-actions {
    gap: 8px;
}

.google-management-actions {
    margin-bottom: 14px;
}

.google-calendars-list {
    display: grid;
    gap: 12px;
}

.google-calendar-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 248, 241, 0.7);
    border: 1px solid rgba(200, 107, 57, 0.12);
}

.google-calendar-main {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
}

.google-calendar-main input {
    margin-top: 4px;
}

.google-calendar-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Share panel (partage d'événement) */
.share-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
}

.share-panel {
    background: var(--surface, #fffaf5);
    border-radius: 18px 18px 12px 12px;
    padding: 20px;
    width: 100%;
    max-width: 480px;
    display: grid;
    gap: 14px;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
}

.share-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.share-panel-preview {
    font-size: 0.85rem;
    color: var(--text, #2a1a0a);
    background: rgba(200, 107, 57, 0.06);
    border-radius: 10px;
    padding: 10px 12px;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    max-height: 120px;
    overflow-y: auto;
}

.share-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.share-panel-url {
    padding: 6px 0;
    word-break: break-all;
}
.share-url-link {
    color: var(--accent);
    text-decoration: underline;
    font-size: 0.85rem;
}

/* Sélection multi-éléments (documents / photos) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.drive-select-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-light, #ddd);
    background: var(--surface, #fff);
    font-size: 0.8rem;
}
.drive-select-label:has(input:checked) {
    background: var(--accent-light, #fde9dc);
    border-color: var(--accent, #c86b39);
}
.drive-selection-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 4px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-light, #eee);
    margin-top: 8px;
}
.drive-selection-count {
    font-size: 0.85rem;
    color: var(--muted);
}
.drive-photo-card.is-selected {
    outline: 2px solid var(--accent, #c86b39);
    outline-offset: 2px;
}

.google-calendar-controls {
    display: grid;
    gap: 10px;
}

.google-calendar-controls select {
    max-width: 260px;
}

.google-family-primary-label {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-size: 0.9rem;
    color: var(--muted);
}

.panel-copy {
    margin: 0 0 12px;
    line-height: 1.55;
    color: var(--muted);
}

.policy-note-list {
    display: grid;
    gap: 12px;
}

.policy-note-item {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 248, 241, 0.7);
    border: 1px solid rgba(200, 107, 57, 0.12);
}

.policy-note-item strong {
    display: block;
    margin-bottom: 6px;
}

.policy-note-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.sync-readonly-label {
    align-self: center;
    justify-self: end;
    font-weight: 700;
    color: var(--muted);
}

.session-card,
.session-actions {
    display: grid;
    gap: 10px;
}

.session-card p {
    margin: 0;
    color: rgba(255, 244, 235, 0.86);
}

.status-subcopy {
    margin: 0;
    color: rgba(255, 244, 235, 0.72);
    line-height: 1.45;
    font-size: 0.88rem;
}

.session-actions select {
    background: rgba(255, 251, 247, 0.92);
}