/* Garden Planet — UI moderne, sobre, compacte (bleu pastel dominant + vert sauge & crème) */
:root {
    --bg-app: #f3f7fb;
    --bg-panel: #ffffff;
    --bg-soft: #eaf2fa;
    --bg-cream: #fcfaf4;
    --border: #d5e2ee;
    --border-strong: #b6cce2;
    --ink: #243647;
    --ink-muted: #5a6f82;
    --primary: #4b86be;
    --primary-dark: #356a9d;
    --primary-soft: #e3effa;
    --sage: #58965d;
    --sage-soft: #e7f5e8;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --danger: #dc2626;
    --shadow: 0 4px 16px rgba(36, 54, 71, 0.08);
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg-app);
    font-size: 13px;
    user-select: none;
    -webkit-user-select: none;
}

input, select, textarea {
    user-select: auto;
    -webkit-user-select: auto;
}

.gp-app {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
}

/* --- TOPBAR --- */
.gp-topbar {
    height: 44px;
    min-height: 44px;
    flex: 0 0 auto;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    padding: 5px 8px;
    gap: 6px;
    overflow: visible;
    z-index: 40;
}

.gp-topbar::-webkit-scrollbar {
    display: none;
}

.gp-brand {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    font-size: 13px;
    color: var(--primary-dark);
    white-space: nowrap;
    flex-shrink: 0;
}

.gp-brand-badge {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, #7ec257, #4b86be);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

.gp-bar-group {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    min-width: 0;
    flex-shrink: 0;
}

.gp-topbar .gp-btn {
    height: 28px;
    padding: 0 7px;
    font-size: 11px;
    gap: 3px;
}

.gp-topbar .gp-select {
    height: 28px;
    padding: 0 4px;
    font-size: 11px;
    width: auto;
    max-width: none;
}

.gp-select, .gp-input {
    height: 30px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    padding: 0 7px;
    background: var(--bg-cream);
    color: var(--ink);
    font-size: 12px;
    outline: none;
}

#garden-select {
    max-width: 155px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gp-select:focus, .gp-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(75, 134, 190, 0.16);
}

.gp-btn {
    height: 30px;
    border: 1px solid var(--border-strong);
    background: var(--bg-panel);
    color: var(--ink);
    border-radius: 7px;
    padding: 0 8px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.gp-btn:hover {
    background: var(--bg-soft);
    border-color: var(--primary);
}

.gp-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

.gp-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

.gp-btn.primary:hover {
    background: var(--primary-dark);
}

.gp-btn.sage {
    background: var(--sage-soft);
    color: #2d6232;
    border-color: #b4d9b7;
}

.gp-btn.sage.active {
    background: var(--sage);
    color: #fff;
    border-color: #3f7644;
}

.gp-btn.gp-free-badge {
    background: var(--sage-soft);
    border-color: #b4d9b7;
    color: #2d6232;
    font-weight: 700;
}

.gp-btn.gp-free-badge:hover {
    background: #dcfce7;
    border-color: #4a8c50;
}

.gp-unlock-card {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding: 7px 8px;
    border-radius: 8px;
    border: 1px dashed #93c5fd;
    background: #eff6ff;
    color: #1e40af;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s;
}

.gp-unlock-card:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}

.gp-season-box {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0 9px 0 5px;
    height: 30px;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.gp-season-box.out-of-window {
    border-color: #f59e0b;
    background: #fffbeb;
}

.gp-slider-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 240px;
    height: 26px;
}

.gp-season-box input[type="range"] {
    width: 100%;
    height: 11px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.gp-slider-window-track {
    position: relative;
    width: calc(100% - 12px);
    margin: 1px 6px 0 6px;
    height: 4px;
    background: rgba(148, 163, 184, 0.28);
    border-radius: 99px;
    overflow: hidden;
    pointer-events: none;
}

.gp-slider-ticks {
    position: relative;
    width: calc(100% - 12px);
    margin: 1px 6px 0 6px;
    height: 9px;
    pointer-events: none;
}

.gp-slider-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 8.5px;
    font-weight: 700;
    line-height: 1;
    color: #15803d;
    white-space: nowrap;
    display: none;
}

.gp-slider-abri,
.gp-slider-valid {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 99px;
    display: none;
}

.gp-slider-abri {
    background: #93c5fd;
}

.gp-slider-valid {
    background: #22c55e;
}

.gp-play-btn {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--primary-dark);
    font-size: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
}

