/* NGO.UZ web app — Classical design (gold). Mirrors the native apps' Theme / Palette tokens. */
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/CormorantGaramond-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/CormorantGaramond-SemiBold.ttf) format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Lora"; src: url(fonts/Lora-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lora"; src: url(fonts/Lora-SemiBold.ttf) format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Phosphor"; src: url(shared/Phosphor.ttf) format("truetype"); font-display: block; }

:root {
  --bg: #f3f2f2; --surface: #eae9e9; --ink: #201f1d; --lead: #444141; --muted: #605d5d;
  --accent: #b68235; --accent-deep: #7d5411; --accent-pressed: #a06f24; --wash: #fff3e4;
  --line: rgba(32, 31, 29, .16); --error: #b3261e;
  --r: 4px; --r-lg: 7px; --pad: 18px;
  --heading: "Cormorant Garamond", Georgia, serif; --body: "Lora", Georgia, serif;
  --tabbar-h: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-deep); text-underline-offset: 3px; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(182, 130, 53, .3); }
.ph { font-family: "Phosphor"; font-style: normal; font-weight: normal; line-height: 1; display: inline-block; speak: never; }
.tnum { font-variant-numeric: tabular-nums; }

#app { min-height: 100vh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.local-banner { background: var(--wash); color: var(--accent-deep); font: 600 11px var(--body); letter-spacing: .6px; text-align: center; padding: 5px; }

