:root {
  --bg: #090a0e;
  --panel: #101117;
  --panel-2: #151720;
  --soft: #1b1e28;
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.13);
  --text: #f7f7fb;
  --muted: #8d91a2;
  --accent: #8b5cf6;
  --accent-2: #b18cff;
  --success: #57d49b;
  --danger: #ff6b7a;
  --shadow: 0 24px 70px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(139,92,246,.13), transparent 26%),
    radial-gradient(circle at 80% 22%, rgba(74,50,130,.10), transparent 23%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

button { cursor: pointer; }

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: .025;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

.topbar {
  position: relative;
  z-index: 2;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(9,10,14,.72);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent-2), #6d42d6);
  color: white;
  font-weight: 900;
  box-shadow: 0 0 30px rgba(139,92,246,.25);
}

.brand strong { display: block; letter-spacing: .12em; font-size: 14px; }
.brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .16em; }

.topbar-actions { display: flex; gap: 10px; }

button {
  border: 0;
  border-radius: 11px;
  padding: 11px 15px;
  font-weight: 700;
  transition: .2s ease;
}

.ghost-btn {
  color: #d8d9e1;
  background: rgba(255,255,255,.045);
  border: 1px solid var(--line);
}

.ghost-btn:hover { background: rgba(255,255,255,.075); }

.primary-btn {
  color: white;
  background: linear-gradient(135deg, #9b73ff, #7446df);
  box-shadow: 0 10px 30px rgba(119,73,224,.22);
}

.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 35px rgba(119,73,224,.35); }

.secondary-btn {
  background: #242735;
  color: white;
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 24px;
  max-width: 1520px;
  margin: 0 auto;
  padding: 44px 30px 70px;
}

.workspace { min-width: 0; }

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
  padding: 26px 4px 46px;
}

.eyebrow {
  display: block;
  margin-bottom: 9px;
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .19em;
}

.hero h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(42px, 5.3vw, 78px);
  line-height: .98;
  letter-spacing: -.05em;
}

.hero h1 span { color: var(--accent-2); }

.hero p {
  max-width: 690px;
  margin: 23px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.hero-status {
  min-width: 210px;
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.025);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(87,212,155,.08), 0 0 20px rgba(87,212,155,.4);
}

.hero-status strong, .hero-status span { display: block; }
.hero-status strong { font-size: 15px; }
.hero-status span { color: var(--muted); font-size: 11px; margin-top: 1px; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading h2, .summary-title h2, .dialog-heading h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -.025em;
}

.progress-track {
  width: 180px;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #1d202b;
}

.progress-value {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6f42da, #b58cff);
  transition: width .3s ease;
}

.component-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.component-card {
  position: relative;
  min-height: 142px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(21,23,32,.92), rgba(15,17,23,.92));
  transition: .2s ease;
}

.component-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139,92,246,.28);
  box-shadow: 0 18px 50px rgba(0,0,0,.2);
}

.component-empty {
  height: 100%;
  min-height: 142px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px;
}

.category-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #191b24;
  border: 1px solid var(--line);
  color: var(--accent-2);
  font-size: 25px;
}

.component-empty-copy { min-width: 0; flex: 1; }
.component-empty-copy strong { display: block; font-size: 14px; }
.component-empty-copy span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }

.add-btn {
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  padding: 0;
  border-radius: 12px;
  background: rgba(139,92,246,.1);
  color: var(--accent-2);
  border: 1px solid rgba(139,92,246,.18);
  font-size: 20px;
}

.add-btn:hover { background: rgba(139,92,246,.18); }

.product-card {
  display: grid;
  grid-template-columns: 82px minmax(0,1fr);
  min-height: 142px;
}

.product-image {
  position: relative;
  min-height: 142px;
  background: #fafafa;
  border-right: 1px solid var(--line);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

.product-image .fallback {
  height: 100%;
  display: grid;
  place-items: center;
  color: #808080;
  font-size: 11px;
}

.product-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.product-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.category-label {
  display: inline-flex;
  margin-bottom: 7px;
  color: var(--accent-2);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .14em;
}

.product-info h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 750;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.site-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
}

.product-bottom {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.product-price { font-size: 18px; font-weight: 850; }

.card-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 29px;
  height: 29px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
}

.icon-btn:hover { color: white; background: rgba(255,255,255,.08); }
.icon-btn.danger:hover { color: var(--danger); }

.summary-panel { min-width: 0; }

.summary-sticky {
  position: sticky;
  top: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 23px;
  background:
    linear-gradient(180deg, rgba(18,19,27,.98), rgba(12,13,18,.98));
  box-shadow: var(--shadow);
}

