/* ==========================================================================
   bema-intake — vDCW terminal/futuristic
   ========================================================================== */

:root {
  --bg: #060608;
  --bg-2: #0b0b10;
  --bg-3: #101019;
  --ink: #e8eef4;
  --ink-dim: #8a93a3;
  --ink-low: #52596a;
  --line: #1a1d27;
  --line-bright: #2a3142;
  --accent: #22e0ff;            /* cyan neon */
  --accent-dim: #0ea8c2;
  --accent-glow: rgba(34, 224, 255, 0.35);
  --warn: #ff7a45;
  --ok: #22ff9f;
  --err: #ff4b6e;
  --font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 6px;
  --radius-lg: 10px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); min-height: 100%; }

body {
  background:
    radial-gradient(ellipse at top, rgba(34,224,255,0.08), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(34,224,255,0.04), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
  line-height: 1.55;
  font-size: 15px;
}

/* Subtle grid overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.18;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
  z-index: 0;
}

/* Scanline */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(255,255,255,0.012) 3px,
    rgba(255,255,255,0.012) 4px
  );
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: var(--accent-glow); }

.mono { font-family: var(--font-mono); }

.app { position: relative; z-index: 1; min-height: 100vh; }

/* ==========================================================================
   Header / topbar
   ========================================================================== */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11,11,16,0.9), rgba(11,11,16,0.6));
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}

.brand { display: flex; gap: 12px; align-items: center; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.05em; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.brand b { color: var(--ink); font-weight: 600; }
.brand span { color: var(--ink-dim); }

.topbar-right { display: flex; gap: 16px; align-items: center; font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); }
.topbar-right .status { color: var(--ok); }
.topbar-right .status::before { content: '● '; }

/* ==========================================================================
   Buttons & inputs
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 1px var(--accent-glow); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #001318;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 0 20px -2px var(--accent-glow);
}
.btn.primary:hover { filter: brightness(1.1); color: #001318; text-decoration: none; }
.btn.ghost { border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line-bright); }
.btn.danger:hover { color: var(--err); border-color: var(--err); box-shadow: 0 0 0 1px rgba(255,75,110,0.3); }

input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=password], textarea, select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: all 0.15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); background: var(--bg-3); }
textarea { resize: vertical; min-height: 80px; }

input[type=color] {
  width: 56px; height: 40px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 2px;
}

::placeholder { color: var(--ink-low); }

input[type=date] {
  max-width: 260px;
  font-size: 16px;
  padding: 13px 16px;
  border-color: var(--line-bright);
  color-scheme: dark;
}
input[type=date]::-webkit-calendar-picker-indicator {
  filter: brightness(0) invert(1);
  cursor: pointer;
  padding-left: 8px;
  scale: 1.3;
}

/* ==========================================================================
   Login page
   ========================================================================== */

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 40px 20px; }
.login-card {
  width: 100%; max-width: 460px;
  background: var(--bg-2);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 0 40px -10px var(--accent-glow), 0 20px 60px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--accent-glow) 0%, transparent 4px);
  pointer-events: none;
}
.login-head { margin-bottom: 28px; }
.login-head .mono-prefix { font-family: var(--font-mono); color: var(--accent); font-size: 12px; letter-spacing: 0.1em; margin-bottom: 8px; }
.login-head h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.login-head p { color: var(--ink-dim); margin: 10px 0 0; font-size: 14px; }

.login-form label { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--ink-dim); text-transform: uppercase; margin: 20px 0 8px; }
.login-form .err { background: rgba(255,75,110,0.1); color: var(--err); border: 1px solid rgba(255,75,110,0.3); padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.login-form button { width: 100%; justify-content: center; margin-top: 28px; padding: 13px; }

.login-foot { margin-top: 24px; text-align: center; color: var(--ink-low); font-size: 12px; font-family: var(--font-mono); }

/* ==========================================================================
   Form layout
   ========================================================================== */

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - 58px);
}

.sidebar {
  padding: 30px 20px;
  border-right: 1px solid var(--line);
  background: rgba(11,11,16,0.4);
  position: sticky; top: 58px; align-self: start;
  max-height: calc(100vh - 58px);
  overflow-y: auto;
}

.sidebar h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin: 0 0 16px;
}

