/* Everborn 4-surface shell (Today · People · Calendar · Settings).
   A nav/routing layer over the existing panels — see surface-shell.js.
   Retires the old flat 12-item tab rail (desktop) and the old 5-slot bottom nav
   (nav-shell.js) whenever body.eb-surfaces is set, and provides the new rail,
   bottom nav, and per-surface sub-switcher. Everborn tokens from styles.css. */

/* The topbar is position:fixed (immovable shell), so offset the content below it. */
body.eb-surfaces main { margin-top: var(--eb-topbar-h, 60px); }

/* ── Retire the old flat navs (they still EXIST, hidden, for proxy-clicking) ── */
body.eb-surfaces nav.tabs { display: none !important; }
body.eb-surfaces .eb-bottomnav,
body.eb-surfaces .eb-bn-more-sheet,
body.eb-surfaces .eb-more-backdrop { display: none !important; }

/* Hidden panels stay hidden; the real .tab buttons are visually gone but present. */
body.eb-surfaces main .import-toolbar { }  /* imports UI is portaled into Settings */

/* Default-hide the new chrome; the media queries below turn on the right one. */
.eb-rail, .eb-surfnav, .eb-more-sheet2, .eb-more-backdrop2 { display: none; }
.eb-subbar[hidden] { display: none !important; }