.summary-title { margin-bottom: 21px; }

.summary-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 335px;
  overflow: auto;
  padding-right: 3px;
}

.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 11px;
}

.summary-line span {
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-line strong { font-size: 11px; white-space: nowrap; }

.empty-summary {
  padding: 18px 0;
  color: #666b7d;
  font-size: 12px;
  line-height: 1.6;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.cost-row span { color: #a6a9b7; font-size: 12px; }
.cost-row strong { font-size: 20px; }

.profit-field { display: block; margin-bottom: 14px; }
.profit-field > span, .dialog-card label > span {
  display: block;
  margin-bottom: 7px;
  color: #aeb1bf;
  font-size: 10px;
  font-weight: 700;
}

.input-shell {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: #0c0d12;
  border-radius: 12px;
  overflow: hidden;
}

.input-shell input {
  width: 100%;
  border: 0 !important;
  background: transparent !important;
}

.input-shell > span {
  padding: 0 14px;
  color: var(--muted);
  font-weight: 700;
}

input {
  width: 100%;
  outline: 0;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #0c0d12;
  color: white;
  padding: 12px 13px;
  transition: .2s ease;
}

input:focus {
  border-color: rgba(139,92,246,.65);
  box-shadow: 0 0 0 3px rgba(139,92,246,.10);
}

.selling-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(139,92,246,.25);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(139,92,246,.16), rgba(139,92,246,.06));
}

.selling-card span, .selling-card strong { display: block; }
.selling-card span { color: #b8b3c5; font-size: 11px; margin-bottom: 3px; }
.selling-card strong { font-size: 27px; letter-spacing: -.03em; }

.margin-pill {
  padding: 7px 9px;
  border-radius: 999px;
  color: #d9caff;
  background: rgba(139,92,246,.13);
  border: 1px solid rgba(139,92,246,.18);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.mini-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.mini-metrics > div {
  padding: 13px;
  border-radius: 13px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
}

.mini-metrics span, .mini-metrics strong { display: block; }
.mini-metrics span { color: var(--muted); font-size: 9px; margin-bottom: 3px; }
.mini-metrics strong { font-size: 13px; }

.summary-note {
  margin: 16px 2px 0;
  color: #676b7b;
  font-size: 9px;
  line-height: 1.55;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: white;
  background: transparent;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(2,3,7,.74);
  backdrop-filter: blur(8px);
}

.dialog-card {
  position: relative;
  padding: 25px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #12141b;
}

.dialog-close {
  position: absolute;
  top: 17px;
  right: 17px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: #a8abba;
  font-size: 22px;
}

.dialog-heading { padding-right: 45px; margin-bottom: 22px; }
.dialog-heading p { max-width: 620px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.url-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.fetch-status {
  min-height: 20px;
  padding: 6px 0 4px;
  color: var(--muted);
  font-size: 10px;
}

.fetch-status.ok { color: var(--success); }
.fetch-status.error { color: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid .full { grid-column: 1 / -1; }

.dialog-price input { border: 0; }

.dialog-preview {
  display: grid;
  grid-template-columns: 58px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 17px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}

.preview-image {
  width: 58px;
  height: 58px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f3f3f3;
  color: #777;
  font-size: 8px;
  font-weight: 900;
}

.preview-image img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.dialog-preview strong, .dialog-preview span { display: block; }
.dialog-preview > div:nth-child(2) strong { font-size: 11px; }
.dialog-preview > div:nth-child(2) span { margin-top: 3px; color: var(--muted); font-size: 9px; }
#previewPrice { font-size: 14px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 21px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 11px 14px;
  border-radius: 10px;
  background: #1d2029;
  border: 1px solid var(--line-strong);
  box-shadow: 0 15px 40px rgba(0,0,0,.35);
  color: white;
  font-size: 11px;
  transition: .22s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .summary-sticky { position: static; }
}

@media (max-width: 720px) {
  .topbar { padding: 0 16px; }
  .topbar-actions .ghost-btn { display: none; }
  .layout { padding: 28px 14px 50px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-status { min-width: 0; width: 100%; }
  .component-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .progress-track { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .dialog-card { padding: 20px 15px; }
  .url-row { grid-template-columns: 1fr; }
}

/* ===== V11 · navigation, sauvegarde, bibliothèque et authentification ===== */
.is-hidden { display: none !important; }
[hidden] { display: none !important; }

.user-chip {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-btn { display: inline-flex; align-items: center; gap: 8px; }
.library-btn span {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(139,92,246,.14);
  color: #d7c8ff;
  font-size: 9px;
}

.toast.error { border-color: rgba(255,107,122,.35); }

/* ----- Modal de sauvegarde ----- */
.save-config-dialog { width: min(760px, calc(100vw - 28px)); }
.save-config-card > label { display: block; margin-bottom: 20px; }

.field-label,
.format-fieldset legend {
  display: block;
  margin-bottom: 8px;
  color: #aeb1bf;
  font-size: 10px;
  font-weight: 700;
}

.cover-upload-section {
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.018);
}

.cover-upload-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
}
.cover-upload-heading .field-label { margin-bottom: 5px; }
.cover-upload-heading p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}
.optional-badge {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #717586;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .12em;
}

.cover-upload-layout {
  display: grid;
  grid-template-columns: 210px minmax(0,1fr);
  gap: 14px;
  align-items: stretch;
}

.config-cover-preview {
  position: relative;
  min-height: 118px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #0b0c11;
}
.config-cover-preview img {
  width: 100%;
  height: 100%;
  min-height: 118px;
  display: block;
  object-fit: cover;
}
.cover-preview-placeholder {
  min-height: 118px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 5px;
  color: #5d6170;
  background:
    radial-gradient(circle at 50% 15%, rgba(139,92,246,.12), transparent 48%),
    linear-gradient(135deg, #11131a, #0b0c11);
}
.cover-preview-placeholder span { color: var(--accent-2); font-size: 25px; }
.cover-preview-placeholder strong { font-size: 9px; letter-spacing: .05em; }

.cover-upload-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
}
.cover-upload-actions .secondary-btn,
.cover-upload-actions .cover-remove-btn { min-width: 165px; }
.cover-upload-actions small {
  margin-top: 3px;
  color: #6f7384;
  font-size: 9px;
  line-height: 1.5;
}
.cover-remove-btn { color: #c4c6d0; }

.format-fieldset { padding: 0; margin: 0; border: 0; }
.format-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.format-option { position: relative; cursor: pointer; }
.format-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.format-option > span {
  min-height: 76px;
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  margin: 0 !important;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #0c0d12;
  transition: .18s ease;
}
.format-option strong { color: white; font-size: 12px; }
.format-option small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.format-option input:checked + span {
  border-color: rgba(139,92,246,.65);
  background: rgba(139,92,246,.10);
  box-shadow: 0 0 0 3px rgba(139,92,246,.08);
}

.save-config-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.save-config-summary > div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.025);
}
.save-config-summary span, .save-config-summary strong { display: block; }
.save-config-summary span { color: var(--muted); font-size: 8px; margin-bottom: 4px; }
.save-config-summary strong { font-size: 12px; }

/* ----- Bibliothèque ----- */
.library-view {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 50px 34px 90px;
}
.library-shell { min-width: 0; }

.library-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 10px 2px 36px;
}
.library-hero h1 {
  margin: 0;
  font-size: clamp(40px, 4.5vw, 68px);
  line-height: .98;
  letter-spacing: -.05em;
}
.library-hero p {
  max-width: 700px;
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.library-counter {
  min-width: 155px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(139,92,246,.08), rgba(255,255,255,.02));
  box-shadow: 0 18px 50px rgba(0,0,0,.13);
}
.library-counter strong { display: block; font-size: 27px; }
.library-counter span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }

.library-section {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.022), rgba(255,255,255,.012));
  box-shadow: inset 0 1px rgba(255,255,255,.015);
}
.library-section + .library-section { margin-top: 28px; }
.library-section-itx { border-color: rgba(87,212,155,.11); }

