@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }

/* رنگ‌های برند (لوگو): سبز تیره و طلایی */
:root {
  --brand: #0F4C4A; --brand-2: #156B67; --brand-3: #1D8077; --gold: #E2BE5C; --gold-text: #F2D27A; --gold-dark: #B7791F;
  --bg: #F3F6F5; --card: #fff; --ink: #10201F; --muted: #6A7B79; --soft: #E6F2F0; --line: #EEF2F1;
  --warn-bg: #FBF1DA; --ok: #2E7D5B; --ok-bg: #E3F4EC; --err: #C0392B;
  --r: 20px; --shadow: 0 1px 3px rgba(16,32,31,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-feature-settings: "tnum"; white-space: nowrap; }

/* ---------- سربرگ ---------- */
header#top { display: flex; align-items: center; gap: 12px; padding: 16px 20px 4px; padding-top: calc(16px + env(safe-area-inset-top)); max-width: 640px; margin: 0 auto; }
header#top img { width: 40px; height: 40px; }
header .who { flex: 1; min-width: 0; }
header .who small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .who b { font-size: 16px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; border: 0; background: var(--card); color: var(--brand); font-size: 18px; box-shadow: var(--shadow); cursor: pointer; }

main { padding: 8px 20px 0; max-width: 640px; margin: 0 auto; }

/* ---------- کارت اصلی ---------- */
.hero { margin-top: 12px; border-radius: 24px; padding: 20px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 60%, var(--brand-3) 100%); box-shadow: 0 10px 30px rgba(15,76,74,.25); }
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; left: -70px; top: -100px; background: rgba(226,190,92,.18); pointer-events: none; }
.hero small { opacity: .82; font-size: 13px; }
.hero .big { font-size: clamp(22px, 7.2vw, 34px); font-weight: 700; margin: 2px 0; letter-spacing: -.3px; position: relative; }
.hero .big span { font-size: 15px; font-weight: 400; opacity: .85; margin-right: 6px; }
.hero .sub { display: flex; gap: 22px; margin-top: 12px; font-size: 12.5px; flex-wrap: wrap; position: relative; }
.hero .sub div { opacity: .92; }
.hero .sub b { display: block; font-size: 14.5px; color: var(--gold-text); }

/* ---------- میان‌برها ---------- */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 18px; }
.quick button { border: 0; background: none; text-align: center; font-size: 12px; color: #34504E; padding: 0; cursor: pointer; }
.quick i { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 6px; border-radius: 18px; background: var(--card);
  font-style: normal; font-size: 22px; color: var(--brand); box-shadow: 0 2px 8px rgba(17,75,74,.08); }

/* ---------- عنوان بخش ---------- */
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 2px 10px; }
.sec h3 { margin: 0; font-size: 16px; }
.sec button { border: 0; background: none; color: var(--brand-3); font-size: 13px; padding: 0; cursor: pointer; }

