:root {
  color-scheme: dark;
  --bg: #07090b;
  --panel: #181b1f;
  --panel-2: #20242a;
  --line: #343b45;
  --text: #f2f4f7;
  --muted: #a9b0ba;
  --accent: #43d6a6;
  --accent-2: #f2b84b;
  --danger: #ff6f7d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(67, 214, 166, 0.035), transparent 38%),
    radial-gradient(circle at 85% 0%, rgba(242, 184, 75, 0.045), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.home-view {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 56px;
  align-items: center;
  min-height: 100vh;
  width: min(1240px, calc(100% - 56px));
  margin: 0 auto;
  padding: 54px 0;
  position: relative;
  overflow: hidden;
}

.home-view::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(circle at 88% 8%, rgba(67, 214, 166, 0.18), transparent 26%),
    radial-gradient(circle at 8% 62%, rgba(67, 214, 166, 0.075), transparent 34%),
    linear-gradient(115deg, #030706 0%, #080b0f 50%, #030407 100%);
}

.home-rings {
  position: absolute;
  left: -300px;
  bottom: 80px;
  z-index: -1;
  width: 820px;
  height: 820px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 22px, rgba(67, 214, 166, 0.09) 23px 24px);
  opacity: 0.28;
  transform: rotate(-20deg);
  mask-image: linear-gradient(90deg, #000, transparent 76%);
}

.home-copy h1 {
  max-width: 720px;
  margin: 22px 0 22px;
  font-size: clamp(44px, 5.2vw, 78px);
  line-height: 0.98;
  position: relative;
  text-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.home-copy h1 span {
  color: #ffffff;
  text-shadow: 0 0 34px rgba(67, 214, 166, 0.12);
}

.home-copy h1 em {
  color: var(--accent);
  font-style: normal;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 52px;
  color: var(--text);
  font-size: 23px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-brand b {
  padding: 2px 8px;
  border-radius: 7px;
  background: var(--accent);
  color: #092117;
  font-size: 14px;
}

.brand-icon {
  display: inline-block;
  width: 28px;
  height: 28px;
  clip-path: polygon(18% 0, 100% 50%, 18% 100%, 0 82%, 48% 50%, 0 18%);
  background: linear-gradient(135deg, #7dffc9, #10bc80);
  box-shadow: 0 0 24px rgba(67, 214, 166, 0.5);
}

.home-pill {
  display: inline-flex;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid rgba(67, 214, 166, 0.22);
  border-radius: 999px;
  background: rgba(67, 214, 166, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-text {
  max-width: 720px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.55;
}

.home-text strong {
  color: var(--text);
  font-weight: 850;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 34px;
  max-width: 680px;
}

.home-features div {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 3px 14px;
  align-items: center;
}

.home-features i {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(67, 214, 166, 0.1);
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
}

.home-features strong {
  font-size: 14px;
}

.home-features span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.card-label {
  display: inline-flex;
  color: var(--text);
  font-size: 28px;
  font-weight: 900;
}

.login-card {
  align-self: center;
  display: grid;
  gap: 22px;
  padding: 34px;
  border: 1px solid rgba(67, 214, 166, 0.34);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(24, 30, 33, 0.78), rgba(15, 18, 22, 0.9));
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.login-head {
  display: flex;
  align-items: center;
  gap: 20px;
}

.login-icon {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(67, 214, 166, 0.3), rgba(67, 214, 166, 0.06));
  color: var(--accent);
  font-size: 28px;
}

.login-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 22px;
}

.home-button,
.secondary {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.account-box {
  display: grid;
  gap: 2px;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.9);
  text-align: right;
}

.account-box span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 64px);
  line-height: 0.95;
  letter-spacing: 0;
}

.status {
  min-width: 152px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.82);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.status.ok {
  color: var(--accent);
}

.status.bad {
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(430px, 0.9fr) minmax(520px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.control-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.95);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121417;
}

.mode {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.mode.active {
  background: var(--accent);
  color: #071410;
}

.mode.has-active {
  position: relative;
  padding-right: 28px;
}

.mode.has-active::after {
  content: attr(data-active-count);
  position: absolute;
  top: 6px;
  right: 7px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.mode.has-active::before {
  content: "";
  position: absolute;
  top: 11px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  animation: pulse 1.1s ease-in-out infinite;
}

.field,
.drop {
  display: grid;
  gap: 7px;
}

.field span,
.drop span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101215;
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 92px;
  padding: 13px;
  line-height: 1.45;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
}

.media-grid,
.settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.reference-only {
  display: grid;
  gap: 12px;
}

.reference-only .media-grid {
  grid-template-columns: 1fr;
}

.drop {
  min-height: 108px;
  padding: 14px;
  border: 1px dashed #4b5562;
  border-radius: 8px;
  background: #111418;
}

.drop input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #071410 !important;
  cursor: pointer;
  font-size: 13px !important;
  font-weight: 850 !important;
}

.drop.dragging {
  border-color: var(--accent);
  background: rgba(67, 214, 166, 0.1);
}

.drop.has-file {
  border-color: rgba(67, 214, 166, 0.76);
}

.drop small {
  color: var(--muted);
  line-height: 1.35;
}

.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-chip {
  display: grid;
  grid-template-columns: 54px minmax(80px, 1fr);
  gap: 6px;
  align-items: center;
  width: min(100%, 220px);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1215;
}

.preview-chip img,
.file-kind {
  width: 54px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: #070809;
}

.file-kind {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
}

.preview-chip span {
  color: var(--text);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-chip button {
  grid-column: 2;
  width: fit-content;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #101215;
  font-weight: 700;
}

.toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-2);
  color: #171106;
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
}

.submit:disabled {
  cursor: wait;
  opacity: 0.62;
}

.arrow {
  font-size: 22px;
}

.preview-panel {
  overflow: hidden;
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 520px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    #0c0d0f;
  background-size: 28px 28px;
}

.preview-stage video {
  width: 100%;
  max-height: 72vh;
  background: #000;
}

.empty,
.working {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.empty strong,
.working strong {
  color: var(--text);
  font-size: 20px;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.global-working {
  max-width: 460px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.meta-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.result-meta strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.download {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #071410;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.logs {
  min-height: 160px;
  max-height: 260px;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: #101215;
  color: #cbd2dc;
  white-space: pre-wrap;
}

.job-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.job-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
}

.job-group > summary {
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.job-group > summary span {
  color: var(--muted);
}

.job-group-list {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.job-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.job-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
}

.job-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.job-click {
  cursor: pointer;
}

.job-click:hover strong {
  color: var(--accent);
}

.job-item span {
  color: var(--muted);
  font-size: 12px;
}

.job-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.job-item a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.job-item button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.admin-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.95);
  box-shadow: var(--shadow);
}

.admin-panel > summary {
  cursor: pointer;
  padding: 14px 18px;
  color: var(--text);
  font-weight: 900;
}

.admin-content {
  display: grid;
  gap: 16px;
  padding: 0 18px 18px;
}

.admin-head,
.admin-form,
.admin-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.admin-head h2,
.admin-panel h3 {
  margin: 0;
}

.admin-form {
  align-items: end;
  justify-content: start;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.admin-grid details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
}

.admin-grid summary {
  cursor: pointer;
  padding: 12px;
  color: var(--text);
  font-weight: 850;
}

.admin-grid details .admin-list {
  padding: 0 12px 12px;
}

.admin-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.admin-overview {
  display: grid;
  gap: 14px;
  padding: 0 12px 12px;
}

.metric-grid,
.chart-grid {
  display: grid;
  gap: 12px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-grid div,
.chart-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1215;
  padding: 12px;
}

.metric-grid strong {
  display: block;
  font-size: 22px;
}

.metric-grid span,
.chart-empty {
  color: var(--muted);
  font-size: 12px;
}

.chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-grid h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.8fr) minmax(120px, 2fr) 44px;
  gap: 8px;
  align-items: center;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
}

.bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row b {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #07090b;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), rgba(242, 184, 75, 0.9));
}

.admin-row {
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
}

.admin-row strong,
.admin-row span,
.admin-row small {
  overflow-wrap: anywhere;
}

.admin-row span,
.admin-row small {
  color: var(--muted);
  font-size: 12px;
}

.ledger-row {
  display: grid;
  justify-content: stretch;
}

.admin-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  max-height: 620px;
  overflow: auto;
  padding: 0 12px 12px;
}

.gallery-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1215;
}

.gallery-card video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 360px;
  background: #000;
  object-fit: contain;
}

.gallery-meta {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.gallery-meta strong,
.gallery-meta span,
.gallery-meta small {
  overflow-wrap: anywhere;
}

.gallery-meta span,
.gallery-meta small {
  color: var(--muted);
  font-size: 12px;
}

.gallery-card a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin: 0 10px 10px;
  border: 1px solid rgba(67, 214, 166, 0.35);
  border-radius: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

@media (max-width: 880px) {
  .metric-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }
}

.account-box .version {
  display: block;
  justify-self: end;
  color: rgba(242, 244, 247, 0.78);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 2px;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    transform: scale(1.7);
    opacity: 0;
  }
}


@media (max-width: 980px) {
  .home-view,
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    min-height: 380px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1440px);
    padding-top: 16px;
  }

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

  .mode-tabs,
  .media-grid,
  .settings {
    grid-template-columns: 1fr;
  }

  .result-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-grid,
  .admin-form {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
}