.gp-play-btn:hover, .gp-play-btn.playing {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

.gp-step-btn {
    width: 20px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0 0 1px 0;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.gp-step-btn:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

.gp-step-btn:disabled {
    opacity: 0.36;
    cursor: default;
}

.gp-season-label {
    font-weight: 700;
    color: var(--primary-dark);
    min-width: 96px;
    width: auto;
    padding-right: 4px;
    font-size: 11px;
    white-space: nowrap;
}

.gp-season-box.out-of-window .gp-season-label {
    color: #b45309;
}

/* --- WORKSPACE --- */
.gp-workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

/* --- LEFT PALETTE --- */
.gp-left {
    width: 244px;
    flex: 0 0 244px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 10px;
    gap: 8px;
}

.gp-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    pointer-events: none;
}

.gp-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--border);
    padding: 3px;
    border-radius: 9px;
}

.gp-tabs.gp-tabs-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.gp-tab {
    border: none;
    background: transparent;
    color: var(--ink-muted);
    font-weight: 600;
    font-size: 11.5px;
    padding: 6px 4px;
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s, color 0.15s;
}

.gp-tab:hover:not(.active) {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.gp-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 4px rgba(47, 99, 149, 0.24);
}

.gp-cat-filter {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    padding: 3px;
    background: #e8f1fb;
    border: 1px solid #bfd6ee;
    border-radius: 9px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.gp-cat-pill {
    height: 26px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 1;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.gp-cat-pill:hover:not(.active) {
    background: #ffffff;
    border-color: #aac9ea;
    transform: translateY(-1px);
}

.gp-cat-pill.active {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: #fff;
    box-shadow: 0 1px 4px rgba(47, 99, 149, 0.28);
}

.gp-palette-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.gp-crop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.gp-crop-card {
    border: 1.5px solid var(--border);
    background: var(--bg-cream);
    border-radius: 8px;
    padding: 4px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s, border-color 0.15s, background 0.15s;
}

.gp-crop-card:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-1px);
}

.gp-crop-card.selected {
    border-color: var(--primary-dark);
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px rgba(75, 134, 190, 0.22);
}

.gp-crop-card img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    pointer-events: none;
}

.gp-crop-name {
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--ink);
}

.gp-crop-sub {
    font-size: 10px;
    color: var(--ink-muted);
}

.gp-soil-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gp-soil-card {
    border: 1.5px solid var(--border);
    background: var(--bg-cream);
    border-radius: 9px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

.gp-soil-card:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.gp-soil-card.selected {
    border-color: var(--primary-dark);
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px rgba(75, 134, 190, 0.22);
}

.gp-soil-swatch {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 1.5px solid #4a3222;
    flex-shrink: 0;
}

.gp-soil-info strong {
    display: block;
    font-size: 12px;
}

.gp-soil-info span {
    font-size: 10.5px;
    color: var(--ink-muted);
}

/* --- CENTER CANVAS STAGE --- */
.gp-stage {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    overflow: hidden;
    background: #7bb054;
}

#garden-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.gp-stage-banner {
    position: absolute;
    top: 10px;
    left: 12px;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(213, 226, 238, 0.95);
    border-radius: 10px;
    padding: 7px 9px 7px 11px;
    box-shadow: var(--shadow);
    pointer-events: auto;
    z-index: 6;
}

.gp-stage-banner.collapsed {
    padding: 0;
    border-radius: 9px;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}

.gp-stage-banner.collapsed .gp-banner-content {
    display: none;
}

.gp-banner-chip {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid rgba(213, 226, 238, 0.95);
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary-dark);
    box-shadow: var(--shadow);
    cursor: pointer;
    place-items: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.gp-banner-chip:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.gp-stage-banner.collapsed .gp-banner-chip {
    display: grid;
}

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

.gp-banner-min {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(240, 246, 252, 0.9);
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
}

.gp-banner-min:hover {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: #fff;
}

.gp-stage-banner strong {
    display: block;
    font-size: 12px;
    color: var(--primary-dark);
}

.gp-stage-banner span {
    display: block;
    font-size: 11.5px;
    color: var(--ink-muted);
    margin-top: 2px;
}

.gp-zoom-controls {
    position: absolute;
    right: 12px;
    bottom: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 5;
}

.gp-pan-pad {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    color: var(--ink);
}

.gp-pan-cross {
    position: absolute;
    inset: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    color: #94a3b8;
    pointer-events: none;
}

