/* Velioon admin — same neutral palette as the browser (no blue). */
:root {
  color-scheme: light;
  --shell: #EDEDEB; --surface: #FFFFFF; --surface-2: #F6F6F5; --surface-3: #EFEFED;
  --line: #E1E1DE; --line-strong: #CACAC6;
  --text: #1B1B1A; --text-2: #5E5D59; --text-3: #8D8C87;
  --ink: #1B1B1A; --on-ink: #FFFFFF;
  --ok: #2E7A4C; --danger: #B9372A; --danger-soft: rgba(185, 55, 42, .10);
  --grid: #EAEAE7;
  --series-cost: #eb6834;   /* orange — validated pair (dataviz validator) */
  --series-income: #1baf7a; /* aqua */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, "Noto Sans Arabic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --shell: #222221; --surface: #2A2A29; --surface-2: #303030; --surface-3: #373736;
    --line: #3A3A38; --line-strong: #4C4C49;
    --text: #ECECE9; --text-2: #ABAAA5; --text-3: #85847F;
    --ink: #ECECE9; --on-ink: #1E1E1D;
    --ok: #63B583; --danger: #E26A5C; --danger-soft: rgba(226, 106, 92, .14);
    --grid: #343432;
    --series-cost: #d95926;
    --series-income: #199e70;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--shell); color: var(--text); font: 14px/1.5 var(--font); }
[hidden] { display: none !important; }
h1, h2 { margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.mark { display: inline-block; width: 18px; height: 24px; flex: none; background: var(--text); -webkit-mask: url("/admin/mark.png") center / contain no-repeat; mask: url("/admin/mark.png") center / contain no-repeat; }

/* controls */
.btn { height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: 600 13px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn.primary { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.danger { color: var(--danger); }
.link { border: 0; background: none; color: var(--text-2); font: inherit; cursor: pointer; text-decoration: underline; }
.search, .select, .field input { height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: 13px var(--font); }
.search { width: min(280px, 100%); }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
:focus-visible { outline: 2px solid var(--text-2); outline-offset: 2px; }

/* sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 32px 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.login-card h1 { font-size: 22px; font-weight: 650; }
.login-card p { margin: 0; }
.login-card .mark { width: 24px; height: 32px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; }
.field input { height: 40px; }
.error { color: var(--danger); font-size: 13px; }
.lang-toggle { align-self: center; margin-top: 4px; }

/* layout */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: var(--shell); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 16px; font-weight: 650; }
.spacer { flex: 1; }
.content { max-width: 1240px; margin: 0 auto; padding: 22px 24px 60px; display: flex; flex-direction: column; gap: 16px; }
.card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { flex: 1; font-size: 15px; font-weight: 650; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

/* headline numbers */
.hero { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; }
.hero-main { padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.label { color: var(--text-2); font-size: 13px; font-weight: 550; }
.hero-value { font-size: 48px; font-weight: 650; letter-spacing: -1px; line-height: 1.1; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.hero-value.neg { color: var(--danger); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); min-width: 0; }
.tile .value { margin-top: 2px; font-size: 22px; font-weight: 650; letter-spacing: -.3px; unicode-bidi: plaintext; }
.tile .sub { color: var(--text-3); font-size: 12px; }

/* chart */
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; }
.legend i.cost { background: var(--series-cost); }
.legend i.income { width: 10px; height: 10px; border-radius: 3px; background: var(--series-income); }
.chart { position: relative; height: 270px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--text-3); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.cost { stroke: var(--series-cost); }
.chart .line.income { stroke: var(--series-income); }
.chart .bar.income { fill: var(--series-income); opacity: .9; }
.chart .bar.income.on { opacity: 1; stroke: var(--text); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.cost { fill: var(--series-cost); }
.chart .dot.income { fill: var(--series-income); }
.chart .end-label { fill: var(--text); font: 600 11.5px var(--font); }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart .empty { fill: var(--text-3); font: 13px var(--font); }
.tooltip { position: fixed; z-index: 20; min-width: 160px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); font-size: 12.5px; pointer-events: none; }
.tooltip .t { margin-bottom: 4px; font-weight: 650; }
.tooltip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip i { width: 8px; height: 8px; border-radius: 50%; }
.tooltip i.cost { background: var(--series-cost); }
.tooltip i.income { background: var(--series-income); }
.tooltip b { font-variant-numeric: tabular-nums; }
.table-view { margin-top: 10px; }
.table-view summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 12px; font-weight: 600; text-align: start; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
td.email { max-width: 260px; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: start; unicode-bidi: plaintext; }
td .tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 600; }
td .tag.bad { background: var(--danger-soft); color: var(--danger); }
td .tag.good { color: var(--ok); }
td .acts { display: inline-flex; gap: 4px; }
.empty-row td { color: var(--text-3); text-align: center; padding: 18px; }
.more { margin-top: 8px; }

.toast { position: fixed; inset-inline-start: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--on-ink); font-size: 13px; }
[dir="rtl"] .toast { transform: translateX(50%); }

@media (max-width: 980px) {
  .hero, .grid-2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 10px 16px; }
  .content { padding: 16px 16px 48px; }
  .tiles { grid-template-columns: 1fr; }
  .hero-value { font-size: 40px; }
}
