:root {
  color-scheme: light;
  --bg: #eef1f0;
  --panel: #fff;
  --ink: #18201e;
  --muted: #68716e;
  --line: #d8dfdc;
  --soft: #f4f7f6;
  --accent: #0c7462;
  --accent-dark: #07594b;
  --blue: #315b8a;
  --danger: #a23a35;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.workspace { width: min(1220px, calc(100vw - 32px)); margin: 24px auto; display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 18px; }
.controlPanel, .resultPanel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 34px rgba(31, 49, 44, .08); }
.controlPanel { padding: 22px; }
.resultPanel { min-height: calc(100vh - 48px); padding: 22px; }
.appHeader { display: flex; align-items: center; gap: 13px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.mark { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--ink); font-weight: 850; font-size: 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: 21px; letter-spacing: 0; }
h2 { margin-top: 4px; font-size: 22px; letter-spacing: 0; }
.appHeader p, .sectionTitle span, .taskMessage { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
label { display: block; margin-top: 14px; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; margin-top: 7px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; outline: none; }
textarea { resize: vertical; min-height: 138px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(12, 116, 98, .12); }
.connection { margin-top: 16px; padding: 11px 12px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.connection summary { cursor: pointer; font-size: 13px; font-weight: 800; }
.twoCol { display: grid; grid-template-columns: 1fr 112px; gap: 12px; }
.check { display: flex; align-items: center; gap: 9px; margin-top: 10px; color: var(--muted); font-weight: 600; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
fieldset { margin: 16px 0 0; padding: 0; border: 0; }
legend { margin-bottom: 7px; font-size: 13px; font-weight: 700; }
.segments { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.segments button { min-height: 36px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.segments button.active { background: #fff; color: var(--accent); box-shadow: 0 1px 4px rgba(30, 45, 41, .14); }
.referenceSection { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.sectionTitle { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sectionTitle strong, .sectionTitle span { display: block; }
.dropZone { position: relative; min-height: 128px; margin-top: 10px; display: grid; place-items: center; overflow: hidden; border: 1px dashed #aebbb7; border-radius: 8px; background: var(--soft); cursor: pointer; text-align: center; }
.dropZone:hover { border-color: var(--accent); }
.dropZone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropZone span b, .dropZone span small { display: block; }
.dropZone span b { color: var(--accent); font-size: 14px; }
.dropZone span small { margin-top: 5px; color: var(--muted); font-weight: 500; }
.dropZone img { width: 100%; height: 210px; object-fit: contain; background: #e8edeb; }
.urlInput { color: var(--muted); font-weight: 600; }
.iconButton { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--danger); font-size: 22px; cursor: pointer; }
.primary, .secondary, .smallButton { border: 0; border-radius: 7px; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.primary { width: 100%; min-height: 48px; margin-top: 16px; background: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.secondary { min-height: 42px; padding: 0 18px; background: var(--blue); white-space: nowrap; }
.smallButton { min-height: 34px; padding: 0 13px; background: #e7efed; color: var(--accent-dark); }
button:disabled { cursor: wait; opacity: .62; }
.formStatus { min-height: 20px; margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.formStatus.error { color: var(--danger); }
.resultHeader { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.statusBadge { padding: 7px 10px; border-radius: 999px; background: #edf1f0; color: var(--muted); font-size: 12px; font-weight: 800; }
.statusBadge.processing { background: #e6f0f8; color: #315b8a; }
.statusBadge.completed { background: #e3f3ed; color: #08705b; }
.statusBadge.failed { background: #f8e8e6; color: var(--danger); }
.emptyState { min-height: 430px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.emptyState strong { color: var(--ink); font-size: 17px; }
.emptyState p { margin-top: 7px; font-size: 13px; }
.playMark { width: 62px; height: 62px; margin-bottom: 15px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--soft); color: var(--accent); padding-left: 4px; }
.taskView { margin-top: 18px; }
.progressInfo { padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.progressInfo > div:first-child { display: flex; justify-content: space-between; font-size: 13px; }
.progressTrack { height: 8px; margin-top: 11px; overflow: hidden; border-radius: 4px; background: #dce4e1; }
.progressTrack span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .35s ease; }
.taskIdRow { margin-top: 12px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 8px; }
.taskIdRow span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.taskIdRow code { display: block; max-width: 530px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.videoWrap { margin-top: 16px; }
.videoWrap video { display: block; width: 100%; max-height: 680px; border-radius: 8px; background: #111; }
.resultActions { display: flex; gap: 10px; margin-top: 10px; }
.resultActions a { padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--accent-dark); text-decoration: none; font-size: 13px; font-weight: 750; }
.taskMessage { margin-top: 12px; }
.manualQuery { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.queryRow { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 10px; }
.queryRow input { margin: 0; }
pre { margin: 18px 0 0; max-height: 360px; overflow: auto; padding: 14px; border-radius: 8px; background: #202522; color: #eaf4f0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .workspace { width: min(680px, calc(100vw - 24px)); margin: 12px auto; grid-template-columns: 1fr; }
  .resultPanel { min-height: 560px; }
  .emptyState { min-height: 300px; }
}

@media (max-width: 480px) {
  .controlPanel, .resultPanel { padding: 16px; }
  .twoCol { grid-template-columns: 1fr; gap: 0; }
  .segments { grid-template-columns: 1fr; }
  .taskIdRow { align-items: flex-start; }
  .taskIdRow code { max-width: 230px; }
}
