:root {
  --bg1: #101923;
  --bg2: #1f2d3a;
  --bg3: #28323d;
  --accent: #69a1c8;
  --accent2: #c39a63;
  --text: #edf3f7;
  --muted: #a9b4bd;
  --online: #7aa989;
  --offline: #c56b6b;
  --waking: #c39a63;
  --control-text: #17222b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(135deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  background: radial-gradient(circle at top, color-mix(in srgb, var(--accent) 12%, transparent), transparent 42%),
              linear-gradient(135deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 24px;
  transition: background .35s ease;
}

body.theme-online {
  --bg1: #0c1b14;
  --bg2: #14402c;
  --bg3: #0e291d;
  --accent: #58b183;
  --accent2: #8fcbaa;
}

body.theme-offline {
  --bg1: #1e0e10;
  --bg2: #4d1c21;
  --bg3: #2a1215;
  --accent: #c87070;
  --accent2: #cf9a9a;
}

body.theme-waking {
  --bg1: #1d1609;
  --bg2: #4e3d16;
  --bg3: #2b2210;
  --accent: #c9a054;
  --accent2: #d6bd92;
}

body.theme-limited {
  --bg1: #1b1a22;
  --bg2: #313044;
  --bg3: #242331;
  --accent: #8b8fb8;
  --accent2: #c39a63;
}

/* Thème neutre de la page recherche & demandes (plus de fond vert « online ») */
body.theme-app {
  --bg1: #0e141b;
  --bg2: #161f29;
  --bg3: #1b2530;
  --accent: #69a1c8;
  --accent2: #c39a63;
}

body.requests-page {
  --bg1: #101923;
  --bg2: #1f2d3a;
  --bg3: #28323d;
  --accent: #5aa9d6;
  --accent2: #d79a4a;
  --online: #7aa989;
  --offline: #c56b6b;
  --waking: #d79a4a;
}

.card {
  width: min(760px, 100%);
  padding: 34px 28px;
  text-align: center;
  border-radius: 24px;
  background: rgba(255, 255, 255, .07);
  background: color-mix(in srgb, var(--accent) 12%, rgba(255, 255, 255, .06));
  border: 1px solid rgba(255, 255, 255, .18);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, rgba(255, 255, 255, .18));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .36);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .36), 0 0 46px color-mix(in srgb, var(--accent) 14%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: border-color .35s ease, box-shadow .35s ease, background .35s ease;
}

.logo {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, #4f93bd, #d79a4a);
  color: white;
  font-size: 30px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, .35);
  box-shadow: 0 12px 35px color-mix(in srgb, var(--accent) 45%, transparent);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 18px;
  background: rgba(0, 0, 0, .18);
  background: color-mix(in srgb, var(--accent) 20%, rgba(0, 0, 0, .18));
  color: var(--accent2);
  border: 1px solid rgba(255, 255, 255, .22);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.waking .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

h1 { font-size: 24px; margin-bottom: 10px; }
h2 { font-size: 21px; margin-bottom: 4px; }
h3 { font-size: 16px; margin: 18px 0 10px; text-align: left; }
p { color: var(--muted); line-height: 1.55; margin-bottom: 24px; }

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

.btn, .mini-btn, button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.btn {
  display: block;
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f7fa3, #6796b6);
  color: white;
  text-decoration: none;
  font-weight: 800;
  transition: transform .12s ease, opacity .2s ease, box-shadow .2s ease;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn.secondary {
  background: rgba(255, 255, 255, .12);
  color: var(--text);
  box-shadow: none;
}

.btn:active { transform: scale(.98); }
.btn:hover { opacity: .92; }
.btn:disabled { opacity: .55; cursor: wait; }

.requests-panel {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.16);
  text-align: left;
}

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

.panel-head p { margin: 0; font-size: 14px; }
.link-btn {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .15);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 10px;
  transition: color .15s ease, border-color .15s ease;
}
.link-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, .28);
}

.login-form, .search-form {
  display: grid;
  gap: 10px;
}

input, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(0,0,0,.22);
  outline: none;
}

