/* ============================================================
   Huchu DS — Portal shells
   Self-contained shell systems for product portals (POS,
   Parent, Student, Teacher, Staff, Admin). Each shell is a
   chrome around the screen body — independent of the dashboard.
   ============================================================ */

/* ── Universal portal screen body ───────────────────────── */
.ps-screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: var(--canvas);
  color: var(--text-body);
  font: var(--type-body);
}
.ps-scroll { flex: 1; overflow-y: auto; }
.ps-scroll::-webkit-scrollbar { width: 0; }

/* ── Mobile status bar ──────────────────────────────────── */
.ps-statusbar {
  height: 36px; padding: 6px 22px 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  font: 600 13px/1 var(--font-sans);
  color: var(--text-strong);
  flex: none;
}
.ps-statusbar .right { display: inline-flex; align-items: center; gap: 5px; }
.ps-statusbar .right svg { width: 14px; height: 14px; }
.ps-statusbar.invert { color: #fff; }
.ps-statusbar.invert .right svg { color: #fff; }

/* ── Mobile top app bar ─────────────────────────────────── */
.ps-appbar {
  height: 52px; padding: 0 16px;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.ps-appbar .nav-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--text-strong);
}
.ps-appbar .nav-btn:hover { background: var(--surface-muted); }
.ps-appbar h1 {
  font: 600 16px/1 var(--font-sans);
  letter-spacing: -0.01em; color: var(--text-strong); margin: 0; flex: 1;
}
.ps-appbar .right { display: inline-flex; align-items: center; gap: 8px; }
.ps-appbar.compact { height: 44px; }
.ps-appbar.transparent { background: transparent; border-bottom: 0; }
.ps-appbar.dark { background: var(--ink); border-bottom-color: transparent; color: #fff; }
.ps-appbar.dark h1 { color: #fff; }
.ps-appbar.dark .nav-btn { color: rgba(255,255,255,.85); }
.ps-appbar.dark .nav-btn:hover { background: rgba(255,255,255,.08); }

/* ── Mobile bottom tab bar ──────────────────────────────── */
.ps-tabbar {
  height: 72px; padding: 8px 8px 18px;
  display: flex; align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex: none;
}
.ps-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 8px; padding: 4px 0;
  color: var(--text-subtle); text-decoration: none;
  font: 500 11px/1 var(--font-sans);
}
.ps-tab svg { width: 22px; height: 22px; }
.ps-tab.active { color: var(--brand); }
.ps-tab.active svg { color: var(--brand); }

/* ── Tablet/desktop side nav (portal) ───────────────────── */
.ps-side {
  width: 220px; flex: none;
  background: var(--canvas); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.ps-side .brand { display: inline-flex; align-items: center; gap: 10px; padding: 6px 8px; font: 600 15px/1 var(--font-sans); color: var(--text-strong); margin-bottom: 16px; }
.ps-side .brand .mark { width: 22px; height: 22px; color: var(--brand); }
.ps-side nav { display: grid; gap: 2px; }
.ps-side nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  font: 500 13.5px/1 var(--font-sans); color: var(--text-body); text-decoration: none;
}
.ps-side nav a:hover { background: var(--surface-muted); color: var(--text-strong); }
.ps-side nav a.active { background: var(--brand-soft); color: var(--brand-strong); }
.ps-side nav a svg { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.ps-side nav a.active svg { color: var(--brand); }
.ps-side .ps-section-h { font: 500 11px/1 var(--font-sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-subtle); padding: 14px 10px 8px; }
.ps-side .ps-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 12px 10px 4px; }
.ps-side .ps-foot .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; font: 600 12px/1 var(--font-sans); }
.ps-side .ps-foot .nm { font: 500 13px/1.3 var(--font-sans); color: var(--text-strong); }
.ps-side .ps-foot .sb { font: 11px/1.2 var(--font-sans); color: var(--text-muted); }

/* Layout helpers */
.ps-row { display: flex; min-height: 100%; }

/* ── Reusable cards inside portal pages ─────────────────── */
.pc {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px;
}
.pc.compact { padding: 12px 14px; }
.pc.tonal-brand { background: var(--brand-soft); border-color: var(--brand-100); }
.pc.tonal-ink { background: var(--ink); color: #fff; border-color: transparent; }
.pc.tonal-ink .pc-h { color: #fff; }

.pc-h { font: 600 14px/1.3 var(--font-sans); color: var(--text-strong); margin: 0 0 4px; }
.pc-sb { font: var(--type-caption); color: var(--text-muted); margin: 0 0 12px; }

/* List rows (mobile-friendly) */
.pl {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: clip;
}
.pl-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.pl-row:last-child { border-bottom: 0; }
.pl-row .nm { font: 500 14px/1.3 var(--font-sans); color: var(--text-strong); }
.pl-row .sb { font: 12px/1.3 var(--font-sans); color: var(--text-muted); margin-top: 2px; }
.pl-row .val { font: 500 14px/1.3 var(--font-mono); color: var(--text-strong); }
.pl-row .ic-tile { width: 36px; height: 36px; display: grid; place-items: center; background: var(--surface-muted); border-radius: 8px; color: var(--text-strong); }
.pl-row .ic-tile.brand { background: var(--brand-soft); color: var(--brand-strong); }
.pl-row .ic-tile.success { background: var(--tone-success-bg); color: var(--tone-success); }
.pl-row .ic-tile.warn { background: var(--tone-warn-bg); color: var(--tone-warn); }
.pl-row .ic-tile.danger { background: var(--tone-danger-bg); color: var(--tone-danger); }

/* Greeting block, hero banner */
.pgreet { padding: 20px 18px 8px; }
.pgreet .hi { font: 500 13px/1.3 var(--font-sans); color: var(--text-muted); }
.pgreet h2 { font: 700 24px/1.15 var(--font-sans); letter-spacing: -0.02em; color: var(--text-strong); margin: 4px 0 0; }

/* Hero card with brand background — used as a focal block */
.phero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deeper) 100%);
  color: #fff;
  border-radius: 14px;
  padding: 18px 18px 20px;
  position: relative;
  overflow: clip;
}
.phero::before {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
}
.phero .lbl { font: 500 12px/1 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; }
.phero .val { font: 700 36px/1.05 var(--font-sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 10px; }
.phero .ds { font: 13.5px/1.4 var(--font-sans); opacity: 0.85; margin-top: 6px; max-width: 28ch; }
.phero .actions { display: flex; gap: 8px; margin-top: 16px; }
.phero .pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 9999px;
  background: rgba(255,255,255,0.15); color: #fff;
  font: 500 13px/1 var(--font-sans); text-decoration: none;
}
.phero .pill:hover { background: rgba(255,255,255,0.25); }
.phero .pill.solid { background: #fff; color: var(--brand-strong); }
.phero .pill.solid:hover { background: rgba(255,255,255,0.9); }

/* Mobile section heading */
.psh { padding: 16px 4px 8px; font: 500 12px/1 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); display: flex; align-items: center; justify-content: space-between; }
.psh a { font: 500 12.5px/1 var(--font-sans); color: var(--brand-strong); text-decoration: none; letter-spacing: 0; text-transform: none; }