.progress-track {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim));
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.4s ease;
}
.progress-label { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); margin-bottom: 24px; display: flex; justify-content: space-between; }
.progress-label b { color: var(--ink); }

.section-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.section-nav li button {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}
.section-nav li button:hover { color: var(--ink); background: rgba(255,255,255,0.02); }
.section-nav li button.active { color: var(--accent); border-left-color: var(--accent); background: rgba(34,224,255,0.05); }
.section-nav li button.done::before { content: '✓'; color: var(--ok); width: 14px; display: inline-block; }
.section-nav li button:not(.done)::before { content: '·'; color: var(--ink-low); width: 14px; display: inline-block; }
.section-nav li button .num { color: var(--ink-low); font-size: 10px; margin-right: 2px; }
.section-nav li button.active .num { color: var(--accent); }

.content { padding: 44px 60px 80px; max-width: 920px; width: 100%; }

.section-head { margin-bottom: 38px; }
.section-head .num-line {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.section-head h2 {
  font-size: 34px; font-weight: 600; margin: 0;
  letter-spacing: -0.02em;
}
.section-head p { color: var(--ink-dim); margin: 8px 0 0; font-size: 15px; }

.field { margin-bottom: 26px; }
.field > label.field-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--ink); }
.field .help { font-size: 12.5px; color: var(--ink-dim); margin-bottom: 10px; font-family: var(--font-body); }
.field.required > label.field-label::after { content: ' *'; color: var(--accent); }

.divider-block {
  margin: 40px 0 24px;
  padding: 16px 0 0;
  border-top: 1px dashed var(--line-bright);
}
.divider-block .num-line { font-family: var(--font-mono); color: var(--accent-dim); font-size: 12px; letter-spacing: 0.1em; }
.divider-block h3 { margin: 4px 0 0; font-size: 20px; font-weight: 500; }

/* radio / checkbox */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.12s ease;
  user-select: none;
}
.chip input { position: absolute; opacity: 0; }
.chip:hover { border-color: var(--line-bright); }
.chip.checked { border-color: var(--accent); color: var(--accent); background: rgba(34,224,255,0.08); box-shadow: 0 0 0 1px var(--accent-glow); }
.chip.checked::before { content: '✓'; font-family: var(--font-mono); font-size: 11px; }

/* single toggle (checkbox, not in a chip-row) */
.toggle-row { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.toggle-row:hover { border-color: var(--line-bright); }
.toggle-switch {
  width: 38px; height: 22px;
  background: var(--bg-3);
  border: 1px solid var(--line-bright);
  border-radius: 100px;
  position: relative;
  transition: all 0.18s;
}
.toggle-switch::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--ink-dim);
  border-radius: 50%;
  transition: all 0.18s;
}
.toggle-row.on .toggle-switch { background: var(--accent-dim); border-color: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.toggle-row.on .toggle-switch::after { left: 18px; background: #001318; }

/* tags */
.tags-input {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 44px;
  align-items: center;
}
.tags-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: rgba(34,224,255,0.12);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 100px;
  font-size: 12px;
  font-family: var(--font-mono);
}
.tag button {
  background: none; border: none; color: inherit; cursor: pointer; padding: 0;
  font-size: 14px; line-height: 1; opacity: 0.6;
}
.tag button:hover { opacity: 1; }
.tags-input input { flex: 1; min-width: 120px; padding: 4px 8px; border: none; background: transparent; }
.tags-input input:focus { box-shadow: none; background: transparent; }

/* slider */
.slider-axis { display: grid; grid-template-columns: 120px 1fr 120px; align-items: center; gap: 14px; margin-bottom: 12px; }
.slider-axis .lbl-left { text-align: right; color: var(--ink-dim); font-size: 13px; font-family: var(--font-mono); }
.slider-axis .lbl-right { text-align: left; color: var(--ink-dim); font-size: 13px; font-family: var(--font-mono); }
.slider-axis input[type=range] {
  width: 100%; -webkit-appearance: none; appearance: none;
  height: 6px; background: var(--bg-3);
  border-radius: 3px;
  outline: none;
}
.slider-axis input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 12px var(--accent-glow);
  border: 2px solid var(--bg);
}
.slider-axis input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 12px var(--accent-glow);
  border: 2px solid var(--bg);
}

