:root {
  --bg: #f4f1ea;
  --bg2: #ffffff;
  --bg3: #ebe6dc;
  --line: #ddd5c8;
  --text: #1a1f29;
  --muted: #6b7280;
  --accent: #e85d04;
  --accent2: #f48c06;
  --good: #0f766e;
  --warn: #b45309;
  --bad: #c2410c;
  --spent: #c2410c;
  --earned: #0f766e;
  --gap: #b45309;
  --radius: 12px;
  --font: "Roboto", system-ui, -apple-system, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow: 0 1px 2px rgba(26, 31, 41, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    linear-gradient(180deg, #faf7f1 0%, var(--bg) 40%, #efe9df 100%);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

a { color: #c2410c; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(26, 31, 41, 0.03);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}
.brand-title {
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.brand-sub {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Right-side professional menu */
.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.75rem;
  margin-left: auto;
  min-width: 0;
}
.main-nav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  color: #3f4654;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover {
  color: var(--text);
  background: var(--bg3);
  text-decoration: none;
}
.main-nav a.active {
  color: #fff;
  background: #111827;
  text-decoration: none;
}
.nav-divider {
  width: 1px;
  height: 1.5rem;
  background: var(--line);
  flex-shrink: 0;
}
.userbox {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
  flex-shrink: 0;
}
.user-name {
  display: none;
  font-weight: 500;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-logout {
  display: inline-flex;
  align-items: center;
  color: #3f4654;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.nav-logout:hover {
  color: var(--text);
  border-color: #c4b9a8;
  background: var(--bg3);
  text-decoration: none;
}

.wrap {
  width: min(1600px, calc(100% - 1.25rem));
  margin: 0.65rem auto calc(1.5rem + var(--safe-bottom));
}

.site-foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 1.25rem 1rem 1.75rem;
}

h1 { font-size: clamp(1.25rem, 4vw, 1.6rem); margin: 0 0 0.25rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.65rem; }
.sub { color: var(--muted); margin: 0 0 0.9rem; line-height: 1.4; }
.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.muted { color: var(--muted); font-size: 0.8rem; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.page-head.compact { margin-bottom: 0.25rem; align-items: center; }
.page-head .sub { margin-bottom: 0; }

/* Years compact bar */
.years-bar {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.55rem;
  box-shadow: var(--shadow);
}
.years-bar.is-complete {
  background: #ecfdf5;
  border-color: #6ee7b7;
}
.years-bar.is-incomplete {
  background: #fff1f2;
  border-color: #fda4af;
}
.year-picker {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 120px;
}
.year-picker.inline { flex: 0 0 auto; }
.year-picker select,
.year-select {
  font-size: 1rem;
  font-weight: 800;
  padding: 0.5rem 0.7rem;
  min-width: 180px;
  border-radius: 9px;
  border: 1px solid var(--line);
  color: var(--text);
}
.year-select.complete {
  background: #d1fae5;
  border-color: #059669;
  color: #065f46;
}
.year-select.incomplete {
  background: #fecaca;
  border-color: #dc2626;
  color: #7f1d1d;
}
.year-select option.opt-complete {
  background: #d1fae5;
  color: #065f46;
}
.year-select option.opt-incomplete {
  background: #fecaca;
  color: #7f1d1d;
}
.years-bar-meta {
  flex: 1;
  min-width: 140px;
  display: grid;
  gap: 0.3rem;
}
.years-bar-meta strong,
.year-count-pill {
  font-size: 0.9rem;
  color: var(--muted);
}
.year-count-pill.complete { color: #065f46; }
.year-count-pill.incomplete { color: #9f1239; }
.progress.complete > span { background: linear-gradient(90deg, #059669, #34d399); }
.progress.incomplete > span { background: linear-gradient(90deg, #dc2626, #fb7185); }

/* Modern year collector view */
.year-hero {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.2rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.year-hero.is-complete {
  background: linear-gradient(180deg, #ecfdf5 0%, #fff 55%);
  border-color: #6ee7b7;
}
.year-hero.is-incomplete {
  background: linear-gradient(180deg, #fff7ed 0%, #fff 55%);
  border-color: #fdba74;
}
.year-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.year-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0.1rem 0 0.25rem;
  letter-spacing: -0.03em;
}
.year-hero-sub { margin: 0; max-width: 42rem; }
.year-hero-picker { min-width: 200px; }
.year-progress-block { margin-bottom: 0.95rem; }
.year-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
}
.year-progress-label span { color: var(--muted); font-weight: 600; }
.year-progress { height: 10px; margin: 0; }

.year-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}
.year-stat-row {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.year-stat {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}
.year-stat .label {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin: 0;
}
.year-stat .value {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 800;
  margin-top: 0.15rem;
  letter-spacing: -0.02em;
}
.year-stat .hint { display: none; }
.year-stat.earned .value { color: var(--earned); }
.year-stat.good .value { color: var(--good); }
.year-stat.warn .value { color: var(--warn); }
.year-stat.accent .value { color: var(--accent); }

.sth-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
.sth-card {
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.sth-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent2);
  box-shadow: 0 10px 28px rgba(26, 31, 41, 0.1);
  text-decoration: none;
}
.sth-card.need { border-color: #fecaca; }
.sth-card.have { border-color: #a7f3d0; }
.sth-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f3f0ea;
  overflow: hidden;
}
.sth-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.sth-card-badges {
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.sth-card-body {
  padding: 0.85rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}
.sth-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.sth-card-color {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}
.sth-price-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.sth-price-row .plabel {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.12rem;
}
.sth-price-row strong {
  font-size: 0.95rem;
  font-weight: 800;
}
.sth-equity {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.sth-equity span {
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.25rem;
}
.sth-equity.up { color: var(--good); }
.sth-equity.down { color: var(--bad); }
.sth-equity.muted-line {
  color: var(--muted);
  font-weight: 500;
}

.year-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.85rem;
  align-items: center;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.7rem;
}
.year-summary strong { font-size: 1.1rem; }
.year-summary span { color: var(--muted); font-size: 0.88rem; }
.year-summary .progress { grid-column: 1 / -1; margin: 0.15rem 0 0; }

/* Dashboard */
.dash-hero {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.dash-progress-wrap { margin-top: 0.15rem; }
.dash-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
}
.dash-progress-meta span { color: var(--muted); }

.money-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.money-grid-7 {
  grid-template-columns: 1fr 1fr;
}
.money-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.money-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}
.money-card.spent::before { background: var(--spent); }
.money-card.earned::before { background: var(--earned); }
.money-card.gap::before { background: var(--gap); }
.money-card.gap.free::before { background: var(--good); }
.money-card .label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.money-card .value {
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 800;
  margin-top: 0.1rem;
  letter-spacing: -0.02em;
}
.money-card.spent .value { color: var(--spent); }
.money-card.earned .value { color: var(--earned); }
.money-card.gap .value { color: var(--gap); }
.money-card.gap.free .value { color: var(--good); }
.money-card.free::before { background: var(--good); }
.money-card .hint { color: var(--muted); font-size: 0.78rem; margin-top: 0.25rem; }

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}
.quick-card {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 0.85rem;
  color: var(--text);
  text-decoration: none;
  min-height: 84px;
  box-shadow: var(--shadow);
}
.quick-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.q-label { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.q-value { font-size: 1.3rem; font-weight: 800; }
.q-hint { color: var(--muted); font-size: 0.75rem; line-height: 1.3; }

.dash-note { margin-top: 0.15rem; }

/* Quick add (dashboard search) */
.quick-add { position: relative; z-index: 5; overflow: visible; }
.qa-search-wrap { position: relative; margin-bottom: 0.75rem; z-index: 6; }
.qa-search-wrap input[type="search"] {
  font-size: 1.05rem;
  padding: 0.8rem 0.95rem;
}
.qa-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  width: 100%;
  min-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(26, 31, 41, 0.16);
  max-height: min(70vh, 480px);
  overflow-y: auto;
  z-index: 40;
}
.qa-empty {
  padding: 1rem 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.qa-option {
  width: 100%;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem 0.95rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.qa-option:last-child { border-bottom: 0; }
.qa-option:hover,
.qa-option.active { background: #fff7ed; }
.qa-option img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg3);
}
.qa-option-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.qa-option-title {
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}
.qa-option-meta {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}
.qa-option-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}
.qa-pill {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.qa-pill.have { background: #d1fae5; color: #065f46; }
.qa-pill.need { background: #ffedd5; color: #9a3412; }

.qa-selected {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: #faf7f1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.85rem;
}
.qa-selected-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  word-break: break-word;
}

.qa-form .form-actions { margin-top: 0.75rem; }
.qa-msg {
  min-height: 1.2rem;
  margin-top: 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}
.qa-msg.ok { color: var(--good); }
.qa-msg.error { color: var(--bad); }

.car-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.car-list.compact { gap: 0.3rem; }

.car-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.6rem;
  align-items: center;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.car-row.compact {
  grid-template-columns: 36px 1fr auto;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  min-height: 0;
}
.car-row:hover {
  border-color: var(--accent2);
  text-decoration: none;
}
.car-row-title {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.car-row.compact .car-row-title { font-size: 0.84rem; }
.case-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 5px;
  background: #111827;
  color: #ffd166;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.car-row-meta { color: var(--muted); font-size: 0.74rem; margin-top: 0.1rem; }
.car-row.compact .car-row-meta { font-size: 0.7rem; margin-top: 0.05rem; }
.car-row-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}
.car-row.compact .car-row-status { gap: 0; }

/* Missing year boxes */
.year-boxes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.year-box {
  display: block;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.55rem;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.year-box:hover { border-color: var(--accent); text-decoration: none; }
.year-box.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(232, 93, 4, 0.18);
}
.year-box.done { opacity: 0.75; }
.year-box.done .yb-left { color: var(--good); }
.yb-year { font-size: 0.95rem; font-weight: 800; }
.yb-count { font-size: 1.05rem; font-weight: 800; margin-top: 0.15rem; color: var(--accent); }
.yb-left { color: var(--muted); font-size: 0.72rem; margin-top: 0.15rem; }
.missing-panel { margin-top: 0.15rem; }

/* Sell */
.tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0.55rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active {
  background: #111827;
  color: #fff;
}
.tab-count {
  display: inline-block;
  min-width: 1.3rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  font-size: 0.72rem;
  margin-left: 0.1rem;
}
.tab:not(.active) .tab-count { background: var(--bg3); color: var(--text); }
.warn-panel {
  background: #fff7ed;
  border-color: #fdba74;
  color: var(--warn);
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

.sell-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.sell-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  box-shadow: var(--shadow);
}
.sell-card-top {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.65rem;
  align-items: start;
  margin-bottom: 0.55rem;
}
.sell-title {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.sell-title:hover { color: var(--accent); }
.sell-badges { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.3rem; }
.sell-prices {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
}
.sell-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.4rem;
}
.inline-sell {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.panel {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.data th,
table.data td {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
table.data tr:hover td { background: rgba(0,0,0,0.02); }

.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 7px;
  background: var(--bg3);
  border: 1px solid var(--line);
}
.thumb.sm {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}
.thumb-lg {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--line);
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-personal { background: #d1fae5; color: #065f46; }
.badge-sellable { background: #fef3c7; color: #92400e; }
.badge-mint { background: #e0f2fe; color: #075985; }
.badge-non_mint { background: #ffedd5; color: #9a3412; }
.badge-owned { background: #d1fae5; color: #065f46; }
.badge-sold { background: #e5e7eb; color: #4b5563; }
.badge-missing { background: #ffedd5; color: #9a3412; }
.badge-have { background: #d1fae5; color: #065f46; }

.btn {
  display: inline-block;
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 0.5rem 0.85rem;
  border-radius: 9px;
  text-decoration: none;
}
.btn:hover { background: var(--accent2); text-decoration: none; color: #fff; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: #c4b9a8; background: var(--bg3); }
.btn-good { background: var(--good); }
.btn-warn { background: #c2410c; }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.78rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}
label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 0.5rem 0.65rem;
  font: inherit;
}
.form-actions {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.flash {
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 0.85rem;
  font-weight: 600;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fff7ed; color: #9a3412; border: 1px solid #fdba74; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: min(400px, 100%);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.login-card h1 { margin-bottom: 0.25rem; }
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.login-brand img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.car-hero {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.9rem;
  align-items: start;
}

.progress {
  height: 8px;
  background: var(--bg3);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.55rem 0 0.9rem;
}
.progress.thin { height: 6px; margin: 0; }
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

@media (min-width: 720px) {
  .wrap { width: min(1600px, calc(100% - 1.5rem)); margin-top: 0.75rem; }
  .topbar { padding: 0.8rem 1.5rem; gap: 1.25rem; }
  .brand-title { font-size: 1.12rem; }
  .brand-sub { font-size: 0.72rem; }
  .main-nav a { font-size: 0.98rem; padding: 0.6rem 1rem; }
  .nav-logout { font-size: 0.9rem; }
  .user-name { display: inline; }
  .money-grid { grid-template-columns: repeat(3, 1fr); }
  .money-grid-7 { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .year-boxes { grid-template-columns: repeat(5, 1fr); }
  .year-stat-grid { grid-template-columns: repeat(3, 1fr); }
  .year-stat-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .sth-card-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .dash-hero {
    grid-template-columns: 1.4fr 1fr;
    align-items: end;
  }
  .car-list.compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
  }
}

@media (min-width: 1100px) {
  .wrap { width: min(1680px, calc(100% - 2rem)); }
  .money-grid-7 { grid-template-columns: repeat(7, 1fr); }
  .money-card .label { font-size: 0.64rem; line-height: 1.25; }
  .money-card .hint { font-size: 0.7rem; }
  .money-card .value { font-size: 1.2rem; }
  .dash-hero { margin-bottom: 0.55rem; }
  .quick-add { margin-bottom: 0.65rem; }
  .year-stat-grid { grid-template-columns: repeat(3, 1fr); }
  .year-stat-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .sth-card-grid { grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
  .sth-card-media { aspect-ratio: 4 / 3; }
}

@media (min-width: 1400px) {
  .year-stat-grid { grid-template-columns: repeat(5, 1fr); }
  .year-stat-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .sth-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sth-card-title { font-size: 1.12rem; }
  .sth-price-row strong { font-size: 1.02rem; }
}

@media (max-width: 900px) {
  .year-stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar { padding: 0.55rem 0.7rem; gap: 0.55rem; }
  .year-stat-row { grid-template-columns: 1fr 1fr; }
  .brand-sub { display: none; }
  .main-nav a {
    font-size: 0.78rem;
    padding: 0.45rem 0.55rem;
    letter-spacing: 0.06em;
  }
  .nav-logout {
    font-size: 0.72rem;
    padding: 0.45rem 0.55rem;
  }
  .nav-divider { display: none; }
  .car-hero { grid-template-columns: 1fr; }
  .car-row:not(.compact) {
    grid-template-columns: 44px 1fr;
  }
  .car-row:not(.compact) .car-row-status {
    grid-column: 2;
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .sell-form-row { grid-template-columns: 1fr; }
  .year-boxes { grid-template-columns: repeat(3, 1fr); }
  .topbar .btn { padding: 0.3rem 0.5rem; }
}

@media (max-width: 380px) {
  .year-boxes { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: 1fr; }
  .brand-title { font-size: 0.82rem; }
}
