:root {
  --success: #2f6f4f;
  --warning: #8d2c1c;
}

* {
  box-sizing: border-box;
}

html {
  background-color: #dde4f3;
  color: var(--ink);
  font-family: Verdana, Arial, Helvetica, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

body.theme-votoiles {
  --paper: #e8edf8;
  --ink: #132347;
  --ink-soft: #4a5b85;
  --line: rgba(44, 68, 132, 0.18);
  --accent: #1a4698;
  --accent-deep: #102d67;
  --accent-soft: #dbe5fb;
  --panel: rgba(244, 247, 255, 0.74);
  --panel-strong: rgba(250, 252, 255, 0.82);
  --shadow: 0 24px 60px rgba(52, 69, 120, 0.18);
  --app-background-overlay: linear-gradient(180deg, rgba(253, 249, 246, 0.4), rgba(231, 238, 251, 0.55));
  --header-overlay: linear-gradient(180deg, rgba(248, 251, 255, 0.84), rgba(231, 238, 252, 0.62));
  --nav-chip-background: rgba(221, 227, 242, 0.72);
  --nav-chip-border: rgba(64, 91, 157, 0.16);
  --nav-hover: #fff2a8;
  --hero-top: rgba(250, 252, 255, 0.78);
  --hero-bottom: rgba(235, 241, 252, 0.62);
  --panel-bottom: rgba(233, 239, 252, 0.72);
  --flash-notice-background: rgba(242, 246, 255, 0.84);
  --code-background: rgba(26, 70, 152, 0.08);
}

body.theme-vosud {
  --paper: #f7e6e1;
  --ink: #4f1e28;
  --ink-soft: #87505c;
  --line: rgba(122, 39, 59, 0.2);
  --accent: #a12f39;
  --accent-deep: #6e1f2b;
  --accent-soft: #f7db9a;
  --panel: rgba(255, 246, 242, 0.76);
  --panel-strong: rgba(255, 250, 246, 0.84);
  --shadow: 0 24px 60px rgba(129, 55, 72, 0.18);
  --app-background-overlay: linear-gradient(180deg, rgba(255, 247, 243, 0.42), rgba(248, 227, 222, 0.6));
  --header-overlay: linear-gradient(180deg, rgba(255, 250, 242, 0.84), rgba(250, 236, 205, 0.66));
  --nav-chip-background: rgba(248, 226, 221, 0.72);
  --nav-chip-border: rgba(146, 60, 82, 0.18);
  --nav-hover: #fff2a8;
  --hero-top: rgba(255, 250, 246, 0.8);
  --hero-bottom: rgba(248, 231, 223, 0.66);
  --panel-bottom: rgba(246, 226, 219, 0.74);
  --flash-notice-background: rgba(255, 248, 244, 0.86);
  --code-background: rgba(161, 47, 57, 0.08);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--app-background-overlay), var(--app-background-image);
  background-position: center top, center top;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
}

a {
  color: inherit;
}

.app-shell {
  padding: 1.5rem;
}

.site-header,
.hero,
.dashboard-grid,
.pagination,
.actions,
.hero-actions,
.checkbox-row {
  display: flex;
  gap: 1rem;
}

.site-header,
.hero,
.panel,
.flash {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero,
.panel,
.flash {
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.app-shell {
  min-height: 100vh;
  padding: 1.5rem;
}

.site-header {
  align-items: stretch;
  background: none;
  backdrop-filter: none;
  border-color: var(--line);
  border-radius: 1.4rem;
  margin: 0 auto 1.5rem;
  overflow: hidden;
  padding: 1rem 1.25rem;
  position: relative;
}

.brand-block strong {
  display: block;
  font-size: 1.2rem;
}

.brand-block,
.site-nav {
  position: relative;
  z-index: 1;
}

.site-nav {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
  padding: 0 2rem;
}

.nav-group-title {
  color: var(--accent-deep);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.4;
  margin: 0;
  text-transform: none;
}

.nav-group-account {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
}

.nav-group-account:hover {
  text-decoration: underline;
}

.nav-group-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-nav a {
  background: var(--nav-chip-background);
  border: 1px solid var(--nav-chip-border);
  border-radius: 999px;
  color: var(--accent);
  padding: 0.45rem 0.8rem;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--nav-hover);
}

.page-shell {
  margin: 0 auto;
  max-width: 1100px;
}

.flash {
  border-radius: 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
}

.flash-notice {
  background: var(--flash-notice-background);
  border-color: rgba(47, 111, 79, 0.25);
}

.flash-alert {
  background: rgba(255, 246, 171, 0.92);
  border-color: rgba(167, 81, 24, 0.32);
  color: #8d2c1c;
}

.hero,
.panel {
  border-radius: 1.5rem;
  padding: 1.5rem;
}

.hero {
  align-items: end;
  background: linear-gradient(180deg, var(--hero-top), var(--hero-bottom));
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.panel {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel-bottom));
}

.stats-stage-panel {
  min-height: 16rem;
}