/* ---------- فهرست ---------- */
.list { background: var(--card); border-radius: var(--r); padding: 2px 16px; box-shadow: var(--shadow); }
.item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.list.tap .item, .item.tap { cursor: pointer; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; color: var(--brand); background: var(--soft); font-size: 17px; }
.avatar.warn { color: var(--gold-dark); background: var(--warn-bg); }
.avatar.ok { color: var(--ok); background: var(--ok-bg); }
.item .t { flex: 1; min-width: 0; }
.item .t b { font-size: 15px; display: block; overflow-wrap: anywhere; }
.item .t small { color: var(--muted); font-size: 12.5px; display: block; overflow-wrap: anywhere; }
.item .v { text-align: left; font-weight: 700; font-size: 14px; flex: none; }
.item .v small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.item .v.warn { color: var(--gold-dark); }
.item .v.ok { color: var(--ok); }
.chev { color: #B5C2C0; flex: none; }
.pill { display: inline-block; border-radius: 99px; padding: 1px 10px; font-size: 12px; background: var(--soft); color: var(--brand); font-weight: 700; }
.pill.warn { background: var(--warn-bg); color: var(--gold-dark); }
.pill.muted { background: #EEF1F0; color: var(--muted); font-weight: 400; }
.empty { text-align: center; color: var(--muted); padding: 30px 12px; font-size: 14px; }
.note { color: var(--muted); font-size: 12.5px; margin: 8px 4px; }

/* ---------- کارت ساده ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-top: 12px; }
.card h2 { font-size: 17px; margin: 0 0 2px; }
.card .meta { color: var(--muted); font-size: 13px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; }
.kv span:first-child { color: var(--muted); }

/* ---------- بازگشت ---------- */
.back { border: 0; background: none; color: var(--brand-3); padding: 6px 0 0; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }

/* ---------- فرم ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 2px 6px; }
input, select, textarea { width: 100%; padding: 13px 14px; border: 1.5px solid #E1E8E6; border-radius: 14px; background: #fff; outline: none; font-size: 15px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-3); box-shadow: 0 0 0 4px rgba(29,128,119,.12); }
input.ltr { direction: ltr; text-align: right; }
.search { position: relative; margin-top: 12px; }
.search input { padding-right: 44px; background: var(--card); border-color: transparent; box-shadow: var(--shadow); }
.search::before { content: "⌕"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; }
.btn { border: 0; border-radius: 16px; padding: 14px 16px; font-weight: 700; font-size: 15px; cursor: pointer; background: var(--soft); color: var(--brand); width: 100%; }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(15,76,74,.22); }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn:disabled { opacity: .55; }
.btns { display: flex; gap: 10px; margin-top: 16px; }
.btns > * { flex: 1; }
a.btn { display: block; text-align: center; text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1.5px solid #E1E8E6; background: #fff; border-radius: 99px; padding: 7px 14px; cursor: pointer; font-size: 14px; }
.chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.error { color: var(--err); font-size: 14px; margin-top: 12px; }
.error:empty { display: none; }

/* ---------- ورود ---------- */
.login { max-width: 400px; margin: 0 auto; padding-top: 6vh; }
.login .brand { text-align: center; margin-bottom: 18px; }
.login .brand img { width: 84px; height: 84px; }
.login .brand h1 { font-size: 22px; margin: 6px 0 0; }
.login .brand p { color: var(--muted); margin: 2px 0 0; font-size: 14px; }
.login .card { padding: 20px; }

/* ---------- منوی پایین ---------- */
nav#tabs { position: fixed; z-index: 10; bottom: calc(12px + env(safe-area-inset-bottom)); inset-inline: 16px; max-width: 608px; margin: 0 auto;
  background: var(--ink); border-radius: 22px; display: flex; padding: 7px; box-shadow: 0 10px 30px rgba(16,32,31,.25); }
nav#tabs button { flex: 1; border: 0; background: none; color: #9FB3B0; font-size: 11px; padding: 6px 0; border-radius: 16px; cursor: pointer; }
nav#tabs button i { display: block; font-style: normal; font-size: 18px; line-height: 1.3; }
nav#tabs button.on { background: var(--gold); color: var(--ink); font-weight: 700; }

/* ---------- عکس‌ها ---------- */
.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.thumb { position: relative; border-radius: 16px; overflow: hidden; background: #DCE6E4; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { position: absolute; inset-inline: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: 11px; padding: 14px 6px 4px;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview { width: 100%; max-height: 42vh; object-fit: contain; border-radius: 16px; background: #0C1716; display: block; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress div { height: 100%; width: 0; background: var(--brand-3); transition: width .2s; }
.viewer { position: fixed; inset: 0; z-index: 30; background: #050A09; display: flex; flex-direction: column; color: #fff; }
.viewer .bar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top)); }
.viewer .bar div { flex: 1; min-width: 0; font-size: 13px; }
.viewer .bar small { display: block; opacity: .7; }
.viewer .bar button { border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 12px; padding: 8px 14px; cursor: pointer; }
.viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }

/* ---------- جدول گزارش ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { background: #F6F9F8; color: var(--muted); font-weight: 700; position: sticky; top: 0; }
tfoot td { font-weight: 700; background: #FBF6E8; }

#toast { position: fixed; inset-inline: 20px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 40; background: var(--ink); color: #fff;
  padding: 12px 16px; border-radius: 16px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: 600px; margin: 0 auto; }
.spinner { width: 30px; height: 30px; border: 3px solid #DCE6E4; border-top-color: var(--brand-3); border-radius: 50%; margin: 48px auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- چیدمان‌های چندستونه (روی گوشی یک ستون) ---------- */
.top-row, .cols, .split { display: block; }
.block { margin-top: 0; }

/* ======================================================================
   نمایش کامپیوتر (صفحه پهن): منوی کناری، چند ستون، دو بخشی — نه همان صفحه گوشی پهن‌تر
   ====================================================================== */
