/* Qamqor-Sharapat App — native iOS component styles (no framework).
   Bottom tab bar, large-title headers, grouped list cells, cards, forms.
   Deliberately NOT the website's look: system font, list patterns, no hero. */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font: var(--body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; }
ul { list-style: none; }

/* ===================== App shell ===================== */
#app { height: 100%; display: flex; flex-direction: column; }

/* Scrollable screen area (above the tab bar) */
#screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-4));
}

/* ===================== Top bar / Large title ===================== */
.nav {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav-row {
  height: 44px; display: flex; align-items: center; justify-content: center;
  position: relative; padding: 0 var(--sp-4);
}
.nav-row .nav-title { font: var(--headline); }
.nav-row .nav-left, .nav-row .nav-right {
  position: absolute; top: 0; height: 44px; display: flex; align-items: center;
  color: var(--primary); font: var(--body);
}
.nav-left { left: var(--sp-4); } .nav-right { right: var(--sp-4); }

.large-title { padding: var(--sp-2) var(--sp-4) var(--sp-3); }
.large-title h1 { font: var(--large-title); letter-spacing: -0.02em; }
.large-title .sub { font: var(--subhead); color: var(--muted); margin-top: 2px; }

/* ===================== Sections & grouped list ===================== */
.section { padding: var(--sp-2) var(--sp-4) var(--sp-6); }
.section-label {
  font: var(--footnote); color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin: var(--sp-2) var(--sp-1) var(--sp-2);
}

.group {
  background: var(--card); border-radius: var(--r-card);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.cell {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: var(--sp-3) var(--sp-4);
  position: relative; transition: background var(--dur) var(--ease);
}
.cell + .cell::before {
  content: ""; position: absolute; top: 0; left: var(--sp-4); right: 0;
  height: 0.5px; background: var(--line);
}
a.cell:active, button.cell:active { background: var(--fill); }
.cell .c-ic {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
}
.cell .c-ic svg { width: 18px; height: 18px; }
.cell .c-body { flex: 1; min-width: 0; }
.cell .c-title { font: var(--body); }
.cell .c-sub { font: var(--subhead); color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .c-val { font: var(--body); color: var(--muted); }
.cell .chev { color: var(--line-strong); width: 9px; height: 15px; flex-shrink: 0; }
/* any trailing icon in a cell (favourite heart, etc.) stays small */
.cell > svg:last-child:not(.chev) { width: 20px; height: 20px; flex-shrink: 0; color: var(--gold); }

/* ===================== Quick-action cards (home) ===================== */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.qa {
  background: var(--card); border-radius: var(--r-card); padding: var(--sp-4);
  box-shadow: var(--shadow-card); min-height: 116px;
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: flex-start; text-align: left;
  transition: transform var(--dur) var(--ease);
}
.qa > div { width: 100%; }
.qa:active { transform: scale(0.97); }
.qa .qa-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.qa .qa-ic svg { width: 24px; height: 24px; }
.qa .qa-t { font: var(--headline); }
.qa .qa-s { font: var(--footnote); color: var(--muted); margin-top: 2px; }
.qa.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: var(--sp-4); min-height: 72px; }
.qa.wide .qa-txt { flex: 1; }

/* primary call card */
.qa.call { background: linear-gradient(135deg, var(--green-600), var(--green-700)); }
.qa.call .qa-t, .qa.call .qa-s { color: #fff; }
.qa.call .qa-s { color: rgba(255,255,255,0.82); }
.qa.call .qa-ic { background: rgba(255,255,255,0.18); }

/* icon tints */
.ic-green { background: var(--green-600); }
.ic-gold  { background: var(--gold); }
.ic-teal  { background: var(--green-500); }
.ic-deep  { background: var(--green-800); }

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 50px; padding: 0 var(--sp-5); border-radius: var(--r-m);
  font: var(--headline); transition: transform var(--dur) var(--ease), background var(--dur);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:active { background: var(--primary-press); }
.btn-ghost { background: var(--fill); color: var(--primary); }
.btn-block { width: 100%; }
.btn svg { width: 20px; height: 20px; }

/* ===================== Forms ===================== */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font: var(--footnote); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin: 0 var(--sp-1) var(--sp-2); }
.field input, .field select, .field textarea {
  width: 100%; font: var(--body); color: var(--ink);
  background: var(--card); border: 0.5px solid var(--line);
  border-radius: var(--r-m); padding: 14px var(--sp-4);
  transition: border-color var(--dur);
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green-500);
}
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.field .err { display: none; font: var(--footnote); color: var(--danger); margin: 6px var(--sp-1) 0; }
.field.invalid .err { display: block; }

/* photo attach */
.photo-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.photo-thumb { width: 72px; height: 72px; border-radius: var(--r-s); object-fit: cover; border: 0.5px solid var(--line); }
.photo-add {
  width: 72px; height: 72px; border-radius: var(--r-s); border: 1px dashed var(--line-strong);
  display: grid; place-items: center; color: var(--muted); background: var(--fill);
}
.photo-add svg { width: 26px; height: 26px; }

/* ===================== Status pills ===================== */
.pill { font: var(--caption); padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.pill.sent { background: var(--green-100); color: var(--green-800); }
.pill.draft { background: var(--fill); color: var(--muted); }

/* ===================== Empty state ===================== */
.empty { text-align: center; padding: var(--sp-10) var(--sp-6); color: var(--muted); }
.empty .e-ic { width: 56px; height: 56px; margin: 0 auto var(--sp-3); color: var(--line-strong); }
.empty .e-ic svg { width: 56px; height: 56px; }
.empty .e-t { font: var(--headline); color: var(--ink-2); margin-bottom: 4px; }
.empty .e-s { font: var(--subhead); }

/* ===================== Calendar / timeline ===================== */
.tl { position: relative; padding-left: var(--sp-6); }
.tl::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 var(--sp-4); }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--bg); }
.tl-item.past::before { background: var(--line-strong); }
.tl-date { font: var(--headline); }
.tl-meta { font: var(--subhead); color: var(--muted); }

