/* INTRANET CASH : noir et or, registre d'un comptoir d'achat-vente d'or */
:root {
  --bg: #0b0a08;
  --sheet: #15130f;
  --sheet-2: #1d1a13;
  --ink: #f1e9d4;
  --muted: #a89e86;
  --line: #3a3322;
  --gold: #c9a24a;
  --gold-hi: #e8cb7e;
  --gold-lo: #8a6a21;
  --on-gold: #1a1407;
  --warn-soft: #30250f;
  --ok: #7fc79a;
  --ok-soft: #14281c;
  --danger: #e59384;
  --danger-soft: #35190f;
  --radius: 4px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0; font: 15px/1.5 var(--sans); color: var(--ink);
  background: var(--bg) url("bg-or.svg") center top / 760px 760px repeat fixed;
}
a { color: var(--gold-hi); }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.8rem; color: var(--gold-hi); }
h2 { font-size: 1.25rem; margin-bottom: .75rem; color: var(--gold-hi); }
td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }

.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.side { background: #050504; border-right: 1px solid var(--gold-lo); padding: 1.25rem 0; display: flex; flex-direction: column; }
.brand { font-family: var(--serif); font-size: 1.3rem; letter-spacing: .04em; padding: 0 1.25rem 1.25rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.brand b { color: var(--gold); font-weight: 700; }
.menu-toggle, .side .menu-btn, .brand-store { display: none; }
.side-body { display: flex; flex-direction: column; flex: 1; }
.side form.store { padding: 1rem 1.25rem; }
.side .store-name { padding: 1rem 1.25rem; color: var(--gold-hi); }
.side form.store select { margin-bottom: .4rem; }
.side label { font-size: .8rem; color: var(--muted); display: block; margin-bottom: .25rem; }
.side nav { display: flex; flex-direction: column; margin-top: .5rem; }
.side nav a { color: var(--ink); text-decoration: none; padding: .55rem 1.25rem; border-left: 3px solid transparent; }
.side nav a:hover { background: #ffffff0f; }
.side nav a[aria-current="page"] { background: #c9a24a1f; border-left-color: var(--gold); color: var(--gold-hi); font-weight: 600; }
.side .who { margin-top: auto; padding: 1rem 1.25rem 0; border-top: 1px solid var(--line); font-size: .85rem; }
.main { padding: 1.75rem 2rem 3rem; max-width: 72rem; width: 100%; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 2px solid var(--gold); }
.head p { margin: 0; color: var(--muted); }

.flash { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; border-left: 4px solid; background: var(--sheet); }
.flash.ok { background: var(--ok-soft); border-color: var(--ok); }
.flash.error { background: var(--danger-soft); border-color: var(--danger); }

table { width: 100%; border-collapse: collapse; background: #15130fee; border: 1px solid var(--line); }
th, td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; font-size: .85rem; color: var(--gold); background: #0f0e0b; }
tr.low td { background: var(--warn-soft); }
tfoot td { font-weight: 700; border-top: 2px solid var(--gold); color: var(--gold-hi); }
.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }

.panel { background: #15130fee; border: 1px solid var(--line); border-top: 2px solid var(--gold-lo); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.grid { display: grid; gap: .75rem 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); align-items: end; }
label.f { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: var(--radius); background: #0d0c09; color: var(--ink); width: 100%; }
input::placeholder { color: #6f6757; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
input[readonly], textarea[readonly] { opacity: .75; }
textarea { min-height: 4.5rem; }
.btn, button { font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius); border: 1px solid var(--gold-lo); background: linear-gradient(#e6c673, #b88d33); color: var(--on-gold); padding: .45rem .9rem; }
.btn:hover, button:hover { background: linear-gradient(#f1d98e, #c9a24a); }
.btn.ghost, button.ghost { background: transparent; color: var(--gold-hi); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover, button.ghost:hover { background: #c9a24a1a; border-color: var(--gold-lo); }
.btn.danger, button.danger { background: transparent; color: var(--danger); border-color: var(--danger); font-weight: 500; }
.btn.small, button.small { padding: .2rem .55rem; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; color: var(--gold-hi); font-weight: 400; text-decoration: underline; }
a.btn { text-decoration: none; display: inline-block; }
form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .78rem; background: var(--sheet-2); border: 1px solid var(--line); }
.badge.warn { background: var(--warn-soft); border-color: var(--gold); color: var(--gold-hi); }
.badge.off { background: var(--danger-soft); border-color: var(--danger); }
.badge.achat { border-color: var(--gold); color: var(--gold-hi); }
.badge.vente { border-color: var(--ok); color: var(--ok); }

.total { font-family: var(--serif); font-size: 2rem; font-variant-numeric: tabular-nums; color: var(--gold-hi); }
.ledger-head { display: flex; flex-wrap: wrap; gap: 2rem; margin-bottom: 1.25rem; }
.ledger-head div span { display: block; color: var(--muted); font-size: .85rem; }

.perm-table td, .perm-table th { padding: .35rem .6rem; }
.checks { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.checks label { display: flex; gap: .4rem; align-items: center; }
.checks input { width: auto; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.2rem; background: var(--warn-soft); padding: .5rem .8rem; border: 1px dashed var(--gold); display: inline-block; user-select: all; color: var(--gold-hi); }
.shift { display: block; padding: .15rem .4rem; margin: .1rem 0; border-radius: 3px; background: #c9a24a26; border-left: 3px solid var(--gold); font-size: .85rem; white-space: nowrap; }
.shift.vacances { background: #6a8fb02e; border-left-color: #7fa3c7; }
.shift.repos { background: #c0392b2e; border-left-color: #d9534f; color: #f0a39e; }
.shift.travail { background: #3e9a5c2b; border-left-color: #4caf6e; color: #b6e3c4; }
.note { background: var(--sheet-2); border-left: 4px solid var(--gold-lo); padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: 1.25rem; color: var(--muted); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login { background: #100f0cf2; padding: 2rem; border-radius: var(--radius); width: min(27rem, 100%); border: 1px solid var(--gold-lo); border-top: 6px solid var(--gold); box-shadow: 0 0 60px #c9a24a1f; }
.login img.ingots { display: block; width: 100%; max-width: 20rem; margin: 0 auto 1rem; }
.login h1 { margin-bottom: .25rem; text-align: center; }
.login > p.muted { text-align: center; }
.login form { display: grid; gap: .9rem; margin-top: 1.25rem; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.table-wrap td input[type="number"] { width: 5rem; }

@media (max-width: 52rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { padding: 0; border-right: 0; border-bottom: 1px solid var(--gold-lo); }
  /* téléphone : barre fine (nom, magasin, bouton Menu) ; le menu s'ouvre à la demande */
  .side-top { display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; }
  .side .brand { padding: 0; border-bottom: 0; font-size: 1.1rem; }
  .brand-store { display: inline; margin-left: auto; color: var(--gold-hi); font-size: .9rem; font-weight: 600; }
  .side .menu-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; border: 1px solid var(--gold-lo); border-radius: 6px; color: var(--gold-hi); cursor: pointer; margin: 0; font-size: .95rem; }
  .menu-toggle:focus-visible ~ .side-top .menu-btn { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
  .menu-toggle:checked ~ .side-top .menu-btn { background: #c9a24a26; }
  .side-body { display: none; border-top: 1px solid var(--line); padding: .5rem 0 .75rem; }
  .menu-toggle:checked ~ .side-body { display: flex; }
  .side nav { flex-direction: column; }
  .side nav a { border-left: 3px solid transparent; padding: .8rem 1.25rem; }
  .side .who { margin-top: .5rem; }
  .main { padding: 1.25rem 1rem 2.5rem; }
  body { background-attachment: scroll; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, button { transition: background .15s; }
}
.moment { padding: .75rem 0; border-top: 1px solid var(--line); }
.moment:first-of-type { border-top: 0; }
.moment h3 { font-size: 1.05rem; margin-bottom: .5rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.denoms { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .5rem 1rem; margin-bottom: .75rem; }
.denoms label { display: flex; justify-content: space-between; align-items: center; gap: .5rem; color: var(--muted); }
.denoms input { width: 5.5rem; text-align: right; }
.live { font-family: var(--serif); font-size: 1.1rem; color: var(--gold-hi); margin: .25rem 0 .75rem; }
.live .live-msg { color: var(--ink); font-family: var(--sans); font-size: .95rem; }
fieldset.coins { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 .75rem; padding: .5rem .9rem .75rem; min-width: 0; }
fieldset.coins legend { padding: 0 .4rem; color: var(--gold); font-family: var(--serif); }
fieldset.coins .denoms { margin-bottom: 0; }
b.neg { color: var(--danger); }
b.pos { color: var(--ok); }
details.detail { margin: .5rem 0 .75rem; }
details.detail summary { cursor: pointer; color: var(--gold-hi); }
details.detail .table-wrap { margin: .5rem 0 0; max-width: 32rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin-bottom: 1.25rem; }
.tab-group { display: flex; flex-direction: column; gap: .35rem; }
.tab-label { color: var(--gold); font-family: var(--serif); font-size: 1rem; }
.tab-row { display: flex; gap: .25rem; }
a.tab { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem 1rem; border: 1px solid var(--line); border-bottom: 3px solid transparent; border-radius: var(--radius) var(--radius) 0 0; text-decoration: none; color: var(--ink); background: #0f0e0b; }
a.tab:hover { background: #c9a24a14; }
a.tab[aria-current="page"] { background: #15130fee; border-bottom-color: var(--gold); color: var(--gold-hi); font-weight: 600; }
.tab-state { font-size: .75rem; font-weight: 500; padding: .05rem .5rem; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tab-state.fait { border-color: var(--ok); color: var(--ok); }
.tab-state.ecart { border-color: var(--danger); color: var(--danger); }
.tab-state.afaire { border-color: var(--gold-lo); color: var(--gold-hi); }

.planning-table th[scope="row"] { white-space: nowrap; text-align: left; }
.planning-table td { vertical-align: top; min-width: 7.5rem; }
.planning-table .who { font-weight: 600; font-size: .85rem; margin-top: .25rem; }
.shift.travail small { color: var(--muted); }
.planning-table .rest-row th { color: var(--danger); border-top: 2px solid var(--gold-lo); }
.planning-table .rest-row td { border-top: 2px solid var(--gold-lo); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.chip { cursor: grab; padding: .35rem .7rem; border: 1px solid var(--gold-lo); border-radius: 99px; background: var(--sheet-2); user-select: none; }
.chip small { color: var(--muted); }
.chip:active, .shift[draggable="true"]:active { cursor: grabbing; }
.shift[draggable="true"] { cursor: grab; }
.trash { margin-left: auto; padding: .35rem .9rem; border: 1px dashed var(--danger); border-radius: var(--radius); color: var(--danger); }
.trash.over { background: var(--danger-soft); }
.planning-table td.over { outline: 2px dashed var(--gold); outline-offset: -3px; background: #c9a24a14; }
.dnd-hours { align-items: end; }
.dnd-msg { min-height: 1.4em; margin: .5rem 0 0; }
.dnd-msg.error { color: var(--danger); }
.dnd-msg.ok { color: var(--ok); }
ul.names { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }

/* Planning : vue globale tenant sur une seule page, sans défilement horizontal */
.planning-table { width: 100%; table-layout: fixed; font-size: .8rem; }
.planning-table th, .planning-table td { padding: .3rem .35rem; }
.planning-table th[scope="row"] { width: 5.2rem; }
.planning-table td { min-width: 0; }
.planning-table .shift { white-space: normal; padding: .1rem .3rem; font-size: .78rem; line-height: 1.25; }
.planning-table .shift small { font-size: .72rem; }
.planning-table .shift form.inline { float: right; margin-left: .2rem; }
.planning-table .shift button.link { padding: 0 .1rem; font-size: .75rem; text-decoration: none; }
.vac-table th[scope="row"] { width: 8rem; }
.vac-table td { height: 2.2rem; }
.vac-table td.num { text-align: right; white-space: nowrap; }
.vac-table .shift { margin: .1rem 0; }
.vac-table .shift { white-space: nowrap; display: inline-block; }
.vac-table .shift form.inline { float: none; display: inline; }

.pause-sel { font-size: .72rem; padding: 0 .1rem; margin-top: .1rem; max-width: 100%; background: transparent; color: inherit; border: 1px solid var(--line, #5a4a20); border-radius: 3px; }
.warn-panel { border-left: 3px solid var(--danger); }
.hours-table { width: 100%; border-collapse: collapse; }
.hours-table th, .hours-table td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid #ffffff14; }
.hstate { padding: .1rem .5rem; border-radius: 999px; font-size: .85rem; }
.hstate.ok { background: #3e9a5c2b; color: #b6e3c4; }
.hstate.warn { background: #d9953a2b; color: #f0c27a; }

.planning-table td.closed { background: #ffffff08; color: var(--muted); text-align: center; font-size: .75rem; font-style: italic; vertical-align: middle; }
.pause-sel { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--muted); padding: 0; cursor: pointer; font-size: .72rem; text-decoration: underline dotted; }
.pause-sel option { background: #1a1a1a; color: #eee; }
.pause-sel, .pause-txt { color: var(--text, #f1e9d2); opacity: .9; font-size: .74rem; display: inline-block; white-space: nowrap; }
.planning-table .shift { overflow: visible; }
.valrow { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .5rem 0; border-top: 1px solid #ffffff14; }
.valrow strong { min-width: 9rem; }
.valrow ul { flex-basis: 100%; margin: .2rem 0 0 1rem; font-size: .88rem; }
.valrow ul.errs { color: var(--danger); }
.valrow details { flex-basis: 100%; font-size: .88rem; color: var(--muted); }
.shift.locked { opacity: .92; border-left-style: double; }
/* planning à afficher en magasin */
.sheet { background: #fbf8ef; color: #1b1608; border-radius: 6px; padding: 1.4rem 1.6rem; margin-top: 1rem; }
.sheet header { text-align: center; border-bottom: 2px solid #9a7418; padding-bottom: .6rem; margin-bottom: 1rem; }
.sheet h2 { margin: .1rem 0; font-size: 1.5rem; color: #1b1608; }
.sheet-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; margin: 0; color: #6b5313; }
.sheet-week { margin: 0; font-weight: 600; }
.sheet-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.sheet-table { background: #fbf8ef; }
.sheet-table td { background: #fff; color: #1b1608; }
.sheet-table th, .sheet-table td { border: 1px solid #b9a463; padding: .35rem .3rem; text-align: center; font-size: .85rem; vertical-align: middle; }
.sheet-table thead th { background: #efe3b8; color: #1b1608; }
.sheet-table tbody th { text-align: left; width: 11%; background: #f5eed3; color: #1b1608; }
.sheet-table .h { display: block; font-weight: 700; }
.sheet-table .p { display: block; font-size: .74rem; color: #5a4a14; }
.sheet-table td.c-repos, .sheet-table td.c-ferme, .sheet-table .c-ferme, .sheet-table .c-vacances, .sheet-table .c-libre, .sheet-table .c-autre { color: #6b6248; font-style: italic; background: #f2efe3; }
.sheet-table .c-repos { color: #8a2c22; }
.sheet-table .tot { font-weight: 700; width: 8%; }
.sheet-note { font-size: .78rem; margin: .9rem 0 .4rem; color: #3b3216; }
.sheet footer p { margin: .2rem 0; font-size: .85rem; }
.sheet .sign { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.4rem; font-size: .85rem; }
@page { size: A4 landscape; margin: 12mm; }
@media print {
  .side, .no-print, .flash, .preview-note, .site-note { display: none !important; }
  body, .main { background: #fff !important; }
  .shell { display: block !important; }
  .main { max-width: none !important; width: 100% !important; padding: 0 !important; margin: 0 !important; }
  body::before { display: none !important; }
  .sheet { border-radius: 0; padding: 0; margin: 0; background: #fff; }
  .sheet-table th, .sheet-table td { border-color: #555; }
}
.print-only { display: none; }
@media print {
  .print-only { display: block !important; }
  .print-title { font-size: 1rem; margin: 0 0 .5rem; color: #000; display: flex !important; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: .3rem; }
  .planning-table, .hours-table { background: #fff !important; border-color: #555 !important; }
  .planning-table th, .planning-table td, .hours-table th, .hours-table td { background: #fff !important; color: #000 !important; border: 1px solid #555 !important; }
  .planning-table thead th, .hours-table thead th { background: #e9e9e9 !important; }
  .planning-table td.closed { background: #eee !important; color: #555 !important; }
  .planning-table .shift { background: #fff !important; border: 1px solid #777 !important; border-left: 3px solid #2e7d4a !important; color: #000 !important; break-inside: avoid; }
  .planning-table .shift.repos { border-left-color: #b3261e !important; color: #8a1c15 !important; }
  .planning-table .shift small, .pause-sel, .pause-txt { color: #000 !important; text-decoration: none !important; }
  .planning-table .shift form, .planning-table .shift button { display: none !important; }
  .panel { background: #fff !important; color: #000 !important; border: 1px solid #777 !important; box-shadow: none !important; }
  .panel h2, .muted { color: #000 !important; }
  .hstate { background: none !important; color: #000 !important; border: 1px solid #777; }
  .table-wrap { overflow: visible !important; }
  section[aria-label="Heures de la semaine"] { break-before: page; }
}
.weekdates { font-size: .55em; font-weight: 400; color: var(--muted); margin-left: .4rem; }
@media print { .weekdates { color: #000; } }
.flash.warn { background: #3a2a0f; border-color: #d9953a; color: #f6d28f; }
.shift.over8 { outline: 2px solid #e0a030; outline-offset: -1px; }
.shift.over8 small:first-of-type::before { content: "⚠ "; color: #f0b44a; }
.hstate.conge { background: #6a8fb02e; color: #a9c4e0; }
.gotoweek { margin-top: .6rem; align-items: end; }
.gotoweek input[type="number"] { width: 6rem; }
@media print {
  .sheet-table thead, .planning-table thead { display: table-header-group; }
  .sheet-table tr, .planning-table tr { break-inside: avoid; }
}
.planning-table td { position: relative; }
.edit-hours { float: right; margin-left: .15rem; }
.edit-hours summary { cursor: pointer; list-style: none; font-size: .75rem; color: var(--gold); }
.edit-hours summary::-webkit-details-marker { display: none; }
.edit-hours[open] form { position: absolute; z-index: 20; left: .2rem; right: .2rem; background: #1b1810; border: 1px solid var(--gold-lo, #7d5c18); border-radius: 6px; padding: .5rem; box-shadow: 0 6px 18px #000a; }
.edit-hours label { display: block; font-size: .72rem; }
.edit-hours input { width: 100%; }
.copy-week { display: inline-block; }
.copy-week[open] form { position: absolute; z-index: 20; background: #1b1810; border: 1px solid var(--gold-lo, #7d5c18); border-radius: 6px; padding: .7rem; max-width: 24rem; box-shadow: 0 6px 18px #000a; }
.copy-week summary { list-style: none; cursor: pointer; display: inline-block; }
.history { margin: .4rem 0 0 1.1rem; }
@media print { .edit-hours, .copy-week { display: none !important; } }

/* téléphone : le planning garde des cases lisibles et se fait défiler sur le côté, la colonne du magasin reste visible */
.scroll-hint { display: none; }
@media (max-width: 52rem) {
  .scroll-hint { display: block; font-size: .85rem; color: var(--muted); margin: 0 0 .4rem; }
  .planning-table { table-layout: auto; min-width: 62rem; font-size: .85rem; }
  .planning-table td { min-width: 7.5rem; }
  .planning-table th[scope="row"] { position: sticky; left: 0; z-index: 2; background: #121109; width: 5.2rem; box-shadow: 2px 0 0 var(--gold-lo); }
  .planning-table .shift { font-size: .85rem; }
}
