@import url('base.css?v=20260709-base-css');

:root {
  /* Alias retro-compat (noms encore utilises dans ce fichier) */
  --panel: var(--surface);
  --panel-strong: var(--btn-bg);
  --info: var(--accent-2);
  --radius: 12px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -5%, rgba(255, 203, 82, .10), transparent 40%),
    radial-gradient(circle at 108% 2%, rgba(255, 85, 119, .10), transparent 46%),
    var(--bg);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-gradient);
  z-index: 100;
  pointer-events: none;
}

button,
input,
.text-link {
  font: inherit;
}

button {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  color: var(--text);
  padding: 9px 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  color: var(--text);
  padding: 9px 13px;
  text-decoration: none;
}

.danger-button {
  border-color: color-mix(in srgb, var(--danger) 65%, var(--border));
  color: #ffd7dc;
}

button:hover,
button:focus-visible,
.button-link:hover,
.button-link:focus-visible,
.text-link:hover,
.text-link:focus-visible {
  border-color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

textarea {
  resize: vertical;
}

label {
  color: var(--muted);
  font-size: 14px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}

.brand-lockup {
  text-align: center;
  margin-bottom: 22px;
}

.brand-lockup img {
  width: min(260px, 90%);
  height: auto;
}

.brand-lockup p,
.muted {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form button {
  margin-top: 8px;
  background: var(--brand-gradient);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 700;
}

.auth-form button:hover,
.auth-form button:focus-visible {
  filter: brightness(1.06);
  border-color: transparent;
}

.field-hint {
  margin: -4px 0 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.4;
}

.alert {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.alert-error {
  border: 1px solid color-mix(in srgb, var(--danger) 60%, var(--border));
  color: #ffd5d5;
  background: #4a2028;
}

.alert-success {
  border: 1px solid color-mix(in srgb, var(--success) 55%, var(--border));
  color: #c8f8dc;
  background: #153724;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 6, 14, .82);
  backdrop-filter: blur(12px);
}

.topbar-title img {
  height: 56px;
  width: auto;
}

a.topbar-title,
.text-link {
  color: var(--text);
  text-decoration: none;
}

.text-link {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.topbar-actions form {
  margin: 0;
}

.workspace {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto;
}

.notice,
.migration-grid article {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}

.notice {
  padding: 22px;
}

.notice h1 {
  margin: 0 0 8px;
  color: var(--accent);
}

.eyebrow {
  margin: 0 0 4px;
  color: #65b7ff;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

.migration-grid article {
  padding: 18px;
}

.migration-grid h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.account-workspace {
  width: min(1120px, calc(100% - 32px));
}

.account-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.account-hero p:last-child {
  max-width: 760px;
}

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

.account-panel-wide {
  grid-column: 1 / -1;
}

.account-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.counter-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, .95fr) minmax(420px, 1.35fr);
  gap: 16px;
  margin-top: 14px;
}

.counter-card {
  display: grid;
  gap: 18px;
  align-content: start;
  min-height: 290px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, var(--border));
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 45%),
    linear-gradient(165deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.counter-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.counter-card-head .button-link {
  white-space: nowrap;
  background: color-mix(in srgb, var(--info) 16%, var(--panel-strong));
  border-color: color-mix(in srgb, var(--info) 42%, var(--border));
}

.counter-card-head h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 22px;
}

.counter-kicker {
  color: var(--info);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.counter-period-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 52%, var(--border));
  border-radius: 999px;
  color: #171a21;
  background: var(--accent);
  font-weight: 700;
}

.counter-value-panel {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0 2px;
}

.counter-value-panel strong {
  margin: 0;
  color: var(--accent);
  font-size: clamp(54px, 8vw, 86px);
  line-height: .9;
}

.counter-value-panel span {
  color: var(--muted);
  font-size: 15px;
}

.counter-card-copy {
  min-height: 22px;
  margin: -8px 0 0;
  color: var(--muted);
}

.counter-range-control {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.counter-range-control input[type="range"] {
  --counter-progress: 0%;
  appearance: none;
  width: 100%;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0 var(--counter-progress), #111722 var(--counter-progress) 100%);
  accent-color: var(--accent);
}

.counter-range-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 3px solid #111722;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.counter-range-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #111722;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.counter-period-labels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.counter-period-labels span {
  padding: 6px 2px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .04);
}

