body {
  font-family: var(--font-sans);
  background: radial-gradient(circle at top right, #ffffff 0%, var(--bg) 40%, #ecf1f6 100%);
  margin: 0;
  padding: 16px;
  color: var(--text);
}

body.home-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 235, 0.18), transparent 28%),
    linear-gradient(160deg, #f7faff 0%, #eef3f9 52%, #e8eef6 100%);
}

body.editor-shell {
  padding-top: 6px;
}

body.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 235, 0.16), transparent 26%),
    linear-gradient(160deg, #f8fbff 0%, #eef4fb 52%, #e7eef6 100%);
}

.app {
  max-width: 1220px;
  margin: 0 auto;
}

.home-page {
  width: min(1280px, 100%);
}

.home-panel {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 32px;
  padding: clamp(26px, 4vw, 40px);
  box-shadow: 0 28px 54px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(14px);
}

.home-panel::after {
  content: "";
  position: absolute;
  inset: auto -120px -140px auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 111, 235, 0.12), rgba(31, 111, 235, 0));
  pointer-events: none;
}

.home-intro {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.home-brand img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.home-intro h1 {
  margin: 12px 0 10px;
  font-size: clamp(32px, 4.6vw, 52px);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.home-intro p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.home-choice-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.home-choice-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
  padding: 22px;
  border-radius: 26px;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 246, 253, 0.88));
  border: 1px solid rgba(31, 111, 235, 0.1);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-choice-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.12);
  border-color: rgba(31, 111, 235, 0.2);
}

.home-choice-index {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.home-choice-card strong {
  font-size: clamp(24px, 2.4vw, 34px);
  letter-spacing: -0.04em;
}

.home-choice-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.home-choice-cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 190px;
  padding: 12px 16px;
  border-radius: 999px;
  background: #0f5ecf;
  color: #fff;
  font-weight: 700;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: 8px;
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-content {
  flex: 1;
}

.app-header img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.app-header h1 {
  font-size: 22px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.app-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  max-width: 640px;
  line-height: 1.35;
}

.app-header-editor {
  align-items: center;
}

.app-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.app-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.app-switcher a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.app-switcher a.is-active,
.app-switcher a[aria-current="page"] {
  color: #fff;
  background: var(--accent);
}

.app-switcher a:not(.is-active):hover {
  color: var(--text);
  background: rgba(15, 94, 207, 0.08);
}

.session-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.session-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.session-badge-admin {
  background: rgba(15, 94, 207, 0.12);
  color: #0f5ecf;
}

.session-badge-demo {
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
}

.session-user {
  color: var(--text);
  font-weight: 700;
}

.session-logout {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.login-page {
  width: min(460px, 100%);
}

.login-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  padding: 32px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-brand img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.login-card h1 {
  margin: 0 0 12px;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 8px;
}

.login-field span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.login-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
}

.login-field input:focus {
  outline: 2px solid rgba(15, 94, 207, 0.18);
  border-color: rgba(15, 94, 207, 0.28);
}

.login-error {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.14);
  color: #b91c1c;
  font-weight: 600;
}

.login-submit {
  width: 100%;
  justify-content: center;
}

.channel-dashboard {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(31, 111, 235, 0.18), transparent 32%),
    linear-gradient(135deg, #0f1f35 0%, #17365f 48%, #20497c 100%);
  color: #fff;
  border-radius: 28px;
  padding: 28px;
  margin-bottom: var(--space-5);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.channel-dashboard::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.channel-dashboard-copy {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.dashboard-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.channel-dashboard h2 {
  margin: 16px 0 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.channel-dashboard p {
  margin: 0;
  max-width: 700px;
  color: rgba(235, 243, 255, 0.82);
  line-height: 1.6;
}

.channel-dashboard-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.channel-card {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 22px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.07));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.channel-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.1));
}

.channel-card strong {
  font-size: 24px;
  letter-spacing: -0.03em;
}

.channel-card p {
  margin: 0;
  color: rgba(235, 243, 255, 0.78);
  font-size: 14px;
  line-height: 1.55;
}

.channel-card-badge {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.channel-card.is-active {
  background: linear-gradient(180deg, rgba(130, 193, 255, 0.3), rgba(255, 255, 255, 0.1));
  border-color: rgba(164, 215, 255, 0.48);
}

.controls,
.actions-footer {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.controls {
  margin-bottom: 8px;
}

.actions-footer {
  margin-top: 6px;
  padding: 10px 14px;
}

#dropzone {
  border: 2px dashed var(--border);
  padding: 12px 14px;
  text-align: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--bg);
  transition: border-color 0.2s ease, background-color 0.2s ease;
  font-size: 13px;
}

#dropzone.hover {
  border-color: var(--accent);
  background: #edf4ff;
}

.file-picker {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}

.upload-compact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 8px;
  border-radius: 14px;
  border: 1px dashed rgba(15, 94, 207, 0.2);
  background: rgba(15, 94, 207, 0.04);
  color: var(--muted);
  white-space: nowrap;
}

.upload-compact.hover {
  border-color: var(--accent);
  background: #edf4ff;
}

.upload-compact-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.upload-compact-icon {
  min-width: 44px;
  width: 44px;
  justify-content: center;
  padding: 4px;
}

.file-picker-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(15, 94, 207, 0.14);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  font-size: 12px;
}

.file-picker-icon {
  min-height: 30px;
  width: 30px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.actions-main {
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px 10px;
  flex-wrap: wrap;
}

.actions-left,
.actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.actions-main-primary {
  align-items: flex-end;
}

.actions-main-advanced {
  align-items: stretch;
  flex-wrap: nowrap;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 10px;
  width: 100%;
}

.actions-primary-cta {
  margin-left: auto;
}

.actions-bottom-save {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: stretch;
}

.actions-bottom-save .btn-primary {
  min-height: 100%;
  width: 100%;
}

.actions-right {
  justify-content: flex-end;
}

.quick-control {
  flex: 1 1 240px;
  min-width: 210px;
  max-width: 260px;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15, 94, 207, 0.04), rgba(15, 94, 207, 0.02));
  border: 1px solid rgba(15, 94, 207, 0.12);
}

.quick-control label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.quick-control label span {
  color: var(--text);
  font-weight: 800;
}

.quick-control input[type="range"] {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 999px;
  outline: none;
}

.quick-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.quick-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.resolution-label {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}

.resolution-select {
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.btn-primary {
  min-width: 210px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 18px 34px rgba(15, 94, 207, 0.24);
}

.btn-primary-top {
  width: 100%;
  min-width: 0;
  min-height: 46px;
}

.btn-secondary {
  background: #eff4fc;
  color: #153258;
  padding: 8px 12px;
  font-size: 13px;
}

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  filter: none;
  transform: none;
}

button:disabled:hover {
  filter: none;
  transform: none;
}

@media (max-width: 1024px) {
  body {
    padding: var(--space-3);
  }

  .app-header {
    flex-wrap: wrap;
  }

  .home-choice-grid {
    grid-template-columns: 1fr;
  }

  .app-switcher {
    width: 100%;
    justify-content: center;
  }

  .app-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .session-tools {
    width: 100%;
    justify-content: space-between;
  }

  .channel-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .actions-main {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-control,
  .actions-left,
  .actions-right {
    width: 100%;
    max-width: none;
  }

  .upload-compact {
    width: 100%;
    justify-content: space-between;
  }

  .actions-primary-cta {
    margin-left: 0;
  }

  .resolution-select,
  .btn-primary {
    flex: 1;
    min-width: 180px;
  }

  .actions-main-advanced {
    grid-template-columns: 1fr;
  }
}