/* FAB */
.pfab {
  position: absolute; right: 16px; bottom: 88px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px -6px rgba(11,93,240,0.4);
  z-index: 30;
}
.pfab:hover { background: var(--brand-strong); }
.pfab svg { width: 22px; height: 22px; }

/* Sale-specific (POS) */
.pos-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; background: var(--surface); border-radius: 12px; }
.pos-keypad button {
  height: 50px; border-radius: 10px; background: var(--surface-muted); color: var(--text-strong);
  font: 600 20px/1 var(--font-sans);
}
.pos-keypad button:hover { background: var(--surface-sunken); }
.pos-keypad button.primary { background: var(--brand); color: #fff; }
.pos-keypad button.brand { background: var(--brand-soft); color: var(--brand-strong); }

/* Sale line items */
.sale-line { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); }
.sale-line:last-child { border-bottom: 0; }
.sale-line .nm { font: 500 14px/1.3 var(--font-sans); color: var(--text-strong); }
.sale-line .qty { font: 500 13px/1 var(--font-mono); color: var(--text-muted); padding: 4px 8px; background: var(--surface-muted); border-radius: 9999px; }
.sale-line .price { font: 600 14px/1 var(--font-mono); color: var(--text-strong); font-variant-numeric: tabular-nums; }

/* Big-button grid (Sale categories) */
.pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
.pos-tile { aspect-ratio: 1; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: 500 12px/1.2 var(--font-sans); color: var(--text-strong); text-align: center; padding: 8px; }
.pos-tile svg { color: var(--brand); width: 22px; height: 22px; }
.pos-tile .ct { font: 11px/1 var(--font-mono); color: var(--text-muted); margin-top: 2px; }
.pos-tile:hover { border-color: var(--brand-200); background: var(--brand-50); }

/* Bottom action bar (variant for screens needing a "pay" button) */
.ps-bottombar {
  padding: 12px 16px 22px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center;
  flex: none;
}

/* Tablet/desktop padded content */
.ps-content { padding: 24px 28px; min-width: 0; flex: 1; overflow-y: auto; }
.ps-content h2 { font: 700 24px/1.15 var(--font-sans); letter-spacing: -0.02em; margin: 0 0 12px; color: var(--text-strong); }
.ps-content .lede { font: 15px/1.55 var(--font-sans); color: var(--text-muted); margin: 0 0 18px; }
