/* BAYAKA Location — design system */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;1,400&family=Montserrat:wght@600;700&display=swap');

:root {
  --gold: #ffd700;
  --gold-dark: #e6c200;
  --bg-1: #262833;
  --bg-2: #252a33;
  --bg-3: #323844;
  --bg-4: #3a4150;
  --text: #ffffff;
  --text-soft: #e5e5e5;
  --text-muted: #7d7b8d;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  --radius-lg: 12px;
  --site-width: 1250px;
  --font-title: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Merriweather', Georgia, serif;
  --body-size: 15px;
  --tap: 48px;
  --sidebar-w: 260px;
  --header-h: 64px;
  --ok: #4caf7a;
  --warn: #e6a23c;
  --bad: #e05c5c;
  --muted: #7d7b8d;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: var(--body-size);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-soft);
  background: var(--bg-1);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-decoration: none; transition: color 0.15s; }
a:hover { color: #fff; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin: 0 0 0.75em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

/* Layout — public */
.site-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner,
.site-main,
.site-footer__inner {
  max-width: var(--site-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.site-logo img { height: 42px; width: auto; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-soft);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--gold);
  background: rgba(255, 215, 0, 0.08);
}

.site-nav__cta {
  background: var(--gold) !important;
  color: var(--bg-1) !important;
  font-weight: 700 !important;
}

.site-nav__cta:hover {
  background: var(--gold-dark) !important;
  color: var(--bg-1) !important;
}

.site-main {
  flex: 1;
  padding: 2rem 1.25rem 3rem;
  width: 100%;
}

.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: auto;
}

.site-footer__inner {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer a { color: var(--gold); }

/* Bare layout */
.bare-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 50%, var(--bg-3) 100%);
}

.bare-logo { margin-bottom: 2rem; }
.bare-logo img { height: 56px; }
.bare-content { width: 100%; max-width: 440px; }

/* App layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.app-sidebar.is-open { transform: translateX(0); }

.app-sidebar__brand {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-sidebar__brand img { height: 36px; }
.app-sidebar__brand span {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
}

.app-nav {
  flex: 1;
  padding: 0.75rem 0;
  list-style: none;
  margin: 0;
}

.app-nav li a,
.app-nav li button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.25rem;
  color: var(--text-soft);
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.app-nav li a:hover,
.app-nav li a.is-active {
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
}

.app-nav__section {
  padding: 1rem 1.25rem 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-weight: 600;
}

.app-main {
  flex: 1;
  margin-left: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h);
}

.app-topbar__title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin: 0;
}

.app-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-content {
  flex: 1;
  padding: 1rem;
  max-width: 1400px;
  width: 100%;
}

.app-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
}

.app-overlay.is-visible { display: block; }

@media (min-width: 900px) {
  .app-sidebar { transform: translateX(0); }
  .app-main { margin-left: var(--sidebar-w); }
  .app-menu-btn { display: none !important; }
  .app-overlay { display: none !important; }
}

/* Flash */
.flash {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 600;
  animation: flash-in 0.3s ease;
}

.flash.ok {
  background: rgba(76, 175, 122, 0.15);
  border: 1px solid rgba(76, 175, 122, 0.4);
  color: #8fd4a8;
}

.flash.error {
  background: rgba(224, 92, 92, 0.15);
  border: 1px solid rgba(224, 92, 92, 0.4);
  color: #f0a0a0;
}

.flash.is-hidden {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s, transform 0.3s;
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  min-height: var(--tap);
  line-height: 1.2;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--gold);
  color: var(--bg-1);
}

.btn-primary:hover {
  background: var(--gold-dark);
  color: var(--bg-1);
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-4);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--gold); border-color: var(--gold); }

.btn-danger {
  background: rgba(224, 92, 92, 0.2);
  color: #f0a0a0;
  border: 1px solid rgba(224, 92, 92, 0.4);
}

.btn-lg {
  padding: 0.9rem 1.75rem;
  font-size: 1rem;
  min-height: 52px;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  min-height: 36px;
}

.btn-block { width: 100%; }

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Cards */
.card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card__body { padding: 1.25rem; }
.card__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card__title {
  margin: 0;
  font-size: 1rem;
}

