:root {
  --bg: #eef2f5;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #d9e0e8;
  --primary: #0f9f68;
  --primary-dark: #087f5b;
  --danger: #f0182d;
  --danger-bg: #ffe4e8;
  --success: #07864f;
  --success-bg: #dff8ea;
  --blue: #0b66d8;
  --blue-bg: #e7f3ff;
  --amber-bg: #fff1cf;
  --shadow: 0 18px 45px rgba(16, 24, 40, .16);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 8%, rgba(15, 159, 104, .10), transparent 26rem),
    linear-gradient(135deg, #f7fafc, #e9eef3);
  color: var(--text);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.full { width: 100%; }
.muted { color: var(--muted); margin: 3px 0 0; }
.tiny { color: var(--muted); font-size: 12px; line-height: 1.45; }

.phone-stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.phone-frame {
  width: min(100%, 1180px);
  min-height: min(760px, calc(100dvh - 48px));
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  position: relative;
  background: #fff;
  border: 1px solid rgba(16, 24, 40, .08);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(16, 24, 40, .10);
}
.statusbar {
  display: none;
}
.auth-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 22px;
  background:
    radial-gradient(circle at 50% 26%, rgba(17, 24, 39, .08), transparent 11rem),
    #fbfcfe;
}
.store-logo { width: 112px; height: 92px; position: relative; margin: 8px 0 12px; }
.awning {
  width: 92px;
  height: 46px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border-radius: 12px 12px 9px 9px;
}
.awning span:nth-child(odd) { background: #11a46d; }
.awning span:nth-child(even) { background: #ff6471; }
.store-body {
  width: 72px;
  height: 42px;
  margin: -2px auto 0;
  border: 8px solid #11a46d;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}
.store-body::after {
  content: "";
  display: block;
  width: 24px;
  height: 25px;
  background: #fbfcfe;
  margin: 9px auto 0;
  border-radius: 5px 5px 0 0;
}
.auth-screen h1 { margin: 0; font-size: 31px; letter-spacing: 0; }
.auth-screen > p { margin: 4px 0 0; color: #344054; }
.auth-form { width: 100%; margin-top: 28px; }
.stack { display: grid; gap: 14px; }

label { display: grid; gap: 7px; color: #182230; font-size: 13px; font-weight: 700; }
input, textarea, select {
  width: 100%;
  border: 1px solid #cfd7e2;
  border-radius: var(--radius);
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  outline: 0;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 159, 104, .14);
}
.password-field {
  position: relative;
  display: block;
}
.password-field input {
  padding-right: 58px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  min-width: 42px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: #e9fbf1;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}
.btn {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  padding: 11px 15px;
  font-weight: 800;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-light { background: #edf1f5; color: #182230; }
.btn-outline { background: #e9fbf1; border: 1px solid var(--primary); color: var(--primary-dark); }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); }
.btn-success-soft, .btn-quick { background: var(--success-bg); color: var(--success); }
.contact-link { color: #006edb !important; font-size: 13px; margin-top: 18px !important; }
.demo-btn { width: 100%; margin-top: 10px; }
.link-button {
  border: 0;
  background: transparent;
  color: #006edb;
  font-weight: 700;
  margin-top: 12px;
}
.auth-foot { margin-top: auto !important; font-size: 13px; color: #667085 !important; }
.pending-screen { justify-content: center; }
.pending-card {
  width: 100%;
  display: grid;
  gap: 5px;
  margin: 18px 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}
.pending-card strong { font-size: 17px; }
.pending-card span { color: var(--muted); font-size: 13px; }

.auth-stage .phone-frame,
#pendingView .phone-frame {
  width: min(100%, 430px);
  min-height: min(720px, calc(100dvh - 48px));
}
.app-phone { display: grid; grid-template-rows: 64px 1fr 72px; }
.appbar {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #fff;
  background: linear-gradient(135deg, #0f9f68, #087f5b);
  box-shadow: 0 2px 10px rgba(8, 127, 91, .28);
}
.appbar-title h1 { margin: 0; font-size: 20px; }
.appbar-title p { margin: 2px 0 0; font-size: 13px; color: rgba(255, 255, 255, .9); }
.icon-action {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 28px;
  display: grid;
  place-items: center;
}
#menuBtn { font-size: 25px; }
.logout-action {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
}
.menu-action {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 9px 0;
}
.menu-action span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}
.app-menu {
  position: absolute;
  top: 58px;
  left: 12px;
  z-index: 30;
  min-width: 170px;
  overflow: hidden;
  border: 1px solid rgba(16, 24, 40, .12);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(16, 24, 40, .18);
}
.app-menu button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  border-radius: 0;
  background: #fff;
  color: #182230;
  text-align: left;
  font-weight: 800;
  padding: 12px 14px;
}
.app-menu button:last-child {
  border-bottom: 0;
  color: var(--danger);
}
.logout-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}
.amount-words {
  display: block;
  margin-top: -2px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.app-content {
  overflow: auto;
  padding: 22px;
  background: #fbfcfe;
}
.app-section { display: none; }
.app-section.active { display: block; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}
.feature-card {
  min-height: 110px;
  border: 0;
  border-radius: var(--radius);
  padding: 13px;
  text-align: center;
  background: linear-gradient(145deg, #f7fbff, #eef5f8);
  box-shadow: 0 8px 20px rgba(16, 24, 40, .06);
  color: var(--text);
}
.feature-card strong, .feature-card small { display: block; }
.feature-card strong { margin-top: 6px; font-size: 15px; }
.feature-card small { margin-top: 4px; color: #344054; font-size: 12px; }
.feature-icon {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
}
.feature-icon.blue { background: var(--blue-bg); }
.feature-icon.amber { background: var(--amber-bg); }
.feature-icon.green, .feature-icon.emerald { background: #ddf8eb; }
.total-card {
  margin-top: 14px;
  padding: 15px 17px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff7e5, #fffefd);
}
.money-bag {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffe0a3;
  font-size: 24px;
}
.total-card small, .mini-card small, .report-card small { display: block; color: #182230; font-size: 12px; }
.total-card strong { font-size: 25px; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.mini-card {
  padding: 15px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #eef7ff, #f7f9ff);
}
.mini-card strong { display: block; margin-top: 8px; font-size: 22px; }

.search-box {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  margin-bottom: 10px;
  border: 1px solid #cfd7e2;
  border-radius: var(--radius);
  background: #f8fafc;
  padding-left: 10px;
}
.search-box span { color: #667085; font-size: 20px; }
.search-box input { border: 0; background: transparent; box-shadow: none; }
.compact-switch { margin: 0 0 12px; }
.switch-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.switch-row input { width: 16px; height: 16px; }

.customer-list, .product-list, .history-list { display: grid; gap: 2px; }
.customer-card, .product-card {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e6ebf0;
  border-radius: 0;
  padding: 12px 0;
  background: #fff;
  display: grid;
  grid-template-columns: 46px 1fr auto 18px;
  gap: 10px;
  align-items: center;
  text-align: left;
  color: var(--text);
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #45aa92, #177a68);
  color: #fff;
  font-weight: 800;
}
.avatar.large { width: 56px; height: 56px; background: #ffdca3; color: #182230; font-size: 18px; }
.customer-name, .product-name { margin: 0; font-weight: 800; font-size: 14px; }
.customer-meta, .product-code { color: var(--muted); font-size: 11px; margin-top: 3px; }
.customer-balance, .product-price { text-align: right; font-weight: 800; white-space: nowrap; }
.customer-balance span { display: none; }
.balance-zero { color: var(--success); }
.balance-debt { color: var(--danger); }
.chevron { color: #98a2b3; font-size: 24px; }
.product-thumb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #eef7ff;
  font-size: 24px;
}
.report-select { margin-bottom: 12px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.report-card { min-height: 84px; padding: 13px; border-radius: var(--radius); }
.report-card strong { display: block; margin-top: 10px; font-size: 18px; }
.report-card.green { background: #dff8ea; color: #075e3b; }
.report-card.red { background: #ffe4e8; color: #c10f22; }
.report-card.blue { background: #e2f2ff; color: #0754b8; }

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  background: #fff;
  border-top: 1px solid #e6ebf0;
}
.single-nav { grid-template-columns: 1fr; }
.admin-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.admin-tools strong,
.admin-tools span {
  display: block;
}
.admin-tools span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.approval-list { display: grid; gap: 10px; }
.approval-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 13px;
  display: grid;
  gap: 10px;
}
.approval-card strong { display: block; font-size: 15px; }
.approval-card span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.approval-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-reject { background: var(--danger-bg); color: var(--danger); }
.nav-item {
  height: 100%;
  border: 0;
  background: transparent;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
}
.nav-item span { display: block; margin-bottom: 4px; font-size: 21px; line-height: 1; }
.nav-item.active { color: var(--primary-dark); }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty-icon { font-size: 31px; }
.empty h3 { margin: 8px 0 4px; color: var(--text); font-size: 16px; }
.empty p { margin: 0; font-size: 13px; }

.modal {
  width: min(520px, calc(100% - 24px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
}
.modal-wide { width: min(760px, calc(100% - 24px)); }
.modal::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
.modal-card { display: grid; gap: 15px; padding: 18px; }
.modal-head, .section-title-row, .client-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.client-head { justify-content: flex-start; }
.modal h3, .section-title-row h4 { margin: 0; }
.icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #edf1f5;
  color: #182230;
  font-size: 22px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.balance-box {
  text-align: center;
  border-radius: var(--radius);
  padding: 15px;
  background: linear-gradient(135deg, #fff0f2, #fff9fa);
}
.balance-box span { display: block; color: #981323; font-size: 12px; }
.balance-box strong { display: block; margin-top: 5px; color: var(--danger); font-size: 25px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-grid-three { grid-template-columns: repeat(3, 1fr); }
.history-list { max-height: 330px; overflow: auto; }
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #e6ebf0;
  padding: 11px 0;
}
.history-side {
  display: grid;
  justify-items: end;
  gap: 7px;
}
.history-title { font-weight: 700; font-size: 13px; }
.history-meta { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.history-amount { font-weight: 800; white-space: nowrap; }
.history-credit .history-amount { color: var(--danger); }
.history-payment .history-amount { color: var(--success); }
.history-edit {
  border: 0;
  border-radius: 6px;
  background: #edf1f5;
  color: #344054;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 9px;
  min-height: 0;
}
.link-btn, .link-danger { border: 0; background: transparent; font-weight: 800; padding: 0; }
.link-btn { color: #475467; }
.link-danger { color: var(--danger); font-size: 12px; }

.items-container { display: grid; gap: 12px; }
.item-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fbfcfe; }
.item-grid { display: grid; grid-template-columns: 1.2fr .8fr .7fr; gap: 9px; align-items: end; }
.span-2 { grid-column: span 2; }
.code-input { display: grid; grid-template-columns: 1fr 40px; gap: 6px; }
.scan-btn { border: 0; border-radius: var(--radius); background: var(--primary-dark); color: #fff; font-size: 19px; }
.item-subtotal-wrap span { display: block; color: var(--muted); font-size: 11px; }
.item-subtotal { font-size: 15px; }
.purchase-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.purchase-total strong { font-size: 22px; }
.quick-pay { margin-top: -6px; }
.chip { border: 0; border-radius: var(--radius); background: #dff8ea; color: var(--success); padding: 10px 12px; font-weight: 800; }
.scanner { min-height: 280px; overflow: hidden; border-radius: var(--radius); background: #111; }
.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(18px);
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #101828;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transition: .25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 520px) {
  .phone-stage { padding: 0; display: block; }
  .phone-frame {
    width: 100%;
    height: 100dvh;
    max-height: none;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .app-phone { grid-template-rows: 64px 1fr 72px; }
  .app-content { padding: 14px 14px 18px; }
  .home-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .auth-stage .phone-frame,
  #pendingView .phone-frame {
    width: 100%;
    min-height: 100dvh;
  }
  .modal { width: min(100% - 16px, 520px); }
  .action-grid, .action-grid-three { grid-template-columns: 1fr; }
  .item-grid { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: span 2; }
}

@media (min-width: 900px) {
  .total-card,
  .mini-grid,
  .report-grid,
  .customer-list,
  .product-list,
  .approval-list {
    max-width: 900px;
  }
  .customer-card,
  .product-card {
    border: 1px solid #e6ebf0;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
  }
}
