html { visibility: hidden; }
html[data-ready] { visibility: visible; }

.page-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  margin-block-end: var(--space-2);
  color: var(--text);
}
.page-subtitle {
  color: var(--text-muted);
  margin-block-end: var(--space-6);
}
.welcome-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}
.welcome-grid app-card { width: 100%; }
.welcome-grid p { color: var(--text-muted); margin-block-end: var(--space-3); }
.welcome-grid p:last-child { margin-block-end: 0; }

.brand-mark {
  display: inline-flex; align-items: center;
}
.brand-mark img { height: 1.85rem; width: auto; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand-mark .brand-full    { display: inline-flex; }
.brand-mark .brand-compact { display: none; }
app-shell[data-sidebar-collapsed] .brand-mark .brand-full    { display: none; }
app-shell[data-sidebar-collapsed] .brand-mark .brand-compact { display: inline-flex; }
.brand-mark brand-logo { --brand-logo-height: 1.5rem; }

.horizontal-logo {
  display: none;
  align-items: center;
  margin-inline-end: var(--space-2);
  text-decoration: none;
}
.horizontal-logo brand-logo { --brand-logo-height: 1.5rem; }
@media (max-width: 768px) {
  .horizontal-logo { display: inline-flex; }
}
/* In horizontal layout the in-header logo is always visible (sidebar brand is hidden) */
app-shell[data-nav-layout="horizontal"] .horizontal-logo { display: inline-flex; }
app-shell[data-nav-layout="horizontal"] .menu-toggle { display: none; }
@media (max-width: 768px) {
  app-shell[data-nav-layout="horizontal"] .menu-toggle { display: inline-flex; }
}

.menu-toggle {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  flex-shrink: 0;
  padding: 0.45rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--header-text);
  cursor: pointer;
  position: relative;
  transition: all 0.05s ease;
  margin-left: 2rem;
}
.menu-toggle:hover { background: var(--surface-hover); color: var(--primary); }
.menu-toggle svg {
  width: 100%; height: 100%;
  position: absolute;
  inset: 0;
  margin: auto;
  padding: 0.45rem;
  box-sizing: border-box;
  fill: currentColor;
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.menu-toggle .menu-btn-open  { opacity: 1; transform: rotate(0); }
.menu-toggle .menu-btn-close { opacity: 0; transform: rotate(-90deg); }
app-shell[data-sidebar-collapsed] .menu-toggle .menu-btn-open,
app-shell[data-sidebar-open]      .menu-toggle .menu-btn-open {
  opacity: 0;
  transform: rotate(90deg);
}
app-shell[data-sidebar-collapsed] .menu-toggle .menu-btn-close,
app-shell[data-sidebar-open]      .menu-toggle .menu-btn-close {
  opacity: 1;
  transform: rotate(0);
}

.demo-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.demo-actions app-button { display: inline-block; width: auto; }

/* Standard row height for all wireTable() tables (core/data-table.js adds this class). */
.data-table th,
.data-table td {
  height: 3.25rem;
  padding: 0 var(--space-4);
  text-align: start;
  border-block-end: 1px solid var(--border);
  vertical-align: middle;
}

/* Full-width loading / empty / error row used by wireTable() (core/data-table.js). */
.data-table-message {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-5) var(--space-4);
}
.data-table-message.is-error { color: var(--danger); }

/* Search box (core/data-table.js `search`): the loader inserts this ABOVE the
   card/wrapper that holds the table (not inside it); it filters the loaded rows
   client-side. */
