:root {
  --font-geist-sans: "Hiragino Sans";
  --font-geist-mono: ui-monospace;
  --cream: #f8f1ea;
  --paper: #fffdf9;
  --paper-strong: #fffaf4;
  --ink: #433735;
  --muted: #7f6f69;
  --soft-muted: #a4948d;
  --rose: #c98f8b;
  --rose-dark: #a96f6d;
  --blush: #f0d9d5;
  --blush-soft: #f9ece9;
  --lavender: #bba9ca;
  --lavender-soft: #eee7f3;
  --gold: #b6925d;
  --gold-soft: #ead9bb;
  --sage: #9aaa92;
  --line: #eaded6;
  --line-strong: #dccbc1;
  --shadow: 0 22px 60px rgba(91, 66, 57, 0.1);
  --small-shadow: 0 10px 30px rgba(91, 66, 57, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 4%, rgba(239, 212, 208, 0.72), transparent 26rem),
    radial-gradient(circle at 91% 15%, rgba(221, 210, 233, 0.66), transparent 23rem),
    linear-gradient(180deg, #fbf7f2 0%, var(--cream) 52%, #f5eee7 100%);
  color: var(--ink);
  font-family: var(--font-geist-sans), "Hiragino Sans", "Yu Gothic UI", sans-serif;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(185, 145, 96, 0.28);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 70px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 252, 248, 0.86);
  border-bottom: 1px solid rgba(222, 203, 193, 0.72);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 76px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

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

.brand strong {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 17px;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.brand small {
  margin-top: 2px;
  color: var(--soft-muted);
  font-size: 8px;
  letter-spacing: 0.2em;
  font-weight: 700;
}

.bottle-mark {
  position: relative;
  width: 34px;
  height: 39px;
  flex: 0 0 auto;
  border: 1.5px solid var(--gold);
  border-radius: 8px 8px 10px 10px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(238, 216, 213, 0.76));
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.34);
}

.bottle-mark::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 7px;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  border: 1.5px solid var(--gold);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: #fffaf4;
}

.bottle-mark::after {
  content: "A";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -43%);
  font-family: Georgia, serif;
  font-size: 13px;
  color: var(--rose-dark);
}

.bottle-mark i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-soft);
  right: 4px;
  top: 5px;
}

.unofficial-badge {
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.page-wrap {
  width: min(100% - 40px, 1080px);
  margin: 0 auto;
}

.tabbar {
  width: fit-content;
  margin: 26px auto 38px;
  padding: 5px;
  display: flex;
  gap: 4px;
  border: 1px solid rgba(219, 198, 187, 0.88);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.7);
  box-shadow: 0 8px 24px rgba(91, 66, 57, 0.06);
}

.tabbar button {
  min-width: 112px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: 160ms ease;
}

.tabbar button span {
  margin-right: 6px;
  color: var(--rose-dark);
  font-size: 16px;
  font-weight: 400;
}

.tabbar button:hover {
  background: rgba(255, 255, 255, 0.64);
}

.tabbar button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(91, 66, 57, 0.12);
}

.search-view,
.ledger-view,
.manage-view {
  animation: page-in 260ms ease both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 48px;
  align-items: center;
  padding: 58px;
  border: 1px solid rgba(218, 197, 187, 0.96);
  border-radius: 36px;
  background:
    linear-gradient(120deg, rgba(255, 253, 249, 0.96), rgba(252, 241, 239, 0.95)),
    var(--paper);
  box-shadow: var(--shadow);
}

.hero-card::before {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(195, 171, 147, 0.22);
  border-radius: 50%;
  right: -148px;
  top: -190px;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(195, 171, 147, 0.2);
  border-radius: 50%;
  left: -88px;
  bottom: -105px;
}

.hero-copy,
.search-panel {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow span {
  position: relative;
  display: inline-block;
  padding-left: 34px;
}

.eyebrow span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 24px;
  height: 1px;
  background: var(--gold);
}

.hero-copy h1 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(39px, 5vw, 58px);
  line-height: 1.34;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.hero-copy h1 em {
  color: var(--rose-dark);
  font-style: normal;
}

.hero-lead {
  max-width: 380px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}

.search-panel {
  padding: 32px;
  border: 1px solid rgba(224, 207, 198, 0.9);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 16px 50px rgba(91, 66, 57, 0.09);
}