/* Top bars */
.brand { display: flex; align-items: center; justify-content: space-between; padding: 14px var(--pad) 14px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.brand .mark { display: flex; flex-direction: column; gap: 1px; }
.brand .mark b { font: 600 25px/1 var(--heading); color: var(--accent-deep); }
.brand .mark small { font: 400 9px var(--body); letter-spacing: 2px; color: var(--muted); }
.navbar { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; align-items: center; min-height: 50px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.navbar h1 { margin: 0; text-align: center; font: 600 19px/1.2 var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navbar .back { border: 0; background: none; color: var(--accent-deep); font-size: 22px; height: 44px; width: 52px; cursor: pointer; }
.tg .navbar .back { visibility: hidden; }

main.screen { flex: 1; min-width: 0; overflow-x: hidden; padding: var(--pad); padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
main.screen.form-screen { padding-bottom: 150px; }

/* Tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 10px calc(4px + env(safe-area-inset-bottom)); }
.tabbar .inner { display: flex; max-width: 640px; margin: 0 auto; }
.tabbar button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 5px; min-height: 48px; color: var(--muted); cursor: pointer; }
.tabbar button .ph { font-size: 23px; }
.tabbar button span:last-child { font: 400 10px var(--body); white-space: nowrap; }
.tabbar button.on { color: var(--accent-deep); }
.tabbar button.on span:last-child { font-weight: 600; }

/* Type */
.display { font: 400 44px/1.05 var(--heading); margin: 4px 0 0; letter-spacing: -.01em; }
.page-title { font: 400 38px/1.05 var(--heading); margin: 2px 0 0; }
.h2 { font: 600 22px/1.2 var(--heading); margin: 0; }
.h3 { font: 600 19px/1.25 var(--heading); margin: 0; }
.kicker { font: 400 10px/1.4 var(--body); letter-spacing: 1.3px; text-transform: uppercase; color: var(--accent-deep); }
.lead { font-size: 14px; line-height: 1.6; color: var(--lead); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.base { align-items: baseline; }
.spacer { flex: 1; }
.link { border: 0; background: none; padding: 0; color: var(--accent-deep); font: 400 13px var(--body); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Hero */
.hero { display: flex; flex-direction: column; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.hero .top { display: flex; align-items: center; justify-content: space-between; }
.hero .top .ph { font-size: 24px; color: var(--accent); }
.hero h2 { font: 400 32px/1.08 var(--heading); margin: 0; }
.hero.compact h2 { font-size: 30px; }
.hero p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--lead); }

/* Surfaces */
.card { min-width: 0; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; background: transparent; display: flex; flex-direction: column; gap: 10px; text-align: left; width: 100%; color: inherit; }
button.card, a.card { cursor: pointer; text-decoration: none; font: inherit; }
button.card:active, a.card:active { background: rgba(32, 31, 29, .04); }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.notice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; font-size: 13px; line-height: 1.55; color: var(--lead); }
.notice .ph { color: var(--accent); font-size: 20px; flex: none; }
.notice.error .ph, .error-text { color: var(--error); }
.error-text { font-size: 13px; }
.plate { padding: 6px; background: var(--surface); outline: 1px solid var(--line); }
.plate img { display: block; width: 100%; object-fit: cover; filter: saturate(.82) contrast(1.05); }
.plate .ph-holder { display: grid; place-items: center; background: var(--surface); color: var(--accent); font-size: 34px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--accent); background: transparent; color: var(--accent-deep); font: 600 18px var(--heading); cursor: pointer; text-decoration: none; }
.btn:active { background: rgba(182, 130, 53, .18); }
.btn:disabled { opacity: .45; cursor: default; background: transparent; }
.btn.block { width: 100%; }
.btn.secondary { border-color: var(--line); color: var(--ink); font-size: 17px; min-height: 44px; }
.btn.secondary:active { background: rgba(32, 31, 29, .08); }
.btn.small { min-height: 40px; font-size: 17px; padding: 0 20px; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(125, 84, 17, .25); border-top-color: var(--accent-deep); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 12px; padding: 14px 0; color: var(--muted); font-size: 14px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .field > .label { font-size: 13px; color: var(--lead); }
.input { width: 100%; min-height: 46px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); font: 400 15px var(--body); color: var(--ink); appearance: none; }
.input:focus { border-color: var(--accent); }
.input.bad { border-color: var(--error); }
textarea.input { resize: vertical; min-height: 110px; line-height: 1.5; }
select.input { background-image: none; padding-right: 36px; }
.select-wrap { position: relative; }
.select-wrap::after { content: "\e13a"; font-family: "Phosphor"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%) rotate(90deg); color: var(--accent-deep); pointer-events: none; font-size: 15px; }
.input::placeholder { color: #aaa6a6; }
.search { position: relative; }
.search .ph { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; }
.search .input { padding-left: 44px; }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 18px; width: 36px; height: 36px; cursor: pointer; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; cursor: pointer; font-size: 14px; }
.check input { appearance: none; width: 22px; height: 22px; flex: none; border: 1px solid var(--accent); border-radius: 2px; background: var(--bg); display: grid; place-items: center; margin: 0; cursor: pointer; }
.check input:checked { background: var(--wash); }
.check input:checked::after { content: "\e182"; font-family: "Phosphor"; color: var(--accent-deep); font-size: 15px; }

/* Segmented control */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r); background: transparent; color: var(--ink); font: 400 14px var(--body); cursor: pointer; }
.seg button.on { border-color: var(--accent); background: var(--wash); color: var(--accent-deep); font-weight: 600; }

/* Home */
.lead-news { width: 100%; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; padding-left: 0; padding-right: 0; }
.lead-news .plate img, .lead-news .plate .ph-holder { height: 205px; }
.lead-news .date { font-size: 11px; letter-spacing: 1.2px; color: var(--accent-deep); margin-top: 4px; }
.lead-news h3 { font: 600 27px/1.15 var(--heading); margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { min-height: 76px; border: 1px solid var(--line); border-radius: var(--r); background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; color: var(--accent); }
.tile .ph { font-size: 25px; }
.tile span:last-child { font: 400 11px var(--body); color: var(--ink); }
.feed-card .meta { display: flex; justify-content: space-between; align-items: center; }
.feed-card h3 { font: 600 19px/1.25 var(--heading); margin: 0; }
.feed-card p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--lead); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more-link { display: flex; justify-content: flex-end; gap: 6px; color: var(--accent-deep); font-size: 13px; align-items: center; }

