﻿/* ============ real-app layout (overrides mockup page frame) ============ */
html, body { height: 100%; overflow: hidden; }
body { background: #E9EFED; }

.app {
  position: fixed; inset: 0; margin: 0 auto; max-width: 520px;
  background: var(--bg); display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 0 70px rgba(10, 32, 27, .14);
}
.viewport { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: var(--bg); }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; background: var(--bg); }
.screen.active { display: flex; }

.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* safe areas */
.appbar { padding-top: calc(10px + env(safe-area-inset-top)); }
.screen[data-screen="home"] .scroll,
.screen[data-screen="reports"] .scroll,
.screen[data-screen="account"] .scroll,
.screen[data-screen="approve"] .scroll { padding-top: calc(8px + env(safe-area-inset-top)); }
.itmhead { padding-top: env(safe-area-inset-top); }
.login .inner { padding-top: calc(34px + env(safe-area-inset-top)); overflow-y: auto; }

/* tabbar */
.tabbar { flex: 0 0 auto; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.tabbar.hidden { display: none; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: transparent; font-family: inherit; font-size: 10.5px; font-weight: 700; color: #8A9A95; padding: 4px 2px; cursor: pointer; }
.tabbar button .ic { display: grid; place-items: center; }
.tabbar button.on { color: var(--primary); }

/* small bits */
.appbar-count { font-size: 12px; color: var(--muted); font-weight: 700; }
.loginerr { color: #FECACA; font-size: 12px; font-weight: 700; min-height: 17px; margin: 2px 0 10px; line-height: 1.5; }
.segcount { font-size: 9.5px; background: rgba(14, 124, 107, .12); color: var(--primary); padding: 1px 6px; border-radius: 999px; font-weight: 800; }
.seg button.on .segcount { background: #fff; }
.hidden { display: none !important; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 20px);
  background: #0F1F1C; color: #fff; font-family: 'Cairo', sans-serif; font-size: 12.5px;
  font-weight: 700; padding: 11px 18px; border-radius: 13px; opacity: 0; pointer-events: none;
  transition: .22s; z-index: 999; max-width: 86vw; text-align: center; line-height: 1.6;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #B91C1C; }
.toast.ok { background: #047857; }

/* loading shimmer */
.loading { padding: 28px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 600; }
.spinner { width: 26px; height: 26px; border: 3px solid #DDE7E4; border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 10px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* picker rows */
.prow .ava { flex: 0 0 auto; }

/* request rows */
.req .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.req .top .b .n { font-size: 13px; font-weight: 800; }
.req .top .b .s { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.6; }
.req .top .amt { font-size: 14.5px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.req .st { display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; margin-top: 8px; }
.req .st.pending { background: var(--amber-bg); color: var(--amber); }
.req .st.approved { background: var(--green-bg); color: var(--green); }
.req .st.rejected { background: var(--red-bg); color: var(--red); }

/* approve cards */
.acard .who { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.acard .who .ava { flex: 0 0 auto; }
.acard .who .b { flex: 1; min-width: 0; }
.acard .who .b .n { font-size: 13px; font-weight: 800; }
.acard .who .b .s { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.acard .who .amt { font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.acard .kv { display: flex; justify-content: space-between; font-size: 11.5px; padding: 5px 0; border-top: 1px dashed #EDF2F0; }
.acard .kv span { color: var(--muted); font-weight: 700; }
.acard .kv b { font-weight: 800; }
.acard .acts { display: flex; gap: 8px; margin-top: 11px; }
.acard .acts .btn { height: 42px; font-size: 13px; border-radius: 11px; }
.btn-danger { background: var(--red-bg); color: var(--red); }

/* login */
.login .inner .btn { margin-top: 4px; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 12px; color: rgba(255, 255, 255, .72); margin: 4px 0 16px; font-weight: 600; cursor: pointer; }
.remember .cb { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid rgba(255, 255, 255, .4); display: grid; place-items: center; color: transparent; }
.remember.on .cb { background: #fff; color: var(--primary-dark); border-color: #fff; }

/* desktop hint */
@media (min-width: 560px) {
  .app { border-left: 1px solid rgba(0, 0, 0, .06); border-right: 1px solid rgba(0, 0, 0, .06); }
}


/* ---------- sales invoice ---------- */
.invstore{margin-top:8px;font-size:11.5px;font-weight:800;color:var(--primary-dark)}
.invline{background:#fff;border:1px solid var(--line);border-radius:14px;padding:11px 12px;margin-bottom:9px;box-shadow:var(--shadow)}
.invline .top{display:flex;align-items:flex-start;gap:8px}
.invline .top .b{flex:1;min-width:0}
.invline .n{font-size:13px;font-weight:800;color:var(--ink)}
.invline .s{font-size:11px;color:var(--muted);font-weight:700;margin-top:2px}
.invline .x{border:0;background:var(--red-bg);color:var(--red);width:28px;height:28px;border-radius:9px;font-size:18px;font-weight:900;line-height:1;cursor:pointer}
.invline .grid{display:grid;grid-template-columns:1.6fr 1fr 1fr;gap:8px;margin-top:9px}
.invline label{display:flex;flex-direction:column;gap:4px;font-size:10.5px;font-weight:800;color:#41534E}
.invline select,.invline input{height:38px;border:1px solid var(--line);border-radius:10px;padding:0 8px;font:inherit;font-size:13px;font-weight:700;background:#F9FBFA;color:var(--ink);min-width:0}
.invline .net{margin-top:8px;font-size:11.5px;font-weight:700;color:#4C635D}
.invline .net b{color:var(--ink);font-variant-numeric:tabular-nums}
.invrem{margin-top:8px;font-size:11.5px;font-weight:700;color:#4C635D}
.invrem b{color:var(--red);font-variant-numeric:tabular-nums}
.invdet{margin:6px 0 8px}
.invdet .dl{border-top:1px dashed var(--line);padding:7px 0}
.invdet .dl .n{font-size:12.5px;font-weight:800}
.invdet .dl .s{font-size:11px;color:var(--muted);font-weight:700;margin-top:2px}

/* ---------- keep fixed toolbars from collapsing inside the column-flex screen ---------- */
.screen > .isum,
.screen > .searchbar,
.screen > .filters,
.screen > .sortrow,
.screen > .pickerbar { flex: 0 0 auto; }
.screen > .filters { min-height: 34px; }

/* ---------- invoice: two amount fields side by side (discount + paid) ---------- */
.amountbox .amountgrid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.amountbox .amountgrid .cell{min-width:0}
.amountbox .amountgrid .k{font-size:10.5px;line-height:1.5;margin-bottom:6px}
.amountbox .amountgrid .inp input{width:100%;min-width:0;flex:1 1 auto;font-size:26px;letter-spacing:-.5px}