.gp-pan-dir {
    position: absolute;
    width: 17px;
    height: 17px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: #334155;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.gp-pan-dir:hover {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--primary-dark);
}

.gp-pan-dir:active {
    background: var(--primary);
    color: #fff;
}

.gp-pan-up    { top: 1px;    left: 50%; transform: translateX(-50%); }
.gp-pan-down  { bottom: 1px; left: 50%; transform: translateX(-50%); }
.gp-pan-left  { left: 1px;   top: 50%;  transform: translateY(-50%); }
.gp-pan-right { right: 1px;  top: 50%;  transform: translateY(-50%); }

.gp-zoom-controls .gp-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
    font-size: 14px;
}

.gp-zoom-controls .gp-btn.active,
.gp-zoom-controls .gp-btn.active:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

.gp-zoom-controls #btn-erase-toggle.active,
.gp-zoom-controls #btn-erase-toggle.active:hover {
    background: #ea580c;
    color: #fff;
    border-color: #c2410c;
}

.gp-statusbar {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    height: 28px;
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: var(--ink);
    box-shadow: var(--shadow);
    pointer-events: none;
}

.gp-statusbar span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gp-legal-link {
    pointer-events: auto;
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 2px 4px;
    font-size: 10.5px;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: color 0.14s, text-decoration-color 0.14s;
}

.gp-legal-link:hover {
    color: var(--primary-dark);
    text-decoration-color: currentColor;
}

/* --- RIGHT DASHBOARD --- */
.gp-right {
    width: 310px;
    flex: 0 0 310px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    gap: 8px;
}

.gp-right-pane {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gp-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.gp-kpi {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 7px 9px;
}

.gp-kpi.sage {
    background: var(--sage-soft);
    border-color: #c7e5ca;
}

.gp-kpi.gp-kpi-wide {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
}

.gp-comp-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 8px;
}

.gp-comp-group:last-of-type {
    margin-bottom: 4px;
}

.gp-comp-heading {
    font-size: 11px;
    font-weight: 700;
}

.gp-comp-heading.good {
    color: #166534;
}

.gp-comp-heading.bad {
    color: #9a3412;
}

.gp-comp-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.gp-comp-hint {
    margin-top: 4px;
    font-size: 10.5px;
    color: var(--ink-muted);
}

.gp-kpi-label {
    font-size: 10.5px;
    color: var(--ink-muted);
    font-weight: 600;
}

.gp-kpi-val {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 1px;
}

.gp-kpi-sub {
    font-size: 10px;
    color: var(--ink-muted);
}

.gp-card {
    background: var(--bg-cream);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 10px;
}

.gp-card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gp-fiche-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.gp-fiche-head img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
}

.gp-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.gp-pill {
    font-size: 10.5px;
    padding: 2px 6px;
    border-radius: 99px;
    background: var(--bg-soft);
    color: var(--primary-dark);
    font-weight: 600;
}

.gp-pill.good {
    background: var(--sage-soft);
    color: #255b2a;
}

.gp-pill.bad {
    background: var(--amber-soft);
    color: #9a3412;
}

.gp-fiche-text {
    font-size: 11.5px;
    line-height: 1.38;
    color: var(--ink);
    margin: 0 0 5px 0;
}

.gp-fiche-tip {
    font-size: 11px;
    line-height: 1.35;
    background: #fff;
    border-left: 3px solid var(--sage);
    padding: 5px 7px;
    border-radius: 0 6px 6px 0;
    color: var(--ink-muted);
}

.gp-cal-bar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
    margin: 6px 0;
}

.gp-cal-m {
    text-align: center;
    font-size: 9.5px;
    padding: 2px 0;
    border-radius: 4px;
    background: #edf2f7;
    color: var(--ink-muted);
    font-weight: 600;
}

