/* Zygrix POS application styles. Mobile-first; tokens live in tokens.css. */

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--z-font);
  font-size: 11px;
  line-height: 1.45;
  color: var(--z-text);
  background: var(--z-bg);
  min-height: 100vh;
}
h1, h2, h3, h4, h5 { color: var(--z-text); letter-spacing: -0.02em; line-height: 1.2; }
h1, .h1 { font-weight: 600; font-size: 15.5px; }
h2, .h2 { font-weight: 600; font-size: 13.5px; }
h3, .h3, h4, h5 { font-weight: 600; }
:focus-visible { outline: 2px solid var(--z-primary); outline-offset: 3px; }
a { text-decoration: none; }
.text-muted { color: var(--z-muted) !important; }

.eyebrow {
  display: inline-block;
  color: var(--z-primary);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ---------- Buttons (pill, brand gradient) ---------- */
.btn {
  --bs-btn-font-weight: 500;
  --bs-btn-border-radius: var(--z-radius-sm);
  --bs-btn-padding-x: 0.85rem;
  --bs-btn-padding-y: 0.35rem;
  font-size: 10.5px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform var(--z-dur) var(--z-ease), box-shadow var(--z-dur) var(--z-ease), background var(--z-dur) var(--z-ease);
}
.btn-sm { min-height: 30px; --bs-btn-padding-x: 0.6rem; --bs-btn-padding-y: 0.2rem; font-size: 10px; gap: 0.35rem; }
.btn-primary {
  --bs-btn-bg: var(--z-primary);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--z-primary-600);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--z-primary-600);
  --bs-btn-disabled-bg: var(--z-primary);
  color: #fff;
}
.btn-primary:hover { color: #fff; }
.btn-outline-primary, .btn-secondary {
  --bs-btn-color: var(--z-navy-2);
  --bs-btn-bg: var(--z-surface);
  --bs-btn-border-color: var(--z-border-strong);
  --bs-btn-hover-color: var(--z-navy);
  --bs-btn-hover-bg: var(--z-primary-50);
  --bs-btn-hover-border-color: var(--z-border-strong);
  --bs-btn-active-bg: var(--z-primary-50);
  --bs-btn-active-color: var(--z-navy);
}
.btn-ghost { background: transparent; border: 0; color: var(--z-muted); }
.btn-ghost:hover { background: var(--z-primary-50); color: var(--z-primary); }
.btn-icon { width: 36px; padding: 0; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: 10px; color: var(--z-muted); margin-bottom: 0.2rem; }
.form-control, .form-select {
  min-height: 36px;
  padding-top: 0.3rem; padding-bottom: 0.3rem;
  border-radius: var(--z-radius-sm);
  border-color: var(--z-border);
  background-color: var(--z-surface);
  color: var(--z-text);
  font-size: 11px;
}
.form-control-sm, .form-select-sm { min-height: 30px; font-size: 10.5px; }
.form-control-lg { min-height: 42px; font-size: 12.5px; }
.form-control:focus, .form-select:focus {
  border-color: var(--z-primary);
  box-shadow: 0 0 0 3px rgba(5, 90, 135, 0.15);
}
.form-check-input:checked { background-color: var(--z-primary); border-color: var(--z-primary); }
.field-validation-error, .validation-summary-errors { color: var(--z-danger); font-size: 10.5px; }
.validation-summary-errors ul { margin: 0; padding-left: 1rem; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--z-subtle); pointer-events: none; }
.input-icon > .form-control { padding-left: 34px; }

/* ---------- Cards ---------- */
.z-card {
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius);
  box-shadow: var(--z-shadow-sm);
}
.z-card-body { padding: var(--z-space-4); }
@media (max-width: 575.98px) { .z-card-body { padding: var(--z-space-3); } }
.z-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--z-space-3);
  padding: var(--z-space-3) var(--z-space-4);
  border-bottom: 1px solid var(--z-border);
}
.z-card-header h2 { font-size: 11.5px; margin: 0; }