.library-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.library-section-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 24px;
  letter-spacing: -.03em;
}
.section-count {
  min-width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #d7c8ff;
  background: rgba(139,92,246,.14);
  border: 1px solid rgba(139,92,246,.14);
  font-size: 10px;
  font-weight: 800;
}
.library-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.library-toolbar > span { margin-right: 2px; color: var(--muted); font-size: 10px; }
.filter-chip {
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
}
.filter-chip:hover { color: white; border-color: var(--line-strong); }
.filter-chip.active {
  color: #e3d9ff;
  border-color: rgba(139,92,246,.38);
  background: rgba(139,92,246,.14);
}

.saved-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.saved-config-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(20,22,30,.98), rgba(13,14,20,.98));
  box-shadow: 0 18px 50px rgba(0,0,0,.15);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.saved-config-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139,92,246,.32);
  box-shadow: 0 24px 65px rgba(0,0,0,.27);
}
.saved-config-card.loaded { border-color: rgba(139,92,246,.56); }

.saved-cover {
  position: relative;
  height: 205px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(139,92,246,.13), transparent 45%),
    #0c0d12;
}
.saved-cover > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .35s ease;
}
.saved-config-card:hover .saved-cover > img { transform: scale(1.025); }
.saved-cover-shade {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4,5,8,.24), transparent 44%, rgba(7,8,12,.72));
}
.saved-cover-top {
  position: absolute;
  top: 13px;
  left: 13px;
  right: 13px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.saved-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.format-badge,
.loaded-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}
.format-badge {
  color: #eee7ff;
  background: rgba(65,46,108,.72);
  border: 1px solid rgba(185,153,255,.3);
}
.format-badge.micro-atx { color: #d9f4ff; background: rgba(24,92,122,.72); border-color: rgba(102,209,255,.26); }
.format-badge.mini-itx { color: #d9ffec; background: rgba(25,94,66,.72); border-color: rgba(105,232,170,.25); }
.loaded-badge { color: #d9ffec; background: rgba(24,88,63,.75); border: 1px solid rgba(105,232,170,.24); }
.component-count {
  flex: 0 0 auto;
  min-width: 40px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  background: rgba(7,8,12,.62);
  backdrop-filter: blur(12px);
  color: #e7e8ef;
  font-size: 9px;
  font-weight: 800;
}
.cover-source {
  position: absolute;
  left: 14px;
  bottom: 12px;
  color: rgba(255,255,255,.62);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.saved-cover-placeholder {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 5px;
  text-align: center;
  color: #606473;
}
.saved-cover-placeholder span { color: var(--accent-2); font-size: 26px; }
.saved-cover-placeholder strong { color: #9da0ad; font-size: 10px; }
.saved-cover-placeholder small { max-width: 190px; font-size: 8px; line-height: 1.4; }

.saved-card-body { padding: 18px; }
.saved-card-title-row h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -.025em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-date { display: block; margin-top: 5px; color: #686d7e; font-size: 9px; }

.saved-specs {
  display: grid;
  gap: 8px;
  margin: 17px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.018);
}
.saved-specs > div { display: grid; grid-template-columns: 45px minmax(0,1fr); gap: 9px; align-items: center; }
.saved-specs span { color: var(--accent-2); font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.saved-specs strong {
  min-width: 0;
  color: #c9cbd5;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-finance-row {
  display: grid;
  grid-template-columns: .85fr .85fr 1.3fr;
  gap: 7px;
}
.saved-finance-row > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.022);
}
.saved-finance-row span,
.saved-finance-row strong { display: block; }
.saved-finance-row span { margin-bottom: 4px; color: var(--muted); font-size: 7px; }
.saved-finance-row strong { font-size: 11px; white-space: nowrap; }
.saved-finance-row .sale {
  border-color: rgba(139,92,246,.22);
  background: linear-gradient(135deg, rgba(139,92,246,.12), rgba(139,92,246,.05));
}
.saved-finance-row .sale strong { color: #e3d8ff; font-size: 13px; }

.saved-card-actions { display: flex; gap: 8px; margin-top: 14px; }
.saved-load-btn { flex: 1; min-height: 40px; }
.saved-delete { width: 42px; height: 40px; font-size: 18px; }

.library-empty,
.library-loading {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  padding: 68px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  text-align: center;
  background: rgba(255,255,255,.012);
  color: var(--muted);
}
.library-empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 15px;
  color: var(--accent-2);
  background: rgba(139,92,246,.10);
  border: 1px solid rgba(139,92,246,.18);
  font-size: 23px;
}
.library-empty h3 { margin: 0; color: white; font-size: 17px; }
.library-empty p { margin: 8px 0 20px; color: var(--muted); font-size: 11px; }

/* ----- Connexion ----- */
.auth-body { overflow-x: hidden; }
.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 38px;
}
.auth-shell {
  width: min(1080px, 100%);
  min-height: 650px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: rgba(13,14,20,.92);
  box-shadow: 0 45px 130px rgba(0,0,0,.42);
}
.auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 42px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(155deg, rgba(139,92,246,.13), transparent 45%),
    radial-gradient(circle at 82% 75%, rgba(139,92,246,.16), transparent 32%),
    #101118;
}
.auth-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, transparent, black 24%, black 76%, transparent);
}
.auth-brand { position: relative; z-index: 2; }
.auth-visual-copy { position: relative; z-index: 2; margin: auto 0; }
.auth-visual-copy h1 {
  margin: 0;
  font-size: clamp(48px, 5vw, 72px);
  line-height: .92;
  letter-spacing: -.055em;
}
.auth-visual-copy h1 span { color: var(--accent-2); }
.auth-visual-copy p {
  max-width: 470px;
  margin: 24px 0 0;
  color: #999cab;
  font-size: 13px;
  line-height: 1.75;
}
.auth-feature-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.auth-feature-grid > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(6,7,10,.28);
  backdrop-filter: blur(10px);
}
.auth-feature-grid span,
.auth-feature-grid strong,
.auth-feature-grid small { display: block; }
.auth-feature-grid span { margin-bottom: 10px; color: var(--accent-2); font-size: 8px; font-weight: 900; }
.auth-feature-grid strong { font-size: 10px; }
.auth-feature-grid small { margin-top: 3px; color: #6f7383; font-size: 8px; line-height: 1.35; }
.auth-glow { position: absolute; border-radius: 50%; filter: blur(10px); pointer-events: none; }
.auth-glow-one { width: 240px; height: 240px; right: -120px; top: 80px; background: rgba(139,92,246,.10); }
.auth-glow-two { width: 180px; height: 180px; left: -90px; bottom: 50px; background: rgba(99,60,190,.09); }

.auth-panel {
  display: grid;
  place-items: center;
  padding: 45px;
  background: linear-gradient(180deg, rgba(16,17,24,.98), rgba(10,11,16,.98));
}
.auth-card { width: min(390px, 100%); }
.auth-lock {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 27px;
  border: 1px solid rgba(139,92,246,.26);
  border-radius: 14px;
  background: rgba(139,92,246,.09);
  box-shadow: 0 12px 35px rgba(85,48,170,.13);
}
.auth-lock span {
  position: relative;
  width: 15px;
  height: 12px;
  border: 2px solid #cdbbff;
  border-radius: 3px;
}
.auth-lock span::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 9px;
  height: 8px;
  transform: translateX(-50%);
  border: 2px solid #cdbbff;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}
.auth-card h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -.04em;
}
.auth-card > p {
  margin: 11px 0 27px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 8px; }
