:root {
  --bg: #070b10;
  --bg-soft: #0a1017;
  --panel: #0e151d;
  --panel-2: #131d27;
  --line: #22334a;
  --line-soft: #1a2838;
  --text: #eaf1f8;
  --muted: #a3b6cc;
  --faint: #7a8ea6;
  --lavender: #b9c6ff;
  --teal: #5eead4;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --sky: #7dd3fc;
  --sky-soft: rgba(125, 211, 252, 0.12);
  --violet: #c4b5fd;
  --violet-soft: rgba(196, 181, 253, 0.12);
  --amber: #fbbf24;
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 10% -12%, rgba(52, 211, 153, 0.1), transparent 60%),
    radial-gradient(760px 420px at 98% -4%, rgba(125, 211, 252, 0.08), transparent 55%),
    radial-gradient(1000px 620px at 50% 112%, rgba(196, 181, 253, 0.08), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(52, 211, 153, 0.28);
}

:focus-visible {
  outline: 2px solid rgba(52, 211, 153, 0.6);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #2b4a63, #33415f);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 22px 40px;
}

/* ---------- Header ---------- */

.topbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  gap: 18px;
  padding: 14px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(520px 160px at 0% 0%, rgba(52, 211, 153, 0.09), transparent 70%),
    linear-gradient(180deg, rgba(19, 29, 39, 0.9), rgba(14, 21, 29, 0.9));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4ade80, #10b981);
  color: #06210f;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 12px 32px rgba(52, 211, 153, 0.22);
}

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

.brand-text h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #6ee7b7, #7dd3fc 55%, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.version {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  background: var(--bg-soft);
}

.brand-text p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

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

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12.5px;
  background: var(--bg-soft);
  white-space: nowrap;
}

.live .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
  animation: pulse 2.2s ease-in-out infinite;
}

.live.down .dot {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
  animation: none;
}

.live.paused .dot {
  background: var(--faint);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
  .live .dot {
    animation: none;
  }
}

/* ---------- Buttons ---------- */

.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button svg {
  width: 15px;
  height: 15px;
  display: block;
}

.button:hover {
  color: var(--text);
  border-color: #2a3948;
  background: #101923;
}

.button .icon-play {
  display: none;
}

.button.paused .icon-pause {
  display: none;
}

.button.paused .icon-play {
  display: block;
}

.button.icon-only {
  width: 35px;
  padding: 8px;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button.record .record-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.button.record.off {
  color: var(--faint);
}

.button.record.off .record-dot {
  background: var(--faint);
  box-shadow: none;
}

.button.danger {
  background: transparent;
  border-color: rgba(248, 113, 113, 0.24);
  color: #fca5a5;
}

.button.danger:hover {
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.button.danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
}

a.button {
  text-decoration: none;
}

.button.public {
  color: #bae6fd;
  border-color: rgba(125, 211, 252, 0.32);
  background: rgba(125, 211, 252, 0.09);
}

.button.public:hover {
  color: #e0f2fe;
  border-color: rgba(125, 211, 252, 0.55);
  background: rgba(125, 211, 252, 0.16);
}

.button.danger-solid {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff5f5;
}

.button.danger-solid:hover {
  background: linear-gradient(180deg, #f05252, #e02d2d);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.button.danger-solid:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* ---------- Summary cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(240px 130px at 50% 0%, var(--tone-soft), transparent 72%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 15px;
  min-height: 118px;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--tone-line);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35), 0 0 26px var(--tone-soft);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--tone), transparent 75%);
  opacity: 0.7;
}

.tone-teal {
  --tone: var(--teal);
  --tone-soft: rgba(94, 234, 212, 0.12);
  --tone-line: rgba(94, 234, 212, 0.28);
}

.tone-green {
  --tone: var(--green);
  --tone-soft: var(--green-soft);
  --tone-line: rgba(52, 211, 153, 0.28);
}

.tone-sky {
  --tone: var(--sky);
  --tone-soft: var(--sky-soft);
  --tone-line: rgba(125, 211, 252, 0.28);
}

.tone-violet {
  --tone: var(--violet);
  --tone-soft: var(--violet-soft);
  --tone-line: rgba(196, 181, 253, 0.28);
}

.tone-red {
  --tone: var(--red);
  --tone-soft: var(--red-soft);
  --tone-line: rgba(248, 113, 113, 0.28);
}

.card-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  margin-bottom: 8px;
}

.card-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--tone);
  background: var(--tone-soft);
  border: 1px solid var(--tone-line);
  box-shadow: 0 0 18px var(--tone-soft);
}

