:root {
  --m-primary: #0f5e6e;
  --m-primary-dark: #0b4652;
  --m-accent: #e8a33d;
  --m-bg: #f4f6f8;
  --m-sidebar: #0e2a33;
  --m-sidebar-text: #b7c9cf;
  --bs-primary: #0f5e6e;
  --bs-primary-rgb: 15, 94, 110;
  --bs-link-color: #0f5e6e;
  --bs-link-color-rgb: 15, 94, 110;
  --bs-link-hover-color: #0b4652;
}
body { background: var(--m-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--m-primary); --bs-btn-border-color: var(--m-primary); --bs-btn-hover-bg: var(--m-primary-dark); --bs-btn-hover-border-color: var(--m-primary-dark); --bs-btn-active-bg: var(--m-primary-dark); --bs-btn-disabled-bg: var(--m-primary); --bs-btn-disabled-border-color: var(--m-primary); }
.btn-outline-primary { --bs-btn-color: var(--m-primary); --bs-btn-border-color: var(--m-primary); --bs-btn-hover-bg: var(--m-primary); --bs-btn-hover-border-color: var(--m-primary); --bs-btn-active-bg: var(--m-primary); }
.text-primary { color: var(--m-primary) !important; }
.bg-primary { background-color: var(--m-primary) !important; }
.form-check-input:checked { background-color: var(--m-primary); border-color: var(--m-primary); }

.boot-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(circle at 20% 10%, #12707f 0, #0e2a33 60%); }
.site-foot { padding: 12px 20px; font-size: .8rem; color: #7b8a90; text-align: center; }
.site-foot:empty { display: none; }
.site-foot a { color: inherit; }
.site-foot.on-dark { margin-top: 18px; color: rgba(255,255,255,.65); }
.auth-card { width: 100%; max-width: 440px; border: 0; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.auth-card.wide { max-width: 560px; }
.brand-mark { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.4rem; color: var(--m-primary); }
.brand-mark img { width: 36px; height: 36px; }
.otp-input { letter-spacing: .6em; font-size: 1.6rem; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--m-sidebar); color: var(--m-sidebar-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 18px 20px; display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.sidebar .brand img { width: 30px; height: 30px; }
.sidebar .nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6f8c95; padding: 14px 20px 4px; }
.sidebar a.nav-item { display: flex; align-items: center; gap: 10px; color: var(--m-sidebar-text); text-decoration: none; padding: 8px 20px; border-left: 3px solid transparent; }
.sidebar a.nav-item:hover { color: #fff; background: rgba(255,255,255,.04); }
.sidebar a.nav-item.active { color: #fff; background: rgba(255,255,255,.08); border-left-color: var(--m-accent); }
.sidebar a.nav-item .badge { margin-left: auto; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid #e3e8eb; padding: 10px 20px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 1020; }
.topbar .title { font-weight: 600; font-size: 1.05rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 20px; flex: 1; }
.sub-banner { padding: 8px 20px; font-size: .875rem; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: -260px; z-index: 1045; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .content { padding: 14px; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1040; }
}

/* ---------- components ---------- */
.card { border: 1px solid #e3e8eb; border-radius: 12px; }
.card-header { background: #fff; border-bottom: 1px solid #edf0f2; font-weight: 600; }
.kpi { padding: 16px; }
.kpi .label { font-size: .78rem; color: #6c7a80; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.45rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .8rem; color: #6c7a80; }
.kpi .icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .55rem .6rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: #6c7a80; font-weight: 600; white-space: nowrap; background: #fafbfc; }
.table-hover tbody tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-state { text-align: center; padding: 40px 16px; color: #7b8a90; }
.empty-state i { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .6; }
.filters .form-control, .filters .form-select { min-width: 140px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-head h2 { font-size: 1.25rem; margin: 0; font-weight: 700; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.dl-grid dt { font-weight: 500; color: #6c7a80; }
.dl-grid dd { margin: 0; }
.picker { position: relative; }
.picker-results { position: absolute; z-index: 1060; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid #dfe5e8; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; }
.picker-results .item { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.picker-results .item:hover, .picker-results .item.active { background: #eef6f8; }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.chart-bars .bar { flex: 1; background: linear-gradient(180deg, #2a8ea0, var(--m-primary)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart-bars .bar:hover { opacity: .85; }
.chart-labels { display: flex; gap: 6px; font-size: .68rem; color: #8a979c; }
.chart-labels span { flex: 1; text-align: center; }
.perm-group { border: 1px solid #e8edef; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.perm-group h6 { font-size: .8rem; text-transform: uppercase; color: #6c7a80; margin-bottom: 6px; }
.notif-item.unread { background: #f1f8fa; }
.wizard-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.wizard-steps .step { flex: 1; min-width: 110px; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid #e3e8eb; font-size: .82rem; }
.wizard-steps .step.done { border-color: #9fd1b4; background: #effaf3; }
.wizard-steps .step.current { border-color: var(--m-primary); box-shadow: inset 0 0 0 1px var(--m-primary); }
.small-muted { font-size: .8rem; color: #7b8a90; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- POS ---------- */
.pos-grid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
@media (max-width: 1199.98px) { .pos-grid { grid-template-columns: 1fr; } }
.pos-cart td { vertical-align: middle; }
.pos-cart input.form-control-sm { max-width: 90px; }
.pos-total { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.scan-input { font-size: 1.1rem; }

/* ---------- in-app guide (spotlight tour) ---------- */
.tour-layer { position: fixed; inset: 0; z-index: 2000; }
.tour-shade { position: absolute; inset: 0; background: transparent; }
.tour-layer.no-target .tour-shade { background: rgba(10, 30, 36, .62); }
.tour-spot { position: fixed; border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(10, 30, 36, .62); outline: 3px solid var(--m-accent); outline-offset: 2px; transition: all .25s ease; }
.tour-layer.no-target .tour-spot { display: none; }
.tour-pop { position: fixed; width: 340px; max-width: calc(100vw - 24px); background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.3); padding: 18px 18px 14px; transition: top .25s ease, left .25s ease; }
.tour-pop h6 { font-weight: 700; font-size: 1.02rem; margin: 0 0 6px; color: #0f2a33; }
.tour-pop .tour-body { font-size: .9rem; color: #3d4c52; line-height: 1.5; }
.tour-pop .tour-body ul, .tour-pop .tour-body ol { padding-left: 1.1rem; margin: 6px 0 0; }
.tour-pop .tour-count { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--m-primary); font-weight: 700; margin-bottom: 4px; }
.tour-pop .tour-dots { display: flex; gap: 4px; }
.tour-pop .tour-dots span { width: 6px; height: 6px; border-radius: 50%; background: #d5dde0; }
.tour-pop .tour-dots span.on { background: var(--m-primary); }
@media (max-width: 575.98px) {
  .tour-pop { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; }
}
.gs-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef1f3; }
.gs-item:last-child { border-bottom: 0; }
.gs-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #c9d3d7; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.gs-item.done .gs-check { background: #1f9d62; border-color: #1f9d62; }
.gs-item.done .gs-title { text-decoration: line-through; color: #7b8a90; }

@media print {
  .sidebar, .topbar, .no-print, .toast-container { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
}