.auth-form label > span { color: #aeb1bf; font-size: 10px; font-weight: 800; }
.auth-form input {
  min-height: 49px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #0b0c11;
}
.auth-form input::placeholder { color: #4d5160; }
.auth-submit {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  padding: 0 17px;
}
.auth-submit > span:last-child { font-size: 17px; }
.auth-error { min-height: 18px; color: var(--danger); font-size: 11px; }
.auth-security-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 23px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}
.auth-security-note p { margin: 0; color: #676b7a; font-size: 9px; line-height: 1.55; }
.security-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(87,212,155,.45);
}

@media (max-width: 1250px) {
  .saved-config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .auth-page { padding: 22px; }
  .auth-shell { grid-template-columns: 1fr; min-height: 0; }
  .auth-visual { min-height: 350px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-feature-grid { margin-top: 42px; }
  .auth-panel { padding: 40px 28px; }
  .user-chip { display: none; }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 82px;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .topbar-actions { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .topbar-actions .ghost-btn { display: inline-flex; }
  .topbar-actions button { white-space: nowrap; }
  .library-view { padding: 30px 14px 55px; }
  .library-hero { align-items: flex-start; flex-direction: column; }
  .library-counter { width: 100%; }
  .library-section { padding: 18px 14px; border-radius: 18px; }
  .library-section-head { align-items: flex-start; flex-direction: column; gap: 14px; }
  .saved-config-grid { grid-template-columns: 1fr; }
  .saved-cover { height: 220px; }
  .format-options { grid-template-columns: 1fr; }
  .save-config-summary { grid-template-columns: repeat(2, 1fr); }
  .cover-upload-layout { grid-template-columns: 1fr; }
  .config-cover-preview, .config-cover-preview img, .cover-preview-placeholder { min-height: 180px; }
  .cover-upload-actions { align-items: stretch; }
  .cover-upload-actions .secondary-btn,
  .cover-upload-actions .cover-remove-btn { min-width: 0; width: 100%; }
  .auth-page { padding: 12px; }
  .auth-shell { border-radius: 20px; }
  .auth-visual { min-height: 305px; padding: 26px 22px; }
  .auth-visual-copy h1 { font-size: 48px; }
  .auth-feature-grid { display: none; }
  .auth-panel { padding: 32px 22px; }
  .saved-finance-row { grid-template-columns: 1fr 1fr; }
  .saved-finance-row .sale { grid-column: 1 / -1; }
}
