:root {
  --coffee-ink: #2c1b12;
  --coffee-roast: #5b3525;
  --coffee-caramel: #c98a54;
  --coffee-caramel-dark: #a96839;
  --coffee-cream: #f7f0e8;
  --coffee-foam: #fffaf5;
  --coffee-muted: #735e50;
  --coffee-line: rgba(91, 53, 37, 0.14);
  --bs-primary: #a96839;
  --bs-primary-rgb: 169, 104, 57;
  --bs-link-color: #8a4f2c;
  --bs-link-hover-color: #5b3525;
  --bs-body-color: #30221b;
  --bs-secondary-color: #735e50;
  --bs-border-color: rgba(91, 53, 37, 0.14);
}

body,
.bg-light {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--coffee-foam) 0%, var(--coffee-cream) 100%) !important;
  color: var(--bs-body-color);
}

a {
  color: var(--bs-link-color);
}

a:hover,
a:focus {
  color: var(--bs-link-hover-color);
}

.navbar.bg-dark {
  background: var(--coffee-ink) !important;
}

.navbar .nav-link {
  color: rgba(255, 250, 245, 0.72);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.active {
  color: #f2c69b;
}

.navbar-brand {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
}

.btn-primary {
  --bs-btn-bg: var(--coffee-caramel-dark);
  --bs-btn-border-color: var(--coffee-caramel-dark);
  --bs-btn-hover-bg: #8a4f2c;
  --bs-btn-hover-border-color: #8a4f2c;
  --bs-btn-active-bg: #704022;
  --bs-btn-active-border-color: #704022;
}

.btn-dark {
  --bs-btn-bg: var(--coffee-ink);
  --bs-btn-border-color: var(--coffee-ink);
  --bs-btn-hover-bg: var(--coffee-roast);
  --bs-btn-hover-border-color: var(--coffee-roast);
  --bs-btn-active-bg: #1d110c;
  --bs-btn-active-border-color: #1d110c;
}

.btn-outline-dark,
.btn-outline-secondary {
  --bs-btn-color: var(--coffee-roast);
  --bs-btn-border-color: rgba(91, 53, 37, 0.42);
  --bs-btn-hover-bg: var(--coffee-roast);
  --bs-btn-hover-border-color: var(--coffee-roast);
  --bs-btn-active-bg: var(--coffee-ink);
  --bs-btn-active-border-color: var(--coffee-ink);
}

.btn-outline-success {
  --bs-btn-color: #52663e;
  --bs-btn-border-color: rgba(82, 102, 62, 0.52);
  --bs-btn-hover-bg: #52663e;
  --bs-btn-hover-border-color: #52663e;
}

.btn-outline-danger {
  --bs-btn-color: #9b3f35;
  --bs-btn-border-color: rgba(155, 63, 53, 0.48);
  --bs-btn-hover-bg: #9b3f35;
  --bs-btn-hover-border-color: #9b3f35;
}

.btn-outline-coffee {
  --bs-btn-color: var(--coffee-roast);
  --bs-btn-border-color: rgba(91, 53, 37, 0.44);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--coffee-roast);
  --bs-btn-hover-border-color: var(--coffee-roast);
  --bs-btn-active-bg: var(--coffee-ink);
  --bs-btn-active-border-color: var(--coffee-ink);
}

.btn-navbar-quiet {
  --bs-btn-color: #fff;
  --bs-btn-border-color: rgba(255, 255, 255, 0.42);
  --bs-btn-hover-color: var(--coffee-ink);
  --bs-btn-hover-bg: #fff;
  --bs-btn-hover-border-color: #fff;
}

.btn-navbar-primary {
  --bs-btn-color: var(--coffee-ink);
  --bs-btn-bg: var(--coffee-caramel);
  --bs-btn-border-color: var(--coffee-caramel);
  --bs-btn-hover-color: var(--coffee-ink);
  --bs-btn-hover-bg: #e1ad78;
  --bs-btn-hover-border-color: #e1ad78;
}

.card {
  background: rgba(255, 250, 245, 0.94);
  border: 1px solid var(--coffee-line);
  box-shadow: 0 0.6rem 1.6rem rgba(44, 27, 18, 0.07) !important;
}