.card-icon svg {
  width: 16px;
  height: 16px;
}

.card-label {
  margin: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.card-value {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--tone);
}

.tone-red .card-value:not(.bad) {
  color: var(--text);
}

.card-value.bad {
  color: var(--red);
}

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

.card-metrics {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  width: 100%;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px 2px 5px;
  border-radius: 10px;
  border: 1px solid var(--tone-line);
  background: var(--tone-soft);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
}

.metric b {
  color: var(--tone);
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric.is-zero {
  border-color: var(--line);
  background: transparent;
}

.metric.is-zero b {
  color: var(--faint);
}

.card-period {
  display: block;
  margin-top: 8px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ---------- Panels ---------- */

.panel {
  background:
    radial-gradient(640px 220px at 12% 0%, rgba(52, 211, 153, 0.06), transparent 62%),
    radial-gradient(640px 240px at 88% 100%, rgba(196, 181, 253, 0.06), transparent 62%),
    linear-gradient(180deg, rgba(125, 211, 252, 0.04), transparent 140px),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 10px;
  margin-bottom: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}

.panel-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  flex-wrap: wrap;
  text-align: left;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
}

.panel-title h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #a7f3d0, #bae6fd 55%, #ddd6fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 19px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(185, 198, 255, 0.08);
  border: 1px solid rgba(185, 198, 255, 0.24);
  color: var(--lavender);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.count.bad {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.28);
}

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--faint);
  pointer-events: none;
}

.search input {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 33px;
  width: min(290px, 100%);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search input::placeholder {
  color: var(--faint);
}

.search input:focus {
  border-color: #2f6b46;
  background: #0b1219;
}

.search input:focus-visible {
  outline: none;
}

/* ---------- Card switches ---------- */

.card-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  min-width: 148px;
  margin: auto 0 0;
  padding: 5px 7px 5px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(9, 15, 23, 0.55);
}

.card-switch-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.card-switch.is-off .card-switch-label {
  color: var(--faint);
}

.switch {
  position: relative;
  flex: none;
  width: 40px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0b1219;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--faint);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch.on {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.42);
}

.switch.on::after {
  transform: translateX(18px);
  background: var(--green);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.45);
}

.switch:hover:not(:disabled) {
  border-color: #2f6b46;
}

.switch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Table ---------- */

.table-wrap {
  overflow: auto;
  max-height: 62vh;
  margin: 0 -18px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  min-width: 1080px;
}

th:nth-child(1) { width: 8%; }
th:nth-child(2) { width: 25%; }
th:nth-child(3) { width: 26%; }
th:nth-child(4) { width: 20%; }
th:nth-child(5) { width: 17%; }
th:nth-child(6) { width: 4%; }

thead th:nth-child(5) {
  white-space: normal;
  line-height: 1.35;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--lavender);
  font-weight: 700;
  padding: 11px 12px;
  background: linear-gradient(180deg, #152235, #0f1826);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  text-align: left;
  font-size: 13.5px;
}

th:first-child,
td:first-child {
  padding-left: 18px;
}

th:last-child,
td:last-child {
  padding-right: 18px;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:nth-child(even) {
  background: rgba(125, 211, 252, 0.03);
}

tbody tr:hover {
  background: linear-gradient(
    90deg,
    rgba(52, 211, 153, 0.05),
    rgba(125, 211, 252, 0.06) 50%,
    rgba(196, 181, 253, 0.05)
  );
}

tbody tr.row-unmatched {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.06), transparent 55%);
}

tbody tr.row-unmatched td:first-child {
  box-shadow: inset 2px 0 0 rgba(251, 191, 36, 0.45);
}

tbody tr.row-unmatched:hover {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.1), rgba(125, 211, 252, 0.04));
}

th.num,
td.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

th.col-actions,
td.col-actions {
  padding-left: 0;
  padding-right: 8px;
  text-align: center;
}

th.col-actions svg {
  width: 13px;
  height: 13px;
  display: block;
  margin: 0 auto;
  color: var(--faint);
}

.row-delete {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.row-delete svg {
  width: 14px;
  height: 14px;
}

.row-delete:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.3);
}

.time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.title {
  font-weight: 600;
  max-width: 240px;
  margin: 0 auto;
  overflow-wrap: anywhere;
}