.search-panel > label {
  display: block;
  margin: 0 0 10px 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.search-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-53%);
  color: var(--rose-dark);
  font-size: 23px;
  pointer-events: none;
}

.search-row input {
  width: 100%;
  min-width: 0;
  height: 58px;
  padding: 0 18px 0 49px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-geist-mono), ui-monospace, monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: 160ms ease;
}

.search-row input::placeholder {
  color: #baa9a0;
  font-weight: 500;
}

.search-row input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(201, 143, 139, 0.12);
}

.search-row button,
.primary-button {
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #be8581, #a96e6d);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(169, 110, 109, 0.2);
  transition: 160ms ease;
}

.search-row button {
  min-width: 108px;
  padding: 0 18px;
  font-size: 13px;
}

.search-row button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 26px rgba(169, 110, 109, 0.25);
}

.example-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
}

.example-row > span {
  margin-right: 2px;
  color: var(--soft-muted);
  font-size: 10px;
}

.example-row button {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-geist-mono), monospace;
  font-size: 10px;
}

.example-row button:hover {
  border-color: var(--rose);
  color: var(--rose-dark);
}

.hero-sparkle {
  position: absolute;
  color: rgba(182, 146, 93, 0.62);
}

.sparkle-one {
  top: 52px;
  right: 44%;
  font-size: 18px;
}

.sparkle-two {
  bottom: 42px;
  left: 44%;
  font-size: 24px;
}

.result-card {
  position: relative;
  margin-top: 26px;
  padding: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: var(--small-shadow);
  animation: result-in 300ms ease both;
}

.result-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(67, 55, 53, 0.38);
  backdrop-filter: blur(8px);
  animation: modal-backdrop-in 180ms ease both;
}

@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.result-dialog {
  position: relative;
  width: min(720px, 100%);
  max-height: min(86dvh, 820px);
}

.result-dialog .result-card {
  width: 100%;
  max-height: min(86dvh, 820px);
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 28px 90px rgba(58, 41, 37, 0.28);
}

.result-dialog .result-head {
  padding-right: 48px;
}

.result-modal-close {
  position: absolute;
  top: 17px;
  right: 17px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.94);
  color: var(--muted);
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
  box-shadow: 0 7px 20px rgba(91, 66, 57, 0.12);
  transition: 160ms ease;
}

.result-modal-close:hover {
  border-color: var(--rose);
  background: var(--blush-soft);
  color: var(--rose-dark);
  transform: rotate(5deg);
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(220, 201, 190, 0.55);
  border-radius: 23px;
  pointer-events: none;
}

.result-head,
.result-summary,
.metric-grid,
.observations,
.basis-details,
.result-card > .soft-button,
.unsupported-mark {
  position: relative;
  z-index: 1;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.result-kicker {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.result-head h2 {
  margin: 0;
  font-family: var(--font-geist-mono), monospace;
  font-size: 28px;
  letter-spacing: 0.06em;
}

.confidence,
.custom-badge,
.series-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 800;
}

.confidence {
  min-width: 29px;
  padding: 6px 10px;
  font-size: 10px;
}

.confidence-high {
  background: #e7f0e3;
  color: #64795b;
}

.confidence-medium {
  background: #f6ead5;
  color: #9a743f;
}

.confidence-low {
  background: #f5dedc;
  color: #a65f5d;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 28px;
}

.metric {
  min-height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  border-radius: 20px;
}

.metric.manufacture {
  background: linear-gradient(135deg, #f8e5e2, #f4d8d4);
}

.metric.expiry {
  background: linear-gradient(135deg, #f0eaf5, #e8def0);
}

.metric span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.metric strong {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.35;
  font-weight: 600;
}

.result-summary {
  padding: 24px 4px 8px;
}

.result-summary h3,
.observations h3 {
  margin: 0 0 7px;
  font-size: 14px;
}

.result-summary p,
.observations p,
.basis-details li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.result-summary p {
  margin: 0;
}

.observations {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(251, 247, 242, 0.7);
}

.observation-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) 1.1fr;
  gap: 24px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.observation-row:first-of-type {
  border-top: 0;
}

.observation-row strong,
.observation-row span {
  display: block;
}

.observation-row strong {
  font-size: 12px;
}

.observation-row span {
  margin-top: 4px;
  color: var(--soft-muted);
  font-size: 10px;
}

.observation-row p {
  margin: 0;
}

.basis-details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.basis-details summary {
  padding: 18px 4px 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.basis-details ul {
  margin: 8px 0 0;
  padding-left: 21px;
}

.basis-details li + li {
  margin-top: 3px;
}

.unsupported-mark {
  width: 74px;
  height: 74px;
  margin: 28px auto 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--blush-soft);
}

.unsupported-mark span {
  color: var(--rose-dark);
  font-family: Georgia, serif;
  font-size: 34px;
}

.soft-button,
.ghost-button {
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: 160ms ease;
}

.soft-button {
  margin-top: 16px;
  padding: 12px 16px;
}

.soft-button:hover,
.ghost-button:hover {
  border-color: var(--rose);
  background: var(--blush-soft);
}

.search-footer-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.55fr;
  gap: 18px;
  margin-top: 22px;
}

.recent-card,
.method-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 249, 0.72);
  box-shadow: 0 8px 25px rgba(91, 66, 57, 0.05);
}