.data-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-block-end: var(--space-3);
}
.data-table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.data-table-toolbar .data-table-search-wrap { margin-block-end: 0; flex: 1; }
.data-table-search-wrap {
  display: flex;
  justify-content: flex-end;
  margin-block-end: var(--space-3);
}
.data-table-search {
  width: 100%;
  max-width: 22rem;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.data-table-search::placeholder { color: var(--text-muted); }
.data-table-search:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

/* Sortable column headers (core/data-table.js): the loader wraps a sortable
   <th>'s content in this button and appends a direction indicator. */
.data-table-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
/* Fixed-width box + text-presentation arrows (\FE0E) so swapping ↕→↑/↓ never
   changes the header width — otherwise the auto-sized column visibly shifts. */
.data-table-sort-icon {
  display: inline-block;
  flex: none;
  width: 1em;
  text-align: center;
  font-size: 0.85em;
  line-height: 1;
  opacity: 0.45;
}
.data-table-sort-icon::before { content: "\2195\FE0E"; }            /* ↕ unsorted */
[aria-sort="ascending"]  .data-table-sort-icon { opacity: 1; }
[aria-sort="ascending"]  .data-table-sort-icon::before { content: "\2191\FE0E"; }  /* ↑ */
[aria-sort="descending"] .data-table-sort-icon { opacity: 1; }
[aria-sort="descending"] .data-table-sort-icon::before { content: "\2193\FE0E"; }  /* ↓ */

/* Master/detail expand toggle + hidden detail row (core/data-table.js). */
.data-table-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--duration-fast), background var(--duration-fast), border-color var(--duration-fast);
}
.data-table-toggle-btn:hover { background: var(--surface-hover); color: var(--text); }
.data-table-toggle-btn[aria-expanded="true"] {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.4);
}
.data-table-chevron {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  flex-shrink: 0;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.data-table-toggle-btn[aria-expanded="true"] .data-table-chevron { transform: rotate(180deg); }

.data-table-detail[hidden] { display: none; }
.data-table-detail-cell { padding: 0 !important; }

/* Reason attached to a control the member can't use (core/dom.js
   disabledWithReason). Two presentations, chosen by INPUT CAPABILITY rather than
   viewport width — a hover tooltip is simply unreachable without a pointer, and a
   narrow window on a laptop still has a mouse. */
.tip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.tip-wrap:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Pointer devices: a real tooltip, on hover AND focus so it is keyboard-reachable.

   `position: fixed`, NOT absolute. These buttons sit in the last column of
   `.avail-table-wrap`, which sets `overflow-x: auto` — and per spec a non-visible
   overflow on one axis makes `visible` on the other compute to `auto`, so the wrapper
   clips vertically too. An absolutely-positioned tooltip is cut off by that ancestor
   however high its z-index. Fixed positioning leaves the clipping context entirely;
   core/dom.js sets top/left from the wrapper's rect on hover/focus. */
@media (hover: hover) {
  .tip-wrap .tip {
    position: fixed;
    z-index: 100;
    inline-size: max-content;
    max-inline-size: min(20rem, 70vw);
    white-space: normal;
    text-align: start;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    /* Follows the theme: a surface panel, not a fixed dark chip — var(--text) as a
       background reads as near-black in light mode and near-white in dark. */
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    font-size: var(--fs-xs);
    font-weight: var(--fw-regular);
    line-height: var(--lh-normal);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-fast) var(--ease-out);
  }
  .tip-wrap.is-tip-open .tip {
    opacity: 1;
    visibility: visible;
  }
}

/* Touch: no hover to reveal anything, so the reason is just there. Stacked under the
   control and allowed to wrap — never a tooltip the member cannot open. */
@media (hover: none) {
  .tip-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
  .tip-wrap .tip {
    max-inline-size: 18rem;
    white-space: normal;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    line-height: var(--lh-normal);
  }
}

/* Reserve-from-calendar modal content (core/reserve-flow.js, rendered into the
   <app-modal> default slot — styled here since it lives in the light DOM). */
.reserve-summary {
  display: grid;
  gap: var(--space-1);
  margin-block-end: var(--space-4);
  padding-block-end: var(--space-4);
  border-block-end: 1px solid var(--border);
}
/* Activity photo (occurrence.image.url) — square, above the rows, like the legacy popup. */
.reserve-summary-img {
  justify-self: center;
  inline-size: 100%;
  max-inline-size: 12rem;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-block-end: var(--space-2);
}
.reserve-summary-row { display: flex; gap: var(--space-3); font-size: var(--fs-sm); }
.reserve-summary-label { color: var(--text-muted); min-width: 7rem; }
.reserve-summary-value { color: var(--text); font-weight: var(--fw-medium); }
.reserve-note { margin: 0 0 var(--space-3); color: var(--text); }
.reserve-note:last-child { margin-block-end: 0; }
.reserve-note.is-error { color: var(--danger); }
.reserve-note.is-success { color: var(--success); }

@media (max-width: 768px) {
  fullscreen-toggle,
  switcher-trigger { display: none; }
}
