:root {
  --bg: #0a0e1c;
  --card: rgba(28, 34, 56, 0.72);
  --card-2: rgba(38, 45, 72, 0.6);
  --line: rgba(120, 134, 184, 0.22);
  --txt: #eef1fb;
  --muted: #9aa3c4;
  --accent: #6c8cff;
  --accent-2: #a06cff;
  --ok: #34d399;
  --bad: #fb7185;
  --warn: #fcd34d;
  --radius: 20px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
  position: relative; overflow-x: hidden;
}
/* мягкие световые пятна на фоне */
.bg-orb { position: fixed; border-radius: 50%; filter: blur(70px); opacity: .5; z-index: -1; pointer-events: none; }
.orb-a { width: 360px; height: 360px; top: -120px; left: -80px;
  background: radial-gradient(circle, #3a52c8, transparent 70%); }
.orb-b { width: 320px; height: 320px; top: 30%; right: -120px;
  background: radial-gradient(circle, #7b3ec8, transparent 70%); }

.app { max-width: 560px; margin: 0 auto; animation: rise .4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.head { text-align: center; padding: 14px 4px 24px; }
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo span {
  font-size: 30px; font-weight: 700; letter-spacing: .3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { color: var(--muted); font-size: 14.5px; line-height: 1.55; margin: 10px 0 0; }

.controls { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 16px; }
.ctl { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ctl-label { color: var(--muted); font-size: 11.5px; letter-spacing: .2px; }
.seg {
  display: flex; gap: 4px; padding: 4px; border-radius: 13px;
  background: var(--card-2); border: 1px solid var(--line);
}
.seg-btn {
  border: 0; cursor: pointer; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 9px; color: var(--muted);
  background: transparent; transition: color .15s, background .15s;
}
.seg-btn.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.seg-btn:not(.active):hover { color: var(--txt); }

/* список файлов */
.jobs-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 4px 4px; color: var(--muted); font-size: 13px;
}
.jobs { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; }
.job {
  background: var(--card); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px;
  box-shadow: var(--shadow); animation: rise .3s ease both;
  overflow: hidden;            /* длинные имена/ссылки не вылезают за карточку */
}
.job.ok { border-color: rgba(52,211,153,.35); }
.job.bad { border-color: rgba(251,113,133,.35); }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.job-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-stage { flex: none; max-width: 50%; color: var(--muted); font-size: 12.5px; text-align: right; }
.tag { font-weight: 700; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; }
.tag.ok { background: rgba(52,211,153,.15); color: var(--ok); }
.tag.bad { background: rgba(251,113,133,.15); color: var(--bad); }
.job-stage .t { color: var(--muted); font-size: 12px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.job .bar { margin: 12px 0 0; }
/* minmax(0,1fr): колонка может сжиматься уже своего контента — длинные имена/
   ссылки/текст ошибки не распирают карточку за край экрана. */
.job-out { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.job-out:empty { margin-top: 0; }
.dl {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  font-size: 13px; font-weight: 600; padding: 12px 14px; border-radius: 11px;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.dl:active { transform: scale(.99); }
.dl.zip { background: transparent; border: 1px solid var(--line); color: var(--txt); }
.dl-ico { flex: none; font-size: 15px; }
.dl-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-meta { flex: none; font-weight: 500; opacity: .85; font-size: 11.5px; }
.retry {
  width: 100%; cursor: pointer; font-size: 13.5px; font-weight: 600;
  padding: 11px; border-radius: 11px; color: var(--txt);
  background: transparent; border: 1px solid var(--line);
}
.retry:active { transform: scale(.99); }
.job-warn {
  font-size: 12.5px; color: var(--warn);
  background: rgba(252,211,77,.1); border: 1px solid rgba(252,211,77,.2);
  border-radius: 10px; padding: 9px 11px;
}
.job-err {
  font-size: 12.5px; color: var(--bad);
  background: rgba(251,113,133,.1); border: 1px solid rgba(251,113,133,.22);
  border-radius: 10px; padding: 10px 12px;
  word-break: break-word; overflow-wrap: anywhere;   /* длинный текст ошибки переносится, не вылазит */
}
.link { background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px; }
.link:hover { color: var(--txt); }

.drop {
  border: 1.5px dashed var(--line);
  background: linear-gradient(180deg, rgba(28,34,56,.5), rgba(20,25,42,.5));
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 42px 20px; text-align: center; cursor: pointer;
  transition: border-color .18s, transform .08s, box-shadow .18s, background .18s;
}
.drop:hover { border-color: rgba(120,134,184,.4); }
.drop:active { transform: scale(.99); }
.drop.over {
  border-color: var(--accent); background: rgba(40,52,96,.6);
  box-shadow: 0 0 0 4px rgba(108,140,255,.15);
}
.drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ico {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 18px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -8px rgba(108,140,255,.7);
}
.drop:hover .ico { transform: translateY(-2px); transition: transform .18s; }
.drop-title { font-size: 17px; font-weight: 600; }
.drop-hint { color: var(--muted); font-size: 13px; margin-top: 7px; }

.card {
  margin-top: 18px; background: var(--card); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  animation: rise .35s ease both;
}
.hidden { display: none; }

.file-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px; }
.link:hover { color: var(--txt); }

.bar { height: 8px; border-radius: 999px; background: rgba(0,0,0,.35); overflow: hidden; margin: 16px 0 12px; }
.bar-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}
.bar-fill.indeterminate { width: 35%; animation: slide 1.1s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

.stage { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; }
.spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid rgba(154,163,196,.3); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ok-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  background: rgba(52,211,153,.15); color: var(--ok);
}
.badge.bad { background: rgba(251,113,133,.15); color: var(--bad); }
.summary { color: var(--muted); font-size: 13.5px; }

.files { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.files li {
  display: flex; align-items: center; gap: 13px; min-width: 0; overflow: hidden;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 13px 14px;
  animation: rise .3s ease both;
}
.f-ico {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  color: #c3cdff; background: rgba(108,140,255,.14);
}
.files .meta { min-width: 0; flex: 1; }
.files .nm { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .mt { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rng { color: #c3cdff; font-weight: 600; background: rgba(108,140,255,.16); padding: 1px 7px; border-radius: 6px; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); opacity: .6; flex: none; }
.dl {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 9px 14px; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform .08s, filter .15s;
}
.dl:hover { filter: brightness(1.08); }
.dl:active { transform: scale(.96); }

.warn {
  margin-top: 14px; font-size: 13px; color: var(--warn);
  background: rgba(252,211,77,.1); border: 1px solid rgba(252,211,77,.2);
  border-radius: 12px; padding: 11px 13px;
}
.actions { display: flex; gap: 10px; margin-top: 18px; }
.btn {
  flex: 1; text-align: center; text-decoration: none; cursor: pointer;
  padding: 14px 16px; border-radius: 13px; border: 0; font-size: 15px; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--txt); }
.btn.ghost:hover { background: rgba(120,134,184,.1); filter: none; }

.error pre {
  white-space: pre-wrap; word-break: break-word; font-size: 12.5px;
  color: var(--bad); background: rgba(0,0,0,.3); border-radius: 12px; padding: 13px; margin: 13px 0;
}
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; line-height: 1.5; }

/* экран входа */
.login-wrap {
  max-width: 400px; margin: 0 auto; min-height: 82dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; animation: rise .4s ease both;
}
.login-sub { color: var(--muted); font-size: 14px; margin: 2px 0 22px; }
.login-card {
  width: 100%; background: var(--card); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; text-align: left;
}
.login-label { font-size: 13px; color: var(--muted); }
.login-input {
  width: 100%; box-sizing: border-box; font-size: 16px; color: var(--txt);
  background: rgba(0,0,0,.28); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 15px; outline: none; transition: border-color .15s;
}
.login-input:focus { border-color: var(--accent); }
.login-err { font-size: 13px; color: var(--bad); }
.login-btn {
  margin-top: 4px; width: 100%; cursor: pointer; font-size: 16px; font-weight: 700;
  padding: 15px; border: 0; border-radius: 13px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.login-btn:active { transform: scale(.99); }