.counter-period-labels span.is-active {
  color: #11151d;
  background: var(--accent);
  font-weight: 700;
}

.podium-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.podium-list[hidden],
[data-ranking-modal-period][hidden] {
  display: none !important;
}

.podium-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.podium-list li.empty {
  display: block;
  min-height: 0;
  color: var(--muted);
}

.podium-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(255, 255, 255, .09);
  font-weight: 700;
}

.podium-place-1 {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
  background: linear-gradient(90deg, rgba(255, 203, 82, .18), rgba(27, 32, 41, .84));
}

.podium-place-1 .podium-rank {
  color: #171a21;
  background: var(--accent);
}

.podium-place-2 .podium-rank {
  color: #11151d;
  background: #c9d3df;
}

.podium-place-3 .podium-rank {
  color: #11151d;
  background: #e0a66a;
}

.podium-user {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-list strong {
  margin: 0;
  color: var(--success);
  font-size: 26px;
  line-height: 1;
}

.counter-modal-panel h3 {
  margin: 0;
  color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: #c7e6ff;
  font-size: 13px;
}

.account-panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.account-panel p {
  margin: 0;
}

.account-form {
  display: grid;
  gap: 10px;
}

.account-toggle-list,
.personal-precompletion-list,
.personal-field-editor {
  display: grid;
  gap: 10px;
}

.account-toggle-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
}

.account-toggle-row input[type="checkbox"] {
  width: auto;
}

.account-toggle-row small,
.personal-precompletion-card small {
  display: block;
  color: var(--muted);
}

.personal-precompletion-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
}

.personal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.personal-status {
  display: inline-flex;
  margin-left: 6px;
  border-radius: 999px;
  padding: 2px 7px;
  background: #303746;
  color: var(--muted);
  font-size: 12px;
}

.personal-status-approved {
  background: #153724;
  color: #c8f8dc;
}

.personal-status-submitted {
  background: #4a3917;
  color: #ffe3a3;
}

.personal-status-rejected {
  background: #442029;
  color: #ffd4d8;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 72px 16px 24px;
  background: rgba(12, 15, 20, .78);
}

.modal-overlay:target {
  display: flex;
}

.modal-overlay.is-modal-closed {
  display: none;
}

.modal-panel {
  width: min(980px, 100%);
  max-height: calc(100vh - 96px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, #1a1626, #120f1c);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
}

.precompletion-designer-modal {
  width: min(1280px, 100%);
}

.precompletion-designer-form {
  display: grid;
  gap: 14px;
}

.designer-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.designer-meta-simple {
  grid-template-columns: minmax(220px, 1.2fr) 180px minmax(220px, 1fr);
}

.designer-meta label,
.designer-field-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.designer-meta input,
.designer-meta select,
.designer-field-row input,
.designer-field-row select,
.designer-field-row textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  padding: 9px 10px;
}

.designer-advanced {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.designer-advanced summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.designer-advanced .designer-meta {
  margin-top: 12px;
}

.designer-action-options {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.designer-action-options p {
  margin: 4px 0 0;
}

.designer-action-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 130px;
  gap: 10px;
  align-items: end;
}

.designer-action-grid-copyable {
  grid-template-columns: minmax(220px, 1fr);
}

.designer-action-wide {
  grid-column: 1 / -1;
}

.designer-action-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.designer-action-grid input,
.designer-action-grid select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--input-bg);
  color: var(--text);
}

.designer-action-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.designer-action-toggle input {
  width: auto;
}

.freenotes-designer {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.designer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.designer-preview {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .015);
}

