/* پیگیر وب — the same soft violet look as the Android app (Kraving). */

@font-face { font-family: Vazirmatn; src: url('../fonts/Vazirmatn-Regular.ttf') format('truetype'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('../fonts/Vazirmatn-Bold.ttf') format('truetype'); font-weight: 700 900; font-display: swap; }

:root {
  --violet: #5b3df5;
  --violet-soft: #ece8fe;
  --canvas: #f1f1f6;
  --card: #ffffff;
  --well: #f4f4f8;
  --ink: #16151c;
  --muted: #6e6c7a;
  --line: #e4e3ec;
  --red: #e5484d;
  --red-soft: #fde8e8;
  --orange: #f08c00;
  --orange-soft: #fff1dc;
  --blue: #2f6fed;
  --blue-soft: #e5edfd;
  --grey-soft: #ececf2;
  --green: #2f9e57;
  --bar: #111015;
  --radius: 24px;
  --shadow: 0 1px 2px rgba(22, 21, 28, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Vazirmatn, Tahoma, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px 120px;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---- Header ---- */
.top { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.top h1 { font-size: 26px; margin: 0; flex: 1; font-weight: 800; }
.top .hello { color: var(--muted); font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.icon-btn svg, .btn svg, .nav svg { width: 20px; height: 20px; }

/* ---- Cards ---- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card.tappable { cursor: pointer; }
.card.outlined { border: 1.5px solid var(--violet); }
.card.warn { border: 1.5px solid #f6c48a; }
.card h2, .card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.summary {
  background: linear-gradient(135deg, #4f2ff0, #7a5cff); color: #fff; border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.summary .big { font-size: 40px; font-weight: 800; line-height: 1.1; }
.summary .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.summary .stat { background: rgba(255, 255, 255, 0.16); border-radius: 16px; padding: 8px; text-align: center; font-size: 13px; }
.summary .stat b { display: block; font-size: 20px; }

.badge {
  width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  flex: none; color: #fff; font-weight: 700;
}
.badge svg { width: 20px; height: 20px; }
.badge.red { background: var(--red); }
.badge.orange { background: var(--orange); }
.badge.blue { background: var(--blue); }
.badge.grey { background: #a3a1ae; }
.badge.violet { background: var(--violet); }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.grey { background: var(--grey-soft); color: var(--muted); }

.when {
  background: var(--well); border-radius: 14px; padding: 8px 12px; margin: 10px 0; font-size: 14px; color: var(--muted);
}
.when b { color: var(--ink); font-weight: 600; }
.when.late b { color: var(--red); }

/* ---- Buttons and chips ---- */
.btn {
  border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; background: var(--well);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600;
}
.btn.primary { background: var(--violet); color: #fff; }
.btn.block { width: 100%; }
.btn.link { background: none; color: var(--violet); padding: 6px 8px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.spread > * { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.chip.on { background: var(--violet); color: #fff; border-color: var(--violet); }

/* ---- Forms ---- */
label.field { display: block; margin: 12px 0 4px; font-size: 14px; color: var(--muted); }
.input {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 12px 14px;
  font-size: 16px; outline: none;
}
.input:focus { border-color: var(--violet); }
input[type=tel].input, input[inputmode=numeric].input { direction: ltr; text-align: right; }
textarea.input { min-height: 90px; resize: vertical; }
.date-row { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.error { color: var(--red); font-size: 14px; margin-top: 8px; }

.search {
  display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 4px 16px; margin-bottom: 12px;
}
.search svg { width: 20px; height: 20px; color: var(--muted); }
.search input { border: 0; outline: none; background: transparent; flex: 1; padding: 10px 0; font-size: 16px; }

/* ---- History ---- */
.history .item { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.history .item .grow { flex: 1; min-width: 0; }
.history .item:last-child { border-bottom: 0; }
.history .meta { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: left; }

/* ---- Bottom bar ---- */
.nav {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 528px;
  background: var(--bar); border-radius: 999px; padding: 8px; display: flex; align-items: center; justify-content: space-around;
  z-index: 10;
}
.nav a {
  color: #b9b7c4; display: flex; flex-direction: column; align-items: center; font-size: 12px; padding: 6px 14px; border-radius: 999px;
}
.nav a.on { background: #2a2930; color: #fff; }
.nav a.plus {
  width: 52px; height: 52px; border-radius: 50%; background: var(--violet); color: #fff; justify-content: center; padding: 0;
}
.nav a.plus svg { width: 26px; height: 26px; }

/* ---- Sheets and toast ---- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(17, 16, 21, 0.4); display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet {
  background: var(--canvas); width: 100%; max-width: 560px; border-radius: 28px 28px 0 0; padding: 20px 16px 28px;
  max-height: 90vh; overflow-y: auto;
}
.sheet h2 { margin: 0 0 8px; font-size: 18px; }
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--bar); color: #fff;
  padding: 10px 18px; border-radius: 999px; opacity: 0; transition: opacity 0.2s; z-index: 30; pointer-events: none;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.syncdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--green); }
.syncdot.busy { background: var(--orange); }
.syncdot.bad { background: var(--red); }

@media (min-width: 900px) {
  #app { max-width: 720px; }
  .nav { max-width: 688px; }
}

/* «پیش‌فاکتور»: the image the customer gets, as it will look. */
.quote-preview { background: #fff; border-radius: 24px; overflow: hidden; margin-bottom: 12px; min-height: 120px; display: grid; place-items: center; }
.quote-preview img { display: block; width: 100%; height: auto; }

/* Sales. */
.deal + .deal { border-top: 1px solid var(--line, #e6e6ec); margin-top: 10px; padding-top: 10px; }
.card.deal + .card.deal { border-top: 0; padding-top: 16px; }
.deal a.row, a.deal-past { color: inherit; text-decoration: none; }
a.deal-past { display: flex; padding: 8px 0; }
.stage-chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--violet-soft); color: var(--violet); white-space: nowrap; }
.stage-chip.warn { background: var(--orange-soft); color: var(--orange); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.chips.scroll .chip { white-space: nowrap; flex-shrink: 0; }
h3.group { margin: 16px 4px 8px; font-size: 15px; color: var(--muted); }
details.card summary { cursor: pointer; font-weight: 700; }
a.card.row { color: inherit; text-decoration: none; }

/* Reports. */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stats .card { margin: 0; }
.card.stat.warn { border: 1px solid var(--red); }
.card.stat.warn .stat-value { color: var(--red); }
.stat-value { font-size: 24px; font-weight: 800; }
.bar-row + .bar-row { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.bar { height: 4px; margin-top: 4px; }
.bar span { display: block; height: 4px; border-radius: 2px; background: var(--violet); }

/* Subscription. */
.card.ok { border: 1px solid var(--green, #2f9e44); }

/* «تولد امروز». */
.badge.pink { background: #fde7f1; color: #c2185b; }
.pill.pink { background: #fde7f1; color: #c2185b; }

/* Sign-in: short and focused. */
#app.auth { max-width: 460px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 24px; }
.logo { font-weight: 800; font-size: 20px; color: var(--violet); }
.auth-title { text-align: center; margin: 0 0 6px; font-size: 24px; }
.login-card { margin: 16px 0 12px; }

/* The introduction page (signed out). */
#app.home { max-width: 1080px; padding: 0 20px 40px; }
.site-header { display: flex; align-items: center; gap: 16px; padding: 16px 0; position: sticky; top: 0; z-index: 5; background: var(--canvas); }
.site-nav { display: flex; gap: 20px; margin-inline-start: 24px; color: var(--muted); }
.site-nav a:hover { color: var(--violet); }
.site-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.btn.big { padding: 14px 26px; font-size: 16px; }
.hero2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding: 40px 0 24px; }
.hero2 h1 { font-size: 40px; line-height: 1.45; margin: 0 0 16px; }
.hero2 p { font-size: 17px; line-height: 2; color: var(--muted); margin: 0 0 24px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.mock { background: var(--card); border-radius: 28px; padding: 20px; box-shadow: 0 20px 60px rgba(91, 61, 245, .14); max-width: 380px; margin-inline-start: auto; }
.mock-head { margin-bottom: 10px; }
.mock-summary { background: var(--violet); color: #fff; border-radius: 18px; padding: 12px 16px; margin-bottom: 12px; }
.mock-summary .big { font-size: 26px; font-weight: 800; margin-inline-end: 6px; }
.mock-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.mock-row .badge { width: 10px; height: 10px; border-radius: 50%; min-width: 10px; padding: 0; }
.pain { text-align: center; max-width: 720px; margin: 32px auto 8px; }
.pain h2 { font-size: 24px; margin: 0 0 8px; }
.pain p { font-size: 16px; line-height: 2; }
#app.home h2.section { font-size: 24px; text-align: center; margin: 48px 0 20px; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.how .card { margin: 0; }
.how h3 { margin: 8px 0 4px; }
.step { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--violet-soft); color: var(--violet); font-weight: 800; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 360px)); justify-content: center; gap: 16px; }
.plan { margin: 0; display: flex; flex-direction: column; }
.plan h3 { margin: 0; font-size: 20px; }
.plan .price { color: var(--muted); margin: 4px 0 12px; }
.plan ul { padding: 0 20px 0 0; margin: 0 0 16px; line-height: 2.1; flex: 1; }
.plan.pro { border: 2px solid var(--violet); }
.faq { margin: 0 auto 10px; max-width: 760px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 10px 0 0; line-height: 2; }
.final-cta { text-align: center; margin: 48px auto 0; max-width: 760px; padding: 32px 20px; }
.final-cta h2 { margin: 0 0 6px; }
.site-footer { display: flex; justify-content: space-between; padding: 32px 0 8px; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.features .card { margin: 0; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature h3 { margin: 0 0 4px; font-size: 16px; }
.feature p { margin: 0; line-height: 1.9; }
.feature-icon { font-size: 22px; width: 46px; height: 46px; border-radius: 14px; background: var(--violet-soft); display: grid; place-items: center; flex-shrink: 0; }
@media (max-width: 760px) {
  .site-nav { display: none; }
  .hero2 { grid-template-columns: 1fr; gap: 24px; padding-top: 16px; text-align: center; }
  .hero2 h1 { font-size: 30px; }
  .hero-cta { justify-content: center; }
  .mock { margin: 0 auto; }
  .how, .plans { grid-template-columns: 1fr; }
}
