/* Shared visual system: workspace, dashboard, forms, tables, and small screens. */

:root {
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-background: #f4f6fb;
  --color-surface: #fff;
  --color-border: #e5e9f2;
  --color-success-background: #e8f6ef;
  --color-success-text: #1f7a4d;
  --color-error-background: #fff0ef;
  --color-error-text: #b63232;
  --sidebar-width: 256px;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(15 23 42 / 4%), 0 4px 14px rgb(15 23 42 / 4%);

  /* Theme colours (« Indigo », the default). Each theme below changes only these. */
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eef2ff;
  --accent-softer: #f5f7ff;
  --accent-border: #c7d2fe;
  --accent-ring: #a5b4fc;
  --accent-bright: #a5b4fc;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --sidebar-background: #1e1b4b;
  --sidebar-hover: rgb(255 255 255 / 8%);
  --sidebar-current: rgb(255 255 255 / 14%);

  /* Earlier names, kept so every rule follows the theme. */
  --color-accent: var(--accent);
  --color-accent-dark: var(--accent-strong);
}

/* Colour themes, chosen in the user menu (src/shared/themes.js). */
html[data-theme="ocean"] {
  --accent: #0284c7; --accent-strong: #0369a1; --accent-soft: #e0f2fe; --accent-softer: #f0f9ff; --accent-border: #bae6fd;
  --accent-ring: #7dd3fc; --accent-bright: #7dd3fc; --accent-gradient: linear-gradient(135deg, #0ea5e9, #2563eb); --sidebar-background: #0c1f3a;
}
html[data-theme="emerald"] {
  --accent: #059669; --accent-strong: #047857; --accent-soft: #d1fae5; --accent-softer: #ecfdf5; --accent-border: #a7f3d0;
  --accent-ring: #6ee7b7; --accent-bright: #6ee7b7; --accent-gradient: linear-gradient(135deg, #10b981, #0d9488); --sidebar-background: #052e2b;
}
html[data-theme="sunset"] {
  --accent: #ea580c; --accent-strong: #c2410c; --accent-soft: #ffedd5; --accent-softer: #fff7ed; --accent-border: #fed7aa;
  --accent-ring: #fdba74; --accent-bright: #fdba74; --accent-gradient: linear-gradient(135deg, #f97316, #e11d48); --sidebar-background: #2a1208;
}
html[data-theme="raspberry"] {
  --accent: #db2777; --accent-strong: #be185d; --accent-soft: #fce7f3; --accent-softer: #fdf2f8; --accent-border: #fbcfe8;
  --accent-ring: #f9a8d4; --accent-bright: #f9a8d4; --accent-gradient: linear-gradient(135deg, #ec4899, #a855f7); --sidebar-background: #2e0a24;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 100px; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--color-accent); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-dark); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 3px; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 100;
  padding: 8px 16px;
  color: var(--color-accent);
  background: white;
  border-radius: 8px;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

/* Sidebar and workspace. The same frame is used on every signed-in page. */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
  align-items: start;
  transition: grid-template-columns 180ms ease;
}
.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-width: 0;
  color: rgb(255 255 255 / 72%);
  background: var(--sidebar-background);
}
.sidebar-brand { display: flex; align-items: center; padding: 28px 22px 30px; min-height: 103px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; text-decoration: none; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 38px; flex-shrink: 0; background: var(--accent); border-radius: 10px; color: white; }
.brand-mark .icon { width: 24px; height: 24px; }
.brand-words { display: flex; flex-direction: column; white-space: nowrap; line-height: 1.4; }
.brand-words strong { font-size: 20px; font-weight: 750; letter-spacing: -0.6px; }
.brand-words > span { margin-top: 3px; color: rgb(255 255 255 / 55%); font-size: 10px; letter-spacing: 0.6px; }
.brand-dot { color: var(--accent-bright); }
.sidebar-navigation { flex: 1; min-height: 0; overflow-y: auto; padding: 0 14px 20px; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / 15%) transparent; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu + .menu { margin-top: 25px; }
.menu-heading { margin: 0 12px 8px; height: 17px; font-size: 9px; line-height: 17px; letter-spacing: 1.7px; font-weight: 650; color: rgb(255 255 255 / 50%); white-space: nowrap; }
.nav-link { position: relative; display: flex; align-items: center; gap: 13px; min-height: 42px; padding: 9px 13px; border-radius: 7px; color: rgb(255 255 255 / 72%); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background 140ms, color 140ms; }
.nav-link .icon { width: 19px; height: 19px; }
.nav-link:hover { color: #fff; background: var(--sidebar-hover); }
.nav-link.current { background: var(--sidebar-current); color: #fff; }
.nav-link.current .icon { color: var(--accent-bright); }
.nav-link.current::before { content: ""; position: absolute; left: 0; top: 13px; bottom: 13px; width: 3px; border-radius: 3px; background: var(--accent-bright); }
.sidebar-footer { display: flex; gap: 11px; align-items: center; margin: 0 18px; padding: 20px 3px 24px; border-top: 1px solid rgb(255 255 255 / 10%); }
.workspace-symbol { display: grid; place-items: center; width: 31px; height: 34px; color: rgb(255 255 255 / 60%); flex-shrink: 0; }
.sidebar-footer-label { display: flex; flex-direction: column; white-space: nowrap; }
.sidebar-footer-label strong { font-size: 11px; font-weight: 550; color: rgb(255 255 255 / 85%); }
.sidebar-footer-label > span { font-size: 10px; color: rgb(255 255 255 / 50%); }
.app-workspace { min-width: 0; }
.workspace-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 78px; padding: 14px 36px; border-bottom: 1px solid var(--color-border); background: #fff; }
.workspace-location { display: flex; align-items: center; gap: 13px; min-width: 0; }
.workspace-title { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: 0 0 auto; padding: 7px; border: 1px solid transparent; border-radius: 8px; color: var(--color-muted); background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--color-accent); background: var(--accent-soft); }
/* « Réduire le menu » sits inside the sidebar (computers); « Ouvrir le menu » in the top bar (phones). */
.sidebar-collapse { display: none; margin-left: auto; color: rgb(255 255 255 / 65%); border-color: rgb(255 255 255 / 10%); }
.sidebar-collapse:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar-open { display: none; border-color: var(--color-border); }
.sidebar-close { display: none; }
.user-bar { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.user-account { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--color-text); border-radius: 8px; }
.user-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--accent-strong); background: var(--accent-soft); font-size: 12px; font-weight: 700; }
.user-info { display: flex; flex-direction: column; line-height: 1.5; }
.user-info strong { font-size: 12px; font-weight: 650; }
.user-info > span { font-size: 10px; color: var(--color-muted); }
.user-logout { border-left: 1px solid var(--color-border); border-radius: 0; padding-left: 14px; width: 40px; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 50; border: 0; background: rgb(9 19 38 / 48%); cursor: pointer; }

