:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #14181f; --muted: #6b7280; --line: #e5e7eb;
  --brand: #0f766e; --brand-ink: #ffffff; --side: #0e1726; --side-ink: #c9d1dd; --side-active: #1e2a3d;
  --green: #15803d; --red: #b91c1c; --amber: #b45309; --blue: #1d4ed8;
  --radius: 12px;
}
html, body { background: var(--bg); color: var(--ink); font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif; font-size: 15px; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 1.45rem; font-weight: 700; margin: 0; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: #0b5f58; border-color: #0b5f58; }
.btn-brand { background: var(--brand); color: #fff; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: left; direction: ltr; white-space: nowrap; }
.blank { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }

/* ERP shell */
.erp { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px 40px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 6px 8px 16px; font-weight: 700; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 700; flex: none; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-section { margin-bottom: 10px; }
.nav-title { font-size: .75rem; color: #8592a6; padding: 8px 10px 4px; letter-spacing: .02em; }
.nav-title .ico { margin-left: 6px; }
.nav-item { display: block; color: var(--side-ink); padding: 6px 12px; border-radius: 8px; font-size: .9rem; }
.nav-item:hover { background: var(--side-active); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top .user { font-weight: 600; font-size: .9rem; }
.bell { position: relative; font-size: 1.1rem; }
.bell .dot { position: absolute; top: -6px; left: -10px; background: var(--red); color: #fff; border-radius: 10px; font-size: .65rem; padding: 0 5px; }
.content { padding: 22px 24px 60px; max-width: 1500px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
@media (max-width: 991px) {
  .erp { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 270px; z-index: 30; transform: translateX(100%); transition: transform .2s; }
  .erp.menu-open .side { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.35); }
  .content { padding: 16px; }
  .top { padding: 10px 16px; }
}

/* Panels */
.card-sr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-sr + .card-sr { margin-top: 16px; }
.card-sr h2 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-kpi { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-label { color: var(--muted); font-size: .8rem; }
.kpi-value { font-size: 1.45rem; font-weight: 700; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: .75rem; } .kpi-delta.up { color: var(--green); } .kpi-delta.down { color: var(--red); }
.kpi-hint { color: var(--muted); font-size: .75rem; }
.kpi-red .kpi-value { color: var(--red); } .kpi-amber .kpi-value { color: var(--amber); } .kpi-green .kpi-value { color: var(--green); }

/* Tables */
.table-sr { width: 100%; border-collapse: collapse; background: var(--panel); }
.table-sr th { font-size: .78rem; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; background: #fafbfc; white-space: nowrap; }
.table-sr td { padding: 9px 10px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.table-sr tr:hover td { background: #fafcff; }
.table-sr tfoot td { font-weight: 700; background: #fafbfc; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.quickgrid { width: 100%; }
.quickgrid th { font-size: .78rem; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.quickgrid td { padding: 9px 10px; border-bottom: 1px solid #f0f1f3; }
.paginator { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px; font-size: .85rem; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .form-control, .toolbar .form-select { width: auto; min-width: 160px; }
.bar { height: 8px; background: #eef0f3; border-radius: 6px; overflow: hidden; } .bar > span { display: block; height: 100%; background: var(--brand); }

.badge-soft { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-gray { background: #eef0f3; color: #4b5563; } .badge-green { background: #dcfce7; color: #166534; } .badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; } .badge-blue { background: #dbeafe; color: #1e40af; }

/* Modal */
.modal-backdrop-sr { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; }
.modal-sr { position: fixed; top: 6vh; left: 50%; transform: translateX(-50%); width: min(560px, 94vw); max-height: 88vh; overflow: auto; background: #fff; border-radius: 14px; z-index: 41; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-sr.wide { width: min(980px, 96vw); }
.modal-sr-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-sr-body { padding: 18px; } .modal-sr-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-start; }
label.form-label { font-size: .82rem; color: #374151; margin-bottom: 4px; }

/* Charts (CSS only) */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; direction: ltr; }
.chart .col { flex: 1; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; position: relative; }
.chart .col:hover { opacity: 1; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: .7rem; direction: ltr; margin-top: 4px; }

/* Auth */
.auth { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.auth h1 { margin-bottom: 4px; }

/* Marketing */
.site { background: #fff; }
.site-nav { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(255,255,255,.95); z-index: 10; }
.site-nav nav a { color: var(--ink); font-weight: 500; }
.site-logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); font-size: 1.1rem; }
.hero { padding: 80px 0 60px; background: linear-gradient(180deg, #f0fdfa 0%, #fff 100%); }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.25; }
.hero p.lead { color: #374151; max-width: 640px; }
.feature { padding: 20px; border: 1px solid var(--line); border-radius: 14px; height: 100%; }
.feature h3 { font-size: 1.05rem; font-weight: 700; }
.section { padding: 64px 0; } .section h2 { font-weight: 700; margin-bottom: 8px; }
.plan { border: 1px solid var(--line); border-radius: 16px; padding: 24px; height: 100%; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--brand); }
.plan .price { font-size: 2rem; font-weight: 700; }
.site-foot { border-top: 1px solid var(--line); background: #fafbfc; }

/* Shop */
.shop { background: #fafafa; min-height: 100vh; }
.shop-nav { background: #fff; border-bottom: 1px solid var(--line); }
.product-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; height: 100%; }
.product-card .img { aspect-ratio: 1; background: #f3f4f6; border-radius: 10px; display: grid; place-items: center; font-size: 2.2rem; color: #9ca3af; overflow: hidden; }
.product-card .img img { width: 100%; height: 100%; object-fit: cover; }
.product-card .price { font-weight: 700; color: var(--brand); }

/* Print */
.print-doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 28px; }
.print-doc table { width: 100%; border-collapse: collapse; } .print-doc th, .print-doc td { border: 1px solid #ddd; padding: 6px 8px; font-size: .85rem; }
@media print { .no-print, .side, .top { display: none !important; } .erp { display: block; } .content { padding: 0; } body { background: #fff; } }

#blazor-error-ui { background: #fef3c7; bottom: 0; display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; left: .75rem; top: .5rem; }

/* Financial statements */
.stmt-section { margin-bottom: 1rem; }
.stmt-head { font-weight: 700; color: var(--sr-primary, #0f5132); border-bottom: 2px solid #e5e7eb; padding: .35rem 0; margin-bottom: .25rem; }
.stmt-row, .stmt-sub, .stmt-total { display: flex; justify-content: space-between; padding: .3rem .25rem; }
.stmt-row { border-bottom: 1px dashed #eef0f3; }
.stmt-sub { font-weight: 600; background: #f8fafc; }
.stmt-total { font-weight: 700; border-top: 2px solid #cbd5e1; margin-top: .25rem; }
.stmt-total.big { font-size: 1.15rem; border-top: 3px double #64748b; }

/* ---------- owner phone view (/m) ---------- */
.m-app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: #F5F8F8; }
.m-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; background: #fff; border-bottom: 1px solid #DDE6E6; }
.m-top h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.m-sub { font-size: .8rem; color: #42565F; }
.m-body { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; padding-bottom: 84px; }
.m-hero { background: #10242E; color: #fff; border-radius: 16px; padding: 18px; }
.m-hero .m-sub { color: #C4D5D8; }
.m-big { font-size: 2rem; font-weight: 700; }
.m-big small { font-size: .9rem; font-weight: 400; color: #C4D5D8; }
.m-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-tile { background: #fff; border: 1px solid #DDE6E6; border-radius: 14px; padding: 12px; }
.m-val { font-size: 1.2rem; font-weight: 700; }
.m-h2 { font-size: 1rem; font-weight: 700; margin: 6px 0 0; }
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-item { display: block; background: #fff; border: 1px solid #DDE6E6; border-radius: 12px; padding: 12px 14px; color: inherit; text-decoration: none; min-height: 44px; }
.m-item.warn { border-inline-start: 4px solid #F59E0B; }
.m-item.alert { border-inline-start: 4px solid #C2410C; }
.m-tabs { position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid #DDE6E6; }
.m-tabs a { display: flex; align-items: center; justify-content: center; min-height: 56px; color: #42565F; text-decoration: none; font-size: .85rem; }
.m-tabs a.on { color: #0B6E6E; font-weight: 700; }
