/* Odoo dashboard — hand-written, no build step.
 *
 * There is no Tailwind and no Vite here on purpose: Node.js is not available
 * on shared hosting, so any build step becomes a manual chore attached to
 * every deploy. This file is served as-is.
 *
 * Written RTL-first. Logical properties (inline-start/end) rather than
 * left/right, so a stray English label does not break the layout. */

:root {
  --bg: #0f1420;
  --surface: #171d2c;
  --surface-2: #1e2536;
  --line: #2a3348;
  --text: #e6eaf2;
  --muted: #94a0b8;
  --accent: #4f7cf7;
  --good: #2fbf71;
  --warn: #e0a33e;
  --bad: #e05c5c;
  --radius: 10px;
  --font: "Segoe UI", "Tahoma", "Noto Sans Arabic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--surface);
  border-inline-start: none;
  border-inline-end: 1px solid var(--line);
  padding: 20px 0;
}

.brand {
  padding: 0 20px 18px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.brand small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

.nav a {
  display: block;
  padding: 10px 20px;
  color: var(--muted);
  border-inline-start: 3px solid transparent;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active {
  color: var(--text);
  background: var(--surface-2);
  border-inline-start-color: var(--accent);
}

.main { flex: 1; min-width: 0; padding: 24px 28px 60px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 22px; }

.who { color: var(--muted); font-size: 13px; }
.who strong { color: var(--text); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.k2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; color: var(--muted); font-weight: 600; }

.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.kpi .label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.kpi .delta { font-size: 13px; margin-top: 4px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }

.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- controls ---------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}
input, select, button {
  font-family: inherit; font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .btn {
  cursor: pointer; background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.btn.ghost { background: var(--surface-2); border-color: var(--line); color: var(--text); }
button:hover, .btn:hover { filter: brightness(1.1); text-decoration: none; }

.pager { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.badge.sale, .badge.purchase, .badge.posted { background: rgba(47,191,113,.15); color: var(--good); }
.badge.draft, .badge.sent { background: rgba(224,163,62,.15); color: var(--warn); }
.badge.cancel { background: rgba(224,92,92,.15); color: var(--bad); }

/* ---------- notices ---------- */
.notice {
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
  border: 1px solid var(--line); background: var(--surface);
}
.notice.error { border-color: rgba(224,92,92,.5); background: rgba(224,92,92,.08); }
.notice code { font-size: 12px; color: var(--muted); }

/* ---------- bar chart (pure CSS, no library) ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bars .fill { width: 100%; background: linear-gradient(180deg, var(--accent), #2d4fa8); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .tick { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

/* ---------- login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .field { margin-bottom: 14px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.login-card input { width: 100%; }
.login-card button { width: 100%; padding: 11px; margin-top: 6px; }
.error-text { color: var(--bad); font-size: 13px; margin-top: 6px; }

@media (max-width: 780px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; border-inline-end: none; border-bottom: 1px solid var(--line); }
  .nav { display: flex; flex-wrap: wrap; }
  .nav a { border-inline-start: none; border-bottom: 3px solid transparent; }
  .nav a.active { border-inline-start: none; border-bottom-color: var(--accent); }
  .main { padding: 18px 14px 40px; }
}
