@import "/static/css/common";

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--purple) var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  background:
    radial-gradient(120% 60% at 50% 108%, rgba(255, 0, 212, .14), transparent 60%),
    radial-gradient(90% 45% at 50% 0%, rgba(56, 108, 255, .12), transparent 65%),
    linear-gradient(180deg, #05031a 0%, var(--bg) 45%, #12042e 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.table-wrap {
  padding: 1px;
  border-radius: 14px;
  background: linear-gradient(90deg,
    var(--cyan), var(--blue), var(--pink), var(--orange));
  background-size: 300% 100%;
  animation: border-flow 8s linear infinite;
  box-shadow: 0 0 18px rgba(139, 44, 255, .35), 0 20px 50px rgba(0, 0, 0, .45);
}

.table-scroll {
  overflow-x: auto;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(24, 16, 58, .92), rgba(11, 7, 35, .95));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.neon-table {
  width: 100%;
  min-width: 560px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.neon-table caption {
  padding: 16px 18px 4px;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
}

.neon-table th,
.neon-table td {
  padding: 13px 18px;
  text-align: left;
  white-space: nowrap;
}

.neon-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .1em;
  color: #fff;
  background: rgba(8, 5, 30, .92);
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--cyan), var(--pink)) 1;
  text-shadow: 0 0 2px #fff, 0 0 10px var(--cyan);
}

.neon-table tbody td {
  color: var(--text);
  border-bottom: 1px solid rgba(139, 44, 255, .18);
  transition: background-color .15s ease;
}

/* CRT-style zebra */
.neon-table tbody tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, .02);
}

/* Row hover: cyan wash + pink edge bar */
.neon-table tbody tr:hover td {
  background-color: rgba(0, 234, 255, .07);
}
.neon-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--pink), inset 12px 0 18px -12px var(--pink);
}

.neon-table tbody tr:last-child td { border-bottom: 0; }

.neon-table th.num,
.neon-table td.num { text-align: right; }

.neon-table td.key {
  font-weight: 700;
  color: #fff;
}

.neon-table tfoot td {
  color: var(--muted);
  border-top: 1px solid rgba(0, 234, 255, .3);
}

/* Status chips */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 12%, transparent);
  text-shadow: 0 0 8px currentColor;
}
.tag.ok   { color: var(--cyan); }
.tag.warn { color: var(--orange); }
.tag.bad  { color: var(--pink); }

.neon-table a { font-weight: 600; }

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

.error {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 0, 212, .1);
  color: var(--pink);
}

::selection { background: var(--pink); color: #fff; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--pink); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.backdrop .floor {
  position: absolute;
  left: -30%;
  right: -30%;
  bottom: -8%;
  height: 46vh;
  transform: perspective(420px) rotateX(63deg);
  transform-origin: top center;
  background:
    repeating-linear-gradient(90deg,
      rgba(0, 234, 255, .4) 0 2px,
      transparent 2px 64px),
    repeating-linear-gradient(0deg,
      rgba(255, 0, 212, .4) 0 2px,
      transparent 2px 34px);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 32%);
  mask-image: linear-gradient(180deg, transparent, #000 32%);
  animation: grid-scroll 4s linear infinite;
}

.backdrop .scanlines {
  position: absolute;
  inset: 0;
  opacity: .35;
  background: repeating-linear-gradient(to bottom,
    rgba(255, 255, 255, .5) 0 1px,
    transparent 1px 3px);
  mix-blend-mode: overlay;
}

.backdrop .vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
    transparent 40%,
    rgba(5, 0, 13, .5) 78%,
    rgba(5, 0, 13, .92) 100%);
}

@keyframes grid-scroll {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 0, 0 34px; }
}

.wrapper {
  width: min(960px, 100% - 40px);
  margin-inline: auto;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 5, 30, .62);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.top-nav::after {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg,
    var(--cyan),
    var(--blue),
    var(--pink),
    var(--orange));
  background-size: 300% 100%;
  animation: border-flow 8s linear infinite;
  box-shadow: 0 0 12px rgba(255, 0, 212, .45);
}

.top-nav .wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 12px;
}