.stage-loader {
  display: grid;
  gap: 1rem;
}

.stage-loader-header {
  align-items: center;
  display: flex;
  gap: 0.9rem;
}

.stage-loader-header h2 {
  margin: 0;
}

.stage-loader-spinner {
  animation: stage-loader-spin 0.9s linear infinite;
  border: 0.28rem solid rgba(26, 70, 152, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  height: 1.8rem;
  width: 1.8rem;
}

.stage-loader-skeleton {
  display: grid;
  gap: 0.75rem;
}

.stage-loader-skeleton span {
  animation: stage-loader-shimmer 1.2s ease-in-out infinite alternate;
  background: linear-gradient(90deg, rgba(219, 229, 251, 0.45), rgba(255, 255, 255, 0.85), rgba(219, 229, 251, 0.45));
  background-size: 200% 100%;
  border-radius: 999px;
  display: block;
  height: 0.9rem;
}

.stage-loader-skeleton span:nth-child(2) {
  width: 82%;
}

.stage-loader-skeleton span:nth-child(3) {
  width: 64%;
}

.stats-stage-panel-error .stage-loader-spinner {
  animation: none;
  border-color: rgba(167, 81, 24, 0.25);
  border-top-color: #8d2c1c;
}

@keyframes stage-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes stage-loader-shimmer {
  from {
    background-position: 0 0;
    opacity: 0.72;
  }

  to {
    background-position: 100% 0;
    opacity: 1;
  }
}

.panel-results-wide {
  width: 95vw;
  margin-left: calc(50% - 47.5vw);
  margin-right: calc(50% - 47.5vw);
}

.panel-results-wide .inventory-table {
  table-layout: fixed;
}

.panel-results-wide .inventory-table th,
.panel-results-wide .inventory-table td {
  hyphens: auto;
  overflow-wrap: break-word;
}

.inventory-table-search th:nth-child(1),
.inventory-table-search td:nth-child(1) {
  width: 7%;
}

.inventory-table-search th:nth-child(2),
.inventory-table-search td:nth-child(2) {
  width: 8%;
}

.inventory-table-search th:nth-child(3),
.inventory-table-search td:nth-child(3),
.inventory-table-search th:nth-child(4),
.inventory-table-search td:nth-child(4) {
  width: 7%;
}

.inventory-table-search th:nth-child(5),
.inventory-table-search td:nth-child(5),
.inventory-table-search th:nth-child(6),
.inventory-table-search td:nth-child(6),
.inventory-table-search th:nth-child(8),
.inventory-table-search td:nth-child(8),
.inventory-table-search th:nth-child(10),
.inventory-table-search td:nth-child(10) {
  width: 10%;
}

.inventory-table-search th:nth-child(7),
.inventory-table-search td:nth-child(7) {
  width: 6%;
}

.inventory-table-search th:nth-child(9),
.inventory-table-search td:nth-child(9),
.inventory-table-search th:nth-child(11),
.inventory-table-search td:nth-child(11) {
  width: 8%;
}

.inventory-table-search th:nth-child(12),
.inventory-table-search td:nth-child(12) {
  width: 9%;
}

.inventory-table-manageable th:nth-child(1),
.inventory-table-manageable td:nth-child(1) {
  width: 10%;
}

.inventory-table-manageable th:nth-child(2),
.inventory-table-manageable td:nth-child(2) {
  width: 5%;
}

.inventory-table-manageable th:nth-child(3),
.inventory-table-manageable td:nth-child(3),
.inventory-table-manageable th:nth-child(4),
.inventory-table-manageable td:nth-child(4) {
  width: 7%;
}

.inventory-table-manageable th:nth-child(5),
.inventory-table-manageable td:nth-child(5),
.inventory-table-manageable th:nth-child(6),
.inventory-table-manageable td:nth-child(6) {
  width: 9%;
}

.inventory-table-manageable th:nth-child(7),
.inventory-table-manageable td:nth-child(7) {
  width: 6%;
}

.inventory-table-manageable th:nth-child(8),
.inventory-table-manageable td:nth-child(8),
.inventory-table-manageable th:nth-child(10),
.inventory-table-manageable td:nth-child(10) {
  width: 8%;
}

.inventory-table-manageable th:nth-child(9),
.inventory-table-manageable td:nth-child(9),
.inventory-table-manageable th:nth-child(11),
.inventory-table-manageable td:nth-child(11),
.inventory-table-manageable th:nth-child(12),
.inventory-table-manageable td:nth-child(12) {
  width: 7%;
}

.inventory-table-manageable th:nth-child(13),
.inventory-table-manageable td:nth-child(13) {
  width: 10%;
}

.hero-actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-grid {
  align-items: start;
  flex-wrap: wrap;
}

.dashboard-grid > * {
  flex: 1 1 320px;
}

.auth-panel {
  margin: 3rem auto 0;
  max-width: 560px;
}

.eyebrow {
  color: var(--accent);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
}

h1,
h2 {
  color: var(--accent-deep);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(2.1rem, 3vw, 3.2rem);
}

h2 {
  font-size: 1.5rem;
}

.lede {
  color: var(--ink-soft);
  font-size: 1.04rem;
  line-height: 1.6;
  margin: 0;
  max-width: 42rem;
}

.stacked-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.filters-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.compact-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label,
legend {
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 600;
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(85, 103, 148, 0.25);
  border-radius: 0.9rem;
  color: var(--ink);
  font: inherit;
  padding: 0.75rem 0.85rem;
  width: 100%;
}

.qty-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.results-cotes .cote,
.results-cotes .dimension {
  display: inline;
}

.results-cotes .dimension::after {
  content: "";
  display: block;
}

.results-coloris .lisere,
.results-coloris .rives {
  display: block;
}

.results-image-cell {
  min-width: 120px;
  width: 120px;
}

.results-image-slot {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100px;
  width: 100px;
}

.results-image-slot .stock-thumb {
  display: block;
  height: auto;
  max-height: 100px;
  max-width: 100px;
  object-fit: contain;
}

.stock-thumb-trigger {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: inline-block;
  padding: 0;
}

.stock-thumb-trigger:hover,
.stock-thumb-trigger:focus-visible {
  background: none;
}

.image-modal-dialog {
  background: transparent;
  border: 0;
  max-height: calc(100vh - 2rem);
  max-width: calc(100vw - 2rem);
  margin: auto;
  overflow: visible;
  padding: 0;
}

.image-modal-dialog::backdrop {
  background: rgba(12, 20, 38, 0.72);
}

.image-modal-panel {
  position: relative;
  width: max-content;
}

.image-modal-close {
  position: absolute;
  right: 0.9rem;
  top: 0.9rem;
  z-index: 1;
}

.image-modal-open {
  bottom: 0.9rem;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  z-index: 1;
}

.image-modal-preview {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel-bottom));
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: var(--shadow);
  display: block;
  height: auto;
  max-height: calc(100vh - 2rem);
  max-width: calc(100vw - 2rem);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 1rem;
  margin: 0;
  padding: 1rem;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--accent-deep);
  font-size: 0.85rem;
  text-transform: uppercase;
}