@media (min-width: 960px) {
  body { padding-bottom: 0; padding-right: 248px; font-size: 14.5px; }
  header#top, main { max-width: 1180px; }
  header#top { padding: 22px 32px 6px; }
  main { padding: 6px 32px 40px; }

  nav#tabs { inset: 0 0 0 auto; width: 248px; max-width: none; margin: 0; border-radius: 0;
    flex-direction: column; justify-content: flex-start; gap: 4px; padding: 96px 16px 20px; box-shadow: none;
    background: linear-gradient(180deg, var(--ink) 0%, #0C2A28 100%); }
  nav#tabs::before { content: "کیمیاگران بیمه"; position: absolute; top: 28px; right: 70px; color: #fff; font-weight: 700; font-size: 17px; }
  nav#tabs::after { content: ""; position: absolute; top: 20px; right: 20px; width: 42px; height: 42px; background: url(logo.png) center / contain no-repeat; }
  nav#tabs button { flex: none; display: flex; align-items: center; gap: 12px; text-align: right; font-size: 15px; padding: 12px 16px; border-radius: 14px; }
  nav#tabs button i { font-size: 18px; width: 22px; text-align: center; }
  nav#tabs button:not(.on):hover { background: rgba(255,255,255,.06); color: #fff; }
  nav#tabs[hidden] + #toast { bottom: 24px; }
  #toast { bottom: 24px; inset-inline-start: auto; inset-inline-end: 280px; max-width: 420px; }

  .hero { margin-top: 0; padding: 26px 28px; }
  .hero .big { font-size: 36px; }
  .top-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; margin-top: 12px; align-items: stretch; }
  .top-row .quick { margin-top: 0; grid-template-columns: repeat(2, 1fr); gap: 12px; align-content: stretch; }
  .top-row .quick button { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 14px 8px; font-size: 13.5px; }
  .top-row .quick button:hover { box-shadow: 0 6px 18px rgba(17,75,74,.12); }
  .top-row .quick i { box-shadow: none; background: var(--soft); width: 48px; height: 48px; border-radius: 16px; }

  .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 0 22px; align-items: start; }
  .split { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 12px; }
  .split > .side { position: sticky; top: 16px; }
  .split > .side > .card:first-child, .split > .side > .hero:first-child { margin-top: 0; }
  .split > .side .hero .big { font-size: clamp(22px, 7.2vw, 34px); }
  .split .sec:first-child { margin-top: 0; }

  .list.wide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; padding: 2px 20px; }
  .list.wide .item:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .item.tap:hover .t b { color: var(--brand-3); }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .preview { max-height: 70vh; }
  .search { max-width: 560px; }

  .login-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; margin: -6px -32px 0; }
  .login-wrap .panel { display: flex; flex-direction: column; justify-content: center; padding: 60px; color: #fff;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 60%, var(--brand-3) 100%); position: relative; overflow: hidden; }
  .login-wrap .panel::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; left: -140px; bottom: -160px; background: rgba(226,190,92,.16); }
  .login-wrap .panel img { width: 96px; height: 96px; filter: drop-shadow(0 6px 16px rgba(0,0,0,.25)); }
  .login-wrap .panel h1 { font-size: 34px; margin: 18px 0 6px; }
  .login-wrap .panel p { font-size: 16px; opacity: .85; margin: 0 0 6px; }
  .login-wrap .login { display: flex; flex-direction: column; justify-content: center; padding: 40px; }
  .login-wrap .login .brand { display: none; }
  body.signed-out { padding-right: 0; }
}
@media (max-width: 959px) { .login-wrap .panel { display: none; } }