.gp-cal-m.abri { background: #dbeafe; color: #1d4ed8; }
.gp-cal-m.plant { background: #dcfce7; color: #15803d; }
.gp-cal-m.harvest { background: #fef08a; color: #854d0e; }

.gp-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.gp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
}

.gp-table th {
    position: sticky;
    top: 0;
    background: var(--bg-soft);
    color: var(--primary-dark);
    font-weight: 700;
    padding: 6px 5px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.gp-table th:first-child, .gp-table td:first-child {
    text-align: left;
    padding-left: 8px;
}

.gp-table th:last-child, .gp-table td:last-child {
    padding-right: 9px;
}

.gp-table td {
    padding: 5px 5px;
    text-align: right;
    border-bottom: 1px solid #eef3f8;
}

.gp-table tr.total-row td {
    font-weight: 700;
    background: var(--sage-soft);
    color: #214e25;
    border-top: 1.5px solid #b5dbb8;
}

.gp-comp-box {
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

@media (max-width: 1240px) {
    .gp-topbar {
        padding: 4px 6px;
        gap: 4px;
    }
    .gp-brand {
        font-size: 12px;
    }
    .gp-topbar .gp-btn {
        padding: 0 5.5px;
        font-size: 10.5px;
    }
    .gp-topbar .gp-select {
        font-size: 10.5px;
        max-width: none;
    }
    .gp-season-label {
        min-width: 88px;
        font-size: 10.5px;
    }
    .gp-left {
        width: 218px;
        flex: 0 0 218px;
        padding: 8px;
    }
    .gp-right {
        width: 284px;
        flex: 0 0 284px;
        padding: 8px;
    }
}

@media (max-width: 1040px) {
    .gp-brand span {
        display: none;
    }
    .gp-topbar .gp-btn {
        padding: 0 5px;
        font-size: 10px;
    }
    .gp-topbar .gp-select {
        font-size: 10px;
        max-width: none;
    }
    .gp-slider-wrap {
        width: 180px;
    }
    .gp-season-label {
        min-width: 82px;
        font-size: 10px;
    }
}

/* --- MODALS --- */
.gp-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(24, 38, 52, 0.42);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.gp-modal-backdrop.open {
    display: flex;
}

.gp-modal {
    position: relative;
    width: 440px;
    max-width: 94vw;
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    padding: 16px 18px;
}

.gp-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.gp-modal-close:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

.gp-modal h3 {
    margin: 0 0 10px 0;
    padding-right: 28px;
    font-size: 15px;
    color: var(--primary-dark);
}

.gp-modal-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.gp-modal-row label {
    font-size: 12px;
    font-weight: 600;
    flex: 1;
}

.gp-modal-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.gp-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.gp-warn {
    background: var(--amber-soft);
    color: #9a3412;
    border-radius: 8px;
    padding: 7px 9px;
    font-size: 11.5px;
    margin-top: 6px;
    display: none;
}

.gp-warn.visible {
    display: block;
}

.gp-toast {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #243647;
    color: #fff;
    padding: 8px 14px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 200;
}

.gp-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- MODE PLEIN ÉCRAN CARTE --- */
.gp-fs-enter {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
    font-size: 15px;
}

.gp-fs-exit {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.gp-app.gp-fullscreen .gp-topbar,
.gp-app.gp-fullscreen .gp-left,
.gp-app.gp-fullscreen .gp-right,
.gp-app.gp-fullscreen .gp-fs-enter {
    display: none;
}

.gp-app.gp-fullscreen .gp-fs-exit {
    display: inline-flex;
}

.gp-app.gp-fullscreen .gp-stage > .gp-season-box {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: rgba(255, 253, 248, 0.94);
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow);
    padding: 4px 10px;
}

.gp-app.gp-fullscreen .gp-stage > .gp-season-box.out-of-window {
    background: rgba(255, 251, 235, 0.96);
}

/* --- AGENDA DYNAMIQUE & LISTE DE COURSES --- */
.gp-agenda-box {
    display: flex;
    flex-direction: column;
    gap: 9px;
    font-size: 11.5px;
}

.gp-agenda-sec {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gp-agenda-h {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-dark);
}

.gp-agenda-h.harvest { color: #92400e; }
.gp-agenda-h.plant { color: #166534; }
.gp-agenda-h.abri { color: #1d4ed8; }
.gp-agenda-h.freed { color: #9a3412; }

.gp-agenda-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 7px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--border);
    cursor: pointer;
}

.gp-agenda-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.gp-agenda-item.harvest { background: #fefce8; border-color: #fde68a; }
.gp-agenda-item.plant { background: #f0fdf4; border-color: #bbf7d0; }
.gp-agenda-item.abri { background: #eff6ff; border-color: #bfdbfe; }

.gp-agenda-qty {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ink-muted);
    white-space: nowrap;
}

.gp-agenda-note {
    font-size: 11px;
    color: var(--ink-muted);
    line-height: 1.35;
}

.gp-pill-btn {
    border: 1px solid #86efac;
    cursor: pointer;
}

.gp-pill-btn:hover {
    background: #bbf7d0;
}

.gp-subtabs {
    padding: 2px;
    border-radius: 8px;
}

.gp-subtabs .gp-tab {
    font-size: 11px;
    padding: 5px 4px;
}

.gp-shop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 11px;
    color: var(--ink-muted);
}

.gp-shop-head .gp-btn {
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
}

.gp-shopping-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 2px;
}

.gp-shop-group h4 {
    margin: 0 0 6px 0;
    font-size: 11.5px;
    color: var(--primary-dark);
    border-bottom: 1px solid var(--border);
    padding-bottom: 3px;
}

.gp-shop-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 6px;
    border-radius: 7px;
    border: 1px solid #eef3f8;
    background: var(--bg-cream);
    margin-bottom: 4px;
    cursor: pointer;
}

.gp-shop-row img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px;
    flex-shrink: 0;
}

.gp-shop-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.gp-shop-info strong {
    font-size: 11.5px;
    color: var(--ink);
}

.gp-shop-info span {
    font-size: 10px;
    color: var(--ink-muted);
}

.gp-shop-qty {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--primary-soft);
    padding: 2px 7px;
    border-radius: 99px;
    white-space: nowrap;
}

.gp-agenda-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gp-btn-xs {
    height: 24px;
    padding: 0 7px;
    font-size: 10.5px;
    border-radius: 6px;
}

.gp-modal-wide {
    width: 520px;
}

.gp-rm-summary {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary-dark);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 9px;
    margin-bottom: 8px;
}

.gp-rm-preview {
    max-height: 210px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-cream);
    padding: 8px 10px;
    font-size: 11.5px;
    line-height: 1.45;
}

.gp-rm-prev-week {
    margin-bottom: 8px;
}

.gp-rm-prev-week:last-child {
    margin-bottom: 0;
}

.gp-rm-prev-whead {
    font-weight: 700;
    color: var(--primary-dark);
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
    margin-bottom: 4px;
}

.gp-rm-prev-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
}