input::placeholder { color: var(--muted); color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, select:focus { border-color: var(--accent2); }

.results, .requests-list { display: grid; gap: 10px; }
.result-block { margin-top: 16px; }
.result, .request-item {
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.14);
}
.result small, .request-meta, .empty {
  color: var(--muted);
  font-size: 13px;
}
.source-tag {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 2px;
  border-radius: 999px;
  background: rgba(120,160,255,.18);
  color: #b9c8ff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}
.source-tag.manual {
  background: rgba(255,255,255,.08);
  color: var(--muted);
}
.source-tag.auto {
  background: rgba(122,169,137,.2);
  color: #b8d8c0;
}
.empty { margin: 0; }

.mini-btn {
  margin-top: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  color: var(--control-text);
  background: var(--accent2);
  font-weight: 800;
}
.mini-btn.secondary {
  color: var(--text);
  background: rgba(255,255,255,.12);
}

.request-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.request-status {
  display: inline-flex;
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,.12);
  color: var(--accent2);
}
.source-link {
  display: inline-block;
  margin: 8px 0;
  color: var(--accent2);
  font-weight: 700;
}
.admin-note {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--accent2);
  background: rgba(255,255,255,.08);
}
.admin-controls {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 8px;
  margin-top: 10px;
}
.admin-controls button {
  border-radius: 10px;
  padding: 0 12px;
  background: var(--accent2);
  color: var(--control-text);
  font-weight: 900;
}

@media (max-width: 640px) {
  body { padding: 14px; }
  .card { padding: 26px 18px; }
  .panel-head, .request-title { align-items: stretch; flex-direction: column; }
  .admin-controls { grid-template-columns: 1fr; }
}

