/* ==========================================================================
   Base: reset, typography, unified app shell (left sidebar, topbar, mobile nav)
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.theme-dark body {
  background-color: var(--bg);
}

/* Every figure in this app lines up in a column somewhere. */
table, .num, input[type="number"] { font-variant-numeric: tabular-nums; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--surface-1); padding: 8px 12px; border-radius: var(--radius);
}
.skip-link:focus { left: 8px; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Modern Semantic <progress class="loading-spinner"> (Conic Trail) ─────── */
@property --arc-start {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@property --arc-end {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@property --progress-dash-animation {
  syntax: "*";
  inherits: false;
  initial-value: , progress-dash 2.6s ease-in-out infinite;
}

@keyframes progress-spin {
  to {
    rotate: 1turn;
  }
}
@keyframes progress-dash {
  from {
    --arc-start: 0deg;
    --arc-end: 8deg;
  }
  50% {
    --arc-start: 100deg;
    --arc-end: 356deg;
  }
  to {
    --arc-start: 360deg;
    --arc-end: 368deg;
  }
}

progress.loading-spinner:indeterminate::-webkit-progress-bar {
  display: none;
  background: none;
}
progress.loading-spinner:indeterminate::-webkit-progress-value {
  display: none;
  background: none;
}
progress.loading-spinner:indeterminate::-moz-progress-bar {
  display: none;
  background: none;
}
progress.loading-spinner:indeterminate::slider-fill {
  display: none;
  background: none;
}

progress.loading-spinner:indeterminate {
  --_from: calc(90deg + var(--arc-start, 0deg));
  --_to: calc(90deg + var(--arc-end, 158deg));
  --size: 36px;
  --thickness: 3px;
  --spinner-color: var(--accent);
  --track-color: color-mix(in srgb, var(--accent) 16%, transparent);
  --spinner-duration: 1.35s;
  --_used-spinner-duration: var(--spinner-duration);

  position: relative;
  display: inline-block;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  appearance: none;
  background: conic-gradient(
      from var(--_from),
      var(--spinner-color) calc(var(--_to) - var(--_from)),
      transparent 0
    )
    var(--track-color);

  @supports (background-clip: border-area) {
    background-clip: border-area;
    border: var(--thickness) solid transparent;
    background-origin: border-box;
  }

  @supports not (background-clip: border-area) {
    --clip-boundary: calc(100% - var(--thickness));
    mask-image: radial-gradient(
      farthest-side,
      transparent var(--clip-boundary),
      black var(--clip-boundary)
    );
    border: 0;
  }

  @media (forced-colors: active) {
    forced-color-adjust: none;
    --spinner-color: CanvasText;
    --track-color: Canvas;
  }

  animation:
    progress-spin var(--_used-spinner-duration) linear infinite
    var(--progress-dash-animation, );
}

progress.loading-spinner.is-sm:indeterminate {
  --size: 20px;
  --thickness: 2.5px;
}

@media (prefers-reduced-motion: reduce) {
  progress.loading-spinner:indeterminate {
    --_used-spinner-duration: 6s;
    --progress-dash-animation: ;
    --arc-end: 158deg;
  }
}

/* ── App Shell (Sidebar + Main Workspace) ─────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* ── Persistent Left Sidebar ──────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-right: 1px solid var(--line);
  z-index: 40;
  user-select: none;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text-1); flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-crest { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; }
.brand-crest img { width: 100%; height: 100%; object-fit: cover; display: none; }
.brand-crest img.for-light { display: block; }
.theme-dark .brand-crest img.for-light { display: none; }
.theme-dark .brand-crest img.for-dark { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 10px; font-weight: 650; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--brand);
}

.sidebar-close-btn { display: none !important; }

.sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-group-title {
  padding: 4px 10px 6px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 33px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.16s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar-link::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 2.5px;
  height: 15px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0;
  transform: translateY(-50%) scaleY(0.35);
  transition:
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.16s ease;
  pointer-events: none;
}
.sidebar-link:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--line-strong) 55%, transparent);
  color: var(--text-1);
  transform: translateX(2px);
  text-decoration: none;
}
.sidebar-link:hover::before {
  opacity: 0.52;
  transform: translateY(-50%) scaleY(0.72);
}
.sidebar-link:active:not(:disabled) {
  transform: translateX(1px) scale(0.976);
}
.sidebar-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow-1);
  font-weight: 700;
}
.sidebar-link.is-active:hover {
  transform: translateX(1px);
}
.sidebar-link.is-active::before {
  opacity: 1;
  transform: translateY(-50%) scaleY(1);
}
.sidebar-link.has-me {
  color: var(--pos);
}
.sidebar-link.has-me::before {
  background: var(--pos);
}

.sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-link:hover .sidebar-icon {
  transform: scale(1.07);
}

.sidebar-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-badge {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 750;
  background: var(--accent);
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

/* Collapsible dropdown navigation */
.sidebar-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 33px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sidebar-dropdown-toggle:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.sidebar-dropdown-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.sidebar-dropdown-toggle.sidebar-group-toggle {
  font-weight: 700;
  color: var(--text-1);
}
.sidebar-dropdown-toggle.has-active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}
.sidebar-dropdown-toggle.is-open {
  color: var(--text-1);
}

.sidebar-chevron {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text-3);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.18s ease;
  flex-shrink: 0;
}
.sidebar-chevron svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.sidebar-dropdown-toggle:hover .sidebar-chevron {
  color: var(--text-1);
}
.sidebar-dropdown-toggle[aria-expanded="true"] .sidebar-chevron {
  transform: rotate(90deg);
  color: var(--text-1);
}

@keyframes submenuReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px 13px;
  padding-left: 9px;
  border-left: 1.5px solid var(--line);
}
.sidebar-submenu:not([hidden]) {
  animation: submenuReveal 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-submenu[hidden] {
  display: none !important;
}

.sidebar-sublink {
  height: 31px;
  padding: 0 8px;
  font-size: 12.5px;
}
.sidebar-sublink .sidebar-icon {
  font-size: 13px;
  width: 16px;
  height: 16px;
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.sidebar-classic-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.sidebar-classic-link:hover {
  color: var(--text-1);
  background: var(--surface-2);
  text-decoration: none;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 39;
}

/* ── Top bar ──────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: saturate(165%) blur(16px);
  -webkit-backdrop-filter: saturate(165%) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 8%, transparent), var(--shadow-topbar);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.topbar-row {
  display: flex; align-items: center; gap: 8px;
  min-height: var(--topbar-h); padding: 6px clamp(12px, 1.5vw, 22px);
  min-width: 0; max-width: 100%; box-sizing: border-box;
}
.clan-strip {
  display: flex; align-items: center;
  padding: 4px clamp(12px, 1.5vw, 22px) 6px;
  border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  min-width: 0; max-width: 100%; box-sizing: border-box;
}

.mobile-menu-btn { display: none !important; }
.mobile-brand {
  display: none;
  font-weight: 800;
  font-size: 14.5px;
  color: var(--text-1);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.mobile-brand:hover { text-decoration: none; }

.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: 0 0 auto; }
.topbar-actions .btn {
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.18s ease,
    transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
.topbar-actions .btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line-strong));
}
.topbar-actions .btn:active:not(:disabled) {
  transform: translateY(0.5px) scale(0.95);
}
.topbar-guide-btn { display: inline-flex; align-items: center; gap: 5px; }
.guide-icon { width: 15px; height: 15px; flex-shrink: 0; color: var(--accent); }
.sync { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; margin-right: 2px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.sync.is-error { color: var(--neg); }

@keyframes refreshSpin {
  to { transform: rotate(360deg); }
}
#refreshBtn.is-busy svg {
  animation: refreshSpin 0.85s linear infinite;
}

dialog:modal {
  overscroll-behavior: contain;
}
dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

/* ── Sub bar ──────────────────────────────────────────────────────────── */
.subbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 6px var(--gutter); border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-1) 75%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-wrap: wrap;
  width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
}
.subbar[hidden] { display: none !important; }
.subbar-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 20px; width: 100%; min-width: 0;
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.subbar-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-width: 0;
}
.subbar-divider {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
  opacity: 0.7;
  flex: 0 0 auto;
}
@media (max-width: 960px) {
  .subbar-divider { display: none; }
  .subbar-group { width: 100%; justify-content: flex-start; gap: 10px 14px; }
}
.subbar.is-view-disabled .subbar-controls {
  opacity: 0.34;
  pointer-events: none;
}
.subbar-mobile-bar { display: none; }
.subbar .week-slider-wrap { margin-left: 0; }

