/* catmath app shell + dashboard helpers, layered on nocturne.css tokens.
   Trimmed from pyledger's app.css: shell, panel and text helpers only. */

/* ── App shell: sidebar + main ─────────────────────────────────────────────── */
.pl-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.pl-sidebar {
  border-right: 1px solid var(--color-neutral-900);
  padding: 22px 18px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.pl-brand {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-heading); font-weight: 500; font-size: 15px;
}
.pl-nav { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pl-nav a {
  padding: 8px 10px; border-radius: 6px; color: var(--color-neutral-400);
  text-decoration: none;
}
.pl-nav a:hover { color: var(--color-text); background: color-mix(in srgb, var(--color-text) 5%, transparent); }
.pl-nav a.active { background: var(--color-accent-900); color: var(--color-accent-300); }
.pl-user {
  margin-top: auto; padding: 12px; border: 1px solid var(--color-neutral-900);
  border-radius: 8px; display: flex; align-items: center; gap: 10px;
}
.pl-avatar {
  width: 28px; height: 28px; border-radius: 999px; background: var(--color-accent-700);
  display: grid; place-items: center; font: 600 12px var(--font-heading);
  color: var(--color-accent-100); flex: none;
}
.pl-user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.pl-user-meta .name { font-size: 12px; }
.pl-logout {
  background: transparent; border: 0; color: var(--color-neutral-500);
  cursor: pointer; font-size: 11px; text-align: left; padding: 0;
}
.pl-logout:hover { color: var(--color-accent-300); }

.pl-main { padding: 28px 36px 40px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.pl-footer {
  margin-top: auto; padding-top: 20px; display: flex; justify-content: space-between;
  font-size: 11px; color: var(--color-neutral-600);
}

/* Mobile bottom tab bar (hidden on desktop) */
.pl-tabbar { display: none; }

@media (max-width: 860px) {
  .pl-layout { grid-template-columns: 1fr; }
  .pl-sidebar { display: none; }
  .pl-main { padding: 16px 16px 84px; }
  .pl-tabbar {
    display: flex; justify-content: space-around; position: fixed; inset: auto 0 0 0;
    background: var(--color-bg); border-top: 1px solid var(--color-neutral-900);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); z-index: 40;
  }
  .pl-tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 10px; color: var(--color-neutral-500); text-decoration: none;
  }
  .pl-tabbar a.active { color: var(--color-accent-300); }
  .pl-tabbar svg { width: 20px; height: 20px; }
}

/* ── Shared helpers ─────────────────────────────────────────────────────────── */
.kicker { font: 600 10px ui-monospace, Menlo, monospace; text-transform: uppercase; letter-spacing: 0.14em; color: var(--color-accent-400); }
.muted { color: var(--color-neutral-500); }
.num-lg { font-family: var(--font-heading); font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.row { display: flex; }
.stack { display: flex; flex-direction: column; }
/* The hidden attribute must win: .panel and .stack set display, which otherwise
   overrides it, so hidden forms showed on page load and Cancel did nothing. */
[hidden] { display: none !important; }
/* Filled primary action (nocturne's .btn-primary is outline-only). */
.btn-solid { background: var(--color-accent); color: var(--color-bg); font-weight: 600; }
.btn-solid:hover { background: var(--color-accent-2); }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 28px; }

.panel { background: var(--color-surface); border: 1px solid var(--color-neutral-800); border-radius: var(--radius-md); padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.panel-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-hd h4 { margin: 0; font-size: 15px; font-weight: 500; }

.loading-state, .error-state { color: var(--color-neutral-500); font-size: 13px; padding: 12px 0; }
.error-state { color: #e2a0a0; }

/* ── Dashboard tables (the mockup's nq-tbl) ─────────────────────────────────── */
.pl-table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.pl-table th { text-align: right; padding: 0 0 8px; font-weight: 500; color: var(--color-neutral-500); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.pl-table td { padding: 12px 0; border-top: 1px solid var(--color-neutral-900); text-align: right; font-weight: 600; }
.pl-table th:first-child, .pl-table td:first-child { text-align: left; }
.pl-table td:first-child { font-weight: 500; }
.pl-table .food { display: block; font-size: 11px; color: var(--color-neutral-500); font-weight: 400; margin-top: 1px; }
.pl-table .unit { color: var(--color-neutral-500); font-weight: 400; font-size: 11px; }
.pl-table .goal { font: 600 10px ui-monospace, Menlo, monospace; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-accent-300); margin-left: 4px; }
.pl-table td.cat-error { text-align: left; color: #e2a0a0; font-weight: 400; }
.flag { font-size: 12px; color: var(--color-neutral-500); padding-top: 10px; border-top: 1px solid var(--color-neutral-900); }
.flag b { color: var(--color-accent-300); font-weight: 600; }
