:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #687382;
  --line: #d9dee6;
  --accent: #176b5b;
  --accent-2: #0f4f82;
  --danger: #a33b3b;
  --warn: #8c6416;
  --field: #ffffff;
  --soft: #fafbfc;
  --info: #f8fbfd;
  --log-line: #edf0f4;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080a0d;
  --panel: #101419;
  --ink: #eef3f7;
  --muted: #9aa7b4;
  --line: #26313c;
  --accent: #21a886;
  --accent-2: #64aee8;
  --danger: #ff7f7f;
  --warn: #e5bd62;
  --field: #151b22;
  --soft: #121820;
  --info: #0f1a22;
  --log-line: #202a34;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  border-color: #aab4c2;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.toolbar,
.panel-head,
.actions,
.authorization {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.log-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  font-weight: 800;
}

h2 {
  font-size: 15px;
  font-weight: 800;
}

.toolbar p,
.authorization p,
.muted {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px;
  margin: 18px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.products {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 16px;
}

.product {
  width: 100%;
  text-align: left;
  min-height: 64px;
  display: grid;
  gap: 3px;
}

.product.active {
  border-color: var(--accent-2);
  box-shadow: inset 3px 0 0 var(--accent-2);
}

.product strong,
.product span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product strong {
  font-weight: 800;
}

.editor form {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
  background: var(--field);
}

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

.guide {
  display: grid;
  gap: 4px;
  border: 1px solid #cdd8e4;
  border-left: 4px solid var(--accent-2);
  border-radius: 8px;
  padding: 12px;
  background: var(--info);
}

.guide span,
.advanced p {
  color: var(--muted);
}

.advanced {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--soft);
}

.advanced summary {
  cursor: pointer;
  padding: 12px;
  font-weight: 700;
}

.advanced p {
  margin: 0;
  padding: 0 12px 12px;
}

.advanced label {
  padding: 0 12px 12px;
}

.authorization {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.check input {
  width: 16px;
  min-height: 16px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  min-height: 1px;
  pointer-events: none;
}

.switch span {
  display: block;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #b7bec8;
  position: relative;
}

.switch span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.actions button {
  min-width: 112px;
}

.actions .primary {
  min-width: 92px;
}

.actions .danger {
  margin-left: 0;
}

.pill {
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef1f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.pill.watch {
  background: #e6f3ee;
  color: var(--accent);
}

.pill.pause {
  background: #fff3dc;
  color: var(--warn);
}

.result,
.logs {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  overflow-wrap: anywhere;
}

.result {
  min-height: 46px;
  color: var(--muted);
}

.log {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(140px, 0.7fr) minmax(220px, 2fr);
  gap: 12px;
  align-items: start;
  padding: 11px 0;
  border-bottom: 1px solid var(--log-line);
  min-width: 0;
}

.log code {
  color: var(--accent-2);
  white-space: normal;
  overflow-wrap: anywhere;
}

.log span {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .app {
    padding: 14px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .log-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .layout,
  .grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .log {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