.title-meta {
  color: var(--faint);
  font-size: 11.5px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.request-file {
  max-width: 100%;
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: #e6f2ff;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.duration {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.duration.fast { color: var(--green); }
.duration.mid { color: var(--amber); }
.duration.slow { color: var(--red); }

.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: 1px;
  margin-left: 6px;
}

.chip.cache {
  color: var(--sky);
  border-color: rgba(125, 211, 252, 0.25);
  background: rgba(125, 211, 252, 0.08);
}

.chip.sdh {
  color: var(--amber);
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}

.chip.dup {
  color: var(--violet);
  border-color: rgba(196, 181, 253, 0.3);
  background: rgba(196, 181, 253, 0.08);
  cursor: help;
}

.chip.api {
  color: #c7d2fe;
  border-color: rgba(199, 210, 254, 0.24);
  background: rgba(199, 210, 254, 0.08);
  cursor: help;
}

.chip.api.multi {
  color: var(--violet);
  border-color: rgba(196, 181, 253, 0.3);
  background: rgba(196, 181, 253, 0.08);
}

.chip.error {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.3);
  background: var(--red-soft);
}

.chip.score {
  color: var(--green);
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(74, 222, 128, 0.08);
  cursor: help;
}

.chip.lang {
  color: var(--sky);
  border-color: rgba(125, 211, 252, 0.25);
  background: rgba(125, 211, 252, 0.08);
  cursor: help;
}

.chip.sync {
  color: var(--teal);
  border-color: rgba(94, 234, 212, 0.3);
  background: rgba(94, 234, 212, 0.08);
  cursor: help;
}

.chip.hash {
  color: var(--green);
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(74, 222, 128, 0.08);
  cursor: help;
}

.chip.source {
  color: var(--violet);
  border-color: rgba(196, 181, 253, 0.25);
  background: rgba(196, 181, 253, 0.08);
  cursor: help;
}

.chip.translation {
  color: var(--sky);
  border-color: rgba(125, 211, 252, 0.25);
  background: rgba(125, 211, 252, 0.08);
  cursor: help;
}

.chip.note {
  color: var(--amber);
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
  cursor: help;
  margin-left: 0;
}

.chip.disk {
  color: var(--teal);
  border-color: rgba(94, 234, 212, 0.3);
  background: rgba(94, 234, 212, 0.08);
  margin-left: 0;
}

