﻿:root {
  --bg: #0e0e0e;
  --surface: #202020;
  --surface-2: #151515;
  --line: #3f3f3f;
  --line-soft: #3c3c3c;
  --text: #fff;
  --muted: #c9c9c9;
  --accent: #2f2f2f;
  --accent-2: #767676;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", system-ui, sans-serif;
}

.shell {
  width: min(calc(100vw - 28px), 980px);
  max-width: 980px;
  margin: 0 0 0 14px;
  padding: 14px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  margin-bottom: 12px;
}

.hero, .card {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  min-height: 28px;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.hero__main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: 0 0 auto;
  opacity: .7;
  filter: grayscale(1) saturate(0) brightness(1.35) contrast(.8);
}

.logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 28px;
  color: inherit;
  text-decoration: none;
}

.logo-link:hover .logo {
  opacity: 1;
}

.tool-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 1px solid rgba(180,180,180,.42);
  border-radius: 16px;
  color: #fff;
  background: #6f6f6f;
  font-size: 28px;
  font-weight: 800;
}

h1, h2, h3, p { margin: 0; }
h1 {
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 700;
}

.hero p, .logic-head p, .card p, .empty {
  color: var(--muted);
  line-height: 1.6;
}

.hero__main p {
  max-width: 660px;
  margin-top: 12px;
  font-size: 15px;
}

.hero__note {
  width: 360px;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  background: rgba(17, 17, 17, .92);
}

.hero__note span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.hero__note strong {
  display: block;
  line-height: 1.45;
}

.tabs {
  display: flex;
  gap: 7px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.shell > .tabs:not(.tool-tabs) {
  margin: 0 0 14px;
}

.tab, .button, .text-button {
  border: 0;
  font: inherit;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}

.tab {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
}

.tab:hover, .button:hover, .card:hover {
  border-color: #5a5a5a;
}

.tab:active, .button:active { transform: translateY(1px); }
.tab.is-active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.view { display: none; }
.view.is-active { display: block; }

.tool-tabs {
  overflow-x: auto;
  padding-bottom: 2px;
}

.tool-tabs .tab {
  border-color: transparent;
}

.tool-tabs .tab:hover,
.tool-tabs .tab.is-active {
  border-color: transparent;
}

.card {
  padding: 18px;
}

.card + .card {
  margin-top: 12px;
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.card__head p {
  max-width: 980px;
}

.card h2 {
  font-size: 22px;
  line-height: 1.25;
  margin-bottom: 8px;
  color: #fff;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 140px;
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.drop-zone.is-over {
  border-color: var(--accent-2);
  background: #1c1c1c;
  transform: translateY(-1px);
}

.drop-zone input { display: none; }
.drop-zone__title {
  font-size: 18px;
  font-weight: 700;
}
.drop-zone__hint {
  margin-top: 6px;
  color: var(--muted);
}

.file-list {
  width: min(760px, 100%);
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #1a1a1a;
}

.targets-box {
  width: 100%;
  min-height: 150px;
  margin-top: 16px;
  padding: 14px 16px;
  resize: vertical;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #0f0f0f;
  font: 15px/1.55 Consolas, "Segoe UI", monospace;
}

.targets-box:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(160,160,160,.16);
}

.targets-box::placeholder,
.source-input::placeholder {
  color: #bdbdbd;
  opacity: 1;
}

.source-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, .7fr) minmax(150px, .55fr) minmax(150px, .55fr);
  gap: 14px;
  margin-top: 16px;
}

.source-grid--compact {
  grid-template-columns: repeat(2, minmax(150px, 220px));
}

.source-grid label,
.source-paste {
  display: grid;
  gap: 7px;
}

.source-grid span,
.source-paste span {
  color: #e0e0e0;
  font-size: 13px;
}

.source-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: #0f0f0f;
  font: inherit;
}

.source-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(160,160,160,.14);
}

.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.date-preset {
  min-height: 32px;
  padding: 0 11px;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #151515;
  font: inherit;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.date-preset:hover {
  border-color: #5a5a5a;
  background: #262626;
}

.date-preset:active {
  transform: translateY(1px);
}

.date-preset.is-active {
  border-color: var(--accent);
  background: rgba(160,160,160,.24);
}

.source-paste {
  margin-top: 16px;
}

.source-textarea {
  min-height: 105px;
  margin-top: 0;
}

.price-url-grid {
  display: grid;
  grid-template-columns: minmax(240px, .65fr) minmax(420px, 1.35fr);
  gap: 16px;
  margin-top: 16px;
}

.price-url-grid label {
  display: grid;
  gap: 7px;
}

.price-url-grid span {
  color: #e0e0e0;
  font-size: 13px;
}

.inline-hint {
  color: var(--muted);
  line-height: 1.45;
}

.hub-card {
  min-height: 0;
}

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

.tool-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 112px;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #151515;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.tool-card:hover {
  border-color: #5a5a5a;
  background: #242424;
}