.recent-card {
  padding: 25px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 28px;
}

.section-heading.compact {
  align-items: flex-start;
  margin-bottom: 12px;
}

.section-heading h1,
.section-heading h2,
.editor-head h2,
.methodology-card h2 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.section-heading h1 {
  font-size: clamp(30px, 5vw, 42px);
}

.section-heading h2 {
  font-size: 20px;
}

.section-heading > div > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.section-heading.compact > button {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--soft-muted);
  cursor: pointer;
  font-size: 10px;
}

.recent-list {
  display: grid;
}

.recent-list button {
  position: relative;
  display: grid;
  grid-template-columns: 120px 1fr 20px;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 8px 3px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.recent-list button:first-child {
  border-top: 0;
}

.recent-list strong {
  font-family: var(--font-geist-mono), monospace;
  font-size: 12px;
}

.recent-list span {
  color: var(--muted);
  font-size: 11px;
}

.recent-list i {
  color: var(--rose-dark);
  font-size: 20px;
  font-style: normal;
}

.empty-note {
  margin: 18px 0 6px;
  color: var(--soft-muted);
  font-size: 12px;
}

.method-card {
  padding: 25px;
  background: linear-gradient(145deg, rgba(239, 230, 244, 0.85), rgba(255, 252, 248, 0.85));
}

.method-card > strong,
.method-card > span {
  display: block;
}

.method-card > strong {
  margin-top: 9px;
  font-family: Georgia, serif;
  font-size: 46px;
  font-weight: 500;
}

.method-card > strong small {
  margin-left: 3px;
  font-family: var(--font-geist-sans), sans-serif;
  font-size: 11px;
}

.method-card > span {
  margin-top: -3px;
  color: var(--muted);
  font-size: 11px;
}

.method-card > p:last-child {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.disclaimer {
  margin: 18px 4px 0;
  color: var(--soft-muted);
  font-size: 10px;
  line-height: 1.7;
  text-align: center;
}

.ledger-view,
.manage-view {
  max-width: 980px;
  margin: 0 auto;
}

.primary-button {
  padding: 13px 19px;
  font-size: 12px;
}

.record-editor {
  margin-bottom: 22px;
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 25px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: var(--small-shadow);
  animation: result-in 240ms ease both;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.editor-head h2 {
  font-size: 22px;
}

.close-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}

.form-grid label {
  display: grid;
  gap: 7px;
}

.form-grid label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.form-grid label > span b {
  margin-left: 4px;
  color: var(--rose-dark);
  font-size: 9px;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.ledger-toolbar input,
.ledger-toolbar select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}

.form-grid input,
.form-grid select {
  height: 45px;
  padding: 0 13px;
}

.form-grid textarea {
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.6;
}

.wide-field {
  grid-column: 1 / -1;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.editor-actions .ghost-button,
.manage-actions .ghost-button {
  padding: 12px 17px;
}

.ledger-toolbar {
  display: grid;
  grid-template-columns: 1fr 180px 150px;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.74);
}

.toolbar-search {
  position: relative;
}

.toolbar-search > span {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-55%);
  color: var(--rose-dark);
  font-size: 19px;
}

.ledger-toolbar input {
  height: 44px;
  padding: 0 12px 0 39px;
}

.ledger-toolbar select {
  height: 44px;
  padding: 0 11px;
}

.ledger-count {
  margin: 14px 4px 8px;
  color: var(--soft-muted);
  font-size: 11px;
}

.ledger-count strong {
  color: var(--ink);
  font-size: 13px;
}

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

.record-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.78);
  box-shadow: 0 7px 22px rgba(91, 66, 57, 0.045);
  transition: 160ms ease;
}

