/* PALM PAY dashboard — RTL, brand olive sampled from the logo. */
:root {
  --brand: #51652a;
  --brand-dark: #3c4c1f;
  --brand-soft: #eef2e4;
  --bg: #f5f6f2;
  --card: #ffffff;
  --text: #1f2418;
  --muted: #6b7262;
  --line: #e2e5da;
  --ok: #2f7d32;
  --ok-soft: #e6f4e7;
  --warn: #9a6a00;
  --warn-soft: #fff4d6;
  --err: #b3261e;
  --err-soft: #fde8e7;
  --info: #1d5fa8;
  --info-soft: #e5eefa;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Kufi Arabic", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
}
a { color: var(--brand-dark); }
code, .mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: .9em; direction: ltr; unicode-bidi: embed; }
h1 { font-size: 1.45rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; }
.ltr { direction: ltr; unicode-bidi: embed; text-align: left; }
.nowrap { white-space: nowrap; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  background: var(--brand); color: #fff; padding: 8px 16px; height: 56px;
}
.topbar a, .topbar .muted { color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; }
.brand img { border-radius: 50%; background: #fff; }
.who { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.who code { color: #fff; }
.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--card); border-inline-end: 1px solid var(--line);
  padding: 12px 8px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  text-decoration: none; color: var(--text); margin-bottom: 2px;
}
.sidebar a:hover { background: var(--brand-soft); }
.sidebar a.active { background: var(--brand); color: #fff; }
.sidebar .ico { width: 22px; text-align: center; }
.sidebar .crown { margin-inline-start: auto; font-size: .8em; }
.content { flex: 1; padding: 24px; min-width: 0; max-width: 1400px; }

@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .sidebar { position: fixed; inset-inline-start: 0; top: 56px; z-index: 30; transform: translateX(110%);
             transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .content { padding: 16px; }
  .who .muted { display: none; }
}

/* ---------- cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
        box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
a.kpi { display: block; text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--brand); }
.kpi .label { color: var(--muted); font-size: .85rem; }
.kpi .value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }
.kpi .sub { color: var(--muted); font-size: .8rem; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--card); }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
table.data th { background: #fafbf7; font-weight: 600; font-size: .85rem; color: var(--muted); white-space: nowrap; }
table.data tr:hover td { background: #fbfcf8; }
table.data td.num { direction: ltr; text-align: end; white-space: nowrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #eef0ea; color: var(--muted); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: .85rem; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row .field { margin-bottom: 0; }
input[type=text], input[type=number], input[type=search], input[type=file], select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }
input.small-input { width: 110px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- flashes ---------- */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; border: 1px solid transparent; }
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: #cbe7cd; }
.flash-error { background: var(--err-soft); color: var(--err); border-color: #f5c6c3; }
.flash-info { background: var(--info-soft); color: var(--info); border-color: #c9dbf3; }
.flash-warn { background: var(--warn-soft); color: var(--warn); border-color: #f1dea3; }

/* ---------- pagination ---------- */
.pager { display: flex; gap: 6px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

/* ---------- product gallery ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; background: #fff; }
.thumb img { width: 100%; height: 150px; object-fit: contain; }
.thumb .cap { font-size: .85rem; margin-top: 4px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 420px; text-align: center; }
.auth-logo { border-radius: 50%; margin-bottom: 8px; }

/* ---------- utilities ---------- */
.mt { margin-top: 16px; }
