/* Tokens and base styles. Source of truth: web/DESIGN.md (dark only). */
:root {
  --background: hsl(233 24% 4%);
  --foreground: hsl(220 14% 96%);
  --border: hsl(233 18% 12%);
  --card: hsl(233 24% 6%);
  --primary: hsl(252 100% 64%);
  --primary-fg: #fff;
  --secondary: hsl(233 18% 12%);
  --muted: hsl(233 18% 10%);
  --muted-fg: hsl(220 10% 60%);
  --accent: hsl(280 100% 65%);
  --destructive: hsl(0 84% 60%);
  --input: hsl(233 18% 16%);
  --radius: 1rem;
  --font-sans: "Manrope", sans-serif;
  --font-display: "Syne", sans-serif;
  --font-mono: Menlo, monospace;
}
* { box-sizing: border-box; border-color: var(--border); }
html, body { margin: 0; }
body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); margin: 0; line-height: 1.25; }
button { font: inherit; color: inherit; cursor: pointer; }

.page { position: relative; min-height: 100vh; overflow: hidden; display: flex; flex-direction: column; align-items: center; padding: 48px 16px; }
@media (min-width: 640px) { .page { padding-inline: 24px; } }
@media (min-width: 1024px) { .page { padding-inline: 32px; } }
.blob { position: absolute; border-radius: 9999px; pointer-events: none; mix-blend-mode: screen; }
.blob-1 { top: 0; left: 50%; transform: translateX(-50%); width: 800px; height: 400px; background: hsl(252 100% 64% / .2); filter: blur(120px); opacity: .5; }
.blob-2 { bottom: 0; right: 0; width: 500px; height: 500px; background: hsl(280 100% 65% / .1); filter: blur(100px); opacity: .4; }
.column { position: relative; z-index: 10; width: 100%; max-width: 48rem; display: flex; flex-direction: column; gap: 40px; animation: fade-in .5s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.header { text-align: center; margin-top: 32px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.badge { display: inline-flex; align-items: center; gap: 8px; background: rgb(255 255 255 / .05); border: 1px solid rgb(255 255 255 / .1); padding: 6px 16px; border-radius: 9999px; backdrop-filter: blur(12px); font-size: 14px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: rgb(255 255 255 / .8); }
.badge svg { color: var(--primary); }
.title { font-size: clamp(36px, 6vw, 60px); font-weight: 800; letter-spacing: -.025em; background: linear-gradient(135deg, #fff, rgb(255 255 255 / .6)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.25; padding-bottom: .12em; }
.lead { font-size: 18px; color: var(--muted-fg); max-width: 36rem; margin: 0; }

.card { border-radius: 16px; border: 1px solid var(--border); background: var(--card); padding: 12px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 190px; text-align: center; padding: 32px; border-radius: 24px; border: 2px solid var(--border); background: var(--card); text-decoration: none; color: inherit; transition: all .3s; }
.tile:hover { border-color: hsl(252 100% 64% / .5); }
.tile svg { color: var(--muted-fg); margin-bottom: 16px; }
.tile h4 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.tile p { margin: 0; font-size: 14px; color: var(--muted-fg); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.btn-primary { width: 100%; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 20px 32px; border-radius: 16px; border: 0; font-weight: 700; font-size: 18px; color: #fff; background: linear-gradient(to right, var(--primary), var(--accent)); box-shadow: 0 10px 40px -10px rgb(108 71 255 / .5); transition: all .3s; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 50px -10px rgb(108 71 255 / .7); transform: translateY(-4px); }
.btn-primary:active:not(:disabled) { transform: scale(.95); }
.btn-primary:disabled { background: var(--secondary); color: var(--muted-fg); border: 1px solid var(--border); box-shadow: none; cursor: not-allowed; }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px; border-radius: 24px; border: 2px dashed var(--border); background: hsl(233 24% 6% / .4); cursor: pointer; transition: all .3s ease-out; }
.dropzone:hover { background: hsl(233 24% 6% / .6); border-color: hsl(252 100% 64% / .5); }
.dropzone.drag { border-color: var(--primary); background: hsl(252 100% 64% / .05); box-shadow: 0 0 40px -10px rgb(108 71 255 / .4); }
.dropzone.disabled { background: hsl(233 24% 6% / .2); opacity: .5; cursor: not-allowed; }

.panel { border-radius: 16px; padding: 16px; border: 1px solid; font-size: 14px; font-weight: 500; }
.panel-error { background: hsl(0 84% 60% / .1); border-color: hsl(0 84% 60% / .3); color: var(--destructive); }
.panel-success { background: rgb(34 197 94 / .1); border-color: rgb(34 197 94 / .3); color: rgb(74 222 128); }
.panel-warn { background: rgb(234 179 8 / .1); border-color: rgb(234 179 8 / .3); color: rgb(253 224 71); }
.panel-orange { background: rgb(249 115 22 / .1); border-color: rgb(249 115 22 / .3); color: rgb(253 186 116); }

.progress { position: relative; width: 100%; height: 8px; background: var(--secondary); border-radius: 9999px; overflow: hidden; }
.progress > i { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(to right, var(--primary), var(--accent)); border-radius: 9999px; transition: width .5s ease-out; }
.progress > i.indeterminate { width: 45%; transition: none; animation: nexabill-indeterminate 1.4s ease-in-out infinite; }
@keyframes nexabill-indeterminate { 0% { left: -45%; } 100% { left: 100%; } }

.throbber { position: relative; display: inline-flex; width: 20px; height: 20px; }
.throbber .ping { position: absolute; inset: 0; border-radius: 9999px; background: rgb(255 255 255 / .4); animation: ping 1s cubic-bezier(0, 0, .2, 1) infinite; }
.throbber svg { position: relative; animation: spin 1s linear infinite; }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--muted-fg); }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }

/* Shared top bar (logged-in user + logout) */
.topbar { position: relative; z-index: 20; width: 100%; max-width: 48rem; display: flex; justify-content: flex-end; align-items: center; gap: 16px; min-height: 20px; margin-bottom: -16px; font-size: 13px; color: var(--muted-fg); }
.topbar-back { margin-right: auto; color: var(--foreground); text-decoration: none; padding: 4px 12px; border-radius: 9999px; border: 1px solid var(--border); background: var(--card); transition: border-color .3s; }
.topbar-back:hover { border-color: hsl(252 100% 64% / .5); }
a.badge { text-decoration: none; transition: border-color .3s; }
a.badge:hover { border-color: hsl(252 100% 64% / .5); }
.topbar-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-logout { color: var(--foreground); text-decoration: none; padding: 4px 12px; border-radius: 9999px; border: 1px solid var(--border); background: var(--card); transition: border-color .3s; }
.topbar-logout:hover { border-color: hsl(252 100% 64% / .5); }

/* Splitter page */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-start { display: flex; align-items: flex-start; gap: 12px; }
.section-title { font-size: 20px; font-weight: 700; }
.eyebrow { font-family: var(--font-sans); font-size: 14px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-fg); }
.dropzone { position: relative; overflow: hidden; }
.dropzone .glow { position: absolute; inset: 0; opacity: 0; background: linear-gradient(to bottom, hsl(252 100% 64% / .05), transparent); transition: opacity .5s; pointer-events: none; }
.dropzone:not(.disabled):hover .glow { opacity: 1; }
.dropzone h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.dropzone p { margin: 0; font-size: 14px; color: var(--muted-fg); }
.dropzone .icon-box { background: var(--secondary); padding: 20px; border-radius: 16px; margin-bottom: 24px; border: 1px solid rgb(255 255 255 / .05); box-shadow: 0 20px 25px -5px rgb(0 0 0 / .4); color: var(--muted-fg); transition: transform .3s; display: flex; }
.dropzone:not(.disabled):hover .icon-box { transform: scale(1.1); }
.dropzone.drag .icon-box { transform: translateY(-10px); color: var(--primary); }
.file-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .file-grid { grid-template-columns: 1fr 1fr; } }
.file-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--card); box-shadow: 0 10px 15px -3px rgb(0 0 0 / .3); overflow: hidden; }
.file-card.busy { opacity: .6; }
.file-card .meta { display: flex; align-items: center; gap: 12px; overflow: hidden; min-width: 0; }
.file-card .ficon { background: hsl(252 100% 64% / .1); color: var(--primary); padding: 8px; border-radius: 12px; display: flex; flex-shrink: 0; }
.file-card .fname { margin: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fsize { margin: 0; font-size: 12px; color: var(--muted-fg); }
.icon-btn { border: 0; background: transparent; color: var(--muted-fg); padding: 8px; border-radius: 9999px; display: flex; flex-shrink: 0; transition: all .2s; }
.icon-btn:hover { background: hsl(0 84% 60% / .1); color: var(--destructive); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--primary); background: hsl(252 100% 64% / .1); padding: 4px 12px; border-radius: 9999px; }
.provider { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 32px; border-radius: 24px; border: 2px solid var(--border); background: var(--card); transition: all .3s; }
.provider:hover:not(:disabled) { background: hsl(233 24% 6% / .8); }
.provider:disabled { cursor: not-allowed; opacity: .5; }
.provider.selected { border-color: var(--primary); background: hsl(252 100% 64% / .1); box-shadow: 0 0 30px -5px rgb(108 71 255 / .25); }
.provider .check { position: absolute; top: 16px; right: 16px; color: var(--primary); display: flex; }
.provider .picon { padding: 16px; border-radius: 16px; margin-bottom: 16px; background: var(--secondary); color: var(--foreground); display: flex; transition: background .3s; }
.provider.selected .picon { background: var(--primary); color: #fff; }
.provider h4 { font-size: 24px; font-weight: 700; letter-spacing: -.025em; margin-bottom: 4px; }
.provider p { margin: 0; font-size: 14px; color: var(--muted-fg); }
.panel p { margin: 0; }
.panel-error .row-start { color: var(--destructive); }
.panel-error .row-start svg { margin-top: 2px; flex-shrink: 0; }
.panel-success { padding: 0; overflow: hidden; }
.panel-success .head { display: flex; align-items: center; gap: 12px; padding: 16px; color: rgb(74 222 128); }
.panel-success .head p { flex: 1; }
.panel-success .body { padding: 0 16px 16px; }
.panel-orange { padding: 0; overflow: hidden; }
.panel-orange .head { padding: 16px; color: rgb(253 186 116); }
.panel-orange .head p:first-child { font-weight: 600; }
.panel-orange .head p + p { font-size: 12px; font-weight: 400; color: rgb(253 186 116 / .7); margin-top: 4px; }
.panel-orange .actions { display: flex; gap: 8px; padding: 0 16px 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid transparent; font-size: 14px; font-weight: 600; text-decoration: none; transition: all .2s; }
.btn-retry { align-self: flex-start; background: hsl(252 100% 64% / .2); color: var(--primary); }
.btn-retry:hover { background: hsl(252 100% 64% / .3); }
.btn-download { width: 100%; background: rgb(34 197 94 / .15); border-color: rgb(34 197 94 / .3); color: rgb(134 239 172); }
.btn-download:hover { background: rgb(34 197 94 / .25); }
.btn-kill { flex: 1; background: rgb(249 115 22 / .2); border-color: rgb(249 115 22 / .4); color: rgb(254 215 170); }
.btn-kill:hover { background: rgb(249 115 22 / .3); }
.btn-cancel { background: var(--secondary); border-color: var(--border); color: var(--muted-fg); font-weight: 500; }
.btn-cancel:hover { background: hsl(233 18% 12% / .8); }
.expired { border-radius: 12px; background: rgb(234 179 8 / .1); border: 1px solid rgb(234 179 8 / .3); padding: 12px; }
.expired p { font-size: 12px; color: rgb(253 224 71); font-weight: 500; margin-bottom: 8px; }
.btn-reset { font-size: 12px; padding: 6px 12px; border-radius: 8px; background: rgb(234 179 8 / .15); border-color: rgb(234 179 8 / .3); color: rgb(253 224 71); font-weight: 500; }
.btn-primary.processing { background: linear-gradient(to right, hsl(252 100% 64% / .8), hsl(280 100% 65% / .8)); cursor: not-allowed; box-shadow: none; }
.hint-ready { text-align: center; font-size: 14px; font-weight: 500; color: var(--primary); margin: 0; }
.progress-panel { border-radius: 16px; background: hsl(233 24% 6% / .6); border: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; gap: 16px; backdrop-filter: blur(4px); animation: fade-in .3s ease-out; }
.progress-panel .top { display: flex; justify-content: space-between; font-size: 14px; }
.progress-panel .top .left { color: var(--muted-fg); font-weight: 500; }
.progress-panel .top .right { color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-panel .foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-fg); }
.progress-panel .foot p { margin: 0; }
.reconnect { display: flex; align-items: center; gap: 8px; font-size: 12px; color: rgb(250 204 21 / .8); background: rgb(250 204 21 / .05); border: 1px solid rgb(250 204 21 / .2); border-radius: 12px; padding: 8px 12px; }
.reconnect svg { animation: spin 1s linear infinite; flex-shrink: 0; }
.pb { padding-bottom: 64px; padding-top: 16px; }

/* Forms of the merge / upload screens (additive) */
.form-card { display: flex; flex-direction: column; gap: 20px; padding: 28px; border-radius: 24px; border: 1px solid var(--border); background: var(--card); }
.form-row { display: flex; flex-direction: column; gap: 8px; }
.form-row label { font-weight: 600; }
.form-row input[type="file"] { padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--secondary); color: inherit; font: inherit; }
.file-info { font-size: 14px; color: var(--muted-fg); display: flex; flex-direction: column; gap: 2px; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