.gp-rm-coord-badge {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 10.5px;
    font-weight: 700;
    background: #eef4fa;
    color: var(--primary-dark);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    padding: 0 5px;
    white-space: nowrap;
    align-self: flex-start;
}

/* --- FEUILLE IMPRIMABLE FEUILLE DE ROUTE & PLAN SIMPLIFIÉ A1.. --- */
.gp-roadmap-print-sheet {
    display: none;
}

@media print {
    body { background: #fff !important; overflow: visible !important; color: #111 !important; }
    .gp-topbar, .gp-left, .gp-stage, .gp-toast, #modal-resize, #modal-roadmap, #popup-greenhouse,
    .gp-right > .gp-tabs, .gp-subtabs, #right-panel-fiche, #right-panel-agenda,
    #potager-sub-stats, #btn-print-shopping {
        display: none !important;
    }
    .gp-app, .gp-workspace, .gp-right, #right-panel-bilan, #potager-sub-shopping {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        border: none !important;
        padding: 0 !important;
    }
    .gp-shopping-scroll { overflow: visible !important; }

    /* Mode impression Feuille de route : masque l'appli et n'imprime que le plan A1 + tâches */
    body.gp-print-roadmap .gp-app {
        display: none !important;
    }
    body.gp-print-roadmap #roadmap-print-sheet {
        display: block !important;
        font-family: 'Segoe UI', Arial, sans-serif;
        color: #111;
        padding: 4mm;
    }
    .gp-rm-sheet-head {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        border-bottom: 2px solid #222;
        padding-bottom: 4px;
        margin-bottom: 10px;
    }
    .gp-rm-sheet-head h1 {
        margin: 0;
        font-size: 16px;
    }
    .gp-rm-sheet-meta {
        font-size: 11px;
        color: #444;
    }
    .gp-rm-plan-block {
        margin-bottom: 14px;
        page-break-inside: avoid;
    }
    .gp-rm-section-title {
        font-size: 12.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin: 0 0 6px 0;
        color: #111;
    }
    .gp-rm-grid {
        border-collapse: collapse;
        table-layout: fixed;
        width: 100%;
        max-width: 190mm;
    }
    .gp-rm-grid th {
        font-size: 9px;
        font-weight: 700;
        color: #444;
        padding: 2px 1px;
        text-align: center;
        border: none;
    }
    .gp-rm-grid td {
        height: 20px;
        text-align: center;
        vertical-align: middle;
        font-family: ui-monospace, Consolas, monospace;
        font-size: 8.5px;
        padding: 1px;
        border: 0.5px dotted #cbd5e1;
        color: #999;
    }
    .gp-rm-grid td.is-alley {
        background: #e8ecf0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border: 0.5px solid #cbd5e1;
    }
    .gp-rm-grid td.is-soil {
        background: #fff !important;
        border: 0.8px solid #666;
        color: #333;
        font-weight: 600;
    }
    .gp-rm-grid td.is-active {
        background: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color: #000;
        font-weight: 800;
        border-color: #111;
    }
    .gp-rm-grid td.bed-t { border-top: 2px solid #111 !important; }
    .gp-rm-grid td.bed-b { border-bottom: 2px solid #111 !important; }
    .gp-rm-grid td.bed-l { border-left: 2px solid #111 !important; }
    .gp-rm-grid td.bed-r { border-right: 2px solid #111 !important; }
    .gp-rm-plan-legend {
        margin-top: 4px;
        font-size: 9.5px;
        color: #444;
    }
    .gp-rm-week-block {
        margin-bottom: 10px;
        page-break-inside: avoid;
    }
    .gp-rm-week-title {
        font-size: 12px;
        font-weight: 700;
        background: #f3f4f6 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-left: 3px solid #111;
        padding: 3px 7px;
        margin-bottom: 4px;
    }
    .gp-rm-task-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .gp-rm-task-list li {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 10px;
        padding: 3px 4px;
        border-bottom: 0.5px solid #e2e8f0;
        font-size: 11px;
    }
    .gp-rm-task-coords {
        font-family: ui-monospace, Consolas, monospace;
        font-weight: 700;
        font-size: 10.5px;
        white-space: nowrap;
        border: 1px solid #333;
        border-radius: 3px;
        padding: 0 5px;
    }
    .gp-rm-task-gh {
        font-style: italic;
        font-size: 10.5px;
        color: #444;
        white-space: nowrap;
    }
}

/* --- POP-UP DÉPLAÇABLE INTÉRIEUR ILLUSTRÉ DE LA MINI-SERRE --- */
.gp-float-popup {
    position: fixed;
    top: 62px;
    left: 260px;
    width: 532px;
    height: min(560px, calc(100vh - 92px));
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 76px);
    background: #fff;
    border: 2px solid #8a5e32;
    border-radius: 13px;
    box-shadow: 0 18px 46px rgba(24, 42, 62, 0.28);
    z-index: 65;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gp-float-head {
    background: linear-gradient(180deg, #9f6a37 0%, #7d4f25 100%);
    color: #fffdf7;
    padding: 8px 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: move;
    user-select: none;
    border-bottom: 1.5px solid #593617;
}

.gp-float-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 700;
}

.gp-float-badge {
    font-size: 10.5px;
    font-weight: 600;
    background: rgba(255, 253, 240, 0.22);
    padding: 2px 7px;
    border-radius: 99px;
}

.gp-float-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.gp-float-btn,
.gp-float-close {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.gp-float-btn:hover,
.gp-float-close:hover {
    background: rgba(255, 255, 255, 0.34);
}

.gp-float-popup.fullscreen {
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    width: auto !important;
    height: auto !important;
    max-width: none;
    max-height: none;
    border-radius: 12px;
    z-index: 80;
}

.gp-float-popup.fullscreen .gp-float-head {
    cursor: default;
}

/* --- BANDEAU FLOTTANT : ALERTE HORS FENÊTRE DE PLANTATION --- */
.gp-plant-guard-banner {
    position: absolute;
    bottom: 44px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 26;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 13px;
    background: rgba(254, 242, 242, 0.97);
    border: 2px solid #dc2626;
    border-radius: 99px;
    box-shadow: 0 8px 24px rgba(153, 27, 27, 0.22);
    font-size: 12px;
    font-weight: 700;
    color: #991b1b;
    white-space: nowrap;
}

.gp-plant-guard-banner .gp-btn {
    height: 26px;
    padding: 0 9px;
    font-size: 11px;
}

/* --- BANDEAU FLOTTANT : REPÈRE DE PLANTATION SUR LE PLAN (DEPUIS LA SERRE) --- */
.gp-map-link-banner {
    position: absolute;
    bottom: 44px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 13px;
    background: rgba(255, 251, 235, 0.96);
    border: 2px solid #d97706;
    border-radius: 99px;
    box-shadow: 0 8px 24px rgba(120, 53, 15, 0.24);
    font-size: 12px;
    font-weight: 700;
    color: #78350f;
    white-space: nowrap;
}

.gp-map-link-banner .gp-btn {
    height: 26px;
    padding: 0 9px;
    font-size: 11px;
}

.gp-map-link-close {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(180, 83, 9, 0.14);
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.gp-map-link-close:hover {
    background: rgba(180, 83, 9, 0.26);
}

.gp-gh-toolbar {
    padding: 6px 10px;
    background: #f8f3e8;
    border-bottom: 1px solid #dfd2bc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.gp-gh-summary {
    font-size: 11px;
    font-weight: 700;
    color: #5c3d1e;
}

.gp-gh-canvas-wrap {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    background: #c8e8f4;
    display: block;
    text-align: center;
}

.gp-gh-canvas-wrap canvas {
    display: inline-block;
    vertical-align: top;
}

.gp-gh-footer {
    flex-shrink: 0;
    padding: 7px 10px;
    background: #f8f3e8;
    border-top: 1px solid #dfd2bc;
    font-size: 11px;
    color: #4a3723;
    min-height: 36px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.gp-gh-step {
    border: 1px solid #cfa97a;
    background: #fffdf7;
    color: #4a3222;
    border-radius: 99px;
    padding: 2px 8px;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.gp-gh-step:hover {
    background: #fef08a;
    border-color: #d97706;
    color: #854d0e;
}

.gp-gh-step.current {
    background: #4b86be;
    border-color: #2f6395;
    color: #fff;
}

.gp-gh-arrow {
    color: #b45309;
    font-weight: 700;
    font-size: 11px;
}

body.gp-dragging,
body.gp-dragging * {
    user-select: none !important;
    -webkit-user-select: none !important;
}


/* ==================== ROTATIONS PLURIANNUELLES (N+1) ==================== */
.gp-year-select {
    font-weight: 700;
    color: #2c5282;
    background: #eef6ff;
    border-color: #bcd6f5;
    padding: 0 9px;
    min-width: 88px;
    max-width: none;
    width: auto;
}
.gp-toast.show {
    pointer-events: auto;
    cursor: pointer;
}


/* ==================== GROUPE ICÔNES FICHIER (TOPBAR) ==================== */
.gp-file-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    background: #e4effb;
    border: 1px solid #b9d3ee;
    border-radius: 9px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.gp-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #2b4c73;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}
.gp-icon-btn:hover,
.gp-icon-btn:focus-visible {
    background: #ffffff;
    border-color: #aac9ea;
    color: #1d4ed8;
    box-shadow: 0 1px 3px rgba(30, 64, 110, 0.12);
    outline: none;
}
.gp-icon-btn.needs-save {
    background: #f59e0b;
    border-color: #d97706;
    color: #ffffff;
    animation: gpSaveBlink var(--save-blink-dur, 1.8s) ease-in-out infinite;
}
.gp-icon-btn.needs-save::before {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #dc2626;
}
@keyframes gpSaveBlink {
    0%, 100% {
        background: #f59e0b;
        border-color: #b45309;
        color: #ffffff;
        box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.38);
    }
    50% {
        background: #fffbeb;
        border-color: #f59e0b;
        color: #b45309;
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}
.gp-icon-btn[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    padding: 3px 8px;
    border-radius: 6px;
    background: #1e3a5f;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.22);
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 90;
}
.gp-icon-btn[data-tip]:hover::after,
.gp-icon-btn[data-tip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* Éviter que le tooltip du dernier bouton (Charger) ne sorte du bord droit */
.gp-file-group .gp-icon-btn:last-child[data-tip]::after {
    left: auto;
    right: 0;
    transform: translateY(-2px);
}
.gp-file-group .gp-icon-btn:last-child[data-tip]:hover::after,
.gp-file-group .gp-icon-btn:last-child[data-tip]:focus-visible::after {
    transform: translateY(0);
}

/* --- MODALE LECTEUR VIDÉO DÉMO --- */
.gp-modal-video {
    width: min(820px, 94vw);
    max-width: 94vw;
}
.gp-video-wrap {
    border-radius: 10px;
    overflow: hidden;
    background: #0f172a;
    aspect-ratio: 16 / 9;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.22);
}
.gp-video-wrap video {
    width: 100%;
    height: 100%;
    display: block;
}