code,
pre {
  background: var(--code-background);
  border-radius: 0.7rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

code {
  padding: 0.15rem 0.4rem;
}

pre {
  overflow: auto;
  padding: 1rem;
}

.button,
button,
input[type="submit"] {
  align-items: center;
  background: linear-gradient(180deg, #fff8c4, #ffde70);
  border: 1px solid rgba(210, 162, 57, 0.4);
  border-radius: 999px;
  color: #5b3604;
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  gap: 0.4rem;
  justify-content: center;
  padding: 0.7rem 1.1rem;
  text-decoration: none;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--nav-chip-border);
  color: var(--accent);
}

.button-busy {
  cursor: wait;
  opacity: 0.88;
  pointer-events: none;
}

.button-inline-spinner {
  animation: stage-loader-spin 0.9s linear infinite;
  border: 0.16rem solid rgba(26, 70, 152, 0.16);
  border-radius: 50%;
  border-top-color: currentColor;
  display: none;
  flex: 0 0 auto;
  height: 0.95rem;
  width: 0.95rem;
}

.button-busy .button-inline-spinner {
  display: inline-block;
}

.button-danger {
  background: linear-gradient(180deg, #ffd9d6, #f4a7a0);
  border-color: rgba(150, 42, 34, 0.35);
  color: #7a1d18;
}

.inline-actions,
.actions {
  flex-wrap: wrap;
}

.notice-list,
.metric-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
}

.metric-list {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.metric-list li,
.notice-list li {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid var(--line);
  border-radius: 1rem;
  list-style: none;
  padding: 0.9rem 1rem;
}

.stats-list {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 0;
}

.stats-list > div {
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid var(--line);
  border-radius: 1rem;
  min-width: 0;
  padding: 0.95rem 1rem;
}

.stats-list dt,
.stats-list dd {
  margin: 0;
}

.stats-list dt {
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.4;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.stats-list dd {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.stats-list dd strong,
.stats-list dd b {
  color: var(--accent-deep);
}

.badge {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-deep);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
}

.empty-state,
.inline-note {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.image-thumb {
  border-radius: 1rem;
  display: block;
  max-width: 120px;
}

.pagination {
  justify-content: space-between;
  margin-top: 1rem;
}

.checkbox-row {
  align-items: center;
}

.checkbox-row input {
  width: auto;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 1rem;
  }

  .site-header,
  .hero {
    align-items: start;
    flex-direction: column;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .site-nav {
    grid-template-columns: 1fr;
  }

  .panel-results-wide {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }

  .results-image-cell {
    min-width: 0;
    width: auto;
  }

  .results-image-slot {
    justify-content: flex-start;
    width: auto;
  }

  .stats-list {
    grid-template-columns: 1fr;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  td {
    padding-left: 0;
    padding-right: 0;
  }
}
