/* ============================================================
   akwOS — product shell

   LAYOUT ONLY. Every component the views render — grid, tile, tag,
   panel, chip, button, badge — lives in `ui.css` and resolves against
   `tokens.css`. This file used to carry its own :root palette and its
   own copy of ten of those components; both are gone.

   One document, two shapes. At >=900 CSS px it is a rail + canvas
   desktop app; below that it collapses to a phone shell with a bottom
   tab bar. The site's viewport toggle only sizes the frame — this
   stylesheet does the rest.
   ============================================================ */

html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs-14); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }

.os { display: flex; min-height: 100%; }

/* ── rail (desktop) ────────────────────────────────────────── */
.rail {
  width: var(--rail); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
}
.rail-brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 18px; }
.rail-mark {
  width: 26px; height: 26px; border-radius: var(--r); flex: none;
  background: var(--solid); display: grid; place-items: center;
}
.rail-mark svg {
  width: 16px; height: 16px; stroke: var(--solid-fg); stroke-width: 2.6;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.rail-name { font-size: 16px; font-weight: 640; letter-spacing: -.03em; }
.rail-name span { opacity: .45; }
.rail-lbl {
  font-size: var(--fs-10); font-weight: 620; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-dim); padding: 14px 10px 6px;
}
.rail-foot {
  margin-top: auto; border-top: 1px solid var(--border-subtle);
  padding: 12px 10px 2px; font-size: var(--fs-10);
  color: var(--text-dim); line-height: 1.6;
}
.rail-foot b { color: var(--text-muted); font-weight: 600; }

/* ── nav items, shared by rail and tab bar ─────────────────── */
/* `.navitem`, not `.nav`: the marketing shell already owns `.nav` for its
   sticky header. Two different components under one name were kept apart
   only by never appearing on the same page, which is not a guarantee. */
.navitem, .tab {
  border: 0; background: transparent; cursor: pointer;
  font-family: inherit; letter-spacing: -.01em;
  color: var(--text-muted); transition: background .16s, color .16s;
}
.navitem {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 520; text-align: left;
}
.navitem:hover { background: var(--surface-hover); color: var(--text); }
.navitem.on { background: var(--bg-sunken); color: var(--text); font-weight: 600; }
.navitem .ic, .tab .ic {
  display: grid; place-items: center; flex: none;
  width: 19px; height: 19px; border-radius: var(--r-sm);
  font-size: 10px; color: var(--accent-fg);
}
.navitem .n {
  margin-left: auto; font-size: var(--fs-11);
  color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.navitem .n.alert { color: var(--danger); font-weight: 640; }

/* ── main ──────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 20px 28px; display: flex; align-items: flex-end;
  gap: 20px; flex-wrap: wrap;
}
.topbar h1 { font-size: var(--fs-21); font-weight: 650; letter-spacing: -.026em; margin: 0; }
.topbar p { margin: 3px 0 0; color: var(--text-muted); font-size: var(--fs-13); }
.content { padding: 24px 28px 40px; flex: 1; }
.inner { max-width: 1180px; }

/* ── tab bar (phone) ───────────────────────────────────────── */
.tabbar { display: none; }

/* ── the phone shape ───────────────────────────────────────── */
@media (max-width: 899px) {
  .rail { display: none; }
  .os { flex-direction: column; }

  /* Reserve the status-bar / notch band the way a real iOS app does.
     env(safe-area-inset-top) does not resolve inside the preview
     frame, so the 54px floor stands in and env() wins where it works. */
  .topbar {
    padding: max(54px, calc(env(safe-area-inset-top) + 14px)) 16px 14px;
    align-items: flex-start; flex-direction: column; gap: 10px;
  }
  .topbar h1 { font-size: 19px; }
  .content { padding: 16px 16px 88px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 9px; }
  .tile b { font-size: 22px; }

  /* A sideways-scrolling grid hides the column people came for. Keep
     the name and the last two; drop the middle numeric columns, which
     are the ones a phone reader is least likely to be scanning. */
  .grid-wrap { max-height: none; }
  .grid thead th:nth-child(3), .grid tbody td:nth-child(3),
  .grid thead th:nth-child(4), .grid tbody td:nth-child(4) { display: none; }
  .grid thead th, .grid tbody td { padding: 10px 8px; }
  .grid thead th:first-child, .grid tbody td:first-child { padding-left: 12px; }
  .toolbar { gap: 6px; }
  .toolbar .count { display: none; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-top: 1px solid var(--border); padding: 7px 6px 22px;
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 2px; font-size: 10px; font-weight: 560; position: relative;
  }
  .tab .ic { width: 22px; height: 22px; border-radius: 7px; font-size: 11px; opacity: .42; transition: opacity .16s; }
  .tab.on { color: var(--text); }
  .tab.on .ic { opacity: 1; }
  .tab .n {
    position: absolute; top: 1px; right: calc(50% - 20px);
    min-width: 15px; height: 15px; padding: 0 4px; border-radius: var(--r-full);
    background: var(--text-dim); color: var(--surface);
    font-size: 9.5px; font-weight: 680; display: grid; place-items: center;
  }
  .tab .n.alert { background: var(--danger); color: var(--akw-n-0); }
}