.kpi { display: flex; flex-direction: column; gap: 0.35rem; height: 100%; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--z-primary-50); color: var(--z-primary);
}
.kpi-label { font-size: 9.5px; color: var(--z-muted); font-weight: 500; }
.kpi-value { font-size: 15.5px; font-weight: 600; color: var(--z-text); letter-spacing: -0.02em; }
.kpi-note { font-size: 10px; color: var(--z-subtle); }

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--z-radius);
  padding: var(--z-space-5);
  color: #fff;
  background:
    radial-gradient(circle at 85% 20%, rgba(122, 252, 255, 0.28), transparent 35%),
    var(--z-gradient);
  box-shadow: var(--z-shadow);
}
.hero-card h1 { color: #fff; margin: 0.25rem 0; }
.hero-card .eyebrow { color: rgba(255, 255, 255, 0.85); }
.hero-card p { color: rgba(255, 255, 255, 0.85); margin: 0; }
.hero-card .btn-light { --bs-btn-color: var(--z-navy-2); font-weight: 600; }

/* ---------- Badges & chips ---------- */
.z-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--z-radius-pill);
  font-size: 9.5px; font-weight: 600;
  background: var(--z-primary-50); color: var(--z-primary);
  white-space: nowrap;
}
.z-badge.success { background: var(--z-success-50); color: var(--z-success); }
.z-badge.warning { background: var(--z-warning-50); color: var(--z-warning); }
.z-badge.danger { background: var(--z-danger-50); color: var(--z-danger); }
.z-badge.muted { background: var(--z-surface-2); color: var(--z-muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--z-sidebar-w);
  background: var(--z-sidebar-bg);
  color: #cfe3f5;
  display: flex; flex-direction: column;
  z-index: 1040;
  transform: translateX(-100%);
  transition: transform 220ms var(--z-ease);
}
.sidebar.is-open { transform: translateX(0); box-shadow: var(--z-shadow); }
.sidebar-brand { padding: 12px 16px 8px; display: flex; align-items: center; justify-content: space-between; }
.sidebar-brand img { height: 30px; width: auto; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 12px; }
.nav-section {
  font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(207, 227, 245, 0.45); font-weight: 600;
  padding: 10px 10px 4px; white-space: nowrap;
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; border-radius: 6px; cursor: pointer; text-align: left;
}
.nav-link-z {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin: 1px 0;
  border-radius: 6px; white-space: nowrap;
  color: #cfe3f5; font-size: 10.5px; font-weight: 400;
  transition: background var(--z-dur) var(--z-ease), color var(--z-dur) var(--z-ease);
}
.nav-link-z:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link-z svg { flex-shrink: 0; width: 17px; height: 17px; }
.nav-link-z.active { background: var(--z-primary); color: #fff; font-weight: 500; }
.nav-link-z.is-disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.nav-link-z .tag { margin-left: auto; font-size: 9.5px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: #cfe3f5; }
.sidebar-footer { padding: 8px 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 9.5px; color: rgba(207, 227, 245, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-collapse { display: none; align-items: center; justify-content: center; height: 32px; margin: 0 10px 6px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, 0.06); color: #cfe3f5; }
.sidebar-collapse:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.backdrop { position: fixed; inset: 0; background: rgba(6, 30, 65, 0.45); z-index: 1035; display: none; }
.backdrop.is-open { display: block; }

.main { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(var(--z-bottomnav-h) + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 1020;
  height: var(--z-topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--z-border);
}
[data-theme="dark"] .topbar { background: rgba(10, 22, 51, 0.88); }
.topbar-title { font-weight: 600; font-size: 12px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-logo { height: 26px; }
.topbar .search { flex: 1; max-width: 420px; display: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--z-primary); color: #fff; font-weight: 600; font-size: 9.5px;
}
.content { padding: 12px; flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
  height: calc(var(--z-bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--z-surface);
  border-top: 1px solid var(--z-border);
  box-shadow: 0 -8px 24px rgba(1, 38, 100, 0.06);
}
.bottom-nav a, .bottom-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 9.5px; font-weight: 500; color: var(--z-subtle);
  background: none; border: 0;
}
.bottom-nav a.active { color: var(--z-primary); }
.bottom-nav .fab {
  width: 52px; height: 52px; margin: -22px auto 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--z-btn-gradient); color: #fff;
  box-shadow: var(--z-shadow-btn);
}

@media (min-width: 768px) {
  .content { padding: 16px 20px; }
  .topbar { padding: 0 20px; }
  .topbar .search { display: block; }
}

@media (min-width: 992px) {
  .sidebar { transform: none; }
  .main { margin-left: var(--z-sidebar-w); padding-bottom: 0; transition: margin-left 200ms var(--z-ease); }
  .bottom-nav, .topbar-logo, .menu-toggle, .sidebar-close { display: none !important; }
  .backdrop { display: none !important; }
  .content { padding: 18px 24px; }
  .sidebar { transition: width 200ms var(--z-ease); }
  .sidebar-collapse { display: flex; }
  .sidebar-collapsed .sidebar { width: var(--z-sidebar-w-collapsed); }
  .sidebar-collapsed .main { margin-left: var(--z-sidebar-w-collapsed); }
  .sidebar-collapsed .sidebar-collapse svg { transform: rotate(180deg); }
  .sidebar-collapsed .nav-link-z { justify-content: center; padding: 8px 0; }
  .sidebar-collapsed .nav-link-z span, .sidebar-collapsed .nav-section, .sidebar-collapsed .sidebar-footer { display: none; }
  .sidebar-collapsed .sidebar-brand { justify-content: center; padding: 12px 0 8px; }
  .sidebar-collapsed .sidebar-brand img { width: 30px; height: 30px; object-fit: cover; object-position: left; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.page-header h1 { margin: 0; }
.page-header p, .page-header .eyebrow { display: none; }

/* ---------- Tables → cards on mobile ---------- */
.z-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.z-table th {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--z-subtle); font-weight: 600; white-space: nowrap;
  padding: 8px 12px; background: var(--z-surface-2);
  border-bottom: 1px solid var(--z-border);
}
.z-table td { padding: 8px 12px; border-bottom: 1px solid var(--z-border); vertical-align: middle; }
.z-table tr:last-child td { border-bottom: 0; }
.z-table tbody tr { transition: background var(--z-dur) var(--z-ease); }
.z-table tbody tr:hover { background: var(--z-surface-2); }
@media (max-width: 767.98px) {
  .z-table thead { display: none; }
  .z-table, .z-table tbody, .z-table tr, .z-table td { display: block; width: 100%; }
  .z-table tr { padding: 10px 12px; border-bottom: 1px solid var(--z-border); }
  .z-table td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; }
  .z-table td::before { content: attr(data-label); color: var(--z-subtle); font-size: 10px; font-weight: 500; }
  .z-table td.cell-primary { font-weight: 600; font-size: 11.5px; display: block; }
  .z-table td.cell-primary::before { content: none; }
}

.empty-state { text-align: center; padding: 28px 16px; color: var(--z-muted); }
.empty-state .icon-wrap {
  width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 10px;
  display: grid; place-items: center; background: var(--z-primary-50); color: var(--z-primary);
}

/* ---------- Quick actions & checklist ---------- */
.quick-action {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--z-radius);
  border: 1px solid var(--z-border); background: var(--z-surface);
  color: var(--z-text); font-weight: 500; font-size: 10.5px;
  transition: transform var(--z-dur) var(--z-ease), border-color var(--z-dur) var(--z-ease), box-shadow var(--z-dur) var(--z-ease);
}
.quick-action:hover { border-color: var(--z-border-strong); color: var(--z-text); }
.quick-action.is-disabled { opacity: 0.55; pointer-events: none; }
.quick-action small { display: block; color: var(--z-subtle); font-weight: 400; font-size: 9.5px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--z-border); font-size: 11.5px; }
.checklist li:last-child { border-bottom: 0; }
.check-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: rgba(6, 30, 65, 0.06); color: var(--z-subtle); }
.check-icon.done { background: var(--z-success-50); color: var(--z-success); }

/* ---------- Alerts / toasts ---------- */
.z-alert { border-radius: var(--z-radius-sm); padding: 8px 12px; font-size: 10.5px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.z-alert.success { background: var(--z-success-50); color: #14532d; border-color: rgba(22, 163, 74, 0.25); }
.z-alert.danger { background: var(--z-danger-50); color: #7f1d1d; border-color: rgba(220, 38, 38, 0.25); }
.z-alert.info { background: var(--z-info-50); color: var(--z-navy-2); border-color: var(--z-border-strong); }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--z-bg); }
.auth-brand {
  display: none; position: relative; overflow: hidden;
  background: radial-gradient(circle at 15% 20%, rgba(5, 90, 135, 0.35), transparent 35%),
              radial-gradient(circle at 85% 80%, rgba(122, 252, 255, 0.18), transparent 35%),
              var(--z-dark);
  color: #fff; padding: 48px;
  flex-direction: column; justify-content: space-between;
}
.auth-brand h2 { color: #fff; font-size: 26px; font-weight: 700; max-width: 14ch; }
.auth-brand p { color: rgba(255, 255, 255, 0.75); max-width: 42ch; }
.auth-brand .feature { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, 0.85); font-size: 11.5px; margin-top: 10px; }
.auth-brand .feature svg { color: var(--z-glow); }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { height: 54px; margin-bottom: 24px; }
@media (min-width: 992px) {
  .auth-page { grid-template-columns: 1.05fr 1fr; }
  .auth-brand { display: flex; }
}

.swoosh { position: relative; display: inline-block; }
.swoosh::after {
  content: ""; position: absolute; left: 0; right: 8%; bottom: -6px; height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 16' fill='none'%3E%3Cpath d='M2 12c42-10 84-14 126-8 34 5 70 10 110 3' stroke='%2305B3FC' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.pagination-z { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--z-border); font-size: 11px; color: var(--z-muted); }

@media print {
  .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
}
.validation-summary-valid { display: none !important; }
.auth-card .logo { display: block; }

/* ---------- Scan / search line editor ---------- */
.lookup { position: relative; }
.lookup .form-control-lg { min-height: 42px; font-size: 12px; border-radius: var(--z-radius-sm); }
.lookup-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1050;
  background: var(--z-surface); border: 1px solid var(--z-border); border-radius: 14px;
  box-shadow: var(--z-shadow); max-height: 360px; overflow-y: auto; padding: 6px;
}
.lookup-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--z-text);
}
.lookup-item strong { display: block; font-weight: 600; font-size: 11.5px; }
.lookup-item small { color: var(--z-subtle); font-size: 10px; }
.lookup-item:hover, .lookup-item.active { background: var(--z-primary-50); }
.lookup-empty { padding: 14px; color: var(--z-muted); font-size: 11px; text-align: center; }
tr.flash { background: var(--z-primary-50) !important; transition: background 0.6s; }

