:root {
  --bg: #0b0e13;
  --surface: #161a22;
  --section: #16181e;
  --icon-frame: #2c2f38;
  --primary: #0d9488;
  --primary-light: #14b8a6;
  --text: #ffffff;
  --muted: #9aa3b2;
  --border: #2a3140;
  --success: #16a34a;
  --error: #dc2626;
  --logo-gray: #454c56;
  --brand-red: #e10600;
  --tile-text: #d6dae0;
  --brand-word: #ffffff;
  --brand-word-dim: #9aa3b2;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
  font-synthesis: none;
}
html[data-theme="light"] {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --section: #ffffff;
  --icon-frame: #e6eaef;
  --text: #161a22;
  --muted: #5c6775;
  --border: #d7dee6;
  --tile-text: #243040;
  --brand-word: #161a22;
  --brand-word-dim: #5c6775;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}
html[data-text="sm"] .app-shell { zoom: 0.92; }
html[data-text="lg"] .app-shell { zoom: 1.12; }

@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn_regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn_medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn_bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn_black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "2 Kidnap";
  src: url("/fonts/2-kidnap.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-weight: 500;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
::placeholder { color: var(--muted); opacity: 1; }

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -48px;
  z-index: 20;
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  border-radius: 10px;
}
.skip-link:focus { top: 12px; }

.app-shell, .flow-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.shell-main, .flow-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.frame-inner, .page-inner, .bottom-nav-inner {
  width: min(1080px, 100%);
  margin-inline: auto;
}
.page-inner { padding: 8px 16px 28px; }
.page-inner.narrow, .form-inner { width: min(560px, 100%); margin-inline: auto; }
.form-inner { padding-bottom: 12px; }

.brand-frame {
  background: var(--surface);
  padding: 8px 8px 8px;
  padding-top: calc(8px + env(safe-area-inset-top));
}
.brand-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border-radius: 20px;
  min-height: 68px;
  padding: 8px 16px;
}
.brand-logo-box {
  width: 52px;
  height: 52px;
  padding: 4px;
  border-radius: 12px;
  background: var(--logo-gray);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.brand-logo-box.tiny { width: 36px; height: 36px; border-radius: 10px; padding: 3px; }
.pocket-logo { width: 100%; height: 100%; display: block; }
.pocket-hand {
  transform-box: view-box;
  transform: translateY(7.4%);
  animation: pocket-dip 0.9s ease-in-out infinite alternate;
}
@keyframes pocket-dip {
  from { transform: translateY(7.4%); }
  to { transform: translateY(12%); }
}
.brand-word {
  margin: 0;
  color: var(--brand-word);
  font-family: "2 Kidnap", Vazirmatn, Tahoma, sans-serif;
  font-size: 22px;
  font-weight: 400;
  animation: brand-blink 0.9s ease-in-out infinite alternate;
}
@keyframes brand-blink {
  from { color: var(--brand-word); }
  to { color: var(--brand-word-dim); }
}

.offline-bar, .install-banner {
  background: #241418;
  color: #ffe4e6;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
}
.install-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  color: var(--text);
  border-top: 1px solid var(--border);
}
.install-banner p, .offline-bar { margin: 0; }
.install-actions { display: flex; gap: 8px; }