/* Library / article */
.lib-card .plate { margin: 12px 12px 0; }
.lib-card .plate img, .lib-card .plate .ph-holder { height: 158px; }
.lib-card .body { padding: 18px; display: flex; gap: 14px; }
.lib-card h3 { font: 600 21px/1.2 var(--heading); margin: 0; }
.doc-badge { width: 60px; height: 88px; flex: none; border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--accent); }
.doc-badge .ph { font-size: 32px; }
.doc-badge i.rule { width: 24px; height: 1px; background: var(--line); }
.doc-badge b { font: 400 8px var(--body); letter-spacing: .9px; color: var(--accent-deep); }
.article h2 { font: 400 30px/1.12 var(--heading); margin: 0; }
.article .body { padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.blocks { display: flex; flex-direction: column; gap: 18px; }
.blocks p { margin: 0; font-size: 15px; line-height: 1.7; }
.blocks .b-title { font: 400 28px/1.15 var(--heading); margin: 0; }
.blocks .b-heading { font: 600 21px/1.25 var(--heading); margin: 0; display: flex; gap: 11px; }
.blocks .b-heading::before { content: ""; width: 3px; flex: none; background: rgba(182, 130, 53, .45); border-radius: 2px; margin: 4px 0; }
.blocks .bullet { display: flex; gap: 11px; font-size: 15px; line-height: 1.7; }
.blocks .bullet::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: rgba(182, 130, 53, .6); flex: none; margin-top: 11px; }
.blocks img { max-width: 100%; display: block; }
.blocks .linkrow { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: var(--accent-deep); text-decoration: none; font-size: 13px; }
.blocks .linkrow .ph { font-size: 19px; }
.blocks .linkrow span.t { flex: 1; }
.blocks details { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.blocks details summary { cursor: pointer; font: 600 19px var(--heading); list-style: none; display: flex; gap: 10px; align-items: center; }
.blocks details summary::after { content: "\e13a"; font-family: Phosphor; margin-left: auto; color: var(--accent-deep); font-size: 14px; transform: rotate(90deg); }
.blocks details[open] summary::after { transform: rotate(-90deg); }
.blocks details > .blocks { margin-top: 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.metric { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.metric b { font: 600 26px/1 var(--heading); color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.metric span { font-size: 12px; color: var(--muted); }
.fact { display: flex; flex-direction: column; gap: 3px; }
.fact span { font-size: 12px; color: var(--muted); }
.pill { display: inline-block; border: 1px solid var(--accent); border-radius: 2px; color: var(--accent-deep); font-size: 10px; padding: 3px 8px; }

/* Directory */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 0; }
.stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats b { font: 400 30px/1.1 var(--heading); font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters select { font-size: 12px; color: var(--accent-deep); min-height: 44px; }
.org-card .head { display: flex; gap: 11px; align-items: flex-start; }
.initials { width: 40px; height: 40px; flex: none; border: 1px solid var(--accent); border-radius: var(--r); display: grid; place-items: center; font: 600 17px var(--heading); color: var(--accent-deep); }
.org-card h3 { font: 600 19px/1.25 var(--heading); margin: 0; }
.org-card .soha { font-size: 12px; color: var(--accent-deep); margin-top: 4px; }
.org-card .line { display: flex; gap: 8px; font-size: 13px; color: var(--muted); align-items: flex-start; }
.org-card .line .ph { font-size: 16px; width: 18px; margin-top: 2px; }
.detail-rows { display: flex; flex-direction: column; }
.detail-rows > div { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; }
.detail-rows > div + div { border-top: 1px solid var(--line); }
.detail-rows span { font-size: 12px; color: var(--muted); }
.detail-rows b { font-weight: 400; font-size: 14px; }

/* Menu */
.group-head { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.group-head .num { width: 25px; height: 25px; border-radius: 50%; border: 1px solid var(--accent); display: grid; place-items: center; font-size: 10px; color: var(--accent-deep); font-variant-numeric: tabular-nums; flex: none; }
.group-head h3 { font: 400 21px var(--heading); margin: 0; white-space: nowrap; }
.group-head i { flex: 1; height: 1px; background: var(--line); }
.menu-card { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: var(--r); padding: 15px; min-height: 66px; background: none; width: 100%; text-align: left; cursor: pointer; color: inherit; }
.menu-card:active { background: rgba(32, 31, 29, .04); }
.menu-card > .ph:first-child { font-size: 22px; color: var(--accent); width: 30px; text-align: center; }
.menu-card .t { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.menu-card .t b { font: 600 15px var(--body); }
.menu-card .t small { font-size: 12px; color: var(--muted); }
.menu-card > .ph:last-child { font-size: 15px; color: var(--muted); }
.menu-list { border: 1px solid var(--line); border-radius: var(--r); padding: 0 16px; }
.menu-list .menu-card { border: 0; border-radius: 0; padding: 16px 2px; }
.menu-list .menu-card + .menu-card { border-top: 1px solid var(--line); }

/* Staff */
.staff .tag { display: flex; align-items: center; gap: 7px; padding: 12px 18px; font-size: 11px; color: var(--accent-deep); border-bottom: 1px solid var(--line); }
.staff .main { display: flex; gap: 16px; padding: 18px; }
.staff .portrait { width: 78px; height: 100px; flex: none; border-radius: var(--r); overflow: hidden; display: grid; place-items: center; border: 1px solid var(--accent); font: 600 28px var(--heading); color: var(--accent-deep); }
.staff .portrait.has { border-color: transparent; }
.staff .portrait img { width: 100%; height: 100%; object-fit: cover; }
.staff h3 { font: 600 21px/1.2 var(--heading); margin: 0 0 9px; }
.staff .role { font-size: 13px; line-height: 1.55; color: var(--accent-deep); }
.staff .mail { display: flex; align-items: center; gap: 9px; margin: 0 18px; padding: 16px 0; border-top: 1px solid var(--line); color: var(--accent-deep); text-decoration: none; font-size: 12px; }
.staff .mail > span:not(.ph) { flex: 1; overflow-wrap: anywhere; }

/* Forms */
.steps { display: flex; align-items: center; gap: 6px; }
.steps .dot { width: 27px; height: 27px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.steps .dot.on { border-color: var(--accent); color: var(--accent-deep); background: var(--wash); }
.steps .dot.done { border-color: var(--accent); color: var(--accent-deep); }
.steps i { flex: 1; height: 1px; background: var(--line); }
.steps i.done { background: var(--accent); }
.form-bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom)); z-index: 10; }
.form-bar .inner { max-width: 604px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.form-bar .btns { display: flex; gap: 12px; }
.form-bar .btns .btn:last-child { flex: 1; }
.files { display: flex; flex-direction: column; gap: 8px; }
.file-row { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; font-size: 13px; }
.file-row .ph { color: var(--accent); font-size: 18px; }
.file-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.req-doc { display: flex; gap: 10px; font-size: 13px; color: var(--lead); }
.req-doc .ph { color: var(--accent); }

/* Success / receipts */
.success { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; padding-top: 18px; }
.ring { width: 92px; height: 92px; border-radius: 50%; border: 1px solid var(--accent); display: grid; place-items: center; color: var(--accent); font-size: 44px; }
.ring.sm { width: 43px; height: 43px; font-size: 22px; flex: none; }
.ring.md { width: 70px; height: 70px; font-size: 31px; }
.success .num { font: 600 40px var(--heading); letter-spacing: 3px; color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 28px 22px; border: 1px solid var(--line); border-radius: var(--r); }
.empty h3 { font: 600 22px var(--heading); margin: 0; }
.empty p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* Dialog */
.backdrop { position: fixed; inset: 0; background: rgba(32, 31, 29, .45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.dialog { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; width: 100%; max-width: 640px; padding: 22px var(--pad) calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.dialog h3 { font: 600 22px var(--heading); margin: 0; }
.dialog p { margin: 0; font-size: 14px; color: var(--lead); }

/* Grant AI */
.grant-card h3 { font: 600 21px/1.2 var(--heading); margin: 0; }
.grant-card .donor { font-size: 12px; font-weight: 600; color: var(--accent-deep); }
.answer { font-size: 15px; line-height: 1.7; white-space: pre-wrap; }
