:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #07111f;
  --muted: #64748b;
  --line: #dbe5f2;
  --blue: #2563eb;
  --purple: #7c3aed;
  --green: #16a34a;
  --radius: 18px;
  --shadow: 0 22px 70px rgba(15, 23, 42, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 14%, rgba(37, 99, 235, .28), transparent 32%),
    radial-gradient(circle at 82% 22%, rgba(124, 58, 237, .22), transparent 28%),
    url("/static/brand/login-bg.png") center/cover no-repeat;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 28px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.auth-logo { display: block; width: 150px; margin: 0 auto 22px; }
.auth-card h1 { margin: 0 0 8px; font-size: 34px; letter-spacing: 0; text-align: center; }
.auth-card p { margin: 0 0 24px; color: var(--muted); text-align: center; }

.form-stack { display: grid; gap: 12px; }
input, textarea, select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #f8fafc;
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: rgba(37, 99, 235, .55); box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: 0 14px 34px rgba(37, 99, 235, .22);
}
.btn:hover { filter: brightness(.96); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.soft { color: #1d4ed8; background: #eaf1ff; box-shadow: none; }
.btn.small { min-height: 36px; padding-inline: 13px; font-size: 13px; }

.app-body { display: grid; grid-template-columns: 286px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 26px 18px;
  color: #e5efff;
  background: #061126;
  border-right: 1px solid rgba(255,255,255,.08);
}
.brand img { width: 164px; display: block; margin: 0 auto; }
.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  color: #fff;
  background: rgba(255,255,255,.08);
}
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a {
  padding: 12px 14px;
  border-radius: 12px;
  color: #aab8d3;
  font-weight: 750;
}
.sidebar nav a:hover { color: #fff; background: rgba(37, 99, 235, .22); }
.sidebar-user {
  margin-top: auto;
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.05);
}
.sidebar-user span { color: #91a4c6; font-size: 13px; }
.sidebar-user a { color: #93c5fd; font-weight: 800; }

.main { min-width: 0; padding: 38px min(46px, 5vw); }
.notice { margin-bottom: 18px; padding: 12px 14px; border-radius: 12px; background: #dcfce7; color: #166534; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: 0; }
.page-head h1 { margin-top: 5px; font-size: clamp(36px, 5vw, 58px); }
.page-head p, .section-row p { margin: 6px 0 0; color: var(--muted); }

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 12px 44px rgba(15, 23, 42, .06);
}

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}
.stat span, .stat small { display: block; color: var(--muted); }
.stat strong { display: block; margin: 8px 0 4px; font-size: 30px; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }

.video-list { display: grid; gap: 10px; }
.video-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 180px auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}
.video-thumb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}
.video-thumb svg { width: 22px; height: 22px; fill: currentColor; }
.video-row strong, .video-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-row span { color: var(--muted); font-size: 13px; }
.video-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; width: fit-content; padding: 6px 10px; border-radius: 99px; color: #1d4ed8; font-size: 12px; font-weight: 850; background: #dbeafe; }
.pill.green { color: #166534; background: #dcfce7; }
.pill.blue { color: #1d4ed8; background: #dbeafe; }
.status-block { display: grid; gap: 7px; }
.mini-progress, .progress-line { overflow: hidden; height: 7px; border-radius: 99px; background: rgba(37, 99, 235, .12); }
.mini-progress i, .progress-line i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8, #7c3aed, #2563eb);
  background-size: 220% 100%;
  animation: flow 1.1s linear infinite;
  transition: width .25s ease;
}
.hidden { display: none !important; }
.empty { padding: 34px; color: var(--muted); text-align: center; }

.upload-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.upload-layout-v2 { display: block; }
.upload-card { display: grid; gap: 18px; }
.upload-select-card { padding: 18px; }
.upload-bottom-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.drop-zone {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 390px;
  border: 2px dashed rgba(37, 99, 235, .32);
  border-radius: 22px;
  color: #fff;
  cursor: pointer;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, .35), transparent 42%),
    linear-gradient(135deg, #07111f, #102754);
}
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-zone video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.drop-zone.has-preview video { opacity: 1; }
.drop-zone.has-preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, rgba(2,6,23,.72)); }
.drop-content { position: relative; z-index: 2; display: grid; place-items: center; gap: 8px; text-align: center; }
.upload-orb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  color: #93c5fd;
  background: rgba(255,255,255,.10);
}
.drop-zone.is-uploading .upload-orb { animation: pulseLift 1s ease-in-out infinite; }
.upload-fields { display: grid; gap: 12px; opacity: .45; pointer-events: none; }
.upload-fields.ready { opacity: 1; pointer-events: auto; }
.upload-fields label, .config-form p, .embed-code { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 750; }
.progress-card { position: sticky; top: 22px; display: grid; gap: 12px; }
.progress-card h2 { font-size: 25px; }
.progress-card p { margin: 0; color: var(--muted); }
.progress-line { height: 10px; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.progress-meta strong { color: var(--blue); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
.embed-preview { overflow: hidden; margin: 18px 0; aspect-ratio: 16 / 9; border-radius: 18px; background: #020617; }
.embed-preview iframe { width: 100%; height: 100%; border: 0; }
.embed-code textarea { min-height: 110px; font-family: ui-monospace, Consolas, monospace; }
.public-id-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.public-id-box span { color: var(--muted); font-size: 13px; font-weight: 800; }
.public-id-box strong { font-family: ui-monospace, Consolas, monospace; color: var(--blue); }
.config-form { display: grid; gap: 12px; }
.config-form p { margin: 0; }
.config-form input[type="checkbox"] { width: auto; }
.config-form input[type="color"] { width: 72px; height: 44px; padding: 4px; }
.form-section { display: grid; gap: 12px; }
.form-section label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.color-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.toggle-list { display: grid; gap: 10px; }
.switch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}
.switch-row span { display: grid; gap: 2px; }
.switch-row strong { color: var(--ink); font-size: 14px; }
.switch-row small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.switch-row i {
  position: relative;
  display: block;
  width: 58px;
  height: 32px;
  border-radius: 999px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  transition: background .2s ease, border-color .2s ease;
}
.switch-row i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .18);
  transition: transform .2s ease;
}
.switch-row input:checked + i {
  background: #dcfce7;
  border-color: #86efac;
}
.switch-row input:checked + i::after { transform: translateX(26px); }