.card__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

/* Grid */
.grid {
  display: grid;
  gap: 1.25rem;
}

.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* Product cards */
.product-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: rgba(255, 215, 0, 0.35);
  transform: translateY(-2px);
}

.product-card__img {
  aspect-ratio: 4/3;
  background: var(--bg-2);
  object-fit: cover;
  width: 100%;
}

.product-card__img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.product-card__body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card__name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 0.35em;
}

.product-card__price {
  color: var(--gold);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
}

.product-card__meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.75rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 1rem 4rem;
  background: linear-gradient(180deg, var(--bg-2) 0%, transparent 100%);
  border-radius: var(--radius-lg);
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.5em;
}

.hero h1 span { color: var(--gold); }

.hero__lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* Forms */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-bottom: 0.35rem;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-control {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: var(--tap);
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
}

textarea.form-control { min-height: 120px; resize: vertical; }

select.form-control { cursor: pointer; }

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}

.form-check input { margin-top: 0.25rem; accent-color: var(--gold); }

.form-row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 600px) {
  .form-row-2 { grid-template-columns: 1fr 1fr; }
}

.form-scan {
  font-size: 1.25rem !important;
  font-family: var(--font-title) !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em;
  text-align: center;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-2);
  white-space: nowrap;
}

.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.data-table tr:last-child td { border-bottom: none; }

.data-table a { font-weight: 600; }

/* Definition list */
.dl-show {
  display: grid;
  gap: 0;
}

.dl-show__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 600px) {
  .dl-show__row { grid-template-columns: 200px 1fr; gap: 1rem; }
}

.dl-show__label {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dl-show__value { color: var(--text-soft); }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
  white-space: nowrap;
}

.badge.ok { background: rgba(76, 175, 122, 0.2); color: #8fd4a8; }
.badge.warn { background: rgba(230, 162, 60, 0.2); color: #f0c878; }
.badge.bad { background: rgba(224, 92, 92, 0.2); color: #f0a0a0; }
.badge.muted { background: rgba(125, 123, 141, 0.2); color: var(--text-muted); }

/* Stats */
.stats {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.stat {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat__value {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--gold);
  line-height: 1.2;
}

.stat__label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-family: var(--font-title);
  font-weight: 600;
}

/* Progress */
.progress {
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-lg { height: 14px; border-radius: 7px; }
.progress-lg .progress__bar { border-radius: 7px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

/* Ops mobile */
.ops-scan-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem;
  background: var(--bg-2);
  border-top: 2px solid var(--gold);
  z-index: 60;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.ops-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ops-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--tap);
}

.ops-list__item.is-done { opacity: 0.6; }
.ops-list__item.is-done .ops-list__name { text-decoration: line-through; }

.ops-list__name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.ops-list__code {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: monospace;
}

/* Signature */
.sig-wrap {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
}

.sig-wrap canvas {
  display: block;
  width: 100%;
  height: 200px;
  cursor: crosshair;
}

/* QR */
.qr-box {
  display: inline-block;
  padding: 1rem;
  background: #fff;
  border-radius: var(--radius);
}

.qr-box svg { display: block; }

/* Page header */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 { margin: 0; font-size: 1.4rem; }

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: flex-end;
}

.filters .form-group { margin: 0; flex: 1; min-width: 160px; }

/* Alerts */
.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.alert-list li {
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--warn);
  background: rgba(230, 162, 60, 0.08);
  margin-bottom: 0.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
}

.alert-list li.alert-bad { border-color: var(--bad); background: rgba(224, 92, 92, 0.08); }

/* Error pages */
.error-page {
  text-align: center;
  padding: 4rem 1rem;
}

.error-page__code {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 5rem;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 0.5rem;
}

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .no-print { display: none !important; }
  .site-header, .site-footer, .app-sidebar, .app-topbar { display: none !important; }
  .app-main { margin: 0 !important; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
}

.print-doc {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  color: #111;
  font-family: Georgia, serif;
  background: #fff;
}

.print-doc h1, .print-doc h2 { color: #111; }

/* Utilities */
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-2 { margin-top: 2rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--bad);
  color: #fff;
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 10px;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state p { margin-bottom: 1rem; }
