/* --------------------------------------------------------------------------
   Admin + owner panel. Mobile-first: the owner panel is used on a phone
   behind the bar, the admin panel on a laptop. One stylesheet, no framework.
   -------------------------------------------------------------------------- */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f766e;
  --brand-dark: #0b5f58;
  --accent: #f59e0b;
  --danger: #dc2626;
  --good: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.5;
}

a { color: var(--brand); }

/* ---- shell ---- */

.topbar {
  background: #101418;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  white-space: nowrap;
}
.brand span { color: var(--accent); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }

.nav a {
  color: #cbd2da;
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 14.5px;
  white-space: nowrap;
}
.nav a:hover { background: #1c2229; color: #fff; }
.nav a.is-active { background: var(--brand); color: #fff; }

.topbar form { margin: 0; }
.linkbtn {
  background: none; border: 0; color: #9aa1ab; cursor: pointer;
  font: inherit; font-size: 14px; padding: 7px 4px;
}
.linkbtn:hover { color: #fff; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin: 0 0 20px; font-size: 14.5px; }

/* ---- cards / panels ---- */

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.panel--highlight {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  animation: panel-flash 1.2s ease-out 1;
}
@keyframes panel-flash {
  0%   { background: #ecfdf5; }
  100% { background: var(--surface); }
}

.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.panel-head h2 { margin: 0; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---- stats ---- */

.stat {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px;
}
.stat-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 750; letter-spacing: -.02em; margin-top: 3px; }
.stat-note { font-size: 13px; color: var(--muted); }
.stat--alert .stat-value { color: var(--danger); }

/* ---- tables ---- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}

/* ---- forms ---- */

.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

label.field { display: block; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field-label em { font-weight: 400; color: var(--muted); font-style: normal; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14);
}
input[type="color"] { width: 54px; height: 38px; padding: 2px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }

.checkline { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }

/* ---- buttons ---- */

.btn {
  display: inline-block;
  font: inherit; font-weight: 600; font-size: 14.5px;
  padding: 9px 15px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: #c9cfd6; }
.btn--danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn--sm { padding: 5px 10px; font-size: 13.5px; }
.btn--block { display: block; width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- pills / badges ---- */

.pill {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.pill--stock    { background: #eef2f6; color: #475569; }
.pill--assigned { background: #dcfce7; color: #15803d; }
.pill--retired  { background: #f1f5f9; color: #94a3b8; }
.pill--new      { background: #fee2e2; color: #b91c1c; }
.pill--resolved { background: #dcfce7; color: #15803d; }
.pill--qr       { background: #e0e7ff; color: #3730a3; }
.pill--nfc      { background: #fce7f3; color: #9d174d; }
.pill--link     { background: #ccfbf1; color: #0f766e; }
.pill--mock     { background: #fef3c7; color: #92400e; }

/* ---- weekly report preview ---- */

.report-preview {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.55;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin: 0;
  font-family: inherit;
}

/* ---- Google attribution: required wherever Places data is shown ---- */

.attribution {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---- messages ---- */

.msg { border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 14.5px; }
.msg--ok  { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.msg--err { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.msg--info{ background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }

.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 14.5px; }

/* ---- login ---- */

.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 30px 26px; }
.login-box h1 { text-align: center; margin-bottom: 4px; }
.login-box .page-sub { text-align: center; }

/* ---- star bits ---- */

.stars-inline { color: var(--accent); letter-spacing: 2px; white-space: nowrap; }
.stars-inline .off { color: #d5d9de; }

.rating-big { font-size: 40px; font-weight: 750; letter-spacing: -.03em; line-height: 1; }

/* ---- review list ---- */

.review { border-bottom: 1px solid var(--line); padding: 12px 0; }
.review:last-child { border-bottom: 0; }
.review-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--muted); }
.review-text { margin: 5px 0 0; font-size: 14.5px; }

/* ---- feedback inbox ---- */

.fb { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fff; }
.fb--new { border-color: #fca5a5; background: #fffbfb; }
.fb-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.fb-comment { margin: 0 0 10px; font-size: 15px; }
.fb-meta { font-size: 13.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---- QR sheet (print) ---- */

.sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sheet-item { border: 1px solid #ddd; border-radius: 8px; padding: 8px; text-align: center; page-break-inside: avoid; }
.sheet-item svg { width: 100%; height: auto; display: block; }
.sheet-code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; letter-spacing: 1px; margin-top: 4px; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .panel { box-shadow: none; padding: 0; }
  .sheet { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 640px) {
  /* Keep the nav on one line and let it scroll sideways, instead of wrapping
     into three rows and pushing the page content down on a phone. */
  .topbar-inner { flex-wrap: nowrap; gap: 8px; }
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .wrap { padding: 16px 12px 50px; }
  .panel { padding: 14px; }
  h1 { font-size: 21px; }
  .stat-value { font-size: 24px; }
  .sheet { grid-template-columns: repeat(2, 1fr); }
}
