:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel-2: #f4f4f3;
  --line: rgba(24, 24, 27, 0.1);
  --text: #18181b;
  --muted: #71717a;
  --dim: #a1a1aa;
  --accent: #f45137;
  --accent-2: #e95b43;
  --success: #16865b;
  --danger: #c84335;
  --warning: #a76c15;
  --shadow: 0 20px 60px rgba(24, 24, 27, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.dashboard-body {
  background:
    radial-gradient(circle at 82% -10%, rgba(255, 85, 61, .08), transparent 29rem),
    var(--bg);
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: 244px;
  flex-direction: column;
  padding: 30px 20px 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  width: max-content;
  color: var(--text);
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -.025em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 24px rgba(255, 85, 61, .24);
}

.brand-mark i {
  display: block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid white;
}

.nav { display: grid; gap: 5px; margin-top: 58px; }
.nav-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #71717a;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.nav-item > span { color: #a1a1aa; font-size: 18px; text-align: center; }
.nav-item small {
  min-width: 22px;
  padding: 3px 6px;
  border-radius: 99px;
  background: #f0f0ef;
  color: #71717a;
  font-size: 9px;
  text-align: center;
}
.nav-item:hover, .nav-item.active { background: #f3f3f2; color: #18181b; }
.nav-item.active > span { color: var(--accent-2); }

.server-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafaf9;
}
.server-status { display: flex; gap: 8px; align-items: center; color: #3f3f46; font-size: 11px; font-weight: 700; }
.server-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(88,211,154,.09); }
.server-card p { margin: 9px 0 0; color: #71717a; font-size: 9px; line-height: 1.55; }

.logout-form { margin-top: 10px; }
.logout-form button {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: #71717a;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.logout-form button:hover { color: #18181b; }

.main-content { width: min(1040px, calc(100% - 292px)); margin-left: max(268px, calc((100% - 244px - 1040px) / 2 + 244px)); padding: 58px 0 38px; }
.mobile-header { display: none; }
.dashboard-view[hidden] { display: none; }

.page-heading {
  display: flex;
  gap: 30px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 42px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.page-heading h1 { margin: 0; font-size: clamp(36px, 4.7vw, 57px); line-height: 1.03; letter-spacing: -.055em; }
.stats { display: grid; grid-template-columns: repeat(3, auto); gap: 25px; padding-bottom: 4px; }
.stats div { min-width: 65px; }
.stats strong { display: block; color: #27272a; font-size: 18px; font-weight: 740; letter-spacing: -.03em; }
.stats span { display: block; margin-top: 3px; color: #71717a; font-size: 9px; font-weight: 650; text-transform: uppercase; }

.panel {
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-title { display: flex; gap: 14px; align-items: center; }
.section-title .eyebrow { margin-bottom: 5px; color: #71717a; }
.section-title h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.step-number {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 102, 77, .25);
  border-radius: 10px;
  background: rgba(255, 85, 61, .07);
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 800;
}

.session-panel {
  display: grid;
  grid-template-columns: 1fr minmax(260px, .72fr);
  gap: 28px;
  align-items: center;
  margin-bottom: 16px;
  scroll-margin-top: 25px;
}
.settings-heading { margin-bottom: 30px; }
.settings-intro { max-width: 560px; margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.session-description { max-width: 610px; margin: 17px 0 0; color: #71717a; font-size: 11px; line-height: 1.65; }
.session-description strong { color: #3f3f46; }
.session-description code, .session-copy code { color: #52525b; font-size: .92em; }
.session-copy details { margin-top: 11px; color: #71717a; font-size: 10px; }
.session-copy summary { width: max-content; color: #52525b; cursor: pointer; }
.session-copy ol { margin: 10px 0 0; padding-left: 20px; line-height: 1.65; }
.session-actions { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fafaf9; }
.session-badge { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; color: var(--warning); font-size: 10px; font-weight: 750; }
.session-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(239,185,95,.08); }
.session-badge.connected { color: var(--success); }
.session-badge.connected i { box-shadow: 0 0 0 4px rgba(88,211,154,.08); }
#cookies-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#cookies-file { position: absolute; overflow: hidden; width: 1px; height: 1px; opacity: 0; }
.file-picker { overflow: hidden; padding: 11px 12px; border: 1px dashed rgba(24,24,27,.2); border-radius: 9px; color: #71717a; font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.file-picker:hover { border-color: rgba(244,81,55,.45); color: #27272a; }
#cookies-upload { min-width: 112px; padding: 0 12px; font-size: 9px; }
.session-delete { margin-top: 10px; padding: 0; border: 0; background: transparent; color: #71717a; font-size: 9px; cursor: pointer; }
.session-delete:hover { color: var(--danger); }
.session-delete[hidden] { display: none; }
.session-message { min-height: 12px; margin: 8px 0 0; color: #71717a; font-size: 9px; }
.session-message.error { color: var(--danger); }
.session-message.success { color: var(--success); }
.create-panel { scroll-margin-top: 25px; }

.url-row { display: flex; gap: 10px; margin-top: 22px; }
.url-field {
  display: flex;
  flex: 1;
  gap: 11px;
  align-items: center;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafaf9;
  transition: border-color 150ms, box-shadow 150ms;
}
.url-field:focus-within { border-color: rgba(255, 118, 95, .55); box-shadow: 0 0 0 4px rgba(255,85,61,.06); }
.link-icon { color: #a1a1aa; font-size: 22px; transform: rotate(-25deg); }
.url-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.url-field input::placeholder { color: #a1a1aa; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 11px;
  font-weight: 730;
  cursor: pointer;
  transition: transform 150ms, background 150ms, opacity 150ms;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; }
.button-secondary { min-width: 145px; padding: 0 20px; background: #27272a; color: #ffffff; font-size: 12px; }
.button-secondary:hover:not(:disabled) { background: #3f3f46; }

.status { display: none; margin: 14px 2px 0; color: #52525b; font-size: 11px; }
.status.visible { display: flex; gap: 8px; align-items: center; }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }
.status.loading::before {
  width: 11px;
  height: 11px;
  border: 2px solid rgba(24,24,27,.13);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  content: "";
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.editor { display: grid; grid-template-columns: .82fr 1.28fr; gap: 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.editor[hidden] { display: none; }
.video-card, .cut-panel { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fafaf9; }
.thumbnail-wrap { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 9px; background: #e4e4e7; }
.thumbnail-wrap img { width: 100%; height: 100%; object-fit: cover; }
.duration-badge { position: absolute; right: 7px; bottom: 7px; padding: 4px 6px; border-radius: 5px; background: rgba(0,0,0,.8); color: #fff; font-size: 9px; font-variant-numeric: tabular-nums; }
.video-copy { padding: 13px 2px 1px; }
.video-copy p, .cut-heading p { margin: 0 0 6px; color: #71717a; font-size: 9px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.video-copy h3 { display: -webkit-box; overflow: hidden; margin: 0 0 10px; font-size: 14px; line-height: 1.35; letter-spacing: -.015em; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.video-copy a { color: #71717a; font-size: 10px; text-decoration: none; }
.video-copy a:hover { color: #18181b; }
.cut-heading { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.cut-heading h3 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.clip-length { flex: 0 0 auto; padding: 6px 8px; border-radius: 7px; background: rgba(255,85,61,.09); color: var(--accent-2); font-size: 9px; font-weight: 750; }

.timeline { position: relative; height: 32px; margin-top: 25px; }
.timeline-base, .timeline-selection { position: absolute; top: 13px; right: 0; left: 0; height: 5px; border-radius: 99px; }
.timeline-base { background: #e4e4e7; }
.timeline-selection { right: auto; background: linear-gradient(90deg, var(--accent), #ff8a62); }
.range { position: absolute; top: 0; left: 0; width: 100%; height: 32px; margin: 0; pointer-events: none; appearance: none; background: transparent; }
.range::-webkit-slider-runnable-track { height: 5px; background: transparent; }
.range::-moz-range-track { height: 5px; background: transparent; }
.range::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -6px; border: 4px solid var(--accent); border-radius: 50%; background: white; box-shadow: 0 2px 10px rgba(24,24,27,.28); pointer-events: auto; cursor: grab; appearance: none; }
.range::-moz-range-thumb { width: 11px; height: 11px; border: 4px solid var(--accent); border-radius: 50%; background: white; box-shadow: 0 2px 10px rgba(24,24,27,.28); pointer-events: auto; cursor: grab; }
.range-start { z-index: 3; }
.range-end { z-index: 4; }
.timeline-labels { display: flex; justify-content: space-between; color: #71717a; font-size: 8px; }

.time-fields { display: grid; grid-template-columns: 1fr auto 1fr; gap: 9px; align-items: end; margin-top: 19px; }
.time-fields label > span { display: block; margin: 0 0 6px 2px; color: #71717a; font-size: 9px; font-weight: 650; }
.time-input-wrap { display: flex; align-items: center; height: 41px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #ffffff; }
.time-input-wrap:focus-within { border-color: rgba(255,118,95,.55); }
.time-input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }
.time-input-wrap small { color: #a1a1aa; font-size: 7px; }
.arrow { padding-bottom: 12px; color: #a1a1aa; }
.button-primary { width: 100%; min-height: 46px; gap: 9px; margin-top: 17px; background: linear-gradient(105deg, var(--accent), #ff6d4f); color: #ffffff; box-shadow: 0 12px 25px rgba(255,85,61,.15); font-size: 12px; }
.button-primary:hover:not(:disabled) { box-shadow: 0 14px 30px rgba(255,85,61,.23); }
.limit-note { margin: 9px 0 0; color: #71717a; font-size: 8px; text-align: center; }

.history-section { scroll-margin-top: 25px; margin-top: 48px; }
.history-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.refresh-button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: #ffffff; color: #71717a; font-size: 10px; cursor: pointer; }
.refresh-button:hover { color: #18181b; border-color: rgba(24,24,27,.2); }
.jobs-list { display: grid; gap: 9px; }
.job-card { display: grid; grid-template-columns: 126px 1fr auto; gap: 15px; align-items: center; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: #ffffff; transition: border-color 150ms, transform 150ms, box-shadow 150ms; }
.job-card:hover { border-color: rgba(24,24,27,.16); box-shadow: 0 10px 30px rgba(24,24,27,.05); transform: translateY(-1px); }
.job-thumb { position: relative; overflow: hidden; width: 126px; aspect-ratio: 16 / 9; border-radius: 8px; background: #e4e4e7; }
.job-thumb img { width: 100%; height: 100%; object-fit: cover; }
.job-thumb > span { position: absolute; right: 5px; bottom: 5px; padding: 3px 5px; border-radius: 4px; background: rgba(0,0,0,.76); color: #fff; font-size: 8px; }
.job-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: #a1a1aa; }
.job-main { min-width: 0; }
.job-topline { display: flex; gap: 9px; align-items: center; }
.job-topline time { color: #71717a; font-size: 8px; }
.job-status { display: inline-flex; gap: 5px; align-items: center; color: #71717a; font-size: 8px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.job-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.job-status.completed { color: var(--success); }
.job-status.active { color: var(--accent-2); }
.job-status.queued { color: var(--warning); }
.job-status.failed { color: var(--danger); }
.job-status.expired { color: #71717a; }
.job-main h3 { overflow: hidden; margin: 6px 0 4px; font-size: 13px; font-weight: 680; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; }
.job-range { margin: 0; color: #71717a; font-size: 9px; }
.job-error { margin: 5px 0 0; color: var(--danger); font-size: 9px; line-height: 1.35; }
.job-progress { overflow: hidden; height: 3px; margin-top: 9px; border-radius: 99px; background: #e4e4e7; }
.job-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ff986a); transition: width 350ms; }
.job-actions { display: flex; gap: 7px; align-items: center; }
.job-download { padding: 8px 11px; border-radius: 8px; background: rgba(255,85,61,.1); color: var(--accent-2); font-size: 9px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.job-download:hover { background: rgba(255,85,61,.16); }
.job-wait { min-width: 34px; color: #71717a; font-size: 9px; text-align: right; }
.job-delete { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #a1a1aa; font-size: 16px; cursor: pointer; }
.job-delete:hover { background: rgba(24,24,27,.05); color: var(--danger); }

.empty-state { padding: 55px 20px; border: 1px dashed var(--line); border-radius: 15px; color: #71717a; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state > span { font-size: 28px; }
.empty-state h3 { margin: 11px 0 5px; color: #3f3f46; font-size: 14px; }
.empty-state p { margin: 0; font-size: 10px; }

footer { display: flex; justify-content: space-between; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: #a1a1aa; font-size: 9px; }
footer span { color: #71717a; font-weight: 750; }
footer p { margin: 0; }

.sidebar-backdrop { display: none; }
.menu-button { border: 0; background: transparent; color: #52525b; font-size: 20px; }

/* Login */
.login-body { display: grid; overflow: hidden; place-items: center; background: #f7f7f5; }
.login-glow { position: fixed; z-index: -1; width: 470px; height: 470px; top: -240px; border-radius: 50%; background: rgba(255,85,61,.15); filter: blur(100px); }
.login-shell { width: min(420px, calc(100% - 30px)); }
.login-brand { margin: 0 auto 25px; }
.login-card { padding: 35px; border: 1px solid var(--line); border-radius: 20px; background: #ffffff; box-shadow: 0 30px 90px rgba(24,24,27,.12); }
.login-card h1 { margin: 0; font-size: 32px; letter-spacing: -.045em; }
.login-intro { margin: 9px 0 27px; color: #71717a; font-size: 12px; }
.login-card label > span { display: block; margin: 0 0 7px 2px; color: #52525b; font-size: 10px; font-weight: 650; }
.login-card input { width: 100%; height: 49px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #fafaf9; color: var(--text); }
.login-card input:focus { border-color: rgba(255,118,95,.55); box-shadow: 0 0 0 4px rgba(255,85,61,.06); }
.login-card .button-primary { justify-content: space-between; padding: 0 16px; margin-top: 13px; }
.login-error { margin-top: 10px; color: var(--danger); font-size: 10px; }
.login-foot { margin: 17px 0 0; color: #a1a1aa; font-size: 9px; text-align: center; }

.sr-only { position: absolute; overflow: hidden; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .sidebar { width: 215px; }
  .main-content { width: calc(100% - 255px); margin-left: 235px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .session-panel { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .sidebar { width: min(280px, 82vw); transform: translateX(-102%); transition: transform 200ms; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 15; inset: 0; background: rgba(24,24,27,.36); }
  .sidebar-backdrop.visible { display: block; }
  .main-content { width: min(100% - 26px, 620px); margin: 0 auto; padding-top: 17px; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 55px; }
  .page-heading { margin-bottom: 30px; }
  .stats { gap: 19px; }
  .panel { padding: 16px; }
  #cookies-form { grid-template-columns: 1fr; }
  #cookies-upload { min-height: 40px; }
  .url-row { flex-direction: column; }
  .button-secondary { min-height: 47px; }
  .job-card { grid-template-columns: 100px 1fr; }
  .job-thumb { width: 100px; }
  .job-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .job-download { flex: 1; text-align: center; }
}

@media (max-width: 430px) {
  .page-heading h1 { font-size: 38px; }
  .stats { width: 100%; justify-content: space-between; }
  .time-input-wrap small { display: none; }
  .job-card { grid-template-columns: 85px 1fr; gap: 11px; }
  .job-thumb { width: 85px; }
  footer { gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