.tool-card:active {
  transform: translateY(1px);
}

.tool-card span {
  font-size: 17px;
  font-weight: 800;
}

.tool-card strong {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
}

.options-row--end {
  justify-content: flex-end;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.switch input { display: none; }
.switch__track {
  position: relative;
  width: 54px;
  height: 30px;
  border-radius: 999px;
  background: #2a2a2a;
  transition: background .16s ease;
}

.switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform .16s ease;
}

.switch input:checked + .switch__track {
  background: var(--accent);
}
.switch input:checked + .switch__track .switch__knob {
  transform: translateX(24px);
}

.button {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  color: var(--text);
  border: 1px solid var(--line-soft);
  background: transparent;
}

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

.button--secondary:hover, .text-button:hover {
  background: #262626;
}

.text-button {
  color: var(--muted);
  background: transparent;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 14px;
  color: #d0d0d0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #171717;
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6f6f6f, #b8b8b8);
  transition: width .25s ease;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .85fr);
  align-items: stretch;
  gap: 18px;
  margin-top: 18px;
}

.work-grid {
  grid-template-columns: 1fr;
}

.result-card,
.log-card {
  min-height: 0;
}

.result-card--wide {
  min-height: 620px;
}

.log-card {
  display: flex;
  flex-direction: column;
}

.result-files {
  display: grid;
  gap: 10px;
}

.summary-box {
  display: none;
}

.score-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #151515;
}

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

.score-row strong {
  color: #dedede;
}

.score-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.table-preview {
  margin: 14px 0;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.preview-tabs button,
.preview-actions button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #151515;
  font: inherit;
  cursor: pointer;
}

.preview-tabs button.is-active {
  color: #fff;
  border-color: var(--accent);
  background: rgba(160,160,160,.24);
}

.preview-actions {
  flex: 0 0 auto;
}

.preview-fullscreen {
  min-height: 34px;
}

.preview-table-wrap {
  height: min(62vh, 680px);
  min-height: 460px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #111;
}

.preview-table {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
  line-height: 1.35;
}

.preview-table th,
.preview-table td {
  padding: 9px 10px;
  border-right: 1px solid rgba(160,160,160,.18);
  border-bottom: 1px solid rgba(160,160,160,.18);
  vertical-align: top;
  overflow: hidden;
}

.preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  min-width: 70px;
  color: #eeeeee;
  background: #262626;
  text-align: left;
  font-weight: 700;
  user-select: none;
}

.preview-table td {
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-table tr.row--cheaper td {
  background: rgba(190, 190, 190, .14);
}

.preview-table tr.row--expensive td {
  background: rgba(255, 255, 255, .07);
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 3px;
  width: 1px;
  background: rgba(190, 190, 190, .2);
}

.col-resizer:hover::after,
.is-resizing-column .col-resizer::after {
  background: rgba(220,220,220,.82);
}

.is-resizing-column {
  cursor: col-resize;
  user-select: none;
}

.table-preview.is-fullscreen {
  position: fixed;
  inset: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(190,190,190,.42);
  border-radius: 12px;
  background: #0f0f0f;
  box-shadow: 0 30px 110px rgba(0,0,0,.62);
}

.table-preview.is-fullscreen .preview-table-wrap {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
}

.table-preview.is-fullscreen .preview-toolbar {
  flex: 0 0 auto;
}

.file-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #151515;
}

.log {
  display: none;
  flex: 1 1 auto;
  min-height: 380px;
  max-height: none;
  overflow: auto;
  margin: 0;
  padding-right: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #d0d0d0;
  line-height: 1.5;
  font-family: Consolas, monospace;
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: rgba(190, 190, 190, .35) rgba(255,255,255,.04);
}

.log::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.log::-webkit-scrollbar-track {
  background: rgba(255,255,255,.04);
  border-radius: 999px;
}

.log::-webkit-scrollbar-thumb {
  background: rgba(190, 190, 190, .35);
  border-radius: 999px;
}

.log::-webkit-scrollbar-thumb:hover {
  background: rgba(220, 220, 220, .55);
}

.logic-head {
  max-width: 780px;
  margin-bottom: 20px;
}
.logic-head h2 {
  font-size: 26px;
  margin-bottom: 10px;
}

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

.logic-card {
  max-width: 800px;
}

.logic-card h3 {
  margin-bottom: 14px;
  font-size: 18px;
}
.logic-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}
.logic-card li + li { margin-top: 8px; }

@media (max-width: 860px) {
  .shell {
    width: calc(100vw - 24px);
    max-width: none;
    margin: 0 auto;
    padding-top: 12px;
  }
  .topbar {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .hero, .card__head, .options-row, .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero {
    flex-direction: row;
    align-items: center;
  }
  .hero__note { width: 100%; }
  .grid, .logic-grid, .source-grid, .price-url-grid, .hub-grid { grid-template-columns: 1fr; }
  .button { width: 100%; }
  .tabs { overflow-x: auto; }
}

