:root {
  --wine: #74171b;
  --wine-dark: #5c1115;
  --ink: #211c1a;
  --muted: #736d68;
  --line: #dfd2c0;
  --paper: #fffaf3;
  --panel: #f4eee4;
  --sage: #477259;
  --gold: #d99a16;
  --rose: #b45c6a;
  --shadow: 0 18px 55px rgba(56, 31, 20, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f5f4f1;
}

body {
  overflow: hidden;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #f5f4f1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  position: relative;
  height: 100vh;
  min-height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.screen {
  display: none;
  height: 100%;
  min-height: 0;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(88px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.screen.active {
  display: block;
}

.login-screen {
  place-content: center;
}

.login-screen.active {
  display: grid;
}

.login-panel {
  display: grid;
  gap: 18px;
  width: min(100%, 360px);
  margin: 0 auto;
  padding: 26px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.login-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-error {
  margin: 0;
  color: var(--wine);
  font-weight: 800;
}

.topbar,
.simple-header,
.form-header {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(223, 210, 192, 0.55);
}

.topbar {
  justify-content: space-between;
  gap: 12px;
}

h1,
h2,
.wine-title,
.timeline-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

h1 {
  margin: 0;
  color: #050505;
  font-size: 1.65rem;
  line-height: 1.1;
}

h2 {
  margin: 22px 0 12px;
  color: var(--wine);
  font-size: 1.55rem;
}

.btn-wine {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--wine);
  --bs-btn-border-color: var(--wine);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--wine-dark);
  --bs-btn-hover-border-color: var(--wine-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--wine-dark);
  border-radius: 999px;
  min-height: 40px;
}

.btn-outline-wine {
  --bs-btn-color: var(--ink);
  --bs-btn-border-color: var(--line);
  --bs-btn-bg: #efe6d7;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--wine);
  --bs-btn-hover-border-color: var(--wine);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--wine);
  --bs-btn-active-border-color: var(--wine);
  border-radius: 999px;
  white-space: nowrap;
}

.btn-check:checked + .btn-outline-wine {
  color: #fff;
  background: var(--wine);
  border-color: var(--wine);
}

.btn-soft {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fbf4e9;
  font-size: 0.78rem;
  font-weight: 800;
}

.icon-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.list-tools {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  margin: 0 -18px 12px;
  padding: 10px 18px;
  border-top: 1px solid rgba(223, 210, 192, 0.7);
  border-bottom: 1px solid rgba(223, 210, 192, 0.7);
  background: rgba(255, 250, 243, 0.97);
}

.search-input {
  min-height: 42px;
  border-radius: 999px;
  padding-inline: 16px;
  background: #fbf4e9;
}

.filter-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px 0 14px;
  color: var(--ink);
  background: #efe6d7;
  font-size: 0.86rem;
  font-weight: 850;
}

.filter-toggle::after {
  color: var(--wine);
  content: "⌄";
  font-size: 1rem;
  line-height: 1;
}

.filter-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.filter-toggle-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  margin-right: 8px;
  border-radius: 999px;
  place-items: center;
  color: #fff;
  background: var(--wine);
  font-size: 0.75rem;
}

.filter-toggle-count[hidden] {
  display: none;
}

.filter-panel {
  display: grid;
  gap: 10px;
}

.filter-panel[hidden] {
  display: none;
}

.active-insight-filter {
  display: grid;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  border: 1px solid rgba(116, 23, 27, 0.28);
  border-left: 5px solid var(--wine);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--wine);
  background: rgba(116, 23, 27, 0.08);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: left;
}

.active-insight-filter[hidden] {
  display: none;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar,
.scrollable::-webkit-scrollbar {
  display: none;
}

.status-chip {
  min-height: 30px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #efe6d7;
  font-size: 0.86rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-chip.active {
  border-color: var(--wine);
  color: #fff;
  background: var(--wine);
}

.content-list {
  display: grid;
  gap: 10px;
}

.wine-card,
.drink-now-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  width: 100%;
  padding: 15px 14px 14px 18px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--wine);
  border-radius: 9px;
  color: inherit;
  background: var(--panel);
  text-align: left;
}

.drink-now-card {
  cursor: pointer;
  background: #f7f1e8;
}

.wine-card[data-type="White"],
.wine-card[data-type="Sparkling"],
.drink-now-card[data-type="White"],
.drink-now-card[data-type="Sparkling"] {
  border-left-color: var(--gold);
}