.designer-section {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

fieldset.designer-section {
  display: grid;
  gap: 8px;
  padding: 16px 14px 12px;
}

.designer-section legend {
  padding: 0 12px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.designer-section-yellow {
  --section-color: var(--accent);
}

.designer-section-red {
  --section-color: #ff4d5f;
}

.designer-section-blue {
  --section-color: #51a9ff;
}

.designer-section-green {
  --section-color: #2ee07b;
}

.designer-section-red,
.designer-section-blue,
.designer-section-green {
  border-bottom-color: var(--section-color);
}

.designer-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 10px 14px;
  color: var(--section-color);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  list-style: none;
}

.designer-accordion summary::-webkit-details-marker {
  display: none;
}

.designer-accordion summary::after {
  content: "▼";
  margin-left: auto;
  color: var(--section-color);
}

.designer-accordion[open] summary::after {
  content: "▲";
}

.designer-section-fields {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.designer-brand-row {
  display: grid;
  grid-template-columns: 90px repeat(3, minmax(0, 118px));
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 700;
}

.designer-brand-row button {
  min-height: 30px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
  background: var(--surface-2);
}

.designer-field-row {
  display: grid;
  grid-template-columns: 112px 112px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.designer-field-row.is-custom {
  grid-template-columns: 34px 112px minmax(120px, .65fr) minmax(100px, .45fr) minmax(0, 1fr) minmax(0, 1fr);
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--info) 55%, var(--border));
  border-radius: 8px;
  background: var(--surface-2);
}

.designer-field-key {
  display: none !important;
}

.designer-field-row.is-removed {
  opacity: .52;
}

.designer-required {
  align-items: center;
  grid-template-columns: auto 1fr;
  min-width: 0;
}

.designer-required input {
  width: auto;
}

.designer-field-row .designer-toggle-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid #803f48;
  border-radius: 999px;
  background: #421c24;
  color: #ffd2d8;
  cursor: pointer;
  user-select: none;
}

.designer-field-row .designer-toggle-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.designer-field-row .designer-toggle-pill .designer-pill-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.designer-field-row .designer-toggle-pill .pill-on,
.designer-field-row .designer-toggle-pill .pill-off {
  color: inherit;
}

.designer-field-row .designer-toggle-pill .pill-on {
  display: none;
}

.designer-field-row .designer-toggle-pill:has(input:checked) {
  border-color: #1f7a46;
  background: #143823;
  color: #c8f8dc;
}

.designer-field-row .designer-toggle-pill:has(input:checked) .pill-off {
  display: none;
}

.designer-field-row .designer-toggle-pill:has(input:checked) .pill-on {
  display: inline;
}

.designer-field-row .designer-visibility-pill {
  border-color: #1f7a46;
  background: #143823;
  color: #c8f8dc;
}

.designer-field-row .designer-visibility-pill:has(input:checked) {
  border-color: #803f48;
  background: #421c24;
  color: #ffd2d8;
}

.designer-field-row .designer-toggle-pill:has(input:disabled) {
  cursor: not-allowed;
  opacity: .8;
}

.designer-field-control {
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
}

.designer-field-control span,
.designer-required span {
  color: var(--accent);
  font-weight: 700;
}

.designer-field-control input,
.designer-field-control textarea {
  min-height: 28px;
  border-color: var(--input-border);
  background: var(--input-bg);
}

.designer-field-control textarea {
  min-height: 98px;
}

.designer-required:has(input:checked) + .designer-field-control input,
.designer-required:has(input:checked) + .designer-field-control textarea,
.designer-field-required:has(input:checked) ~ .designer-field-control input,
.designer-field-required:has(input:checked) ~ .designer-field-control textarea {
  border-color: #f39c12;
  box-shadow: 0 0 0 1px rgba(243, 156, 18, .35);
}

.designer-add-line {
  justify-self: end;
  color: var(--section-color, var(--accent));
}

.account-panel-disabled {
  grid-column: 1 / -1;
}

.account-panel-disabled button:disabled {
  cursor: not-allowed;
  opacity: .65;
}

@media (max-width: 720px) {
  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .migration-grid,
  .account-grid,
  .counter-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .account-panel-disabled {
    grid-column: auto;
  }

  .account-panel-wide,
  .personal-precompletion-card {
    grid-column: auto;
  }

  .personal-precompletion-card,
  .designer-action-grid,
  .designer-action-grid-copyable,
  .designer-meta,
  .designer-meta-simple,
  .designer-field-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .panel-header,
  .personal-actions,
  .counter-card-head {
    align-items: stretch;
    flex-direction: column;
    justify-content: stretch;
  }

  .counter-card-head .button-link {
    text-align: center;
    white-space: normal;
  }

  .modal-overlay {
    padding: 48px 10px 18px;
  }

  .designer-brand-row {
    grid-template-columns: 1fr;
  }
}
