/* App shell: filter drawer, brand, responsive chrome. */

html {
  -webkit-text-size-adjust: 100%;
}

body.is-app-preview {
  --app-tabbar-h: calc(4.15rem + env(safe-area-inset-bottom, 0px));
  --app-ribbon-h: 1.7rem;
  padding-top: env(safe-area-inset-top, 0px);
  min-height: 100dvh;
}

.staging-ribbon {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--app-ribbon-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8c547;
  color: #0a0e1a;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-brand {
  display: none;
}

.app-brand-logo {
  border-radius: 8px;
}

.app-brand-copy {
  display: grid;
  line-height: 1.15;
}

.app-brand-copy strong {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.app-brand-copy span {
  font-size: 0.68rem;
  color: var(--mute);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.app-toolbar {
  display: none;
}

.filter-sheet-head {
  display: none;
}

.filter-sheet-backdrop {
  display: none;
}

body.is-app-preview .app-filter-btn {
  appearance: none;
  position: relative;
  border: 1px solid var(--signal);
  background: rgba(232, 197, 71, 0.14);
  color: var(--signal);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 2.7rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  cursor: pointer;
}

body.is-app-preview .app-filter-btn[aria-expanded="true"] {
  background: var(--signal);
  color: #0a0e1a;
}

body.is-app-preview .app-filter-btn.is-criteria-on:not([aria-expanded="true"]) {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

body.is-bot-board .app-filter-btn {
  display: none;
}

body.is-app-preview.filters-open {
  overflow: hidden;
}

.chip,
.tab,
.seg-btn,
.nav-link,
.league-btn,
.row.scan-card-row,
.app-filter-btn {
  transition: transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.chip:active,
.tab:active,
.seg-btn:active,
.nav-link:active,
.league-btn:active,
.app-filter-btn:active {
  transform: scale(0.97);
}

.list.is-skeleton {
  min-height: 18rem;
  background: linear-gradient(
    90deg,
    rgba(22, 31, 53, 0.4) 0%,
    rgba(232, 197, 71, 0.08) 50%,
    rgba(22, 31, 53, 0.4) 100%
  );
  background-size: 220% 100%;
  animation: app-skel 1.1s ease-in-out infinite;
  border-radius: 16px;
}

@keyframes app-skel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.empty {
  padding: 2.2rem 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 16px;
}

@media (max-width: 960px) {
  body.is-app-preview .site-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 60;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: space-evenly;
    gap: 0.15rem;
    padding: 0.35rem 0.35rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: rgba(5, 7, 15, 0.96);
  }

  body.is-app-preview .app-brand {
    display: none;
  }

  body.is-app-preview .nav-link {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.62rem;
    padding: 0.35rem 0.1rem;
    letter-spacing: 0.03em;
  }

  body.is-app-preview .nav-logout {
    margin-top: 0;
  }

  body.is-app-preview .board-head,
  body.is-app-preview .section-head {
    position: sticky;
    top: var(--app-ribbon-h);
    z-index: 30;
    background: rgba(10, 14, 26, 0.94);
    backdrop-filter: blur(12px);
    padding-top: 0.3rem;
    margin-top: 0;
  }

  body.is-app-preview .board-head {
    display: block;
    gap: 0;
    margin: 0 calc(-1 * var(--board-pad-x, 0.9rem)) 0.55rem;
    padding: 0.28rem var(--board-pad-x, 0.9rem) 0.32rem;
  }

  body.is-app-preview .board-actions {
    display: grid;
    grid-template-columns: auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "toggle date filters ."
      "search search search search";
    align-items: center;
    column-gap: 0.38rem;
    row-gap: 0.28rem;
    width: 100%;
  }

  body.is-app-preview .board-actions .view-toggle {
    grid-area: toggle;
    display: inline-flex;
    margin: 0;
    padding: 0.08rem;
    min-height: 0;
    height: 1.85rem;
    align-items: center;
  }

  body.is-app-preview .board-actions .day-pick {
    grid-area: date;
    display: flex;
    align-items: center;
    position: relative;
    min-width: 0;
    min-height: 1.85rem;
    margin: -7px 0;
    padding: 7px 0;
  }

  body.is-app-preview .board-actions .app-filter-btn {
    grid-area: filters;
    justify-self: start;
    align-self: center;
  }

  body.is-app-preview .board-actions .search {
    grid-area: search;
    display: block;
    min-width: 0;
    width: 100%;
  }

  body.is-app-preview .board-actions #csv {
    display: none;
  }

  body.is-app-preview .tab,
  body.is-app-preview .seg-btn {
    min-height: 44px;
  }

  body.is-app-preview .board-head .chip,
  body.is-app-preview .board-head .app-filter-btn {
    position: relative;
    min-height: 0;
    height: 1.85rem;
    padding: 0 0.62rem;
    font-size: 0.7rem;
  }

  body.is-app-preview .board-head .chip::after,
  body.is-app-preview .board-head .app-filter-btn::after {
    content: "";
    position: absolute;
    left: -2px;
    right: -2px;
    top: 50%;
    height: 44px;
    transform: translateY(-50%);
  }

  body.is-app-preview .board-head .day-pick input {
    min-height: 0;
    height: 1.85rem;
    width: 8.15rem;
    max-width: 100%;
    padding: 0 0.3rem;
    font-size: 0.72rem;
    border-radius: 9px;
  }

  body.is-app-preview .board-head .search input {
    width: 100%;
    max-width: none;
    min-height: 0;
    height: 2.05rem;
    padding: 0 0.75rem;
    font-size: 0.84rem;
    border-radius: 10px;
  }

  body.is-app-preview .filter-sheet {
    position: fixed;
    inset: 0;
    z-index: 70;
    pointer-events: none;
  }

  body.is-app-preview .filter-sheet.is-open {
    pointer-events: auto;
  }

  body.is-app-preview .filter-sheet-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  body.is-app-preview .filter-sheet.is-open .filter-sheet-backdrop {
    opacity: 1;
  }

  body.is-app-preview .filter-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 86dvh;
    overflow: auto;
    padding: 0.85rem 1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    border: 1px solid var(--line);
    background: #0f1628;
    transform: translateY(110%);
    transition: transform 0.28s ease;
  }

  body.is-app-preview .filter-sheet.is-open .filter-sheet-panel {
    transform: translateY(0);
  }

  body.is-app-preview .filter-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  body.is-app-preview .filter-sheet-head h2 {
    margin: 0;
    font-size: 1.05rem;
  }

  body.is-app-preview #page-board,
  body.is-app-preview .product-section,
  body.is-app-preview .foot {
    padding-bottom: calc(var(--app-tabbar-h) + 0.75rem);
  }

  body.is-app-preview .sheet-panel {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 400px) {
  body.is-app-preview .board-head .chip,
  body.is-app-preview .board-head .app-filter-btn {
    padding: 0 0.5rem;
  }

  body.is-app-preview .board-head .day-pick input {
    width: 7.85rem;
    font-size: 0.7rem;
  }
}

@media (min-width: 961px) {
  body.is-app-preview {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: var(--app-ribbon-h) minmax(0, 1fr);
    min-height: 100dvh;
  }

  body.is-app-preview .staging-ribbon {
    grid-column: 1 / -1;
  }

  body.is-app-preview .site-nav {
    position: sticky;
    top: var(--app-ribbon-h);
    align-self: start;
    height: calc(100dvh - var(--app-ribbon-h));
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding: 1.1rem 0.85rem 1.25rem;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: #070b16;
  }

  body.is-app-preview .app-brand {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    margin: 0 0 0.85rem;
    padding: 0.15rem 0.35rem 0.85rem;
    border-bottom: 1px solid var(--line);
  }

  body.is-app-preview .nav-link {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
  }

  body.is-app-preview .nav-logout {
    margin-top: auto;
    opacity: 0.85;
  }

  body.is-app-preview .app-frame {
    min-width: 0;
    width: 100%;
  }

  body.is-app-preview .board {
    padding-left: var(--board-pad-x, 1.25rem);
    padding-right: var(--board-pad-x, 1.25rem);
  }

  body.is-app-preview .list {
    width: 100%;
  }

  body.is-app-preview .filter-sheet {
    position: fixed;
    inset: 0;
    z-index: 70;
    pointer-events: none;
  }

  body.is-app-preview .filter-sheet.is-open {
    pointer-events: auto;
  }

  body.is-app-preview .filter-sheet-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  body.is-app-preview .filter-sheet.is-open .filter-sheet-backdrop {
    opacity: 1;
  }

  body.is-app-preview .filter-sheet-panel {
    position: absolute;
    top: calc(var(--app-ribbon-h) + 1rem);
    left: calc(220px + 1.25rem);
    right: 1.25rem;
    width: min(44rem, calc(100vw - 220px - 2.5rem));
    max-height: calc(100dvh - var(--app-ribbon-h) - 2rem);
    overflow: auto;
    padding: 1rem 1.15rem 1.15rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #0f1628;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }

  body.is-app-preview .filter-sheet.is-open .filter-sheet-panel {
    transform: none;
    opacity: 1;
  }

  body.is-app-preview .filter-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
  }

  body.is-app-preview .filter-sheet-head h2 {
    margin: 0;
    font-size: 1.05rem;
  }

  body.is-app-preview .row-controls.density-simple {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11.25rem, 1fr));
    gap: 0.9rem 1.15rem;
  }

  body.is-app-preview .row-controls.density-simple .filter-row {
    width: auto;
    max-width: none;
  }

  body.is-app-preview .row-controls .filter-help {
    max-width: 16rem;
  }

  body.is-app-preview .row-controls.density-full {
    display: flex;
    flex-wrap: wrap;
  }
}
