/* Shared shell layout for every authenticated page (sidebar + mobile
   drawer + topbar). Previously duplicated as an inline <style> block in
   dashboard.html, app-manager.html, preview.html, resources.html,
   super-admin.html, and task-detail.html — now lives in one place, so a
   layout or color change only needs to happen once. Plain CSS, not
   Tailwind, so it works with no build step regardless of what
   output.css was last compiled with. */

/* --- Skip link ---
   Lets keyboard/screen-reader users jump straight past the sidebar nav
   (4-5+ links on every page) to the actual page content. Hidden until
   it receives keyboard focus, per standard pattern. */
.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 100;
  background: var(--color-navy);
  color: #ffffff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-control);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 1rem;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Button system now lives in components.css, shared by every page
   (public and app-shell alike) — link components.css before this file. */
.app-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: 248px;
  background: var(--sidebar-bg);
  border-right: none;
  padding: 2.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}
.app-sidebar.open {
  transform: translateX(0);
}

/* More breathing room between nav links, and a bolder, left-accented
   active state — targets the exact class combinations already in the
   HTML (e.g. a link with both bg-indigo-50 and text-indigo-700, which
   the color sweep already recolors to the teal accent), so no HTML
   needs to change. */
.app-sidebar nav {
  gap: 0.3rem !important;
}
.app-sidebar nav a {
  padding: 0.75rem 1rem !important;
  border-radius: var(--radius-control) !important;
  font-weight: 500;
  color: var(--sidebar-text) !important;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.app-sidebar nav a:hover {
  background: var(--sidebar-hover-bg);
}
.app-sidebar nav a.bg-indigo-50.text-indigo-700 {
  background: var(--color-accent-bg) !important;
  color: #1c6b3c !important;
  font-weight: 600;
}

.app-sidebar-title {
  display: none;
}

.mobile-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--sidebar-bg);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}
.mobile-topbar span {
  color: #ffffff !important;
}
.mobile-topbar button {
  color: var(--sidebar-text) !important;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-backdrop);
  z-index: 20;
}
.sidebar-backdrop.open {
  display: block;
}

.app-main {
  flex: 1;
  width: 100%;
  padding: 4.5rem 2rem 3rem;
}

/* System check status pills — was inline el.style.backgroundColor /
   el.style.color set from super-admin.js. Kept as real CSS classes now
   so they respond to token changes and don't need JS to know hex values. */
.status-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--color-border);
  color: var(--color-text-secondary);
}
.status-pill.is-ready {
  background: var(--color-success-bg);
  color: var(--color-success-dark);
}
.status-pill.is-not-ready {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

/* --- New: sidebar brand lockup, identity strip, and section sub-nav.
   Additive only — used first on app-manager.html and settings.html,
   safe to reuse on any other page later without changing anything
   above this point. --- */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.15rem;
  margin-bottom: 1.5rem;
}
.sidebar-brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.45rem;
  background: var(--sidebar-mark-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}
/* .app-sidebar-title is already display:none below 768px and shown as
   a plain block above it (see the @media rule further down) — reusing
   it here so the wordmark still hides/shows the same way it always
   has, just now sitting next to an icon instead of alone. */
.sidebar-brand .app-sidebar-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: #ffffff;
  margin: 0;
  padding: 0;
}

/* "Need help" panel — a quiet neutral card pinned near the bottom of
   the sidebar, matching the reference's support callout. */
.sidebar-help-card {
  margin-top: 1.25rem;
  background: var(--sidebar-card-bg);
  border-radius: var(--radius-control);
  padding: 0.85rem 0.95rem;
}
.sidebar-help-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.35rem;
}
.sidebar-help-card-body {
  font-size: 0.72rem;
  color: var(--sidebar-text-muted);
  line-height: 1.4;
  margin: 0;
}

/* Identity block: a quiet tinted panel, not a bordered id-card — the
   softness comes from a filled tint and generous padding rather than a
   hairline border. */