.wine-card[data-type="Rose"],
.wine-card[data-type="Dessert"],
.drink-now-card[data-type="Rose"],
.drink-now-card[data-type="Dessert"] {
  border-left-color: var(--rose);
}

.wine-title {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.18;
}

.wine-meta,
.timeline-card p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.wine-producer {
  color: #5d625e;
}

.wine-card-main {
  min-width: 0;
}

.wine-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.25;
}

.wine-card-details span {
  display: inline-flex;
}

.score-summary {
  display: inline-flex;
  max-width: 100%;
  margin: 8px 0 0;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--wine);
  background: rgba(116, 23, 27, 0.08);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.25;
}

.mini-drink-window {
  display: grid;
  gap: 5px;
  max-width: 360px;
  margin-top: 10px;
}

.mini-drink-window-years {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.mini-drink-window-bar {
  position: relative;
  display: flex;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(39, 39, 42, 0.1);
  background: #f8f1e5;
}

.mini-drink-window-bar .drink-current-marker {
  top: -2px;
  bottom: -2px;
  width: 2px;
}

.vintage {
  color: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  min-width: 86px;
  gap: 8px;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 9px;
  color: #fff;
  background: var(--sage);
  font-size: 0.72rem;
  font-weight: 800;
}

.status-pill.Ordered {
  color: #5c4f43;
  background: #d9cfbf;
}

.status-pill.Shipped {
  color: #755012;
  background: #e5bd65;
}

.price {
  color: #0e0e0e;
  font-weight: 850;
}

.price-stack {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.current-card-value {
  display: grid;
  justify-items: end;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.15;
}

.current-card-value small {
  color: var(--wine);
  font-size: 0.64rem;
  font-weight: 850;
  text-transform: uppercase;
}

.timeline {
  padding: 38px 0 12px;
}

.year-group {
  position: relative;
  display: grid;
  gap: 20px;
  margin-bottom: 28px;
  padding-left: 34px;
}

.year-group::before {
  position: absolute;
  top: 48px;
  bottom: 0;
  left: 10px;
  width: 2px;
  background: var(--line);
  content: "";
}

.year-heading {
  margin: 0 0 2px -8px;
  color: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
}

.timeline-card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.timeline-card::before {
  position: absolute;
  top: 23px;
  left: -28px;
  width: 10px;
  height: 10px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: #e3bd72;
  content: "";
}

.timeline-card strong {
  font-size: 1.08rem;
}

.drink-now-list {
  display: grid;
  gap: 20px;
  padding-top: 16px;
}

.drink-now-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.drink-now-panel {
  display: none;
}

.drink-now-panel.active {
  display: block;
}

.pairing-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f1e8;
}

.pairing-form {
  display: grid;
  gap: 10px;
}

.pairing-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.3;
}

.pairing-option input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--wine);
}

.pairing-result {
  display: grid;
  gap: 12px;
}

.pairing-result[hidden] {
  display: none;
}

.pairing-result h2 {
  margin: 8px 0 0;
  font-size: 1.18rem;
}

.pairing-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.pairing-match-list,
.pairing-market-grid {
  display: grid;
  gap: 10px;
}

.pairing-match {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(223, 210, 192, 0.85);
  border-left: 5px solid var(--wine);
  border-radius: 9px;
  color: inherit;
  background: var(--paper);
  text-align: left;
}

.pairing-match span,
.pairing-market-tier span,
.pairing-market-tier p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.pairing-market-tier {
  display: grid;
  gap: 8px;
}

.pairing-market-tier h3 {
  margin: 2px 0 0;
  color: var(--wine);
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pairing-market-tier article {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(223, 210, 192, 0.85);
  border-radius: 9px;
  background: var(--paper);
}

.drink-now-section h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.drink-now-section h2 span {
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 850;
}

.drink-now-side {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 8px;
  min-width: 92px;
}

.drink-now-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--wine);
  background: rgba(116, 23, 27, 0.08);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.drink-now-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 9px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  background: #557663;
  font-size: 0.76rem;
  font-weight: 900;
}

.drink-now-card[data-status="dontWait"] .drink-now-status {
  background: #9b2226;
}

.drink-now-card[data-status="ideal"] .drink-now-status {
  background: #3f7d58;
}

.drink-now-card[data-status="pastIdeal"] .drink-now-status {
  color: #4f2f00;
  background: #e9b44c;
}

.drink-now-card[data-status="ready"] .drink-now-status {
  background: #547b8f;
}

.drink-now-card[data-status="wait"] .drink-now-status {
  background: #6b7280;
}