/* Icon-only desktop rail. Accessible names and hover titles stay on each link. */
@media (min-width: 901px) {
  .navigation-ready .sidebar-collapse { display: inline-flex; }
  html[data-sidebar-collapsed="true"] { --sidebar-width: 80px; }
  [data-sidebar-collapsed="true"] .sidebar-brand { flex-direction: column; gap: 14px; padding-left: 22px; padding-right: 22px; }
  [data-sidebar-collapsed="true"] .sidebar-collapse { margin-left: 0; }
  [data-sidebar-collapsed="true"] .app-sidebar .brand-words,
  [data-sidebar-collapsed="true"] .nav-label,
  [data-sidebar-collapsed="true"] .sidebar-footer-label { display: none; }
  [data-sidebar-collapsed="true"] .sidebar-navigation { padding-left: 14px; padding-right: 14px; }
  [data-sidebar-collapsed="true"] .nav-link { justify-content: center; padding-left: 8px; padding-right: 8px; }
  [data-sidebar-collapsed="true"] .menu-heading { margin-left: 13px; margin-right: 13px; display: flex; align-items: center; }
  [data-sidebar-collapsed="true"] .menu-heading span { display: none; }
  [data-sidebar-collapsed="true"] .menu-heading::after { content: ""; height: 1px; width: 100%; background: rgb(255 255 255 / 14%); }
  [data-sidebar-collapsed="true"] .sidebar-footer { justify-content: center; padding-left: 0; padding-right: 0; }
  [data-sidebar-collapsed="true"] .sidebar-collapse .icon { transform: rotate(180deg); }
}

/* Page titles, panels, and feedback. */
.content { width: 100%; min-width: 0; margin: 0; padding: 34px 36px 56px; }
.content:focus { outline: none; }