/* ---------- Filter bar, tabs, stats ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { min-height: 34px; width: auto; min-width: 160px; }
.filter-bar .grow { flex: 1 1 220px; }
.z-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 16px; }
.z-tabs a {
  white-space: nowrap; padding: 4px 12px; border-radius: var(--z-radius-sm); font-size: 10px; font-weight: 500;
  color: var(--z-muted); background: var(--z-surface); border: 1px solid var(--z-border);
}
.z-tabs a.active { color: #fff; background: var(--z-primary); border-color: transparent; }
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 992px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 10px 12px; }
.stat .kpi-value { font-size: 14.5px; }
.qty-pos { color: var(--z-success); font-weight: 600; }
.qty-neg { color: var(--z-danger); font-weight: 600; }
.matrix-table input { min-width: 90px; }
.matrix-table td, .matrix-table th { white-space: nowrap; }
.section-title { font-size: 11px; font-weight: 600; margin: 0 0 10px; }
.sticky-actions {
  position: sticky; bottom: calc(var(--z-bottomnav-h) + 8px); z-index: 10;
  display: flex; gap: 8px; justify-content: flex-end; padding: 12px; margin-top: 16px;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px);
  border: 1px solid var(--z-border); border-radius: 16px; box-shadow: var(--z-shadow);
}
[data-theme="dark"] .sticky-actions { background: rgba(15, 33, 71, 0.92); }
@media (min-width: 992px) { .sticky-actions { bottom: 12px; } }
.barcode-svg { width: 100%; height: 100%; display: block; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1200px) { .pos { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; } .pos-side { position: sticky; top: calc(var(--z-topbar-h) + 12px); } }
.pos-cart { max-height: calc(100vh - 260px); overflow: auto; }
.pos-cart input { min-width: 70px; }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; font-size: 11px; }
.totals input { max-width: 120px; }
.totals .grand { font-size: 16.5px; font-weight: 700; color: var(--z-navy); border-top: 1px solid var(--z-border); margin-top: 6px; padding-top: 8px; }
[data-theme="dark"] .totals .grand { color: var(--z-text); }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-grid label { font-size: 10px; color: var(--z-muted); font-weight: 500; display: flex; flex-direction: column; gap: 4px; }
.pay-grid input { font-size: 12.5px; font-weight: 600; text-align: right; }
.pos-customer { padding: 12px; border-radius: 12px; background: var(--z-surface-2); border: 1px solid var(--z-border); }
.cust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cust-grid small { display: block; color: var(--z-subtle); font-size: 9.5px; }
.cust-grid strong { font-size: 11.5px; }
.pos-modal { position: fixed; inset: 0; z-index: 1100; background: rgba(6, 30, 65, 0.5); display: grid; place-items: center; padding: 16px; }
.pos-modal[hidden] { display: none; }
.pos-modal-card { width: 100%; max-width: 420px; box-shadow: var(--z-shadow); }
.credit-badge-Good { } 

.denoms { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.denom { display: flex; flex-direction: column; font-size: 9.5px; color: var(--z-muted); font-weight: 600; }
@media (max-width: 575.98px) { .denoms { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Notifications ---------- */
.bell-count { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--z-danger); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; }
.notif-panel { position: fixed; top: calc(var(--z-topbar-h) + 6px); right: 16px; width: min(380px, calc(100vw - 32px)); z-index: 1060; box-shadow: var(--z-shadow); max-height: 70vh; display: flex; flex-direction: column; }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--z-border); color: var(--z-text); font-size: 11px; }
.notif-item:hover { background: var(--z-surface-2); color: var(--z-text); }
.notif-item.unread { background: var(--z-primary-50); }
.notif-item .dot { margin-top: 6px; flex-shrink: 0; }
.notif-item small, .notif-item time { display: block; color: var(--z-muted); font-size: 10px; }