.app-main h1,
.app-main h2,
.app-main .h1,
.app-main .h2 {
  color: var(--coffee-ink);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.025em;
}

.app-main h3,
.app-main .h3,
.app-main .h4,
.app-main .h5,
.app-main .h6 {
  color: var(--coffee-roast);
}

.bg-white,
.bg-light {
  background-color: rgba(255, 250, 245, 0.8) !important;
}

.bg-warning-subtle {
  background-color: #f6e6cc !important;
  color: #62401e !important;
}

.alert {
  border: 0;
  border-left: 0.28rem solid currentColor;
  border-radius: 0.8rem;
}

.alert-info {
  --bs-alert-color: #5c4837;
  --bs-alert-bg: #eee0d1;
  --bs-alert-border-color: #d7bd9d;
}

.alert-danger {
  --bs-alert-color: #7c3029;
  --bs-alert-bg: #f9e2df;
  --bs-alert-border-color: #dca19b;
}

.alert-success {
  --bs-alert-color: #435431;
  --bs-alert-bg: #e3ead7;
  --bs-alert-border-color: #acbd96;
}

.alert-warning {
  --bs-alert-color: #66471f;
  --bs-alert-bg: #f7e8cf;
  --bs-alert-border-color: #dfbd85;
}

.badge.text-bg-secondary {
  background-color: #806451 !important;
}

.badge.text-bg-success {
  background-color: #61764b !important;
}

code {
  background: #efe1d1;
  border-radius: 0.35rem;
  color: #7a4124;
  padding: 0.12rem 0.32rem;
}

hr {
  border-color: var(--coffee-line);
  opacity: 1;
}

summary {
  color: var(--coffee-roast);
}

.form-control,
.form-select {
  background-color: rgba(255, 255, 255, 0.86);
  border-color: rgba(91, 53, 37, 0.25);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--coffee-caramel);
  box-shadow: 0 0 0 0.25rem rgba(201, 138, 84, 0.22);
}

.form-check-input:checked {
  background-color: var(--coffee-caramel-dark);
  border-color: var(--coffee-caramel-dark);
}

.form-check-input:focus {
  border-color: var(--coffee-caramel);
  box-shadow: 0 0 0 0.25rem rgba(201, 138, 84, 0.22);
}

.offline-card {
  max-width: 28rem;
  margin-top: 12vh;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(33, 27, 18, 0.08);
  border-radius: 1.5rem;
  box-shadow: 0 0.75rem 2rem rgba(44, 27, 18, 0.1);
}

.mobile-tab-bar {
  display: none;
}

.navbar-brand {
  font-weight: 600;
}

.navbar-shell {
  align-items: center;
}

.navbar-context {
  min-width: 0;
  max-width: min(65vw, 18rem);
}

.navbar-household {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  max-width: 100%;
}

.navbar-household:hover,
.navbar-household:focus {
  color: #fff;
}

.navbar-user-tools {
  width: 100%;
}

.card {
  border: 0;
  border-radius: 1rem;
}

.card .border,
.card.border-light-subtle {
  border-radius: 0.9rem !important;
}

.btn,
.form-control,
.form-select {
  min-height: 48px;
}

.btn-sm {
  min-height: 38px;
}

.form-control,
.form-select {
  font-size: 16px;
}

.page-actions {
  display: grid;
  gap: 0.75rem;
}

.metric-card {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--coffee-line);
}

.list-meta {
  color: #6c757d;
  font-size: 0.95rem;
}

.empty-state {
  background: rgba(255, 250, 245, 0.72);
  border: 1px dashed rgba(91, 53, 37, 0.26);
}

