@font-face { font-family: Nian; src: url(/fonts/Nian-Regular.ttf) format('truetype'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2011, U+066A-066D; font-weight: 400; font-display: swap; }
@font-face { font-family: Nian; src: url(/fonts/Nian-Bold.ttf) format('truetype'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2011, U+066A-066D; font-weight: 700; font-display: swap; }
@font-face { font-family: Nian; src: url(/fonts/Nian-ExtraBold.ttf) format('truetype'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2011, U+066A-066D; font-weight: 800; font-display: swap; }
@font-face { font-family: Nian; src: url(/fonts/Nian-Black.ttf) format('truetype'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2011, U+066A-066D; font-weight: 900; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(/fonts/vazirmatn-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(/fonts/vazirmatn-latin-700-normal.woff2) format('woff2'); font-weight: 700 900; font-display: swap; }
@font-face { font-family: Corm; src: url(/fonts/cormorant-garamond-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Corm; src: url(/fonts/cormorant-garamond-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --em-900: #0B2E2A; --em-800: #0E3B36; --em-700: #145248; --em-600: #1C6658; --em-100: #E3EEEA; --em-50: #F0F6F3;
  --gold: #C9A45C; --gold-light: #F3DEA2; --gold-dark: #A97E32; --gold-50: #FAF3E2;
  --bg: #F6F1E7; --card: #FFFFFF; --ink: #1B2A27; --muted: #6E7C78; --line: #E9E2D4;
  --green: #1E8449; --green-50: #E6F4EC; --amber: #B9770E; --amber-50: #FCF1DE; --red: #C0392B; --red-50: #FBE9E7; --grey-50: #F0EFEC;
  --radius: 18px; --shadow: 0 6px 22px rgba(14, 59, 54, .08);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: Nian, Vazirmatn, system-ui, sans-serif; font-size: 16px; line-height: 1.7; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.ltr { direction: ltr; unicode-bidi: isolate; font-family: Vazirmatn, Nian, sans-serif; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
#view { padding-bottom: calc(92px + var(--safe-b)); }
.page { padding: 0 16px; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; direction: ltr; }
.brand img { width: 42px; height: 42px; }
.brand .bt { display: flex; flex-direction: column; line-height: 1; font-family: Corm, serif; }
.brand .bn { font-weight: 700; font-size: 19px; letter-spacing: .1em; color: var(--gold-light); white-space: nowrap; }
.brand .bs { font-weight: 700; font-size: 10.5px; letter-spacing: .5em; color: var(--gold); margin-top: 5px; }
.powered { font-family: Corm, serif; direction: ltr; text-align: center; color: var(--muted); line-height: 1.15; }
.powered small { display: block; font-weight: 600; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; }
.powered b { display: block; font-weight: 700; font-size: 21px; letter-spacing: .05em; color: var(--em-800); margin-top: 3px; }
.auth .powered b { color: var(--gold-light); }

/* ---------- top bars ---------- */
.hero { position: relative; background: radial-gradient(120% 90% at 70% 0%, #1C6658 0%, var(--em-800) 45%, var(--em-900) 100%); color: #fff; padding: calc(18px + var(--safe-t)) 20px 86px; overflow: hidden; border-radius: 0 0 28px 28px; }
.hero .sky { position: absolute; inset: auto 0 0 0; height: 70%; background: url(/icons/skyline.svg) center bottom / cover no-repeat; opacity: .32; pointer-events: none; }
.hero .hello { position: relative; margin-top: 22px; }
.hero h1 { margin: 0; font-weight: 900; font-size: 26px; }
.hero .today { color: var(--gold-light); opacity: .85; font-size: 14px; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--em-800); color: #fff; padding: calc(12px + var(--safe-t)) 14px 12px; display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.topbar h2 { margin: 0; font-size: 18px; font-weight: 800; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand img { width: 30px; height: 30px; }
.topbar .brand .bn { font-size: 12.5px; letter-spacing: .08em; }
.topbar .brand .bs { font-size: 8px; margin-top: 3px; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255,255,255,.1); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.iconbtn svg { width: 22px; height: 22px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: -62px 16px 0; position: relative; z-index: 2; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 900; color: var(--em-800); line-height: 1.4; }
.stat .v small { font-size: 13px; font-weight: 700; color: var(--muted); }
.stat .s { font-size: 12.5px; color: var(--muted); }
.stat.gold { background: linear-gradient(135deg, #FFF9EA, #F7E8C2); }

/* ---------- sections & cards ---------- */
.section-h { display: flex; align-items: center; justify-content: space-between; margin: 26px 2px 10px; }
.section-h h3 { margin: 0; font-size: 18px; font-weight: 900; color: var(--em-800); }
.section-h a { font-size: 14px; color: var(--gold-dark); font-weight: 700; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card h4 { margin: 0 0 8px; font-size: 16px; font-weight: 900; color: var(--em-800); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty svg { width: 46px; height: 46px; color: var(--gold); display: block; margin: 0 auto 8px; }

/* event list */
.ev { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 10px; position: relative; overflow: hidden; }
.ev::before { content: ''; position: absolute; inset: 0 0 0 auto; width: 5px; background: var(--c, var(--gold)); }
.ev .ic { width: 42px; height: 42px; border-radius: 13px; background: var(--cbg, var(--gold-50)); color: var(--c, var(--gold-dark)); display: flex; align-items: center; justify-content: center; flex: none; }
.ev .ic svg { width: 22px; height: 22px; }
.ev .tx { flex: 1; min-width: 0; }
.ev .t1 { font-weight: 800; font-size: 15px; }
.ev .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .rt { text-align: left; flex: none; }
.ev .amt { font-weight: 900; color: var(--em-800); font-size: 15px; }
.ev .when { font-size: 12.5px; font-weight: 700; color: var(--c, var(--muted)); }
.ev.red { --c: var(--red); --cbg: var(--red-50); }
.ev.amber { --c: var(--amber); --cbg: var(--amber-50); }
.ev.green { --c: var(--green); --cbg: var(--green-50); }
.ev.em { --c: var(--em-600); --cbg: var(--em-50); }

/* unit cards */
.unit { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.unit .thumb { width: 58px; height: 58px; border-radius: 16px; background: linear-gradient(160deg, var(--em-700), var(--em-900)); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--gold-light); flex: none; line-height: 1.1; }
.unit .thumb b { font-size: 19px; font-weight: 900; }
.unit .thumb span { font-size: 10px; opacity: .8; }
.unit .body { flex: 1; min-width: 0; }
.unit .t1 { font-weight: 900; font-size: 16.5px; color: var(--em-800); }
.unit .t2 { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit .chev { color: var(--muted); width: 20px; height: 20px; flex: none; }
.bar { height: 6px; border-radius: 6px; background: var(--grey-50); overflow: hidden; margin-top: 7px; }
.bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--gold), var(--em-600)); }
.bar.warn i { background: linear-gradient(90deg, var(--amber), var(--red)); }

/* pills & chips */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 99px; background: var(--grey-50); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-50); color: var(--green); }
.pill.amber { background: var(--amber-50); color: var(--amber); }
.pill.red { background: var(--red-50); color: var(--red); }
.pill.em { background: var(--em-50); color: var(--em-700); }
.pill.gold { background: var(--gold-50); color: var(--gold-dark); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); padding: 6px 14px; border-radius: 99px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--em-800); color: var(--gold-light); border-color: var(--em-800); }

.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 14px; padding: 4px 14px; box-shadow: var(--shadow); margin: 16px 0 10px; }
.search svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; padding: 10px 0; font-size: 15px; }

/* detail */
.dhead { background: linear-gradient(160deg, var(--em-700), var(--em-900)); color: #fff; border-radius: 22px; padding: 18px; margin: 14px 0 12px; position: relative; overflow: hidden; }
.dhead .sky { position: absolute; inset: auto 0 0 0; height: 80%; background: url(/icons/skyline.svg) center bottom / cover no-repeat; opacity: .18; }
.dhead .t { position: relative; font-size: 24px; font-weight: 900; color: var(--gold-light); line-height: 1.3; }
.dhead .s { position: relative; font-size: 14px; opacity: .85; }
.dhead .pills { position: relative; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.kv .k { font-size: 12.5px; color: var(--muted); }
.kv .v { font-weight: 800; font-size: 15px; word-break: break-word; }
.rows .r { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.rows .r:last-child { border-bottom: 0; }
.rows .r .k { color: var(--muted); font-size: 14px; flex: none; }
.rows .r .v { font-weight: 800; text-align: left; font-size: 14.5px; }
.rows .r .v .j { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.note { background: var(--gold-50); border-radius: 14px; padding: 10px 14px; font-size: 14px; color: #6b5626; margin-top: 10px; white-space: pre-wrap; }

.tabs { display: flex; background: var(--card); border-radius: 16px; padding: 4px; box-shadow: var(--shadow); margin: 6px 0 14px; position: sticky; top: calc(64px + var(--safe-t)); z-index: 10; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px 2px; border-radius: 12px; font-weight: 800; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--em-800); color: var(--gold-light); }
.tabs button i { font-style: normal; font-size: 11px; opacity: .8; }

.pay { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: default; }
.pay:last-child { border-bottom: 0; }
.pay.click { cursor: pointer; }
.pay .dt { flex: 1; min-width: 0; }
.pay .d1 { font-weight: 800; font-size: 15px; }
.pay .d2 { font-size: 12.5px; color: var(--muted); }
.pay .am { text-align: left; }
.pay .am b { display: block; font-weight: 900; color: var(--em-800); }
.sumrow { display: flex; gap: 8px; margin-bottom: 12px; }
.sumrow > div { flex: 1; background: var(--card); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); }
.sumrow .k { font-size: 12px; color: var(--muted); }
.sumrow .v { font-weight: 900; font-size: 15px; color: var(--em-800); }

.doc { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: 0; }
.doc .fi { width: 44px; height: 44px; border-radius: 12px; background: var(--em-50); color: var(--em-700); display: flex; align-items: center; justify-content: center; flex: none; }
.doc .fi.pdf { background: var(--red-50); color: var(--red); }
.doc .fi.img { background: var(--gold-50); color: var(--gold-dark); }
.doc .fi svg { width: 22px; height: 22px; }
.doc .dt { flex: 1; min-width: 0; }
.doc .d1 { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc .d2 { font-size: 12.5px; color: var(--muted); }
.cat-h { font-size: 13px; font-weight: 900; color: var(--gold-dark); margin: 14px 0 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 800; font-size: 15px; cursor: pointer; background: var(--em-800); color: var(--gold-light); }
.btn svg { width: 20px; height: 20px; }
.btn.block { width: 100%; }
.btn.gold { background: linear-gradient(135deg, #E8C97E, var(--gold)); color: var(--em-900); }
.btn.ghost { background: var(--card); color: var(--em-800); border: 1px solid var(--line); }
.btn.danger { background: var(--red-50); color: var(--red); }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 11px; }
.btn:disabled { opacity: .6; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btnrow .btn { flex: 1; }
.linkbtn { border: 0; background: none; color: var(--gold-dark); font-weight: 800; cursor: pointer; padding: 0; font-size: 14px; }

/* menu list */
.menu a, .menu button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 4px; border: 0; background: none; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 15.5px; cursor: pointer; text-align: right; }
.menu a:last-child, .menu button:last-child { border-bottom: 0; }
.menu svg { width: 22px; height: 22px; color: var(--gold-dark); flex: none; }
.menu .chev { margin-right: auto; color: var(--muted); width: 18px; height: 18px; }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { font-weight: 800; color: var(--muted); font-size: 12px; text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 4px; border-bottom: 1px dashed var(--line); font-weight: 700; }
.tbl td.n, .tbl th.n { text-align: left; }
.tbl tr:last-child td { border-bottom: 0; }

/* tab bar */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; padding: 6px 6px calc(6px + var(--safe-b)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 2px; font-size: 11.5px; font-weight: 800; color: var(--muted); border-radius: 12px; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.on { color: var(--em-800); }
.tabbar a.on svg { color: var(--gold-dark); }

/* login */
.auth { min-height: 100vh; background: radial-gradient(120% 70% at 70% 0%, #1C6658 0%, var(--em-800) 45%, var(--em-900) 100%); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: calc(40px + var(--safe-t)) 20px calc(24px + var(--safe-b)); position: relative; overflow: hidden; }
.auth .sky { position: absolute; inset: auto 0 0 0; height: 46%; background: url(/icons/skyline.svg) center bottom / cover no-repeat; opacity: .35; pointer-events: none; }
.auth .logo { display: flex; flex-direction: column; align-items: center; position: relative; margin-bottom: 26px; }
.auth .logo img { width: 112px; filter: drop-shadow(0 10px 22px rgba(0,0,0,.35)); }
.auth .logo .bn { font-family: Corm, serif; font-weight: 700; font-size: 31px; letter-spacing: .08em; color: var(--gold-light); margin-top: 14px; line-height: 1; padding-left: .08em; white-space: nowrap; direction: ltr; }
.auth .logo .bs { font-family: Corm, serif; font-weight: 700; font-size: 15px; letter-spacing: .55em; color: var(--gold); margin-top: 8px; padding-left: .55em; }
.auth .box { position: relative; width: 100%; max-width: 380px; background: rgba(255,255,255,.97); border-radius: 24px; padding: 22px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.auth .box h2 { margin: 0 0 4px; font-size: 20px; font-weight: 900; color: var(--em-800); }
.auth .powered { position: relative; color: rgba(243,222,162,.75); margin-top: auto; padding-top: 28px; }

/* forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13.5px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 13px; background: #FDFBF7; padding: 11px 13px; font-size: 16px; outline: none; transition: border-color .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); background: #fff; }
.field textarea { min-height: 84px; resize: vertical; }
.field .hint { font-size: 12.5px; color: var(--gold-dark); margin-top: 3px; min-height: 1em; }
.field input[type=date] { direction: ltr; text-align: right; min-height: 48px; }
.field input.ltrin { direction: ltr; text-align: left; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { margin: 0; }
.seg input { display: none; }
.seg span { display: inline-block; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--line); font-weight: 800; font-size: 14px; color: var(--muted); cursor: pointer; background: #FDFBF7; }
.seg input:checked + span { background: var(--em-800); border-color: var(--em-800); color: var(--gold-light); }
.err { color: var(--red); font-size: 14px; font-weight: 700; min-height: 1.2em; margin-top: 6px; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(11,46,42,.45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 26px 26px 0 0; padding: 10px 18px calc(20px + var(--safe-b)); animation: up .22s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 44px; height: 5px; border-radius: 5px; background: #d8d0c0; margin: 2px auto 10px; }
.sheet h3 { margin: 0 0 14px; font-size: 19px; font-weight: 900; color: var(--em-800); display: flex; align-items: center; justify-content: space-between; }
.sheet h3 button { border: 0; background: var(--grey-50); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.sheet h3 svg { width: 18px; height: 18px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: var(--em-900); color: var(--gold-light); padding: 10px 18px; border-radius: 14px; font-weight: 800; font-size: 14.5px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: up .2s ease; max-width: 90vw; text-align: center; }
.toast.bad { background: var(--red); color: #fff; }

.loading { display: flex; justify-content: center; padding: 60px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--em-100); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.steps { counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 10px 0; align-items: flex-start; }
.steps li::before { content: counter(s, persian); width: 30px; height: 30px; border-radius: 50%; background: var(--em-800); color: var(--gold-light); font-weight: 900; display: flex; align-items: center; justify-content: center; flex: none; font-size: 15px; }
.steps svg { width: 20px; height: 20px; vertical-align: -4px; color: var(--em-700); }
.footer-brand { text-align: center; padding: 26px 0 8px; }
.footer-brand img { width: 46px; opacity: .9; }
.footer-brand .n { font-family: Corm, serif; font-weight: 700; letter-spacing: .1em; color: var(--em-800); font-size: 16px; margin-top: 6px; direction: ltr; }