.drink-now-card[data-status="unknown"] .drink-now-status {
  color: #4f4637;
  background: #e8dcc8;
}

.drink-now-window-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 8px;
  margin-top: 12px;
}

.drink-now-window-cell {
  display: grid;
  gap: 3px;
  min-width: 96px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fffaf3;
}

.drink-now-window-cell.highlight {
  border-color: rgba(217, 154, 22, 0.4);
  color: var(--wine);
  background: #fff6e1;
}

.drink-now-window-cell span {
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.drink-now-window-cell strong {
  color: #111;
  font-size: 1.08rem;
  line-height: 1;
}

.drink-now-reason {
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.drink-now-reason strong {
  color: var(--wine);
}

.drink-now-action {
  min-height: 32px;
  padding: 4px 9px;
  border-color: rgba(116, 23, 27, 0.22);
  font-size: 0.76rem;
  white-space: nowrap;
}

.small-vintage {
  color: var(--wine);
  font-size: 0.85rem;
  font-weight: 800;
}

.insights {
  padding-top: 18px;
}

.segmented-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #efe6d7;
}

.insight-tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.15;
}

.insight-tab.active {
  color: #fff;
  background: var(--wine);
}

.insight-panel {
  display: none;
}

.insight-panel.active {
  display: block;
}

.value-card,
.metric-card,
.region-list {
  border: 1px solid var(--line);
  border-radius: 14px;
}

.value-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  background: var(--wine);
  color: #fff;
}

.shared-value {
  background: #477259;
}

.total-value {
  background: #4c5044;
}

.value-card span {
  color: #ecd6d8;
  font-weight: 850;
}

.value-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 9vw, 2.45rem);
  font-weight: 500;
  line-height: 1;
}

.metric-card {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 14px;
  background: var(--panel);
}

.metric-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.42rem;
  font-weight: 500;
  line-height: 1.05;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
}

.region-list {
  overflow: hidden;
  background: var(--panel);
}

.region-row {
  position: relative;
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 14px;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  font-weight: 760;
  font-size: 0.92rem;
  text-align: left;
  overflow: hidden;
}

.region-row::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--bar-width, 0%);
  background: rgba(116, 23, 27, 0.08);
  content: "";
}

.region-row span,
.region-row strong {
  position: relative;
  z-index: 1;
}

.region-row:last-child {
  border-bottom: 0;
}

.region-row:hover,
.region-row:focus-visible {
  background: rgba(116, 23, 27, 0.06);
}

.region-row strong {
  color: var(--wine);
}

.rates-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.form-screen {
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.detail-screen {
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  border-bottom: 1px solid rgba(223, 210, 192, 0.75);
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.detail-panel {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--wine);
  border-radius: 12px;
  background: var(--panel);
}

.detail-title-row,
.detail-status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-title-row h1 {
  overflow-wrap: anywhere;
}

.detail-title-row p {
  margin: 8px 0 0;
  color: var(--muted);
}

.detail-status-row {
  align-items: center;
}

.values-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(223, 210, 192, 0.85);
  border-radius: 12px;
  background: rgba(255, 250, 243, 0.6);
}

.values-panel h2 {
  margin: 0;
  font-size: 1.15rem;
}

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

.values-grid article {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 12px;
  border: 1px solid rgba(223, 210, 192, 0.75);
  border-radius: 10px;
  background: var(--paper);
}

.values-grid span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
}

.values-grid strong {
  align-self: end;
  color: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

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

.detail-grid div {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid rgba(223, 210, 192, 0.75);
  border-radius: 10px;
  background: rgba(255, 250, 243, 0.55);
}

.detail-grid .quantity-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.quantity-action .btn {
  min-height: 32px;
  padding: 0 10px;
}

.detail-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.detail-grid strong {
  align-self: end;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.owners-panel,
.scores-panel,
.notes-panel,
.ai-notes-panel,
.drink-window-panel,
.sales-panel {
  display: grid;
  gap: 10px;
}

.owners-panel h2,
.scores-panel h2,
.notes-panel h2,
.ai-notes-panel h2,
.drink-window-panel h2,
.sales-panel h2 {
  margin: 0;
  font-size: 1.15rem;
}

.notes-box {
  min-height: 54px;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(223, 210, 192, 0.75);
  border-radius: 10px;
  color: #4f5665;
  background: rgba(255, 250, 243, 0.55);
  white-space: pre-wrap;
}

.compact-note {
  min-height: 0;
  font-size: 0.88rem;
}

.drink-window-chart {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(223, 210, 192, 0.75);
  border-radius: 10px;
  background: rgba(255, 250, 243, 0.55);
}

.drink-window-years,
.drink-window-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.drink-window-bar {
  position: relative;
  display: flex;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(39, 39, 42, 0.12);
  background: #f8f1e5;
}

.drink-segment {
  min-width: 8%;
}

.drink-young {
  background: #e8c84f;
}

.drink-peak {
  background: #4f9a62;
}

.drink-decline {
  background: #b94a48;
}

.drink-current-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  border-radius: 999px;
  background: #1f2933;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px rgba(255, 250, 243, 0.85);
}

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

.wishlist-card {
  display: grid;
  gap: 0;
  width: 100%;
  border: 1px solid rgba(223, 210, 192, 0.9);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 250, 243, 0.9);
  text-align: left;
}

