/* shell.css — Direction A (Focus)
   The app frame: desktop left sidebar + mobile top bar + mobile bottom tab bar.
   Ported from the shell + @media(max-width:760px) blocks of the prototype's app.css.
   Also defines the minimal centered layout used for unauthenticated (auth) pages. */

/* ---------- shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}

/* mobile top bar (hidden on desktop) */
.mtopbar {
  display: none;
}

/* sidebar (desktop) — a sticky full-height rail so its nav and footer stay
   visible however long the main content grows (it no longer scrolls away or
   leaves the column half-empty on tall pages). */
aside {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f1f0e8;
}

.brand .wordmark {
  display: block;
  width: auto;
  height: 24px;
}

/* Desktop sidebar: the negative wordmark sits on a full-bleed dark strip across
   the top of the otherwise light sidebar (bleeds past the aside padding). */
aside .brand {
  display: flex;
  align-items: center;
  margin: -26px -18px 18px;
  padding: 18px;
  background: var(--brand-navy);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 12px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--muted);
  transition: .14s;
}

.nav a svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.nav a .lbl {
  white-space: nowrap;
}

.nav a:hover {
  color: var(--ink);
  background: #e9e7dd;
}

.nav a.on {
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow);
}

.nav a.on svg {
  stroke: var(--clay);
}

.sidefoot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
}

.sidefoot .av {
  width: 36px;
  height: 36px;
  aspect-ratio: 1;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--paper);
  background: linear-gradient(135deg, #2c2d22, #494a39);
}

/* Keep the name to a single line and truncate it, so a long name can't wrap and
   crowd (or visually distort) the avatar and trailing controls. */
.sidefoot .who {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidefoot .who small {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

/* Sign out — an icon button in the sidefoot (desktop) and mobile top bar.
   button_to wraps a <form>; display:contents lets the button be the flex child. */
.sidefoot form, .mtopbar form {
  display: contents;
}

.signout {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: 0.14s;
}

.signout:hover {
  color: var(--clay);
  background: var(--paper);
  border-color: var(--line);
}

.signout svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidefoot .bell {
  margin-left: auto;
}

/* When a bell is present it owns the right-push, so the signout sits beside it. */
.sidefoot .bell + .signout {
  margin-left: 0;
}

.sidefoot .signout {
  margin-left: auto;
}

/* Notifications bell — an icon link with a clay unread badge, used in the
   sidefoot (desktop) and mobile top bar, mirroring the sign-out control. */
.bell {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--muted);
  transition: 0.14s;
}

.bell:hover {
  color: var(--clay);
  background: var(--paper);
}

.bell svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bell .badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--clay);
  color: var(--paper);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

main {
  padding: 48px 56px;
  max-width: 980px;
}

/* ---------- auth (unauthenticated, no-chrome) layout ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth main {
  padding: 0;
  width: 100%;
  max-width: 380px;
}

/* Login: the same negative wordmark, centered on a dark pill so it reads on the
   light auth screen. */
.auth .brand {
  display: flex;
  justify-content: center;
  padding: 0 0 22px;
}

.auth .brand .wordmark {
  /* content-box so the padding sits *around* the 30px wordmark rather than
     eating it (global box-sizing is border-box, which collapsed it to a dark pill). */
  box-sizing: content-box;
  height: 30px;
  padding: 16px 22px;
  background: var(--brand-navy);
  border-radius: var(--radius);
}

.auth .auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 30px;
  box-shadow: var(--shadow);
}

/* ============================================================
   MOBILE (<=760px)
   sidebar -> fixed bottom tab bar, plus a slim top bar
   ============================================================ */
@media (max-width: 760px) {
  .app {
    display: block;
    min-height: 100vh;
  }

  .mtopbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--mtop-h);
    padding: 0 16px;
    background: rgba(241, 240, 232, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }

  .mtopbar .brand-sm {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -.02em;
  }

  .mtopbar .brand-sm .dot {
    width: 20px;
    height: 20px;
    border-radius: 0;
    background: url("/assets/ts-mark-8e2cb690.svg") center/contain no-repeat;
  }

  .mtopbar .mtitle {
    font-weight: 700;
    font-size: 15px;
    margin-left: 2px;
  }

  .mtopbar .bell {
    margin-left: auto;
    width: 32px;
    height: 32px;
  }

  /* The bell now owns the right-push, so the avatar sits beside it. */
  .mtopbar .bell + .av {
    margin-left: 0;
  }

  .mtopbar .av {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--paper);
    background: linear-gradient(135deg, #2c2d22, #494a39);
  }

  aside {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 30;
    flex-direction: row;
    gap: 0;
    height: var(--tabbar-h);
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--line);
    background: rgba(241, 240, 232, .96);
    backdrop-filter: blur(8px);
  }

  aside .brand, aside .sidefoot {
    display: none;
  }

  .nav {
    flex-direction: row;
    flex: 1;
    gap: 0;
    overflow-x: auto;
    padding: 0 6px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex-direction: column;
    gap: 3px;
    justify-content: center;
    align-items: center;
    flex: 1 0 auto;
    min-width: 62px;
    padding: 9px 8px 8px;
    border-radius: 0;
    font-size: 10.5px;
    font-weight: 600;
  }

  .nav a .lbl {
    font-size: 10.5px;
  }

  .nav a svg {
    width: 21px;
    height: 21px;
  }

  /* Admin roles get a 6-item bar (Home/Companies/Tasks/Reports/Prices/Catering) that
     is cramped at ~390px. Tighten per-item width/padding/labels once there are 6+
     items so they fit evenly without clipping; 5-item member/ceo bars are untouched. */
  .nav:has(a:nth-child(6)) a {
    min-width: 0;
    flex: 1 1 0;
    padding: 9px 4px 8px;
  }

  .nav:has(a:nth-child(6)) a .lbl {
    font-size: 9.5px;
  }

  .nav:has(a:nth-child(6)) a svg {
    width: 19px;
    height: 19px;
  }

  .nav a:hover {
    background: transparent;
  }

  .nav a.on {
    background: transparent;
    box-shadow: none;
    color: var(--clay);
  }

  .nav a.on svg {
    stroke: var(--clay);
  }

  main {
    padding: 22px 18px calc(var(--tabbar-h) + 26px);
    max-width: none;
  }

  h1.page {
    font-size: 27px;
    margin-bottom: 18px;
  }
}
