:root {
  color-scheme: light;
  --bg: #eef3f5;
  --surface: #ffffff;
  --surface-2: #f6faf9;
  --ink: #13201f;
  --ink-2: #30413f;
  --muted: #6d7c7a;
  --border: #d9e4e2;
  --border-strong: #b8c8c5;
  --accent: #ffb000;
  --teal: #0d7c75;
  --teal-dark: #0a625d;
  --green: #15803d;
  --red: #c62828;
  --shadow: 0 22px 55px rgba(23, 43, 41, .11);
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(13, 124, 117, .16), transparent 30%),
    linear-gradient(135deg, #f7faf9 0%, var(--bg) 54%, #fff5dc 100%);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: #0c1817;
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08), 0 8px 24px rgba(0, 0, 0, .14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #34d399);
  color: #0c1817;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: .04em;
}

.brand small {
  color: rgba(255, 255, 255, .58);
  font-size: 11px;
  text-transform: uppercase;
}

.status-dot {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .86);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.page {
  width: min(1320px, calc(100% - 32px));
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .68fr);
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.hero-image,
.item-panel,
.calc-grid,
.result-panel,
.logs-page,
.message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
}

.lede {
  max-width: 720px;
  margin: 14px 0 18px;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1.45;
}

.hero-image {
  margin: 0;
  overflow: hidden;
  background: #fff;
}

.hero-image img {
  width: 100%;
  height: 100%;
  min-height: 250px;
  display: block;
  object-fit: cover;
}

.scan-form {
  display: grid;
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 900;
}

.scan-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 120px;
  gap: 10px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

input,
select,
button {
  min-height: 48px;
  border-radius: 12px;
  font-size: 14px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 176, 0, .2);
}

button {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), #34d399);
  color: #0c1817;
  cursor: pointer;
  font-weight: 900;
  padding: 0 16px;
}

button:hover {
  filter: saturate(1.08) brightness(.98);
}

button:disabled {
  cursor: wait;
  opacity: .65;
}

.ghost {
  width: max-content;
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, .72);
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  min-height: 0;
  align-items: stretch;
}

.calculator-column {
  display: grid;
  grid-template-rows: auto auto auto minmax(48px, auto);
  gap: 12px;
  min-height: 0;
}

.tab-page { display: block; }

.item-panel {
  padding: 16px;
}

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.item-head h2 {
  max-height: 54px;
  overflow: hidden;
  font-size: 22px;
  line-height: 1.2;
}

.pill {
  border: 1px solid #c9eee8;
  border-radius: 999px;
  background: #e6f8f5;
  color: var(--teal-dark);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

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

.facts div,
.result-panel div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 13px;
}

.facts span,
.result-panel span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.facts strong,
.result-panel strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 110px 130px;
  gap: 10px;
  align-items: end;
  padding: 16px;
}

.result-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 160px;
  gap: 10px;
  align-items: stretch;
  padding: 16px;
}

.result-panel button {
  min-height: 100%;
  background: #0c1817;
  color: #fff;
}

.total-card {
  border-color: #9de8d4 !important;
  background: #edfdf8 !important;
}

.total-card strong {
  color: var(--green);
  font-size: 24px;
}

.message {
  min-height: 50px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
  padding: 12px 14px;
}

.message.error {
  border-color: #fecaca;
  background: #fff5f5;
  color: var(--red);
}

.message.good {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--green);
}

.hidden { display: none; }

.logs-page {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 14px;
}

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

.logs-toolbar h2 {
  font-size: 18px;
}

.logs-toolbar .ghost {
  min-height: 36px;
  padding: 0 12px;
}

.log-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
}

.log-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.log-card.good,
.log-card.status-200,
.log-card.ok { border-left-color: var(--green); }

.log-card.error,
.log-card.status-400,
.log-card.status-404,
.log-card.status-429,
.log-card.running { border-left-color: var(--red); }

.log-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.log-card span,
.log-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.log-card strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.log-card pre {
  display: none;
}

.log-card ol {
  display: grid;
  gap: 3px;
  max-height: 84px;
  overflow: hidden;
  margin: 7px 0 0;
  padding-left: 17px;
}

.log-card li {
  color: #334155;
  font-size: 11px;
  line-height: 1.25;
}

.log-card li.error {
  color: var(--red);
  font-weight: 900;
}

@media (min-width: 1100px) and (min-height: 780px) {
  body { overflow: hidden; }
}

@media (max-width: 1040px) {
  body { overflow: auto; }
  .page { min-height: auto; }
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }
  .logs-page { min-height: 260px; }
}

@media (max-width: 760px) {
  .app-header {
    height: auto;
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .page {
    width: min(100% - 20px, 1320px);
    padding: 10px 0 18px;
  }

  .hero-copy { padding: 16px; }
  h1 { font-size: 32px; }
  .lede { font-size: 16px; }

  .scan-row,
  .facts,
  .calc-grid,
  .result-panel {
    grid-template-columns: 1fr;
  }

  .hero-image img {
    min-height: 220px;
  }
}