/* ── Per-surface sub-switcher (both desktop + mobile) ─────────────────────── */
.eb-subbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 0 0 14px; padding: 0;
}
.eb-seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--rd-card, #fff); border: 1px solid var(--rd-line, rgba(18,18,18,.09));
  border-radius: 999px;
}
.eb-seg-item {
  border: 0; background: transparent; cursor: pointer;
  padding: 9px 17px; border-radius: 999px;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--eb-slate, #6E7268);
  white-space: nowrap; font-family: inherit;
}
.eb-seg-item:hover { color: var(--eb-ink, #16211B); }
.eb-seg-item.on {
  background: var(--rd-chrome, #0E0F10); color: var(--rd-accent-hi, #E6C766);
  font-weight: 600; box-shadow: 0 1px 2px rgba(15,51,39,.18);
}
.eb-subactions { display: inline-flex; gap: 8px; }
.eb-subbtn {
  border: 1px solid var(--brand-primary, #1E6B4A); background: #fff;
  color: var(--brand-primary, #1E6B4A); cursor: pointer;
  padding: 9px 16px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600;
  white-space: nowrap; font-family: inherit;
}
.eb-subbtn:hover { background: rgba(30,107,74,.06); }
.eb-subbtn.on {
  background: var(--brand-primary, #1E6B4A); color: var(--brand-on-primary, #fff);
}

/* ── Desktop (≥761px): a 4-item left rail; sub-switcher sits atop <main> ───── */
@media (min-width: 761px) {
  body.eb-surfaces .eb-rail {
    display: flex; flex-direction: column; gap: 5px;
    position: fixed; top: var(--eb-topbar-h, 60px); left: 0; bottom: 0;
    width: 214px; z-index: 18;
    /* Dark rail derived from the tenant brand: on the Everborn default this is the
       historical deep evergreen; on other tenants it becomes their brand-dark. */
    background: linear-gradient(180deg, var(--brand-surface), var(--brand-surface-2));
    border-right: 1px solid rgba(0,0,0,.12);
    padding: 16px 12px; overflow-y: auto;
  }
  body.eb-surfaces .eb-rail-item {
    display: flex; align-items: center; gap: 13px;
    text-align: left; border: 0; border-radius: 11px; background: transparent;
    /* Light tint of the brand for idle text (legible on the dark brand surface). */
    color: color-mix(in srgb, var(--brand-primary), #fff 72%);
    padding: 13px 14px; font: inherit; font-size: 16px; font-weight: 500;
    cursor: pointer; font-family: inherit; border-left: 3px solid transparent;
  }
  body.eb-surfaces .eb-rail-item .ic { font-size: 20px; width: 24px; text-align: center; }
  body.eb-surfaces .eb-rail-item:hover {
    background: color-mix(in srgb, var(--brand-accent), transparent 90%);
    color: color-mix(in srgb, var(--brand-accent), #fff 62%);
  }
  body.eb-surfaces .eb-rail-item.on {
    background: color-mix(in srgb, var(--brand-accent), transparent 84%);
    color: color-mix(in srgb, var(--brand-accent), #fff 62%); font-weight: 600;
    border-left: 3px solid var(--brand-accent, #D4A62A);
  }
  body.eb-surfaces main { margin-left: 214px; }
}

/* ── Mobile (≤760px): a 4-item bottom nav + More overflow ─────────────────── */
@media (max-width: 760px) {
  body.eb-surfaces main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  /* Mobile bottom nav — the tenant chrome (e.g. black) + accent active. */
  body.eb-surfaces .eb-surfnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--brand-surface, #0E0F10); border-top: 1px solid var(--rd-accent-soft, rgba(212,166,42,.16));
    justify-content: space-around; align-items: stretch;
    padding: 9px 4px calc(11px + env(safe-area-inset-bottom));
    box-shadow: 0 -3px 14px rgba(0,0,0,.28);
  }
  body.eb-surfaces .eb-surfnav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    font: inherit; font-size: 11.5px; font-weight: 500; color: var(--rd-on-chrome-muted, #B7B2A6);
    cursor: pointer; background: none; border: 0; padding: 5px 0; font-family: inherit;
    min-height: 48px; justify-content: center;
  }
  body.eb-surfaces .eb-surfnav-item[hidden] { display: none; }
  body.eb-surfaces .eb-surfnav-item .ic { font-size: 23px; line-height: 1; }
  body.eb-surfaces .eb-surfnav-item.on { color: var(--rd-accent-hi, #E6C766); font-weight: 600; }

  body.eb-surfaces .eb-more-backdrop2.on {
    display: block; position: fixed; inset: 0; z-index: 41; background: rgba(16,33,27,.25);
  }
  body.eb-surfaces .eb-more-sheet2.on {
    display: block; position: fixed; left: 0; right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 42;
    background: #fff; border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(16,33,27,.16);
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    max-height: 60vh; overflow-y: auto;
  }
  body.eb-surfaces .eb-more-item2 {
    display: block; width: 100%; text-align: left; font: inherit; font-size: 14px;
    padding: 12px 10px; border: 0; border-bottom: 1px solid var(--eb-off, #F5F5F0);
    background: none; color: var(--eb-ink, #16211B); font-family: inherit; cursor: pointer;
  }
  body.eb-surfaces .eb-more-item2:last-child { border-bottom: 0; }

  /* Mock's mobile sub-tab bar (.msub): a DARK full-bleed strip below the header,
     with subtle dark pills and a gold-soft active pill (not a white pill row). */
  body.eb-surfaces .eb-subbar {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    background: var(--brand-surface, #0E0F10);
    margin: -16px -16px 12px; padding: 9px 12px; gap: 4px;
  }
  body.eb-surfaces .eb-subbar::-webkit-scrollbar { display: none; }
  body.eb-surfaces .eb-seg { flex: 0 0 auto; background: transparent; border: 0; padding: 0; gap: 4px; }
  body.eb-surfaces .eb-seg-item {
    background: rgba(255,255,255,.05); color: var(--rd-on-chrome-muted, #B7B2A6);
    border-radius: 8px; padding: 10px 14px; font-size: .8rem; font-weight: 600;
    /* Raise the tap target from ~30px to a comfortable ~42px (Fitts's Law). */
    min-height: 42px; display: inline-flex; align-items: center;
  }
  body.eb-surfaces .eb-seg-item.on {
    background: var(--rd-accent-soft, rgba(212,166,42,.14)); color: var(--rd-accent-hi, #E6C766);
    box-shadow: none;
  }
  body.eb-surfaces .eb-subactions { flex: 0 0 auto; }
}
/* Bottom-nav / rail icons are now inline SVG (mock glyphs), not unicode chars. */
.eb-bn-item .ic svg, .eb-rail-item .ic svg { width: 20px; height: 20px; display: block; }
.eb-surfnav-item .ic svg { width: 23px; height: 23px; display: block; }

/* ── Keyboard focus (G-026) ───────────────────────────────────────────────────
   A single, consistent, brand-accent focus ring for every interactive shell
   control — the nav rail, the mobile bottom-nav, the More sheet, the per-surface
   sub-switcher segments/actions, the directory rows + their icon actions, and the
   student-card buttons. Only shows for keyboard users (:focus-visible), so mouse
   clicks stay clean. Accessibility: keyboard users could not previously see where
   focus was on these custom (border/outline-less) buttons. */
.eb-rail-item:focus-visible,
.eb-surfnav-item:focus-visible,
.eb-bn-item:focus-visible,
.eb-more-item:focus-visible,
.eb-more-item2:focus-visible,
.eb-seg-item:focus-visible,
.eb-subbtn:focus-visible,
.contact-name-btn:focus-visible,
.acts .iconbtn:focus-visible,
.sc-card button:focus-visible,
.sc-link:focus-visible {
  outline: 2px solid var(--brand-accent, #D4A62A);
  outline-offset: 2px;
  border-radius: 8px;
}
