/* Poggio al Sole — the shared design of the staff apps (Tavoli, Cassa, Degustazioni, Presenze).
   Canonical copy: login/static/poggio.css; each app carries an identical copy in its static/
   (test_login.py checks). Load it BEFORE the app's own CSS. See login/DESIGN.md.

   One look for every app: warm paper, dark ink, one accent colour per app (set by
   <html data-app="…">), the same top bar, and the person chip in the middle of it. */

:root {
  /* surfaces and ink */
  --bg: #f8f4ed; --panel: #fffdfa; --panel2: #fcf9f4; --line: #e5dfd6; --ink: #25211b; --muted: #797066;
  /* the app's own colour (see data-app below) and what is written on it */
  --wine: #7b2d3b; --accent: var(--wine); --accent-ink: #fff;
  /* signals, one earthy family: ok (olive) -> warn (amber) -> high (wine red) */
  --ok: #518046; --ok-bg: #eaf2e6; --warn: #a77612; --warn-bg: #fbf1dc; --high: #a63030; --high-bg: #f9e8e6;
  --shadow: 0 1px 2px rgba(60,40,20,.06), 0 2px 8px rgba(60,40,20,.04);
  --shadow-pop: 0 10px 34px rgba(40,25,10,.20);
  --radius: 9px; --radius-lg: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --bar-h: 60px;
  color-scheme: light;
}
/* one accent per app, so a glance says which app is open */
:root[data-app="tavoli"], :root[data-app="degu"] { --accent: var(--wine); }
:root[data-app="cassa"] { --accent: #2e7d32; }
:root[data-app="presenze"] { --accent: #2f5a2f; }

/* dark: only for apps that opt in with <html data-scheme="auto"> (Tavoli, Degustazioni) */
@media (prefers-color-scheme: dark) {
  :root[data-scheme="auto"] {
    --bg: #181512; --panel: #23201c; --panel2: #2a2621; --line: #39342f; --ink: #efebe4; --muted: #a49d94;
    --wine: #c8737f; --accent-ink: #181512;
    --ok: #85bc79; --ok-bg: #22301f; --warn: #e4b65c; --warn-bg: #352b17; --high: #e2726b; --high-bg: #402624;
    --shadow: none; --shadow-pop: 0 10px 34px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- top bar
   <header class="p-bar">
     <a class="p-brand" href="/"><img src="/static/icon.svg" alt="">Tavoli</a>
     <nav class="p-tabs">…<a class="on">…</a></nav>
     <div class="p-center" id="pChip"></div>          ← the person chip (Poggio.chip)
     <div class="p-actions">…buttons…</div>
   </header> */
.p-bar { position: sticky; top: 0; z-index: 10; flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  min-height: var(--bar-h); padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); color: var(--ink); font-family: var(--font); }
.p-brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: .2px;
  color: var(--accent); white-space: nowrap; text-decoration: none; }
.p-brand img { width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto; }
.p-brand .p-sub { color: var(--muted); font-weight: 500; }
.p-tabs { display: flex; gap: 4px; }
.p-tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.p-tabs a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.p-center { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.p-actions { display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- the person chip
   Who is using the app now. Tap = hand over: on a shared iPad the next person draws their sign;
   with an own account a small menu offers "Esci". Built by Poggio.chip() in poggio.js. */
.p-chip { display: inline-flex; align-items: center; gap: 9px; height: 44px; max-width: 260px; padding: 0 14px 0 5px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow);
  font: 600 15px/1 var(--font); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.p-chip:active { transform: scale(.97); }
.p-chip .p-av { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 700; }
.p-chip .p-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.p-chip .p-sw { flex: 0 0 auto; color: var(--muted); font-size: 14px; font-weight: 500; }

/* ---------------------------------------------------------------- small menu under the chip (Poggio.menu) */
.p-menu-bd { position: fixed; inset: 0; z-index: 70; }
.p-menu { position: fixed; z-index: 71; min-width: 230px; max-width: calc(100vw - 16px); padding: 6px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); font: 15px/1.35 var(--font); }
.p-menu .p-hd { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.p-menu .p-hd .p-av { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; flex: 0 0 auto; }
.p-menu .p-hd b { display: block; text-transform: capitalize; }
.p-menu .p-hd span { color: var(--muted); font-size: 13px; }
.p-menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--radius);
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.p-menu button:hover, .p-menu button:active { background: var(--panel2); }
.p-menu button .p-i { width: 20px; text-align: center; color: var(--muted); }
.p-menu button.p-out { color: var(--high); }
.p-menu button.p-out .p-i { color: var(--high); }

/* ---------------------------------------------------------------- small shared pieces */
.p-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 5px 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.p-pill.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.p-pill.high { border-color: color-mix(in srgb, var(--high) 45%, var(--line)); background: var(--high-bg); color: var(--high); font-weight: 600; }

@media (max-width: 700px) {
  .p-bar { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .p-chip { max-width: 160px; padding-right: 10px; }
  .p-chip .p-sw { display: none; }
}