.record-card:hover {
  border-color: var(--line-strong);
  background: rgba(255, 253, 249, 0.96);
  transform: translateY(-1px);
}

.record-lot-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.record-lot-line h2 {
  margin: 0;
  font-family: var(--font-geist-mono), monospace;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.custom-badge {
  padding: 4px 7px;
  background: var(--lavender-soft);
  color: #806b90;
  font-size: 9px;
}

.record-main h3 {
  margin: 9px 0 12px;
  font-size: 13px;
}

.record-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.record-dates > span {
  padding: 7px 10px;
  border-radius: 9px;
  background: #f6eee8;
  color: var(--muted);
  font-size: 10px;
}

.record-dates small {
  margin-right: 6px;
  color: var(--rose-dark);
  font-size: 8px;
  font-weight: 800;
}

.record-main > p {
  margin: 12px 0 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.series-badge {
  padding: 5px 8px;
  background: rgba(237, 226, 244, 0.7);
  color: #806f8d;
  font-size: 9px;
}

.record-actions {
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.record-actions button {
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.record-actions button:hover {
  color: var(--rose-dark);
}

.record-actions .danger-text {
  color: #a66f6d;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  color: var(--soft-muted);
}

.empty-state span {
  font-size: 32px;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
}

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

.stat-grid article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.78);
}

.stat-grid span,
.stat-grid strong {
  display: block;
}

.stat-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.stat-grid strong {
  margin-top: 8px;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 500;
}

.stat-grid small {
  margin-left: 3px;
  font-family: var(--font-geist-sans), sans-serif;
  font-size: 9px;
}

.manage-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin-top: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.82);
}

.manage-card-copy {
  display: flex;
  align-items: center;
  gap: 16px;
}

.manage-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 15px;
  background: var(--blush-soft);
  color: var(--rose-dark);
  font-size: 22px;
}

.manage-icon.lavender {
  background: var(--lavender-soft);
  color: #7f6c8f;
}

.manage-card h2,
.danger-zone h2 {
  margin: 0;
  font-size: 14px;
}

.manage-card p,
.danger-zone p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.manage-actions {
  display: flex;
  gap: 8px;
}

.methodology-card {
  margin-top: 18px;
  padding: 28px;
  border: 1px solid rgba(203, 187, 214, 0.75);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(241, 235, 245, 0.88), rgba(255, 252, 248, 0.84));
}

.methodology-card h2 {
  font-size: 22px;
}

.methodology-card dl {
  margin: 22px 0 0;
}

.methodology-card dl > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 20px;
  padding: 12px 0;
  border-top: 1px solid rgba(190, 169, 204, 0.35);
}

.methodology-card dt {
  font-size: 11px;
  font-weight: 800;
}