.subtitle-release {
  max-width: 100%;
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.subtitle-meta {
  color: var(--faint);
  font-size: 11.5px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px 6px;
  margin-top: 5px;
}

.meta-line .chip {
  margin-left: 0;
}

.stored-file {
  font-size: 12.5px;
  font-weight: 600;
  color: #dbeafe;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.stored-path {
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.times {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 158px;
  text-align: left;
}

.time-line {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.time-label {
  width: 62px;
  flex: none;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.time-value {
  min-width: 42px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.time-chips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.time-chips .chip {
  margin-left: 0;
}

.time-line.total {
  margin-top: 1px;
  padding-top: 4px;
  border-top: 1px dashed var(--line-soft);
}

.time-line.total .time-label {
  color: var(--lavender);
}

.time-line.total .time-value {
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.08);
  color: #c7d3e2;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.65;
  letter-spacing: 0.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag.hash {
  color: var(--violet);
  border-color: rgba(196, 181, 253, 0.28);
  background: rgba(196, 181, 253, 0.09);
}

.tag.size {
  color: var(--teal);
  border-color: rgba(94, 234, 212, 0.24);
  background: rgba(94, 234, 212, 0.08);
}

.tag.length {
  color: var(--sky);
  border-color: rgba(125, 211, 252, 0.26);
  background: rgba(125, 211, 252, 0.09);
}

.tag.id {
  color: #a5b4fc;
  border-color: rgba(165, 180, 252, 0.26);
  background: rgba(165, 180, 252, 0.09);
}

.tag.downloads {
  color: var(--amber);
  border-color: rgba(251, 191, 36, 0.26);
  background: rgba(251, 191, 36, 0.08);
}

.tag.format {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.24);
  background: rgba(134, 239, 172, 0.08);
}

.tag.saved {
  color: var(--faint);
  border-color: var(--line-soft);
  background: rgba(148, 163, 184, 0.05);
}

.nosub {
  display: inline-flex;
  align-items: center;
  color: var(--lavender);
  font-size: 11.5px;
  border: 1px dashed rgba(185, 198, 255, 0.3);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.muted {
  color: var(--faint);
  font-size: 12.5px;
}

/* ---------- Empty states ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 34px 16px 36px;
}

.empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--faint);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.empty-icon svg {
  width: 20px;
  height: 20px;
}

.empty-icon.ok {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(52, 211, 153, 0.28);
}

.empty-title {
  margin: 0 0 3px;
  font-size: 13.5px;
  font-weight: 600;
}

.empty-text {
  margin: 0;
  color: var(--faint);
  font-size: 12.5px;
  max-width: 380px;
}

.empty.small {
  padding: 26px 16px 28px;
}

/* ---------- Legend ---------- */

.legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 18px 8px;
  margin: 0 -18px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.swatch.fast { background: var(--green); }
.swatch.mid { background: var(--amber); }
.swatch.slow { background: var(--red); }

.legend-note {
  margin-left: 0;
  color: var(--faint);
}

/* ---------- Errors ---------- */

.errors {
  list-style: none;
  margin: 0;
  padding: 0 0 4px;
}

.errors:empty {
  display: none;
}

.errors li {
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: baseline;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  flex-wrap: wrap;
  text-align: center;
}

.errors li:last-child {
  border-bottom: none;
}

.errors .error-time {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 62px;
}

.errors .error-kind {
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.25);
  background: var(--red-soft);
  border-radius: 999px;
  padding: 1px 7px;
}

.errors .error-message {
  color: #fca5a5;
  word-break: break-word;
}

/* ---------- Footer ---------- */

.foot {
  display: flex;
  justify-content: center;
  gap: 14px;
  color: var(--faint);
  font-size: 11.5px;
  padding: 4px 2px;
  flex-wrap: wrap;
  text-align: center;
}

/* ---------- Dialog ---------- */

.dialog {
  width: min(430px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #131d27, #0e151d);
  color: var(--text);
  padding: 24px;
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.dialog::backdrop {
  background: rgba(3, 6, 10, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--red-soft);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: var(--red);
  margin: 0 auto 14px;
}

.dialog-icon svg {
  width: 20px;
  height: 20px;
}

.dialog h2 {
  margin: 0 0 8px;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.dialog p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 50;
  transform: translateX(-50%) translateY(10px);
  background: #0f231a;
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #a7f3d0;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: calc(100vw - 32px);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #2a1215;
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

/* ---------- Responsive ---------- */

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

@media (max-width: 700px) {
  .topbar {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .brand {
    justify-content: center;
  }
  .controls {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }
  .actions {
    flex: 1;
    justify-content: center;
  }
  .panel-head {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .panel-title {
    justify-content: center;
  }
  .panel-tools {
    justify-content: center;
  }
  .search input {
    width: 100%;
  }
  .search {
    flex: 1 1 220px;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 20px 14px 30px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .card {
    min-height: 0;
  }
  .brand-text p {
    display: none;
  }
  .panel {
    padding: 14px 14px 8px;
  }
  .table-wrap {
    margin: 0 -14px;
  }
  th:first-child,
  td:first-child {
    padding-left: 14px;
  }
  th:last-child,
  td:last-child {
    padding-right: 14px;
  }
  .legend {
    margin: 0 -14px;
    padding: 10px 14px 8px;
  }
}

@media (max-width: 760px) {
  .table-wrap {
    overflow: visible;
    max-height: none;
    margin: 0;
  }
  table {
    min-width: 0;
  }
  thead {
    display: none;
  }
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }
  tbody tr {
    position: relative;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
  }
  tbody tr:last-child {
    margin-bottom: 4px;
  }
  tbody tr:hover {
    background: var(--bg-soft);
  }
  tbody td {
    border: none;
    padding: 5px 0;
    font-size: 13.5px;
  }
  tbody td:first-child {
    position: absolute;
    top: 12px;
    right: 14px;
    width: auto;
    padding: 0;
  }
  tbody td:first-child::before {
    display: none;
  }
  tbody td:first-child .time {
    display: inline-block;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    color: var(--lavender);
    font-size: 11.5px;
  }
  tbody td:nth-child(2) {
    padding-right: 82px;
  }
  tbody td:last-child {
    padding-left: 0;
    padding-right: 0;
  }
  tbody td.col-actions {
    padding-top: 10px;
    text-align: right;
  }
  tbody td.col-actions::before {
    display: none;
  }
  tbody td.num {
    text-align: left;
  }
  tbody td::before {
    content: attr(data-label);
    display: block;
    color: var(--faint);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 2px;
  }
  .times {
    width: 100%;
    min-width: 0;
  }
  .time-label {
    width: 58px;
  }
  .request-file,
  .subtitle-release,
  .stored-file,
  .title {
    max-width: none;
  }
  .legend {
    margin: 6px 0 0;
    padding: 10px 0 8px;
  }
  .legend-note {
    margin-left: 0;
    width: 100%;
  }
}
