:root {
  --bg: #e7e2d8;
  --ink: #1c1d21;
  --muted: #5c615b;
  --line: #d8d1c4;
  --card: #fffcf7;
  --header: #fffcf7;
  --screen: #0c6e68;
  --screen-soft: #e4f3f1;
  --case: #a34b2e;
  --case-soft: #f8eee8;
  --part: #1d4e89;
  --part-soft: #e7eef8;
  --good: #157a45;
  --danger: #9d2c2c;
  --shadow: 0 16px 40px rgba(28, 29, 33, 0.06);
  --font: "Heebo", "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--screen); outline-offset: 2px; }

.wrap { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.hidden { display: none !important; }

.sticky { position: sticky; top: 0; z-index: 20; }
.top { background: var(--header); color: var(--ink); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; }
body:not(.page-admin) .top-inner {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  min-height: 0;
  padding: 12px 0 10px;
}
body:not(.page-admin) .site-nav { justify-content: flex-start; }
@media (min-width: 861px) {
  body:not(.page-admin) .site-nav { justify-content: center; }
  body:not(.page-admin) .site-nav a { flex: 0 0 auto; }
}
.logo { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: 0 0 auto; }
.logo img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.logo strong { display: block; font-size: 18px; font-weight: 800; }
.logo small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.credit {
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 14px;
  background: #fff;
}
.credit:hover { background: #f6f3ec; }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}
.site-nav a {
  text-decoration: none;
  font-weight: 700;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
}
.site-nav a:hover { background: #f3f0e8; }
.site-nav a.is-active { background: var(--ink); color: #fff; }
.stripe { display: flex; height: 4px; }
.stripe i { display: block; flex: 1; }
.stripe i:first-child { background: var(--screen); }
.stripe i:last-child { background: var(--case); }

.brand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.brand-row .logo { flex: 1 1 auto; min-width: 0; align-items: flex-start; }
.brand-row .logo img { margin-top: 1px; }
.brand-copy { display: block; min-width: 0; }
.brand-copy strong {
  font-size: 18px;
  line-height: 1.3;
  text-wrap: balance;
}
.brand-copy small {
  margin-top: 3px;
  font-size: 13.5px;
  line-height: 1.45;
  text-wrap: pretty;
}
.tech-slot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.brand-row .tech-slot { flex: 0 0 auto; align-self: flex-start; max-width: min(220px, 46%); padding-top: 2px; }
.brand-row .tech-slot .text-btn { white-space: nowrap; }
.tech-name { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }

.zones {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 16px 0 4px;
}
.zones a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 14px 16px;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 800;
  font-size: 22px;
  color: #fff;
}
.zones a[href="#screens"] { background: var(--screen); }
.zones a[href="#cases"] { background: var(--case); }
.zones a[href="#parts"] { background: var(--part); }
.zones a[aria-current] { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85); }

#screens, #cases, #parts { scroll-margin-top: 150px; padding: 28px 0 48px; }
#screens { background: #f3f7f6; }
#cases { background: #f8f4f0; }
#parts { background: #f3f6fb; }
.sec-head { margin-bottom: 18px; }
.eyebrow { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
#screens .eyebrow { color: var(--screen); }
#cases .eyebrow { color: var(--case); }
#parts .eyebrow { color: var(--part); }
.sec-head h2 { font-size: 36px; line-height: 1.15; font-weight: 800; }
.lede { max-width: 62ch; color: var(--muted); margin-top: 8px; }
.count { margin-top: 8px; font-weight: 700; }

.layout { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; align-items: start; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.panel h3, .community h3, .sheet h3 { font-size: 18px; margin-bottom: 10px; }
.label { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
.brands { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.brand-btn, .models button, .ghost, .primary, .text-btn { border-radius: 12px; }
.brand-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 52px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: right;
}
.brand-btn small { color: var(--muted); font-size: 12px; }
#screens .brand-btn[aria-pressed="true"] { background: var(--screen); color: #fff; border-color: var(--screen); }
#cases .brand-btn[aria-pressed="true"] { background: var(--case); color: #fff; border-color: var(--case); }
#parts .brand-btn[aria-pressed="true"] { background: var(--part); color: #fff; border-color: var(--part); }
#parts .brands { grid-template-columns: repeat(2, 1fr); }
.part-kinds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}
.brand-btn[aria-pressed="true"] small { color: inherit; opacity: 0.85; }

input[type="search"], input[type="password"], input[type="text"], select, .adder input, form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 16px;
}
.models {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  margin-top: 10px;
  padding-inline-end: 2px;
}
.models button {
  min-height: 46px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.25;
}
#screens .models button[aria-pressed="true"] { background: var(--screen); color: #fff; border-color: var(--screen); }
#cases .models button[aria-pressed="true"] { background: var(--case); color: #fff; border-color: var(--case); }
#parts .models button[aria-pressed="true"] { background: var(--part); color: #fff; border-color: var(--part); }
.result-panel { position: sticky; top: 148px; }
.result { min-height: 180px; border-radius: 14px; padding: 14px; }
#screens .result { background: var(--screen-soft); }
#cases .result { background: var(--case-soft); }
#parts .result { background: var(--part-soft); }
.placeholder { color: var(--muted); }
.picked { font-size: 28px; line-height: 1.2; font-weight: 700; margin: 4px 0 8px; }
.kicker { font-size: 13px; font-weight: 800; }
#screens .kicker { color: var(--screen); }
#cases .kicker { color: var(--case); }
#parts .kicker { color: var(--part); }
.matches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.match-chip {
  font-family: var(--mono);
  font-size: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #efe8da;
  margin-inline-start: 6px;
}
.tag.good { background: #e3f5ea; color: var(--good); }
.tag.field { background: #fff1d6; color: #8a5a10; }
.tag.solo { background: #eceff3; color: #3e4650; }
.note { margin-top: 8px; color: var(--muted); font-size: 14px; }
.group-line { margin-top: 10px; color: var(--muted); font-size: 13px; }
.linkish { font-weight: 800; }

.split {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  background: var(--bg);
}
.split::before, .split::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.split span { font-weight: 800; font-size: 14px; color: var(--case); white-space: nowrap; }
.split-part span { color: var(--part); }

.sheet {
  margin-top: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.sheet-head p { color: var(--muted); font-size: 14px; max-width: 70ch; }
.sheet-tools { display: flex; gap: 8px; align-items: center; min-width: min(100%, 320px); }
.sheet-tools input { min-width: 180px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: right; vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 700; background: #f7f4ee; }
tbody tr { border-top: 1px solid #eee6da; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #fbf8f2; }
tr.section td {
  background: #f3f0e8;
  font-weight: 800;
  padding-top: 10px;
  padding-bottom: 10px;
}
td .models-cell { font-size: 15px; font-weight: 600; }
td .num { font-family: var(--mono); color: var(--muted); }
.empty, .placeholder { color: var(--muted); }
.sheet .empty { padding: 20px 16px; }

.community {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  padding: 16px;
  border-radius: 22px;
  background: #edd6ae;
  border: 1px solid #e0c28e;
}
.community > div, .password-box, .login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.community > div {
  background: #f6e6cc;
  border-color: #e4c99a;
}
.community p, .login-card p { color: var(--muted); margin-bottom: 12px; }
.community .models { max-height: 240px; margin-bottom: 8px; }
form label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
details { margin: 8px 0 12px; }
details summary { cursor: pointer; font-weight: 700; }
form label input, form label select { margin-top: 6px; font-weight: 500; }
.add-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; align-items: center; }
.plus {
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 8px; margin-top: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px 4px 12px;
  font-size: 14px;
}
.chip button { border: 0; background: transparent; font-size: 16px; line-height: 1; padding: 0 2px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.primary, .ghost, .text-btn { min-height: 44px; padding: 0 16px; font-weight: 700; }
.primary { background: var(--ink); color: #fff; border: 0; }
#screens .primary { background: var(--screen); }
#cases .primary { background: var(--case); }
#parts .primary { background: var(--part); }
.ghost { background: #fff; border: 1px solid var(--line); }
.text-btn { background: transparent; border: 0; padding-inline: 6px; color: var(--ink); text-decoration: underline; min-height: 36px; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
}
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card .who { color: var(--muted); font-size: 13px; margin-top: 6px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); display: block; }
.dots i.on { background: var(--good); border-color: var(--good); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

footer { background: #14161a; color: #efeae1; padding: 28px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.footer-inner a { color: #fff; font-weight: 800; }
.admin-link { margin-inline-start: auto; font-size: 14px; opacity: 0.8; }

dialog {
  border: 0;
  border-radius: 18px;
  padding: 18px;
  width: min(420px, calc(100% - 32px));
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(20, 22, 26, 0.45); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.toasts { position: fixed; bottom: 16px; left: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 40; }
.toast {
  background: #14161a;
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  max-width: 320px;
  box-shadow: var(--shadow);
}
.error { color: var(--danger); font-weight: 700; min-height: 1.2em; }
.print-only { display: none; }

.page-admin { background: #efece4; }
.admin-main { padding: 24px 0 48px; }
.login-card { max-width: 440px; margin: 32px auto; }
.login-card h1 { font-size: 32px; margin-bottom: 8px; }
.admin-bar, .admin-actions, .tabs { display: flex; gap: 8px; align-items: center; }
.admin-bar { justify-content: space-between; margin-bottom: 12px; }
.tabs { margin-bottom: 12px; }
.tabs button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-form { margin-bottom: 16px; }
.page-admin .models { max-height: 280px; margin-bottom: 8px; }
.page-admin .models button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#part-field { display: block; margin: 12px 0; }
.admin-table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.row-actions { display: flex; gap: 6px; }
.danger { background: #fff; color: var(--danger); border: 1px solid #eccfcf; border-radius: 12px; min-height: 40px; padding: 0 12px; font-weight: 700; }
.password-box { margin-top: 18px; }
.password-box summary { cursor: pointer; font-weight: 800; }
.password-box form { margin-top: 12px; max-width: 420px; }
.suggest-block { margin-top: 16px; }
.suggest-block h3 { margin-bottom: 10px; }

@media (min-width: 720px) {
  .zones { grid-template-columns: repeat(3, 1fr); padding-top: 22px; }
  .zones a { min-height: 84px; font-size: 26px; }
}

@media (max-width: 860px) {
  .top-inner { flex-direction: column; align-items: stretch; padding: 10px 0; gap: 10px; }
  body:not(.page-admin) .site-nav {
    display: grid;
    grid-template-columns: repeat(3, max-content);
    justify-content: center;
    align-content: center;
    align-self: center;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    gap: 6px;
    padding: 6px;
    overflow: visible;
    border-radius: 22px;
  }
  body:not(.page-admin) .site-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: unset;
    box-sizing: border-box;
    min-height: 44px;
    max-width: 100%;
    padding: 8px 10px;
    text-align: center;
    white-space: nowrap;
    font-size: clamp(12.5px, 3.6vw, 14px);
    line-height: 1.15;
  }
  #screens, #cases, #parts { scroll-margin-top: 200px; }
  .layout, .community, .form-grid { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .sec-head h2 { font-size: 30px; }
  .sheet-head { flex-direction: column; align-items: stretch; }
  .picked { font-size: 24px; }
  .match-chip { font-size: 18px; }
  .split span { white-space: normal; text-align: center; }
  .brand-copy strong { font-size: 16px; }
  .brand-copy small { font-size: 13px; }
}

@media (max-width: 520px) {
  .brand-row { flex-wrap: wrap; row-gap: 2px; }
  .brand-row .logo { flex-basis: 100%; }
  .brand-row .tech-slot { flex-basis: 100%; max-width: none; padding-top: 0; justify-content: flex-start; }
}

@media print {
  .sticky, .zones, .community, .split, footer, .no-print, #cases, #parts, .sec-head, .layout { display: none !important; }
  body, #screens { background: #fff; }
  .sheet { border: 0; }
  .print-only { display: block; font-weight: 800; padding: 0 0 12px; }
  #screens { padding: 0; }
}
