/* =====================================================================
   Payaco office automation — one stylesheet (D-101, v2.38)
   Order: tokens → base → layout → components → pages → documents/print.
   Every colour comes from a token; dark mode only redefines tokens and
   the few component values that need a different shade.
   Printed documents (.doc, .pp-*) keep fixed paper colours on purpose.
   ===================================================================== */

@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-var.woff2") format("woff2-variations"), url("fonts/Vazirmatn-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  --bg: #eef2ef; --surface: #ffffff; --surface-2: #e6ece7; --text: #0f172a; --muted: #4b5a6b; --line: #dbe3dd;
  /* brand fills keep #2E8B3E; --brand-2 is the readable green for text, links and the active tab (6.1:1 on white) */
  --brand: #2e8b3e; --brand-2: #22702f; --brand-dark: #22702f; --brand-strong: #22702f; --yellow: #f2b51c; --accent: #10b981;
  /* status colours as text: each reaches at least 4.5:1 on white (v2.38) */
  --danger: #b91c1c; --warn: #f59e0b; --warn-ink: #b45309; --ok: #047857; --info: #1d4ed8;
  --deep: #133d1c; --panel: #0d1f12; --amber: #ffc531;
  --radius: 6px; --shadow: none; --tabbar-h: 64px;
  font-family: Vazirmatn, Tahoma, system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0a1210; --surface: #121c19; --surface-2: #1a2723; --text: #e5edf7; --muted: #a4b3ad; --line: #24332e;
    --brand: #34a14a; --brand-2: #4cc163; --brand-dark: #2e8b3e; --shadow: none;
    --danger: #f87171; --warn: #fbbf24; --warn-ink: #fbbf24; --ok: #34d399; --info: #60a5fa; }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.7; -webkit-text-size-adjust: 100%; overflow-x: hidden; font-feature-settings: "ss01"; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.ico-i { width: 1em; height: 1em; vertical-align: -.15em; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); text-decoration: none; }