.bottom-nav {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr 1fr auto 1fr 1fr;
  align-items: center;
}
.nav-item {
  position: relative;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.nav-item.active { color: var(--primary); }
.nav-badge {
  position: absolute;
  top: 4px;
  inset-inline-start: calc(50% + 18px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-red);
  color: white;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.nav-logo {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--logo-gray);
  padding: 6px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.brand-logo-box .pocket-logo,
.nav-logo .pocket-logo {
  transform: scale(1.85);
  transform-origin: 50% 64%;
}

.theme-shortcut {
  position: fixed;
  z-index: 6;
  top: calc(18px + env(safe-area-inset-top));
  left: 12px;
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.theme-shortcut button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  min-height: 26px;
  padding: 0 8px;
}
.theme-shortcut button[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
}
.category-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 4px 0 14px;
  padding: 10px 8px;
  background: var(--surface);
  border-radius: 22px;
}
.category-chip {
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}
.category-chip img { width: 36px; height: 36px; }
.category-chip span {
  max-height: 2.8em;
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.22s ease, opacity 0.18s ease;
}
.category-bar.compact { padding-block: 6px; }
.category-bar.compact .category-chip { gap: 0; }
.category-bar.compact .category-chip span {
  max-height: 0;
  opacity: 0;
}
.category-chip.active { color: var(--primary-light); }

.section-card {
  background: var(--section);
  border-radius: 20px;
  padding: 8px 8px 12px;
  margin-bottom: 14px;
}
.section-card.flat { padding: 16px; }
.section-title, .page-title, .section-card h3, .form-heading h2, .flow-body h2 {
  margin: 0;
  font-weight: 700;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  padding: 10px 8px 12px;
}
.section-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: var(--accent, var(--primary));
}
.page-title { font-size: 26px; padding: 8px 4px 16px; }
.section-card h3 { font-size: 16px; margin-bottom: 10px; }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 6px;
}
.service-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  border-radius: 16px;
}
.service-tile:hover .tile-icon { background: #3a3e48; }
.service-tile:active { transform: scale(0.98); }
.tile-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--icon-frame);
  display: grid;
  place-items: center;
}
.tile-icon img { width: 36px; height: 36px; }
.tile-label {
  min-height: 2.7em;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  color: var(--tile-text);
}