/* color block */
.color-row { display: flex; align-items: center; gap: 10px; }
.color-hex { font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); }
.colors-stack { display: flex; flex-direction: column; gap: 8px; }
.colors-stack .color-row .btn { padding: 6px 10px; font-size: 11px; }

/* upload dropzone */
.dropzone {
  border: 2px dashed var(--line-bright);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  background: rgba(11,11,16,0.5);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(34,224,255,0.04); color: var(--accent); box-shadow: 0 0 30px -8px var(--accent-glow); }
.dropzone .icon { font-size: 28px; margin-bottom: 8px; color: var(--accent); }
.dropzone .hint { font-size: 13px; color: var(--ink-dim); }
.dropzone input[type=file] { display: none; }

.file-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}
.file-item-row { display: flex; align-items: center; gap: 10px; }
.file-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .meta { flex-shrink: 0; color: var(--ink-dim); font-family: var(--font-mono); font-size: 11px; }
.file-item .bar { height: 3px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.file-item .bar > div { height: 100%; background: var(--accent); transition: width 0.2s; }
.file-item.done { border-color: var(--accent-dim); }
.file-item.done .name::before { content: '✓  '; color: var(--ok); }
.file-item.error { border-color: var(--err); }
.file-item.error .name::before { content: '✗  '; color: var(--err); }
.file-item .x { flex-shrink: 0; background: none; border: none; color: var(--ink-low); cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }
.file-item .x:hover { color: var(--err); }

/* repeater */
.repeater { display: flex; flex-direction: column; gap: 14px; }
.repeater-item {
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-lg);
  padding: 20px 24px 10px;
  background: rgba(11,11,16,0.4);
  position: relative;
}
.repeater-item .rep-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.repeater-item .rep-head .rep-nr { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.12em; }
.repeater-add { margin-top: 4px; }

/* save indicator */
.save-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-dim);
}
.save-indicator.saving::before { content: '◌'; animation: spin 0.8s linear infinite; color: var(--accent); display: inline-block; }
.save-indicator.saved::before { content: '✓'; color: var(--ok); }
.save-indicator.error::before { content: '⚠'; color: var(--err); }
@keyframes spin { to { transform: rotate(360deg); } }

/* footer actions */
.section-actions {
  margin-top: 40px;
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* done page */
.done-wrap { text-align: center; padding: 80px 20px; max-width: 640px; margin: 0 auto; }
.done-wrap .big { font-family: var(--font-mono); color: var(--accent); letter-spacing: 0.1em; font-size: 13px; margin-bottom: 16px; }
.done-wrap h1 { font-size: 42px; margin: 0; letter-spacing: -0.02em; }
.done-wrap p { color: var(--ink-dim); font-size: 16px; line-height: 1.7; margin-top: 18px; }

.terminal-ascii {
  font-family: var(--font-mono);
  color: var(--accent-dim);
  font-size: 11px;
  line-height: 1.3;
  white-space: pre;
  opacity: 0.7;
  margin: 40px auto 10px;
  display: inline-block;
  text-align: left;
}

/* retrieve.php */
.retrieve-wrap { max-width: 1120px; margin: 0 auto; padding: 40px 28px 80px; }
.retrieve-wrap h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -0.01em; }
.retrieve-wrap .sub { color: var(--ink-dim); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 28px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 30px; }
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.stat-card .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--ink-dim); text-transform: uppercase; }
.stat-card .v { font-size: 28px; font-weight: 600; margin-top: 4px; }
.stat-card .v.ok { color: var(--ok); }
.stat-card .v.accent { color: var(--accent); }

.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 24px;
}
.panel h2 { font-size: 17px; margin: 0 0 16px; font-family: var(--font-mono); letter-spacing: 0.04em; color: var(--ink-dim); text-transform: uppercase; }

table.sessions { width: 100%; border-collapse: collapse; font-size: 13px; }
table.sessions th, table.sessions td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.sessions th { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-dim); font-weight: 500; }
table.sessions td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); }

.download-btn { font-size: 14px; padding: 14px 28px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--line); }
  .content { padding: 30px 22px 60px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .slider-axis { grid-template-columns: 1fr; gap: 4px; }
  .slider-axis .lbl-left, .slider-axis .lbl-right { text-align: center; }
}