.top-nav .wrapper { position: relative; }

.top-nav .nav-link {
  position: absolute;
  right: 0;
  color: var(--text);
  font: 700 12px/1 system-ui, sans-serif;
  letter-spacing: .12em;
  text-decoration: none;
  transition: color .15s ease, text-shadow .15s ease;
}

.top-nav .nav-link:hover {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
}

.logo {
  svg {
    overflow: visible;
    width: auto;
    height: 28px;
  }
}

.page {
  position: relative;
  z-index: 1;
  flex: 1;
  padding-top: clamp(32px, 6vh, 64px);
  padding-bottom: 64px;
}

.page > .container {
  width: min(480px, 100%);
  margin-inline: auto;
  padding: 32px 28px;
  background: linear-gradient(180deg, rgba(24, 16, 58, .82), rgba(14, 9, 40, .86));
  border: 1px solid rgba(139, 44, 255, .4);
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(0, 234, 255, .08),
    0 0 28px rgba(139, 44, 255, .28),
    0 24px 60px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.page > h1 {
  margin: 0 0 clamp(20px, 4vh, 32px);
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: -.5px;
  color: #fff;
  text-shadow:
    0 0 2px #fff,
    0 0 10px var(--pink),
    0 0 28px var(--pink),
    0 0 70px var(--purple);
}

.page > p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.text-input {
  display: flex;
  width: 100%;
  padding: 1px;
  border-radius: 12px;
  background: linear-gradient(90deg,
    var(--cyan),
    var(--blue),
    var(--pink),
    var(--orange));
  background-size: 300% 100%;
  animation: border-flow 6s linear infinite;
  box-shadow: 0 0 10px rgba(0, 234, 255, .25);
}

.text-input:focus-within {
  box-shadow:
    0 0 10px rgba(0, 234, 255, .7),
    0 0 28px rgba(255, 0, 212, .3);
}

.text-input input {
  flex: 1;
  min-width: 0;
  height: 50px;
  border: 0;
  outline: 0;
  padding: 0 16px;
  color: #fff;
  font: 600 15px/1 system-ui, sans-serif;
  border-radius: 11px 0 0 11px;
  background:
    repeating-linear-gradient(0deg,
      rgba(255, 255, 255, .015) 0 1px,
      transparent 1px 4px),
    #0b0723;
}

.text-input input::placeholder { color: #514c70; }
.text-input input:focus { background-color: #0e092d; }
.text-input input::selection { background: var(--pink); color: #fff; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font: 700 13px/1 system-ui, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(180deg, var(--cyan), var(--purple) 55%, var(--pink));
  box-shadow:
    0 0 12px rgba(139, 44, 255, .45),
    inset 0 1px rgba(255, 255, 255, .25);
  text-shadow:
    0 1px 1px rgba(30, 0, 80, .5),
    0 0 8px rgba(255, 255, 255, .35),
    0 0 18px rgba(139, 44, 255, .6);
  transition: box-shadow .2s ease, text-shadow .2s ease, transform .15s ease;
}

.btn:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow:
    0 0 14px rgba(0, 234, 255, .5),
    inset 0 1px rgba(255, 255, 255, .25),
    0 0 28px rgba(255, 0, 212, .35);
  text-shadow:
    0 1px 1px rgba(30, 0, 80, .5),
    0 0 8px rgba(255, 255, 255, .5),
    0 0 20px rgba(0, 234, 255, .6);
}

.btn:active { transform: translateY(0); }

.text-input .btn {
  height: 50px;
  min-height: 0;
  margin-right: 1px;
  border-radius: 0 10px 10px 0;
}

.top-nav .btn { min-height: 38px; padding: 0 18px; }

.panel {
  padding: 24px;
  background: linear-gradient(180deg, rgba(24, 16, 58, .78), rgba(14, 9, 40, .82));
  border: 1px solid rgba(139, 44, 255, .32);
  border-radius: 16px;
  box-shadow: 0 0 24px rgba(139, 44, 255, .2), 0 20px 50px rgba(0, 0, 0, .45);
}

.panel h1, .panel h2 { margin-top: 0; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -.4px; }

.subtitle, .muted { color: var(--muted); }

.neon-pink {
  color: #fff;
  text-shadow:
    0 0 2px #fff,
    0 0 8px var(--pink),
    0 0 22px var(--pink),
    0 0 60px var(--purple);
}

.neon-cyan {
  color: #fff;
  text-shadow:
    0 0 2px #fff,
    0 0 8px var(--cyan),
    0 0 22px var(--cyan),
    0 0 60px var(--blue);
}

.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(139, 44, 255, .25);
  background: rgba(8, 5, 30, .55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);

  .wrapper {
    padding-top: 14px;
    padding-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px; 
  }
}

@keyframes border-flow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .backdrop .floor,
  .text-input,
  .top-nav::after { animation: none; }
}

