:root {
  --navy: #7a0f26; --navy-2: #b91537; --teal: #e30620; --teal-2: #ff4a5e;
  --bg: #fbf4f6; --card: #fff; --ink: #35151e; --mute: #64748b; --line: #efd9de;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7;
  --danger: #b91c1c; --danger-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe;
  --r: 14px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.7 "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; background: var(--bg); position: relative; padding-bottom: 76px; }
body.wide .app { max-width: 980px; }
@media (min-width: 560px) { body:not(.wide) .app { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(15,23,42,.12); } }

/* هدر و ناوبری */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.top h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 700; }
.top .sub { font-size: 12px; opacity: .8; font-weight: 400; display: block; }
.icon-btn { position: relative; width: 38px; height: 38px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; font-size: 18px; }
.icon-btn .dot { position: absolute; top: -4px; inset-inline-start: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #ef4444; font-size: 11px; line-height: 18px; text-align: center; }
.nav { position: fixed; bottom: 0; inset-inline: 0; margin: 0 auto; max-width: 480px; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
body.wide .nav { max-width: 980px; }
.nav a { flex: 1; text-align: center; padding: 9px 2px 8px; font-size: 12px; color: var(--mute); text-decoration: none; position: relative; }
.nav a .i { display: block; font-size: 20px; line-height: 1.2; }
.nav a.on { color: var(--navy); font-weight: 700; }
.nav a.on::before { content: ""; position: absolute; top: 0; inset-inline: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--teal); }

main { padding: 14px 14px 8px; }
h2 { font-size: 16px; margin: 18px 4px 8px; }
h2:first-child { margin-top: 4px; }
.muted { color: var(--mute); font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.mt { margin-top: 12px; }

/* کارت */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }
.card.link { display: block; text-decoration: none; color: inherit; }
.card.link:active { transform: scale(.995); }
.tile { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; border-top: 4px solid var(--line); }
.tile b { display: block; font-size: 28px; line-height: 1.2; }
.tile span { font-size: 12.5px; color: var(--mute); }
.tile.t-warn { border-color: #f59e0b; } .tile.t-info { border-color: #3b82f6; }
.tile.t-danger { border-color: #ef4444; } .tile.t-ok { border-color: #22c55e; }

/* چیپ */
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.danger { background: var(--danger-bg); color: var(--danger); } .chip.info { background: var(--info-bg); color: var(--info); }
.chip.mute { background: #e2e8f0; color: #475569; }
.plate { display: inline-flex; align-items: center; gap: 7px; direction: ltr; unicode-bidi: isolate; font-weight: 800; padding: 1px 10px; border: 2px solid #1e293b; border-radius: 8px; background: #fff; font-size: 15px; line-height: 1.25; }
.plate b { font-weight: 800; letter-spacing: .5px; } .plate i { font-style: normal; font-size: 9px; font-weight: 700; border-inline-start: 2px solid #1e293b; padding-inline-start: 7px; text-align: center; line-height: 1.1; }
.plate::before { content: ""; width: 7px; align-self: stretch; margin: -1px 2px -1px -10px; background: #1d4ed8; border-radius: 6px 0 0 6px; }
.code { font: 700 18px/1.4 ui-monospace, Menlo, monospace; direction: ltr; unicode-bidi: isolate; color: var(--ok); background: var(--ok-bg); padding: 8px 12px; border-radius: 10px; text-align: center; letter-spacing: 1px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.timer.low { color: var(--danger); }

/* دکمه و فرم */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; cursor: pointer; background: var(--navy); color: #fff; min-height: 44px; }
.btn.block { width: 100%; } .btn.teal { background: var(--teal); } .btn.ghost { background: #f7e4e9; color: var(--navy); }
.btn.danger { background: var(--danger); } .btn.warn { background: #d97706; } .btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label.f { display: block; font-size: 13px; color: var(--mute); margin: 10px 0 4px; }
input[type=text], input[type=tel], input[type=number], select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(227,6,32,.18); }
input.ltr { direction: ltr; text-align: center; letter-spacing: 2px; }
input.bad { border-color: var(--danger); background: #fff5f5; }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }
.err { color: var(--danger); font-size: 13px; margin-top: 6px; }
.hint { background: var(--info-bg); color: #1e3a8a; padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.hint.warn { background: var(--warn-bg); color: #78350f; } .hint.danger { background: var(--danger-bg); color: #7f1d1d; } .hint.ok { background: var(--ok-bg); color: #14532d; }

/* مراحل */
.steps { display: flex; align-items: center; margin: 4px 0 14px; }
.steps .s { flex: 1; text-align: center; font-size: 11.5px; color: var(--mute); position: relative; }
.steps .s i { display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 2px; border-radius: 50%; background: #cbd5e1; color: #fff; font-style: normal; font-weight: 700; position: relative; z-index: 1; }
.steps .s.on i { background: var(--navy); } .steps .s.done i { background: var(--teal); }
.steps .s.on { color: var(--navy); font-weight: 700; }
.steps .s:not(:last-child)::after { content: ""; position: absolute; top: 14px; inset-inline-start: 50%; width: 100%; height: 3px; background: #cbd5e1; }
.steps .s.done:not(:last-child)::after { background: var(--teal); }

/* چک‌لیست */
.item { background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; border: 1.5px solid var(--line); }
.item.fail { border-color: #fca5a5; background: #fffafa; } .item.ok { border-color: #bbf7d0; } .item.na { border-color: #e2e8f0; background: #f8fafc; }
.item .q { display: flex; gap: 8px; font-size: 14px; }
.item .q b { color: var(--mute); min-width: 22px; }
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 0; font-size: 13px; cursor: pointer; font-weight: 600; color: var(--mute); }
.seg button.on.ok { background: var(--ok-bg); border-color: #22c55e; color: var(--ok); }
.seg button.on.fail { background: var(--danger-bg); border-color: #ef4444; color: var(--danger); }
.seg button.on.na { background: #e2e8f0; border-color: #94a3b8; color: #334155; }
.item input[type=text] { margin-top: 8px; min-height: 38px; }
.decl { font-size: 12px; margin-top: 6px; }
.cl-title { font-size: 13px; font-weight: 700; color: var(--navy); margin: 14px 4px 6px; }
.progress { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin: 6px 0 12px; }
.progress i { display: block; height: 100%; background: var(--teal); transition: width .25s; }

/* عکس */
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
body.wide .photos { grid-template-columns: repeat(4, 1fr); }
.ph { position: relative; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; background: #e8eef4; border: 2px dashed #94a3b8; display: grid; place-items: center; text-align: center; font-size: 12.5px; color: var(--mute); cursor: pointer; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph.set { border: 2px solid var(--teal); }
.ph .lb { position: absolute; bottom: 0; inset-inline: 0; background: rgba(11,58,91,.82); color: #fff; padding: 2px 6px; font-size: 12px; }
.ph .ic { font-size: 26px; display: block; }
.tread { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; border: 1.5px solid var(--line); }
.tread input { width: 90px; text-align: center; }

.empty { text-align: center; color: var(--mute); padding: 36px 10px; }
.empty .big { font-size: 40px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 14px; }
.kv dt { color: var(--mute); } .kv dd { margin: 0; }
.sticky-bar { position: sticky; bottom: 62px; padding: 10px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; }
.tabs button { border: 0; background: #e8eef4; border-radius: 999px; padding: 6px 14px; font-size: 13px; white-space: nowrap; cursor: pointer; color: var(--navy); }
.tabs button.on { background: var(--navy); color: #fff; }

/* ورود */
.login { min-height: 100dvh; display: grid; align-content: center; padding: 20px; background: linear-gradient(160deg, #7a0f26, #b91537 60%, #e30620); }
.login .box { background: #fff; border-radius: 22px; padding: 24px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login .logo { width: 64px; height: 64px; display: block; margin: -56px auto 8px; border-radius: 18px; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.login h1 { text-align: center; font-size: 20px; margin: 0; } .login p { text-align: center; margin: 4px 0 14px; }
.demo { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.demo .tabs { flex-wrap: wrap; } .demo button { font-size: 12px; }

.toast { position: fixed; bottom: 86px; inset-inline: 16px; margin: 0 auto; max-width: 440px; padding: 11px 16px; border-radius: 12px; background: #1e293b; color: #fff; text-align: center;
  opacity: 0; transform: translateY(12px); transition: .22s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: none; } .toast.bad { background: var(--danger); } .toast.good { background: var(--ok); }
.spin { display: inline-block; width: 16px; height: 16px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; font-size: 12px; color: var(--mute); }
.bar i { display: block; width: 70%; min-height: 3px; background: linear-gradient(var(--teal-2), var(--teal)); border-radius: 6px 6px 0 0; }
.bar b { color: var(--ink); font-size: 12px; }

.role-sw { border: 0; border-radius: 10px; padding: 6px 8px; background: rgba(255,255,255,.18); color: #fff; font-size: 12.5px; min-height: 36px; max-width: 108px; }
.role-sw option { color: #111; }

/* صفحه ورود دو ستونه */
body.auth-mode .app { max-width: none; padding-bottom: 0; background: #fff; }
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100dvh; gap: 0; }
.auth-hero { margin: 12px; border-radius: 28px; padding: 36px 40px; color: #fff; display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden;
  background: radial-gradient(circle at 20% 10%, rgba(255,255,255,.10), transparent 40%), linear-gradient(160deg, #5a0a1d, #b91537 60%, #e30620); }
.a-badge { align-self: flex-start; background: rgba(255,255,255,.14); padding: 4px 14px; border-radius: 999px; font-size: 13px; }
.auth-hero h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.35; margin: 24px 0 0; } .auth-hero h2 em { font-style: normal; color: #ffc2cb; }
.auth-hero p { margin: 0; opacity: .88; max-width: 520px; }
.a-card { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 20px; padding: 16px; max-width: 360px; margin-top: 8px; backdrop-filter: blur(4px); }
.muted-w { font-size: 12.5px; opacity: .8; } .a-ok { background: rgba(255,255,255,.2); padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.a-row { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,.12); border-radius: 12px; padding: 8px 12px; margin-top: 8px; font-size: 14px; }
.a-row i { font-style: normal; background: #fff; color: var(--teal); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.a-bar { height: 5px; background: rgba(255,255,255,.2); border-radius: 3px; margin-top: 12px; } .a-bar i { display: block; width: 100%; height: 100%; background: #fff; border-radius: 3px; }
.a-feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: auto; }
.a-feat { background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18); border-radius: 16px; padding: 12px; }
.a-feat b { font-size: 22px; } .a-feat h4 { margin: 4px 0 0; font-size: 14.5px; } .a-feat p { margin: 0; font-size: 12.5px; opacity: .8; }
.auth-main { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 24px clamp(20px, 6vw, 80px); }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.home-btn { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 14px; color: var(--ink); text-decoration: none; font-size: 14px; background: #fff; }
.brandline { display: flex; align-items: center; gap: 8px; } .brandline b { font-size: 22px; color: var(--navy-2); } .brandline small { color: var(--mute); font-size: 12px; } .brandline img { border-radius: 11px; }
.auth-card { background: #fff; border: 1.5px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: 0 10px 40px rgba(185,21,55,.08); }
.auth-card h2 { margin: 14px 0 2px; font-size: 21px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #fbf4f6; border-radius: 14px; padding: 4px; gap: 4px; }
.auth-tabs button { border: 0; background: transparent; border-radius: 11px; padding: 9px; font-weight: 700; cursor: pointer; color: var(--mute); }
.auth-tabs button.on { background: #fff; color: var(--navy-2); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.install-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--soft2, #ffe1e8); border-radius: 16px; padding: 12px 16px; } .install-banner[hidden] { display: none; }
.center { text-align: center; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none; } .auth-main { padding: 20px; min-height: 100dvh; } }
