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

/* Day: Nokhod's navy header, warm white, gold only for gold numbers and the main button. */
:root {
  --hdr: #10233F; --hdr-text: #E9EDF3; --hdr-muted: #9FB0C8; --hdr-chip: rgba(255,255,255,.07);
  --bg: #F7F6F2; --card: #FFFFFF; --line: #E7E4DC; --field: #CFCBC1; --seg: #EFECE4;
  --text: #1B1E23; --text-2: #4A515C; --muted: #737A85;
  --gold: #C7A24A; --gold-ink: #7B632A; --on-gold: #10233F; --chip-gold: #D9B865;
  --green: #1F8A5B; --red: #C84A4A; --chip-green: #6FD0A0; --chip-red: #F09090;
  --warn-bg: #FBF3DF; --warn-line: #E9D59A; --warn-text: #5C4A16;
  --thumb: #E4E1D8;
}
/* Night: slate blue, the header is the card colour. */
:root[data-theme="dark"] {
  --hdr: #151F2C; --hdr-text: #E9EDF3; --hdr-muted: #8D9AAD; --hdr-chip: #1C2836;
  --bg: #0E1621; --card: #151F2C; --line: #2B3847; --field: #4A5868; --seg: #1C2836;
  --text: #E9EDF3; --text-2: #BAC4D2; --muted: #8D9AAD;
  --gold: #C7A24A; --gold-ink: #D9B865; --on-gold: #0E1621; --chip-gold: #D9B865;
  --green: #3DB37C; --red: #E26A6A; --chip-green: #3DB37C; --chip-red: #E26A6A;
  --warn-bg: #2F3331; --warn-line: rgba(240,196,83,.28); --warn-text: #F0C453;
  --thumb: #24313F;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; }
body { font-family: Vazirmatn, Tahoma, sans-serif; font-size: 13px; line-height: 1.6; padding-bottom: 62px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); } .gold { color: var(--gold-ink); }
.muted { color: var(--muted); }

.hdr { background: var(--hdr); color: var(--hdr-text); padding: 12px 14px 12px; }
.hdr .top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--hdr-muted); min-height: 20px; }
.hdr .ttl { font-weight: 700; color: var(--hdr-text); font-size: 13px; }
.hdr .big { font-size: 15px; font-weight: 700; margin-top: 8px; }
.hdr .k { color: var(--hdr-muted); font-size: 11.5px; margin-top: 8px; }
.chips { display: flex; gap: 6px; margin-top: 8px; }
.chips > div { flex: 1; background: var(--hdr-chip); border-radius: 9px; padding: 6px 8px; min-width: 0; }
.chips .k { font-size: 10.5px; color: var(--hdr-muted); margin: 0; }
.chips .v { font-size: 12.5px; font-weight: 700; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips .v.g { color: var(--chip-gold); } .chips .v.p { color: var(--chip-green); } .chips .v.n { color: var(--chip-red); }

.body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 9px; max-width: 560px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card h3 { margin: 0; font-size: 12.5px; font-weight: 700; padding: 9px 12px 4px; display: flex; justify-content: space-between; align-items: center; }
.card h3 a, .card h3 button { color: var(--muted); font-weight: 400; font-size: 11.5px; background: none; border: 0; padding: 0; cursor: pointer; }
.li { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.card h3 + .li, .card > .li:first-child { border-top: 0; }
.li.sub { padding-right: 24px; }
.av { width: 28px; height: 28px; border-radius: 50%; background: var(--seg); color: var(--text-2); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; }
.li .m { flex: 1; min-width: 0; } .li .n { font-size: 12.5px; } .li .s { font-size: 11px; color: var(--muted); }
.li .a { text-align: left; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.li .a .s { font-weight: 400; }
.day { font-size: 11px; color: var(--muted); padding: 2px 4px 0; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; font-size: 12px; }

.note { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 8px 11px; font-size: 12px; line-height: 1.7; color: var(--warn-text); }
.note b { font-weight: 700; }
.note a { text-decoration: underline; }

.seg { display: flex; flex-wrap: wrap; background: var(--seg); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { flex: 1 1 auto; text-align: center; padding: 5px 6px; border-radius: 7px; font-size: 12px; color: var(--text-2); background: none; border: 0; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.f { display: flex; flex-direction: column; gap: 3px; }
.f label { font-size: 11.5px; color: var(--text-2); }
.in { width: 100%; min-width: 0; background: var(--card); border: 1px solid var(--field); border-radius: 9px; padding: 8px 10px; font-size: 13px; outline: none; }
.in:focus { border-color: var(--gold); }
.in.big { font-size: 16px; font-weight: 700; }
select.in { appearance: none; -webkit-appearance: none; }
textarea.in { resize: vertical; min-height: 40px; }
.hint { font-size: 11px; color: var(--muted); line-height: 1.7; }
.two { display: flex; gap: 8px; } .two > * { flex: 1; min-width: 0; }
.err { color: var(--red); font-size: 12px; }

.btn { display: block; width: 100%; background: var(--gold); color: var(--on-gold); text-align: center; border-radius: 10px; padding: 10px 0; font-weight: 700; font-size: 13px; border: 0; cursor: pointer; }
.btn:disabled { background: var(--thumb); color: var(--muted); cursor: default; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; }
.acts button, .acts a { flex: 1; text-align: center; border: 1px solid var(--field); background: var(--card); border-radius: 9px; padding: 6px 4px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.acts .danger { color: var(--red); }

.tbl .tr { display: grid; grid-template-columns: 1.3fr 1fr 1fr; padding: 7px 12px; border-top: 1px solid var(--line); font-size: 12px; gap: 6px; }
.tbl .tr span:not(:first-child) { text-align: left; }
.tbl .th { color: var(--muted); font-size: 11px; padding: 5px 12px; }
.sum { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; line-height: 1.9; }
.sum .r { display: flex; justify-content: space-between; gap: 10px; } .sum .r span:first-child { color: var(--text-2); }

.files { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 12px 10px; }
.thumb { width: 64px; height: 64px; border-radius: 8px; background: var(--thumb); border: 1px solid var(--line); overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; inset: auto 0 0 0; background: rgba(0,0,0,.55); color: #fff; border: 0; font-size: 10.5px; padding: 2px 0; cursor: pointer; }
.add { border: 1px dashed var(--field); border-radius: 8px; height: 64px; padding: 0 12px; display: grid; place-items: center; font-size: 12px; color: var(--text-2); cursor: pointer; }
.add input { display: none; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 20; }
.viewer img { max-width: 100%; max-height: 100%; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs a { flex: 1; text-align: center; padding: 10px 0 11px; font-size: 12px; color: var(--muted); }
.tabs a.on { color: var(--text); font-weight: 700; }
.toast { position: fixed; bottom: 72px; left: 16px; right: 16px; margin: 0 auto; max-width: 420px; background: var(--text); color: var(--bg); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; text-align: center; z-index: 30; }
