/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', 'Google Sans', Arial, sans-serif; font-size: 14px;
  background: #F9FAFB; color: #202124; min-height: 100vh; margin: 0; }

/* ── Navbar ── */
.navbar {
  background: #1a73e8; color: #fff;
  padding: 0 20px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.navbar-brand { font-size: 18px; font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.navbar-user  { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.navbar-name  { opacity: .9; }
.role-badge {
  padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.role-admin   { background: rgba(255,255,255,.25); }
.role-cashier    { background: rgba(52,168,83,.4); }
.role-manager { background: rgba(251,188,4,.4); }
.btn-logout {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 5px 14px; border-radius: 6px; font-size: 12px;
  cursor: pointer; transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }

/* ── Page layout ── */
#app    { display: none; }
#login  { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #1a73e8; }
.content { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.section { display: none; }
.section.active { display: block; }

/* ── Login box ── */
.login-box {
  background: #fff; border-radius: 16px; padding: 40px 36px;
  width: 100%; max-width: 400px; box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .icon { font-size: 48px; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: #1a73e8; }
.login-logo p  { font-size: 13px; color: #5f6368; margin-top: 4px; }

/* ── Page header ── */
.page-header { margin-bottom: 20px; margin-top: 4px; }
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-header p  { font-size: 13px; color: #5f6368; margin-top: 3px; }
.breadcrumb { font-size: 12px; color: #9aa0a6; margin-bottom: 6px; cursor: pointer; }
.breadcrumb:hover { color: #1a73e8; }

/* ── Cards grid ── */
.cards-grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media(max-width:600px) { .g2,.g3,.g4 { grid-template-columns: 1fr 1fr; } }
@media(max-width:420px) { .g3,.g4 { grid-template-columns: 1fr; } }

/* ── Stat card ── */
.stat-card {
  background: #fff; border-radius: 12px; padding: 18px;
  border: 1px solid #e0e0e0; text-align: center;
}
.stat-card .s-icon  { font-size: 28px; margin-bottom: 6px; }
.stat-card .s-value { font-size: 26px; font-weight: 700; margin-bottom: 2px; }
.stat-card .s-label { font-size: 11px; color: #5f6368; text-transform: uppercase; letter-spacing: .5px; }
.stat-card.blue   { border-top: 3px solid #1a73e8; }
.stat-card.green  { border-top: 3px solid #34a853; }
.stat-card.red    { border-top: 3px solid #ea4335; }
.stat-card.yellow { border-top: 3px solid #fbbc04; }
.stat-card.orange { border-top: 3px solid #fa7b17; }
.stat-card.blue .s-value   { color: #1a73e8; }
.stat-card.green .s-value  { color: #137333; }
.stat-card.red .s-value    { color: #c5221f; }
.stat-card.yellow .s-value { color: #b45309; }
.stat-card.orange .s-value { color: #e06000; }

/* ── Quick action cards ── */
.action-card {
  background: #fff; border-radius: 12px; padding: 20px 16px;
  border: 1px solid #e0e0e0; text-align: center;
  cursor: pointer; transition: all .15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.action-card:hover { border-color: #1a73e8; box-shadow: 0 4px 12px rgba(26,115,232,.15); transform: translateY(-2px); }
.action-card .a-icon  { font-size: 30px; }
.action-card .a-title { font-size: 13px; font-weight: 700; color: #202124; }
.action-card .a-desc  { font-size: 11px; color: #9aa0a6; }

/* ── Panel ── */
.panel {
  background: #fff; border-radius: 12px; padding: 24px;
  border: 1px solid #e0e0e0; margin-bottom: 16px;
}
.panel-title {
  font-size: 15px; font-weight: 700; margin-bottom: 18px;
  padding-bottom: 12px; border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; gap: 8px;
}

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width:500px) { .form-row { grid-template-columns: 1fr; } }
.form-label {
  display: block; font-size: 11px; font-weight: 700;
  color: #5f6368; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px;
}
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid #dadce0; border-radius: 8px;
  font-size: 13px; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  outline: none; border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
.form-hint { font-size: 11px; color: #9aa0a6; margin-top: 3px; }

/* ── Info cards ── */
.info-card {
  background: #e8f0fe; border: 1px solid #c5d5f5;
  border-radius: 8px; padding: 12px 14px;
  font-size: 12px; margin: 8px 0; display: none;
}
.info-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
.info-row:last-child { margin-bottom: 0; }
.info-label { color: #5f6368; }
.info-value { font-weight: 700; color: #1a73e8; }
.info-value.warn { color: #e37400; }
.info-value.danger { color: #c5221f; }

/* ── Cart ── */
.cart-box { background: #fff; border: 1px solid #dadce0; border-radius: 10px; overflow: hidden; margin: 12px 0; }
.cart-head { background: #1a73e8; color: #fff; padding: 9px 14px; font-size: 12px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; }
.cart-head .badge-ct { background: rgba(255,255,255,.25); border-radius: 10px; padding: 1px 9px; font-size: 11px; }
.cart-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cart-table th { background: #f8f9fa; color: #5f6368; font-size: 10px; font-weight: 700;
  text-transform: uppercase; padding: 7px 10px; text-align: left; border-bottom: 1px solid #e0e0e0; }
.cart-table th.r { text-align: right; }
.cart-table td { padding: 8px 10px; border-bottom: 1px solid #f5f5f5; }
.cart-table tr:last-child td { border-bottom: none; }
.cart-table .r { text-align: right; }
.cart-foot { padding: 10px 14px; border-top: 2px solid #e0e0e0; background: #f8f9fa; }
.cart-total-row { display: flex; justify-content: space-between; align-items: center; }
.cart-total-label { font-size: 13px; color: #5f6368; font-weight: 600; }
.cart-total-amt { font-size: 22px; font-weight: 800; color: #137333; }
.credit-after { font-size: 11px; color: #5f6368; display: flex; justify-content: space-between; margin-top: 4px; }
.credit-after.over { color: #c5221f; font-weight: 700; }
.btn-remove { background: none; border: none; color: #c5221f; font-size: 18px; cursor: pointer; padding: 0 3px; }
.add-item-row { display: grid; grid-template-columns: 1fr 80px 40px; gap: 8px; align-items: end; margin-bottom: 8px; }
.btn-add-item {
  height: 38px; background: #1a73e8; color: #fff; border: none;
  border-radius: 8px; font-size: 22px; cursor: pointer; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-add-item:hover { opacity: .85; }
.product-strip { background: #f1f3f4; border-radius: 6px; padding: 6px 10px;
  font-size: 11px; color: #5f6368; margin-bottom: 6px; display: none; }
.product-strip span { font-weight: 600; color: #202124; }
.empty-cart { text-align: center; padding: 20px; color: #9aa0a6; font-size: 12px; }

/* ── Preset date buttons ── */
.preset-group { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; margin-bottom: 10px; }
@media(max-width:500px) { .preset-group { grid-template-columns: 1fr 1fr; } }
.preset-btn {
  padding: 7px 4px; border: 1px solid #dadce0; border-radius: 6px;
  background: #fff; font-size: 11px; font-weight: 600; color: #5f6368;
  cursor: pointer; text-align: center; transition: all .15s;
}
.preset-btn:hover  { border-color: #1a73e8; color: #1a73e8; background: #e8f0fe; }
.preset-btn.active { background: #1a73e8; color: #fff; border-color: #1a73e8; }

/* ── Buttons ── */
.btn {
  padding: 10px 20px; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: opacity .15s; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
}
.btn-block { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:active   { opacity: .8; }
.btn-primary  { background: #1a73e8; color: #fff; }
.btn-success  { background: #34a853; color: #fff; }
.btn-danger   { background: #ea4335; color: #fff; }
.btn-warning  { background: #fbbc04; color: #202124; }
.btn-light    { background: #f1f3f4; color: #3c4043; }

/* ── Alerts ── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; display: none; margin: 10px 0; line-height: 1.5; }
.alert-success { background: #e6f4ea; color: #137333; border: 1px solid #81c995; }
.alert-error   { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6c2; }
.alert-info    { background: #e8f0fe; color: #1558b0; border: 1px solid #aecbfa; }
.spinner-msg   { text-align: center; padding: 12px; color: #5f6368; font-size: 13px; display: none; }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: #f8f9fa; color: #5f6368; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px;
  text-align: left; border-bottom: 2px solid #e0e0e0; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid #f0f0f0; }
.data-table tr:hover td { background: rgba(26,115,232,.03); }
.data-table .r { text-align: right; }
.table-wrap { overflow-x: auto; }

/* ── Status badges ── */
.badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.badge-active     { background: #e6f4ea; color: #137333; }
.badge-delinquent { background: #fce8e6; color: #c5221f; }
.badge-suspended  { background: #fff3e0; color: #e06000; }

/* ── Report tables ── */
.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th { background: #1a73e8; color: #fff; padding: 8px 10px;
  font-size: 10px; font-weight: 700; text-align: left; text-transform: uppercase; }
.report-table th.r { text-align: right; }
.report-table td { padding: 6px 10px; border-bottom: 1px solid #f0f0f0; }
.report-table tr:hover td { background: rgba(26,115,232,.03); }
.report-table .r { text-align: right; }
.report-table .subtotal td { background: #f8f9fa; font-weight: 700; border-top: 1px solid #e0e0e0; }

/* ── Totals footer ── */
.totals-footer { border-radius: 10px; overflow: hidden; border: 1px solid #dadce0; margin-top: 14px; }
.total-line { display: flex; justify-content: space-between; padding: 9px 14px;
  font-size: 13px; font-weight: 600; background: #f8f9fa; }
.total-line.discount { background: #fff8e1; color: #b45309; font-size: 12px; }
.total-line.billed { background: #1a73e8; color: #fff; font-size: 16px; font-weight: 700; padding: 12px 14px; }

/* ── Tabs ── */
.tab-bar { display: flex; gap: 4px; border-bottom: 2px solid #e0e0e0; margin-bottom: 14px; }
.tab-btn-b { padding: 8px 16px; border: none; background: none; font-size: 13px;
  font-weight: 600; color: #5f6368; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab-btn-b:hover { color: #1a73e8; }
.tab-btn-b.on { color: #1a73e8; border-bottom-color: #1a73e8; }
.tab-pane { display: none; }
.tab-pane.on { display: block; }

/* ── Ledger statement ── */
.stmt-header { background: #1a73e8; color: #fff; padding: 14px 18px; border-radius: 10px 10px 0 0; }
.stmt-header h3 { font-size: 15px; font-weight: 700; }
.stmt-meta { font-size: 12px; opacity: .8; margin-top: 3px; }
.stmt-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: #e0e0e0; }
.stmt-sum-box { background: #fff; padding: 12px 14px; text-align: center; }
.stmt-sum-label { font-size: 10px; color: #5f6368; text-transform: uppercase; letter-spacing: .5px; }
.stmt-sum-value { font-size: 16px; font-weight: 700; margin-top: 2px; }

/* ── Search ── */
.search-bar { position: relative; margin-bottom: 14px; }
.search-bar input { padding-left: 36px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #9aa0a6; font-size: 16px; pointer-events: none; }

/* ── Monthly reset ── */
.reset-card { border: 2px solid #fbbc04; border-radius: 12px; padding: 24px; background: #fffde7; text-align: center; }
.reset-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.reset-card p  { color: #5f6368; font-size: 13px; line-height: 1.7; margin-bottom: 16px; }
.reset-rules { text-align: left; background: #fff; border-radius: 8px; padding: 14px 18px;
  font-size: 13px; line-height: 2; margin-bottom: 16px; border: 1px solid #fce29f; }

/* ── Change password ── */
.cp-card { max-width: 400px; }

/* ── Workflow guide ── */
.workflow-panel {
  background: #fff; border-radius: 12px; border: 1px solid #e0e0e0;
  margin-bottom: 20px; overflow: hidden;
}
.workflow-toggle {
  width: 100%; padding: 14px 20px; background: none; border: none;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; font-size: 14px; font-weight: 700; color: #202124;
  transition: background .15s;
}
.workflow-toggle:hover { background: #f8f9fa; }
.workflow-toggle .wt-left { display: flex; align-items: center; gap: 8px; }
.workflow-toggle .wt-arrow { font-size: 12px; color: #9aa0a6; transition: transform .2s; }
.workflow-toggle.open .wt-arrow { transform: rotate(180deg); }
.workflow-body { display: none; padding: 0 20px 20px; }
.workflow-body.open { display: block; }

.wf-steps {
  display: flex; align-items: flex-start;
  gap: 0; overflow-x: auto; padding: 4px 0 8px;
}
.wf-step {
  display: flex; flex-direction: column; align-items: center;
  min-width: 110px; flex: 1; position: relative;
}
.wf-step-inner {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 0 6px; width: 100%;
}
.wf-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 8px; position: relative; z-index: 1;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.wf-num {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #202124; color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.wf-title { font-size: 12px; font-weight: 700; color: #202124; margin-bottom: 3px; }
.wf-desc  { font-size: 10px; color: #9aa0a6; line-height: 1.4; }

.wf-arrow-wrap {
  display: flex; align-items: center; padding-top: 26px;
  flex-shrink: 0; padding: 0 2px; margin-top: 26px;
}
.wf-arrow-line {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.wf-arrow-icon { font-size: 16px; color: #dadce0; }
.wf-arrow-label { font-size: 9px; color: #9aa0a6; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }

.wf-branch {
  background: #f8f9fa; border-radius: 10px; padding: 12px 16px;
  margin-top: 14px; border: 1px solid #e0e0e0;
}
.wf-branch-title { font-size: 11px; font-weight: 700; color: #5f6368;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.wf-branch-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wf-branch-card {
  border-radius: 8px; padding: 10px 12px;
  display: flex; align-items: flex-start; gap: 8px;
}
.wf-branch-card.yes { background: #e6f4ea; border: 1px solid #81c995; }
.wf-branch-card.no  { background: #fce8e6; border: 1px solid #f5c6c2; }
.wf-branch-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.wf-branch-label { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.wf-branch-card.yes .wf-branch-label { color: #137333; }
.wf-branch-card.no  .wf-branch-label { color: #c5221f; }
.wf-branch-text { font-size: 11px; color: #5f6368; line-height: 1.5; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid #e0e0e0; margin: 16px 0; }
.section-title { font-size: 13px; font-weight: 700; color: #5f6368; text-transform: uppercase;
  letter-spacing: .8px; margin-bottom: 12px; }

/* ============================================
   SIDEBAR LAYOUT - ERP-style navigation
============================================ */

/* Remove old navbar styles impact */
.navbar { display: none !important; }

/* App shell */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: #F9FAFB;
}

/* ── Sidebar ── */
.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: #fff;
  border-right: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width .22s cubic-bezier(.4,0,.2,1),
              min-width .22s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.sidebar.collapsed { width: 72px; min-width: 72px; }

/* Brand */
.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px; border-bottom: 1px solid #F3F4F6;
  min-height: 68px; flex-shrink: 0;
}
.sb-logo {
  width: 36px; height: 36px; min-width: 36px;
  background: #2563EB; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.sb-brand-text { overflow: hidden; transition: opacity .18s, width .22s; white-space: nowrap; }
.sidebar.collapsed .sb-brand-text { opacity: 0; width: 0; }
.sb-brand-name { font-size: 13.5px; font-weight: 700; color: #111827; }
.sb-brand-sub  { font-size: 11px; color: #6B7280; margin-top: 1px; }

/* Toggle button */
.sb-toggle {
  position: absolute; right: -11px; top: 64px;
  width: 22px; height: 22px;
  background: #fff; border: 1px solid #E5E7EB;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 201; color: #6B7280; padding: 0;
  transition: transform .22s, background .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.sb-toggle:hover { background: #F3F4F6; color: #111827; }
.sidebar.collapsed .sb-toggle { transform: rotate(180deg); }

/* Nav area */
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: #E5E7EB; border-radius: 4px; }

/* Section headers */
.sb-section {
  padding: 14px 20px 4px;
  font-size: 10px; font-weight: 700; color: #9CA3AF;
  text-transform: uppercase; letter-spacing: .9px;
  white-space: nowrap; transition: opacity .18s;
}
.sidebar.collapsed .sb-section { opacity: 0; padding: 6px 0; }

/* Nav items */
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin: 1px 8px;
  border-radius: 8px; cursor: pointer;
  color: #374151; font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
  white-space: nowrap; position: relative;
  border-left: 3px solid transparent;
  user-select: none;
}
.sb-item:hover { background: #F3F4F6; color: #111827; }
.sb-item.active {
  background: #EFF6FF; color: #2563EB;
  border-left-color: #2563EB; font-weight: 600;
}
.sb-item.disabled {
  opacity: .35; cursor: default; pointer-events: none;
}
.sb-icon {
  flex-shrink: 0; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}
.sb-label { transition: opacity .18s; }
.sidebar.collapsed .sb-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sb-item { justify-content: center; padding: 9px; margin: 1px 8px; }
.sidebar.collapsed .sb-item.active { border-left-color: #2563EB; }

/* Tooltip on collapsed */
.sb-tooltip {
  display: none; position: absolute;
  left: calc(100% + 10px); top: 50%;
  transform: translateY(-50%);
  background: #111827; color: #fff;
  padding: 5px 10px; border-radius: 6px;
  font-size: 12px; white-space: nowrap;
  z-index: 999; pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.sb-tooltip::before {
  content: '';
  position: absolute; right: 100%; top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #111827;
}
.sidebar.collapsed .sb-item:hover .sb-tooltip { display: block; }

/* User section */
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid #F3F4F6;
  flex-shrink: 0;
}
.sb-avatar {
  width: 32px; height: 32px; min-width: 32px;
  background: #2563EB; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sb-user-info { flex: 1; overflow: hidden; transition: opacity .18s, width .22s; }
.sidebar.collapsed .sb-user-info { opacity: 0; width: 0; }
.sb-user-name {
  font-size: 12.5px; font-weight: 600; color: #111827;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-role { font-size: 10px; color: #6B7280; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.sb-logout {
  background: none; border: none; color: #9CA3AF;
  cursor: pointer; padding: 6px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .12s, color .12s;
}
.sb-logout:hover { background: #FEE2E2; color: #DC2626; }

/* ── Main content wrapper ── */
.main-content {
  margin-left: 280px;
  min-height: 100vh;
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
  flex: 1; display: flex; flex-direction: column;
}
.main-content.sb-collapsed { margin-left: 72px; }

/* Topbar (page title + mobile menu) */
.topbar {
  height: 56px; background: #fff;
  border-bottom: 1px solid #E5E7EB;
  display: flex; align-items: center;
  padding: 0 24px; gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-menu {
  background: none; border: none; color: #374151;
  cursor: pointer; padding: 6px;
  border-radius: 6px; display: none;
  align-items: center; justify-content: center;
  transition: background .12s;
}
.topbar-menu:hover { background: #F3F4F6; }
.topbar-title { font-size: 15px; font-weight: 600; color: #111827; flex: 1; }

/* ── Content area ── */
.content { max-width: 1100px; margin: 0 auto; padding: 24px 24px; }

/* ── Mobile overlay ── */
.sb-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 199;
}
.sb-overlay.visible { display: block; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease, width .22s;
    width: 280px; min-width: 280px;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: 280px; min-width: 280px; }
  .main-content, .main-content.sb-collapsed { margin-left: 0; }
  .topbar-menu { display: flex !important; }
  .sb-toggle { display: none; }
}
@media (max-width: 600px) {
  .content { padding: 16px 14px; }
}


/* ── Cashier: no sidebar ── */
body.cashier-mode .sidebar    { display: none !important; }
body.cashier-mode .main-content,
body.cashier-mode .main-content.sb-collapsed { margin-left: 0 !important; }
body.cashier-mode .sb-overlay { display: none !important; }
body.cashier-mode .topbar-menu { display: none !important; }

/* ================================================================
   DASHBOARD - Modern ERP Layout
================================================================ */

/* Content width increase */
.content { max-width: 1320px; }

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media(max-width:1200px) { .kpi-grid { grid-template-columns: repeat(3,1fr); } }
@media(max-width:700px)  { .kpi-grid { grid-template-columns: repeat(2,1fr); } }

.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 16px;
  border: 1px solid #E5E7EB;
  transition: box-shadow .15s, transform .15s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-1px); }
.kpi-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; border-radius: 4px 0 0 4px;
}
.kpi-card.blue::before   { background: #2563EB; }
.kpi-card.green::before  { background: #16A34A; }
.kpi-card.red::before    { background: #DC2626; }
.kpi-card.yellow::before { background: #F59E0B; }
.kpi-card.indigo::before { background: #6366F1; }
.kpi-card.teal::before   { background: #0D9488; }

.kpi-icon-wrap {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px; font-size: 18px;
}
.kpi-card.blue   .kpi-icon-wrap { background: #EFF6FF; }
.kpi-card.green  .kpi-icon-wrap { background: #F0FDF4; }
.kpi-card.red    .kpi-icon-wrap { background: #FEF2F2; }
.kpi-card.yellow .kpi-icon-wrap { background: #FFFBEB; }
.kpi-card.indigo .kpi-icon-wrap { background: #EEF2FF; }
.kpi-card.teal   .kpi-icon-wrap { background: #F0FDFA; }

.kpi-label {
  font-size: 11px; font-weight: 600; color: #6B7280;
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px;
}
.kpi-value {
  font-size: 22px; font-weight: 700; color: #111827;
  line-height: 1.2; margin-bottom: 4px;
}
.kpi-sub { font-size: 11px; color: #9CA3AF; }
.kpi-sub .up   { color: #16A34A; font-weight: 600; }
.kpi-sub .down { color: #DC2626; font-weight: 600; }

/* Dashboard grid rows */
.dash-row {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}
.dash-row-2col { grid-template-columns: 1fr 1fr; }
.dash-row-3col { grid-template-columns: 2fr 1fr 1fr; }
@media(max-width:900px) { .dash-row-2col, .dash-row-3col { grid-template-columns: 1fr; } }

/* Dashboard widgets */
.dash-widget {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  overflow: hidden;
}
.widget-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #F3F4F6;
}
.widget-title {
  font-size: 13.5px; font-weight: 700; color: #111827;
}
.widget-period, .widget-badge {
  font-size: 11px; color: #6B7280; font-weight: 500;
  background: #F3F4F6; padding: 3px 8px; border-radius: 20px;
}
.widget-body { padding: 16px 18px; }

/* Billing summary widget */
.billing-stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 1px; background: #F3F4F6; border-radius: 8px; overflow: hidden;
}
@media(max-width:800px) { .billing-stats { grid-template-columns: repeat(3,1fr); } }
.billing-stat {
  background: #fff; padding: 14px 12px; text-align: center;
}
.billing-stat-label {
  font-size: 10px; color: #6B7280; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
}
.billing-stat-value { font-size: 18px; font-weight: 700; color: #111827; }
.billing-stat-value.blue   { color: #2563EB; }
.billing-stat-value.green  { color: #16A34A; }
.billing-stat-value.red    { color: #DC2626; }
.billing-stat-value.yellow { color: #B45309; }
.billing-no-data { text-align: center; padding: 24px; color: #9CA3AF; font-size: 13px; }

/* Recent Activity */
.activity-list { list-style: none; }
.activity-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid #F9FAFB;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2563EB; flex-shrink: 0; margin-top: 5px;
}
.activity-dot.sale    { background: #2563EB; }
.activity-dot.payment { background: #16A34A; }
.activity-dot.member  { background: #6366F1; }
.activity-dot.product { background: #F59E0B; }
.activity-dot.report  { background: #0D9488; }
.activity-dot.reset   { background: #DC2626; }
.activity-dot.login   { background: #9CA3AF; }
.activity-content { flex: 1; min-width: 0; }
.activity-action {
  font-size: 12.5px; font-weight: 600; color: #374151;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.activity-detail { font-size: 11px; color: #9CA3AF; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-time { font-size: 11px; color: #9CA3AF; flex-shrink: 0; }

/* Top Products */
.product-rank-list { list-style: none; }
.product-rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid #F9FAFB;
}
.product-rank-item:last-child { border-bottom: none; }
.rank-num {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.rank-1 { background: #FEF3C7; color: #B45309; }
.rank-2 { background: #F3F4F6; color: #374151; }
.rank-3 { background: #FEF3C7; color: #92400E; }
.rank-other { background: #F9FAFB; color: #9CA3AF; }
.rank-name { flex: 1; font-size: 12.5px; font-weight: 500; color: #374151; }
.rank-qty  { font-size: 12px; font-weight: 700; color: #111827; }
.rank-bar-wrap { width: 60px; height: 4px; background: #F3F4F6; border-radius: 4px; overflow: hidden; }
.rank-bar { height: 100%; background: #2563EB; border-radius: 4px; }

/* Outstanding Members */
.outstanding-list { list-style: none; }
.outstanding-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid #F9FAFB;
}
.outstanding-item:last-child { border-bottom: none; }
.outstanding-avatar {
  width: 34px; height: 34px; border-radius: 8px;
  background: #EFF6FF; color: #2563EB;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.outstanding-info { flex: 1; min-width: 0; }
.outstanding-name { font-size: 13px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outstanding-meta { font-size: 11px; color: #9CA3AF; }
.outstanding-balance { font-size: 14px; font-weight: 700; color: #DC2626; flex-shrink: 0; }
.outstanding-bar-wrap { width: 80px; }
.outstanding-bar { height: 4px; background: #FEE2E2; border-radius: 4px; overflow: hidden; }
.outstanding-fill { height: 100%; background: #DC2626; border-radius: 4px; }

/* Dashboard header */
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.dash-title { font-size: 22px; font-weight: 700; color: #111827; margin-bottom: 2px; }
.dash-subtitle { font-size: 13px; color: #6B7280; }
.dash-period-badge {
  background: #EFF6FF; color: #2563EB;
  padding: 6px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}

/* Sidebar improvements */
.sidebar {
  background: #F8FAFC !important;
}
.sb-brand { border-bottom-color: #E5E7EB; }
.sb-item {
  color: #4B5563;
}
.sb-item:hover {
  background: #EFF6FF !important;
  color: #2563EB !important;
}
.sb-item.active {
  background: #EFF6FF !important;
  color: #2563EB !important;
  border-left-color: #2563EB !important;
  font-weight: 600;
}
.sb-item.active .sb-icon { color: #2563EB; }
.sb-section { color: #94A3B8; }
.sb-user { border-top-color: #E5E7EB; }

/* Improved topbar */
.topbar {
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-billing {
  font-size: 12px; color: #6B7280;
  display: flex; align-items: center; gap: 6px;
}
.topbar-billing span { color: #2563EB; font-weight: 600; }
.topbar-notif {
  width: 32px; height: 32px; border-radius: 8px;
  background: none; border: 1px solid #E5E7EB;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #6B7280; position: relative;
  transition: background .12s;
}
.topbar-notif:hover { background: #F3F4F6; }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px; background: #DC2626;
  border-radius: 50%; border: 1px solid #fff;
  display: none;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 8px;
  cursor: pointer; transition: background .12s;
}
.topbar-user:hover { background: #F3F4F6; }
.topbar-user-name { font-size: 13px; font-weight: 600; color: #111827; }
.topbar-user-role {
  font-size: 10px; font-weight: 700; color: #fff;
  background: #2563EB; padding: 2px 6px;
  border-radius: 4px; text-transform: uppercase; letter-spacing: .4px;
}

/* Spinner for widgets */
.widget-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 32px; color: #9CA3AF; font-size: 13px; gap: 8px;
}

/* ── Print receipt ── */
#printReceiptArea { display: none; }

@media print {
  @page { margin: 8mm 12mm; size: A4; }
  #login, #app { display: none !important; }
  #printReceiptArea {
    display: block !important;
    width: 100%;
    height: 281mm; /* A4 297mm − 8mm top − 8mm bottom */
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 10px; color: #111; background: #fff;
    display: flex; flex-direction: column;
  }
  /* Each copy fills exactly half the page */
  .rcpt-copy {
    width: 100%;
    height: 139mm;
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  /* Cut line takes ~3mm between the two halves */
  .rcpt-cut {
    height: 3mm;
    text-align: center; font-size: 8px; color: #aaa;
    border-top: 1.5px dashed #bbb;
    line-height: 0; flex-shrink: 0;
  }
  .rcpt-cut span {
    background: #fff; padding: 0 8px;
    position: relative; top: -1px;
    letter-spacing: 1px; text-transform: uppercase;
  }
  /* Header band — fixed height */
  .rcpt-band {
    background: #1a73e8; color: #fff;
    padding: 5px 12px 4px; flex-shrink: 0;
    display: flex; justify-content: space-between; align-items: center;
  }
  .rcpt-band-title { font-size: 12px; font-weight: 800; margin: 0; }
  .rcpt-band-sub   { font-size: 7.5px; opacity: .8; margin: 1px 0 0; }
  .rcpt-band-inv   { font-size: 14px; font-weight: 900; letter-spacing: .5px; }
  /* Meta row — fixed height */
  .rcpt-meta {
    display: grid; grid-template-columns: repeat(4, 1fr);
    border: 1px solid #e0e0e0; border-top: none;
    flex-shrink: 0;
  }
  .rcpt-meta-cell {
    padding: 3px 7px;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
  }
  .rcpt-meta-cell:last-child { border-right: none; }
  .rcpt-meta-cell.wide { grid-column: span 2; }
  .rcpt-meta-label { font-size: 7px; text-transform: uppercase; letter-spacing: .5px; color: #888; }
  .rcpt-meta-value { font-size: 9.5px; font-weight: 700; color: #111; }
  /* Items table — grows to fill remaining space */
  .rcpt-items-wrap {
    border: 1px solid #e0e0e0; border-top: none;
    flex: 1; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-start;
  }
  .rcpt-items { width: 100%; border-collapse: collapse; font-size: 9px; }
  .rcpt-items thead tr { background: #f4f6f8; }
  .rcpt-items th {
    padding: 3px 5px; text-align: left;
    font-size: 7.5px; text-transform: uppercase;
    letter-spacing: .3px; color: #5f6368;
    border-bottom: 1px solid #ddd;
  }
  .rcpt-items th.r, .rcpt-items td.r { text-align: right; }
  .rcpt-items td { padding: 2px 5px; border-bottom: 1px solid #f0f0f0; line-height: 1.3; }
  .rcpt-items tr:last-child td { border-bottom: none; }
  .rcpt-items td.disc   { color: #b45309; }
  .rcpt-items td.billed { color: #137333; font-weight: 700; }
  /* Totals — fixed height */
  .rcpt-totals { border: 1px solid #e0e0e0; border-top: none; flex-shrink: 0; }
  .rcpt-total-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 8px; border-bottom: 1px solid #f0f0f0; font-size: 9.5px;
  }
  .rcpt-total-row:last-child { border-bottom: none; }
  .rcpt-total-row.gross  { background: #fafafa; }
  .rcpt-total-row.disc   { background: #fffbf0; color: #b45309; }
  .rcpt-total-row.billed { background: #1a73e8; color: #fff; font-size: 11px; font-weight: 800; }
  .rcpt-total-value { font-weight: 700; }
  /* Signature — fixed, pinned to bottom of each copy */
  .rcpt-sign-wrap {
    padding: 5px 12px 6px;
    border: 1px solid #e0e0e0; border-top: none;
    display: flex; align-items: center; gap: 12px;
    flex-shrink: 0;
  }
  .rcpt-sign-notice { font-size: 8px; color: #5f6368; line-height: 1.4; flex: 1; }
  .rcpt-sign-inner  { text-align: center; min-width: 170px; }
  .rcpt-sign-line {
    border-top: 1px solid #111; padding-top: 3px;
    font-size: 9px; font-weight: 700;
  }
  .rcpt-sign-sublabel { font-size: 7.5px; color: #888; margin-top: 1px; }
  /* Footer — fixed at bottom of each copy */
  .rcpt-footer {
    text-align: center; font-size: 7.5px; color: #bbb;
    padding: 2px 0; letter-spacing: .3px; flex-shrink: 0;
  }
}

@keyframes slideUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