bdi { unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ltr { direction: ltr; text-align: left; }
.spacer { flex: 1; }
.tap { cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.loading { text-align: center; color: var(--muted); padding: 30px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- top bar ---------- */
.topbar {
  position: relative; top: 0; z-index: 10; background: var(--bg); color: var(--text); border-bottom: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar .who { font-size: 12px; color: var(--muted); opacity: 1; }
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .logo {
  width: 36px; height: 36px; border-radius: 10px; background: #fff; color: var(--brand); object-fit: contain; padding: 3px; border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.icon-btn { background: rgba(255, 255, 255, .12); border: 0; color: #fff; border-radius: 10px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.refresh-btn { position: absolute; left: 12px; bottom: 10px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.refresh-btn.spin svg { animation: pspin .8s linear infinite; }
@keyframes pspin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
main { padding: 16px; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); max-width: 900px; margin: 0 auto; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 8px; }
.section-title h2 { font-size: 17px; margin: 0; font-weight: 800; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* page-level action row (one primary + secondaries; scrolls sideways on phones) */
.page-actions { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; }
.page-actions .btn { min-height: 44px; padding: 10px 18px; font-size: 14.5px; white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 1023px) {
  .page-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px 6px; }
  .page-actions::-webkit-scrollbar { display: none; }
}
a[data-act="back"] { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; margin-bottom: 8px; border-radius: 999px;
  background: var(--surface); color: var(--brand-2); font-weight: 700; text-decoration: none; box-shadow: 0 1px 0 rgba(0, 0, 0, .06); }
a[data-act="back"] + .card, a[data-act="back"] + div > .card:first-child { margin-top: 0; }

/* ---------- cards and lists ---------- */
.card { background: var(--surface); border: 0; border-radius: var(--radius); padding: 14px; box-shadow: none; margin-bottom: 10px; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.995); }
/* alert cards (inline border colour = meaning): the meaning shows as a thick edge */
.card[style*="border-color"] { border-inline-start: 4px solid; }
.item-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.item-head > div[style*="text-align:left"] { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.item-head > div[style*="text-align:left"] .amount { white-space: nowrap; }
.item-title { font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.amount .rial { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.debt { color: var(--danger); }
.credit { color: var(--ok); }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
/* money columns line up: equal-width digits only where figures stack (amounts, stat numbers, report tables) */
.stat .value, table.list td:last-child { font-variant-numeric: tabular-nums; }
table.list td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
.big-balance { margin: 10px 0 12px; font-size: 26px; font-weight: 800; line-height: 1.3; }
.big-balance > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.big-balance .amount { font-size: 26px; font-weight: 800; color: inherit; }
.big-balance .amount .rial { font-size: 12.5px; font-weight: 500; }
.with-key { display: flex; align-items: center; gap: 12px; min-width: 0; }
.call-key { flex: 0 0 auto; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; font-weight: 800; font-size: 14px;
  color: var(--brand-dark); background: radial-gradient(circle at 50% 35%, #fff 0%, #eef3ef 60%, #dfe7e1 100%);
  border: 2px solid color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: 0 1px 2px rgba(15,23,42,.12), inset 0 -2px 3px rgba(15,23,42,.06); }
.card.tap:hover .call-key { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(242,181,28,.25); }
@media (prefers-color-scheme: dark) { .call-key { color: var(--brand-2); background: radial-gradient(circle at 50% 35%, #26354d 0%, #18243a 100%); } }
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "◂"; color: var(--muted); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(-90deg); }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 0; border-radius: var(--radius); padding: 14px 14px 12px; position: relative; overflow: hidden;
  box-shadow: 0 2px 0 rgba(15, 23, 42, .05), 0 6px 16px rgba(15, 23, 42, .07); }
.stat:not(.money-stat) { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.stat:not(.money-stat) .value { grid-column: 1 / -1; }
.stat .label { font-size: 12px; color: var(--muted); line-height: 1.5; }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 2px; color: var(--text); }
.stat.wide { grid-column: 1 / -1; }
.stat-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: color-mix(in srgb, var(--tone, var(--muted)) 13%, transparent); color: var(--tone, var(--muted)); }
.stat-ico svg { width: 20px; height: 20px; }
.stat.tone-brand { --tone: var(--brand); } .stat.tone-info { --tone: var(--info); } .stat.calm { --tone: var(--muted); }
.stat.danger { --tone: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.stat.warn { --tone: var(--warn); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.stat.danger .value { color: var(--danger); } .stat.warn .value { color: var(--warn-ink); }
.stat.money-stat { --tone: var(--brand); display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center;
  background: linear-gradient(90deg, var(--surface) 60%, color-mix(in srgb, var(--yellow) 12%, var(--surface))); }
.stat.money-stat .stat-ico { grid-row: span 2; margin: 0; width: 46px; height: 46px; border-radius: 14px; }
.stat.money-stat .stat-ico svg { width: 24px; height: 24px; }
.stat.money-stat .value { font-size: 28px; }
.stat.tap:active { transform: translateY(1px) scale(.99); }
.floor-ind.tap:active { transform: scale(.98); }
.stat.tap:hover { box-shadow: 0 0 0 2px var(--line); }
@media (prefers-color-scheme: dark) { .stat { box-shadow: 0 2px 0 rgba(0, 0, 0, .35); } }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn-ink); }
.badge.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 12px; font-size: 16px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(46, 139, 62, .15); }
textarea { min-height: 84px; resize: vertical; }
.date-picker { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--surface); box-shadow: var(--shadow); font-weight: 700; color: var(--brand-dark); }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 500; }
label.check input { width: 20px; height: 20px; flex: none; }
.error-box { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.csel-q { margin-bottom: 6px; }
.lsearch { margin: 8px 0 12px; }

/* ---------- buttons: physical "switch" feel (Nima, v2.35.1) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 11px 16px; font-size: 15px; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #2f9142 0%, #1f6a2c 100%);
  box-shadow: 0 2px 0 rgba(20, 70, 30, .35), 0 4px 10px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn.block { width: 100%; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:hover { background: linear-gradient(180deg, #2a8239 0%, #1b5e27 100%); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(20, 70, 30, .35), 0 2px 5px rgba(15, 23, 42, .12); }
.btn.secondary { border: 0; color: var(--text); background: linear-gradient(180deg, #ffffff 0%, var(--surface-2) 100%);
  box-shadow: 0 2px 0 rgba(15, 23, 42, .08), 0 3px 8px rgba(15, 23, 42, .08), inset 0 1px 0 #fff; }
.btn.secondary:hover { background: linear-gradient(180deg, #ffffff 0%, color-mix(in srgb, var(--brand) 10%, var(--surface-2)) 100%); }
.btn.secondary.danger-text { color: var(--danger); }
.btn.danger { background: linear-gradient(180deg, #dc2626 0%, #b91c1c 60%, #991b1b 100%); box-shadow: 0 2px 0 rgba(120, 20, 20, .35), 0 4px 10px rgba(15, 23, 42, .12); }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform .12s ease, box-shadow .12s ease; }
  .sheet { animation: sheetIn .2s ease-out; }
  @keyframes sheetIn { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (prefers-color-scheme: dark) {
  .btn.secondary { background: linear-gradient(180deg, #22332e 0%, var(--surface-2) 100%); box-shadow: 0 2px 0 rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06); }
}

/* ---------- filter chips ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 13px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.chips button.on { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }

/* ---------- bottom tab bar (desktop: right sidebar) ---------- */
.tabbar {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 10;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--muted); font-size: 11px; gap: 2px; }
.tabbar a .ico { font-size: 20px; line-height: 1; display: grid; place-items: center; position: relative; }
.tabbar a.on { color: var(--brand-2); font-weight: 700; }
.tab-badge { position: absolute; top: -6px; left: -10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.side-brand, .side-foot { display: none; }

/* ---------- sheet (bottom modal) and toast ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(5, 12, 24, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 20px); }
.sheet h3 { margin: 0 0 12px; font-size: 18px; }
.sheet .actions { margin-top: 14px; }
.sheet .actions .btn:not(.small) { min-height: 46px; flex: 1 1 auto; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 16px; } }
#toast {
  position: fixed; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); right: 50%; transform: translateX(50%);
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: calc(100% - 32px);
}
#toast.show { opacity: .95; }
.progress { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; width: 0; background: var(--brand, #2e8b3d); transition: width .2s; }

/* navigation feedback: thin moving bar + dimmed page while the next page loads */
body.busy #view { opacity: .55; pointer-events: none; transition: opacity .12s; }
body.busy::before { content: ""; position: fixed; top: 0; right: 0; left: 0; height: 3px; z-index: 1000;
  background: linear-gradient(90deg, transparent, var(--yellow), var(--brand), transparent); background-size: 50% 100%; background-repeat: no-repeat;
  animation: busybar 1s linear infinite; }
@keyframes busybar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) { body.busy::before { animation: none; background: var(--brand); } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 80% 0%, rgba(242, 181, 28, .25), transparent 45%), linear-gradient(160deg, #f8fafc 0%, #e8f3ea 100%); }
.login-card { background: var(--surface); width: 100%; max-width: 380px; border-radius: 16px; padding: 24px 20px; box-shadow: 0 12px 40px rgba(15, 23, 42, .12); border: 1px solid var(--line); }
.login-card .logo-lg { width: 56px; height: 56px; border-radius: 15px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 24px; margin: 0 auto 8px; }
.login-card h1 { text-align: center; font-size: 20px; margin: 0; }
.login-card p { text-align: center; margin: 2px 0 14px; }
.login-logo { display: block; width: 230px; max-width: 80%; margin: 4px auto 6px; }
@media (prefers-color-scheme: dark) {
  .login-wrap { background: radial-gradient(circle at 80% 0%, rgba(242, 181, 28, .15), transparent 45%), linear-gradient(160deg, #0b1220 0%, #102018 100%); }
  .login-logo, .side-brand img { background: #fff; border-radius: 12px; padding: 6px; }
}

/* ---------- dashboard ---------- */
.hero { display: flex; align-items: stretch; justify-content: space-between; gap: 16px; position: relative; overflow: hidden;
  background: var(--brand); color: #fff; border-radius: var(--radius); padding: 18px 20px 58px; margin-bottom: 12px; }
.hero .brand-lines { position: absolute; inset-inline-start: 8px; bottom: 6px; height: 48px; width: auto; max-width: calc(100% - 16px); color: rgba(255, 255, 255, .55); pointer-events: none; }
.hero-txt { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.hero-txt, .floor-ind { position: relative; z-index: 1; }
.hero-t { font-size: 20px; font-weight: 800; }
.hero-s { font-size: 13px; opacity: .9; }
.hero-slogan { margin-top: 10px; font-size: 13px; color: var(--amber); font-weight: 600; }
@media (prefers-color-scheme: dark) { .hero { background: #1f6d2e; } }
.floor-ind { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.floor-screen { display: flex; flex-direction: column; align-items: center; gap: 0; background: var(--panel); border-radius: 10px; padding: 7px 16px 8px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.6), 0 0 0 3px rgba(255,255,255,.12); min-width: 92px; justify-content: center; }
.floor-num { font-size: 38px; line-height: 1; padding-top: 6px; font-weight: 800; color: var(--amber); font-variant-numeric: tabular-nums; text-shadow: 0 0 10px rgba(255,197,49,.55); }
.floor-arrow { color: var(--amber); display: grid; place-items: center; filter: drop-shadow(0 0 4px rgba(255,197,49,.6)); }
.floor-arrow svg { width: 26px; height: 18px; fill: currentColor; stroke: none; }
.floor-lbl { font-size: 11.5px; opacity: .9; text-align: center; max-width: 110px; line-height: 1.4; }
@media (prefers-reduced-motion: no-preference) {
  .floor-arrow { animation: floorUp 1.6s ease-in-out 2; }
  @keyframes floorUp { 0%, 100% { transform: translateY(2px); opacity: .55; } 50% { transform: translateY(-3px); opacity: 1; } }
}
@media (max-width: 380px) { .floor-num { font-size: 30px; } .floor-screen { min-width: 74px; } }
.dash-search { margin: 0 0 10px; }
.dash-quick { margin: 0 0 12px; }
.dash-quick .btn { min-height: 44px; padding: 10px 18px; font-size: 14.5px; }
@media (max-width: 1023px) {
  .dash-quick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-inline: -16px; padding-inline: 16px; }
  .dash-quick::-webkit-scrollbar { display: none; }
  .dash-quick .btn { flex: 0 0 auto; white-space: nowrap; }
}
.pending-card { border: 0 !important; background: var(--surface); padding-top: 14px; }
.pending-card .item-title { font-size: 17px; font-weight: 800; }
.pending-row { padding: 8px 0; border-top: 1px solid var(--line); gap: 8px; align-items: center; }
.pending-row .badge.warn { min-width: 28px; text-align: center; font-weight: 800; background: var(--yellow); color: #3b2a00; }
.reminders { display: flex; flex-direction: column; gap: 2px; border-radius: var(--radius); overflow: hidden; }
.reminders > .card { border: 0 !important; border-radius: 0; margin: 0; background: var(--surface); padding: 12px 14px; }
.reminders > .card[style*="border-color"] { border-inline-start: 4px solid !important; }
.reminders > .card .item-title { font-size: 14.5px; }
.dash-side .section-title { margin-top: 14px; }

/* ---------- CEO dashboard areas (D-104): two big switches ---------- */
.area-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.area-switch button { border: 0; font: inherit; cursor: pointer; text-align: start; padding: 14px 16px; border-radius: 14px; display: flex; flex-direction: column; gap: 4px; min-height: 76px;
  color: var(--text); background: linear-gradient(180deg, #ffffff 0%, var(--surface-2) 100%); box-shadow: 0 2px 0 rgba(15, 23, 42, .08), 0 3px 8px rgba(15, 23, 42, .08), inset 0 1px 0 #fff; }
.area-switch button b { font-size: 16px; font-weight: 900; } .area-switch button span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.area-switch button.on { color: #fff; background: linear-gradient(180deg, #2f9142 0%, #1f6a2c 100%); box-shadow: 0 2px 0 rgba(20, 70, 30, .35), 0 4px 10px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .22); }
.area-switch button.on span { color: rgba(255, 255, 255, .85); }
@media (prefers-color-scheme: dark) { .area-switch button:not(.on) { background: linear-gradient(180deg, #22332e 0%, var(--surface-2) 100%); box-shadow: 0 2px 0 rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06); } }
@media (prefers-reduced-motion: no-preference) { .area-switch button { transition: transform .12s ease; } .area-switch button:active { transform: translateY(1px); } }

/* ---------- contract page: grouped "more actions" sheet ---------- */
.menu-group { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 0 6px; }
.menu-sep { height: 1px; background: var(--line); margin: 16px 0 10px; }
.menu-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.menu-acts .btn { flex: 1 1 calc(50% - 8px); min-height: 44px; justify-content: center; }

/* ---------- services: assignment picker, extra-work notes, ratings ---------- */
.pick-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 6px; background: var(--surface); }
.pick { margin: 0; font-weight: 400; color: var(--text); display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; line-height: 1.6; }
.pick:last-child { border-bottom: 0; }
.pick input { width: 20px; height: 20px; margin-top: 3px; flex: 0 0 auto; accent-color: var(--brand); }
.pick:has(input:checked) { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.pick-wrap .pick-note { margin: 0 28px 8px 0; width: calc(100% - 28px); }
.assign-note { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--warn, #e0a800) 14%, transparent); font-size: 13px; }
.stars { display: flex; gap: 4px; justify-content: flex-start; margin: 2px 0 6px; }
.star { width: 44px; height: 44px; border: 0; background: none; font-size: 30px; line-height: 1; color: #cbd5e1; cursor: pointer; padding: 0; }
.star.on { color: var(--yellow); text-shadow: 0 1px 0 rgba(0,0,0,.08); }
.star:focus-visible { outline: 2px solid var(--brand); border-radius: 8px; }
.rate-sum b { color: var(--warn-ink); }
.receipt-text { white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 6px 8px; margin-top: 6px; color: var(--text); }
.tpl-body { min-height: 55vh; font-size: 14px; line-height: 1.9; }
.tpl-keys button { font-size: 12px; }

/* ---------- designer credit ---------- */
.nima-credit { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; font-size: 12px; color: var(--muted); }
a.nima-credit { text-decoration: none; }
.nima-credit img { display: block; width: 21px; height: 16px; }
.nima-credit .nima-name { font-family: Montserrat, "Segoe UI", system-ui, -apple-system, sans-serif; font-weight: 700; letter-spacing: .2px; color: var(--text); }
.page-credit { margin: 24px 0 8px; }

/* ---------- desktop ---------- */
@media (min-width: 1024px) {
  :root { --side-w: 236px; }
  .tabbar { top: 0; bottom: 0; left: auto; right: 0; width: var(--side-w); height: 100vh; flex-direction: column; justify-content: flex-start;
    border-top: 0; border-left: 1px solid var(--line); padding: 16px 12px; gap: 4px; }
  .tabbar a { position: relative; flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 11px 14px; border-radius: 12px; }
  .tabbar a:hover { background: var(--surface-2); color: var(--text); }
  .tabbar a.on { background: color-mix(in srgb, var(--brand) 12%, transparent); }
  .tabbar a.on::after { content: ""; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px 0 0 4px; background: var(--yellow); }
  .side-brand { display: block; padding: 4px 6px 18px; } .side-brand img { width: 100%; }
  .side-foot { display: block; margin-top: auto; font-size: 13px; color: var(--text); padding: 12px; border-top: 1px solid var(--line); }
  .side-foot span { color: var(--muted); font-size: 12px; }
  .topbar { margin-right: var(--side-w); padding: 18px 28px; }
  .topbar .logo { display: none; }
  .topbar h1 { font-size: 22px; }
  main { margin-right: var(--side-w); max-width: none; padding: 20px 28px 40px; }
  main > * { max-width: 1280px; }
  #view { display: block; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #view:has(> .card.tap:nth-of-type(4)) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; align-content: start; }
  #view:has(> .card.tap:nth-of-type(4)) > :not(.card) { grid-column: 1 / -1; }
  #toast { bottom: 24px; }
  .sheet-backdrop { align-items: center; } .sheet { border-radius: 16px; max-width: 720px; }
  .hero { padding: 22px 26px 66px; }
  .hero .brand-lines { height: 58px; }
  .hero-t { font-size: 23px; }
  .floor-num { font-size: 46px; }
  .dash.has-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 0 18px; align-items: start; }
  .dash-side .section-title { margin-top: 0; }
  .dash .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1500px) { #view:has(> .card.tap:nth-of-type(4)) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* =====================================================================
   Documents (subscriber link page) — always paper colours, both themes
   ===================================================================== */
.doc-page { max-width: 820px; margin: 0 auto; padding: 12px; }
main.doc-page { padding-bottom: 40px; }
.doc { position: relative; background: #fff; color: #1b2433; border-radius: 12px; padding: 22px 20px; box-shadow: 0 2px 16px rgba(0,0,0,.12);
  font-size: 14px; line-height: 1.75; overflow: hidden; border-top: 6px solid #2e8b3e; }
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 2px solid #f2b51c; padding-bottom: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.doc-logo { width: 210px; max-width: 55%; height: auto; }
.doc-title { text-align: left; }
.doc-title h2 { margin: 0 0 4px; font-size: 18px; color: #2e8b3e; text-align: right; }
.doc-no { font-weight: 700; }
.doc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.doc-info th, .doc-info td { border: 1px solid #d9dee6; padding: 6px 8px; text-align: right; vertical-align: top; }
.doc-info th { background: #f4f7f2; color: #44506a; font-weight: 600; white-space: nowrap; width: 1%; }
.doc-items th { background: #2e8b3e; color: #fff; padding: 7px 8px; font-weight: 600; text-align: right; }
.doc-items td { border-bottom: 1px solid #e3e7ee; padding: 7px 8px; vertical-align: top; }
.doc-items td.c { text-align: center; }
.doc-items .n { text-align: left; direction: ltr; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-items tfoot td { padding: 6px 8px; border-bottom: 1px dashed #e3e7ee; }
.doc-items tfoot tr.strong td { font-weight: 700; border-top: 2px solid #c9d1dc; }
.doc-items tfoot tr.doc-payable td { background: #fff6dc; font-weight: 800; font-size: 15px; border-bottom: 2px solid #f2b51c; }
.doc-sub { font-size: 12px; color: #6a7489; }
.doc-words { margin: 8px 0; padding: 8px 10px; background: #f4f7f2; border-radius: 8px; }
.doc-notes, .doc-paid { margin: 8px 0; font-size: 13px; }
.doc-bank { margin: 12px 0; border: 1.5px solid #2e8b3e; border-radius: 10px; padding: 10px 12px; }
.doc-bank-title { font-weight: 700; color: #2e8b3e; margin-bottom: 6px; }
.doc-bank-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px dashed #e3e7ee; flex-wrap: wrap; }
.doc-bank-label { color: #44506a; min-width: 6.5em; }
.doc-bank-val { font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; flex: 1; white-space: nowrap; word-break: normal; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; }
.doc-copy { border: 1px solid #2e8b3e; background: #fff; color: #2e8b3e; border-radius: 8px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.doc-foot { margin-top: 14px; border-top: 2px solid #f2b51c; padding-top: 10px; text-align: center; font-size: 13px; color: #44506a; }
.doc-slogan { color: #2e8b3e; font-weight: 700; margin-bottom: 4px; }
.doc-contacts { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.doc-void { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 64px; font-weight: 900; color: rgba(192, 57, 43, .18);
  border: 6px solid rgba(192, 57, 43, .18); padding: 0 24px; border-radius: 12px; pointer-events: none; white-space: nowrap; }
.doc-actions { margin-top: 12px; }
.doc-pay { margin-top: 8px; }
.doc-pay-title { font-weight: 700; margin-top: 10px; }
.doc-sum .row { padding: 3px 0; }
@media (max-width: 480px) {
  .doc { padding: 16px 12px; font-size: 13px; } .doc-title { text-align: right; } .doc-logo { max-width: 70%; }
  .doc-bank-row { display: grid; grid-template-columns: 1fr auto; row-gap: 2px; }
  .doc-bank-label { grid-column: 1 / -1; font-size: 12px; }
  .doc-bank-val { font-size: 13.5px; }
}

/* =====================================================================
   A4 pages on the letterhead (contracts, invoices, statements, plan)
   ===================================================================== */
body.pp-open #app, body.pp-open #toast:not(.show) { display: none; }
.pp-wrap { position: fixed; inset: 0; z-index: 60; overflow: auto; background: #e6e9ee; -webkit-overflow-scrolling: touch; }
.pp-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px calc(10px) 12px; padding-top: max(10px, env(safe-area-inset-top)); background: #fff; border-bottom: 1px solid var(--line); }
.pp-bar .spacer { flex: 1; }
.pp-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.pp-pages { padding: 8px 0 40px; }
.pp-page { --g: #2e8b3e; --g2: #e9f3ea; --y: #f2b51c; --y2: #fff6dc; --ink: #1f2733; --mut: #5f6d84; --ln: #cfd6df;
  position: relative; width: 210mm; height: 297mm; margin: 0 auto 10px; background: #fff; overflow: hidden; color: var(--ink); zoom: var(--z, 1);
  box-shadow: 0 2px 10px rgba(0,0,0,.12); -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 9.6pt; line-height: 1.75; }
.pp-art { position: absolute; inset: 0; width: 210mm; height: 297mm; font-family: inherit; }
.pp-logo { position: absolute; left: 19mm; top: 10mm; width: 53mm; }
.pp-member { position: absolute; left: 19mm; top: 42.6mm; font-size: 5.6pt; font-weight: 700; color: #3a3f47; line-height: 1.4; }
.pp-addr { position: absolute; right: 57mm; top: 21mm; font-size: 8.4pt; line-height: 2; color: #4b525c; }
.pp-addr b { color: #2c3138; font-weight: 800; }
.pp-meta { position: absolute; right: 13mm; top: 14.5mm; font-size: 8.6pt; line-height: 1; }
.pp-meta div { display: flex; align-items: baseline; gap: 2mm; height: 7.6mm; }
.pp-meta span { color: #8a929e; width: 11mm; }
.pp-meta bdi { min-width: 28mm; border-bottom: .25mm dotted #b9c0ca; padding-bottom: .6mm; font-weight: 700; font-size: 9.4pt; text-align: center; }
.pp-foot { position: absolute; left: 19mm; bottom: 9mm; display: flex; gap: 6mm; font-size: 8pt; color: #6b7380; direction: ltr; line-height: 1; }
.pp-foot span { display: inline-flex; align-items: center; gap: 1.4mm; }
.pp-no { position: absolute; right: 17mm; bottom: 9mm; font-size: 7.6pt; color: #8a929e; display: flex; gap: 2.4mm; align-items: baseline; line-height: 1; }
.pp-iso { direction: ltr; font-family: ui-monospace, Menlo, monospace; font-size: 7pt; color: #6b7380; }
.pp-sign { position: absolute; right: 17mm; bottom: 15mm; display: flex; gap: 4mm; font-size: 7pt; color: #8a929e; line-height: 1.4; }
.pp-sign div { width: 30mm; height: 8mm; border: .25mm dashed #b9c0ca; border-radius: 1.5mm; padding: .8mm 1.5mm; }
.pp-draft { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 40pt; font-weight: 900; color: rgba(192, 57, 43, .13); white-space: nowrap; pointer-events: none; }
/* office paper that already carries the printed letterhead: only number, date, attachment and text are printed */
.pp-pages.paper .pp-art, .pp-pages.paper .pp-logo, .pp-pages.paper .pp-member, .pp-pages.paper .pp-addr, .pp-pages.paper .pp-foot, .pp-pages.paper .pp-meta span { visibility: hidden; }
.pp-pages.paper .pp-meta bdi { border-color: transparent; }
.pp-body { position: absolute; top: 55mm; bottom: 22mm; left: 17mm; right: 17mm; }
.pp-page.compact { font-size: 8.4pt; line-height: 1.5; }
.pp-page.compact .pp-body { top: 52mm; bottom: 26mm; left: 15mm; right: 15mm; }
.pp-ctitle { text-align: center; } .pp-ctitle .bis, .pp-ctitle .ayah { font-size: 8pt; color: var(--mut); line-height: 1.5; }
.pp-ctitle h1 { font-size: 13.5pt; color: var(--g); margin: .5mm 0; font-weight: 900; }
.pp-tags { display: flex; justify-content: center; gap: 3mm; margin-bottom: 1.6mm; }
.pp-chip { border: .35mm solid var(--g); color: var(--g); border-radius: 10mm; padding: .2mm 2.6mm; font-size: 7.8pt; font-weight: 800; white-space: nowrap; }
.pp-chip.y { border-color: var(--y); background: var(--y2); color: #7a5600; }
.pp-body .pp-a { margin: 0 0 1.2mm; text-align: justify; }
.pp-body .pp-a.cont { margin-top: -.9mm; }
.pp-body .pp-a h4 { margin: 0; font-size: 9.2pt; color: var(--g); font-weight: 800; }
.pp-body .pp-a h4::before { content: ""; display: inline-block; width: 2mm; height: 2mm; background: var(--y); border-radius: .5mm; margin-left: 1.6mm; vertical-align: middle; }
.pp-body .pp-a p { margin: 0 0 .3mm; } .pp-body .pp-a ul { margin: 0; padding-right: 4mm; } .pp-body .pp-a li { margin: 0; }
.pp-body .tb { color: #3d4652; } .pp-body .tb b { color: var(--ink); }
.pp-fill { font-weight: 800; color: #12351a; background: linear-gradient(transparent 62%, #fff0c2 62%); padding: 0 .6mm; }
.pp-miss { color: #9aa2ad; letter-spacing: 1px; }
.pp-page:has(.pp-draft) .pp-miss { color: #c0392b; }
.pp-body table { width: 100%; border-collapse: collapse; }
.pp-spec td, .pp-spec th { border: .25mm solid var(--ln); padding: .35mm 1.6mm; font-size: 8.2pt; text-align: right; }
.pp-spec th { background: var(--g2); color: #1d5a28; font-weight: 700; }
.pp-spec td.k { width: 30mm; color: var(--mut); background: #fafbfc; }
.pp-money th { background: var(--g); color: #fff; padding: .7mm 1.5mm; font-size: 8pt; font-weight: 700; border: .25mm solid var(--g); text-align: center; }
.pp-money td { border: .25mm solid var(--ln); padding: .8mm 1.5mm; text-align: center; font-weight: 800; font-size: 8.8pt; }
.pp-money td.hl { background: var(--y2); }
.pp-sub { font-size: 7.6pt; color: var(--mut); text-align: left; }
.pp-csign { display: flex; gap: 6mm; margin-top: 1.5mm; }
.pp-csign div { flex: 1; height: 19mm; border: .3mm solid var(--ln); border-radius: 2.4mm; padding: 2mm 3mm; font-size: 8.4pt; color: var(--mut); }
.pp-csign b { display: block; color: var(--ink); font-size: 9pt; }
.pp-title { display: flex; align-items: center; justify-content: space-between; gap: 4mm; margin-bottom: 3.5mm; }
.pp-title h1 { margin: 0; font-size: 15pt; font-weight: 900; color: var(--g); }
.pp-title h1 small { display: block; font-size: 8.5pt; font-weight: 600; color: var(--mut); }
.pp-rule { height: 1.2mm; background: linear-gradient(to left, var(--g) 0 62%, var(--y) 62% 100%); border-radius: 1mm; margin: 0 0 4mm; }
.pp-info { border: .3mm solid var(--ln); border-radius: 2mm; margin-bottom: 4mm; width: 100%; border-collapse: collapse; }
.pp-info td { padding: 1.4mm 2.6mm; border-bottom: .2mm solid #e6eaf0; font-size: 9pt; vertical-align: top; }
.pp-info td.k { color: var(--mut); width: 22mm; white-space: nowrap; background: #f6f8f5; }
.pp-items th { background: var(--g); color: #fff; font-weight: 700; font-size: 8.6pt; padding: 1.8mm 2mm; text-align: right; }
.pp-items td { padding: 1.6mm 2mm; border-bottom: .2mm solid #e3e7ee; font-size: 9pt; vertical-align: top; }
.pp-items td.c { text-align: center; } .pp-page .n, .doc-sum .n { text-align: left; direction: ltr; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pp-items td.cr { color: #1d7a33; }
.pp-items tbody tr:nth-child(even) td { background: #fafbfc; }
.pp-sum { width: 92mm !important; margin-right: auto; margin-top: 2mm; border-collapse: collapse; }
.pp-sum td { padding: 1.2mm 2mm; font-size: 9pt; border-bottom: .2mm dashed #e3e7ee; }
.pp-sum tr.s td { font-weight: 800; border-top: .4mm solid #c9d1dc; }
.pp-sum tr.pay td { background: var(--y2); font-weight: 900; font-size: 11pt; border-top: .6mm solid var(--y); border-bottom: 0; }
.pp-words { margin: 3mm 0; padding: 2mm 3mm; background: #f4f7f2; border-radius: 2mm; font-size: 9pt; }
.pp-cols { display: flex; gap: 4mm; } .pp-cols > * { flex: 1; }
.pp-box { border: .35mm solid var(--g); border-radius: 2.4mm; padding: 2.4mm 3mm; font-size: 8.8pt; margin-bottom: 2mm; }
.pp-box.y { border-color: var(--y); } .pp-box h3 { margin: 0 0 1mm; font-size: 9pt; color: var(--g); } .pp-box.y h3 { color: #7a5600; }
.pp-box .r { display: flex; justify-content: space-between; gap: 2mm; border-bottom: .2mm dashed #e3e7ee; padding: .6mm 0; }
.pp-mono { font-family: ui-monospace, Menlo, monospace; direction: ltr; font-weight: 700; }
.pp-signs { display: flex; gap: 6mm; margin-top: 4mm; } .pp-signs div { flex: 1; height: 24mm; border: .3mm solid var(--ln); border-radius: 2.4mm; padding: 2mm 3mm; font-size: 8.6pt; color: var(--mut); }
.pp-signs b { display: block; color: var(--ink); }
.pp-stamp { margin-top: 3mm; font-size: 7.8pt; color: #8a929e; text-align: center; }
.screen-doc { padding: 0; }
/* Keep the document itself non-interactive; allow taps only on bank copy values. */
.screen-doc .pp-page { pointer-events: none; }
.screen-doc .pp-copy { pointer-events: auto; cursor: pointer; }
/* installation price quotation (D-103, PY-FO-PC-G10): a livelier page in the letterhead colours */
.iq-hero { display: flex; justify-content: space-between; align-items: stretch; gap: 4mm; margin-bottom: 4mm; padding: 4mm 5mm; border-radius: 3mm;
  background: linear-gradient(120deg, #2e8b3e 0%, #22702f 70%, #1b5e27 100%); color: #fff; }
.iq-hero h1 { margin: .5mm 0 1mm; font-size: 16pt; font-weight: 900; line-height: 1.3; }
.iq-kicker { display: inline-block; background: var(--y); color: #3b2a00; font-weight: 900; font-size: 8pt; padding: .4mm 2.6mm; border-radius: 10mm; }
.iq-hero-s { font-size: 8.4pt; opacity: .92; }
.iq-addr { display: block; font-size: 9pt; font-weight: 700; opacity: 1; margin-bottom: .6mm; }
.iq-addr::before { content: "نشانی پروژه: "; font-weight: 400; opacity: .85; }
.iq-valid { flex: 0 0 auto; min-width: 27mm; background: #fff; color: var(--ink); border-radius: 2.4mm; padding: 2mm 3mm; text-align: center; display: flex; flex-direction: column; justify-content: center; border-bottom: 1.2mm solid var(--y); }
.iq-valid b { font-size: 18pt; color: var(--g); line-height: 1.1; } .iq-valid span { font-size: 7.6pt; font-weight: 800; }
.iq-valid em { font-style: normal; font-size: 6.8pt; color: var(--mut); } .iq-valid i { font-style: normal; font-size: 7pt; color: #7a5600; font-weight: 800; }
.iq-to { font-weight: 900; font-size: 10.5pt; margin-bottom: 1.5mm; }
.iq-lead { margin: 0 0 3mm; text-align: justify; font-size: 10pt; line-height: 1.9; padding-inline-start: 3mm; border-inline-start: 1mm solid var(--y); }
.iq-sec { display: flex; align-items: center; gap: 2mm; margin: 3.5mm 0 2mm; font-size: 10.5pt; font-weight: 900; color: var(--g); }
.iq-sec::after { content: ""; flex: 1; height: .5mm; background: linear-gradient(to left, transparent, var(--g2) 0, var(--g2)); border-radius: 1mm; }
.iq-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2mm; }
.iq-tile { background: var(--g2); border-radius: 2mm; padding: 2mm 2.4mm; display: flex; flex-direction: column; border-top: .9mm solid var(--g); }
.iq-tile span { font-size: 7pt; color: var(--mut); font-weight: 700; } .iq-tile b { font-size: 11.5pt; font-weight: 900; color: #12351a; line-height: 1.35; }
.iq-tile em { font-style: normal; font-size: 7pt; color: var(--mut); }
.iq-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4mm 4mm; margin-bottom: 1.4mm; }
.iq-li { display: flex; gap: 2mm; align-items: flex-start; font-size: calc(8.8pt * var(--fit, 1)); line-height: calc(1.65 * (0.4 + 0.6 * var(--fit, 1))); text-align: justify; }
.iq-fit { row-gap: calc(1.4mm * var(--fit, 1)); }
.iq-n { flex: 0 0 auto; width: 5mm; height: 5mm; border-radius: 50%; background: var(--g); color: #fff; font-size: 7.4pt; font-weight: 800; display: grid; place-items: center; margin-top: .4mm; }
.iq-p { margin: 0 0 2.4mm; text-align: justify; font-size: 9pt; }
.iq-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; margin-bottom: 3mm; }
.iq-opt { border: .35mm solid var(--ln); border-radius: 2.6mm; padding: 2.6mm 3mm; background: #fff; display: flex; flex-direction: column; gap: .8mm; }
.iq-opt.best { border: .6mm solid var(--y); background: var(--y2); }
.iq-opt-h { display: flex; align-items: center; gap: 2mm; font-size: 9.4pt; } .iq-opt-h i { margin-inline-start: auto; font-style: normal; background: var(--y); color: #3b2a00; font-size: 7pt; font-weight: 900; padding: .2mm 2mm; border-radius: 10mm; }
.iq-amt { font-size: 15pt; font-weight: 900; color: var(--g); direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.iq-amt small { font-size: 8pt; color: var(--mut); margin-left: 1mm; }
.iq-words { font-size: 7.6pt; color: #3d4652; } .iq-break { font-size: 7.2pt; color: var(--mut); border-top: .2mm dashed var(--ln); padding-top: .8mm; }
.iq-note { background: var(--y2); border-radius: 2mm; padding: 2mm 3mm; font-size: 8.8pt; margin-bottom: 2mm; border-inline-start: 1mm solid var(--y); }
.iq-cond { font-size: 8.6pt; line-height: 1.75; }
.iq-sign { display: flex; flex-direction: column; align-items: flex-end; margin-top: 4mm; font-size: 9pt; } .iq-sign b { font-size: 12pt; color: var(--g); font-weight: 900; }
.iq-sign em { font-style: normal; font-size: 8pt; color: #7a5600; font-weight: 800; }
.pp-pages.paper .iq-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* daily service plan (D-96) */
.pp-plan { table-layout: fixed; margin: 0; }
.pp-plan + .pp-plan, .pp-blk > .pp-plan { margin-top: -1px; }
.pp-plan td { vertical-align: top; height: 11mm; word-break: break-word; }
.pp-plan .small { font-size: 8.5pt; color: #444; }
/* monthly archive (D-92): offscreen render stage */
.pp-stage { position: fixed; top: 0; left: -12000px; width: 820px; pointer-events: none; }
.pp-stage .pp-pages { --z: 1; }

/* ---------- print ---------- */
@page { size: A4; margin: 0; }

/* ---------- installation project control (D-105): stage rows, progress strip, matrix */
.stg { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--line); }
.stg-no { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: .85rem; }
.stg-t { flex: 1; min-width: 0; }
.mx-strip { display: grid; grid-template-columns: repeat(15, 1fr); gap: 3px; margin: 8px 0 4px; }
.mx-strip i { height: 8px; border-radius: 3px; }
.mx-no { background: var(--line); }
.mx-on { background: var(--info); }
.mx-ok { background: var(--ok); }
.mx-bad { background: var(--danger); }
.mx-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 10px; }
.mx-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mx-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.mx-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
table.mx { border-collapse: collapse; width: 100%; font-size: .8rem; }
table.mx th, table.mx td { padding: 8px 1px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.mx thead th { font-size: .7rem; }
table.mx thead th { font-weight: 600; color: var(--muted); }
table.mx th[scope="row"], table.mx thead th:first-child { position: sticky; right: 0; background: var(--surface); text-align: right; min-width: 96px; max-width: 150px; white-space: normal; z-index: 1; padding-inline: 8px; }
table.mx td i { display: inline-block; width: 13px; height: 13px; border-radius: 4px; vertical-align: middle; }
table.mx .mx-p { color: var(--text); }
.mx-dlv { outline: 2px solid var(--warn); outline-offset: 1px; }
.goods-wait { margin: 8px 0 2px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-inline-start: 3px solid var(--warn); }
.sched-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 6px; text-align: center; }
.sched-nums b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.sched-nums span { font-size: .72rem; color: var(--muted); }
svg.ch { width: 100%; max-width: 460px; height: auto; display: block; margin: 0 auto; direction: ltr; }
.sched-nums { max-width: 460px; margin-inline: auto; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-ax { fill: var(--muted); font-size: 10px; font-family: inherit; }
.ch-plan { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 4; }
.ch-act { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.ch-dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.ch-today { stroke: var(--warn-ink); stroke-width: 1.5; }
.ch-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend i { width: 18px; height: 0; display: inline-block; border-top: 3px solid var(--brand); }
.ch-legend i.lg-plan { border-top: 2px dashed var(--muted); }
table.mx tbody tr.tap:hover td, table.mx tbody tr.tap:hover th { background: var(--surface-2); }


/* ---------- online control forms (D-106) */
.if-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.if-row.col { flex-direction: column; align-items: stretch; }
.if-row > * { min-width: 0; max-width: 100%; }
#if-form .card { min-width: 0; overflow: hidden; }
.card > .if-row:first-of-type { border-top: 0; }
.if-l { flex: 1 1 160px; font-size: .9rem; line-height: 1.6; }
.if-in { display: flex; align-items: center; gap: 6px; flex: 0 1 200px; }
.if-in input { min-width: 0; }
.if-u { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.if-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.if-chips.col { flex-direction: column; }
.if-chips button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: .85rem; min-height: 36px; }
.if-chips button.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.if-chips button.bad.on { background: var(--danger); border-color: var(--danger); }
.if-chips button:disabled { opacity: .75; }
.if-note { font-size: .85rem; color: var(--muted); line-height: 1.8; padding: 6px 0; }
.if-n { width: 56px; display: inline-block; margin-inline-start: 6px; }
.if-tw { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.if-t { border-collapse: collapse; font-size: .78rem; }
table.if-t th, table.if-t td { border: 1px solid var(--line); padding: 3px; text-align: center; }
table.if-t th:first-child { white-space: nowrap; padding-inline: 6px; }
table.if-t td input, table.if-t td select { width: 64px; min-height: 32px; padding: 2px 4px; font-size: .8rem; }
.if-li { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.if-li span { width: 20px; color: var(--muted); font-size: .8rem; }
.if-ser { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 6px 0; border-top: 1px dashed var(--line); }
.ip-find { margin: 6px 0 4px; }
.ip-find input { width: 100%; }
.cl-row { padding: 8px; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cl-row .row { margin-top: 6px; gap: 6px; }
.cl-row .row input { flex: 1; min-width: 0; }
.cl-foot { justify-content: space-between; align-items: center; }
/* printed form */
.if-ph h1 { font-size: 15pt; margin: 0 0 2px; }
table.if-pt { width: 100%; border-collapse: collapse; font-size: 9pt; margin: 3px 0; }
table.if-pt th, table.if-pt td { border: 1px solid #9aa5a0; padding: 2px 5px; text-align: center; }
table.if-pt.if-meta td { text-align: right; }
table.if-pt td.n { width: 22px; }
.if-ps h3 { font-size: 10.5pt; margin: 6px 0 2px; display: flex; gap: 6px; align-items: center; }
.if-ps h3 span { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: #2e8b3e; color: #fff; font-size: 8pt; }
.if-pr { display: flex; justify-content: space-between; gap: 8px; font-size: calc(9pt * var(--fit, 1)); padding: 1.5px 0; border-bottom: 1px dotted #c9d1cd; }
.if-po { display: flex; gap: 8px; flex-wrap: wrap; }
.if-po i { font-style: normal; color: #6b7a74; white-space: nowrap; }
.if-po i.on { color: #0f172a; font-weight: 700; }
.if-pn { font-size: calc(8.5pt * var(--fit, 1)); line-height: 1.7; margin: 3px 0; }
.if-blank { display: inline-block; min-width: 40px; border-bottom: 1px dotted #9aa5a0; }
.if-psig { display: flex; gap: 10px; margin-top: 10px; }
.if-psig > div { flex: 1; border: 1px solid #9aa5a0; border-radius: 6px; padding: 6px; min-height: 64px; font-size: 9pt; display: flex; flex-direction: column; gap: 2px; }
.if-psig span { margin-top: auto; color: #6b7a74; font-size: 8pt; }


/* ---------- graphic progress and project report (D-108) */
.ring .rg-pending { stroke: var(--line); } .ring .rg-in_progress { stroke: var(--info); } .ring .rg-approved { stroke: var(--ok); } .ring .rg-rejected { stroke: var(--danger); }
.ring-v { font-size: 20px; font-weight: 800; fill: var(--text); font-family: inherit; }
.ring-l { font-size: 9px; fill: var(--muted); font-family: inherit; }
.pr-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 700px) { .pr-grid { grid-template-columns: 1fr 1fr; gap: 0 12px; } }
.pr-card { display: flex; align-items: center; gap: 12px; }
.pr-card svg { flex: none; }
.pr-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pr-t .badge { align-self: flex-start; white-space: normal; }
.rp-h h1 { font-size: 15pt; margin: 0 0 2px; }
.rp-sum { display: flex; gap: 14px; align-items: center; margin: 8px 0; padding: 8px; border: 1px solid #c9d1cd; border-radius: 8px; }
.rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; flex: 1; font-size: 9pt; }
.rp-kv { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px dotted #c9d1cd; padding: 2px 0; }
.rp-kv span { color: #4b5a6b; }
.rp-unit { border: 1px solid #c9d1cd; border-radius: 8px; padding: 6px 8px; margin: 6px 0; }
.rp-uh { display: flex; gap: 10px; align-items: center; }
.rp-uh h3 { margin: 0; font-size: 11pt; }
table.rp-st td { font-size: calc(8.5pt * var(--fit, 1)); padding: 1px 4px; }
.rp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px; vertical-align: middle; }
.rp-note { font-size: 8.5pt; margin-top: 4px; line-height: 1.7; }


/* ---------- section switches inside installation pages (D-109) */
.ip-tabs { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 10px 0; padding-bottom: 2px; scrollbar-width: none; }
.ip-tabs::-webkit-scrollbar { display: none; }
.ip-tabs button { flex: 1 0 auto; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: 10px 14px; font: inherit; font-size: .9rem; font-weight: 600; white-space: nowrap; min-height: 44px; }
.ip-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ip-tabs button span { font-weight: 400; opacity: .8; margin-inline-start: 4px; }


/* ---------- quick note for next month's service on the dashboard (D-111) */
.note-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 10px 0 4px; padding: 14px 16px; border-radius: 16px; border: 0;
  background: linear-gradient(180deg, #2f9142, #1f6a2c); color: #fff; font: inherit; font-size: 1.05rem; font-weight: 800; text-align: right; box-shadow: 0 6px 16px rgba(31, 106, 44, .28); cursor: pointer; }
.note-cta span { font-size: .78rem; font-weight: 400; opacity: .9; }

@media print {
  body { background: #fff !important; }
  .topbar, .tabbar, .no-print, #toast, .sheet-backdrop, .side-brand, .side-foot, .refresh-btn, .page-credit, .pp-bar, a[data-act="back"] { display: none !important; }
  .topbar, main { margin-right: 0 !important; }
  main#view, .doc-page { padding: 0 !important; margin: 0 !important; max-width: none; }
  .doc { box-shadow: none; border-radius: 0; padding: 0; border-top: 0; }
  .doc-items th, .doc-items tfoot tr.doc-payable td, .doc-info th, .doc-words { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.pp-open { background: #fff; }
  body.pp-open .pp-wrap { position: static; overflow: visible; background: #fff; }
  .pp-pages { padding: 0; }
  .pp-page { zoom: 1 !important; margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  .pp-page:last-child { break-after: auto; page-break-after: auto; }
  .doc-page .screen-doc .pp-page { zoom: 1 !important; }
}


/* Public proforma: brand-led responsive reading layout; A4 remains the print source. */
.ppm-view { display: none; }
@media screen and (max-width: 640px) {
  .doc-page .screen-doc { padding: 0 0 18px; background: #f1f4f1; }
  .doc-page .screen-doc > .pp-page { visibility: hidden; position: absolute; left: -10000px; }
  .doc-page .screen-doc > .ppm-view { display: block; }
  .ppm-view { --pm-g:#2e8b3e; --pm-gd:#1b5e27; --pm-y:#f2b51c; --pm-ink:#1f2733; width:100%; max-width:680px; margin:0 auto; padding:12px 12px 22px; color:var(--pm-ink); background:#f1f4f1; font-size:14px; line-height:1.85; overflow-wrap:anywhere; }
  .ppm-head { position:relative; overflow:hidden; background:#fff; border:1px solid #dce6dc; border-radius:15px; margin-bottom:13px; box-shadow:0 5px 18px rgba(28,75,38,.08); }
  .ppm-head::before { content:""; display:block; height:6px; background:linear-gradient(to left,var(--pm-g) 0 68%,var(--pm-y) 68% 100%); }
  .ppm-brandbar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:13px 15px 10px; border-bottom:1px solid #edf1ed; }
  .ppm-brand { display:flex; align-items:center; gap:10px; min-width:0; color:var(--pm-g); }
  .ppm-brand img { width:54px; height:40px; object-fit:contain; }
  .ppm-brand b { display:block; font-size:19px; font-weight:900; line-height:1.35; letter-spacing:-.4px; }
  .ppm-brand small { display:block; color:#65736a; font-size:10px; font-weight:700; white-space:nowrap; }
  .ppm-brandbar .pp-chip { flex:none; font-size:11px; padding:4px 10px; }
  .ppm-head-main { position:relative; padding:17px 16px 15px; background:linear-gradient(135deg,#f5faf5 0%,#fff 66%); }
  .ppm-head-main::after { content:""; position:absolute; left:0; bottom:0; width:34%; height:3px; background:var(--pm-y); }
  .ppm-eyebrow { color:#829087; font-size:9px; font-weight:800; letter-spacing:1.1px; direction:ltr; text-align:right; }
  .ppm-head h1 { margin:3px 0 4px; color:var(--pm-gd); font-size:22px; line-height:1.55; font-weight:900; }
  .ppm-docno { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:6px; background:#e9f3ea; color:#315c38; font-size:12px; font-weight:700; }
  .ppm-docno bdi { font-weight:900; }
  .ppm-head-main p { margin:9px 0 0; color:#68766d; font-size:11px; display:flex; flex-wrap:wrap; align-items:center; gap:5px; }
  .ppm-head-main p i { width:4px; height:4px; border-radius:50%; background:var(--pm-y); display:inline-block; margin:0 3px; }
  .ppm-head-foot { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:8px 15px; background:#f8faf8; color:#6e7a71; font-size:9px; }
  .ppm-head-foot b { direction:ltr; color:var(--pm-g); white-space:nowrap; }
  .ppm-section { position:relative; background:#fff; border:1px solid #dfe7df; border-radius:13px; padding:14px; margin:0 0 12px; min-width:0; box-shadow:0 2px 8px rgba(31,65,37,.035); }
  .ppm-section h2 { display:flex; align-items:center; gap:8px; font-size:15px; color:var(--pm-gd); font-weight:900; margin:0 0 11px; padding-bottom:8px; border-bottom:1px solid #e8eee8; }
  .ppm-section h2::before { content:""; width:4px; height:17px; border-radius:4px; background:var(--pm-y); flex:none; }
  .ppm-kv { display:grid; grid-template-columns:minmax(88px,.7fr) minmax(0,1.5fr); gap:8px 10px; font-size:13px; }
  .ppm-kv span { color:#718076; }
  .ppm-kv b { min-width:0; overflow-wrap:anywhere; color:#26352a; }
  .ppm-item { padding:11px 0; border-bottom:1px solid #edf1ed; }
  .ppm-item:last-child { border-bottom:0; padding-bottom:0; }
  .ppm-item-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
  .ppm-item-head b { flex:1; min-width:0; font-size:13px; color:#26352a; }
  .ppm-item-head strong { flex:none; direction:rtl; text-align:left; font-size:13px; color:var(--pm-gd); font-variant-numeric:tabular-nums; }
  .ppm-item-head small { font-size:10px; font-weight:600; }
  .ppm-item-meta { display:flex; flex-wrap:wrap; gap:3px 12px; color:#718076; font-size:11px; margin-top:5px; }
  .ppm-totals > div { display:flex; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px dashed #dfe7df; font-size:13px; }
  .ppm-totals > div b { text-align:left; direction:rtl; font-variant-numeric:tabular-nums; }
  .ppm-totals .ppm-grand { background:linear-gradient(110deg,#fff8e3,#fff2c7); border:1px solid var(--pm-y); border-right:4px solid var(--pm-g); border-radius:9px; padding:12px 10px; margin-top:9px; font-weight:900; color:#4c3a08; }
  .ppm-words { background:#edf5ed; border-right:3px solid var(--pm-g); border-radius:8px; padding:10px; margin:10px 0 0; font-size:12px; }
  .ppm-view .pp-box { font-size:13px; margin:0; padding:11px; border:1px solid var(--pm-g); border-radius:10px; background:linear-gradient(145deg,#fff,#f6faf6); }
  .ppm-view .pp-box h3 { font-size:14px; font-weight:900; }
  .ppm-view .pp-box .r { align-items:flex-start; flex-wrap:wrap; gap:5px 12px; padding:8px 0; }
  .ppm-view .pp-copy { overflow-wrap:anywhere; text-align:left; color:var(--pm-gd); }
  .ppm-conditions { margin:0; padding-right:22px; font-size:12px; }
  .ppm-conditions li { padding:4px 0; }
  .ppm-sign { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
  .ppm-sign div { min-height:88px; background:linear-gradient(145deg,#fff,#fafcfa); border:1px dashed #aebdaf; border-top:3px solid var(--pm-g); border-radius:9px; padding:10px; font-size:12px; }
  .ppm-sign div:last-child { border-top-color:var(--pm-y); }
  .ppm-sign b, .ppm-sign span { display:block; }
  .ppm-sign b { color:#304d35; }
  .ppm-sign span { color:#718076; margin-top:6px; }
  .doc-page .doc-actions { padding:0 14px; }
  .doc-page > .hint { margin:8px 14px 18px; }
}
@media print {
  .doc-page .screen-doc > .ppm-view { display:none !important; }
  .doc-page .screen-doc > .pp-page { display:block !important; visibility:visible !important; position:relative !important; left:auto !important; }
  /* The mobile view is the final sibling in the DOM; the last A4 page is therefore not :last-child. */
  .doc-page .screen-doc > .pp-page:has(+ .ppm-view) { break-after:auto !important; page-break-after:auto !important; }
}