.trend { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.trend .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.trend .bar span { width: 100%; max-width: 28px; border-radius: 6px 6px 2px 2px; background: var(--z-btn-gradient); min-height: 2px; }
.trend .bar small { font-size: 9.5px; color: var(--z-subtle); }
.report-table td.num, .report-table th.num { text-align: right; white-space: nowrap; }

/* ---------- Phase 7: shell extras, dark mode, offline ---------- */
.app-footer { text-align: center; font-size: 9.5px; color: var(--z-subtle); padding: 10px 12px 14px; }
.offline-bar { display: flex; align-items: center; gap: 8px; padding: 6px 16px; font-size: 10px; background: var(--z-warning-50); color: var(--z-warning); border-bottom: 1px solid var(--z-border); }
.offline-bar[hidden] { display: none; }
.z-alert.warning { background: var(--z-warning-50); color: #78350f; border-color: rgba(217, 119, 6, 0.25); }
tr.row-danger td { background: var(--z-danger-50); }
.nav-pills-z { gap: 4px; flex-wrap: nowrap; overflow-x: auto; }
.nav-pills-z .nav-link { padding: 5px 12px; font-size: 10.5px; border-radius: var(--z-radius-sm); color: var(--z-muted); white-space: nowrap; }
.nav-pills-z .nav-link.active { background: var(--z-primary); color: #fff; }

[data-theme="dark"] .z-alert.success { color: #86efac; }
[data-theme="dark"] .z-alert.danger { color: #fca5a5; }
[data-theme="dark"] .z-alert.warning { color: #fcd34d; }
[data-theme="dark"] .z-alert.info { color: #9ad8fa; }
[data-theme="dark"] .z-badge { color: #9ad8fa; }
[data-theme="dark"] .z-badge.success { color: #86efac; }
[data-theme="dark"] .z-badge.warning { color: #fcd34d; }
[data-theme="dark"] .z-badge.danger { color: #fca5a5; }
[data-theme="dark"] .btn-outline-primary, [data-theme="dark"] .btn-secondary { --bs-btn-color: var(--z-text); --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; }
[data-theme="dark"] .btn-outline-secondary { --bs-btn-color: var(--z-muted); --bs-btn-border-color: var(--z-border-strong); }
[data-theme="dark"] .btn-ghost:hover { color: #9ad8fa; }
[data-theme="dark"] .text-success { color: #4ade80 !important; }
[data-theme="dark"] .text-danger { color: #f87171 !important; }
[data-theme="dark"] .text-warning { color: #fbbf24 !important; }
[data-theme="dark"] .bottom-nav { box-shadow: none; }
[data-theme="dark"] .sticky-actions { background: rgba(14, 29, 61, 0.94); }
[data-theme="dark"] .form-control::placeholder { color: var(--z-subtle); }
[data-theme="dark"] .totals .grand, [data-theme="dark"] .kpi-value { color: var(--z-text); }

/* Touch screens: keep 40px targets on phones and tablets */
@media (max-width: 991.98px) {
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .form-control, .form-select { min-height: 40px; font-size: 16px; }
  .form-control-sm { min-height: 34px; font-size: 14px; }
  .page-header h1 { font-size: 13.5px; }
}

/* Printed letterhead for page documents (purchase bill, PO, Z-report) */
.print-only { display: none !important; }
@media print {
  .print-only { display: block !important; }
  .print-head { display: flex !important; justify-content: space-between; gap: 10mm; padding-bottom: 3mm; margin-bottom: 4mm; border-bottom: 2px solid var(--z-primary); color: #111; font-size: 9.5pt; }
  .print-biz { font-size: 15pt; font-weight: 700; color: var(--z-navy); }
  .print-title { text-align: right; }
  .print-title > div { font-size: 12pt; font-weight: 700; letter-spacing: 0.06em; color: var(--z-primary); }
  .print-title table { margin-left: auto; font-size: 9pt; }
  .print-title th { font-weight: 500; color: #555; padding-right: 4mm; text-align: left; }
  .print-party { margin-bottom: 4mm; font-size: 10pt; }
  .print-party span { display: block; font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.08em; color: #666; }
  .print-sign { display: flex !important; gap: 12mm; margin-top: 22mm; }
  .print-sign > div { flex: 1; border-top: 1px solid #333; padding-top: 1mm; text-align: center; font-size: 8pt; color: #444; }
  .z-card { box-shadow: none !important; }
  body { background: #fff !important; }
  .content { padding: 0 !important; max-width: none !important; }
}

/* Sidebar: collapsible sections and a quiet scrollbar (visible only while hovering the menu) */
.nav-section:hover, .nav-section:focus-visible { color: rgba(207, 227, 245, 0.85); }
.nav-section svg { transition: transform var(--z-dur) var(--z-ease); opacity: 0.7; }
.nav-group.has-active .nav-section svg { opacity: 0.35; }
.sidebar-nav { scrollbar-gutter: stable; }
/* Edge/Chrome: custom 6 px bar without arrow buttons (standard scrollbar-* properties would bring Windows arrows back) */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(207, 227, 245, 0.12); border-radius: 3px; }
.sidebar-nav:hover::-webkit-scrollbar-thumb, .sidebar-nav:focus-within::-webkit-scrollbar-thumb { background: rgba(207, 227, 245, 0.26); }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(207, 227, 245, 0.4); }
/* Firefox */
@supports (-moz-appearance: none) {
  .sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(207, 227, 245, 0.12) transparent; }
  .sidebar-nav:hover, .sidebar-nav:focus-within { scrollbar-color: rgba(207, 227, 245, 0.22) transparent; }
}
@media (min-width: 992px) {
  /* Icon rail: show every item, no section headers */
  .sidebar-collapsed .nav-items { display: block !important; }
  .sidebar-collapsed .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
}

/* =====================================================================================================================
   Compact design (v3): 11 px base, 28 px controls, light shell, single accent #055a87.
   Follows Fluent "compact" / Polaris density: dense tables, hairline borders, no heavy shadows.
   ===================================================================================================================== */
:root { --z-ctl-h: 28px; --z-ctl-h-sm: 24px; --z-row-h: 30px; --z-topbar-h: 46px; --z-sidebar-w: 212px; }
body { font-size: 11px; letter-spacing: 0; }
h1, .h1 { font-size: 15px; font-weight: 600; }
h2, .h2 { font-size: 12.5px; font-weight: 600; }
.small, small { font-size: 10px; }
.text-muted { color: var(--z-subtle) !important; }

/* Controls */
.btn { min-height: var(--z-ctl-h); --bs-btn-padding-x: 10px; --bs-btn-padding-y: 3px; font-size: 11px; font-weight: 500; gap: 5px; border-radius: 5px; }
.btn-sm { min-height: var(--z-ctl-h-sm); --bs-btn-padding-x: 8px; --bs-btn-padding-y: 2px; font-size: 10.5px; }
.btn-xs { min-height: 22px; padding: 1px 7px; font-size: 10.5px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; }
.btn-icon { width: var(--z-ctl-h); }
.btn-primary { --bs-btn-bg: #055a87; --bs-btn-hover-bg: #044a6f; --bs-btn-active-bg: #033d5c; --bs-btn-disabled-bg: #055a87; background: #055a87; }
.btn-primary:hover { background: #044a6f; }
.btn-outline-primary { --bs-btn-color: #055a87; --bs-btn-border-color: #b9d3e2; --bs-btn-hover-bg: #e8f2f8; --bs-btn-hover-color: #055a87; --bs-btn-hover-border-color: #8fbcd6; }
.btn-outline-secondary { --bs-btn-color: var(--z-muted); --bs-btn-border-color: var(--z-border); --bs-btn-hover-bg: var(--z-surface-2); --bs-btn-hover-color: var(--z-text); --bs-btn-hover-border-color: var(--z-border-strong); background: var(--z-surface); }
[data-theme="dark"] .btn-outline-primary { --bs-btn-color: #8fd0f2; --bs-btn-border-color: rgba(143, 208, 242, 0.35); --bs-btn-hover-bg: rgba(79, 168, 216, 0.16); --bs-btn-hover-color: #cdeaf9; }
.form-control, .form-select { min-height: var(--z-ctl-h); padding: 3px 8px; font-size: 11px; border-radius: 5px; }
.form-select { padding-right: 24px; background-position: right 6px center; background-size: 12px 10px; }
.form-control-sm, .form-select-sm { min-height: var(--z-ctl-h-sm); padding: 1px 6px; font-size: 10.5px; }
.form-select-sm { padding-right: 22px; }
.form-control-lg, .lookup .form-control-lg { min-height: 34px; font-size: 12px; }
.form-label { font-size: 10px; margin-bottom: 2px; font-weight: 500; }
.form-check-input { width: 13px; height: 13px; margin-top: 2px; }
.form-switch .form-check-input { width: 24px; height: 13px; }
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 2px rgba(5, 90, 135, 0.18); border-color: #055a87; }
.input-icon > .form-control { padding-left: 28px; }
.input-icon > svg { left: 9px; width: 14px; height: 14px; }
.dropdown-menu { font-size: 11px; --bs-dropdown-item-padding-y: 4px; border-radius: 6px; }

/* Cards, tables, badges */
.z-card { border-radius: 8px; box-shadow: none; border-color: var(--z-border); }
.z-card-body { padding: 12px 14px; }
.z-card-header { padding: 8px 14px; min-height: 38px; }
.z-card-header h2 { font-size: 11.5px; font-weight: 600; }
.section-title { font-size: 11.5px; margin-bottom: 8px; }
.z-table th { font-size: 9.5px; padding: 6px 10px; letter-spacing: 0.04em; }
.z-table td { padding: 5px 10px; height: var(--z-row-h); font-size: 11px; }
.z-table tfoot td { font-weight: 600; background: var(--z-surface-2); border-top: 1px solid var(--z-border-strong); }
.z-badge { font-size: 9.5px; padding: 1px 6px; border-radius: 4px; }
.z-alert { font-size: 11px; padding: 7px 10px; border-radius: 6px; }
.z-tabs a { font-size: 10.5px; padding: 3px 10px; border-radius: 5px; }
.page-header { margin-bottom: 10px; }
.page-header h1 { font-size: 15px; }
.page-sub { font-size: 10.5px; color: var(--z-subtle); margin-top: 1px; }
.empty-state { padding: 22px 12px; font-size: 11px; }
.content { padding: 14px 18px; max-width: 1600px; }
.stat { padding: 8px 10px; }
.kpi-icon { width: 30px; height: 30px; border-radius: 7px; }

/* Shell: light sidebar + white top bar */
.sidebar { background: var(--z-side-bg); color: var(--z-side-text); border-right: 1px solid var(--z-side-border); }
.sidebar-brand { padding: 12px 16px 10px; min-height: var(--z-topbar-h); }
.sidebar-brand img { width: 150px; max-width: 100%; height: auto; display: block; }
.sidebar-brand a { flex: 1; min-width: 0; }
.sidebar-brand img.logo-for-dark { display: none; }
[data-theme="dark"] .sidebar-brand img.logo-for-light { display: none; }
[data-theme="dark"] .sidebar-brand img.logo-for-dark { display: block; }
.logo-for-dark { display: none; }
[data-theme="dark"] .logo-for-light { display: none; }
[data-theme="dark"] .logo-for-dark { display: inline; }
.sidebar .sidebar-close { color: var(--z-side-text) !important; }
.nav-section { color: var(--z-side-muted); font-size: 9.5px; padding: 9px 8px 3px; }
.nav-section:hover, .nav-section:focus-visible { color: var(--z-side-text); background: none; }
.nav-link-z { color: var(--z-side-text); font-size: 11.5px; padding: 5px 8px; border-radius: 5px; gap: 9px; position: relative; }
.nav-link-z svg { width: 15px; height: 15px; opacity: 0.8; }
.nav-link-z:hover { background: var(--z-side-hover); color: var(--z-side-active); }
.nav-link-z.active { background: var(--z-side-active-bg); color: var(--z-side-active); font-weight: 600; }
.nav-link-z.active svg { opacity: 1; }
.nav-link-z.active::before { content: ""; position: absolute; left: -10px; top: 5px; bottom: 5px; width: 3px; border-radius: 0 3px 3px 0; background: var(--z-side-active); }
.sidebar-collapse { background: var(--z-side-hover); color: var(--z-side-muted); height: 28px; }
.sidebar-collapse:hover { background: var(--z-side-active-bg); color: var(--z-side-active); }
.sidebar-footer { color: var(--z-side-muted); border-top-color: var(--z-side-border); font-size: 9.5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.18); }
.sidebar-nav:hover::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.38); }
[data-theme="dark"] .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(207, 227, 245, 0.12); }
[data-theme="dark"] .sidebar-nav:hover::-webkit-scrollbar-thumb { background: rgba(207, 227, 245, 0.26); }
.topbar { height: var(--z-topbar-h); background: var(--z-surface); backdrop-filter: none; }
[data-theme="dark"] .topbar { background: var(--z-surface); }
.topbar-title { font-size: 12.5px; }
.topbar .search .form-control { min-height: 28px; background: var(--z-bg); border-color: transparent; }
.avatar { width: 26px; height: 26px; font-size: 10px; }
.bottom-nav a, .bottom-nav button { font-size: 9.5px; }

/* KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpi-grid-sm { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi-card { display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; background: var(--z-surface); border: 1px solid var(--z-border); border-radius: 8px; color: var(--z-text); text-decoration: none; min-width: 0; }
a.kpi-card:hover { border-color: #8fbcd6; color: var(--z-text); }
.kpi-card .kpi-label { font-size: 10px; color: var(--z-subtle); font-weight: 500; }
.kpi-card .kpi-value { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-card .kpi-note { font-size: 9.5px; color: var(--z-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-card.is-warn .kpi-value { color: var(--z-warning); }
.kpi-label { font-size: 10px; }
.kpi-value { font-size: 16px; }
.kpi-note { font-size: 9.5px; }

/* Dashboard grid */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.dash-grid > * { grid-column: span 12; min-width: 0; }
@media (min-width: 992px) { .dash-grid .span-4 { grid-column: span 4; } .dash-grid .span-8 { grid-column: span 8; } .dash-grid .span-12 { grid-column: span 12; } }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.quick-action { padding: 7px 9px; gap: 8px; font-size: 11px; border-radius: 6px; }
.quick-action .kpi-icon { width: 24px; height: 24px; border-radius: 5px; }
.checklist li { padding: 6px 0; font-size: 11px; gap: 8px; }
.check-icon { width: 18px; height: 18px; }

/* Charts */
.zc { position: relative; min-height: 120px; }
.zc-svg { display: block; width: 100%; height: auto; overflow: visible; }
.zc-grid { stroke: var(--z-border); stroke-width: 1; }
.zc-axis { fill: var(--z-subtle); font-size: 9.5px; font-family: var(--z-font); }
.zc-center { fill: var(--z-text); font-size: 14px; font-weight: 600; font-family: var(--z-font); }
.zc-guide { stroke: var(--z-border-strong); stroke-dasharray: 3 3; }
.zc-bar { transition: opacity var(--z-dur); }
.zc-bar:hover, .zc-slice:hover { opacity: 0.82; }
.zc-dot { pointer-events: none; }
.zc-empty { display: grid; place-items: center; min-height: 140px; color: var(--z-subtle); font-size: 11px; }
.zc-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 10px; color: var(--z-muted); }
.zc-legend i, .zc-tip i, .zc-dlist i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: -0.5px; }
.zc-tip { position: fixed; z-index: 2000; pointer-events: none; background: #0f1d33; color: #fff; padding: 6px 8px; border-radius: 6px; font-size: 10.5px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); min-width: 120px; }
.zc-tip[hidden] { display: none; }
.zc-tip b { display: block; margin-bottom: 3px; font-weight: 600; }
.zc-tip div { display: flex; align-items: center; gap: 4px; }
.zc-tip span { margin-left: auto; padding-left: 10px; font-variant-numeric: tabular-nums; }
.zc-hbars { display: grid; gap: 5px; }
.zc-hrow { display: grid; grid-template-columns: minmax(70px, 38%) 1fr auto; align-items: center; gap: 8px; font-size: 10.5px; }
.zc-hl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--z-text); }
.zc-ht { height: 8px; background: var(--z-surface-2); border-radius: 4px; overflow: hidden; }
.zc-ht i { display: block; height: 100%; border-radius: 4px; }
.zc-hv { font-variant-numeric: tabular-nums; color: var(--z-muted); min-width: 42px; text-align: right; }
.zc-donut { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.zc-donut svg { flex-shrink: 0; max-width: 150px; height: auto; }
.zc-dlist { display: grid; gap: 4px; flex: 1; min-width: 120px; font-size: 10.5px; }
.zc-dlist div { display: flex; align-items: center; gap: 2px; }
.zc-dl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--z-muted); }
.zc-dlist b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Segmented control (period presets, view tabs) */
.seg { display: inline-flex; background: var(--z-surface-2); border: 1px solid var(--z-border); border-radius: 6px; padding: 2px; gap: 1px; flex-wrap: wrap; }
.seg a { padding: 2px 9px; min-height: 22px; font-size: 10.5px; color: var(--z-muted); border-radius: 4px; display: inline-flex; align-items: center; text-decoration: none; }
.seg a.active { background: var(--z-surface); color: var(--z-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }
.seg button { border: 0; background: none; padding: 2px 9px; min-height: 22px; font-size: 10.5px; color: var(--z-muted); border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; }
.seg button:hover { color: var(--z-text); }
.seg button.active { background: var(--z-surface); color: #055a87; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }
[data-theme="dark"] .seg button.active { color: #8fd0f2; }

/* Reports */
.report-layout { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 992px) { .report-layout { grid-template-columns: 170px minmax(0, 1fr); } }
.report-nav nav a { display: block; padding: 4px 8px; border-radius: 5px; color: var(--z-muted); font-size: 11px; }
.report-nav nav a:hover { background: var(--z-surface-2); color: var(--z-text); }
.report-nav nav a.active { background: var(--z-side-active-bg); color: var(--z-side-active); font-weight: 600; }
.report-nav-group { font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--z-subtle); padding: 8px 8px 3px; }
.saved-views { display: grid; gap: 2px; padding: 0 4px; }
.saved-view { display: flex; align-items: center; gap: 4px; }
.saved-view a { flex: 1; font-size: 10.5px; padding: 3px 4px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-view a:hover { background: var(--z-surface-2); }
.saved-view button { border: 0; background: none; color: var(--z-subtle); font-size: 10px; }
.report-filters { padding: 8px 10px; margin-bottom: 10px; display: grid; gap: 6px; }
.report-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.report-conditions { display: grid; gap: 4px; }
.report-conditions:empty { display: none; }
.cond-row { display: grid; grid-template-columns: minmax(110px, 180px) minmax(90px, 130px) minmax(90px, 1fr) minmax(70px, 120px) auto; gap: 4px; align-items: center; }
.cond-row [hidden] { display: none !important; }
@media (max-width: 575.98px) { .cond-row { grid-template-columns: 1fr 1fr; } }
.report-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.report-title { font-size: 14px; margin: 0; }
.report-table td.num, .report-table th.num { font-variant-numeric: tabular-nums; }
@media print { .report-layout { display: block; } .zc-tip { display: none; } }

/* Mobile keeps comfortable touch targets */
@media (max-width: 991.98px) {
  :root { --z-ctl-h: 34px; --z-ctl-h-sm: 30px; }
  .form-control, .form-select { font-size: 16px; }
  .form-control-sm, .form-select-sm { font-size: 14px; }
}

/* Toasts (all app messages) */
.toast-stack { position: fixed; top: calc(var(--z-topbar-h) + 8px); right: 12px; z-index: 2100; display: grid; gap: 6px; width: min(340px, calc(100vw - 24px)); pointer-events: none; }
.ztoast { pointer-events: auto; position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px 10px; border-radius: 7px;
  background: var(--z-surface); color: var(--z-text); border: 1px solid var(--z-border); border-left: 3px solid var(--z-info);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14); font-size: 11px; line-height: 1.4; animation: ztoast-in 180ms var(--z-ease); }
.ztoast.out { animation: ztoast-out 180ms var(--z-ease) forwards; }
.ztoast svg { flex-shrink: 0; margin-top: 1px; }
.ztoast.success { border-left-color: var(--z-success); } .ztoast.success svg { color: var(--z-success); }
.ztoast.danger { border-left-color: var(--z-danger); } .ztoast.danger svg { color: var(--z-danger); }
.ztoast.warning { border-left-color: var(--z-warning); } .ztoast.warning svg { color: var(--z-warning); }
.ztoast.info { border-left-color: #055a87; } .ztoast.info svg { color: #055a87; }
.ztoast-body { flex: 1; min-width: 0; display: grid; gap: 1px; word-break: break-word; }
.ztoast-body strong { font-weight: 600; }
.ztoast-action { font-weight: 600; font-size: 10.5px; margin-top: 2px; justify-self: start; }
.ztoast-close { border: 0; background: none; color: var(--z-subtle); font-size: 10px; padding: 0 2px; line-height: 1; }
.ztoast-close:hover { color: var(--z-text); }
.ztoast-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: currentColor; opacity: 0.18; transform-origin: left; animation: ztoast-bar linear forwards; animation-play-state: paused; }
.ztoast.success .ztoast-bar { color: var(--z-success); } .ztoast.danger .ztoast-bar { color: var(--z-danger); }
.ztoast.warning .ztoast-bar { color: var(--z-warning); } .ztoast.info .ztoast-bar { color: #055a87; }
@keyframes ztoast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes ztoast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes ztoast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 991.98px) { .toast-stack { top: auto; bottom: calc(var(--z-bottomnav-h) + 10px + env(safe-area-inset-bottom)); left: 12px; right: 12px; width: auto; } }
@media print { .toast-stack { display: none; } }

/* Sign-in pages (compact theme, light + dark) */
.auth-body { background: var(--z-bg); min-height: 100vh; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: minmax(340px, 38%) 1fr; } }
.auth-side { display: none; flex-direction: column; justify-content: space-between; gap: 24px; padding: 36px 40px; color: #e3f1f9;
  background: radial-gradient(circle at 85% 12%, rgba(122, 252, 255, 0.14), transparent 40%), linear-gradient(160deg, #055a87 0%, #04466a 55%, #061e41 100%); }
@media (min-width: 992px) { .auth-side { display: flex; } }
.auth-side-logo { width: 190px; max-width: 100%; height: auto; align-self: flex-start; }
.auth-side h2 { color: #fff; font-size: 20px; font-weight: 600; line-height: 1.3; max-width: 22ch; margin: 0 0 18px; letter-spacing: -0.01em; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 12px; color: rgba(227, 241, 249, 0.88); }
.auth-points li { display: flex; align-items: center; gap: 9px; }
.auth-points svg { color: #7afcff; flex-shrink: 0; }
.auth-side-foot { font-size: 10.5px; color: rgba(227, 241, 249, 0.55); }
.auth-main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px 16px 20px; }
.auth-theme { position: absolute; top: 12px; right: 12px; }
.auth-card { width: 100%; max-width: 340px; background: var(--z-surface); border: 1px solid var(--z-border); border-radius: 10px; padding: 24px 24px 20px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06); }
.auth-logo { margin-bottom: 18px; }
.auth-logo img { width: 170px; max-width: 100%; height: auto; }
.auth-card .logo { display: none; }
.auth-title { font-size: 16px; font-weight: 600; margin: 0; }
.auth-sub { font-size: 11px; color: var(--z-subtle); margin: 2px 0 16px; }
.auth-form { display: grid; gap: 11px; }
.auth-form .form-control { min-height: 32px; }
.auth-form .form-check-label { font-size: 10.5px; color: var(--z-muted); }
.auth-submit { min-height: 34px; margin-top: 2px; }
.auth-code { text-align: center; letter-spacing: 0.4em; font-size: 15px; font-variant-numeric: tabular-nums; }
.auth-link { border: 0; background: none; padding: 0; font-size: 10.5px; color: #055a87; font-weight: 500; }
.auth-link:hover { text-decoration: underline; color: #044a6f; }
[data-theme="dark"] .auth-link { color: #8fd0f2; }
.auth-alt { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.auth-alt form { margin: 0; }
.auth-help { font-size: 10px; color: var(--z-subtle); margin: 14px 0 0; text-align: center; }
.auth-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 10.5px; color: var(--z-subtle); }
.auth-footer a { color: var(--z-subtle); }
.auth-footer a:hover { color: #055a87; }
[data-theme="dark"] .auth-card { box-shadow: none; }
@media (max-width: 991.98px) { .auth-main { justify-content: flex-start; padding-top: 56px; } }

@media (min-width: 992px) {
  /* Icon rail: show just the Z mark (left part of the logo) */
  .sidebar-collapsed .sidebar-brand { padding: 12px 0 8px; }
  .sidebar-collapsed .sidebar-brand a { flex: 0 0 auto; }
  .sidebar-collapsed .sidebar-brand img { width: 34px; height: 34px; max-width: none; object-fit: cover; object-position: left center; }
}

/* Workspace panel: page content sits in one rounded card on the grey app background (tablet/desktop) */
@media (min-width: 768px) {
  .content { width: calc(100% - 28px); max-width: 1640px; margin: 12px auto 0; padding: 18px 22px;
    background: var(--z-surface); border: 1px solid var(--z-border); border-radius: 12px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05); }
  .content .z-card, .content .kpi-card { box-shadow: none; }
  [data-theme="dark"] .content { box-shadow: none; }
  [data-theme="dark"] .content .z-card, [data-theme="dark"] .content .kpi-card { background: var(--z-surface-2); }
  .app-footer { padding-top: 10px; }
}
@media print { .content { border: 0 !important; box-shadow: none !important; margin: 0 !important; width: auto !important; border-radius: 0 !important; } }

/* =====================================================================================================================
   Print (all app pages): A4, no browser header/footer (page margin 0), our own margins on every page via repeating
   spacers, letterhead with logo + business name, fixed branded footer, compact tables.
   ===================================================================================================================== */
.print-spacer-top, .print-spacer-bottom, .print-foot { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  body { font-size: 8.5pt; color: #111 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .main { display: table !important; width: 100%; table-layout: fixed; }
  .print-spacer-top { display: table-header-group !important; }
  .print-spacer-top::after { content: ""; display: block; height: 11mm; }
  .print-spacer-bottom { display: table-footer-group !important; }
  .print-spacer-bottom::after { content: ""; display: block; height: 16mm; }
  .content { display: table-row-group !important; }
  main.content > * { margin-left: 13mm !important; margin-right: 13mm !important; }
  .app-footer, .offline-bar, .page-header, .report-nav, .report-filters, .seg, .btn, .z-tabs, [data-view-tabs] { display: none !important; }

  .print-head { display: flex !important; align-items: flex-start; justify-content: space-between; gap: 10mm; padding-bottom: 3mm; margin-bottom: 4mm;
    border-bottom: 1.5px solid #055a87; font-size: 8pt; color: #4a5a70; }
  .print-brand { display: flex; gap: 3mm; align-items: center; }
  .print-logo { width: 11mm; height: 11mm; object-fit: contain; }
  .print-biz { font-size: 13pt; font-weight: 700; color: #061e41; line-height: 1.2; }
  .print-title { text-align: right; }
  .print-title > div:first-child { font-size: 11pt; font-weight: 700; letter-spacing: 0.04em; color: #055a87; }
  .print-title > .print-subtitle { font-size: 8pt; font-weight: 400; letter-spacing: 0; color: #4a5a70; margin-top: 0.5mm; }
  form[role="search"], .filter-bar, .z-card-header.filter-bar, .pagination-z, .input-icon { display: none !important; }
  code { color: inherit !important; font-size: 7.5pt; }
  .print-title table { margin-left: auto; margin-top: 1mm; font-size: 8pt; }
  .print-title th { font-weight: 500; color: #6b7a90; padding-right: 3mm; text-align: left; }
  .print-title td { color: #111; font-weight: 600; text-align: right; }

  .print-foot { display: flex !important; position: fixed; left: 13mm; right: 13mm; bottom: 6mm; justify-content: space-between;
    padding-top: 2mm; border-top: 0.5px solid #d6dde6; font-size: 7pt; color: #6b7a90; }
  .print-foot-brand { color: #055a87; font-weight: 600; }

  .z-card { border: 1px solid #dfe5ec !important; border-radius: 4px !important; background: #fff !important; box-shadow: none !important; break-inside: avoid; }
  .z-card-header { padding: 2mm 3mm !important; min-height: 0 !important; }
  .z-card-header h2 { font-size: 9pt !important; }
  .z-card-body { padding: 3mm !important; }
  .z-table { font-size: 8pt; }
  .z-table th { background: #061e41 !important; color: #fff !important; font-size: 7pt !important; padding: 1.6mm 2mm !important; border: 0 !important; }
  .z-table td { padding: 1.3mm 2mm !important; height: auto !important; font-size: 8pt !important; border-bottom: 0.5px solid #e3e8ef !important; }
  .z-table tbody tr:nth-child(even) td { background: #f6f8fb !important; }
  .z-table tfoot td, .z-table tr.fw-bold td { background: #eef3f8 !important; border-top: 1px solid #061e41 !important; font-weight: 700; }
  .z-table thead { display: table-header-group; }
  .z-table tr { break-inside: avoid; }
  .kpi-grid { gap: 2mm !important; grid-template-columns: repeat(4, 1fr) !important; margin-bottom: 3mm !important; }
  .kpi-card { padding: 2mm 3mm !important; border: 1px solid #dfe5ec !important; border-radius: 4px !important; }
  .kpi-card .kpi-label { font-size: 7pt !important; } .kpi-card .kpi-value { font-size: 11pt !important; }
  .report-head { margin-bottom: 2mm !important; } .report-head h2, .report-head .page-sub { display: none; }
  .report-view[data-view-panel="chart"] .z-card-header { display: none; }
  .report-view[data-view-panel="chart"] .zc { max-height: 70mm; overflow: hidden; }
  .report-view + .report-view { margin-top: 4mm; }
  .z-badge { border: 0.5px solid currentColor; }
  a { color: inherit !important; text-decoration: none !important; }
}

/* Print always uses the full table layout (never the phone "stacked cards"), whatever the paper width or scale.
   Reports print what you're looking at: Graphical view = chart + table, Table view = table only. */
@media print {
  .z-table { display: table !important; width: 100% !important; }
  .z-table thead { display: table-header-group !important; }
  .z-table tbody { display: table-row-group !important; }
  .z-table tfoot { display: table-footer-group !important; }
  .z-table tr { display: table-row !important; padding: 0 !important; }
  .z-table th, .z-table td { display: table-cell !important; width: auto !important; }
  .z-table td::before { content: none !important; display: none !important; }
  .z-table td.cell-primary { font-size: 8pt !important; }
  .table-responsive { overflow: visible !important; }
  .report-view[data-view-panel="table"][hidden] { display: block !important; }
  .report-view[data-view-panel="chart"][hidden] { display: none !important; }
  .report-view[data-view-panel="chart"]:has(.zc-empty) { display: none !important; }
  .kpi-grid { display: grid !important; }
}

/* Top-bar branch switcher (owners) and branch chip (branch staff) */
.branch-switch .form-select { min-height: 28px; height: 28px; padding-top: 0; padding-bottom: 0; max-width: 190px; background-color: var(--z-bg); border-color: var(--z-border); }
.branch-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--z-primary-50, var(--z-bg)); color: var(--z-primary); font-weight: 600; white-space: nowrap; }
@media (max-width: 575.98px) { .branch-switch .form-select { max-width: 120px; } .branch-chip { max-width: 120px; overflow: hidden; text-overflow: ellipsis; } }

/* Product picture thumbnails */
.product-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--z-border); background: var(--z-bg); flex: none; }

/* Camera barcode scanning (phones) */
.lookup { position: relative; }
.has-camera { flex: 1; }
.lookup:has(.camera-scan-btn) { display: flex; flex-wrap: wrap; gap: 6px; }
.lookup:has(.camera-scan-btn) > .lookup-results { flex-basis: 100%; }
.camera-scan-btn { flex: none; display: inline-grid; place-items: center; padding: 0 12px; }
@media (hover: hover) and (pointer: fine) { .camera-scan-btn { display: none; } }
.camera-scan { position: fixed; inset: 0; z-index: 2000; background: #000; display: grid; place-items: center; }
.camera-scan[hidden] { display: none; }
.camera-scan video { width: 100%; height: 100%; object-fit: cover; }
.camera-scan-frame { position: absolute; width: min(80vw, 420px); height: 160px; border: 3px solid var(--z-primary-400); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); }
.camera-scan-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; color: #fff; background: rgba(0, 0, 0, .55); }