/* ===================== Tab bar ===================== */
#tabbar {
  flex-shrink: 0;
  display: flex; align-items: stretch;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-bar);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); transition: color var(--dur) var(--ease);
}
.tab svg { width: 26px; height: 26px; }
.tab span { font: var(--caption); font-size: 10.5px; }
.tab.active { color: var(--primary); }
.tab:active { opacity: 0.6; }

/* ===================== Segmented control (language) ===================== */
.seg { display: inline-flex; background: var(--fill); border-radius: 9px; padding: 2px; }
.seg button { font: var(--footnote); font-weight: 600; padding: 5px 12px; border-radius: 7px; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* favourite toggle in cell */
.cell .fav { flex-shrink: 0; line-height: 0; }

/* date input looks native */
.field input[type="date"] { -webkit-appearance: none; min-height: 50px; }

/* ===================== Branches ===================== */
.branch { background: var(--card); border-radius: var(--r-card); padding: var(--sp-4);
  box-shadow: var(--shadow-card); margin-bottom: var(--sp-3); }
.branch-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-2); }
.branch-name { font: var(--headline); }
.branch-addr { font: var(--subhead); color: var(--muted); margin-top: 2px; }
.branch-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.bx { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; border-radius: var(--r-s); font: var(--subhead); font-weight: 600; }
.bx svg { width: 18px; height: 18px; }
.bx.route { background: var(--green-100); color: var(--green-800); }
.bx.call { background: var(--fill); color: var(--primary); }
.bx:active { opacity: 0.7; }
.near-hint { padding: var(--sp-3); text-align: center; font: var(--subhead); color: var(--muted); }
.near-hint.err { color: var(--danger); }

/* ===================== iPad / wide screens ===================== */
/* Center content in a phone-width column so the app reads natively on iPad,
   not like a stretched website. */
@media (min-width: 600px) {
  .nav > .nav-row, .nav > .large-title,
  .section { max-width: 560px; margin-left: auto; margin-right: auto; }
  #tabbar { justify-content: center; }
  #tabbar .tab { max-width: 130px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