.wake-card { width: min(420px, 100%); }
.requests-page {
  place-items: start center;
  padding: 28px 18px;
}
.requests-shell {
  width: min(980px, 100%);
}
.requests-hero {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.logo.small {
  width: 52px;
  height: 52px;
  margin: 0;
  border-radius: 16px;
  font-size: 23px;
}
.back-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.10);
}
.eyebrow {
  margin: 0 0 2px;
  color: var(--accent2);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.requests-hero h1 { margin: 0 0 4px; }
.requests-hero p { margin-bottom: 0; }
.page-panel {
  margin-top: 0;
  padding: 22px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 24px;
  background: rgba(0,0,0,.18);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.page-panel .login-form {
  max-width: 460px;
  margin: 0 auto;
}
.search-large {
  grid-template-columns: 1fr auto;
  align-items: stretch;
  margin-bottom: 18px;
}
.search-large .btn { min-width: 150px; }
.results-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.result-block {
  min-height: 160px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(0,0,0,.16);
  border: 1px solid rgba(255,255,255,.12);
}
.request-section, .admin-area {
  margin-top: 22px;
}
.view-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.view-tab {
  min-height: 42px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 900;
  background: transparent;
}
.view-tab.active {
  color: var(--control-text);
  background: var(--accent2);
}

@media (max-width: 760px) {
  .requests-hero {
    grid-template-columns: 1fr auto;
  }
  .requests-hero .logo { display: none; }
  .requests-hero > div { grid-column: 1 / -1; }
  .search-large, .results-grid { grid-template-columns: 1fr; }
  .search-large .btn { width: 100%; }
}
.admin-controls .delete-request {
  background: #b96f73;
  color: white;
}
.api-note {
  margin: -6px 0 18px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.tickets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}
.tickets-head h3 { margin: 0; }
.status-filter {
  width: auto;
  min-width: 190px;
}
.ticket-list .request-item {
  border-left: 4px solid var(--accent2);
}
@media (max-width: 640px) {
  .tickets-head { flex-direction: column; align-items: stretch; }
  .status-filter { width: 100%; }
}

/* Ticketing/search readability pass */
.requests-shell { width: min(1120px, 100%); }
.page-panel { padding: 28px; }
.search-large {
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 14px;
}
.search-large input {
  font-size: 17px;
  padding: 16px 18px;
}
.results-grid {
  grid-template-columns: 1fr;
  gap: 18px;
}
.result-block {
  min-height: auto;
  padding: 20px;
}
.result-block h3 {
  font-size: 19px;
  margin-bottom: 14px;
}
.result {
  padding: 16px;
  margin-bottom: 10px;
}
.result strong {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.result small {
  display: block;
  margin-top: 6px;
  line-height: 1.45;
}
.mini-btn { margin-top: 12px; }
.login-form[hidden], #searchArea[hidden], #logoutBtn[hidden], #adminArea[hidden] { display: none !important; }

@media (max-width: 760px) {
  .page-panel { padding: 18px; }
  .search-large { grid-template-columns: 1fr; }
  .result-block { padding: 16px; }
  .result { padding: 14px; }
}

/* Mobile viewport hardening */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.requests-page {
  justify-items: center;
}
.requests-shell,
.page-panel,
.requests-hero,
.card {
  max-width: 100%;
}

@media (max-width: 640px) {
  body.requests-page {
    padding: 10px;
    display: block;
  }
  .requests-shell {
    width: 100%;
    min-width: 0;
  }
  .requests-hero {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
  }
  .back-link,
  .link-btn {
    align-self: flex-start;
  }
  .requests-hero > div {
    min-width: 0;
  }
  .requests-hero h1 {
    font-size: 22px;
    overflow-wrap: anywhere;
  }
  .back-link,
  .link-btn {
    justify-self: start;
    width: auto;
  }
  .page-panel {
    width: 100%;
    padding: 14px;
    border-radius: 18px;
  }
  .login-form,
  .search-form,
  .request-item,
  .result,
  .result-block {
    min-width: 0;
  }
  input, select, .btn, .mini-btn {
    max-width: 100%;
  }
}

/* Simpler ticket statuses + readable media titles */
.media-title {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  line-height: 1.4;
  font-size: 15px;
}
.media-meta {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 8px !important;
}
.media-meta span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.request-status.New { color: #a8cde4; }
.request-status.Validée { color: #b8d8c0; }
.request-status.Refusée { color: #dfa0a0; }
@media (max-width: 640px) {
  .media-title { font-size: 14px; }
  .result-block h3 { font-size: 17px; }
  .media-meta { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .media-meta span { text-align: center; }
}

/* Ticket item: details inline, no modal */
.request-item {
  cursor: default;
  transition: border-color .2s ease, background .2s ease;
}
.request-item:hover,
.request-item:focus-within {
  border-color: rgba(255,255,255,.25);
  border-color: color-mix(in srgb, var(--accent2) 55%, rgba(255,255,255,.14));
  background: rgba(255,255,255,.04);
  outline: none;
}
.request-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}
.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.request-actions .btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}
.request-actions.owner-actions { justify-content: flex-end; }
.request-actions .validate-request { background: #5c8f72; }
.request-actions .refuse-request { background: rgba(255,255,255,.10); color: var(--text); }
.source-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent2);
}
.ticket-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.ticket-chips span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.ticket-chips.large span {
  font-size: 13px;
  padding: 7px 11px;
}
.request-modal[hidden] { display: none !important; }
.request-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(24,34,44,.97), rgba(15,24,32,.97));
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 24px 90px rgba(0,0,0,.55);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: var(--text);
  font-size: 24px;
}
.modal-head { padding-right: 42px; }
.modal-head h2 {
  margin: 12px 0 8px;
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.modal-head p { margin-bottom: 14px; }
.source-link.big {
  margin: 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.10);
}
.detail-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.12);
}
.detail-box strong { display: block; margin-bottom: 8px; }
.detail-box p { margin: 0; }
.detail-box textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  background: rgba(0,0,0,.22);
  font: inherit;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin-top: 18px;
}
.btn.danger,
.modal-actions .refuse-request {
  background: #b96f73;
  color: white;
}
.modal-actions .validate-request {
  background: linear-gradient(135deg, #7aa989, #9bb99f);
  color: var(--control-text);
}

@media (max-width: 640px) {
  .request-modal { padding: 8px; align-items: end; }
  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 12px 12px;
    padding: 18px;
  }
  .modal-actions { grid-template-columns: 1fr; }
  .ticket-chips span { flex: 1 1 auto; text-align: center; }
}