/* ---------- جدول‌های مثل برنامه (حساب بیمه‌ها و ...) ---------- */
.segment { display: flex; background: #E3EBE9; border-radius: 16px; padding: 4px; margin-top: 12px; gap: 4px; }
.segment button { flex: 1; border: 0; background: none; border-radius: 12px; padding: 10px; font-weight: 700; color: var(--muted); cursor: pointer; }
.segment button.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }
.card.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.card.filters .f-company, .card.filters .f-btn { grid-column: 1 / -1; }
.card.filters label { margin-top: 8px; }
.card.filters .f-btn .btn { margin-top: 14px; }
.card.totals { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card.totals b { font-size: 18px; color: var(--brand); }
.tiles4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.tile { background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.tile small { display: block; color: var(--muted); font-size: 12px; }
.tile b { display: block; font-size: 16px; overflow-wrap: anywhere; }
.tile.gold { background: linear-gradient(135deg, var(--brand), var(--brand-3)); color: #fff; }
.tile.gold small { color: rgba(255,255,255,.8); }
.tile.gold b { color: var(--gold-text); }
table.grid td.num, table.grid th.num { text-align: left; }
table.grid td.ok { color: var(--ok); }
table.grid td.err { color: var(--err); }
table.grid td.warn { color: var(--gold-dark); }
table.grid td.strong { font-weight: 700; }
table.grid td.link { color: var(--brand-3); font-weight: 700; }
table.grid tr.tap { cursor: pointer; }
table.grid tr.tap:hover td { background: #F4FAF8; }
table.grid tr.carry td { background: #FBF6E8; font-style: italic; }
table.grid tbody tr:nth-child(even) td { background: #FAFCFB; }
@media (min-width: 960px) {
  .card.filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }
  .card.filters .f-company, .card.filters .f-btn { grid-column: auto; }
  .card.filters .f-btn .btn { margin-top: 0; padding: 13px 28px; }
  .tiles4 { grid-template-columns: repeat(4, 1fr); }
  .segment { max-width: 420px; }
  table.grid { font-size: 13.5px; }
}
.thumb em.phone-tag { position: absolute; top: 6px; left: 6px; font-style: normal; font-size: 13px; background: rgba(255,255,255,.9); border-radius: 8px; padding: 1px 5px; }
.viewer .bar button.danger { background: rgba(192,57,43,.85); }
@media (max-width: 420px) { nav#tabs button { font-size: 10px; padding: 6px 0; } nav#tabs { inset-inline: 10px; padding: 6px; } .segment button { font-size: 12.5px; padding: 9px 4px; } }
/* منوی «بیشتر» گوشی */
nav#tabs { position: fixed; }
nav#tabs button.extra { display: none; }
.more-sheet { position: absolute; bottom: calc(100% + 10px); inset-inline-end: 0; min-width: 190px; background: var(--ink); border-radius: 18px; padding: 8px;
  box-shadow: 0 10px 30px rgba(16,32,31,.3); display: flex; flex-direction: column; gap: 2px; }
nav#tabs .more-sheet button { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 12px 14px; text-align: right; }
nav#tabs .more-sheet button i { display: inline; font-size: 17px; }
@media (min-width: 960px) {
  nav#tabs button.extra { display: flex; }
  nav#tabs button.more, .more-sheet { display: none !important; }
}
/* دکمه خروج: آیکن SVG (نماد متنی در بعضی گوشی‌ها مربع دیده می‌شد) */
.logout-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--card); color: var(--err); border-radius: 14px;
  padding: 10px 14px; font-size: 13.5px; font-weight: 700; box-shadow: var(--shadow); cursor: pointer; flex: none; }
.logout-btn svg { transform: scaleX(-1); }
.logout-btn:active { background: #FBECEA; }
nav#tabs button i, .quick i { display: grid; place-items: center; } nav#tabs button i svg { display: block; margin: 0 auto 2px; } @media (min-width: 960px) { nav#tabs button i svg { margin: 0; } } .more-sheet button i svg { margin: 0; }
/* نوشتار پالمر (خطوط واقعی): بالا راست ┘، بالا چپ └، پایین راست ┐، پایین چپ ┌ */
table.palmer { display: inline-table; border-collapse: collapse; width: auto; font-size: 13px; line-height: 1.15; vertical-align: middle; margin: 1px 0; direction: ltr; }
table.palmer td { padding: 1px 4px; border: 0; background: none !important; white-space: nowrap; font-weight: 700; font-feature-settings: "tnum"; letter-spacing: 1px; }
table.palmer td.q.ur { text-align: right; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; }
table.palmer td.q.ul { text-align: left; border-left: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; }
table.palmer td.q.lr { text-align: right; border-right: 1.6px solid currentColor; border-top: 1.6px solid currentColor; }
table.palmer td.q.ll { text-align: left; border-left: 1.6px solid currentColor; border-top: 1.6px solid currentColor; }
table.palmer td.e { padding: 0; min-width: 0; }
.item .t small table.palmer, .meta table.palmer { font-size: 12px; }
