:root {
  --red: #e10600;
  --red-dark: #b10500;
  --ink: #1c1e22;
  --muted: #5e656e;
  --line: #d9dee5;
  --panel: #ffffff;
  --work: #e8edf2;
  --silver: #d7dbe1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--work);
  font-family: "Segoe UI", Arial, sans-serif;
}

.banner {
  background: #111114;
  text-align: center;
  margin: 0;
  border: 0;
  padding: 0 16px 14px;
}

.banner-logo {
  display: block;
  width: min(440px, 84vw);
  height: auto;
  margin: 0 auto;
}

.banner-tag {
  margin: 8px 0 0;
  color: #e4e7ec;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.2;
}

.workspace {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.2fr);
  gap: 22px;
}

.panel {
  background: var(--panel);
  border: 1px solid #f4f7fa;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(28, 33, 40, 0.06);
  padding: 22px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

select, .dropzone, button {
  font: inherit;
}

select, .combo input {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  padding: 0 12px;
  color: var(--ink);
}

.combo {
  position: relative;
}

.combo input {
  padding-right: 42px;
  font: inherit;
}

.combo-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 40px;
  height: 44px;
  border: 0;
  border-radius: 0 10px 10px 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.combo-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(28, 33, 40, 0.12);
}

.combo-menu li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.combo-menu li.is-active,
.combo-menu li:hover {
  background: #f4f6f8;
}

.combo-menu li.is-selected {
  color: var(--red);
  font-weight: 700;
}

.ecu-wrap { max-width: 880px; margin: 32px auto; padding: 0 16px 48px; }
.ecu-list { columns: 2; margin: 16px 0 0; padding: 0; list-style: none; }
.ecu-list li { break-inside: avoid; padding: 7px 0; border-bottom: 1px solid var(--line); }

.dropzone {
  position: relative;
  margin-top: 18px;
  min-height: 168px;
  border: 1.5px dashed #b7c0ca;
  border-radius: 14px;
  background: #f7f9fb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 18px;
  color: var(--muted);
}

.dropzone strong {
  color: var(--ink);
  font-size: 16px;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone.is-locked {
  opacity: 0.55;
  background: #f1f3f6;
}

.dropzone.is-locked input {
  cursor: not-allowed;
}

.dropzone.is-hot {
  border-color: var(--red);
  background: #fff5f4;
}

.status {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status.error { color: #9d1c16; }
.status.ok { color: #0d6b3a; }

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.test {
  color: #7a4b00;
  background: #fff1d6;
}

.badge.live {
  color: #085c32;
  background: #e5f7ee;
}

.tree {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
  max-height: 420px;
  overflow: auto;
}

.folder {
  border-bottom: 1px solid #eef1f5;
}

.folder:last-child { border-bottom: 0; }

.tree-tools { display: flex; gap: 8px; margin: 0 0 8px; }
.tree-tools button { background: #1b1c20; color: #d7dbe2; border: 1px solid #3a3d42; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.folder > button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 650;
}
.folder-icon { color: #f5c518; }
.map-icon { margin-right: 6px; }
.folder ul ul { margin-left: 16px; }

.folder ul {
  list-style: none;
  margin: 0;
  padding: 0 14px 12px 34px;
}

.folder li {
  padding: 4px 0;
  color: #30343a;
}

.folder.is-collapsed ul { display: none; }

.preview-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.buy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.price {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

#download {
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: white;
  min-width: 132px;
  height: 46px;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(225, 6, 0, 0.22);
}

#download:hover { background: var(--red-dark); }

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 28px;
  background: #111114;
  color: white;
  border: 0;
  margin: 0;
}
.nav-brand { color: white; font-weight: 800; text-decoration: none; letter-spacing: 0.04em; }
.nav-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-items: center; }
.lang-select {
  color: #f2f3f5;
  background: #111114;
  border: 1px solid #3a3d44;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}
.nav-links a, .nav-logout, .ghost {
  color: #f2f3f5;
  background: transparent;
  border: 1px solid #3a3d44;
  border-radius: 999px;
  padding: 7px 12px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.auth-wrap { max-width: 560px; margin: 32px auto; padding: 0 16px 40px; }
.auth-card h1 { margin-top: 0; }
.auth-card label, .stack label { display: block; margin: 12px 0 6px; color: var(--muted); }
.note { color: var(--muted); line-height: 1.5; }
.auth-card input, .stack input, .filters input, .filters select, .stack select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
}
.stack input[type="file"] { height: auto; padding: 8px 0; border: 0; }
.stack textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}
.hint { color: var(--muted); margin: 6px 0 0; }
.problem { white-space: pre-wrap; line-height: 1.5; }
.secret { display: flex; gap: 8px; }
.secret input { flex: 1; }
.secret .ghost, .stack .ghost { color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; }
.check input, .filters input[type="checkbox"] { width: auto; height: auto; }
button:disabled, select:disabled, input:disabled { opacity: 0.55; cursor: not-allowed; }
.primary, #buy {
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: white;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}
.auth-links { color: var(--muted); }
.shell { display: grid; grid-template-columns: 240px 1fr; gap: 18px; max-width: 1280px; margin: 0 auto; padding: 20px; }
.side { background: #16161a; color: white; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 6px; min-height: 70vh; }
.side a { color: #e8eaee; text-decoration: none; border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.side a svg { width: 16px; height: 16px; flex: 0 0 16px; }
.side a.active, .tabs a.active { background: var(--red); color: white; }
.side-title { margin: 4px 8px 12px; font-weight: 800; letter-spacing: 0.08em; }
.view { min-height: 70vh; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: #f7f8fa; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.stat span { color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 8px 10px; vertical-align: top; white-space: nowrap; }
.facts { display: grid; grid-template-columns: 180px 1fr; gap: 8px 12px; }
.filters, .tabs, .pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.stack { max-width: 420px; }
.chart { margin-top: 18px; }
.chart-svg { width: 100%; height: 160px; background: #f7f8fa; border-radius: 12px; }

@media (max-width: 900px) {
  .workspace, .shell {
    grid-template-columns: 1fr;
  }

  .preview-foot { flex-direction: column; align-items: stretch; }
  .buy-row { margin-left: 0; justify-content: space-between; }
}

@media (max-width: 700px) {
  .ecu-list { columns: 1; }
  .banner { padding: 0 12px 12px; }
  .banner-tag { font-size: 11px; letter-spacing: 0.08em; }
}