.player-body { margin: 0; background: #020617; }
.clipfy-player { position: relative; width: 100vw; min-height: 100vh; display: grid; place-items: center; overflow: hidden; background: #020617; }
.clipfy-player video { width: 100%; height: 100vh; object-fit: contain; background: #000; }
.clipfy-player.fit-cover video { object-fit: cover; }
.sound-gate {
  position: absolute;
  display: grid;
  place-items: center;
  gap: 8px;
  min-width: 260px;
  padding: 26px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--player-primary), var(--player-secondary));
  box-shadow: 0 24px 70px rgba(0,0,0,.38);
  cursor: pointer;
}
.sound-gate img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  filter: grayscale(1) saturate(.12) contrast(1.14) brightness(1.08);
  mix-blend-mode: screen;
  animation: pulseLift 1.1s ease-in-out infinite;
}
.player-compact .sound-gate {
  min-width: 230px;
  padding: 18px 22px;
  border-radius: 18px;
}
.player-compact .sound-gate img {
  width: 56px;
  height: 56px;
}
.player-compact .sound-gate strong {
  font-size: 15px;
  line-height: 1.2;
}
.player-compact .fake-progress {
  left: 14px;
  right: 14px;
  bottom: 10px;
}
.player-brand { position: absolute; top: 16px; right: 16px; padding: 10px 12px; border-radius: 14px; background: rgba(2,6,23,.62); backdrop-filter: blur(10px); }
.player-brand img { height: 28px; }
.player-cta { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); padding: 14px 18px; border-radius: 14px; color: #fff; font-weight: 900; background: linear-gradient(135deg, var(--player-primary), var(--player-secondary)); }
.fake-progress {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,.22);
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
}
.fake-progress.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.fake-progress span {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--player-primary), var(--player-secondary));
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}
.fake-progress b {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--player-primary), transparent 72%), 0 4px 12px rgba(0,0,0,.28);
  transform: translate(-50%, -50%);
  will-change: left;
}
.player-pending { min-height: 100vh; display: grid; place-content: center; gap: 12px; padding: 24px; color: #fff; text-align: center; background: #020617; }
.player-pending .progress-line { width: min(420px, 80vw); }

@keyframes flow { to { background-position: 220% 50%; } }
@keyframes pulseLift { 50% { transform: translateY(-3px) scale(1.04); } }

@media (max-width: 980px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .sidebar-toggle { display: grid; place-items: center; position: absolute; top: 22px; right: 18px; }
  .stats-grid, .upload-layout, .detail-grid { grid-template-columns: 1fr; }
  .video-row { grid-template-columns: 48px minmax(0, 1fr); }
  .video-row .status-block, .video-row .btn { grid-column: 2; }
}

.field-label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 850;
}
.remember-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #475569;
  font-size: 13px;
  font-weight: 750;
}
.remember-row input { width: 16px; height: 16px; accent-color: var(--blue); }

