:root {
  --bg: #171717;
  --panel: #232323;
  --panel-alt: #1e1e1e;
  --line: #3f3f3f;
  --line-soft: rgba(255,255,255,.08);
  --text: #e7e7e7;
  --muted: #a8a8a8;
  --accent: #2b7d2f;
  --accent-2: #375d3a;
  --warn: #c69a48;
  --danger: #d66a6a;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.cad-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(110,110,110,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110,110,110,.08) 1px, transparent 1px),
    linear-gradient(rgba(40,150,40,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(40,150,40,.04) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px, 140px 140px, 140px 140px;
}

.site-shell {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px 14px 34px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-chip,
.level-up,
.card-link,
.ghost-btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: #202020;
  color: var(--text);
  font-weight: 600;
}

.brand-chip { background: #121212; }
.level-up,
.card-link,
.ghost-btn { color: var(--muted); }
.primary-btn {
  background: #273427;
  border-color: #456545;
  color: #edf5ed;
}

.brand-chip:hover,
.level-up:hover,
.card-link:hover,
.ghost-btn:hover,
.primary-btn:hover {
  filter: brightness(1.05);
}

.card-link--disabled {
  opacity: .55;
  cursor: default;
  pointer-events: none;
  filter: none;
}

.page-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1 0 auto;
}

.hero-panel,
.catalog-group,
.tool-card,
.app-card,
.teaser-panel,
.tool-header-panel,
.modal-box,
.interest-panel,
.simple-state {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
}

.hero-panel,
.catalog-group,
.app-card,
.teaser-panel,
.tool-header-panel,
.modal-box {
  padding: 18px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.hero-quote {
  margin: 0 0 10px;
  color: #d6e6d6;
  font-size: 13px;
  letter-spacing: .01em;
}

.hero-panel h1,
.tool-header-panel h1,
.teaser-panel h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.04;
  font-weight: 600;
}

.hero-lead,
.tool-lead,
.teaser-panel p,
.tool-card p,
.hint-line,
.simple-state span {
  color: var(--muted);
  line-height: 1.65;
}

.hero-lead,
.tool-lead,
.teaser-panel p { margin: 12px 0 0; max-width: 760px; }

.catalog-shell { display: grid; gap: 18px; }
.section-head {
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tool-card { padding: 16px; display: grid; gap: 14px; align-content: start; }
.tool-card h3 { margin: 0; font-size: 22px; font-weight: 600; }
.tool-card__meta,
.tool-card__actions,
.auth-row,
.button-row,
.button-row__left,
.button-row__right,
.card-head-line,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.card-head-line { justify-content: space-between; }
.status-pill,
.interest-pill,
.tool-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: #1b1b1b;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.status-pill--live { color: #dcefdc; border-color: #456545; background: #1d2a1d; }
.status-pill--soon { color: #eadab8; border-color: #6c5732; background: #2b2417; }
.status-pill--interest { color: #dce4ef; border-color: #4a5665; background: #1d232b; }
.interest-pill { text-transform: none; letter-spacing: 0; }

.tool-header-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
  gap: 18px;
  align-items: start;
}
.tool-kicker { margin-bottom: 10px; }
.tool-header-side { display: grid; gap: 14px; align-content: start; }
.usage-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  width: fit-content;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: #161616;
  color: var(--muted);
}
.usage-badge b { font-size: 24px; color: #eff5ef; }
.usage-badge small { color: var(--muted); }
.who { color: var(--muted); font-size: 13px; }

.app-card h2 { margin: 0 0 14px; font-size: 20px; font-weight: 600; }
.grid-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.field-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-alt);
}
.field-card span,
.toggle-line,
.summary,
.hint-line,
.meta,
.note,
.err,
.ok { color: var(--muted); }
.toggle-line { font-size: 13px; }
input[type="text"],
input[type="number"],
input[type="password"],
table input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 2px;
  border: 1px solid #4b4b4b;
  background: #181818;
  color: var(--text);
}
input[type="number"] { appearance: textfield; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.data-table th { text-align: left; color: #ececec; font-weight: 600; }
.col-idx { width: 48px; text-align: right; padding-right: 10px; color: var(--muted); }
.col-len { width: 180px; }
.col-qty { width: 96px; }
.col-name { width: 220px; }
.filepick { display: none; }
.summaryBox {
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #1a1a1a;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  font-weight: 800;
}
.cuts { display: grid; gap: 12px; margin-top: 14px; }
.cutbox {
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: #202020;
}
.cuthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #171717;
  border-bottom: 1px solid var(--line);
}
.cuthead .title,
.cuthead .waste { font-weight: 700; }
.barwrap { padding: 10px 12px; }
.bar {
  position: relative;
  height: 42px;
  border: 1px solid #4b4b4b;
  border-radius: 2px;
  overflow: hidden;
  background: #111;
}
.seg { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; border-right: 2px solid rgba(0,0,0,.42); color: #000; font-weight: 800; }
.seg.green { background: #19ff19; }
.seg.red { background: #ff2a2a; }
.seg .lbl { font-size: clamp(10px, 1.4vw, 14px); padding: 0 6px; white-space: nowrap; }
.seg.small .lbl { display: none; }
.seg.small:hover .lbl { display: block; position: absolute; top: -24px; background: #000; color: #fff; border-radius: 1px; padding: 2px 6px; font-size: 12px; }
.meta { padding: 10px 12px 12px; font-size: 12px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 18px;
}
.modal-box {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
}
.modal-box h3 { margin: 0; font-size: 20px; font-weight: 600; }

.teaser-panel { display: grid; gap: 18px; }
.teaser-head { display: grid; gap: 10px; }
.interest-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.interest-counter {
  display: grid;
  gap: 6px;
  min-width: 220px;
}
.interest-counter span,
.interest-feedback { color: var(--muted); }
.interest-counter strong { font-size: 34px; line-height: 1; }
.interest-feedback.is-done { color: #d9ecd9; }
.simple-state {
  display: grid;
  gap: 8px;
  padding: 16px;
}
.teaser-panel--missing { text-align: center; }

.site-footer {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
}
.site-footer__copy {
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: #90979d;
  font-size: 13px;
  text-align: center;
}

.route-tube .tool-header-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.route-tube .tool-header-side {
  justify-self: end;
  text-align: right;
}

.route-tube .usage-badge {
  margin-left: auto;
}

.route-tube .auth-row {
  justify-content: flex-end;
}

.route-tube .tool-header-panel h1 {
  font-size: clamp(38px, 4.2vw, 54px);
}

.route-tube .tool-lead {
  font-size: 18px;
}

.route-tube .app-card h2 {
  font-size: 22px;
}

.route-tube .field-card {
  gap: 10px;
  padding: 16px;
}

.route-tube .field-card span {
  font-size: 15px;
}

.route-tube input[type="text"],
.route-tube input[type="number"],
.route-tube input[type="password"],
.route-tube table input {
  min-height: 44px;
  padding: 11px 13px;
  font-size: 16px;
}

.route-tube .toggle-line,
.route-tube .hint-line,
.route-tube .summary,
.route-tube .meta,
.route-tube .who {
  font-size: 14px;
}

.route-tube .data-table th,
.route-tube .data-table td {
  padding-top: 11px;
  padding-bottom: 11px;
  font-size: 15px;
}

.route-tube .button-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  justify-content: space-between;
  align-items: flex-start;
}

.route-tube .button-row__left,
.route-tube .button-row__right {
  align-items: flex-start;
}

.route-tube .ghost-btn,
.route-tube .primary-btn,
.route-tube .level-up {
  min-height: 42px;
  font-size: 15px;
}

.route-tube .summaryBox {
  gap: 14px;
}

.route-tube .cuthead {
  padding: 12px 14px;
}

.route-tube .cuthead .title,
.route-tube .cuthead .waste {
  font-size: 18px;
}

.route-tube .bar {
  height: 46px;
}

.route-tube .meta {
  padding-top: 12px;
  padding-bottom: 14px;
}

@media (max-width: 980px) {
  .hero-panel,
  .tool-header-panel,
  .grid-three,
  .tool-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-shell { padding: 14px 10px 24px; }
  .topbar,
  .card-head-line,
  .button-row,
  .cuthead,
  .tool-card__meta,
  .tool-card__actions,
  .auth-row,
  .modal-actions,
  .interest-panel {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-panel h1,
  .tool-header-panel h1,
  .teaser-panel h1 { font-size: 28px; }
  .tool-card h3 { font-size: 20px; }
  .usage-badge { width: 100%; justify-content: center; }
  .route-tube .tool-header-side {
    justify-self: stretch;
    text-align: left;
  }
  .route-tube .usage-badge {
    margin-left: 0;
  }
  .route-tube .auth-row {
    justify-content: flex-start;
  }
  .route-tube .button-row {
    align-items: stretch;
  }
}
