/* Back-office K.Y.M Collection : mêmes couleurs que la vitrine, mobile d'abord. */

:root {
  --ivory: #f5f1eb;
  --greige: #bdb6ae;
  --taupe: #7a6f60;
  --ink: #5b4d3d;
  --dark: #443829;
  --white: #fffdfa;
  --line: #ddd6cc;
  --danger: #8c2f2f;
  --danger-bg: #f6e4e1;
  --success: #3f5b3a;
  --success-bg: #e6eee2;
  --radius: 14px;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

h1 {
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--dark);
}

a {
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: 2px;
}

/* En-tête */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--dark);
  color: var(--ivory);
}

.brand {
  display: flex;
  flex-direction: column;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.1;
  text-decoration: none;
  text-transform: uppercase;
}

.brand span {
  display: none;
}

.brand small {
  color: var(--greige);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.nav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--ivory);
  font-size: 0.95rem;
  text-decoration: none;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  background: rgb(255 255 255 / 14%);
}

.account {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.account form {
  margin: 0;
}

.account-name {
  display: none;
  color: var(--greige);
}

.link-button {
  min-height: 44px;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: var(--ivory);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Page */

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

.page-centered {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
  min-height: 100vh;
  min-height: 100dvh;
}

.card {
  padding: 1.5rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--taupe);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.login {
  text-align: center;
}

.login .form {
  text-align: left;
}

.hint {
  color: var(--taupe);
}

/* Messages */

.flash {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
}

.flash-notice {
  background: var(--success-bg);
  color: var(--success);
}

.flash-alert {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Formulaires */

.form {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-size: 0.9rem;
  font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--greige);
  border-radius: 10px;
  background: #fff;
  color: var(--dark);
  font: inherit;
}

.button {
  min-height: 48px;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ivory);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.button:hover {
  background: var(--dark);
}

/* Accueil */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.tile {
  padding: 1.1rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.tile-value {
  margin: 0;
  color: var(--dark);
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1;
}

.tile-label {
  margin: 0.35rem 0 0;
  color: var(--taupe);
  font-size: 0.9rem;
}

@media (min-width: 640px) {
  .topbar {
    padding: 0.75rem 1.5rem;
  }

  .brand span {
    display: inline;
  }

  .brand {
    display: block;
  }

  .brand small {
    display: block;
  }

  .account-name {
    display: inline;
  }

  .page {
    padding: 2rem 1.5rem 4rem;
  }
}

/* Titres de page et de section */

h2 {
  margin: 0 0 0.5rem;
  color: var(--dark);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-head h1 {
  margin: 0;
}

/* Boutons */

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button-secondary {
  border: 1px solid var(--greige);
  background: transparent;
  color: var(--ink);
}

.button-secondary:hover {
  background: #ece6dd;
}

.button-danger {
  background: var(--danger);
}

.button-danger:hover {
  background: #6f2424;
}

.button-small {
  min-height: 44px;
  padding: 0 1rem;
  font-size: 0.9rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  cursor: pointer;
}

.icon-button:hover:not(:disabled) {
  background: #ece6dd;
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Listes */

.rows {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.row-moves {
  display: flex;
  gap: 0.35rem;
}

.row-main {
  flex: 1;
  min-width: 9rem;
}

.row-title {
  color: var(--dark);
  font-weight: 600;
  text-decoration: none;
}

a.row-title:hover {
  text-decoration: underline;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.15rem 0 0;
  color: var(--taupe);
  font-size: 0.9rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-muted {
  background: #ece6dd;
  color: var(--taupe);
}

/* Formulaires (suite) */

.card + .rows,
.hint + .rows,
.form + .rows {
  margin-top: 1rem;
}

.form-inline {
  grid-template-columns: 1fr;
  align-items: end;
  margin-bottom: 1rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.field-hint {
  margin: 0;
  color: var(--taupe);
  font-size: 0.88rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  cursor: pointer;
}

.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--ink);
}

input[type="file"] {
  max-width: 100%;
  font: inherit;
}

.thumb {
  display: block;
  width: 120px;
  height: 150px;
  border-radius: 10px;
  object-fit: cover;
}

.flash ul {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
}

.flash p {
  margin: 0;
}

.danger-zone {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid #e3c4bf;
  border-radius: var(--radius);
}

.danger-zone p {
  margin: 0 0 1rem;
  color: var(--taupe);
}

@media (min-width: 640px) {
  .form-inline {
    grid-template-columns: 1fr auto;
  }
}

/* Téléphone : marque et déconnexion sur une ligne, menu défilant en dessous. */

@media (max-width: 639px) {
  .account {
    margin-left: auto;
  }

  .nav {
    flex: 0 0 100%;
    flex-wrap: nowrap;
    order: 3;
    margin: 0 -1rem;
    padding: 0 1rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-link {
    flex: none;
  }

  .row-main {
    min-width: 5rem;
  }
}

/* Articles */

.tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 -1rem 1rem;
  padding: 0 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  flex: none;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.9rem;
  text-decoration: none;
}

.tab[aria-current="page"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--ivory);
}

.filters {
  grid-template-columns: 1fr;
  align-items: end;
  margin-bottom: 1rem;
}

.row-thumb {
  flex: none;
  width: 64px;
  height: 80px;
  overflow: hidden;
  border-radius: 8px;
  background: #ece6dd;
}

.row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: #f5e9cf;
  color: #7a5a17;
}

.badge-dark {
  background: var(--taupe);
  color: var(--ivory);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  color: var(--taupe);
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0 1rem;
}

.choices {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--ink);
  background: #f3eee6;
}

.choice input {
  width: 20px;
  height: 20px;
  margin-top: 0.15rem;
  accent-color: var(--ink);
}

.choice small {
  display: block;
  color: var(--taupe);
}

input[type="datetime-local"] {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--greige);
  border-radius: 10px;
  background: #fff;
  color: var(--dark);
  font: inherit;
}

summary {
  min-height: 28px;
  font-weight: 600;
  cursor: pointer;
}

.details-body {
  margin-top: 1rem;
}

.summary {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.thumb-small {
  width: 64px;
  height: 80px;
}

.stock-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stock-list li {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
}

.stock-list .stock-empty {
  color: var(--taupe);
  text-decoration: line-through;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

form.form > .card + .card,
form.form > .card + details {
  margin-top: 0;
}

@media (min-width: 640px) {
  .filters {
    grid-template-columns: 2fr 1fr auto;
  }

  .summary {
    grid-template-columns: 1fr 1fr;
  }

  .tabs {
    margin: 0 0 1rem;
    padding: 0;
  }
}

/* Photos d'un article */

.photos {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.photo {
  position: relative;
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.photo-img {
  flex: none;
  width: 96px;
  height: 128px;
  border-radius: 8px;
  background: #ece6dd;
  object-fit: cover;
}

.photo-main {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
}

.photo-body {
  display: grid;
  flex: 1;
  gap: 0.6rem;
  min-width: 0;
}

.photo-alt {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.5rem;
  margin: 0;
}

.photo-alt label {
  grid-column: 1 / -1;
  color: var(--taupe);
  font-size: 0.82rem;
}

.photo-alt input[type="text"] {
  min-height: 44px;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.photo-upload {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.card + .card,
.card + form.form,
form.form + .danger-zone {
  margin-top: 1rem;
}

.summary {
  margin-bottom: 0;
}

@media (min-width: 640px) {
  .photos {
    grid-template-columns: 1fr 1fr;
  }
}

/* Photo : image et boutons côte à côte, description sur toute la largeur en dessous. */

.photo {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
}

.photo-body {
  display: contents;
}

.photo-actions {
  grid-row: 1;
  grid-column: 2;
}

.photo-alt {
  grid-column: 1 / -1;
}

/* Tailles et stock */

.card .page-head h2 {
  margin: 0;
}

.stock-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stock-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.stock-row label {
  flex: 1;
  font-weight: 600;
}

.stock-row input[type="number"] {
  width: 4.6rem;
  min-height: 44px;
  padding: 0.4rem 0.5rem;
  text-align: center;
}

.remove-sizes {
  margin-top: 1rem;
}

.remove-sizes summary {
  color: var(--taupe);
  font-weight: 400;
}

.remove-sizes .field-hint {
  margin: 0.5rem 0;
}

.add-size {
  grid-template-columns: 1fr 6rem;
  align-items: end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.add-size .button {
  grid-column: 1 / -1;
}

/* Tableaux */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  white-space: nowrap;
}

.table th,
.table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table th {
  color: var(--taupe);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .plus {
  color: var(--success);
  font-weight: 600;
}

.table .minus {
  color: var(--danger);
  font-weight: 600;
}

@media (min-width: 640px) {
  .add-size {
    grid-template-columns: 1fr 7rem auto;
  }

  .add-size .button {
    grid-column: auto;
  }
}

/* Commandes */

.filters-search {
  grid-template-columns: 1fr;
}

.action-card {
  border-color: var(--ink);
}

.action-card .inline-form + .inline-form,
.action-card .form + .inline-form {
  margin-left: 0;
}

.action-card .form-inline {
  margin-bottom: 0.75rem;
}

.order-items {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.order-item-price {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.totals {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.totals dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.totals-total {
  padding-top: 0.4rem;
  color: var(--dark);
  font-size: 1.1rem;
  font-weight: 600;
}

.two-cards {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.two-cards .card + .card {
  margin-top: 0;
}

.lines {
  margin: 0;
  line-height: 1.7;
}

.note {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: #f3eee6;
}

.timeline {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.timeline time {
  color: var(--taupe);
}

a.tile-link {
  display: block;
  text-decoration: none;
}

a.tile-link:hover {
  border-color: var(--ink);
}

@media (min-width: 640px) {
  .filters-search {
    grid-template-columns: 1fr auto;
  }

  .two-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.two-cards + .card {
  margin-top: 1rem;
}

/* Retours et remboursement */

.return {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.return .note {
  margin: 0;
}

.return-items {
  margin: 0;
  padding-left: 1.2rem;
}

.return-receive {
  gap: 0.5rem;
}

.new-return summary {
  color: var(--ink);
}

.stock-row label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.new-return .stock-rows {
  grid-template-columns: 1fr;
}

/* Clientes */

.tile-value-small {
  font-size: 1.35rem;
  line-height: 1.3;
}

.tiles + .two-cards {
  margin-top: 0;
}

/* Codes promo */

.code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.04em;
}

input.code {
  text-transform: uppercase;
}

/* Un champ large (date et heure) ne doit jamais élargir la page : les cases d'une grille
   peuvent rétrécir, et deux dates côte à côte s'empilent sur téléphone. */

.form > *,
.field-pair > * {
  min-width: 0;
}

@media (max-width: 639px) {
  .field-pair:has(input[type="datetime-local"]) {
    grid-template-columns: 1fr;
  }
}

.choice input {
  flex: none;
}

/* Shooting */

.checks-scroll {
  max-height: 20rem;
  padding: 0.25rem 0.75rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.card .rows .row {
  background: transparent;
}

/* Tableau de bord */

h3 {
  margin: 1.5rem 0 0.6rem;
  color: var(--taupe);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tile-alert {
  border-color: var(--ink);
}

.tiles-flat {
  margin-bottom: 0;
}

.tiles-flat .tile {
  padding: 0.85rem;
  background: #f8f4ee;
}

.tiles-flat .tile-value {
  font-size: 1.7rem;
}

.card .tabs {
  margin: 0 0 1rem;
  padding: 0;
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 140px;
  padding-top: 4px;
  border-bottom: 1px solid var(--greige);
}

.chart-bar {
  display: flex;
  flex: 1;
  align-items: flex-end;
  min-width: 0;
  height: 100%;
}

.chart-bar span {
  display: block;
  width: 100%;
  min-height: 1px;
  border-radius: 3px 3px 0 0;
  background: var(--ink);
}

.chart-range {
  display: flex;
  justify-content: space-between;
  margin: 0.3rem 0 1rem;
  color: var(--taupe);
  font-size: 0.82rem;
}

.ranking {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  padding-left: 1.4rem;
}

.ranking li {
  padding-left: 0.2rem;
}

.ranking-name {
  font-weight: 600;
}

.ranking-value {
  display: block;
  color: var(--taupe);
  font-size: 0.9rem;
}

/* Connexion */

.login > p {
  margin: 0 0 0.75rem;
}