.wishlist-card-header {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  padding: 14px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.wishlist-card-header > div {
  min-width: 0;
  flex: 1 1 auto;
}

.wishlist-card-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wishlist-card h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.wishlist-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.wishlist-closed-meta {
  color: var(--wine) !important;
  font-size: 0.78rem !important;
  font-weight: 850;
}

.wishlist-card-side {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.wishlist-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  color: #fff;
  background: var(--wine);
  font-size: 0.72rem;
  font-weight: 800;
}

.wishlist-chip.priority-high {
  background: var(--wine);
}

.wishlist-chip.priority-medium {
  color: #5c4f43;
  background: #e5bd65;
}

.wishlist-chip.priority-low {
  background: var(--sage);
}

.wishlist-chevron {
  color: var(--wine);
  font-size: 0.82rem;
  font-weight: 900;
  transition: transform 0.18s ease;
}

.wishlist-card-header[aria-expanded="true"] .wishlist-chevron {
  transform: rotate(180deg);
}

.wishlist-card-header[aria-expanded="true"] {
  border-bottom: 1px solid rgba(223, 210, 192, 0.75);
  background: rgba(244, 238, 228, 0.65);
}

.wishlist-card-detail {
  display: grid;
  gap: 12px;
  margin: 12px;
  padding: 12px;
  border: 1px solid rgba(223, 210, 192, 0.95);
  border-radius: 12px;
  background: rgba(255, 250, 243, 0.72);
}

.wishlist-card-detail[hidden] {
  display: none;
}

.wishlist-card-detail dl {
  display: grid;
  gap: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(223, 210, 192, 0.7);
  border-radius: 9px;
  background: var(--paper);
}

.wishlist-card-detail dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(223, 210, 192, 0.75);
}

.wishlist-card-detail dl div:last-child {
  border-bottom: 0;
}

.wishlist-card-detail dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.wishlist-card-detail dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sale-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(223, 210, 192, 0.75);
  border-radius: 10px;
  background: rgba(255, 250, 243, 0.55);
}

.sale-buyer,
.sale-actions {
  grid-column: 1 / -1;
}

.sale-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
}

.sale-list {
  overflow: hidden;
  border: 1px solid rgba(223, 210, 192, 0.75);
  border-radius: 10px;
  background: rgba(255, 250, 243, 0.55);
}

.sale-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid rgba(223, 210, 192, 0.75);
}

.sale-row:last-child {
  border-bottom: 0;
}

.sale-row div,
.sale-numbers {
  display: grid;
  gap: 3px;
}

.sale-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.sale-numbers {
  text-align: right;
}

.profit {
  color: var(--sage) !important;
}

.loss {
  color: var(--wine) !important;
}

.owner-list {
  overflow: hidden;
  border: 1px solid rgba(223, 210, 192, 0.75);
  border-radius: 10px;
  background: rgba(255, 250, 243, 0.55);
}

.score-list {
  overflow: hidden;
  border: 1px solid rgba(223, 210, 192, 0.75);
  border-radius: 10px;
  background: rgba(255, 250, 243, 0.55);
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid rgba(223, 210, 192, 0.75);
}

.score-row:last-child {
  border-bottom: 0;
}

.score-row div {
  display: grid;
  gap: 3px;
}

.score-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.score-value-pill {
  min-width: 58px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--wine);
  text-align: center;
}

.owner-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid rgba(223, 210, 192, 0.75);
}

.owner-row:last-child {
  border-bottom: 0;
}

.owner-row.total {
  color: var(--wine);
  font-weight: 800;
  background: rgba(239, 230, 215, 0.75);
}

.form-header {
  justify-content: flex-start;
  border-bottom: 1px solid rgba(223, 210, 192, 0.75);
}