/* Status filter overlap fix */
.request-section .api-note {
  clear: both;
  margin-top: 12px;
}
.tickets-head {
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.status-filter {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
}
.modal-actions.owner-actions {
  grid-template-columns: 1fr;
}

/* Status filter buttons */
.status-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.filter-btn {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  color: var(--text);
  font-weight: 800;
  border: 1px solid rgba(255,255,255,.14);
}
.filter-btn.active {
  background: var(--accent2);
  color: var(--control-text);
  border-color: transparent;
}
@media (max-width: 640px) {
  .status-filter-buttons { justify-content: stretch; }
  .filter-btn { flex: 1 1 0; padding: 8px 6px; font-size: 13px; }
}

/* Ticket border color by status */
.ticket-list .request-item.status-New {
  border-left-color: #5aa9d6;
}
.ticket-list .request-item.status-Validee {
  border-left-color: #7aa989;
}
.ticket-list .request-item.status-Refusee {
  border-left-color: #b96f73;
}
.request-status.Validee { color: #b8d8c0; }
.request-status.Refusee { color: #dfa0a0; }

.tracker-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.tracker-pill {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.09);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  padding: 9px 13px;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.tracker-pill:active { transform: scale(.98); }
.tracker-pill.online { border-color: rgba(90,169,214,.58); color: #d7eefb; background: rgba(90,169,214,.18); }
.tracker-pill.empty { border-color: rgba(215,154,74,.62); color: #ffe0ad; background: rgba(215,154,74,.16); }
.tracker-pill.down, .tracker-pill.disabled { border-color: rgba(185,111,115,.58); color: #f0b9b9; background: rgba(185,111,115,.14); }
.tracker-pill.active {
  color: var(--control-text);
  background: var(--accent2);
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(215,154,74,.22);
}

/* Search options popup */
.search-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 10px;
}
.search-options-btn {
  min-height: 42px;
}
.search-options-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.options-modal[hidden] { display: none; }
.options-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}
.options-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.options-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  background: linear-gradient(180deg, rgba(24,34,44,.98), rgba(15,24,32,.98));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 26px 80px rgba(0,0,0,.45);
  border-radius: 26px;
  padding: 22px;
}
.options-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.options-head h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.09);
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}
.options-intro {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.45;
}
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.options-grid fieldset {
  min-width: 0;
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.055);
}
.options-grid legend {
  padding: 0 6px;
  color: var(--accent2);
  font-weight: 950;
}
.options-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,.13);
  cursor: pointer;
  font-weight: 800;
}
.options-grid input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.26);
  background: rgba(0,0,0,.25);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.options-grid input[type="checkbox"]::before {
  content: "";
  width: 11px;
  height: 11px;
  transform: scale(0);
  transition: transform .12s ease;
  box-shadow: inset 1em 1em var(--accent);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.options-grid input[type="checkbox"]:checked {
  border-color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  background: rgba(255, 255, 255, .12);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.options-grid input[type="checkbox"]:checked::before { transform: scale(1); }
.options-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
body.modal-open { overflow: hidden; }

@media (max-width: 700px) {
  .la-cale-limit { font-size: 14.5px; }
  .options-modal {
    align-items: end;
    padding: 10px;
  }
  .options-card {
    width: 100%;
    max-height: 90vh;
    border-radius: 24px 24px 14px 14px;
    padding: 18px;
  }
  .options-grid { grid-template-columns: 1fr; }
  .options-actions { grid-template-columns: 1fr; display: grid; }
  .options-actions .btn,
  .options-actions .mini-btn { width: 100%; }
}

@media (max-width: 460px) {
  .search-tools { align-items: stretch; }
  .search-options-btn { width: 100%; }
  .search-options-summary { width: 100%; }
  .options-card { padding: 16px; }
  .options-grid fieldset { padding: 12px; }
}

.banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.banner-warn {
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.35);
  color: #ffb74d;
}

/* Ligne d'info sous le statut (éteint depuis / en ligne depuis) */
.status-detail {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  opacity: .95;
}

/* ---------- Statut « Nouvelle » (ex-New) ---------- */
.request-status.Nouvelle { color: #a8cde4; }
.ticket-list .request-item.status-Nouvelle { border-left-color: #5aa9d6; }

/* ---------- Commentaire admin ---------- */
.request-admin-comment {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(90, 169, 214, .12);
  border: 1px solid rgba(90, 169, 214, .28);
  color: var(--text);
  font-size: 13px;
}
.admin-comment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}
.admin-comment {
  flex: 1 1 220px;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.22);
  color: var(--text);
  font-size: 13px;
}
.admin-comment-row .mini-btn { margin-top: 0; }

/* ---------- Composeur de demande inline ---------- */
.inline-composer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,.22);
  background: rgba(255,255,255,.04);
}
.inline-composer .composer-note {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.22);
  color: var(--text);
  font-size: 14px;
}
.inline-composer .mini-btn { margin-top: 0; }