.flow-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface);
}
.flow-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.flow-footer {
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(11, 14, 19, 0.94);
  border-top: 1px solid var(--border);
}
.footer-stack, .stack-form { display: flex; flex-direction: column; gap: 10px; }
.form-heading { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.form-heading h2 { font-size: 22px; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 13px; }
.lede { margin: 8px 0 14px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 700; font-size: 14px; }
.field-hint { color: var(--muted); font-size: 13px; }
.field-error { color: #fca5a5; font-size: 12px; }
.field-control {
  width: 100%;
  height: 55px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 14px;
  color: white;
}
.field-control[aria-invalid="true"] { border-color: var(--error); }
.digit-field { direction: ltr; text-align: right; }
select.field-control { appearance: none; }
.form-alert {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.15);
  color: #fecaca;
}
.form-alert.ok { background: rgba(22, 163, 74, 0.16); color: #bbf7d0; }

.btn-primary, .btn-ghost, .link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
}
.btn-primary {
  border: 0;
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: white;
}
.btn-ghost:hover { border-color: var(--primary); }
.btn-primary.slim, .btn-ghost.slim { width: auto; min-height: 40px; padding: 0 14px; font-size: 14px; }
.danger-btn { color: #fecaca; border-color: rgba(220, 38, 38, 0.5); }

.profile-page { padding-bottom: 24px; }
.menu-list, .profile-edit, .profile-panel, .profile-page .form-alert { margin-inline: 16px; }
.profile-head {
  margin: 0 0 8px;
  padding: 28px 20px 32px;
  background: #ff5a00;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: #e8edf2;
  color: #5c6775;
  font-size: 32px;
  display: grid;
  place-items: center;
}
.profile-phone {
  margin: 0;
  color: white;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.profile-edit, .profile-panel {
  margin: 12px 0;
  padding: 16px;
  background: var(--surface);
  border-radius: 18px;
}
.profile-edit-actions, .text-size-choices { display: flex; gap: 8px; }
.profile-panel h2 { margin: 8px 0 12px; font-size: 20px; }
.profile-panel p { margin: 0; color: var(--muted); }
.menu-list { list-style: none; margin: 8px 0 0; padding: 0; }
.menu-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 16px 4px;
  text-align: right;
}
.menu-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--icon-frame);
  flex: none;
}
.menu-title { flex: 1; font-weight: 700; }
.menu-switch {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: #3a4250;
  position: relative;
  flex: none;
}
.menu-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
}
.menu-switch.on { background: var(--primary); }
.menu-switch.on::after { right: auto; left: 3px; }
.text-btn {
  border: 0;
  background: transparent;
  color: white;
  font-weight: 700;
  padding: 8px 0;
}
.text-btn.danger { color: #fca5a5; }

.plate {
  direction: ltr;
  display: grid;
  grid-template-columns: 46px 1fr 72px 1.3fr 68px;
  height: 72px;
  background: #f7f4ee;
  color: #111;
  border: 2px solid #d9d3c7;
  border-radius: 12px;
  overflow: hidden;
  color-scheme: light;
}
.plate-blue {
  background: #003399;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.plate input, .plate select {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: #111;
  text-align: center;
  font-weight: 700;
  font-size: 20px;
}
.plate-iran {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 2px solid #d9d3c7;
  background: white;
  font-size: 12px;
  font-weight: 700;
}
.plate-iran input { height: 28px; font-size: 18px; }
.motor-plate { display: grid; gap: 8px; }

.demo-notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 135, 0, 0.12);
  color: #fdba74;
  border: 1px solid rgba(255, 135, 0, 0.28);
}
.result-service { margin: 0; font-size: 20px; font-weight: 700; }
.result-lead { margin: 8px 0; }
.status-pill {
  display: inline-flex;
  margin: 4px 0 14px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.status-pill.ok { background: rgba(22, 163, 74, 0.16); color: #86efac; }
.status-pill.warn { background: rgba(220, 38, 38, 0.16); color: #fca5a5; }
.detail-list { margin: 0 0 14px; display: grid; gap: 8px; }
.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; }
.fine-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.fine-list li, .record-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.fine-list li {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.fine-list small, .record-list small, .record-list time {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.amount-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin: 8px 0 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.amount-box strong { color: var(--primary-light); font-size: 18px; }

.empty-state { text-align: center; color: var(--text); padding: 12px 8px 24px; }
.empty-state p { margin: 8px 0; }
.empty-logo {
  width: 96px;
  height: 96px;
  margin: 12px auto;
  display: block;
}
.record-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.record-list a, .basket-row {
  background: var(--section);
  border-radius: 16px;
  padding: 12px 14px;
}
.record-list a strong { display: block; }
.basket-row { display: grid; gap: 4px; }
.record-list .basket-row a { background: transparent; padding: 0; }

.modal {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: white;
  padding: 20px;
}
.modal::backdrop { background: rgba(0, 0, 0, 0.62); }
.modal h2 { margin: 0 0 8px; }
.modal p { color: var(--muted); }

.splash {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 32px;
  text-align: center;
}
.splash-logo { width: min(88vw, 336px); height: min(88vw, 336px); }
.splash-line { margin: 28px 0 0; font-size: 20px; font-weight: 500; }
.splash-brand { margin: 6px 0 0; color: var(--brand-red); font-size: 40px; font-weight: 900; line-height: 1.2; }
.splash-enter {
  margin-top: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

@media (min-width: 720px) {
  .icon-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .category-chip { font-size: 13px; }
}
@media (min-width: 1100px) {
  .icon-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .frame-inner,
  .page-inner,
  .bottom-nav-inner,
  .page-inner.narrow,
  .form-inner {
    width: 100%;
    max-width: none;
  }
  .page-inner { padding: 16px 28px 32px; }
  .form-inner { padding-inline: 28px; }
  .brand-frame { padding-inline: 12px; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .record-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .detail-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .footer-stack { flex-direction: row; }
  .footer-stack > .btn-primary,
  .footer-stack > .btn-ghost,
  .footer-stack > .link-btn { flex: 1; width: auto; }
  .plate { width: min(640px, 100%); }
}

@media (max-width: 380px) {
  .category-chip { font-size: 10px; }
  .plate { grid-template-columns: 36px 1fr 58px 1.2fr 56px; height: 64px; }
  .plate input, .plate select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pocket-hand, .brand-word, .category-chip span { animation: none; transition: none; }
  .brand-word { color: var(--brand-word); }
  .service-tile:active { transform: none; }
}