.form-header h1 {
  font-size: 1.2rem;
}

.link-button {
  border: 0;
  padding: 0 4px 0 0;
  color: var(--wine);
  background: transparent;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.wine-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
  padding-top: 16px;
}

.form-field {
  display: grid;
  gap: 7px;
  color: #4f5665;
  font-weight: 650;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-control,
.form-select {
  min-height: 48px;
  border-color: var(--line);
  border-radius: 8px;
  background-color: var(--panel);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--wine);
  box-shadow: 0 0 0 0.2rem rgba(116, 23, 27, 0.16);
}

.choice-row {
  display: flex;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  border: 0;
  scrollbar-width: none;
}

.choice-row legend {
  width: 100%;
  margin-bottom: 8px;
  color: #4f5665;
  font-size: 1rem;
  font-weight: 650;
}

.owners-editor {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.scores-editor {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.owners-editor legend,
.scores-editor legend {
  margin-bottom: 0;
  color: #4f5665;
  font-size: 1rem;
  font-weight: 650;
}

#owners-form-list,
#scores-form-list {
  display: grid;
  gap: 8px;
}

.score-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(90px, 0.6fr) minmax(0, 1.4fr) auto;
  gap: 8px;
}

.score-form-row .btn {
  min-height: 48px;
}

.owner-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px auto;
  gap: 8px;
}

.owner-form-row .btn {
  min-height: 48px;
}

.form-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 20px;
}

.save-button,
.form-actions .btn-danger {
  min-height: 52px;
  border-radius: 7px;
  font-weight: 800;
}

.form-actions .btn-danger[hidden] {
  display: none;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 540px;
  min-height: calc(68px + env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: 4px 5px env(safe-area-inset-bottom);
  border-top: 1px solid rgba(223, 210, 192, 0.75);
  background: rgba(255, 250, 243, 0.96);
}

.nav-item {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 4px 3px;
  border: 0;
  border-radius: 10px;
  color: #6d737c;
  background: transparent;
  font-size: 0.68rem;
  line-height: 1.05;
  text-align: center;
}

.nav-item span {
  display: block;
  max-width: 78px;
  overflow-wrap: normal;
}

.nav-item.active {
  color: var(--wine);
  background: rgba(116, 23, 27, 0.08);
  font-weight: 800;
}

.empty-state {
  padding: 40px 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  margin: 0;
  padding: 16px;
}

@media (min-width: 760px) {
  body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
  }

  .app-shell {
    width: min(540px, 100%);
    height: min(920px, calc(100vh - 48px));
    min-height: 0;
    border: 1px solid #e4ded4;
    border-radius: 34px;
  }

  .screen {
    height: 100%;
    min-height: 0;
  }

  .bottom-nav {
    position: absolute;
  }
}

@media (max-width: 430px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar > .d-flex {
    width: 100%;
  }

  .btn-wine {
    flex: 1;
  }

  .wine-form {
    grid-template-columns: 1fr;
  }

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

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

  .drink-now-card {
    grid-template-columns: 1fr;
  }

  .drink-now-side {
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    justify-items: start;
    align-items: center;
  }

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

  .owner-form-row {
    grid-template-columns: 1fr 86px;
  }

  .owner-form-row .owner-remove {
    grid-column: 1 / -1;
  }

  .score-form-row {
    grid-template-columns: 1fr;
  }

  .wishlist-form {
    grid-template-columns: 1fr;
  }

  .wishlist-card-actions {
    flex-direction: column;
  }

  .wishlist-card-actions .btn {
    width: 100%;
  }

  .wishlist-card {
    border-radius: 10px;
  }

  .wishlist-card-header {
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

  .wishlist-card h2 {
    font-size: 1rem;
    line-height: 1.18;
  }

  .wishlist-card p {
    margin-top: 4px;
    font-size: 0.8rem;
  }

  .wishlist-card-side {
    gap: 6px;
  }

  .wishlist-chip {
    max-width: 82px;
    padding: 4px 8px;
    overflow: hidden;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .wishlist-card-detail {
    margin: 0 10px 10px;
    padding: 10px;
    border-radius: 10px;
  }

  .wishlist-card-detail dl div {
    padding: 9px 10px;
  }

  .wishlist-card-detail dl div:last-child {
    display: grid;
    gap: 4px;
  }

  .wishlist-card-detail dl div:last-child dd {
    text-align: left;
  }

  .sale-form {
    grid-template-columns: 1fr;
  }

  .col-6 {
    width: 100%;
  }
}