.eyebrow {
  color: var(--coffee-caramel-dark);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.welcome-hero {
  align-items: center;
  background: linear-gradient(135deg, var(--coffee-ink), #55301f 58%, #7b492c);
  border-radius: 1.5rem;
  color: #fffaf5;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  min-height: 22rem;
  overflow: hidden;
  padding: clamp(2rem, 7vw, 4.5rem);
  position: relative;
}

.welcome-hero-content {
  max-width: 38rem;
  position: relative;
  z-index: 1;
}

.welcome-hero .eyebrow {
  color: #f2c69b;
}

.welcome-hero h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  letter-spacing: -0.04em;
  line-height: 0.98;
  margin-bottom: 1.25rem;
}

.welcome-hero .lead {
  color: rgba(255, 250, 245, 0.82);
  max-width: 33rem;
}

.welcome-note {
  color: rgba(255, 250, 245, 0.62);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.welcome-mark {
  align-items: center;
  background: rgba(255, 250, 245, 0.1);
  border: 1px solid rgba(255, 250, 245, 0.2);
  border-radius: 50%;
  display: flex;
  flex: 0 0 auto;
  height: clamp(9rem, 23vw, 16rem);
  justify-content: center;
  margin: 0 0 0 2rem;
  transform: rotate(-12deg);
  width: clamp(9rem, 23vw, 16rem);
}

.welcome-mark span {
  filter: sepia(0.28);
  font-size: clamp(4rem, 11vw, 8rem);
}

.welcome-features {
  margin-top: 0;
}

.feature-card {
  background: rgba(255, 250, 245, 0.72);
  border: 1px solid var(--coffee-line);
  border-radius: 1rem;
  padding: 1.5rem;
}

.feature-card h2 {
  color: var(--coffee-ink);
  font-family: Georgia, "Times New Roman", serif;
}

.feature-card p {
  color: var(--coffee-muted);
}

.feature-number {
  color: var(--coffee-caramel-dark);
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 1.25rem;
}

.auth-card {
  margin-top: 3vh;
}

.min-w-0 {
  min-width: 0;
}

.bean-card-actions {
  display: grid;
  gap: 0.75rem;
}

.bean-card-actions .btn,
.bean-secondary-actions .btn {
  align-items: center;
  display: flex;
  justify-content: center;
  margin: 0;
  width: 100%;
}

.bean-secondary-actions {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
  width: 100%;
}

.bean-secondary-actions > *,
.bean-secondary-actions form {
  min-width: 0;
  width: 100%;
}

.icon-button {
  align-items: center;
  display: inline-flex;
  flex: 0 0 48px;
  justify-content: center;
  padding: 0;
  width: 48px;
}

.icon-button svg,
.icon-link svg {
  fill: none;
  height: 1.5rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 1.5rem;
}

.icon-button svg {
  stroke: currentColor;
}

.icon-link {
  align-items: center;
  color: var(--bs-secondary-color);
  display: inline-flex;
  flex: 0 0 48px;
  justify-content: center;
  min-height: 48px;
  text-decoration: none;
}

.icon-link:hover,
.icon-link:focus {
  color: var(--bs-primary);
}

.brew-history-card {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.brew-history-content {
  min-width: 0;
}

.brew-history-side {
  align-items: end;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.brew-history-actions {
  display: flex;
  gap: 0.25rem;
}

.brew-history-actions .icon-link {
  flex-basis: 40px;
  min-height: 40px;
  width: 40px;
}

.brew-step-card {
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.brew-step-card:hover,
.brew-step-card:focus-within {
  box-shadow: 0 0.5rem 1.25rem rgba(33, 37, 41, 0.12) !important;
  transform: translateY(-1px);
}

.brew-method-form {
  max-width: 52rem;
}

.brew-iced-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(33, 37, 41, 0.08);
  border-radius: 1rem;
  display: inline-flex;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.75rem 1rem 0.75rem 3rem;
}

.brew-method-card {
  appearance: none;
  background: var(--bs-card-bg);
  border: 0;
  color: inherit;
  cursor: pointer;
  min-height: 100%;
  padding: 0;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.brew-method-card:hover,
.brew-method-card:focus-visible {
  box-shadow: 0 0.5rem 1.25rem rgba(33, 37, 41, 0.12) !important;
  outline: 0;
  transform: translateY(-1px);
}

.espresso-last-brew {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(33, 37, 41, 0.08);
  border-radius: 1rem;
  padding: 1rem;
}

.espresso-last-brew-grid {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.espresso-last-brew-grid > * {
  flex: 1 1 0;
  min-width: 0;
}

.last-brew-actions {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
}

.last-brew-actions .btn {
  align-items: center;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.pour-planner {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(33, 37, 41, 0.08);
  border-radius: 1rem;
  padding: 1rem;
}

.pour-entry {
  border-bottom: 1px solid rgba(33, 37, 41, 0.12);
  padding: 1rem 0;
}

.pour-entry:first-child {
  padding-top: 0;
}

.pour-entry:last-child {
  border-bottom: 0;
}

@media (max-width: 991.98px) {
  .app-main {
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
  }

  .mobile-tab-bar {
    align-items: stretch;
    background: rgba(44, 27, 18, 0.98);
    border-top: 1px solid rgba(242, 198, 155, 0.18);
    bottom: 0;
    box-shadow: 0 -0.25rem 1.25rem rgba(44, 27, 18, 0.2);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    left: 0;
    padding: 0.5rem max(0.4rem, env(safe-area-inset-left)) max(0.5rem, env(safe-area-inset-bottom)) max(0.4rem, env(safe-area-inset-right));
    position: fixed;
    right: 0;
    transform: translateZ(0);
    z-index: 1030;
  }

  .mobile-tab-link {
    align-items: center;
    color: rgba(255, 255, 255, 0.78);
    display: flex;
    flex-direction: column;
    font-size: 0.7rem;
    font-weight: 600;
    gap: 0.1rem;
    justify-content: center;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
  }

  .mobile-tab-icon {
    fill: none;
    font-size: 1.25rem;
    line-height: 1;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 1.35rem;
  }

  .mobile-tab-link.is-active {
    color: #f2c69b;
  }

  .mobile-tab-link.is-active:not(.mobile-tab-link-primary) .mobile-tab-icon {
    stroke-width: 2.4;
  }

  .mobile-tab-link-primary {
    color: #fff;
  }

  .mobile-tab-plus {
    align-items: center;
    background: var(--coffee-caramel);
    border: 3px solid var(--coffee-cream);
    border-radius: 50%;
    display: flex;
    font-size: 1.7rem;
    font-weight: 300;
    height: 3rem;
    justify-content: center;
    line-height: 1;
    margin-top: -1.7rem;
    box-shadow: 0 0.35rem 0.8rem rgba(0, 0, 0, 0.28);
    width: 3rem;
  }

  .mobile-tab-link-primary.is-active .mobile-tab-plus {
    background: #e1ad78;
  }
}

.species-options {
  display: grid;
  grid-template-columns: 1fr 1fr 48px;
  gap: 0.5rem;
}

.species-options .btn {
  align-items: center;
  display: flex;
  justify-content: center;
}

.species-options .btn:has(input:checked) {
  background-color: var(--coffee-ink);
  color: var(--bs-white);
}

.species-custom-trigger {
  font-size: 1.25rem;
  padding-inline: 0;
}

.rating-stars-display {
  display: flex;
  justify-content: space-between;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.rating-star {
  position: relative;
  display: block;
  color: #d0d4d9;
  width: 1em;
  text-align: center;
}

.rating-star.is-full {
  color: #ffb400;
}

.rating-star.is-half {
  color: #d0d4d9;
}

.rating-star.is-half::before {
  content: "★";
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  overflow: hidden;
  color: #ffb400;
}

.rating-rail {
  position: relative;
  height: 1rem;
  width: 100%;
  border-radius: 999px;
  background: #d0d4d9;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}

.rating-rail-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, #ffca55 0%, #ffb400 100%);
  border-radius: 999px;
}

.rating-rail-steps {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  z-index: 1;
}

.rating-rail-steps span {
  border-right: 1px solid rgba(255, 255, 255, 0.55);
}

.rating-rail-steps span:last-child {
  border-right: 0;
}

.rating-clear {
  flex-shrink: 0;
}

code {
  font-size: 0.95em;
}

@media (min-width: 768px) {
  .page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
  }
}

@media (min-width: 992px) {
  .navbar-context {
    max-width: 22rem;
  }

  .navbar-user-tools {
    width: auto;
  }
}
