/* =========================================================================
   PB Aruba Dashboard — mobile-first PWA
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Pinyon+Script&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:          #f5f1eb;
  --card:        #ffffff;
  --border:      #e4dfd5;
  --text:        #2b2926;
  --text-soft:   #7a736b;
  --accent:      #b48250;   /* warm brown */
  --accent-dark: #8a6039;
  --success:     #2f7a4a;
  --danger:      #b3413b;
  --warn:        #b48250;
  --shadow:      0 4px 16px rgba(0,0,0,0.06);
  --radius:      14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
.hidden { display: none !important; }

/* ---- Brand ---- */
.brand-wordmark {
  font-family: 'Pinyon Script', cursive;
  font-size: 38px;
  line-height: 1;
  color: var(--text);
  text-align: center;
}
.brand-wordmark.small { font-size: 24px; text-align: left; }
.brand-sub {
  letter-spacing: 0.28em;
  font-size: 10px;
  color: var(--text-soft);
  text-align: center;
  margin: 6px 0 22px;
}

/* ---- Login overlay ---- */
.login-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #ecdccf 0%, #d9c1a8 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 999;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 22px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}
.login-hint { font-size: 12px; color: var(--text-soft); line-height: 1.5; margin: 0 0 18px; }
.login-hint code { background: #f3ede3; padding: 2px 5px; border-radius: 4px; font-size: 11px; }
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: 6px;
}
.field input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fdfbf7; font-size: 14px; color: var(--text);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-primary {
  width: 100%; padding: 14px;
  background: var(--text); color: white;
  border: none; border-radius: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; font-weight: 500;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.5; }
.login-result { margin-top: 12px; font-size: 12px; min-height: 16px; }
.login-result.ok { color: var(--success); }
.login-result.err { color: var(--danger); }

/* ---- Topbar ---- */
.app { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 8px; background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.btn-ghost {
  background: none; border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 999px;
  color: var(--text-soft); font-size: 12px;
}

.who-chip {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-soft); padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 999px;
  background: rgba(255,255,255,0.5);
  margin-left: auto; margin-right: 8px;
}

/* ---- Tabs ---- */
.tabbar {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 6px 16px 12px;
  background: var(--bg);
  position: sticky; top: 60px; z-index: 9;
  -webkit-overflow-scrolling: touch;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  background: transparent; border: 1px solid transparent;
  padding: 8px 14px; border-radius: 999px;
  font-size: 12px; color: var(--text-soft); letter-spacing: 0.06em;
  white-space: nowrap; position: relative;
}
.tab.active { background: var(--text); color: white; border-color: var(--text); }

.badge {
  display: inline-block; background: var(--accent);
  color: white; font-size: 10px; padding: 1px 7px;
  border-radius: 999px; margin-left: 4px;
}

/* ---- Main content ---- */
main {
  padding: 12px 16px 32px;
  max-width: 800px; margin: 0 auto;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 500;
}
.card h3 { margin: 0; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-soft); font-weight: 500; }
.big-number { font-size: 40px; font-weight: 300; letter-spacing: -0.02em; margin-top: 4px; }
.big-number .cur { font-size: 18px; color: var(--text-soft); vertical-align: super; margin-right: 4px; }
.delta { font-size: 12px; margin-top: 6px; color: var(--text-soft); }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card.mini { padding: 14px; }
.card.mini .big-number { font-size: 26px; }
.card.mini h2 { font-size: 10px; }

/* ---- Chart (bar list) ---- */
.chart {
  display: flex; align-items: flex-end;
  gap: 5px; height: 120px; margin-top: 12px;
}
.chart .bar {
  flex: 1; min-width: 4px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: 4px 4px 0 0;
  position: relative;
}
.chart .bar.today { background: var(--text); }
.chart .bar-label {
  position: absolute; bottom: -20px; left: 0; right: 0;
  text-align: center; font-size: 9px; color: var(--text-soft);
}

/* ---- Lists ---- */
.list { margin: 0; padding: 0; list-style: none; }
.list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.list li:last-child { border-bottom: none; }
.list .sub { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.pill {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.pill.ok      { background: #e2f0e6; color: var(--success); }
.pill.warn    { background: #f5e6d3; color: var(--warn); }
.pill.danger  { background: #f5dedb; color: var(--danger); }
.pill.muted   { background: #eee9e0; color: var(--text-soft); }

/* ---- Product card in stock ---- */
.stock-item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  align-items: center;
}
.stock-item img {
  width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
  background: #f3ede3;
}
.stock-item .no-photo {
  width: 56px; height: 56px; border-radius: 8px;
  background: #f3ede3; display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-size: 10px;
}
.stock-item .ref { font-weight: 500; font-size: 14px; }
.stock-item .desc { color: var(--text-soft); font-size: 11px; margin-top: 2px; }
.stock-item .stock-num { font-size: 20px; font-weight: 300; }

/* ---- Reservation card ---- */
.reserv-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.reserv-head { display: flex; justify-content: space-between; align-items: flex-start; }
.reserv-code {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 18px; letter-spacing: 0.14em;
  background: #f3ede3; padding: 6px 12px; border-radius: 6px;
}
.reserv-actions { display: flex; gap: 8px; margin-top: 14px; }
.reserv-actions button {
  flex: 1; padding: 10px; border-radius: 8px;
  font-size: 12px; letter-spacing: 0.08em; font-weight: 500;
  border: 1px solid var(--border); background: white;
}
.reserv-actions .confirm { background: var(--success); color: white; border-color: var(--success); }
.reserv-actions .reject  { background: var(--danger); color: white; border-color: var(--danger); }
.reserv-actions .fulfill { background: var(--text); color: white; border-color: var(--text); }

.empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-soft); font-size: 13px;
}

/* ---- Search input ---- */
.search-input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: white; font-size: 14px; margin-bottom: 12px;
}

/* ---- Loading / refresh ---- */
.loader {
  padding: 40px 0; text-align: center; color: var(--text-soft); font-size: 12px;
}
.loader::before {
  content: ''; display: inline-block; vertical-align: middle;
  width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--text);
  border-radius: 50%; margin-right: 8px; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Photo lightbox ---- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; }

/* ---- Utility ---- */
.right { text-align: right; }
.mono { font-family: 'Menlo', 'Consolas', monospace; font-variant-numeric: tabular-nums; }