.methodology-card dd {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.methodology-card > p {
  margin: 18px 0 0;
  color: var(--soft-muted);
  font-size: 9px;
  text-align: right;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid rgba(192, 119, 116, 0.28);
  border-radius: 20px;
  background: rgba(251, 234, 232, 0.52);
}

.danger-zone button {
  padding: 10px 15px;
  border: 1px solid rgba(169, 111, 109, 0.42);
  border-radius: 11px;
  background: transparent;
  color: var(--rose-dark);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.storage-note {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 18px 3px 0;
  color: var(--muted);
}

.storage-note > span {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.75);
}

.storage-note p {
  margin: 0;
  font-size: 10px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(67, 55, 53, 0.94);
  color: #fff;
  box-shadow: 0 14px 36px rgba(48, 35, 31, 0.26);
  font-size: 11px;
  text-align: center;
  animation: toast-in 180ms ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 820px) {
  .hero-card {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 42px;
  }

  .hero-lead {
    max-width: 620px;
  }

  .sparkle-one {
    right: 30px;
  }

  .sparkle-two {
    display: none;
  }

  .search-footer-grid {
    grid-template-columns: 1fr;
  }

  .method-card {
    min-height: 180px;
  }

  .ledger-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-search {
    grid-column: 1 / -1;
  }

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

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

  .manage-actions {
    padding-left: 64px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-bottom: 92px;
  }

  .topbar-inner {
    min-height: 66px;
    padding: 10px 18px;
  }

  .brand {
    gap: 9px;
  }

  .brand strong {
    font-size: 14px;
    letter-spacing: 0.04em;
  }

  .brand small {
    font-size: 7px;
  }

  .bottle-mark {
    width: 29px;
    height: 34px;
  }

  .unofficial-badge {
    display: none;
  }

  .page-wrap {
    width: min(100% - 24px, 1080px);
  }

  .tabbar {
    position: fixed;
    z-index: 50;
    left: 12px;
    right: 12px;
    bottom: 10px;
    width: auto;
    margin: 0;
    justify-content: stretch;
    background: rgba(255, 252, 248, 0.94);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 32px rgba(60, 43, 38, 0.2);
  }

  .tabbar button {
    min-width: 0;
    flex: 1;
    padding: 10px 8px;
    font-size: 11px;
  }

  .tabbar button span {
    display: block;
    margin: 0 0 2px;
    font-size: 16px;
  }

  .search-view,
  .ledger-view,
  .manage-view {
    padding-top: 20px;
  }

  .hero-card {
    min-height: 0;
    gap: 26px;
    padding: 32px 20px 22px;
    border-radius: 27px;
  }

  .hero-copy h1 {
    font-size: 38px;
  }

  .hero-lead {
    margin-top: 17px;
    font-size: 12px;
    line-height: 1.85;
  }

  .search-panel {
    margin: 0 -5px;
    padding: 18px;
    border-radius: 20px;
  }

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

  .search-row input {
    height: 55px;
  }

  .search-row button {
    min-height: 48px;
  }

  .example-row {
    margin-top: 13px;
  }

  .example-row > span {
    width: 100%;
  }

  .sparkle-one {
    top: 26px;
    right: 22px;
  }

  .result-card {
    padding: 27px 20px;
    border-radius: 25px;
  }

  .result-modal-backdrop {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .result-dialog,
  .result-dialog .result-card {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .result-dialog .result-card {
    padding-top: 31px;
  }

  .result-dialog .result-head {
    padding-right: 42px;
  }

  .result-modal-close {
    top: 13px;
    right: 13px;
    width: 35px;
    height: 35px;
    font-size: 23px;
  }

  .result-card::before {
    inset: 7px;
    border-radius: 19px;
  }

  .result-head h2 {
    font-size: 22px;
  }

  .result-head .confidence {
    padding: 5px 8px;
    font-size: 9px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
    gap: 9px;
    margin-top: 22px;
  }

  .metric {
    min-height: 105px;
    padding: 20px;
  }

  .metric strong {
    font-size: 23px;
  }

  .observation-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .search-footer-grid {
    margin-top: 13px;
  }

  .recent-card,
  .method-card {
    border-radius: 20px;
  }

  .recent-card {
    padding: 21px;
  }

  .recent-list button {
    grid-template-columns: 94px 1fr 12px;
  }

  .disclaimer {
    margin-bottom: 10px;
  }

  .section-heading {
    align-items: flex-start;
    margin-bottom: 22px;
  }

  .section-heading h1 {
    font-size: 31px;
  }

  .section-heading > div > p:last-child {
    font-size: 11px;
  }

  .section-heading > .primary-button {
    flex: 0 0 auto;
    padding: 11px 13px;
  }

  .record-editor {
    padding: 22px 18px;
    border-radius: 21px;
  }

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

  .wide-field {
    grid-column: auto;
  }

  .ledger-toolbar {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .toolbar-search {
    grid-column: auto;
  }

  .record-card {
    position: relative;
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 19px;
  }

  .record-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }

  .record-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .record-dates > span:last-child {
    grid-column: 1 / -1;
  }

  .stat-grid {
    gap: 8px;
  }

  .stat-grid article {
    padding: 16px;
  }

  .manage-card {
    gap: 18px;
    padding: 20px;
  }

  .manage-card-copy {
    align-items: flex-start;
  }

  .manage-icon {
    width: 43px;
    height: 43px;
  }

  .manage-actions {
    display: grid;
    grid-template-columns: 1fr;
    padding-left: 0;
  }

  .methodology-card {
    padding: 22px 19px;
  }

  .methodology-card dl > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .danger-zone {
    align-items: flex-start;
    padding: 19px;
  }

  .storage-note {
    align-items: flex-start;
    margin-bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