/* ---------- Toasts (remplacent alert()) ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
  width: min(92vw, 480px);
  pointer-events: none;
}
.toast {
  padding: 11px 14px;
  border-radius: 12px;
  background: #1b2733;
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  text-align: center;
}
.toast.show { opacity: 1; transform: none; }
.toast.error {
  background: #3a1720;
  border-color: rgba(223, 160, 160, .5);
  color: #f2c9c9;
}

/* ---------- Top demandeurs (board demandes) ---------- */
.top-requesters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 4px 0 16px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
}
.top-requesters[hidden] { display: none; }
.top-requester { display: grid; gap: 5px; }
.top-requester-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 14px;
}
.top-requester-head strong { font-weight: 700; }
.top-requester-count { color: var(--muted); font-size: 12px; }
.top-requester-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  overflow: hidden;
}
.top-requester-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent2);
  opacity: .85;
}
.rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(255,255,255,.09);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.rank-you {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: .2px;
}
.top-requester.is-me .rank-num { background: rgba(195,154,99,.20); color: #e6c58f; }
@media (max-width: 560px) {
  .top-requesters { grid-template-columns: 1fr; }
}

/* ---------- v2 : file de telechargement ---------- */
.request-status.En-file { color: #d9c68b; }
.request-status.Telechargement { color: #8fc4e8; }
.request-status.Disponible { color: #8fd6a0; }
.request-status.Echec { color: #e08b8b; }
.ticket-list .request-item.status-En-file { border-left-color: #b8a25f; }
.ticket-list .request-item.status-Telechargement { border-left-color: #5aa9d6; }
.ticket-list .request-item.status-Disponible { border-left-color: #6fb583; }
.ticket-list .request-item.status-Echec { border-left-color: #b96f73; }

.request-dest {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text);
  opacity: .82;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}
.request-error {
  margin: 6px 0 0;
  color: #e08b8b;
  font-size: 13px;
}
.dl-wrap { margin-top: 8px; }
.dl-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}
.dl-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #5aa9d6;
  transition: width .4s ease;
}
.dl-bar.done > span { background: #6fb583; }
.dl-bar.error > span { background: #b96f73; }
.dl-meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: .72;
  word-break: break-all;
}


.inline-composer .composer-kinds { display: flex; gap: 12px; flex: 1 1 100%; }
.chip-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  font-size: 14px;
  cursor: pointer;
}
.inline-composer .composer-series {
  display: flex;
  gap: 8px;
  flex: 1 1 100%;
}
.inline-composer .composer-series input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.22);
  color: var(--text);
  font-size: 14px;
}
.inline-composer .composer-series input.composer-season { flex: 0 0 90px; }

.inline-composer .composer-kindline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 100%;
  font-size: 13px;
  font-weight: 700;
}
.inline-composer .kind-change {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  opacity: .6;
  text-decoration: underline;
  cursor: pointer;
}

/* Sans ca, display:flex / display:grid neutralise l'attribut hidden du formulaire. */
.inline-composer .composer-kinds[hidden],
.inline-composer .composer-series[hidden] { display: none !important; }

/* ---------- Filtres de recherche en ligne ---------- */
.search-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 10px;
}
.opt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.opt-label {
  min-width: 62px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .5;
}
.opt-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.opt-chip:hover { border-color: rgba(255,255,255,.32); }
.opt-chip.active {
  background: var(--accent2);
  border-color: transparent;
  color: var(--control-text);
}
.opt-reset {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 12px;
  opacity: .5;
  text-decoration: underline;
  cursor: pointer;
}
.opt-reset:hover { opacity: .9; }
@media (max-width: 640px) {
  .opt-label { width: 100%; min-width: 0; }
  .opt-chip { padding: 5px 9px; font-size: 12px; }
  .opt-reset { margin-left: 0; }
}

/* Lien d'administration + rappel de quota sous le titre de la page demandes */
.hero-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hero-buttons[hidden] { display: none !important; }
.hero-buttons .link-btn { text-decoration: none; }
#adminLink[hidden], #logoutBtn[hidden] { display: none !important; }
.quota-line {
  margin-top: 6px !important;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.quota-line strong { color: var(--text); }
.quota-line[hidden] { display: none !important; }
