@font-face { font-family: Vazirmatn; src: url(/static/vendor/vazirmatn.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f4f5f3; --surface: #ffffff; --surface-2: #f8f9f7; --line: #e3e6e1; --line-strong: #cfd4cc;
  --text: #1c2420; --muted: #66706a; --brand: #0f6b5f; --brand-strong: #0b5148; --brand-soft: #e2f1ee;
  --side: #14231f; --side-text: #b9c7c1; --side-active: #24403a;
  --ok: #15803d; --ok-soft: #e3f4e8; --warn: #a16207; --warn-soft: #fbf1d9; --bad: #b42318; --bad-soft: #fce9e6; --info: #1d5fa8; --info-soft: #e4eefa;
  --radius: 10px; --shadow: 0 1px 2px rgb(20 35 31 / 7%);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) { --bg: #101614; --surface: #18201d; --surface-2: #1e2824; --line: #2a3531; --line-strong: #3a4842;
    --text: #e6ece9; --muted: #98a59f; --brand: #38b2a0; --brand-strong: #5cc9b8; --brand-soft: #173b35;
    --side: #0c1210; --side-text: #a8b6b0; --side-active: #1f332e;
    --ok: #4ade80; --ok-soft: #14321f; --warn: #f0c04f; --warn-soft: #362a10; --bad: #f58a7e; --bad-soft: #3c1a16; --info: #7db5f0; --info-soft: #172c44;
    --shadow: none; } }
/* manual-theme */ :root[data-theme=dark] { --bg: #101614; --surface: #18201d; --surface-2: #1e2824; --line: #2a3531; --line-strong: #3a4842;
    --text: #e6ece9; --muted: #98a59f; --brand: #38b2a0; --brand-strong: #5cc9b8; --brand-soft: #173b35;
    --side: #0c1210; --side-text: #a8b6b0; --side-active: #1f332e;
    --ok: #4ade80; --ok-soft: #14321f; --warn: #f0c04f; --warn-soft: #362a10; --bad: #f58a7e; --bad-soft: #3c1a16; --info: #7db5f0; --info-soft: #172c44;
    --shadow: none; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.75 Vazirmatn, Tahoma, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 21px; margin: 0; font-weight: 700; line-height: 1.5; }
