:root {
  --shell-field: #17352c;
  --shell-ink: #15181c;
  --shell-paper: #f5f6f3;
  --shell-white: #ffffff;
  --shell-sodium: #f0b429;
  --shell-dusk: #6e7fd9;
  --shell-coral: #e2563f;
  --shell-slate: #6a7280;
  --shell-line: #e0e2de;
  --shell-focus: #17352c;
  --shell-nav-height: 4.65rem;
  --shell-rail-width: 11rem;
}

html { background: var(--shell-paper); }

body {
  background: var(--shell-paper) !important;
  color: var(--shell-ink) !important;
}

.ledger-grain { background-image: none !important; }

.shell-skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 80;
  padding: 0.55rem 0.8rem;
  border-radius: 0.6rem;
  background: var(--shell-field);
  color: var(--shell-white);
  transform: translateY(-150%);
}
.shell-skip:focus,
.shell-skip:focus-visible { transform: none; }

.app-masthead {
  background: var(--shell-white);
  border-bottom: 1px solid var(--shell-line);
}
.app-masthead__inner { position: relative; }

.shell-brand {
  font-family: "Bricolage Grotesque", ui-sans-serif, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--shell-field);
}

.shell-main {
  min-height: calc(100vh - 5rem);
  color: var(--shell-ink);
}

.shell-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  background: rgba(255,255,255,0.98);
  border-top: 1px solid var(--shell-line);
  box-shadow: 0 -8px 30px rgba(21,24,28,0.06);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  backdrop-filter: blur(14px);
}

.shell-nav__list {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  margin: 0;
  padding: 0.3rem 0.45rem;
  list-style: none;
  overflow: hidden;
}

.shell-nav__item { flex: 1 1 0; min-width: 0; }

.shell-nav__link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 44px;
  min-height: 54px;
  padding: 0.35rem 0.2rem;
  border-radius: 0.8rem;
  color: var(--shell-slate);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.05;
  transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.shell-nav__icon { width: 1.18rem; height: 1.18rem; display: block; }
.shell-nav__label { display: block; white-space: nowrap; }

.shell-nav__link.is-current {
  color: var(--shell-field);
  background: rgba(23,53,44,0.08);
  box-shadow: none;
}

.shell-nav__link.is-current::before {
  content: "";
  position: absolute;
  top: 0.16rem;
  width: 1.25rem;
  height: 0.18rem;
  border-radius: 999px;
  background: var(--shell-sodium);
}

.shell-nav__link:hover,
.shell-nav__link:focus-visible {
  color: var(--shell-field);
  background: rgba(23,53,44,0.06);
}

.has-shell-nav .shell-main {
  padding-bottom: calc(var(--shell-nav-height) + env(safe-area-inset-bottom, 0px) + 1.2rem);
}

/* Make the legacy dark-surface utility vocabulary render as a light product
   until each retained view is simplified in its own task. */
.shell-main [class*="bg-paper/"] { background-color: var(--shell-white) !important; }
.shell-main [class*="border-paper/"] { border-color: var(--shell-line) !important; }
.shell-main .text-paper,
.shell-main [class*="text-paper/"] { color: var(--shell-ink) !important; }

.shell-main .bg-field.text-paper,
.shell-main .bg-dusk.text-paper,
.shell-main .bg-coral.text-paper,
.shell-main .bg-field .text-paper,
.shell-main .bg-dusk .text-paper,
.shell-main .bg-coral .text-paper,
.shell-main .bg-field [class*="text-paper/"],
.shell-main .bg-dusk [class*="text-paper/"],
.shell-main .bg-coral [class*="text-paper/"] {
  color: var(--shell-white) !important;
}

.shell-card,
.shell-state,
.shell-listing,
.shell-form {
  border-radius: 1rem;
  border: 1px solid var(--shell-line);
}

.shell-card {
  background: var(--shell-white);
  color: var(--shell-ink);
  padding: 1.15rem 1.25rem;
  box-shadow: 0 8px 28px rgba(21,24,28,0.04);
}

.shell-card__label,
.shell-state__title {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--shell-slate);
}

.shell-card__value {
  margin-top: 0.4rem;
  font-family: "Bricolage Grotesque", ui-sans-serif, sans-serif;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.shell-card__hint,
.shell-state__body {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--shell-slate);
}

.shell-state {
  padding: 1rem 1.1rem;
  background: var(--shell-white);
}

.shell-state--error { border-color: rgba(226,86,63,0.45); }
.shell-state--success { border-color: rgba(23,53,44,0.25); }

.shell-action,
.shell-form button,
.shell-form input,
.shell-form select,
.shell-form textarea { border-radius: 0.75rem; }

.shell-action {
  display: inline-flex;
  margin-top: 0.6rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid currentColor;
  text-decoration: none;
}

.shell-form label { display: block; margin-top: 0.75rem; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--shell-focus);
  outline-offset: 2px;
}

@media (min-width: 900px) {
  .has-shell-nav .app-masthead__inner,
  .has-shell-nav .shell-main { margin-left: var(--shell-rail-width); }

  .shell-nav {
    top: 0;
    right: auto;
    bottom: 0;
    width: var(--shell-rail-width);
    padding: 6.25rem 0.85rem 1rem;
    border-top: 0;
    border-right: 1px solid var(--shell-line);
    box-shadow: 12px 0 32px rgba(21,24,28,0.035);
    background: var(--shell-white);
    backdrop-filter: none;
  }

  .shell-nav::before {
    content: "Brim";
    position: absolute;
    top: 1.6rem;
    left: 1.15rem;
    font-family: "Bricolage Grotesque", ui-sans-serif, sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--shell-field);
  }

  .shell-nav__list { flex-direction: column; gap: 0.35rem; padding: 0; }
  .shell-nav__item { flex: 0 0 auto; }

  .shell-nav__link {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.7rem;
    min-height: 46px;
    padding: 0.68rem 0.75rem;
    font-size: 0.88rem;
    border-radius: 0.8rem;
  }

  .shell-nav__link.is-current::before {
    top: 50%;
    left: -0.85rem;
    width: 0.18rem;
    height: 1.55rem;
    transform: translateY(-50%);
  }

  .has-shell-nav .shell-main { padding-bottom: 2.5rem; }
}

@media (max-width: 899px) {
  .app-masthead__inner {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
