:root {
  --amber: #d9782a;
  --bourbon: #a45a1f;
  --oak: #6b4e2e;
  --agave: #3e7a5b;
  --charcoal: #1b1b1f;
  --slate: #383d44;
  --cream: #f6f2e9;

  --bg: var(--cream);
  --card: #fffdf8;
  --card-alt: #fbf6ec;
  --accent: #d9782a;
  --accent-strong: #a45a1f;
  --ink: #1b1b1f;
  --muted: #6f6a61;
  --line: #e7ddca;

  --font-head: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 6% 0%, #fffaf0 0%, transparent 26%),
    radial-gradient(circle at 94% 6%, #f3ead8 0%, transparent 30%),
    linear-gradient(180deg, #faf6ed 0%, var(--bg) 100%);
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.1rem;
  padding: 0.72rem 1.55rem;
  background:
    radial-gradient(circle at 20% -120%, rgba(217, 120, 42, 0.4), transparent 45%),
    linear-gradient(120deg, #111318 0%, #181c23 55%, #131820 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  flex: 0 0 auto;
  gap: 0.75rem;
}

.topbar h1 {
  display: flex;
  align-items: center;
  margin: 0;
  line-height: 1;
}

.topbar h1 a {
  display: inline-flex;
  align-items: center;
}

.brand-logo-horizontal {
  height: 2.25rem;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.25));
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  gap: 1.05rem;
  flex-wrap: nowrap;
}

.top-nav a {
  color: rgba(241, 236, 225, 0.84);
  font-weight: 600;
  letter-spacing: 0.11em;
  font-size: 0.66rem;
  text-transform: uppercase;
  transition: color 0.14s ease;
  white-space: nowrap;
}

.top-nav a:hover {
  color: #fff;
}

.top-nav a.is-active {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.18);
}

.top-nav .muted {
  color: var(--muted);
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout-form {
  margin: 0;
}

.nav-icon-form {
  margin: 0;
}

.nav-logout-button {
  font: inherit;
  color: rgba(241, 236, 225, 0.84);
  text-transform: uppercase;
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  white-space: nowrap;
}

.nav-logout-button:hover {
  color: #fff;
}

.top-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #f6f2e9;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  line-height: 0;
  text-decoration: none;
  min-height: 0;
}

.top-nav-icon svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-nav-icon:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.1);
}

.hamburger {
  display: none;
  width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

.hamburger span {
  display: block;
  width: 1.2rem;
  height: 2px;
  margin: 0.16rem auto;
  background: var(--ink);
  border-radius: 999px;
}

.mobile-pagebar,
.mobile-footer-nav {
  display: none;
}

.mobile-pagebar-side {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 2.2rem;
}

.mobile-pagebar-side-end {
  justify-content: flex-end;
}

.mobile-pagebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #f6f2e9;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  line-height: 0;
  min-height: 0;
}

.mobile-pagebar-icon svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-pagebar-icon:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
}

.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem calc(2rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 2rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
  box-shadow: 0 14px 34px rgba(54, 37, 28, 0.08);
}

