/* Commandes groupées d'agrumes – style inspiré de jardins-du-taillefer.fr */

:root {
    --green: #82ca61;
    --green-dark: #4e8f31;
    --green-light: #f3f8ef;
    --orange: #ffa62b;
    --ink: #393e46;
    --text: #5f5f5f;
    --muted: #7a7a7a;
    --line: #e4e6e1;
    --bg: #f6f7f4;
    --danger: #c0392b;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Roboto, "Work Sans", Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
}

h1, h2, h3 { color: var(--ink); font-family: Roboto, sans-serif; line-height: 1.25; }
h1 { font-size: 1.8rem; font-weight: 500; margin: 0 0 .6rem; }
h2 { font-size: 1.3rem; font-weight: 500; color: var(--green-dark); margin: 0 0 .8rem; }
h3 { font-size: 1.05rem; font-weight: 600; font-family: "Work Sans", sans-serif; margin: 0 0 .4rem; }
p { margin: 0 0 .8rem; }
a { color: var(--green-dark); }
a:hover { color: var(--ink); }
code { background: #eef0ea; padding: .1em .35em; border-radius: 3px; font-size: .9em; }
.break { word-break: break-all; }

.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.center { text-align: center; }
.num { text-align: right; }
.nowrap { white-space: nowrap; }
.warn { color: var(--danger); }

/* ---------- Boutons ---------- */

.button {
    display: inline-block;
    border: 0;
    border-radius: 3px;
    background: var(--green);
    color: #fff;
    cursor: pointer;
    font: 700 .85rem/1 Roboto, sans-serif;
    letter-spacing: 1.5px;
    padding: .85rem 1.3rem;
    text-decoration: none;
    text-transform: uppercase;
    transition: background .15s;
}
.button:hover { background: var(--green-dark); color: #fff; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-light { background: #fff; color: var(--green-dark); box-shadow: inset 0 0 0 1px var(--green); }
.button-light:hover { background: var(--green-light); color: var(--green-dark); }
.button-danger { background: #fff; color: var(--danger); box-shadow: inset 0 0 0 1px #e3b4ae; }
.button-danger:hover { background: #fbeeec; color: var(--danger); }
.button-large { font-size: .95rem; padding: 1.05rem 1.8rem; }
.button-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.button-row form { margin: 0; }

.link-button {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--green-dark); font: inherit; text-decoration: underline;
}
.link-button.danger { color: var(--danger); }

/* ---------- Formulaires ---------- */

label { display: block; color: var(--ink); font-weight: 500; font-size: .95rem; }
label small { color: var(--muted); font-weight: 400; }
label > small:last-child { display: block; margin-top: .2rem; }

input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=search], textarea, select {
    display: block;
    width: 100%;
    margin-top: .3rem;
    padding: .65rem .75rem;
    border: 1px solid #cfd4ca;
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    font: 400 1rem Roboto, sans-serif;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
textarea { resize: vertical; }

.checkbox { display: flex; gap: .55rem; align-items: flex-start; font-weight: 400; margin: .8rem 0 0; }
.checkbox input { margin-top: .3rem; width: 1.1rem; height: 1.1rem; accent-color: var(--green-dark); }

.stack > * + * { margin-top: 1rem; }
.grid-2, .grid-3 { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.narrow { max-width: 640px; }
.form-actions { display: flex; gap: .8rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Blocs ---------- */

.page { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page-admin { max-width: 1180px; }

.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.2rem;
}
.card > :last-child { margin-bottom: 0; }
details.card summary { cursor: pointer; color: var(--ink); }
details.card[open] summary { margin-bottom: 1rem; }

.alert { border-radius: var(--radius); padding: .85rem 1rem; margin: 0 0 1.2rem; }
.alert ul { margin: 0; padding-left: 1.2rem; }
.alert-success { background: var(--green-light); border-left: 4px solid var(--green); color: #2f5d1c; }
.alert-error { background: #fbeeec; border-left: 4px solid var(--danger); color: #8e2a1f; }
.alert-info { background: #fff6e8; border-left: 4px solid var(--orange); color: #7a4b05; }

.badge {
    display: inline-block; vertical-align: middle;
    background: #eceee9; color: var(--ink);
    border-radius: 99px; font-size: .75rem; font-weight: 500; padding: .2rem .6rem;
}
.badge-success { background: #dff1d4; color: #2f5d1c; }
.badge-warning { background: #ffe9c7; color: #7a4b05; }
.badge-muted { background: #eceee9; color: var(--muted); }
.tag-bio { color: var(--green-dark); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-left: .3rem; }

/* ---------- Tableaux ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
th { color: var(--ink); font-weight: 500; font-size: .85rem; }
thead th { border-bottom: 2px solid var(--green); }
tfoot th { border-bottom: 0; font-size: 1rem; }
.total { color: var(--green-dark); font-size: 1.2rem; font-weight: 700; }
.list-table tr.is-muted td { color: #a5a5a5; }
.list-table tr.is-paid td { background: #f8fcf5; }
.actions { white-space: nowrap; text-align: right; }
.actions > * { margin-left: .7rem; display: inline-block; }
.actions form { margin: 0; }

/* Quantités */
.products-table td { vertical-align: middle; }
.qty-col { width: 1%; }
.price-inline { display: none; }
.qty { display: inline-flex; align-items: stretch; border: 1px solid #cfd4ca; border-radius: 4px; overflow: hidden; background: #fff; }
.qty input {
    width: 3.2rem; margin: 0; border: 0; border-radius: 0; text-align: center; padding: .5rem .2rem;
    -moz-appearance: textfield; appearance: textfield; font-weight: 700;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-btn { border: 0; background: var(--green-light); color: var(--green-dark); width: 2.4rem; font-size: 1.25rem; cursor: pointer; }
.qty-btn:hover { background: var(--green); color: #fff; }
tr.has-qty td { background: #f8fcf5; }

.campaign-products input[type=text] { margin: 0; padding: .45rem .55rem; }
.campaign-products .input-price { max-width: 7rem; margin-left: auto; text-align: right; }
.campaign-products tr:not(.is-selected) td { opacity: .55; }
.campaign-products tr:not(.is-selected) td:first-child { opacity: 1; }
.campaign-products input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--green-dark); }

.split-table td { vertical-align: middle; }
.split-table input[type=text] { margin: 0; min-width: 9rem; }
.split-table .qty-btn { height: 2.3rem; border-radius: 4px; }

.paid-toggle {
    border: 1px solid #e0b36b; background: #fff8ec; color: #7a4b05;
    border-radius: 99px; cursor: pointer; font: 500 .8rem Roboto, sans-serif; padding: .3rem .75rem; white-space: nowrap;
}
.paid-toggle.is-on { border-color: var(--green); background: #dff1d4; color: #2f5d1c; }

/* ---------- Partie publique ---------- */

.hero {
    background: linear-gradient(135deg, #6fb34f 0%, #82ca61 55%, #ffa62b 160%);
    color: #fff;
    padding: 1.6rem 1rem;
}
.hero-inner { max-width: 860px; margin: 0 auto; display: flex; align-items: center; gap: 1.2rem; }
.hero-logo img { display: block; width: 96px; height: 96px; }
.hero-badge { margin: 0; font-size: .75rem; letter-spacing: 2px; text-transform: uppercase; font-weight: 700; }
.hero-title { margin: 0; font-size: 1.9rem; font-weight: 600; line-height: 1.15; }
.hero-subtitle { margin: .2rem 0 0; font-family: "Work Sans", sans-serif; font-weight: 300; }

.key-dates { display: flex; flex-wrap: wrap; gap: .8rem; margin: .4rem 0 1rem; }
.key-dates div { background: var(--green-light); border-radius: var(--radius); padding: .6rem 1rem; }
.key-dates dt { font-size: .75rem; letter-spacing: 1px; text-transform: uppercase; color: var(--green-dark); font-weight: 700; }
.key-dates dd { margin: 0; color: var(--ink); font-weight: 500; font-size: 1.05rem; }
.intro { color: var(--ink); }

.submit-card { text-align: center; }
.submit-card p:first-child { font-size: 1.15rem; color: var(--ink); }

.campaign-list { list-style: none; margin: 0; padding: 0; }
.campaign-list a { display: block; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .6rem; text-decoration: none; }
.campaign-list a:hover { border-color: var(--green); background: var(--green-light); }
.campaign-list span { display: block; color: var(--text); font-size: .9rem; }

.summary-blocks { margin-top: 1.4rem; }
.summary-blocks > div { background: var(--green-light); border-radius: var(--radius); padding: 1rem; }

.site-footer { text-align: center; font-size: .85rem; color: var(--muted); padding: 0 1rem 2rem; }
.site-footer a { color: var(--muted); }

/* ---------- Connexion ---------- */

body.auth { background: linear-gradient(135deg, #6fb34f 0%, #82ca61 70%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-box { background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 2rem; width: 100%; max-width: 400px; position: relative; padding-top: 3.5rem; }
.auth-logo { position: absolute; top: -45px; left: 50%; transform: translateX(-50%); background: var(--green); border-radius: 50%; }
.auth-box h1 { text-align: center; margin-bottom: 0; }
.auth-box > .muted { text-align: center; margin-bottom: 1.4rem; }

/* ---------- Administration ---------- */

.topbar {
    background: var(--green);
    color: #fff;
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .55rem 1.2rem;
}
.topbar-brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.topbar-brand:hover { color: #fff; }
.topbar-brand small { font-weight: 300; opacity: .9; }
.topbar-nav { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; margin-left: auto; }
.topbar-nav a, .topbar-nav .link-button { color: #fff; text-decoration: none; padding: .45rem .7rem; border-radius: 4px; font-weight: 500; font-size: .95rem; }
.topbar-nav a:hover, .topbar-nav a.is-active { background: rgba(255, 255, 255, .22); color: #fff; }
.topbar-nav .logout { margin: 0 0 0 .5rem; }
.topbar-nav .link-button { font-size: .85rem; opacity: .9; text-decoration: none; }
.menu-toggle { display: none; margin-left: auto; background: rgba(255, 255, 255, .2); color: #fff; border: 0; border-radius: 4px; padding: .45rem .8rem; font: 500 .9rem Roboto, sans-serif; cursor: pointer; }

.page-head, .section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.page-head h1, .section-head h2 { margin: 0; }
.breadcrumb { margin-bottom: .4rem; font-size: .9rem; }
.breadcrumb a { text-decoration: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; }
.stat span { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.stat strong { display: block; color: var(--ink); font-size: 1.2rem; font-weight: 500; }
.stat small { color: var(--muted); }

.copy-line { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.copy-line input { flex: 1 1 260px; margin: 0; }

.mail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.mail-actions > div { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }

.filter { margin: 0 0 .8rem; max-width: 360px; }
.search-line { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.search-line input { flex: 1 1 260px; margin: 0; }

.checklist { list-style: none; padding: 0; margin: 0 0 1rem; }
.checklist li { padding: .3rem 0 .3rem 1.6rem; position: relative; }
.checklist li::before { content: "•"; position: absolute; left: .4rem; color: var(--muted); }
.checklist li.ok::before { content: "✓"; color: var(--green-dark); left: .2rem; }
.checklist li.ko::before { content: "✗"; color: var(--danger); left: .2rem; }

/* ---------- Impression ---------- */

body.print { background: #fff; color: #000; font-size: 13px; }
.print-actions { display: flex; gap: .6rem; justify-content: flex-end; padding: 1rem; }
.print-sheet { padding: 0 1rem 1rem; }
.print-sheet h1 { font-size: 1.4rem; margin-bottom: .2rem; }
.print-table th, .print-table td { border: 1px solid #999; padding: .4rem .5rem; color: #000; }
.print-table thead th { background: #eef6e9; border-bottom: 2px solid #555; }
.print-table tfoot th { background: #eef6e9; }
.print-table .big { font-size: 1.15rem; font-weight: 700; }
.grid-table .product-col { font-size: .8rem; }
.grid-table tbody tr:nth-child(even) td { background: #fafafa; }

@media print {
    .no-print { display: none !important; }
    body.print { font-size: 11px; }
    .print-sheet { padding: 0; }
    .print-table tr { page-break-inside: avoid; }
    .print-table thead { display: table-header-group; }
    a { color: #000; text-decoration: none; }
}

/* ---------- Petits écrans ---------- */

@media (max-width: 760px) {
    h1 { font-size: 1.5rem; }
    .grid-2, .grid-3, .mail-actions { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .card { padding: 1.1rem 1rem; }
    .hero-inner { gap: .8rem; }
    .hero-logo img { width: 72px; height: 72px; }
    .hero-title { font-size: 1.4rem; }
    .menu-toggle { display: block; }
    .topbar-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
    .topbar-nav.is-open { display: flex; }
    .topbar-nav .logout { margin: 0; }
    .products-table[data-order-table] .price-col { display: none; }
    .products-table[data-order-table] .price-inline { display: block; color: var(--green-dark); font-size: .85rem; font-weight: 500; }
    .products-table th, .products-table td { padding: .6rem .35rem; }
    .actions { white-space: normal; }
    .actions > * { margin: 0 .6rem .3rem 0; }
}
