:root {
  --bg: #0b0b0c;
  --panel: #141416;
  --panel-2: #1b1b1f;
  --border: #2a2a30;
  --text: #f4f4f5;
  --muted: #9a9aa2;
  --accent: #f4f4f5;
  --danger: #e5484d;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  padding: 24px clamp(12px, 4vw, 48px) 80px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sub {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

.topbar {
  margin-bottom: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

/* --- Upload ------------------------------------------------------------- */

.drop {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.drop.over {
  border-color: var(--accent);
  background: var(--panel-2);
}

.drop p {
  margin: 0;
}

.drop .or {
  color: var(--muted);
  margin: 0 6px;
}

.hint {
  margin-top: 8px !important;
  color: var(--muted);
  font-size: 13px;
}

.upload-fields,
.filter-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

select,
button,
input[type="file"] {
  font: inherit;
}

select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 130px;
  cursor: pointer;
}

button {
  background: var(--accent);
  color: #0b0b0c;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--border);
}

.queue {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.queue li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  background: var(--panel-2);
  border-radius: 8px;
}

.queue .status {
  color: var(--muted);
  flex: none;
}

.queue li.ok .status {
  color: #3fb950;
}

.queue li.error .status {
  color: var(--danger);
}

/* --- Filtres ------------------------------------------------------------ */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.filters .filter-fields {
  margin-top: 0;
}

.count {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Grille ------------------------------------------------------------- */

.day-group {
  margin-bottom: 28px;
}

.day-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 17px;
}

.day-heading .day-count {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card .thumb {
  aspect-ratio: 9 / 16;
  background: #000;
}

.card video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card .name {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.card .meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.actions .download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--panel-2);
}

.actions .download:hover {
  border-color: var(--accent);
}

.actions .download svg {
  width: 18px;
  height: 18px;
}

select.mini {
  min-width: 0;
  width: 100%;
  flex: 1 1 0;
  font-size: 12px;
  padding: 6px 6px;
}

button.mini {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 13px;
}

.devices {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
}

.devices label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.devices input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.empty {
  color: var(--muted);
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 13px;
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}