.narrow {
  max-width: 460px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-actions form {
  margin: 0;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: linear-gradient(180deg, #b85a35 0%, var(--accent) 100%);
  color: #fff;
  padding: 0.62rem 0.95rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(122, 50, 27, 0.25);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(122, 50, 27, 0.3);
}

.form-grid {
  display: grid;
  gap: 0.5rem;
}

.auth-centered-wrap {
  width: 100%;
  min-height: clamp(420px, calc(100vh - 220px), 680px);
  display: grid;
  place-items: center;
}

.auth-request-login {
  width: min(460px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 0.8rem;
  justify-items: center;
  text-align: center;
}

.auth-request-login > .button,
.auth-request-form {
  width: 100%;
}

.google-signin-link {
  display: inline-flex;
  justify-content: center;
}

.google-signin-link:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
  border-radius: 999px;
}

.google-signin-image {
  width: auto;
  height: auto;
  max-width: 100%;
  display: block;
}

.auth-request-form {
  max-width: 360px;
  justify-items: stretch;
}

.auth-request-divider {
  margin: 0.15rem 0;
  color: var(--muted);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  margin: 0;
  justify-self: start;
  border: 1.5px solid #c8b8a8;
  border-radius: 0.28rem;
  background: #fff;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

input[type="checkbox"]::before {
  content: "";
  width: 0.58rem;
  height: 0.58rem;
  transform: scale(0);
  transition: transform 0.12s ease-in-out;
  clip-path: polygon(14% 44%, 0 62%, 44% 100%, 100% 20%, 82% 5%, 40% 72%);
  background: var(--accent-strong);
}

input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: #fff6ec;
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(162, 74, 42, 0.2);
}

.form-grid label + input[type="checkbox"] {
  margin-top: -0.1rem;
  margin-bottom: 0.45rem;
}

textarea {
  min-height: 90px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.view-thumb {
  width: min(100%, 360px);
  max-height: 260px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  background: #fff;
  border: 1px solid var(--line);
}

.bottle-view-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.bottle-view-layout.has-image {
  grid-template-columns: minmax(0, 1fr) minmax(130px, 220px);
  align-items: start;
}

.bottle-view-details .detail-grid {
  display: grid;
  gap: 0.55rem;
}

.bottle-view-details .detail-grid p {
  margin: 0;
}

.bottle-view-photo {
  justify-self: end;
}

.bottle-view-photo .thumb-button {
  display: block;
}

.bottle-view-photo .view-thumb {
  width: min(220px, 100%);
  max-height: 320px;
  margin-bottom: 0;
}

.bottle-view-header {
  margin-bottom: 0.5rem;
}

.bottle-view-title-link {
  margin-left: auto;
}

.bottle-view-footer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.bottle-view-footer-actions form {
  margin: 0;
}

body.is-pwa .pwa-hide-import-export {
  display: none !important;
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.actions-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.role-form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.role-form select {
  width: auto;
  min-width: 100px;
}

.role-form input[type="email"] {
  min-width: 220px;
  width: auto;
}

.sort-link {
  color: inherit;
  font-weight: 700;
}

.sort-link:hover {
  color: var(--accent-strong);
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  background: #fff;
  box-shadow: none;
  padding: 0.25rem;
}

.icon-link:hover {
  background: #fff3e8;
  transform: none;
  box-shadow: none;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.danger-button {
  background: linear-gradient(180deg, #c85050 0%, #a93131 100%);
}

.danger-button:hover {
  box-shadow: 0 10px 22px rgba(137, 35, 35, 0.32);
}

.link {
  background: none;
  color: var(--accent);
  padding: 0;
}

.danger {
  color: #9a1010;
}

.flash-group {
  display: grid;
  gap: 0.5rem;
}

.flash {
  border-radius: 10px;
  padding: 0.6rem;
  border: 1px solid;
}

.flash.success {
  color: #174f2b;
  background: #e9f7ee;
  border-color: #86d1a2;
}

.flash.info {
  color: #184a66;
  background: #eaf5fb;
  border-color: #82c2e2;
}

.flash.warning {
  color: #5d4409;
  background: #fff5de;
  border-color: #edce84;
}

.flash.danger {
  color: #6a1a1a;
  background: #ffeded;
  border-color: #eba5a5;
}

.badge {
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

.badge.yes {
  background: #e4f6e9;
  color: #166734;
}

.badge.no {
  background: #fce9e9;
  color: #922d2d;
}

.muted,
.hint {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.mobile-bottle-list {
  display: none;
}

.mobile-bottle-card {
  margin-bottom: 0.75rem;
}

.mobile-bottle-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.mobile-bottle-distillery {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.mobile-bottle-head h3 {
  margin: 0.15rem 0 0;
  font-size: 1.08rem;
}

.mobile-bottle-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.7rem;
}

.mobile-bottle-meta p {
  margin: 0;
  font-size: 0.92rem;
}

.mobile-bottle-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.mobile-tasting-list {
  display: none;
}

.mobile-tasting-card {
  margin-bottom: 0.75rem;
}

.mobile-tasting-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.mobile-tasting-brand {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.mobile-tasting-head h3 {
  margin: 0.15rem 0 0;
  font-size: 1.08rem;
}

.mobile-tasting-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.mobile-tasting-meta p {
  margin: 0;
  font-size: 0.92rem;
}

.mobile-tasting-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.settings-page {
  display: grid;
  gap: 1rem;
}

.settings-type-list {
  display: none;
  gap: 0.65rem;
}

.settings-type-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0;
}

.settings-type-name {
  margin: 0;
  font-weight: 600;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.table-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
}

.inline-form {
  margin-bottom: 1rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.9rem;
}

.summary-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem;
  color: inherit;
  box-shadow: 0 10px 22px rgba(54, 37, 28, 0.06);
}

.summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.summary-top h3 {
  margin: 0;
}

.summary-count {
  min-width: 2rem;
  text-align: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #fff1e5;
  color: var(--accent-strong);
  font-weight: 700;
}

.summary-subtitle {
  margin: 0.45rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.87rem;
}

.summary-card ul {
  margin: 0;
  padding-left: 1rem;
}

.summary-card li {
  margin-bottom: 0.2rem;
}

.pick-pour-card {
  background:
    radial-gradient(circle at 88% 12%, rgba(217, 120, 42, 0.18) 0%, transparent 42%),
    linear-gradient(150deg, #20241f 0%, #1b2a22 55%, #14201a 100%);
  border: 1px solid #2f3a30;
  border-radius: 16px;
  box-shadow: 0 18px 34px rgba(15, 22, 16, 0.4);
  padding: 1.15rem;
  display: grid;
  gap: 0.95rem;
  margin-bottom: 0.95rem;
}

.pick-pour-head {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

.pick-pour-head > div {
  width: 100%;
  display: grid;
  justify-items: center;
}

.pick-pour-head h3 {
  margin: 0;
  font-size: 1.35rem;
  width: 100%;
  text-align: center;
  color: var(--cream);
}

.pick-pour-head .summary-subtitle {
  display: block;
  width: 100%;
  text-align: center;
  color: #c8c2b4;
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

.pick-pour-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(217, 120, 42, 0.35);
  border-radius: 999px;
  padding: 0.32rem 0.68rem;
  font-size: 0.87rem;
  font-weight: 600;
  color: #ece7da;
  white-space: nowrap;
}

.pick-pour-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.pick-pour-types {
  width: min(320px, 100%);
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  color: #ece7da;
  font-weight: 600;
  font-size: 0.9rem;
}

.pick-pour-types span {
  text-align: center;
}

.pick-pour-multiselect {
  width: 100%;
}

.pick-pour-multiselect summary {
  list-style: none;
  cursor: pointer;
  padding: 0.58rem 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #ece7da;
  border-radius: 10px;
  text-align: left;
  font-weight: 500;
  position: relative;
  padding-right: 2rem;
}

.pick-pour-multiselect summary::after {
  content: "▾";
  position: absolute;
  right: 0.72rem;
  top: 50%;
  transform: translateY(-52%);
  color: var(--amber);
}

.pick-pour-multiselect summary::-webkit-details-marker {
  display: none;
}

.pick-pour-multiselect-menu {
  display: none;
  margin-top: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: #1a1e1a;
  max-height: 160px;
  overflow: auto;
  padding: 0.35rem;
  gap: 0.2rem;
}

.pick-pour-multiselect[open] .pick-pour-multiselect-menu {
  display: grid;
}

.pick-pour-multiselect-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 8px;
  padding: 0.3rem 0.4rem;
  font-weight: 500;
  color: #ece7da;
  cursor: pointer;
}

.pick-pour-multiselect-option:hover {
  background: rgba(217, 120, 42, 0.16);
}

.pick-pour-multiselect-option input[type="checkbox"] {
  width: 0.95rem;
  height: 0.95rem;
}

.pick-pour-wheel-wrap {
  position: relative;
  width: min(230px, 100%);
  margin: 0 auto;
}

.pick-pour-winner {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.3rem;
  text-align: center;
  padding: 1rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 248, 236, 0.95) 0%, rgba(255, 232, 207, 0.88) 64%, rgba(255, 232, 207, 0.2) 100%);
  color: #643622;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
  z-index: 3;
}

.pick-pour-winner.is-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.pick-pour-winner-label {
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: #85523c;
}

.pick-pour-winner-name {
  display: inline-block;
  font-size: 1rem;
  line-height: 1.22;
  max-width: 15ch;
  font-weight: 700;
  color: #6a2f16;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.pick-pour-winner-name[aria-disabled="true"] {
  color: #7a6051;
  text-decoration: none;
  pointer-events: none;
}

.pick-pour-pointer {
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 20px solid #69341f;
  filter: drop-shadow(0 2px 3px rgba(50, 25, 15, 0.28));
  z-index: 2;
}

.pick-pour-wheel {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid #fff7ea;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.85) 0 25%, transparent 26%),
    conic-gradient(
      #ff9f7f 0deg 45deg,
      #ffc26a 45deg 90deg,
      #fedf9a 90deg 135deg,
      #fda97c 135deg 180deg,
      #f7c872 180deg 225deg,
      #ffd59f 225deg 270deg,
      #ffad89 270deg 315deg,
      #ffd089 315deg 360deg
    );
  box-shadow:
    0 16px 28px rgba(110, 52, 25, 0.24),
    inset 0 0 0 3px rgba(255, 255, 255, 0.65);
  display: grid;
  place-items: center;
  transition: transform 3s cubic-bezier(0.1, 0.8, 0.08, 1);
}

.pick-pour-wheel-core {
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff7ea;
  border: 2px solid #f2c8aa;
  color: #7a3118;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
}

.pick-pour-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.pick-pour-result {
  margin: 0;
  color: #ece7da;
  font-weight: 600;
  min-height: 1.25rem;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .pick-pour-wheel {
    transition: none;
  }

  .pick-pour-winner {
    transition: none;
  }
}

.import-card {
  margin-bottom: 1rem;
}

.import-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) auto;
  gap: 0.6rem;
  align-items: end;
}

.import-form label {
  font-weight: 600;
}

.import-form button {
  white-space: nowrap;
}

.inline-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.thumb-button {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  box-shadow: none;
  line-height: 0;
}

.thumb-button:hover,
.thumb-button:focus-visible {
  transform: none;
  box-shadow: none;
}

.thumb-button .table-thumb {
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.thumb-button:hover .table-thumb,
.thumb-button:focus-visible .table-thumb {
  transform: scale(1.03);
  box-shadow: 0 10px 20px rgba(54, 37, 28, 0.2);
}

.image-lightbox {
  width: min(94vw, 980px);
  background: transparent;
}

.lightbox-image {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  background: #18120f;
}

.modal {
  width: min(640px, calc(100vw - 2rem));
  border: none;
  padding: 0;
  border-radius: 16px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(25, 16, 12, 0.45);
}

.modal-close-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.4rem;
}

.search-modal {
  width: min(520px, calc(100vw - 2rem));
}

.search-modal-card {
  background: #f8f3e9;
  border-color: #dac8ad;
}

.search-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.search-modal-head h3 {
  margin: 0;
}

.search-modal-form {
  margin: 0;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.search-results-card h3 {
  margin: 0 0 0.8rem;
}

.search-results-list {
  display: grid;
  gap: 0.55rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  color: inherit;
}

.search-result-item:hover {
  border-color: #d7c2a2;
  box-shadow: 0 8px 18px rgba(44, 31, 23, 0.08);
}

.search-result-copy {
  min-width: 0;
  display: grid;
  gap: 0.14rem;
}

.search-result-copy strong,
.search-result-copy .muted {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table tbody tr:hover {
  background: #fff7ee;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

@media (max-width: 840px) {
  body.is-authenticated {
    background:
      radial-gradient(circle at 50% -40%, rgba(217, 120, 42, 0.2), transparent 40%),
      linear-gradient(180deg, #101318 0%, #151922 40%, #171a21 100%);
    color: #f3ecde;
  }

  body.is-authenticated .topbar {
    display: none;
  }

  body.is-authenticated .mobile-pagebar {
    position: sticky;
    top: 0;
    z-index: 45;
    min-height: 3.2rem;
    display: grid;
    grid-template-columns: minmax(2.2rem, auto) 1fr minmax(2.2rem, auto);
    align-items: center;
    padding: 0.82rem 1rem;
    background:
      radial-gradient(circle at 50% -120%, rgba(217, 120, 42, 0.35), transparent 55%),
      linear-gradient(120deg, #111318 0%, #181c23 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  }

  #mobile-page-title {
    color: #f8f2e5;
    font-family: var(--font-head);
    font-size: 1.06rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(88vw, 420px);
    text-align: center;
    justify-self: center;
  }

  body.is-authenticated .mobile-footer-nav {
    position: fixed;
    left: 0.7rem;
    right: 0.7rem;
    bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.22rem;
    padding: 0.42rem 0.44rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(17, 20, 25, 0.92);
    backdrop-filter: blur(16px);
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.38);
  }

  .mobile-nav-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.16rem;
    min-height: 3.05rem;
    border-radius: 12px;
    color: rgba(243, 236, 222, 0.78);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
  }

  .mobile-nav-item svg {
    width: 1.06rem;
    height: 1.06rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-nav-item.is-active {
    color: #fff;
    background: linear-gradient(180deg, rgba(217, 120, 42, 0.45) 0%, rgba(164, 90, 31, 0.4) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  }

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

  .search-modal {
    width: calc(100vw - 1rem);
  }

  .search-modal-form button {
    width: 100%;
  }

  body.is-authenticated .container {
    margin: 1rem auto;
    gap: 1rem;
    padding: 0 0.75rem calc(5.95rem + env(safe-area-inset-bottom, 0px));
  }

  body.is-authenticated .card {
    background: #f8f3e9;
    border-color: #dac8ad;
    color: var(--ink);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  }

  body.is-authenticated .container > section > .section-header h2,
  body.is-authenticated .container > section > h2 {
    color: #f8f2e5;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.32);
  }

  body.is-authenticated .container > section > .section-header h2,
  body.is-authenticated .container > section > h2 {
    display: none;
  }

  body.is-authenticated .summary-card,
  body.is-authenticated .mobile-bottle-item,
  body.is-authenticated .mobile-tasting-item,
  body.is-authenticated .import-card,
  body.is-authenticated .settings-type-card {
    background: #fbf5eb;
    color: var(--ink);
  }

  body.is-authenticated .card .muted,
  body.is-authenticated .summary-card .muted,
  body.is-authenticated .mobile-bottle-item .muted,
  body.is-authenticated .mobile-tasting-item .muted,
  body.is-authenticated .import-card .muted,
  body.is-authenticated .settings-type-card .muted {
    color: #5e574d;
  }

  body.is-authenticated .flash {
    border-color: #ccad88;
  }

  .topbar {
    padding: 0.85rem 0.9rem;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .topbar h1 {
    margin: 0;
  }

  .brand-logo-horizontal {
    height: 2rem;
    max-width: 64vw;
  }

  .topbar-brand {
    width: 100%;
  }

  .hamburger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .top-nav {
    display: none;
    width: 100%;
    margin-top: 0.55rem;
    padding: 0.55rem 0.2rem 0.1rem;
    border-top: 1px solid var(--line);
    gap: 0.45rem 0.65rem;
  }

  .top-nav.is-open {
    display: flex;
  }

  .container {
    margin: 1rem auto;
    gap: 1rem;
    padding: 0 0.75rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

  .card {
    padding: 0.9rem;
    border-radius: 14px;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    flex-wrap: nowrap;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.2rem;
  }

  .header-actions > * {
    flex: 0 0 auto;
  }

  .button,
  button {
    min-height: 42px;
  }

  .header-actions .button,
  .header-actions button {
    width: auto;
    min-width: 96px;
    white-space: nowrap;
  }

  .actions,
  .actions-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .actions-row form {
    margin: 0;
  }

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

  .bottle-view-layout.has-image {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 170px);
    gap: 0.8rem;
  }

  .bottle-view-photo .view-thumb {
    width: min(170px, 100%);
    max-height: 240px;
  }

  .bottle-view-header {
    align-items: center;
    flex-direction: row;
  }

  .bottle-view-title-link {
    margin-left: auto;
  }

  .bottle-view-footer-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .summary-card {
    padding: 0.85rem;
  }

  .pick-pour-head {
    justify-items: center;
  }

  .pick-pour-toggle {
    white-space: normal;
    border-radius: 10px;
  }

  .pick-pour-actions {
    align-items: center;
  }

  .pick-pour-result {
    text-align: center;
  }

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

  .inline-form {
    gap: 0.6rem;
  }

  .inline-form button {
    width: 100%;
  }

  .table-wrap {
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
  }

  .data-table {
    min-width: 760px;
    font-size: 0.92rem;
  }

  .desktop-table-wrap {
    display: none;
  }

  .mobile-bottle-list {
    display: block;
  }

  .mobile-tasting-list {
    display: block;
  }

  .settings-type-list {
    display: grid;
  }

  .settings-bottle-types-table {
    display: none;
  }

  .data-table th,
  .data-table td {
    padding: 0.55rem;
  }

  .table-thumb {
    width: 44px;
    height: 44px;
  }

  .role-form {
    width: 100%;
  }

  .role-form input[type="email"],
  .role-form select {
    width: 100%;
    min-width: 0;
  }

  .modal {
    width: calc(100vw - 1rem);
    max-width: none;
  }

  .image-lightbox {
    width: calc(100vw - 1rem);
  }

  .lightbox-image {
    max-height: 72vh;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 15px;
  }

  .top-nav a,
  .top-nav .muted {
    font-size: 0.92rem;
  }

  .button,
  button {
    padding: 0.72rem 0.9rem;
    font-size: 0.95rem;
  }

  .top-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .mobile-bottle-meta {
    grid-template-columns: 1fr;
  }

  .mobile-bottle-foot {
    align-items: flex-end;
  }

  .mobile-tasting-foot {
    align-items: flex-end;
  }

  .settings-type-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .thumb {
    height: 150px;
  }

  .view-thumb {
    width: 100%;
    max-height: 220px;
  }

  .bottle-view-layout.has-image {
    grid-template-columns: minmax(0, 1fr) minmax(96px, 128px);
    gap: 0.65rem;
  }

  .bottle-view-photo .view-thumb {
    width: min(128px, 100%);
    max-height: 180px;
  }

  .bottle-view-header {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.45rem;
  }

  .bottle-view-header h2 {
    margin: 0;
    min-width: 0;
    font-size: 1.18rem;
    line-height: 1.2;
  }

  .bottle-view-title-link {
    margin-left: 0;
    justify-self: end;
    white-space: nowrap;
    font-size: 0.92rem;
  }

  body.is-pwa .bottle-view-header {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.45rem;
  }

  body.is-pwa .bottle-view-header h2 {
    margin: 0;
    min-width: 0;
    font-size: 1.18rem;
    line-height: 1.2;
  }

  body.is-pwa .bottle-view-title-link {
    margin-left: 0;
    justify-self: end;
    white-space: nowrap;
    font-size: 0.92rem;
  }

  .flash {
    padding: 0.55rem;
  }

  .narrow {
    max-width: 100%;
  }

  .auth-centered-wrap {
    min-height: calc(100vh - 190px);
  }

  .auth-request-login {
    gap: 0.7rem;
  }

  .modal-close-wrap {
    margin-bottom: 0.25rem;
  }

  .lightbox-image {
    max-height: 68vh;
  }
}

/* ---- Spirit Tracker brand polish ---- */
.brand-word {
  font-family: var(--font-head);
  font-weight: 700;
}

.card {
  border-radius: 18px;
  border-color: var(--line);
  box-shadow: 0 18px 40px rgba(27, 27, 31, 0.08);
}

.section-header h2,
.settings-page h2 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.6rem;
}

.button,
button {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.82rem;
  border-radius: 999px;
}

.link,
.icon-link,
.nav-logout-button,
.sort-link,
.pick-pour-multiselect summary,
.pick-pour-multiselect-option {
  text-transform: none;
  letter-spacing: normal;
}

.icon-link {
  border-radius: 10px;
}

.summary-card {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  border-color: #dcc7a6;
  box-shadow: 0 18px 34px rgba(27, 27, 31, 0.12);
}

.summary-card h3 {
  font-size: 1.2rem;
}

.brand-tagline {
  display: block;
  margin: 0.2rem 0 0.4rem;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-strong);
}

.brand-lockup {
  display: block;
  width: min(240px, 70%);
  height: auto;
  margin: 0.2rem auto 1rem;
}

.flash {
  font-weight: 500;
}