.sidebar-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  margin-bottom: 1.5rem;
  background: var(--sidebar-card-bg);
  border-radius: var(--radius-control);
}
.sidebar-identity-avatar {
  width: 2.3rem;
  height: 2.3rem;
  flex-shrink: 0;
  border-radius: 9999px;
  background: var(--color-accent-bg);
  color: var(--color-accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
}
.sidebar-identity-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.sidebar-identity-email {
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.sidebar-identity-info .status-pill {
  width: fit-content;
  font-size: 0.65rem;
  padding: 0.15rem 0.6rem;
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}

.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.1rem 0 0.4rem 1.25rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--sidebar-border);
}
.sidebar-subnav a {
  font-size: 0.8rem;
  color: var(--sidebar-text-muted);
  padding: 0.35rem 0.5rem !important;
  border-radius: var(--radius-control);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-subnav a:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}
.sidebar-subnav a.is-active-subnav {
  background: var(--color-accent-bg) !important;
  color: #1c6b3c !important;
  font-weight: 600;
}
.app-sidebar nav > a.is-active-subnav {
  background: var(--color-accent-bg) !important;
  color: #1c6b3c !important;
  font-weight: 600;
}

/* Section-switching panels — used on app-manager.html and super-admin.html
   so only one major section shows at a time instead of everything stacked
   on one long page. Panels are shown/hidden by app-manager.js/super-admin.js
   toggling this class; the markup itself never changes. */
.app-manager-panel,
.admin-panel {
  display: none;
}
.app-manager-panel.is-active-panel,
.admin-panel.is-active-panel {
  display: block;
}

.sidebar-task-jump-wrap {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-task-jump-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--sidebar-text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}
.sidebar-task-jump-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-control);
  font-size: 0.8rem;
  color: var(--sidebar-text);
}
.sidebar-task-jump-item:hover {
  background: var(--sidebar-hover-bg);
  color: #ffffff;
}
.sidebar-task-jump-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 9999px;
  flex-shrink: 0;
}
.sidebar-task-jump-item.is-done {
  text-decoration: line-through;
  opacity: 0.6;
}

/* Sign-out button, now a proper .btn-ghost.btn-block instance instead of
   a bare underlined text link — see dashboard.html for the class change. */
#signout-btn {
  margin-top: auto;
  justify-content: flex-start !important;
  color: var(--sidebar-text-muted) !important;
}
#signout-btn:hover {
  color: #ff8a7a !important;
  background: var(--sidebar-hover-bg) !important;
}

.family-member-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--sidebar-card-bg);
  border-radius: var(--radius-control);
  padding: 0.5rem 0.65rem;
}
.family-member-avatar {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 9999px;
  background: var(--color-accent-bg);
  color: var(--color-accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}
.family-member-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
}
.family-member-relationship {
  font-weight: 400;
  color: var(--sidebar-text-muted);
}
.family-member-status {
  font-size: 0.75rem;
  color: var(--sidebar-text-muted);
}

@media (min-width: 768px) {
  .mobile-topbar {
    display: none;
  }
  .app-sidebar {
    position: static;
    transform: none;
    flex-shrink: 0;
  }
  .app-sidebar-title {
    display: block;
  }
  .sidebar-backdrop {
    display: none !important;
  }
  .app-main {
    padding: 3rem 2.5rem;
  }
  .app-sidebar nav {
    margin-top: 0;
  }
}

/* resources.html only: nobody's confirmed logged in yet (or never will
   be) — shell stays fully hidden so the page reads as a plain public
   page, no flash of sidebar/topbar for anonymous visitors.
   resources.js removes this class only after a real session is
   confirmed. */
body.shell-inactive .mobile-topbar,
body.shell-inactive .app-sidebar,
body.shell-inactive .sidebar-backdrop {
  display: none !important;
}
body.shell-inactive .app-main {
  padding: 2.5rem 1.5rem;
}