/* Approved package 04 shell. Component layouts remain scoped to their pages. */
:root {
  --tm-primary-orange: #ad4b0a;
  --tm-primary-orange-hover: #8b3b08;
  --tm-text-secondary: #72614f;
  --tm-text-muted: #72614f;
}

body.tm-app {
  background: var(--tm-cream);
}

.tm-app [hidden] {
  display: none !important;
}

.tm-app-shell {
  width: min(1100px, calc(100% - 48px));
  margin-inline: auto;
}

.tm-app-main {
  padding-block: 36px 72px;
}

.tm-app :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid #17548b;
  outline-offset: 3px;
}

.tm-app :is(button, .tm-btn) {
  min-height: 44px;
  touch-action: manipulation;
}

.tm-skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 12px;
  color: var(--tm-brown-dark);
  background: white;
}

.tm-skip-link:focus {
  top: 8px;
}

.tm-app-header {
  background: #f9d864 url("../images/hero-background.3e8b2110155c.png") center 35%;
  border-bottom: 2px solid var(--tm-primary-orange);
}

.tm-app-topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 28px;
  align-items: center;
  min-height: 72px;
}

.tm-app-topbar > .tm-brand-lockup {
  width: fit-content;
  min-width: 0;
  min-height: 44px;
  padding: 0;
}

.tm-app-topbar .tm-brand-text {
  margin-left: 0;
  font-size: 1.75rem;
}

.tm-app-links {
  display: flex;
  gap: 8px;
  align-self: stretch;
}

.tm-app-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 17px 0;
  color: var(--tm-brown-dark);
  font-weight: 650;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.tm-app-links a[aria-current='page'] {
  border-bottom-color: var(--tm-primary-orange);
  border-radius: 8px 8px 0 0;
  background: #fff8e7b5;
}

.tm-account {
  position: relative;
}

.tm-account-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--tm-brown-dark);
  border-radius: 50%;
  color: white;
  background: var(--tm-brown-dark);
  font-weight: 700;
  cursor: pointer;
}

.tm-account-actions {
  position: absolute;
  top: 56px;
  right: 0;
  z-index: 20;
  width: min(260px, calc(100vw - 32px));
  padding: 16px;
  overflow-wrap: anywhere;
  background: #fffdf8;
  border: 1px solid var(--tm-brown-light);
  border-radius: 12px;
  box-shadow: 0 8px 24px #4a372826;
}

.tm-account-actions p {
  margin-bottom: 8px;
  font-weight: 650;
}

.tm-account-actions a {
  display: block;
  padding: 10px 0;
  min-height: 44px;
  color: var(--tm-primary-orange);
}

.tm-app .tm-error-summary {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border: 1px solid #b63a28;
  border-radius: 10px;
  background: #fff2ee;
  color: #8d2518;
}

.tm-error-summary-icon {
  width: 24px;
  height: 24px;
}

.tm-app .tm-error-summary h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 700;
}

.tm-error-summary ul {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
}

.tm-error-summary li {
  overflow-wrap: anywhere;
}

.tm-error-summary a {
  color: inherit;
  text-decoration: underline;
}

.tm-error-summary:focus {
  outline: 3px solid #17548b;
  outline-offset: 3px;
}

.tm-app .tm-field-error {
  color: #a72817;
  font-size: .9rem;
}

.tm-app input[aria-invalid='true'] {
  border-color: #b63a28;
}

.tm-global-progress {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 10px;
  color: white;
  background: var(--tm-brown-dark);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.htmx-request .tm-global-progress,
.tm-global-progress.htmx-request {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 650px) {
  .tm-app-shell {
    width: calc(100% - 32px);
  }

  .tm-app-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    padding-top: 8px;
    gap: 4px;
  }

  .tm-app-links {
    grid-row: 2;
    grid-column: 1 / -1;
    gap: 4px;
    margin-top: 0;
  }

  .tm-app-links a {
    flex: 1;
    min-width: 0;
    padding: 12px 5px;
    min-height: 44px;
    font-size: 14px;
    text-align: center;
  }

  .tm-account {
    grid-row: 1;
    grid-column: 2;
  }

  .tm-app-main {
    padding-top: 26px;
  }
}