/* ── Personal Standing Banner Slot ────────────────────────────────────── */
.standing-banner-slot {
  padding: 10px var(--gutter) 0;
  width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
}
.standing-banner-slot[hidden] { display: none !important; }

/* ── View outlet ──────────────────────────────────────────────────────── */
.view {
  padding: 16px var(--gutter) 84px;
  outline: none;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.sidebar-scroll,
.table-shell,
.cmd-body,
.cmd-results {
  --scrollbar-thumb: color-mix(in srgb, var(--text-3) 36%, transparent);
  --scrollbar-thumb-hover: color-mix(in srgb, var(--text-2) 55%, transparent);
  --scrollbar-track: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) var(--scrollbar-track);
}
@supports not (scrollbar-color: auto) {
  .sidebar-scroll,
  .table-shell,
  .cmd-body,
  .cmd-results {
    scrollbar-width: auto;
  }
  .sidebar-scroll::-webkit-scrollbar,
  .table-shell::-webkit-scrollbar,
  .cmd-body::-webkit-scrollbar,
  .cmd-results::-webkit-scrollbar {
    width: 7px;
    height: 7px;
  }
  .sidebar-scroll::-webkit-scrollbar-track,
  .table-shell::-webkit-scrollbar-track,
  .cmd-body::-webkit-scrollbar-track,
  .cmd-results::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
  .sidebar-scroll::-webkit-scrollbar-thumb,
  .table-shell::-webkit-scrollbar-thumb,
  .cmd-body::-webkit-scrollbar-thumb,
  .cmd-results::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
  }
  .sidebar-scroll::-webkit-scrollbar-thumb:hover,
  .table-shell::-webkit-scrollbar-thumb:hover,
  .cmd-body::-webkit-scrollbar-thumb:hover,
  .cmd-results::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
  }
}
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.view-title { font-size: var(--fs-xl); letter-spacing: -0.02em; }
.view-sub { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }

/* ── Mobile Sticky Bottom Bar ─────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60px;
  background: color-mix(in srgb, var(--surface-1) 90%, transparent);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-bottom);
  z-index: 35;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@keyframes navIconPop {
  0% { transform: scale(0.88); }
  65% { transform: translateY(-1px) scale(1.08); }
  100% { transform: translateY(-1px) scale(1); }
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text-3);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: color 0.16s ease, transform 0.12s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
}
.mobile-nav-item:hover { text-decoration: none; color: var(--text-1); }
.mobile-nav-item:active { transform: scale(0.95); }
.mobile-nav-item.is-active { color: var(--accent); font-weight: 750; }
.mobile-nav-item.is-active::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
}
.mobile-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 24px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.18s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.16s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-nav-item.is-active .mobile-nav-icon {
  background: var(--accent-soft);
  transform: translateY(-1px);
  animation: navIconPop 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-nav-item.is-active .mobile-nav-icon svg {
  stroke: var(--accent);
}

/* ── Icon Alignment (Sidebar, Mobile Nav, Command Search) ─────────────── */
.sidebar-icon svg.ui-ico {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  vertical-align: 0;
}
.sidebar-sublink .sidebar-icon svg.ui-ico {
  width: 14px;
  height: 14px;
}
.mobile-nav-icon svg.ui-ico {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
  vertical-align: 0;
}
.mobile-nav-item.is-active .mobile-nav-icon svg.ui-ico {
  stroke: var(--accent);
}
.cmd-item-icon svg.ui-ico {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  color: var(--text-2);
  vertical-align: 0;
}
.cmd-item.is-selected .cmd-item-icon svg.ui-ico {
  color: var(--accent);
}
.cmd-focus-icon svg.ui-ico {
  width: 17px;
  height: 17px;
  stroke-width: 2;
  color: var(--accent);
  vertical-align: 0;
}

/* ── Responsive frame (< 960px) ───────────────────────────────────────── */
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 272px;
    transform: translateX(-104%);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--shadow-pop);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .sidebar-close-btn { display: inline-flex !important; }
  .mobile-menu-btn { display: inline-flex !important; }
  .mobile-brand { display: inline-flex; align-items: center; }

  .topbar-row {
    flex-wrap: wrap;
    min-height: auto;
    padding: 8px 12px;
    gap: 8px;
  }
  .topbar-actions {
    order: 1;
    margin-left: auto;
    flex-shrink: 0;
    gap: 6px;
  }
  .topbar-row .clan-switch {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    min-width: 0;
  }
  .findme-name {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: bottom;
  }

  .subbar {
    padding: 6px 12px;
    gap: 8px 12px;
  }
  .standing-banner-slot {
    padding: 8px 12px 0;
  }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .sync { display: none; }
  .view { padding: 12px 12px 88px; }
}

@media (max-width: 768px) {
  .theme-dark body {
    background-image: none;
  }
  .subbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 3px 12px;
  }
  .subbar-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
  }
  .subbar-mobile-title strong {
    color: var(--text-1);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .subbar-mobile-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--r-pill, 999px);
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    font-size: 11px;
    transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
  }
  .subbar.is-expanded .subbar-mobile-chevron {
    transform: rotate(180deg);
    background: var(--accent-soft);
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  }
  .subbar-controls {
    display: none;
    padding: 8px 0 6px;
    border-top: 1px solid var(--line);
    gap: 8px 10px;
  }
  .subbar.is-expanded .subbar-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }
  .subbar-controls > * {
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .hide-xs { display: none !important; }
  .topbar-row {
    padding: 8px 10px;
    gap: 8px 6px;
  }
  .mobile-brand {
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  .topbar-actions .rapi-lookup,
  .topbar-actions .sync,
  .topbar-actions .topbar-discord-btn {
    display: none !important;
  }
  #topbarFindMeBtn {
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #topbarHelpBtn,
  #refreshBtn,
  #themeBtn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
  }
  .findme-name {
    max-width: 62px;
  }
  .subbar {
    padding: 3px 10px;
  }
  .week-slider { display: none; }
  .week-slider-label { display: none; }
  .week-slider-wrap {
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    padding: 2px 4px;
    gap: 4px 6px;
    background: transparent;
    border: none;
  }
  .min-weeks-slider-wrap .week-slider {
    display: inline-block !important;
    width: 54px;
  }
  .min-weeks-slider-wrap .week-slider-label {
    display: inline-block !important;
    font-size: 10px;
  }
  .toggle {
    max-width: 100%;
    min-width: 0;
  }
  .toggle-label {
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after,
  .btn-flip-inner,
  .card-flip-inner {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
