/* Shell, navigation and the reusable pieces shared across screens. */

/* ---------- App shell ---------- */

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.shell__main {
  flex: 1;
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding: var(--space-5) var(--space-4);
  padding-bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom) + var(--space-6));
}

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.masthead__crest { width: 3.25rem; flex-shrink: 0; }

.masthead__names { flex: 1; min-width: 0; }

.masthead__title {
  /* Stays on one line from 320px up, where the crest and bell leave ~280px. */
  font-size: clamp(0.98rem, 4.3vw, 1.3rem);
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--gold);
}

.masthead__tagline {
  font-size: clamp(0.68rem, 2.9vw, 0.8rem);
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.masthead__bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--gold);
}

.masthead__bell svg { width: 1.6rem; height: 1.6rem; }

.masthead__bell[data-unread="true"]::after {
  content: "";
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 0 2px var(--navy);
  animation: pop-in var(--duration-fast) var(--ease-out-quint);
}

/* ---------- Admin sub-navigation ---------- */

.subnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding: 0 var(--space-4) var(--space-4);
}

/* ---------- Bottom tab bar ---------- */

.tab-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: space-around;
  background: var(--navy-sunken);
  border-top: 1px solid var(--hairline-soft);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-bar__link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--tab-bar-height);
  padding: var(--space-2);
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 2px solid transparent;
  transition: color var(--duration-fast) var(--ease-standard),
              border-top-color var(--duration-fast) var(--ease-standard);
}

.tab-bar__link svg { width: 1.5rem; height: 1.5rem; }

.tab-bar__link[aria-current="page"] {
  color: var(--gold);
  border-top-color: var(--gold);
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 3rem;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--text-on-gold);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--duration-instant) var(--ease-standard);
}

.button:hover { filter: brightness(1.08); color: var(--text-on-gold); }
.button:active { filter: brightness(0.94); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }

.button--ghost {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold);
  transition: color var(--duration-instant) var(--ease-standard),
              background-color var(--duration-instant) var(--ease-standard);
}
.button--ghost:hover { color: var(--gold-bright); }
.button--ghost:active { background: var(--hairline-soft); }

.button--go {
  background: var(--green);
  color: #fff;
}

.button--danger {
  background: transparent;
  border-color: #a33;
  color: #e57373;
}

.button--inline { width: auto; }

.button--small {
  min-height: 2.25rem;
  padding: var(--space-2) var(--space-4);
  font-size: 0.9rem;
}

.button--disabled { opacity: 0.35; pointer-events: none; }

/* ---------- Pagination ---------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.pagination__status { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Cards and surfaces ---------- */

.panel {
  background: var(--navy-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
}

.panel + .panel { margin-top: var(--space-4); }

.paper {
  background: var(--paper);
  color: var(--text-on-paper);
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.paper a { color: #8a6414; text-decoration: underline; }

/* ---------- Section headers and the gold divider ---------- */

.page-title {
  text-align: center;
  color: var(--gold);
  margin-bottom: var(--space-2);
}

.page-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.rule {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: var(--gold);
}

.rule::before, .rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--hairline), transparent);
}

.rule__diamond { font-size: 0.7rem; }

/* ---------- Back link ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  color: var(--gold);
}

.back-link svg { width: 1.25rem; height: 1.25rem; }

/* ---------- Forms ---------- */

.field { margin-bottom: var(--space-4); }

.field__label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.field__input,
.field__select,
.field__textarea {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: var(--space-3);
  background: var(--navy-sunken);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color var(--duration-instant) var(--ease-standard);
}

.field__input:focus-visible,
.field__select:focus-visible,
.field__textarea:focus-visible {
  border-color: var(--gold-bright);
}

.field__textarea { min-height: 7rem; resize: vertical; }

.field__checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.field__checkbox input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2rem;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.field__hint {
  margin: var(--space-2) 0 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* ---------- Flash and errors ---------- */

.flash {
  max-width: var(--content-width);
  margin: 0 auto var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--navy-raised);
  animation: rise-in var(--duration-standard) var(--ease-out-quart);
}

.flash--alert { border-color: #a33; color: #f0b4b4; }

.errors {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid #a33;
  border-radius: var(--radius);
  color: #f0b4b4;
}

.errors ul { margin: 0; padding-left: var(--space-5); }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid var(--hairline);
  color: var(--text-muted);
}

.badge--owned { border-color: var(--gold); color: var(--gold); }
.badge--active { background: var(--green-dark); border-color: transparent; color: #7ede97; }
.badge--inactive { background: #23262b; border-color: transparent; color: var(--text-muted); }

/* ---------- Empty states ---------- */

.empty {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--text-muted);
}

/* ---------- Tables ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}

.table th, .table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--hairline-soft);
}

.table tr:last-child td { border-bottom: none; }
.table th { color: var(--text); font-weight: 700; }
.table td:last-child, .table th:last-child { text-align: right; }

.table__value { color: var(--gold); font-size: 1.1rem; }
.table__value--empty { color: var(--text-faint); font-size: 0.95rem; }

/* ---------- Wide screens ---------- */

@media (min-width: 48rem) {
  :root { --content-width: 44rem; }
  .shell__main { padding-inline: var(--space-6); }
}