.sidebar {
  gap: 18px;
  padding: 24px 17px 18px;
  background:
    radial-gradient(circle at 50% 0, rgba(37, 99, 235, .24), transparent 28%),
    linear-gradient(180deg, #081631 0%, #050b1d 100%);
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar-toggle svg,
.nav-link svg,
.sidebar-logout svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-nav {
  display: grid;
  gap: 7px;
  padding-top: 4px;
}
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #8fa0be;
  font-weight: 800;
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}
.sidebar .nav-link:hover {
  color: #f8fbff;
  background: rgba(37, 99, 235, .14);
  border-color: rgba(147, 197, 253, .16);
  transform: translateX(2px);
}
.sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(37,99,235,.36), rgba(124,58,237,.20));
  border-color: rgba(147, 197, 253, .22);
  box-shadow: inset 3px 0 0 #60a5fa;
}
.sidebar-plan {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(147, 197, 253, .14);
  border-radius: 16px;
  background: rgba(15, 23, 42, .58);
}
.sidebar-plan span,
.sidebar-plan a,
.sidebar-user-info span {
  color: #91a4c6;
  font-size: 12px;
  font-weight: 750;
}
.sidebar-plan strong { color: #fff; font-size: 18px; }
.sidebar-plan a { color: #93c5fd; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  padding: 12px;
}
.sidebar-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}
.sidebar-user-info { min-width: 0; flex: 1; display: grid; gap: 1px; }
.sidebar-user-info strong,
.sidebar-user-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: #93a4c2;
}
.sidebar-logout:hover { color: #fff; background: rgba(239, 68, 68, .18); }

.analytics-grid,
.plans-grid,
.extras-grid {
  display: grid;
  gap: 16px;
}
.analytics-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr); }
.plans-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.usage-list { display: grid; gap: 18px; }
.usage-list > div { display: grid; gap: 8px; }
.usage-list span, .usage-list strong { font-weight: 850; }
.usage-list span { color: var(--muted); }
.rank-list { display: grid; gap: 8px; }
.rank-list a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.rank-list a span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #dbeafe;
  font-weight: 900;
}
.rank-list a strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list a em { color: var(--muted); font-style: normal; font-size: 13px; font-weight: 800; }
.plan-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 44px rgba(15, 23, 42, .06);
}
.plan-card.active {
  border-color: rgba(37, 99, 235, .42);
  box-shadow: 0 20px 60px rgba(37, 99, 235, .14);
}
.plan-card > span,
.integration-pill {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #dbeafe;
  font-size: 12px;
  font-weight: 900;
}
.integration-pill { color: #92400e; background: #fef3c7; }
.integration-pill.ready { color: #166534; background: #dcfce7; }
.plan-card h2 { font-size: 34px; }
.plan-card p { margin: 0; color: var(--muted); font-size: 13px; }
.plan-card ul { display: grid; gap: 9px; margin: 0; padding-left: 18px; color: #334155; }
.extra-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}
.extras-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.extra-card span { color: var(--blue); font-weight: 900; }
.extra-card small { color: var(--muted); }
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .7fr);
  gap: 16px;
  margin-bottom: 18px;
}
.settings-section { margin-bottom: 18px; }
.account-card,
.billing-card { display: grid; gap: 12px; }
.account-card p,
.billing-card p { margin: 0; color: var(--muted); }
.account-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.account-facts div,
.billing-status {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.account-facts span,
.billing-status span { color: var(--muted); font-size: 12px; font-weight: 800; }
.billing-status strong { color: var(--ink); }
.daily-list { display: grid; gap: 8px; }
.daily-list > div:not(.empty) {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.daily-list span { color: var(--muted); font-weight: 800; }
.daily-list strong { color: var(--blue); }

.layout-cinema .sound-gate {
  min-width: 310px;
  border-radius: 18px;
  background: rgba(2, 6, 23, .78);
  backdrop-filter: blur(14px);
}
.layout-glass .sound-gate {
  border-color: rgba(255,255,255,.34);
  background: linear-gradient(135deg, rgba(37,99,235,.74), rgba(124,58,237,.62));
  backdrop-filter: blur(18px);
}
.layout-clean .sound-gate {
  min-width: 230px;
  border-radius: 999px;
  color: #061126;
  background: rgba(255,255,255,.94);
}
.layout-clean .sound-gate img { mix-blend-mode: multiply; filter: grayscale(1) contrast(1.1); }

@media (max-width: 1180px) {
  .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .plans-grid, .extras-grid { grid-template-columns: 1fr; }
  .sidebar-plan { margin-top: 0; }
  .upload-bottom-grid, .account-facts, .color-grid { grid-template-columns: 1fr; }
}
