@font-face { font-family: 'Vazirmatn'; src: url('/fonts/vazirmatn/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/vazirmatn/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/vazirmatn/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root { --brand: #1f3b5a; --brand-dark: #16304a; --brand-soft: #e8eef5; --page-bg: #f4f6f9; --surface: #fff; --nav-text: #334; --muted-line: #dde;
    --bs-body-font-family: 'Vazirmatn', Tahoma, sans-serif; --bs-body-font-size: .92rem; }
/* Themes (chosen per user, see Infrastructure/Themes.cs) */
[data-theme=teal] { --brand: #0f6e6e; --brand-dark: #0a5454; --brand-soft: #e3f2f1; --page-bg: #f3f7f7; }
[data-theme=green] { --brand: #2e6b3a; --brand-dark: #22522c; --brand-soft: #e6f1e8; --page-bg: #f4f7f4; }
[data-theme=purple] { --brand: #4b3a7a; --brand-dark: #392c5e; --brand-soft: #ece8f5; --page-bg: #f6f5f9; }
[data-theme=maroon] { --brand: #7a2e3a; --brand-dark: #5e222c; --brand-soft: #f5e8ea; --page-bg: #f9f5f5; }
[data-theme=graphite] { --brand: #3a3f47; --brand-dark: #2a2e34; --brand-soft: #eceef1; --page-bg: #f4f5f6; }
[data-theme=dark] { --brand: #16202c; --brand-dark: #0e151d; --brand-soft: #24384f; --page-bg: #11161c; --surface: #1a222c; --nav-text: #cfd6de; --muted-line: #2c3642; }
[data-theme=dark] .btn-brand { background: #2f6db0; }
[data-theme=dark] .btn-brand:hover { background: #3b7cc2; }
[data-theme=dark] .sidebar .nav-link.active, [data-theme=dark] .sidebar .nav-link:hover { color: #fff; }
[data-theme=dark] .table-light { --bs-table-bg: #222c37; --bs-table-color: #dde; }
.theme-swatch { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid transparent; display: inline-block; box-shadow: 0 0 0 1px rgba(0,0,0,.15) inset; }
.theme-swatch.active { border-color: #fff; outline: 2px solid var(--brand); }
body { background: var(--page-bg); font-family: var(--bs-body-font-family); padding-bottom: env(safe-area-inset-bottom); }
.bg-brand { background: var(--brand) !important; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); color: #fff; }

.sidebar { width: 230px; flex-shrink: 0; background: var(--surface); min-height: calc(100vh - 56px); }
@media (min-width: 992px) { .sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; } }
.sidebar .nav-link { color: var(--nav-text); padding: .55rem 1rem; border-radius: 0; }
.sidebar .nav-link i { margin-left: .4rem; }
.sidebar .nav-link.active, .sidebar .nav-link:hover { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.main-content { min-width: 0; padding-bottom: 80px !important; }
@media (min-width: 992px) { .main-content { padding-bottom: 1rem !important; } }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--muted-line); display: flex; z-index: 1030; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; text-align: center; padding: .4rem 0; color: #667; text-decoration: none; font-size: .7rem; display: flex; flex-direction: column; }
.bottom-nav a i { font-size: 1.2rem; }
.bottom-nav a.active { color: var(--brand); font-weight: 600; }

.card { border: 0; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-header { background: var(--surface); font-weight: 600; }
.page-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.page-head h1 { font-size: 1.25rem; margin: 0; }
.stat { border-radius: .5rem; padding: .8rem; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.06); height: 100%; }
.stat .v { font-size: 1.5rem; font-weight: 700; }
.stat.danger .v { color: #c62828; }
.money { direction: rtl; white-space: nowrap; }
.table td, .table th { vertical-align: middle; }
.table-overdue td { background: #fdecea !important; }
.text-overdue { color: #c62828 !important; font-weight: 600; }
.deadline-badge { font-weight: 500; }

/* Mobile: tables become cards */
@media (max-width: 576px) {
  .table-cards thead { display: none; }
  .table-cards tr { display: block; background: var(--surface); margin-bottom: .5rem; border-radius: .5rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); padding: .4rem .6rem; }
  .table-cards td { display: flex; justify-content: space-between; gap: .5rem; border: 0; padding: .2rem 0; }
  .table-cards td::before { content: attr(data-label); color: #778; font-size: .8rem; }
  .table-cards td.actions { justify-content: flex-end; }
  .table-cards td.actions::before { content: none; }
}

.timeline { position: relative; padding-right: 1.2rem; }
.timeline::before { content: ''; position: absolute; right: .35rem; top: 0; bottom: 0; width: 2px; background: #d5dce5; }
.timeline-item { position: relative; margin-bottom: .9rem; }
.timeline-item::before { content: ''; position: absolute; right: -1.05rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.timeline-item.muted::before { background: #aab; }
.state-badge { font-size: .8rem; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
input[data-jdp] { direction: ltr; text-align: right; }
.form-label { margin-bottom: .2rem; font-size: .85rem; color: #445; }
.required::after { content: ' *'; color: #c62828; }

/* English (left-to-right): "back" arrows point left. */
[dir=ltr] .bi-arrow-right::before { transform: scaleX(-1); display: inline-block; }

/* Month calendar under today's date in the top bar */
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: .85rem; }
.mini-cal-head { color: #778; font-size: .75rem; }
.mini-cal-day { padding: .2rem 0; border-radius: .3rem; }
.mini-cal-day.off { color: #c0392b; }
.mini-cal-day.today { background: var(--brand); color: #fff; font-weight: 600; }
.mini-cal-list { max-height: 8rem; overflow-y: auto; }
.sidebar-foot a { color: #556; }

/* In-app help articles */
.help-body img { max-width: 100%; height: auto; border: 1px solid #dde; border-radius: .4rem; }
.help-body figure { margin: 1rem 0; text-align: center; }
.help-body figure.half img { max-width: 70%; }
.help-body figure.phone img { max-width: 260px; }
.help-body figcaption { font-size: .85rem; color: #667; margin-top: .3rem; }
.help-body table { width: 100%; margin: .75rem 0; border-collapse: collapse; font-size: .92rem; }
.help-body th, .help-body td { border: 1px solid #dde; padding: .35rem .5rem; vertical-align: top; }
.help-body th { background: #f1f4f8; }
.help-body .note { background: #fff8e6; border: 1px solid #f0d58a; border-radius: .4rem; padding: .6rem .8rem; margin: .75rem 0; }
.help-body .note b:first-child { display: block; margin-bottom: .2rem; }
.help-body .flow { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .5rem 0; }
.help-body .flow span { background: #e8eef5; border-radius: .3rem; padding: .15rem .45rem; font-size: .85rem; }
.help-body .flow i { color: #889; font-style: normal; }
[dir=ltr] .help-body .flow i { transform: scaleX(-1); display: inline-block; }
.help-body .cols, .help-body .row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; margin: .75rem 0; }
.help-body .card { padding: .6rem .8rem; }
.help-body h3 { font-size: 1.05rem; margin-top: 1.2rem; }
.help-body ol.steps li { margin-bottom: .3rem; }

/* Admin › role permissions: compact toggle buttons per level */
.perm-table .perm-btn { padding: .1rem .35rem; margin: 1px; }
.perm-table td:first-child { min-width: 14rem; }

/* Printing: only the page content, no navigation or buttons */
@media print {
    .navbar, .sidebar, .bottom-nav, .d-print-none, .btn, form button, #toast-area, .toast-container { display: none !important; }
    body { background: #fff !important; }
    .main-content { padding: 0 !important; }
    .card { border: 0 !important; box-shadow: none !important; }
    .table-responsive { overflow: visible !important; }
    .table-cards td::before { display: none !important; }
    a { color: inherit !important; text-decoration: none !important; }
    @page { size: A4; margin: 12mm; }
}
.report-menu .list-group-item.active { background: var(--brand, #1f3b5a); border-color: var(--brand, #1f3b5a); }