@media (max-width: 560px) {
  .logo { font-size: 20px; }
  .top-nav .btn { padding: 0 14px; }
  .page > form { padding: 24px 18px; }

  .text-input { flex-direction: column; }
  .text-input input {
    border-radius: 11px 11px 0 0;
    text-align: center;
  }
  .text-input .btn {
    width: calc(100% - 2px);
    margin: 0 1px 1px;
    border-radius: 0 0 10px 10px;
  }
}

/* Cells management */
.table-wrap + .create-cell { margin-top: 28px; }

.neon-table td.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}

.neon-table td form { margin: 0; }

.btn.small { min-height: 32px; padding: 0 14px; font-size: 11px; }

.btn.danger {
  background: linear-gradient(180deg, var(--orange), var(--pink));
  box-shadow: 0 0 12px rgba(255, 0, 212, .4), inset 0 1px rgba(255, 255, 255, .25);
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(139, 44, 255, .6);
  box-shadow: none;
}

.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.page > p > a, .page > p a { font-weight: 600; }

.config-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 28px;
  margin-bottom: 28px;
}

.toggle.compact { gap: 10px; padding: 4px 0; font-size: 14px; }
.toggle.compact .switch { width: 36px; height: 20px; }
.toggle.compact .switch::after { top: 2px; left: 2px; width: 14px; height: 14px; }
.toggle.compact input:checked + .switch::after { transform: translateX(16px); }

.toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  cursor: pointer;
}

.toggle input { position: absolute; opacity: 0; pointer-events: none; }

.toggle .switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #0b0723;
  border: 1px solid rgba(139, 44, 255, .6);
  transition: background .2s ease, box-shadow .2s ease;
}

.toggle .switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}

.toggle input:checked + .switch {
  background: rgba(0, 234, 255, .12);
  box-shadow: 0 0 12px rgba(0, 234, 255, .4);
}

.toggle input:checked + .switch::after {
  transform: translateX(20px);
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.toggle input:focus-visible + .switch { outline: 2px solid var(--cyan); outline-offset: 2px; }

.toggle-label { display: flex; flex-direction: column; font-weight: 600; }
.toggle-label small { font-weight: 400; color: var(--muted); word-break: break-all; }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }

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

.section-head h2 { margin: 0; }

.meter {
  display: flex;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: #0b0723;
  border: 1px solid rgba(139, 44, 255, .4);
}

.meter .seg {
  height: 100%;
  box-shadow: inset -1px 0 rgba(8, 5, 30, .8);
  transition: width .4s ease;
}

.seg.image    { background: var(--cyan);   --glow: var(--cyan); }
.seg.video    { background: var(--pink);   --glow: var(--pink); }
.seg.audio    { background: var(--orange); --glow: var(--orange); }
.seg.document { background: var(--blue);   --glow: var(--blue); }
.seg.archive  { background: var(--purple); --glow: var(--purple); }
.seg.other    { background: var(--muted);  --glow: var(--muted); }

.meter-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: 10px 0 20px;
  font-size: 13px;
}

.legend-item { display: inline-flex; align-items: center; gap: 6px; text-transform: capitalize; }
.legend-item small { color: var(--muted); text-transform: none; }

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px var(--glow);
}

.meter-label { margin: 0 0 0 auto; }

