/* Cypriana.ai — shared styles (css/app.css)
   1. Brand tokens + base type (every page)
   2. Navigation: top bar (all sizes) + bottom tabs (phones)
   3. Shared helpers (tap targets, focus, banners)
   4. Dark theme — only on pages that have been fully moved over (body.cyp-dark)
   5. Print — always white, no navigation                                                */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --cy-navy-950: #070e1c;
  --cy-navy-900: #0b1426;
  --cy-navy-850: #0f1a31;
  --cy-navy-800: #13213d;
  --cy-navy-700: #1b2c4f;
  --cy-navy-600: #26395f;
  --cy-line: rgba(255,255,255,0.09);
  --cy-line-strong: rgba(255,255,255,0.16);
  --cy-gold: #d9b25f;
  --cy-gold-strong: #e8c574;
  --cy-gold-ink: #1c1405;
  --cy-text: #eef2f8;
  --cy-text-2: #b7c3d9;
  --cy-muted: #8595b3;
  --cy-ok: #3ddc97;
  --cy-warn: #f5c451;
  --cy-bad: #ff7a7a;
  --cy-info: #7cb4ff;
  --cy-radius: 14px;
  --cy-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --cy-tabbar-h: 64px;
}

html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--cy-font); }
button, input, select, textarea { font-family: inherit; }

/* ── 2. Navigation ─────────────────────────────────────────────────────────── */
.cypnav {
  position: fixed; top: 0; left: 0; right: 0; height: 48px; z-index: 1000;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--cy-navy-900); border-bottom: 1px solid var(--cy-line);
  box-sizing: border-box; font-family: var(--cy-font);
}
.cypnav-brand { color: var(--cy-text); font-weight: 800; font-size: 16px; letter-spacing: -0.3px; text-decoration: none; white-space: nowrap; }
.cypnav-brand span { color: var(--cy-gold); }
.cypnav-biz { color: var(--cy-text-2); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.cypnav-biz:empty { display: none; }
.cypnav-tabs { display: none; gap: 2px; margin-left: auto; }
.cypnav-tabs a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 10px;
  color: var(--cy-text-2); text-decoration: none; font-size: 14px; font-weight: 600;
}
.cypnav-tabs a svg { width: 18px; height: 18px; }
.cypnav-tabs a:hover { color: var(--cy-text); background: rgba(255,255,255,0.06); }
.cypnav-tabs a.active { color: var(--cy-gold-ink); background: var(--cy-gold); }

.cyp-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  height: calc(var(--cy-tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--cy-navy-900); border-top: 1px solid var(--cy-line-strong);
  box-sizing: border-box; font-family: var(--cy-font);
}
.cyp-tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 48px; color: var(--cy-muted); text-decoration: none; font-size: 12px; font-weight: 600; letter-spacing: 0.1px;
}
.cyp-tabbar a svg { width: 24px; height: 24px; }
.cyp-tabbar a.active { color: var(--cy-gold); }
.cyp-tabbar a.active svg { filter: drop-shadow(0 0 6px rgba(217,178,95,0.35)); }
body.cyp-has-tabs { padding-bottom: calc(var(--cy-tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)) !important; }
/* Floating buttons and bottom bars on older pages sit above the tab bar on phones. */
@media (max-width: 899px) {
  body.cyp-has-tabs .fab, body.cyp-has-tabs .save-bar, body.cyp-has-tabs .bottom-bar, body.cyp-has-tabs .sticky-footer { bottom: calc(var(--cy-tabbar-h) + 8px + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (min-width: 900px) {
  .cypnav-tabs { display: flex; }
  .cyp-tabbar { display: none; }
  body.cyp-has-tabs { padding-bottom: 24px !important; }
}

/* ── Manage hub (manage.html) ─────────────────────────────────────────────── */
.hub { max-width: 960px; margin: 0 auto; padding: 16px; }
.hub h1 { font-size: 24px; font-weight: 800; margin: 8px 0 4px; }
.hub .hub-sub { color: var(--cy-muted); font-size: 15px; margin-bottom: 16px; }
.hub-group { margin: 18px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--cy-gold); }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.hub-card {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px; border-radius: var(--cy-radius);
  background: var(--cy-navy-800); border: 1px solid var(--cy-line); color: var(--cy-text); text-decoration: none;
}
.hub-card:hover, .hub-card:focus-visible { border-color: var(--cy-gold); }
.hub-card svg { width: 24px; height: 24px; color: var(--cy-gold); flex-shrink: 0; }
.hub-card b { display: block; font-size: 16px; font-weight: 700; }
.hub-card small { display: block; font-size: 13px; color: var(--cy-muted); margin-top: 2px; line-height: 1.3; }

/* ── 3. Shared helpers ────────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--cy-gold); outline-offset: 2px; }

/* ── 4. Dark theme (pages that opt in with <body class="cyp-dark">) ───────── */
body.cyp-dark { background: var(--cy-navy-950) !important; color: var(--cy-text) !important; font-size: 16px; }
body.cyp-dark a { color: inherit; }
body.cyp-dark input, body.cyp-dark select, body.cyp-dark textarea {
  background: var(--cy-navy-850); color: var(--cy-text); border: 1px solid var(--cy-line-strong); border-radius: 10px;
}
body.cyp-dark input::placeholder, body.cyp-dark textarea::placeholder { color: var(--cy-muted); }
body.cyp-dark input:focus, body.cyp-dark select:focus, body.cyp-dark textarea:focus { outline: none; border-color: var(--cy-gold); box-shadow: 0 0 0 3px rgba(217,178,95,0.2); }
body.cyp-dark .cy-card { background: var(--cy-navy-800); border: 1px solid var(--cy-line); border-radius: var(--cy-radius); }
body.cyp-dark .cy-btn { min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--cy-line-strong); background: var(--cy-navy-700); color: var(--cy-text); font-weight: 700; font-size: 16px; cursor: pointer; }
body.cyp-dark .cy-btn.gold { background: var(--cy-gold); color: var(--cy-gold-ink); border-color: var(--cy-gold); }

/* ── 5. Print: white paper, dark ink, no app chrome ───────────────────────── */
@media print {
  .cypnav, .cyp-tabbar, #cyp-site-badge, #cyp-demo-strip, #cyp-status-banner { display: none !important; }
  body, body.cyp-dark { background: #fff !important; color: #111 !important; padding: 0 !important; }
  body.cyp-dark * { background: transparent !important; color: #111 !important; border-color: #bbb !important; box-shadow: none !important; }
}

/* Small count badges on tabs (e.g. "4 low" on Orders) */
.cyp-tabbar a { position: relative; }
.cyp-tabbar .card-badge { position: absolute; top: 5px; left: calc(50% + 4px); font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--cy-bad); color: #fff; white-space: nowrap; }
.cyp-tabbar .card-badge.amber { background: var(--cy-warn); color: var(--cy-gold-ink); }
.cyp-tabbar .card-badge.green { background: var(--cy-ok); color: var(--cy-gold-ink); }
.cypnav-tabs .card-badge { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: rgba(245,196,81,0.18); color: var(--cy-warn); }
