:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1d2430; --muted: #6b7480; --line: #e3e6ea;
  --brand: #0f6e5c; --brand-soft: #e2f2ee; --danger: #b3261e; --warn: #8a5a00; --warn-soft: #fff3d6;
  --sales: #0f6e5c; --exp: #c2552d;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12161c; --card: #1b2129; --text: #e6e9ee; --muted: #9aa3ad; --line: #2b333d;
    --brand: #4fc3a6; --brand-soft: #173a33; --danger: #ff8a80; --warn: #ffcc66; --warn-soft: #3a2f12; --sales: #4fc3a6; --exp: #f08a5d; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Vazirmatn, "Segoe UI", Tahoma, sans-serif; font-size: 15px; line-height: 1.7; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--brand); }
.who { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font: inherit; white-space: nowrap; cursor: pointer; }
.tabs button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 500; }
.big { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos { color: var(--sales); } .neg { color: var(--exp); }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); min-width: 0; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.btn.main { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.alert { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.chart { width: 100%; height: 180px; display: block; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }
.dot.s { background: var(--sales); } .dot.e { background: var(--exp); }
.list { margin: 0; padding: 0 18px 0 0; }
.pre { white-space: pre-wrap; }
.late { color: var(--danger); }
.done { text-decoration: line-through; color: var(--muted); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal.hidden { display: none; }
.sheet { background: var(--card); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px; }
@media (min-width: 700px) { .modal { align-items: center; } .sheet { border-radius: 16px; } }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.err { color: var(--danger); min-height: 1.5em; }
.link { word-break: break-all; background: var(--brand-soft); padding: 8px; border-radius: 8px; user-select: all; }
@media (max-width: 600px) { main { padding: 12px; } .big { font-size: 19px; } .table th:nth-child(n+5), .table td:nth-child(n+5) { display: none; } .table td.act, .table th.act { display: table-cell; } }

/* terms page */
.doc { max-width: 760px; line-height: 1.9; }
.doc h1 { font-size: 20px; margin: 4px 0 8px; }
.doc h2 { font-size: 16px; margin: 18px 0 6px; }
.doc ul { padding-inline-start: 20px; }
/* credit */
.big { font-size: 28px; font-weight: 700; }
.pos { color: var(--sales); }