/* Uploader */
.uploader {
  width: min(520px, 100% - 32px);
  max-height: calc(100vh - 48px);
  padding: 24px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(24, 16, 58, .98), rgba(11, 7, 35, .98));
  border: 1px solid rgba(139, 44, 255, .5);
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(0, 234, 255, .1), 0 0 40px rgba(139, 44, 255, .4), 0 30px 80px rgba(0, 0, 0, .7);
}

.uploader::backdrop {
  background: rgba(5, 0, 13, .75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.uploader-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.uploader-head h2 { margin: 0; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  border: 2px dashed rgba(0, 234, 255, .5);
  border-radius: 14px;
  background: rgba(0, 234, 255, .03);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.dropzone:hover,
.dropzone.over {
  border-color: var(--pink);
  background: rgba(255, 0, 212, .08);
  box-shadow: 0 0 24px rgba(255, 0, 212, .3), inset 0 0 24px rgba(255, 0, 212, .1);
}

.dropzone span, .dropzone small { color: var(--muted); }

.queue { list-style: none; margin: 16px 0 0; padding: 0; overflow-y: auto; max-height: 40vh; }

.job { padding: 10px 0; border-top: 1px solid rgba(139, 44, 255, .25); font-size: 13px; }
.job-row { display: flex; justify-content: space-between; gap: 12px; }
.job-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.job-pct, .job-bytes, .job-state { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.bar {
  height: 6px;
  margin: 6px 0;
  border-radius: 999px;
  overflow: hidden;
  background: #0b0723;
}

.bar i {
  display: block;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--cyan), var(--blue), var(--pink));
  background-size: 200% 100%;
  box-shadow: 0 0 10px var(--cyan);
  animation: border-flow 2s linear infinite;
}

.job.done .bar i { background: var(--cyan); animation: none; }
.job.done .job-state { color: var(--cyan); }
.job.failed .bar i { background: var(--pink); box-shadow: 0 0 10px var(--pink); animation: none; }
.job.failed .job-state { color: var(--pink); }

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

/* Item page */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0 0 22px;
  font-size: 14px;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-all; }

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--muted);
}

.text-input input:only-child { border-radius: 11px; }

.hint { margin: 8px 0 10px; font-size: 13px; }

.danger-zone { margin-top: 24px; }

/* Status dot */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border-radius: 50%;
  vertical-align: middle;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.dot.ok  { color: var(--cyan); }
.dot.bad { color: var(--pink); }

.open-link {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 10px;
  color: var(--muted);
  transition: color .15s ease, filter .15s ease;
}
.open-link:hover { color: var(--cyan); filter: drop-shadow(0 0 4px var(--cyan)); }

/* Static pages */
.prose { line-height: 1.7; }
.prose h2 { margin: 28px 0 8px; font-size: 18px; letter-spacing: .02em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul { margin: 0 0 12px; color: var(--text); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose code {
  padding: 1px 6px;
  border-radius: 6px;
  font-size: .9em;
  color: var(--cyan);
  background: rgba(0, 234, 255, .08);
}
.prose strong { color: #fff; }

/* Locks */
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.lock-add-head { margin-top: 36px; }

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

.lock-kind {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  color: var(--text);
  transition: box-shadow .2s ease, transform .15s ease;
}
.lock-kind strong { color: #fff; font-size: 16px; }
.lock-kind span { color: var(--muted); font-size: 13px; }
.lock-kind:hover {
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(0, 234, 255, .3), 0 20px 50px rgba(0, 0, 0, .45);
}

.field-input {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 12px 14px;
  color: #fff;
  font: 600 15px/1.4 system-ui, sans-serif;
  background: #0b0723;
  border: 1px solid rgba(139, 44, 255, .6);
  border-radius: 10px;
}
.field-input:focus { outline: 0; border-color: var(--cyan); box-shadow: 0 0 12px rgba(0, 234, 255, .4); }
textarea.field-input { resize: vertical; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }

.lock-form-page { max-width: 560px; }
.lock-form-page .field-label { margin-top: 14px; }
.lock-form-page .actions { margin-top: 22px; }
.lock-info { margin: 22px 0 0; }
