*, *::before, *::after { box-sizing: border-box; }

:root {
  --accent: #880290;
  --accent-dark: #640169;
  --secondary: #ff751f;
  --secondary-soft: #fff0e5;
  --accent-soft: #f7e5f9;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #7c8798;
  --line: #e3e8ef;
  --bg: #f5f7fa;
  --card: #ffffff;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
  --font: 'Cairo', 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

.app-loading { display: grid; place-items: center; min-height: 100vh; }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- auth screens ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 80% -10%, #f2dbf6 0%, transparent 60%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 430px; background: var(--card); border-radius: 20px;
  box-shadow: var(--shadow); padding: 32px 28px;
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo .mark {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 20px;
}
.auth-logo .mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; background: #fff; }
.auth-logo strong { display: block; font-size: 17px; }
.auth-logo span { color: var(--ink-3); font-size: 13px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-2); font-size: 14px; margin-bottom: 20px; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
textarea { min-height: 84px; resize: vertical; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-weight: 700; cursor: pointer;
  transition: filter .15s, transform .05s; text-align: center;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f3c2c2; }
.btn.danger:hover { background: #fef2f2; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font-weight: 600; padding: 0; }

.alert { border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  background: #220029; color: #cbd5e1; padding: 20px 16px; display: flex; flex-direction: column; gap: 6px;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.side .brand .mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; overflow: hidden; flex: none;
}
.side .brand .mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.side .brand b { color: #fff; font-size: 15px; display: block; line-height: 1.2; }
.side .brand small { color: #8fa0b8; font-size: 11px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: #cbd5e1; cursor: pointer; font-size: 14px; font-weight: 600; border: 0; background: none; width: 100%; text-align: right;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }
.side .spacer { flex: 1; }
.side .who { font-size: 12px; color: #8fa0b8; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.1); }
.side .who b { color: #fff; display: block; font-size: 13px; }

.main { padding: 24px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 22px; }
.topbar .sub { color: var(--ink-3); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card h3 { font-size: 16px; margin-bottom: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-title h2 { font-size: 17px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .k { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.stat .v { font-size: 24px; font-weight: 800; margin-top: 4px; }
.stat .v small { font-size: 13px; font-weight: 600; color: var(--ink-3); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { font-size: 12px; color: var(--ink-3); font-weight: 700; text-transform: none; }
tbody tr:hover { background: #f8fafc; }
td .name { font-weight: 700; }
td .muted, .muted { color: var(--ink-3); font-size: 12px; }
.right { text-align: left; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.badge.info { background: var(--accent-soft); color: #640169; }
.badge.draft { background: #e2e8f0; color: #334155; }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .big { font-size: 34px; margin-bottom: 8px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=text] { max-width: 260px; }

/* modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(9, 17, 31, .55); display: grid; place-items: center;
  padding: 20px; z-index: 60; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 760px; box-shadow: 0 30px 80px -20px rgba(2, 6, 23, .5);
  max-height: 92vh; display: flex; flex-direction: column; margin: auto;
}
.modal header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h3 { font-size: 17px; }
.modal .body { padding: 20px 22px; overflow-y: auto; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-start; }
.x-btn { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink-3); line-height: 1; }

.pw-box { background: #220029; color: #e2e8f0; border-radius: 12px; padding: 14px 16px; font-family: 'Inter', monospace; direction: ltr; text-align: left; }
.pw-box b { color: #ffb27a; font-size: 18px; letter-spacing: .5px; }

/* invoice editor */
.items-table input { border-radius: 8px; padding: 8px 10px; }
.items-table td { padding: 6px 6px; }
.items-table .amt { font-weight: 700; direction: ltr; text-align: left; }
.totals { margin-left: auto; width: min(340px, 100%); }
.totals .row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.totals .row.total { border-top: 2px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 17px; font-weight: 800; }
.totals .row span:last-child { direction: ltr; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatch.sel { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
input[type=color] { width: 52px; height: 40px; padding: 3px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }

/* ---------- printed invoice ---------- */
.invoice-doc {
  background: #fff; padding: 34px; border-radius: var(--radius); border: 1px solid var(--line);
  max-width: 900px; margin: 0 auto; box-shadow: var(--shadow);
}
.inv-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; padding-bottom: 18px; border-bottom: 3px solid var(--accent); }
.inv-head .logo { max-height: 88px; max-width: 200px; object-fit: contain; }
.inv-head .seller h2 { font-size: 20px; }
.inv-head .seller p { font-size: 12.5px; color: var(--ink-2); }
.inv-title { text-align: left; }
.inv-title h1 { font-size: 26px; color: var(--accent); letter-spacing: 1px; }
.inv-title .num { font-family: 'Inter', monospace; direction: ltr; font-size: 14px; color: var(--ink-2); }
.inv-meta { display: flex; gap: 26px; justify-content: space-between; flex-wrap: wrap; margin: 20px 0 6px; }
.inv-meta .box h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3); margin-bottom: 4px; }
.inv-meta .box p { font-size: 13px; }
.inv-meta .box b { font-size: 14px; }
.items-print { width: 100%; margin-top: 16px; }
.items-print th { background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--ink); font-size: 12.5px; border-bottom: 2px solid var(--accent); }
.items-print td { font-size: 13.5px; }
.items-print .num { direction: ltr; text-align: left; }
.inv-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; flex-wrap: wrap; }
.inv-note { font-size: 12px; color: var(--ink-2); max-width: 420px; }
.stamp { border: 2px dashed var(--line); border-radius: 10px; padding: 18px 26px; color: var(--ink-3); font-size: 12px; text-align: center; }

@media print {
  body { background: #fff; }
  .side, .topbar, .no-print, .modal-back { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .invoice-doc { box-shadow: none; border: 0; padding: 0; max-width: none; border-radius: 0; }
  .items-print th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 14mm; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; padding: 10px 12px; align-items: center; gap: 8px; }
  .side .brand { padding: 0 8px 0 0; }
  .side .brand small, .side .who, .side .spacer { display: none; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 12px; }
  .main { padding: 16px 14px 60px; }
  .invoice-doc { padding: 18px; }
  .inv-head { flex-direction: column; }
  .inv-title { text-align: right; }
}

/* ---------- public landing page ---------- */
.landing { background: #fff; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.lp-head {
  position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--line);
}
.lp-head .wrap { display: flex; align-items: center; gap: 18px; height: 68px; }
.lp-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.lp-brand .mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; overflow: hidden;
}
.lp-brand .mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.lp-brand b { font-size: 16px; }
.lp-nav { display: flex; gap: 4px; margin-inline-start: auto; }
.lp-nav button {
  background: none; border: 0; color: var(--ink-2); font-weight: 600; font-size: 14px;
  padding: 8px 12px; border-radius: 9px; cursor: pointer;
}
.lp-nav button:hover { background: #f1f5f9; color: var(--ink); }
.lp-actions { display: flex; gap: 8px; }
@media (max-width: 820px) { .lp-nav { display: none; } .lp-actions { margin-inline-start: auto; } }

.hero {
  padding: 64px 0 70px;
  background: radial-gradient(900px 420px at 85% -10%, #f2dbf6 0%, transparent 62%),
              radial-gradient(700px 380px at 0% 10%, #ffe8d9 0%, transparent 60%), #fff;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 46px; align-items: center; }
.pill {
  display: inline-block; background: var(--accent-soft); color: #640169;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; margin-bottom: 16px;
}
.hero h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.18; letter-spacing: -.5px; }
.hero p { color: var(--ink-2); font-size: 17px; margin-top: 16px; max-width: 520px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; align-items: center; }
.hero-cta a { color: var(--ink); font-weight: 700; font-size: 14px; }
.hero-note { font-size: 13.5px !important; color: var(--ink-2) !important; margin-top: 16px !important; }

.hero-visual { display: grid; place-items: center; }
.hc {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line);
  border-radius: 18px; padding: 22px; box-shadow: 0 30px 60px -30px rgba(15,23,42,.35); position: relative;
}
.hc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 3px solid var(--accent); padding-bottom: 14px; }
.hc-brand { display: flex; gap: 10px; align-items: center; }
.hc-brand > span {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.hc-brand b { display: block; font-size: 13.5px; }
.hc-brand small { color: var(--ink-3); font-size: 11px; }
.hc-num { text-align: left; }
.hc-num b { display: block; color: var(--accent); font-size: 15px; }
.hc-num small { font-family: 'Inter', monospace; color: var(--ink-3); font-size: 11px; }
.hc-rows { margin: 14px 0 6px; }
.hc-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); padding: 7px 0; border-bottom: 1px dashed #eef2f7; }
.hc-row span:last-child { font-family: 'Inter', monospace; }
.hc-sum { margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.hc-sum > div { display: flex; justify-content: space-between; padding: 4px 0; }
.hc-total { border-top: 2px solid var(--line); margin-top: 6px; padding-top: 8px !important; font-size: 14px; color: var(--ink); font-weight: 800; }
.hc-total b { color: var(--accent); }
.hc-badge {
  position: absolute; top: -12px; inset-inline-end: 18px; background: #dcfce7; color: #166534;
  font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; border: 1px solid #bbf7d0;
}

.section { padding: 62px 0; }
.section.alt { background: #f8fafc; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sec-head { text-align: center; max-width: 640px; margin: 0 auto 34px; }
.sec-head h2 { font-size: clamp(22px, 3vw, 30px); }
.sec-head p { color: var(--ink-2); margin-top: 10px; }

.feat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.feat-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: #640169; display: grid; place-items: center; margin-bottom: 14px; }
.feat-ico svg { width: 22px; height: 22px; }
.feat h3 { font-size: 15.5px; margin-bottom: 6px; }
.feat p { color: var(--ink-2); font-size: 13.5px; }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.step { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.step span {
  width: 32px; height: 32px; border-radius: 10px; background: var(--secondary); color: #fff;
  display: grid; place-items: center; font-weight: 800; margin-bottom: 12px;
}
.step h3 { font-size: 15.5px; margin-bottom: 6px; }
.step p { color: var(--ink-2); font-size: 13.5px; }

.plans { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.plan { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; text-align: center; }
.plan b { display: block; font-size: 16px; color: var(--secondary); }
.plan span { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 6px; }
.plans-cta { text-align: center; margin-top: 26px; }
.plans-cta p { color: var(--ink-2); font-size: 14px; }
.plans-cta .hero-cta { justify-content: center; margin-top: 14px; }

.lp-foot { background: #220029; color: #cbd5e1; padding: 34px 0; }
.lp-foot .wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.lp-foot b { color: #fff; font-size: 15px; }
.lp-foot p { font-size: 13px; color: #94a3b8; margin-top: 4px; }
.lp-foot-links { display: flex; flex-wrap: wrap; gap: 16px; }
.lp-foot-links a, .lp-foot-links .link-btn { color: #cbd5e1; font-size: 13px; font-weight: 600; }
.lp-foot-links a:hover, .lp-foot-links .link-btn:hover { color: #fff; }
.lp-foot .copy { width: 100%; border-top: 1px solid rgba(255,255,255,.1); padding-top: 16px; font-size: 12px; }

/* login tabs */
.tabs { display: flex; gap: 6px; background: #f1f5f9; padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.tab {
  flex: 1; border: 0; background: none; padding: 9px 8px; border-radius: 9px; cursor: pointer;
  font-weight: 700; font-size: 13.5px; color: var(--ink-2);
}
.tab.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.auth-foot { text-align: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .feat-grid, .steps { grid-template-columns: 1fr 1fr; }
  .plans { grid-template-columns: 1fr 1fr; }
  .lp-head .wrap { height: 60px; }
  .lp-brand b { font-size: 14px; }
}
@media (max-width: 560px) {
  .feat-grid, .steps, .plans { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 46px; }
  .section { padding: 44px 0; }
  .lp-actions .btn.small { padding: 8px 12px; font-size: 12.5px; }
}

@media (max-width: 620px) {
  .lp-actions .btn { white-space: nowrap; }
  .lp-actions .btn.ghost { display: none; }
  .lp-brand b { font-size: 13.5px; }
  .lp-actions .btn.small { padding: 8px 11px; font-size: 12.5px; }
}

/* public invoice page */
.public-page { min-height: 100vh; background: var(--bg); padding: 24px 16px 60px; }
.pub-bar {
  max-width: 900px; margin: 0 auto 18px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.pub-brand { display: flex; align-items: center; gap: 10px; }
.pub-brand .mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; overflow: hidden; flex: none;
}
.pub-brand .mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pub-brand b { display: block; font-size: 15px; }
.pub-brand small { color: var(--ink-3); font-size: 12px; }

/* ---------- language / currency switch ---------- */
.tools { display: flex; gap: 6px; align-items: center; }
.brand .tools { margin-inline-start: auto; }
.tool {
  min-width: 40px; padding: 5px 9px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 12px;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); color: #e2e8f0; line-height: 1.4;
}
.tool:hover { background: rgba(255,255,255,.18); color: #fff; }
.lp-actions .tool {
  border-color: var(--line); background: #fff; color: var(--ink-2);
}
.lp-actions .tool:hover { border-color: var(--accent); color: var(--accent); }
.pub-bar .tool, .float-tools .tool {
  border-color: var(--line); background: #fff; color: var(--ink-2);
}
.pub-bar .tool:hover, .float-tools .tool:hover { border-color: var(--accent); color: var(--accent); }
.float-tools { position: fixed; top: 14px; inset-inline-end: 16px; z-index: 50; display: flex; gap: 6px; }
.muted-row span { color: var(--ink-3); font-size: 12.5px; }

/* ---------- LTR overrides ---------- */
html[dir="ltr"] body { font-family: 'Inter', 'Poppins', 'Cairo', 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif; }
html[dir="ltr"] th, html[dir="ltr"] td { text-align: left; }
html[dir="ltr"] td .right, html[dir="ltr"] .right { text-align: right; }
html[dir="ltr"] .nav-item { text-align: left; }
html[dir="ltr"] .field label { text-align: left; }
html[dir="ltr"] .totals .row span:last-child { direction: ltr; }
html[dir="ltr"] .inv-title { text-align: right; }
html[dir="ltr"] .lp-brand b, html[dir="ltr"] .brand b { letter-spacing: 0; }
html[dir="ltr"] .items-print .num { text-align: right; }
html[dir="ltr"] .x-btn { font-family: inherit; }
.side-tools { display: flex; gap: 6px; padding: 0 10px 12px; }
@media (max-width: 900px) { .side-tools { padding: 0; } }

/* brand accents */
.btn.secondary { background: var(--secondary); }
.btn.outline-secondary { background: #fff; color: var(--secondary); border-color: var(--secondary); }
.hc-num b { color: var(--accent-dark); }
.lp-foot .mark img, .side .brand .mark img { background: #fff; }

/* ---------- mobile responsiveness ---------- */
html, body { max-width: 100%; }
img, svg, video { max-width: 100%; }

@media (max-width: 820px) {
  body { overflow-x: hidden; }
  .wrap { padding: 0 14px; }
  .main { padding: 14px 12px 70px; }
  .topbar { gap: 10px; margin-bottom: 16px; }
  .topbar h1 { font-size: 19px; }
  .stats { gap: 10px; margin-bottom: 14px; }
  .stat { padding: 12px; }
  .stat .v { font-size: 20px; }

  /* wide tables scroll inside their card instead of stretching the page */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card table { min-width: 100%; }
  .card th, .card td { padding: 10px 8px; font-size: 13px; white-space: nowrap; }
  .card td .muted { white-space: normal; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .field { margin-bottom: 12px; }
  input[type=text], input[type=email], input[type=password], input[type=tel],
  input[type=number], input[type=date], select, textarea { font-size: 16px; }
  .btn { padding: 10px 14px; }
  .btn-row { gap: 8px; }
  .btn-row > .btn { flex: 1 1 auto; }
  .toolbar input[type=text] { max-width: none; width: 100%; }

  .modal-back { padding: 8px; }
  .modal { max-height: 94vh; border-radius: 14px; }
  .modal header, .modal .body, .modal footer { padding-left: 14px; padding-right: 14px; }
  .modal footer { flex-wrap: wrap; }
  .modal footer > .btn { flex: 1 1 auto; }

  .items-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .items-table input { min-width: 84px; }
  .totals { width: 100%; }

  .invoice-doc { padding: 16px 12px; }
  .inv-head .logo { max-height: 64px; max-width: 150px; }
  .inv-title h1 { font-size: 21px; }
  .inv-meta { gap: 14px; }
  .items-print { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .items-print th, .items-print td { white-space: nowrap; }
  .public-page { padding: 14px 10px 50px; }
  .pub-bar { gap: 8px; }
}

@media (max-width: 480px) {
  .lp-head .wrap { height: 56px; gap: 8px; }
  .lp-brand { gap: 7px; }
  .lp-brand .mark { width: 30px; height: 30px; }
  .lp-brand b { font-size: 12.5px; }
  .lp-actions { gap: 6px; }
  .tool { min-width: 34px; padding: 5px 7px; font-size: 11.5px; }
  .lp-actions .btn.small { padding: 7px 10px; font-size: 12px; }
  .hero h1 { font-size: 27px; }
  .hero p { font-size: 15.5px; }
  .pill { font-size: 12px; padding: 5px 12px; }
  .hero-cta { gap: 8px; }
  .section { padding: 38px 0; }
  .feat, .step, .plan { padding: 16px; }
  .hc { padding: 16px; }
  .stat .v { font-size: 18px; }
  .pw-box b { font-size: 15px; word-break: break-all; }
}

/* ---------- floating WhatsApp button (home page) ---------- */
.wa-float {
  position: fixed; right: 18px; bottom: 22px; z-index: 70;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; color: #fff; display: grid; place-items: center;
  box-shadow: 0 12px 26px -8px rgba(37, 211, 102, .75), 0 2px 6px rgba(15, 23, 42, .16);
  animation: wa-bob 2.8s ease-in-out infinite; transition: transform .18s ease;
}
.wa-float svg { width: 30px; height: 30px; fill: currentColor; display: block; }
.wa-float::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(37, 211, 102, .55); animation: wa-pulse 2.4s ease-out infinite;
}
.wa-float:hover { transform: scale(1.07); }
.wa-tip {
  position: absolute; right: 68px; top: 50%; transform: translateY(-50%) translateX(8px);
  background: #fff; color: #0f172a; padding: 7px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.wa-float:hover .wa-tip { opacity: 1; transform: translateY(-50%) translateX(0); }
@keyframes wa-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes wa-pulse { 0% { transform: scale(1); opacity: .85; } 100% { transform: scale(1.55); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .wa-float, .wa-float::after { animation: none; } }
@media (max-width: 480px) {
  .wa-float { width: 52px; height: 52px; right: 18px; bottom: 18px; }
  .wa-float svg { width: 27px; height: 27px; }
  .wa-tip { display: none; }
}