/* « ← Retour »: in the top bar of every signed-in page except « Accueil », before the page's name. */
.back-navigation { display: flex; min-width: 0; }
.back-navigation + .workspace-title::before { content: "/"; padding-right: 12px; color: #c5cddb; font-weight: 400; }
.back-link { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 34px; padding: 5px 12px 5px 9px; border: 1px solid #d9e1ed; border-radius: 8px; color: #50617e; background: #fff; font-size: 13px; font-weight: 600; text-decoration: none; transition: background 140ms, border-color 140ms, color 140ms; }
.back-link > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.back-link .icon { width: 17px; height: 17px; }
.back-link:hover { color: var(--color-accent); background: var(--accent-softer); border-color: var(--accent-border); }
h1 { margin: 0 0 9px; font-size: 28px; line-height: 1.25; font-weight: 720; letter-spacing: -0.9px; color: #1d2b42; overflow-wrap: anywhere; }
h2 { margin: 30px 0 14px; font-size: 18px; line-height: 1.4; font-weight: 650; letter-spacing: -0.3px; }
h3 { font-size: 15px; }
/* A page title is followed directly by its content; only a warehouse's address sits just below it. */
.content > h1 { margin-bottom: 22px; }
.content > h1:has(+ .page-intro) { margin-bottom: 9px; }
.page-intro { margin: 0 0 25px; color: var(--color-muted); max-width: 850px; font-size: 14px; }
.breadcrumb { margin: 0 0 16px; color: var(--color-muted); font-size: 12px; }
.breadcrumb a { text-decoration: none; }
.panel { margin-top: 25px; padding: 24px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel h2 { margin-top: 0; }
.empty-state { padding: 24px; border: 1px dashed #cfd8e6; border-radius: 10px; background: #fff; color: var(--color-muted); }
.message { padding: 13px 16px; border: 1px solid transparent; border-radius: 9px; font-weight: 500; overflow-wrap: anywhere; }
.message-success { color: var(--color-success-text); background: var(--color-success-background); border-color: #cee7da; }
.message-error { color: var(--color-error-text); background: var(--color-error-background); border-color: #f5d6d1; }
.panel-notice { border-color: var(--accent-border); background: var(--accent-softer); }
.panel-danger { border-color: #f1c4c1; }

/* Dashboard: real figures and direct routes to the team's daily work. */
.dashboard-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 9px; color: #6a7b97; font-size: 9px; font-weight: 650; letter-spacing: 1.9px; }
.dashboard-heading h1 { font-size: 32px; letter-spacing: -1px; }
.dashboard-heading .page-intro { margin: 0; }
.dashboard-heading > .button { flex-shrink: 0; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.metric-card { display: flex; flex-direction: column; align-items: flex-start; padding: 21px 22px 18px; background: #fff; color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--radius); text-decoration: none; box-shadow: var(--shadow); transition: border-color 160ms, box-shadow 160ms; }
.metric-card:hover { color: var(--color-text); border-color: var(--accent-border); box-shadow: 0 4px 16px rgb(39 70 124 / 6%); }
.metric-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; color: var(--color-muted); font-size: 12px; font-weight: 500; }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; }
.metric-icon .icon { width: 18px; height: 18px; }
.tone-blue { background: var(--accent-soft); color: #4e73de; }
.tone-teal { background: #eaf7f3; color: #258567; }
.tone-amber { background: #fff6e7; color: #b17c20; }
.tone-violet { background: #f2eeff; color: #8664c8; }
.metric-value { margin: 5px 0 9px; font-size: 36px; font-weight: 680; line-height: 1.2; letter-spacing: -1.2px; font-variant-numeric: tabular-nums; color: #20304c; }
.metric-detail { display: flex; align-items: center; gap: 8px; color: #677991; font-size: 11px; }
.metric-detail .icon { width: 13px; height: 13px; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 22px; margin-top: 24px; }
.dashboard-columns > .panel { min-width: 0; margin-top: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 4px 0 0; color: var(--color-muted); font-size: 12px; }
.text-action { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.text-action .icon { width: 14px; height: 14px; }
.warehouse-list, .record-list { margin: 0; padding: 0; list-style: none; }
.warehouse-list > li + li { border-top: 1px solid #edf0f5; }
.warehouse-row { display: flex; align-items: center; gap: 13px; min-height: 87px; padding: 17px 0; color: var(--color-text); text-decoration: none; }
.warehouse-row:hover .warehouse-info strong { color: var(--color-accent); }
.warehouse-symbol { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #e3eaf6; border-radius: 10px; color: #6484bc; background: #f6f8fd; }
.warehouse-info { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 3px; }
.warehouse-info strong { font-size: 14px; font-weight: 650; }
.warehouse-info > span { color: #65758e; font-size: 11px; overflow-wrap: anywhere; }
.warehouse-count { padding: 3px 8px; border: 1px solid #e8edf5; border-radius: 5px; background: #fafbfd; color: #5d6f89; font-size: 11px; white-space: nowrap; }
.warehouse-row > .icon, .quick-action > .icon { width: 14px; height: 14px; color: #98a5ba; }
.quick-actions { display: flex; flex-direction: column; }
.quick-action { display: flex; align-items: center; gap: 12px; border-radius: 8px; padding: 11px 0; color: var(--color-text); text-decoration: none; }
.quick-action:hover { background: #f7f9fd; color: var(--color-accent); }
.quick-action-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; color: var(--accent-strong); background: var(--accent-softer); border: 1px solid var(--accent-border); border-radius: 9px; }
.quick-action-icon .icon { width: 17px; height: 17px; }
.quick-action > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.quick-action strong { font-size: 13px; font-weight: 600; }
.quick-action > span > span { color: #65758e; font-size: 11px; }
.count-badge { display: inline-block; margin-left: 5px; padding: 0 7px; border-radius: 5px; background: #eff3fa; color: #73819a; font-size: 11px; vertical-align: middle; }
.record-list > li + li { border-top: 1px solid var(--color-border); }
.record-list a { display: flex; align-items: center; gap: 16px; padding: 15px 0; color: var(--color-text); text-decoration: none; }
.record-list a:hover strong { color: var(--color-accent); }
.record-list a > span:first-child { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.record-list a > span:first-child > span { font-size: 11px; color: var(--color-muted); }
.record-meta { font-size: 11px; color: var(--color-muted); }
.record-list .icon { width: 14px; height: 14px; color: #8a99af; }
.quiet-empty { margin: 0; padding: 18px; text-align: center; color: #60718b; font-size: 12px; background: #f8fafd; border: 1px dashed var(--color-border); border-radius: 9px; }

/* Tables and document details. Horizontal scrolling stays inside a table. */
.table-wrapper { position: relative; overflow-x: auto; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 17px; text-align: left; border-bottom: 1px solid var(--color-border); }
th { background: #f8fafd; font-size: 11px; font-weight: 600; color: #697a93; white-space: nowrap; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
td a, th a { text-decoration: none; }
td a:hover { text-decoration: underline; }
th a { color: inherit; }
.number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; white-space: nowrap; color: #687c9b; }
.actions { text-align: right; }
.total { font-weight: 700; }
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 16px 24px; margin: 20px 0; padding: 22px 24px; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); }
.details dt { color: var(--color-muted); font-size: 11px; }
.details dd { margin: 4px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.read-only-detail { margin: 0 0 16px; font-weight: 600; }
.status { display: inline-block; padding: 3px 10px; border: 1px solid transparent; border-radius: 6px; font-size: 10px; font-weight: 600; vertical-align: middle; white-space: nowrap; }
.status-draft { color: #98701d; background: #fff7e6; border-color: #f6e9c9; }
.status-confirmed, .status-received { color: var(--color-success-text); background: var(--color-success-background); border-color: #d4ebde; }
.status-in_transit { color: #4a69b8; background: var(--accent-soft); border-color: var(--accent-border); }
.status-cancelled { color: var(--color-error-text); background: var(--color-error-background); }
.row-warning td { background: var(--color-error-background); }
.confirmation-details { padding: 13px 16px; color: var(--color-success-text); background: var(--color-success-background); border-radius: 9px; }
.steps-done { margin-top: 16px; }
.steps-done p { margin: 8px 0; }
.increase { color: var(--color-success-text); }
.decrease { color: var(--color-error-text); }

/* Warehouse catalogue cards. */
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 18px; margin: 0; padding: 0; list-style: none; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 24px; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-title { font-size: 18px; font-weight: 650; text-decoration: none; }
.card-detail { color: var(--color-muted); font-size: 12px; overflow-wrap: anywhere; }
.card-action { margin-top: 14px; font-size: 12px; font-weight: 600; text-decoration: none; }

/* Form fields and actions used throughout the application. */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 0 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 20px; }
.field-label { font-size: 13px; font-weight: 600; }
.field-hint { color: var(--color-muted); font-size: 11px; }
.required { color: var(--color-error-text); }
input, select, textarea { width: 100%; min-width: 0; max-width: 100%; padding: 10px 12px; border: 1px solid #dbe2ed; border-radius: 8px; color: inherit; background: #fff; transition: border-color 140ms, box-shadow 140ms; }
input:hover, select:hover, textarea:hover { border-color: #bcc9df; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #6a8cf0; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
select:disabled { color: var(--color-muted); background: #f3f5f9; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 40px; padding: 9px 17px; border: 1px solid var(--color-accent); border-radius: 8px; color: #fff; background: var(--color-accent); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background 140ms, border-color 140ms; }
.button .icon { width: 17px; height: 17px; }
.button:hover { color: #fff; background: var(--color-accent-dark); border-color: var(--color-accent-dark); }
.button-secondary { color: #50617e; background: #fff; border-color: #d9e1ed; }
.button-secondary:hover { color: var(--color-accent); background: var(--accent-softer); border-color: var(--accent-border); }
.button-danger { color: var(--color-error-text); background: #fff; border-color: #edc7c4; }
.button-danger:hover { color: #fff; background: var(--color-error-text); border-color: var(--color-error-text); }
.button-small { min-height: 30px; padding: 5px 10px; font-size: 11px; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.inline-form { display: inline; }
.link-button { padding: 0; border: none; color: var(--color-accent); background: none; text-decoration: underline; cursor: pointer; }
.link-danger { color: var(--color-error-text); }
.delete-form { margin-top: 18px; }
.add-line-form { margin-top: 24px; }
.add-line-form h3 { margin: 0 0 15px; }
.add-line-empty { margin-top: 16px; }
.quantity-input { max-width: 140px; text-align: right; }

/* « Produits à transférer » on « Nouveau transfert »: one list per departure warehouse. */
.warehouse-product-lists { margin: 6px 0 24px; }
.warehouse-product-lists h2 { margin-top: 8px; }
.warehouse-products { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.warehouse-products legend { margin-bottom: 8px; padding: 0; font-weight: 650; }
.linked-sections-ready .warehouse-products legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.linked-sections-ready [data-shown-when-field]:not([data-shown]) { display: none; }
.row-with-error td { background: var(--color-error-background); }
.row-action { width: 1%; white-space: nowrap; text-align: right; }

/* « Rechercher un produit »: suggestions open below the search box, over the page. */
.product-search-field { position: relative; max-width: 560px; }
.product-suggestions { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin: 4px 0 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--color-border); border-radius: 10px; box-shadow: 0 12px 28px rgb(23 43 77 / 14%); }
.product-suggestion { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.product-suggestion span { color: var(--color-muted); font-size: 12px; }
.product-suggestion:hover, .product-suggestion[aria-selected="true"] { background: var(--accent-soft); }
.product-suggestions-empty { margin: 6px 0 0; color: var(--color-muted); font-size: 13px; }
.chosen-products-title { margin: 4px 0 10px; }
.product-search-ready [data-product-row]:not([data-chosen="true"]) { display: none; }
.row-error { display: block; margin-top: 4px; color: var(--color-error-text); font-size: 12px; text-align: right; white-space: normal; }

/* « En attente de réception » on « Transferts », and the receiving choices on a transfer. */
.waiting-list { margin: 0; padding: 0; list-style: none; }
.waiting-transfer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.waiting-transfer:last-child { border-bottom: none; padding-bottom: 0; }
.waiting-details { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.waiting-details span { color: var(--color-muted); font-size: 13px; }
.waiting-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.receive-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.discrepancy > summary { list-style: none; }
.discrepancy > summary::-webkit-details-marker { display: none; }
.discrepancy[open] > summary { margin-bottom: 16px; }

/* Side panels: « add » forms slide in from the right (src/shared/side-panel.js). Open while the
   address ends with the panel's #id, or with .is-open when a refused form comes back. */
.side-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; display: flex; flex-direction: column; width: min(480px, 100vw); background: #fff; box-shadow: -16px 0 40px rgb(7 20 42 / 16%); transform: translateX(105%); visibility: hidden; transition: transform 220ms ease, visibility 220ms; }
.side-panel:target, .side-panel.is-open { transform: none; visibility: visible; }
.side-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--color-border); }
.side-panel-header h2 { margin: 0; }
.side-panel-body { flex: 1; overflow-y: auto; padding: 20px 24px calc(28px + env(safe-area-inset-bottom, 0px)); }
.side-panel-body .field-grid { grid-template-columns: minmax(0, 1fr); }
.side-panel-backdrop { position: fixed; inset: 0; z-index: 65; display: none; background: rgb(9 19 38 / 40%); }
.side-panel:target + .side-panel-backdrop, .side-panel.is-open + .side-panel-backdrop { display: block; }
[data-side-panel-open="true"] { overflow: hidden; }

/* Compact forms (« Nouvelle facture », « Nouveau transfert »): smaller fields and spacing. */
.compact-form .field { gap: 4px; margin-bottom: 12px; }
.compact-form .field-label { font-size: 12px; }
.compact-form .field-grid { gap: 0 14px; }
.compact-form input, .compact-form select, .compact-form textarea { padding: 7px 10px; font-size: 14px; border-radius: 7px; }
.compact-form textarea { min-height: 64px; height: 64px; }
.compact-form .button { min-height: 36px; padding: 7px 14px; }
.compact-form .form-section-title { margin: 6px 0 8px; font-size: 15px; }
.compact-form .invoice-total { font-size: 14px; }
.compact-form .invoice-total strong { font-size: 17px; }
#formulaire-rapide { width: min(520px, 100vw); }

/* Smart product lines: one card per product, one quantity box per warehouse holding it,
   boxes on the right edge (within reach of the thumb on a phone). */
.product-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.product-line { display: flex; flex-direction: column; gap: 4px; padding: 9px 12px; background: #fff; border: 1px solid var(--color-border); border-radius: 10px; }
.product-line-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 2px; font-size: 14px; }
.product-line-head .code { margin-left: 4px; font-size: 11px; }
.line-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; font-size: 13px; }
.line-entry-detail { color: var(--color-muted); }
.line-entry input { width: 104px; flex: 0 0 auto; padding: 5px 9px; text-align: right; }
.line-total-row { padding-top: 4px; border-top: 1px dashed var(--color-border); }
.product-line .row-error { margin: 2px 0 0; text-align: left; }

/* Corrections: « Retour vers » under a lowered box, and the « Modifications » list. */
.line-return { padding-left: 12px; color: var(--color-muted); }
.line-return select { width: 140px; flex: 0 0 auto; padding: 4px 8px; font-size: 13px; }
.correction-list { margin: 0; padding: 0; list-style: none; }
.correction-list li { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.correction-list li:last-child { border-bottom: none; padding-bottom: 0; }
.correction-list p { margin: 0 0 3px; }
.correction-meta { font-size: 13px; }
.correction-reason { color: var(--color-muted); font-size: 13px; }
.correction-summary { font-size: 14px; }

/* A warehouse's operations: « Entrées » (stock entry) and « Sorties » (invoice, transfer, loss). */
.warehouse-operations { display: flex; flex-wrap: wrap; gap: 14px 36px; margin: 4px 0 18px; }
.operation-group h2 { margin: 0 0 8px; color: var(--color-muted); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.operation-group .form-actions { margin: 0; }
.plain-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.entry-products { margin: 6px 0 24px; }
.entry-products h2 { margin-top: 8px; }
.older-documents { margin-top: 18px; }

/* Invoices: live totals on the form, and the invoice sheet (also what is printed). */
.price-input { max-width: 120px; }
.line-total { white-space: nowrap; font-weight: 600; }
.invoice-total { margin: 14px 0 0; text-align: right; font-size: 16px; }
.invoice-total strong { font-size: 20px; }
.invoice-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.invoice-business { margin: 0 0 4px; color: var(--color-muted); font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.invoice-total-row td { font-size: 16px; font-weight: 700; border-top: 2px solid var(--color-border); }

/* The floating « + » button , movable, on every signed-in page. */
.floating-actions { position: fixed; right: calc(24px + env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 40; }
[data-floating-actions-moved="true"] .floating-actions { left: var(--floating-actions-left); top: var(--floating-actions-top); right: auto; bottom: auto; }
.floating-actions-button { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: #fff; background: var(--color-accent); box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent); list-style: none; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; transition: background 140ms, box-shadow 140ms; }
.floating-actions-button::-webkit-details-marker { display: none; }
.floating-actions-button:hover { background: var(--color-accent-dark); }
.floating-actions-button .icon { width: 26px; height: 26px; transition: transform 160ms; }
.floating-actions[open] .floating-actions-button .icon { transform: rotate(45deg); }
.floating-actions.is-dragging .floating-actions-button { cursor: grabbing; box-shadow: 0 16px 34px color-mix(in srgb, var(--accent) 45%, transparent); }
.floating-actions-menu { position: absolute; right: 0; bottom: calc(100% + 10px); display: flex; flex-direction: column; min-width: 250px; padding: 6px; background: #fff; border: 1px solid var(--color-border); border-radius: 12px; box-shadow: 0 16px 36px rgb(23 43 77 / 18%); }
.floating-actions[data-menu-direction="down"] .floating-actions-menu { top: calc(100% + 10px); bottom: auto; }
.floating-actions[data-menu-side="right"] .floating-actions-menu { right: auto; left: 0; }
.floating-actions-menu a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px; color: var(--color-text); font-size: 14px; font-weight: 600; text-decoration: none; }
.floating-actions-menu a:hover, .floating-actions-menu a:focus-visible { color: var(--color-accent); background: var(--accent-soft); }
.floating-actions-menu .icon { color: var(--color-accent); }

/* On phones, each product becomes one compact row: name, code and stock on the left,
   the quantity box on the right, so no sideways scrolling is needed. */
@media (max-width: 640px) {
  .warehouse-product-lists thead { display: none; }
  .warehouse-product-lists tbody tr { display: grid; grid-template-columns: 1fr auto; column-gap: 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
  .warehouse-product-lists tbody tr:last-child { border-bottom: none; }
  .warehouse-product-lists td { padding: 0; border: none; }
  .warehouse-product-lists td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 11px; }
  .warehouse-product-lists td:nth-child(2) { grid-column: 1; grid-row: 1; font-weight: 600; }
  .warehouse-product-lists td:nth-child(3) { grid-column: 1; grid-row: 3; text-align: left; color: var(--color-muted); font-size: 13px; }
  .warehouse-product-lists td:nth-child(3)::before { content: "Disponible : "; }
  .warehouse-product-lists td:nth-child(4) { grid-column: 2; grid-row: 1 / span 2; }
  .warehouse-product-lists td:nth-child(5) { grid-column: 2; grid-row: 3; }
  .warehouse-product-lists .quantity-input { width: 96px; }
  .warehouse-product-lists .row-error { max-width: 140px; }


  .entry-products thead { display: none; }
  .entry-products tbody tr { display: grid; grid-template-columns: 1fr auto; column-gap: 14px; row-gap: 4px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
  .entry-products tbody tr:last-child { border-bottom: none; }
  .entry-products td { padding: 0; border: none; }
  .entry-products td:nth-child(2) { grid-column: 1; grid-row: 1; font-weight: 600; }
  .entry-products td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 11px; }
  .entry-products td:nth-child(3) { grid-column: 1; grid-row: 3; color: var(--color-muted); font-size: 13px; }
  .entry-products td:nth-child(4) { grid-column: 1; grid-row: 4; text-align: left; color: var(--color-muted); font-size: 13px; }
  .entry-products td:nth-child(4)::before { content: "En stock : "; }
  .entry-products td:nth-child(5) { grid-column: 2; grid-row: 1 / span 2; }
  .entry-products td:nth-child(6) { grid-column: 2; grid-row: 3 / span 2; }
  .entry-products .quantity-input { width: 96px; }
}

/* Inside the side panel, product tables use the compact one-row-per-product layout of phones. */
.side-panel .warehouse-product-lists thead { display: none; }
.side-panel .warehouse-product-lists tbody tr { display: grid; grid-template-columns: 1fr auto; column-gap: 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
.side-panel .warehouse-product-lists tbody tr:last-child { border-bottom: none; }
.side-panel .warehouse-product-lists td { padding: 0; border: none; }
.side-panel .warehouse-product-lists td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 11px; }
.side-panel .warehouse-product-lists td:nth-child(2) { grid-column: 1; grid-row: 1; font-weight: 600; }
.side-panel .warehouse-product-lists td:nth-child(3) { grid-column: 1; grid-row: 3; text-align: left; color: var(--color-muted); font-size: 13px; }
.side-panel .warehouse-product-lists td:nth-child(3)::before { content: "Disponible : "; }
.side-panel .warehouse-product-lists td:nth-child(4) { grid-column: 2; grid-row: 1 / span 2; }
.side-panel .warehouse-product-lists td:nth-child(5) { grid-column: 2; grid-row: 3; }
.side-panel .warehouse-product-lists .quantity-input { width: 96px; }
.side-panel .warehouse-product-lists .row-error { max-width: 140px; }
.side-panel .entry-products thead { display: none; }
.side-panel .entry-products tbody tr { display: grid; grid-template-columns: 1fr auto; column-gap: 14px; row-gap: 4px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
.side-panel .entry-products tbody tr:last-child { border-bottom: none; }
.side-panel .entry-products td { padding: 0; border: none; }
.side-panel .entry-products td:nth-child(2) { grid-column: 1; grid-row: 1; font-weight: 600; }
.side-panel .entry-products td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 11px; }
.side-panel .entry-products td:nth-child(3) { grid-column: 1; grid-row: 3; color: var(--color-muted); font-size: 13px; }
.side-panel .entry-products td:nth-child(4) { grid-column: 1; grid-row: 4; text-align: left; color: var(--color-muted); font-size: 13px; }
.side-panel .entry-products td:nth-child(4)::before { content: "En stock : "; }
.side-panel .entry-products td:nth-child(5) { grid-column: 2; grid-row: 1 / span 2; }
.side-panel .entry-products td:nth-child(6) { grid-column: 2; grid-row: 3 / span 2; }
.side-panel .entry-products .quantity-input { width: 96px; }

/* Room at the bottom of every page, so the floating « + » never hides the last line or a form's buttons. */
.workspace-page .content { padding-bottom: 112px; }
.search-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 14px; margin-bottom: 10px; }
.search-form .field { flex: 1 1 260px; }
.search-form .form-actions { margin-bottom: 20px; }
.filters { margin-bottom: 20px; }

/* Search and filters docked at the bottom of the screen once scrolled past (public/docked-bars.js). */
.is-docked { position: fixed; left: var(--sidebar-width); right: 0; bottom: 0; z-index: 30; max-width: none; max-height: 70vh; overflow-y: auto; margin: 0; padding: 10px 36px calc(10px + env(safe-area-inset-bottom, 0px)); background: #fff; border: 0; border-top: 1px solid var(--color-border); border-radius: 0; box-shadow: 0 -10px 28px rgb(23 43 77 / 10%); animation: dock-slide-in 200ms ease-out; }
@keyframes dock-slide-in { from { transform: translateY(100%); } to { transform: none; } }
.is-docked .field { margin-bottom: 0; }
.is-docked .field-hint { display: none; }
.is-docked:not(.is-expanded) .field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.is-docked:not(.is-expanded) [data-dock-secondary] { display: none; }
.is-docked .form-actions { margin: 0; }
.search-form.is-docked { align-items: center; gap: 10px 14px; }
.filters.is-docked { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.filters.is-docked .field-grid { flex: 1 1 260px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
.filters.is-docked .form-actions { flex-wrap: nowrap; }
.product-search-field.is-docked input { max-width: 560px; }
/* Suggestions open upwards, above the bar. */
.product-search-field.is-docked .product-suggestions { top: auto; bottom: calc(100% + 6px); left: 36px; right: auto; width: min(560px, calc(100% - 72px)); }
.product-search-field.is-docked { overflow: visible; }
[data-bar-docked="true"]:not([data-floating-actions-moved="true"]) .floating-actions { bottom: calc(var(--docked-bar-height) + 16px + env(safe-area-inset-bottom, 0px)); }
.page-links { align-items: center; margin-top: 20px; }
.draft-list { margin: 0; padding-left: 20px; }
.draft-list li { margin: 7px 0; }
.account-actions { display: flex; flex-direction: column; gap: 8px; }
.inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.inline-row select, .inline-row input { width: auto; padding: 6px 9px; }
.narrow { max-width: 520px; margin: 0 auto; }

/* Installation and login use the same visual language without a sidebar. */
.auth-page { background: radial-gradient(ellipse at 50% 0, var(--accent-soft), #f5f7fb 65%); min-height: 100dvh; }
.auth-header { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 20px 14px; }
.auth-header .brand { color: var(--color-text); }
.auth-header .brand-words > span { color: var(--color-muted); }
.auth-page .content { max-width: 560px; margin: 0 auto; padding-top: 32px; }
.auth-page h1 { text-align: center; }
.auth-page .page-intro { text-align: center; }
.auth-page .panel { padding: 28px; }
.auth-page form > .button { width: 100%; }

/* Adapt the dashboard before its cards become cramped. */
@media (max-width: 1200px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-columns { grid-template-columns: minmax(0, 1fr); }
  .warehouse-row { min-height: 82px; }
  .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
}

/* On a phone the menu is an overlay, leaving the whole screen for the selected page.
   Without JavaScript it remains a normal, fully visible navigation block. */
@media (max-width: 900px) {
  .app-shell { display: block; }
  .app-sidebar { position: relative; height: auto; }
  .sidebar-brand { min-height: 85px; padding: 22px; }
  .sidebar-navigation { padding-bottom: 24px; }
  .sidebar-footer { display: none; }
  .navigation-ready .app-sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 270px; max-width: calc(100vw - 32px); height: 100dvh; z-index: 60; transform: translateX(-100%); transition: transform 180ms ease; box-shadow: 10px 0 40px rgb(7 20 42 / 12%); }
  .navigation-ready[data-mobile-menu-open="true"] .app-sidebar { transform: translateX(0); }
  .navigation-ready[data-mobile-menu-open="true"] { overflow: hidden; }
  .navigation-ready .sidebar-close { display: inline-flex; margin-left: auto; color: rgb(255 255 255 / 85%); }
  .navigation-ready .sidebar-open { display: inline-flex; }
  .is-docked { left: 0; padding-left: 16px; padding-right: 16px; }
  .product-search-field.is-docked .product-suggestions { left: 16px; width: calc(100% - 32px); }
  .workspace-header { min-height: 68px; padding: 12px 24px; }
  .content { padding: 28px 24px 42px; }
  .dashboard-heading h1 { font-size: 28px; }
}

@media (max-width: 560px) {
  .workspace-header { padding: 10px 16px; gap: 8px; }
  .workspace-location { gap: 10px; }
  .workspace-title { max-width: 130px; }
  .back-navigation ~ .workspace-title { display: none; }
  .back-link { max-width: 52vw; }
  .user-bar { gap: 5px; }
  .user-info { display: none; }
  .user-logout { width: 34px; padding-left: 9px; }
  .content { padding: 25px 16px 36px; }
  h1 { font-size: 25px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; gap: 18px; margin-bottom: 22px; }
  .dashboard-heading h1 { font-size: 28px; }
  .metrics-grid { gap: 12px; }
  .metric-card { padding: 15px; }
  .metric-top { align-items: flex-start; gap: 8px; font-size: 10px; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-icon .icon { width: 15px; height: 15px; }
  .metric-value { font-size: 30px; margin: 10px 0 0; }
  .metric-detail { display: none; }
  .panel { padding: 20px 17px; }
  .section-heading { gap: 10px; }
  .section-heading h2 { font-size: 15px; }
  .warehouse-row { flex-wrap: wrap; gap: 10px; padding: 17px 0; }
  .warehouse-symbol { width: 36px; height: 38px; }
  .warehouse-count { display: none; }
  .quick-actions { display: flex; }
  .record-list a { flex-wrap: wrap; gap: 10px; }
  .record-meta { display: none; }
  .record-list a > span:first-child { min-width: 150px; }
  .details { padding: 18px; }
  .auth-header { padding-top: 30px; }
  .auth-page .panel { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .is-docked { animation: none; }
  .side-panel { transition: none; }
}

/* ---- Vibrant look (2026-10-26): colour, depth, and motion following the chosen theme. ---- */
html { -webkit-text-size-adjust: 100%; }
body {
  background:
    radial-gradient(1100px 380px at 88% -140px, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%),
    radial-gradient(900px 320px at -10% -120px, color-mix(in srgb, var(--accent-bright) 22%, transparent), transparent 70%),
    var(--color-background);
  background-repeat: no-repeat;
}
a, button, summary, input, select, textarea, label { touch-action: manipulation; }
.app-sidebar { background: linear-gradient(180deg, var(--sidebar-background) 0%, color-mix(in srgb, var(--sidebar-background) 80%, var(--accent)) 100%); }
.brand-mark { background: var(--accent-gradient); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent); }
.nav-link.current { background: var(--accent-gradient); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.nav-link.current .icon { color: #fff; }
.nav-link.current::before { display: none; }
.workspace-header { background: rgb(255 255 255 / 80%); backdrop-filter: saturate(170%) blur(14px); -webkit-backdrop-filter: saturate(170%) blur(14px); }
.button:not(.button-secondary):not(.button-danger) { background: var(--accent-gradient); border-color: transparent; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.button:not(.button-secondary):not(.button-danger):hover { background: var(--accent-gradient); filter: brightness(1.07); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.button { transition: transform 120ms, filter 140ms, box-shadow 140ms, background 140ms; }
.button:active, .floating-actions-button:active, .quick-action:active, .metric-card:active { transform: scale(0.97); }
.button-secondary:hover { color: var(--accent); background: var(--accent-softer); border-color: var(--accent-border); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.panel, .table-wrapper, .card, .metric-card { border-radius: var(--radius); }
.metric-card, .card { transition: transform 160ms, box-shadow 160ms; }
.metric-card:hover, .card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgb(15 23 42 / 8%); }
.floating-actions-button { background: var(--accent-gradient); }
.user-avatar { color: #fff; background: var(--accent-gradient); }
.eyebrow { color: var(--accent); }
.product-line { transition: border-color 140ms, box-shadow 140ms; }
.product-line:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-softer); }

/* The user menu (tap on the avatar). On phones it opens as a sheet from the bottom. */
.user-menu { position: relative; }
/* While the menu is open, the top bar (which holds it) comes above the floating « + ». */
.workspace-header:has(.user-menu[open]) { z-index: 80; }
.user-menu > summary { padding: 4px 10px 4px 4px; border-radius: 999px; list-style: none; cursor: pointer; transition: background 140ms; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--accent-softer); }
.user-menu > summary > .icon { width: 15px; height: 15px; color: var(--color-muted); transform: rotate(90deg); transition: transform 160ms; }
.user-menu[open] > summary > .icon { transform: rotate(-90deg); }
.user-menu-panel { position: absolute; top: calc(100% + 10px); right: 0; z-index: 75; width: 310px; padding: 8px; background: #fff; border: 1px solid var(--color-border); border-radius: 18px; box-shadow: 0 22px 50px rgb(15 23 42 / 18%); animation: menu-in 160ms ease-out; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
.user-menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; border-bottom: 1px solid var(--color-border); }
.user-menu-head > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.user-menu-head strong { font-size: 15px; }
.user-menu-head > span:last-child > span { color: var(--color-muted); font-size: 12px; }
.user-avatar-large { width: 46px; height: 46px; font-size: 15px; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.user-menu-links { display: flex; flex-direction: column; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.user-menu-links a, .user-menu-logout button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 10px 12px; border: 0; border-radius: 12px; color: var(--color-text); background: none; font: inherit; font-size: 14px; font-weight: 550; text-align: left; text-decoration: none; cursor: pointer; }
.user-menu-links a:hover, .user-menu-logout button:hover { background: var(--accent-softer); }
.user-menu-links .icon { color: var(--accent); }
.theme-picker { padding: 12px 12px 14px; border-bottom: 1px solid var(--color-border); }
.theme-picker-title { margin: 0 0 10px; color: var(--color-muted); font-size: 12px; font-weight: 650; }
.theme-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-swatch { width: 42px; height: 42px; padding: 3px; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; transition: transform 120ms, border-color 140ms; }
.theme-swatch:hover { transform: scale(1.08); }
.theme-swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; }
.theme-swatch[data-theme-choice="indigo"] span { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.theme-swatch[data-theme-choice="ocean"] span { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.theme-swatch[data-theme-choice="emerald"] span { background: linear-gradient(135deg, #10b981, #0d9488); }
.theme-swatch[data-theme-choice="sunset"] span { background: linear-gradient(135deg, #f97316, #e11d48); }
.theme-swatch[data-theme-choice="raspberry"] span { background: linear-gradient(135deg, #ec4899, #a855f7); }
.theme-swatch.is-current { border-color: var(--accent); }
.user-menu-logout { margin: 6px 0 0; }
.user-menu-logout button { color: var(--color-error-text); }
.user-menu-logout .icon { color: var(--color-error-text); }

/* Phones and the app added to the home screen: thumb-sized targets, no zoom when typing,
   and room for the notch and the rounded corners. */
.workspace-header { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.side-panel-header { padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
.navigation-ready .app-sidebar { padding-top: env(safe-area-inset-top, 0px); }
@media (max-width: 900px) {
  .workspace-header { padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-left: calc(16px + env(safe-area-inset-left, 0px)); padding-right: calc(16px + env(safe-area-inset-right, 0px)); }
  input, select, textarea, .compact-form input, .compact-form select, .compact-form textarea, .line-entry input, .line-return select { font-size: 16px; }
  .button, .compact-form .button { min-height: 44px; }
  .icon-button { width: 42px; height: 42px; }
  .link-button { min-height: 36px; }
}
@media (max-width: 640px) {
  /* A blurred top bar would hold the sheet inside it: on phones the bar is plain instead. */
  .workspace-header { background: rgb(255 255 255 / 97%); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .user-menu-panel { position: fixed; top: auto; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: 8px; width: auto; border-radius: 22px; animation: sheet-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .user-menu[open]::before { content: ""; position: fixed; inset: 0; z-index: 74; background: rgb(9 19 38 / 38%); animation: fade-in 200ms ease-out; }
  .user-menu > summary { padding: 2px; }
  .user-menu > summary > .icon { display: none; }
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .user-menu-panel, .user-menu[open]::before { animation: none; }
  .button:active, .metric-card:hover, .card:hover, .theme-swatch:hover { transform: none; }
}

@media print {
  .app-sidebar, .workspace-header, .sidebar-backdrop, .back-navigation, .floating-actions, .no-print, .message { display: none !important; }
  body { background: #fff; }
  body, .table-wrapper { background: #fff; box-shadow: none; }
  .invoice-sheet .status { border: 1px solid currentColor; }
  .app-shell { display: block; }
  .content, .workspace-page .content { padding: 0; }
}
