
:root {
  color-scheme: light;
  --bg: #f8fafc;
  --paper: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft-line: #f1f5f9;
  --accent: #0f766e;
  --accent-strong: #0f5f59;
  --warn: #b45309;
  --bad: #dc2626;
  --blue: #2563eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.topbar > div,
.layout {
  width: min(1500px, calc(100vw - 32px));
  margin-inline: auto;
}

.topbar > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 840;
  letter-spacing: 0.02em;
}

.brand-copy {
  min-width: 0;
}

.header-title {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  font-weight: 780;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  max-width: 240px;
  min-height: 20px;
  overflow: hidden;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: #ccfbf1;
  color: var(--accent-strong);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-updated {
  color: var(--muted);
  font-size: 12px;
  font-weight: 640;
  white-space: nowrap;
}

.layout {
  display: grid;
  gap: 16px;
  padding: 20px 0 36px;
}

.control-panel,
.summary-card,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(520px, 1.35fr) minmax(300px, 0.9fr);
  gap: 20px;
  padding: 16px;
}

.panel-section {
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel-section:not(:last-of-type) {
  padding-right: 20px;
  border-right: 1px solid var(--line);
}

.section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.02em;
}

.panel-grid,
.pricing-grid {
  display: grid;
  gap: 12px;
}

.panel-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pricing-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  align-items: end;
}

.wide,
.margin-control {
  grid-column: 1 / -1;
}

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

.field-control {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
  outline: none;
}

td input.row-input,
td input.row-note,
td select.row-status {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  outline: none;
}

.field-control:focus,
td input:focus,
td select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

textarea.field-control {
  min-height: 84px;
  resize: vertical;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

output {
  color: var(--ink);
  font-weight: 760;
}

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

.check-control input {
  width: auto;
  min-height: auto;
  accent-color: var(--accent);
}

.inline-actions {
  display: flex;
  gap: 10px;
}

.primary-action,
.secondary-action,
.row-delete {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 720;
  cursor: pointer;
  white-space: nowrap;
}

.primary-action {
  width: 100%;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.secondary-action {
  border: 1px solid var(--line);
  background: white;
  color: var(--accent-strong);
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.message {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.message.error { color: var(--bad); }
.message.warn { color: var(--warn); }

.cloud-tools {
  grid-column: 1 / -1;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.cloud-tools summary {
  width: max-content;
  cursor: pointer;
  font-weight: 760;
}

.cloud-tools-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(220px, 320px);
  align-items: end;
  gap: 12px;
  margin-top: 10px;
}

.cloud-tools-wide {
  grid-column: 1 / -1;
}

.cloud-tools-action {
  width: max-content;
}

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

.summary-card {
  min-height: 72px;
  padding: 14px;
}

.summary-card span {
  display: block;
  font-size: 24px;
  font-weight: 820;
  line-height: 1.1;
}

.summary-card small {
  color: var(--muted);
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fbfdff;
}

th:nth-child(1), td:nth-child(1) { width: 280px; }
th:nth-child(2), td:nth-child(2) { width: 210px; }
th:nth-child(3), td:nth-child(3) { width: 130px; }
th:nth-child(4), td:nth-child(4) { width: 120px; }
th:nth-child(5), td:nth-child(5) { width: 84px; }
th:nth-child(6), td:nth-child(6) { width: 90px; }
th:nth-child(7), td:nth-child(7) { width: 70px; }
th:nth-child(8), td:nth-child(8) { width: 70px; }
th:nth-child(9), td:nth-child(9) { width: 110px; }
th:nth-child(10), td:nth-child(10) { width: 96px; }

.model-cell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.model-title {
  display: inline-block;
  max-width: 170px;
  color: var(--blue);
  font-weight: 760;
  line-height: 1.2;
  text-decoration: none;
}

.model-title:hover {
  text-decoration: underline;
}

.thumb-button {
  width: 72px;
  height: 72px;
  min-height: 72px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.thumb-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.thumb,
.thumb-placeholder {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f1f5f9;
  object-fit: cover;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-align: center;
}

.sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.tagline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 2px 7px;
  font-size: 11px;
}

.makerworld-stack {
  display: grid;
  gap: 6px;
}

.decision-stack {
  display: grid;
  gap: 6px;
}

.license-source {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.license-source strong {
  color: #334155;
  font-weight: 760;
}

.license-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.license-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.license-hint.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.license-hint.bad {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

.license-hint.warn {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.license-hint.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.license-reason {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.ui-icon {
  display: inline-flex;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.ui-icon svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hint-text {
  font-variant-numeric: tabular-nums;
}

.tip {
  position: relative;
}

.tip::after {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  z-index: 30;
  width: max-content;
  max-width: 240px;
  padding: 5px 7px;
  border-radius: 6px;
  background: #0f172a;
  color: white;
  content: attr(data-tip);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  text-transform: none;
  transform: translate(-50%, 3px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.tip:hover::after,
.tip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

td input.row-input {
  min-height: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td select.row-status {
  margin-top: -1px;
  font-weight: 760;
}

td select.row-status.status-check {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

td select.row-status.status-progress {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

td select.row-status.status-ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.money {
  white-space: nowrap;
  font-weight: 820;
}

.stats-list {
  display: grid;
  gap: 5px;
  min-width: 112px;
  white-space: normal;
}

.stat-pill {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  line-height: 1;
}

.stat-name {
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: 0.8;
}

.stat-value {
  color: currentColor;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 840;
  text-align: right;
  white-space: nowrap;
}

.stat-indigo {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
}

.stat-green {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.stat-amber {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}

.stat-rose {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.stat-blue {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.stat-red {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

.stat-muted {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--muted);
}

.row-delete {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--bad);
  background: white;
  color: var(--bad);
  padding: 0 10px;
}

.row-delete:hover {
  background: #fef2f2;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.pagination-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.pagination-actions .field-label {
  min-width: 96px;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.image-modal.is-open {
  display: flex;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(3px);
}

.image-modal-panel {
  position: relative;
  width: min(92vw, 960px);
  max-height: 90vh;
  display: grid;
  gap: 10px;
}

.image-modal-panel img {
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
  border-radius: 8px;
  background: white;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
}

.image-modal-title {
  color: white;
  font-weight: 760;
  text-align: center;
}

.image-modal-close {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 38px;
  min-height: 38px;
  border: 1px solid white;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.capture-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.capture-modal.is-open {
  display: flex;
}

.capture-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
}

.capture-modal-panel {
  position: relative;
  width: min(92vw, 680px);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.capture-modal-copy {
  display: grid;
  gap: 8px;
}

.capture-modal-copy h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

.capture-modal-copy p,
.capture-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.capture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.capture-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.bookmarklet-text {
  min-height: 80px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.capture-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 980px) {
  .topbar > div,
  .layout {
    width: min(100vw - 20px, 760px);
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .panel-section:not(:last-of-type) {
    padding-right: 0;
    padding-bottom: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .panel-grid,
  .pricing-grid,
  .cloud-tools-grid {
    grid-template-columns: 1fr 1fr;
  }

  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar > div {
    padding: 14px 0;
  }

  .panel-grid,
  .pricing-grid,
  .cloud-tools-grid,
  .summary {
    grid-template-columns: 1fr;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    justify-content: space-between;
  }
}