h2 { font-size: 15px; margin: 0; font-weight: 700; }
input, select, textarea, button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { margin-inline-start: auto; }
.nowrap { white-space: nowrap; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 226px; flex: none; background: var(--side); color: var(--side-text); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 14px; overflow-wrap: anywhere; }
.nav-title { font-size: 11.5px; opacity: .65; padding: 12px 10px 3px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; color: var(--side-text); border-radius: 7px; margin-bottom: 1px; }
.nav a:hover { background: var(--side-active); text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav .count { margin-inline-start: auto; background: #d9483b; color: #fff; font-size: 11px; line-height: 1; padding: 4px 7px; border-radius: 20px; }
.side-foot { margin-top: auto; padding: 14px 10px 2px; font-size: 12px; opacity: .8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line); padding: 9px 22px; position: sticky; top: 0; z-index: 20; }
.menu-btn { display: none; background: none; border: 1px solid var(--line-strong); border-radius: 7px; padding: 3px 11px; cursor: pointer; }
.global-search { flex: 1; max-width: 430px; }
.global-search input { width: 100%; }
.user-box { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.content { padding: 22px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-inline-start: auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-body { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: 2fr 1fr; }
.g-even { grid-template-columns: 1fr 1fr; }
.grid > .card { margin-bottom: 0; min-width: 0; }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow); min-width: 0; }
.tile .label { color: var(--muted); font-size: 12.5px; }
.tile .value { font-size: 22px; font-weight: 700; line-height: 1.6; }
.tile .hint { color: var(--muted); font-size: 12px; }
.tile.bad .value { color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12.5px; background: var(--surface-2); white-space: nowrap; }
th, td { padding: 9px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-strong); border-bottom: 0; }
td.money, th.money { text-align: left; direction: ltr; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: #fff; border: 1px solid var(--brand); padding: 6px 15px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); text-decoration: none; color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .btn, :root:not([data-theme=light]) .btn:hover { color: #08201c; } }
/* manual-theme */ :root[data-theme=dark] .btn, :root[data-theme=dark] .btn:hover { color: #08201c; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn.sm { padding: 2px 10px; font-size: 12.5px; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; }
form.inline { display: inline; }

input[type=text], input[type=password], input[type=search], input[type=email], input[type=number], input:not([type]), select, textarea {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 10px; max-width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { width: 100%; resize: vertical; min-height: 78px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; color: var(--muted); }
.field input, .field select { width: 100%; }
.field.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 0 9px; border-radius: 20px; font-size: 12px; line-height: 21px; background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tag { display: inline-block; padding: 0 8px; border-radius: 5px; font-size: 11.5px; line-height: 20px; color: #fff; margin-inline-end: 3px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--ok-soft); color: var(--ok); overflow-wrap: anywhere; }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }

.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 0 8px; }
.tabs a { padding: 10px 13px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.seg a { padding: 4px 12px; color: var(--muted); border-inline-start: 1px solid var(--line); }
.seg a:first-child { border-inline-start: 0; }
.seg a:hover { text-decoration: none; background: var(--surface-2); }
.seg a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.pager { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--line-strong); }
.chart .bar-current { fill: var(--brand); }
.chart g:hover .bar { fill: var(--brand-strong); }
.chart .bar-value, .chart .bar-label { fill: var(--muted); font-size: 12px; font-family: Vazirmatn, Tahoma, sans-serif; }
.chart .axis { stroke: var(--line-strong); }

.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.stage-bar { padding: 8px 16px; }
.stage-bar .track { height: 7px; background: var(--surface-2); border-radius: 5px; overflow: hidden; margin-top: 3px; }
.stage-bar .fill { height: 100%; background: var(--brand); border-radius: 5px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; }
.timeline .text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; }
.facts { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 5px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.task-done { text-decoration: line-through; color: var(--muted); }
.stars { color: #d9920b; letter-spacing: 1px; }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.column { flex: 0 0 262px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 170px); }
.column-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.column-body { padding: 8px; overflow-y: auto; min-height: 90px; flex: 1; }
.column-body.over { background: var(--brand-soft); }
.deal { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 7px; cursor: grab; display: block; color: inherit; box-shadow: var(--shadow); }
.deal:hover { text-decoration: none; border-color: var(--line-strong); }
.deal.dragging { opacity: .45; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar .dow { text-align: center; padding: 7px 2px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.calendar .cell { min-height: 104px; border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line); padding: 5px; min-width: 0; }
.calendar .cell.today { background: var(--brand-soft); }
.calendar .day { font-weight: 600; font-size: 13px; }
.event { display: block; font-size: 11.5px; line-height: 1.6; padding: 0 5px; margin-top: 3px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--info-soft); color: var(--info); }
.event:hover { text-decoration: none; filter: brightness(.96); }
.event.task { background: var(--warn-soft); color: var(--warn); }
.event.invoice { background: var(--bad-soft); color: var(--bad); }
.event.done { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 370px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 26px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .field { margin-top: 13px; }
.auth-card .btn { width: 100%; margin-top: 18px; padding: 9px; }
.qr { background: #fff; padding: 6px; border-radius: 8px; display: block; }

.jp { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; box-shadow: 0 8px 24px rgb(0 0 0 / 18%); padding: 9px; width: 262px; }
.jp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 600; }
.jp-head button { background: none; border: 0; cursor: pointer; font-size: 18px; padding: 0 9px; color: var(--muted); }
.jp-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 2px; }
.jp-grid span { font-size: 11.5px; color: var(--muted); }
.jp-grid button { background: none; border: 0; border-radius: 5px; padding: 3px 0; cursor: pointer; }
.jp-grid button:hover { background: var(--brand-soft); }
.jp-grid button.on { background: var(--brand); color: #fff; }

.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; }
  .content { padding: 0; }
}
@media (max-width: 980px) {
  .g-2, .g-even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; transform: translateX(105%); transition: transform .18s; }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: block; }
  .content { padding: 16px; }
  .topbar { padding: 9px 16px; }
  .user-box .name { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .calendar .cell { min-height: 66px; }
  .event { font-size: 10.5px; }
  .tile .value { font-size: 19px; }
}
