/* Rate-quotation app (نرخ‌دهی) — standalone page embedded by /nerkh and panel/nerkh. */
:root {
    --blu-900: #0b1f44; --blu-700: #173a7a; --blu-600: #1e4fb0; --blu-500: #2563eb;
    --blu-400: #3b82f6; --blu-100: #dbeafe; --blu-50: #eff5ff;
    --ink: #0f1a2e; --body: #3f4b5f; --muted: #8a96a8;
    --line: rgba(15, 26, 46, .09); --line-2: rgba(15, 26, 46, .06);
    --surface: #fff; --bg: #f5f8fd;
    --ok: #0f9d6b; --ok-bg: #e7f7f0; --warn: #b7791f; --warn-bg: #fdf5e6; --err: #d14343; --err-bg: #fdeeee;
    --radius: 14px; --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(15, 26, 46, .05), 0 2px 8px rgba(15, 26, 46, .04);
    --shadow-md: 0 8px 28px rgba(15, 26, 46, .08);
    --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--body);
    font: 400 15px/1.8 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--blu-600); text-decoration: none; }

.nq { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }

/* Stepper */
.nq-steps { scroll-margin-top: 96px; display: flex; gap: 8px; list-style: none; margin: 0 0 22px; padding: 0; counter-reset: s; }
.nq-steps li {
    flex: 1; display: flex; align-items: center; gap: 8px; padding: 9px 12px;
    border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
    font-size: .85rem; font-weight: 700; color: var(--muted); transition: all .25s var(--ease);
}
.nq-steps li span {
    width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; display: grid; place-items: center;
    background: var(--line-2); font-size: .8rem;
}
.nq-steps li.is-on { color: var(--blu-600); border-color: var(--blu-100); box-shadow: var(--shadow-sm); }
.nq-steps li.is-on span { background: var(--blu-500); color: #fff; }
.nq-steps li.is-done { color: var(--ok); }
.nq-steps li.is-done span { background: var(--ok-bg); }

/* Headings */
.nq-intro { text-align: center; margin: 6px auto 26px; max-width: 640px; }
.nq-intro h1, .nq-head h1 { margin: 0 0 6px; color: var(--ink); font-size: clamp(1.15rem, 2.6vw, 1.5rem); font-weight: 900; line-height: 1.6; }
.nq-intro p, .nq-head p { margin: 0; color: var(--body); font-size: .92rem; }
.nq-head { margin: 4px 0 18px; }
.nq-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.nq-back { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 700; margin-bottom: 10px; }

.nq-search {
    display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 0 16px; height: 50px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm);
}
.nq-search i { color: var(--muted); font-size: 1.15rem; }
.nq-search input { flex: 1; border: 0; outline: 0; background: none; height: 100%; }
.nq-search:focus-within { border-color: var(--blu-400); box-shadow: 0 0 0 4px var(--blu-50); }

/* Category grid */
.nq-group { margin-bottom: 22px; }
.nq-group__title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .95rem; font-weight: 800; color: var(--ink); }
.nq-group__title i { color: var(--blu-500); }
.nq-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.nq-cat {
    display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    font-weight: 700; font-size: .92rem; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.nq-cat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--blu-100); }
.nq-cat:active { transform: scale(.98); }
.nq-cat__icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; }
.nq-cat__title { flex: 1; line-height: 1.6; }
.nq-cat__go { color: var(--muted); font-size: 1.2rem; }
.tone-vehicle { background: #e8f0ff; color: #1e4fb0; }
.tone-person { background: #fdecef; color: #c2334d; }
.tone-fire { background: #fff1e5; color: #c25a0b; }
.tone-liability { background: #ecf7f2; color: #0f8a5f; }
.tone-engineering { background: #f1edfd; color: #6741c9; }
.nq-empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* Form */
.nq-section {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.nq-section__title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: .98rem; font-weight: 800; color: var(--ink); }
.nq-section__title span {
    width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
    background: var(--blu-50); color: var(--blu-600); font-size: .8rem;
}
.nq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.nq-field { min-width: 0; }
.nq-field--wide { grid-column: 1 / -1; }
.nq-field > label, .nq-field > .nq-label { display: block; margin-bottom: 6px; font-size: .86rem; font-weight: 700; color: var(--ink); }
.nq-req { color: var(--err); margin-inline-start: 2px; }
.nq-input {
    width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
    background: #fbfcfe; outline: 0; transition: border-color .2s, box-shadow .2s;
}
.nq-input:focus { border-color: var(--blu-400); box-shadow: 0 0 0 4px var(--blu-50); background: #fff; }
.nq-field.has-error .nq-input, .nq-field.has-error .nq-combo__btn { border-color: var(--err); }
.nq-error { margin: 5px 0 0; font-size: .8rem; color: var(--err); }
.nq-hint { margin: 5px 0 0; font-size: .78rem; color: var(--muted); }

/* Pills (short option lists) */
.nq-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.nq-pill { position: relative; }
.nq-pill input { position: absolute; opacity: 0; pointer-events: none; }
.nq-pill span {
    display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 7px 14px;
    border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; cursor: pointer;
    font-size: .87rem; line-height: 1.6; transition: all .18s var(--ease);
}
.nq-pill span:hover { border-color: var(--blu-100); }
.nq-pill input:checked + span { border-color: var(--blu-500); background: var(--blu-50); color: var(--blu-700); font-weight: 700; }
.nq-pill input:focus-visible + span { box-shadow: 0 0 0 4px var(--blu-50); }
.nq-pill--check input:checked + span::before { content: '\eb7b'; font-family: 'remixicon'; }

/* Searchable combobox */
.nq-combo { position: relative; }
.nq-combo__btn {
    width: 100%; height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 8px; text-align: start;
    border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; cursor: pointer;
}
.nq-combo__btn span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nq-combo__btn span.is-placeholder { color: var(--muted); }
.nq-combo__btn i { color: var(--muted); transition: transform .2s; }
.nq-combo.is-open .nq-combo__btn { border-color: var(--blu-400); box-shadow: 0 0 0 4px var(--blu-50); }
.nq-combo.is-open .nq-combo__btn i { transform: rotate(180deg); }
.nq-combo__pop {
    position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 6px); background: var(--surface);
    border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); overflow: hidden;
}
.nq-combo__pop input { width: 100%; height: 44px; border: 0; border-bottom: 1px solid var(--line-2); padding: 0 14px; outline: 0; }
.nq-combo__list { max-height: 260px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; overscroll-behavior: contain; }
.nq-combo__list li { padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: .88rem; line-height: 1.6; }
.nq-combo__list li:hover, .nq-combo__list li.is-active { background: var(--blu-50); color: var(--blu-700); }
.nq-combo__list li.is-selected { font-weight: 800; color: var(--blu-600); }
.nq-combo__list li.is-empty { color: var(--muted); cursor: default; background: none; }

/* Date (three selects) */
.nq-date { display: grid; grid-template-columns: 1fr 1.3fr 1.2fr; gap: 8px; }
.nq-date select { padding: 0 10px; appearance: none; background-image: none; }

.nq-submit {
    position: sticky; bottom: 0; z-index: 20; margin: 6px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.nq-alert--page { margin-bottom: 18px; }
.nq-alert { margin: 0 0 10px; padding: 10px 14px; border-radius: 12px; background: var(--err-bg); color: var(--err); font-size: .87rem; font-weight: 600; }

.nq-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 22px;
    border: 0; border-radius: 14px; cursor: pointer; font-weight: 800; font-size: .95rem;
    transition: transform .15s var(--ease), box-shadow .2s, background .2s;
}
.nq-btn:active { transform: scale(.98); }
.nq-btn--primary { width: 100%; background: var(--blu-500); color: #fff; box-shadow: 0 8px 20px rgba(37, 99, 235, .25); }
.nq-btn--primary:hover { background: var(--blu-600); }
.nq-btn--primary[disabled] { opacity: .65; cursor: progress; }
.nq-btn--buy { height: 44px; background: var(--blu-500); color: #fff; padding: 0 20px; }
.nq-btn--buy:hover { background: var(--blu-600); color: #fff; }

/* Results */
.nq-sort { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.nq-sort button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; cursor: pointer; font-size: .82rem; font-weight: 700; color: var(--body); }
.nq-sort button.is-on { background: var(--blu-500); color: #fff; }

.nq-summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.nq-summary summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; font-weight: 700; color: var(--ink); font-size: .9rem; list-style: none; }
.nq-summary summary::-webkit-details-marker { display: none; }
.nq-summary summary::after { content: '\ea4e'; font-family: 'remixicon'; margin-inline-start: auto; color: var(--muted); transition: transform .2s; }
.nq-summary[open] summary::after { transform: rotate(180deg); }
.nq-summary dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin: 0; padding: 0 16px 14px; }
.nq-summary dl div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .84rem; }
.nq-summary dt { color: var(--muted); }
.nq-summary dd { margin: 0; color: var(--ink); font-weight: 700; text-align: left; }

.nq-quotes { display: grid; gap: 12px; }
.nq-quote {
    display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) auto; gap: 18px; align-items: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px;
    box-shadow: var(--shadow-sm); animation: nq-in .35s var(--ease) both;
}
.nq-quote.is-best { border-color: var(--blu-400); box-shadow: 0 0 0 3px var(--blu-50), var(--shadow-sm); }
@keyframes nq-in { from { opacity: 0; transform: translateY(8px); } }
.nq-quote__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nq-quote__logo { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 14px; border: 1px solid var(--line-2); background: #fff; display: grid; place-items: center; overflow: hidden; }
.nq-quote__logo img { max-width: 80%; max-height: 80%; object-fit: contain; }
.nq-quote__name { margin: 0; font-weight: 900; color: var(--ink); font-size: 1rem; }
.nq-quote__plan { margin: 0; font-size: .76rem; color: var(--muted); line-height: 1.6; }
.nq-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.nq-badge { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--blu-50); color: var(--blu-600); }
.nq-badge--ok { background: var(--ok-bg); color: var(--ok); }
.nq-badge--warn { background: var(--warn-bg); color: var(--warn); }
.nq-quote__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; margin: 0; font-size: .8rem; }
.nq-quote__facts div { display: flex; justify-content: space-between; gap: 8px; }
.nq-quote__facts dt { color: var(--muted); }
.nq-quote__facts dd { margin: 0; color: var(--ink); font-weight: 700; white-space: nowrap; }
.nq-stars { color: #f5a524; letter-spacing: 1px; }
.nq-stars .off { color: #e3e7ee; }
.nq-quote__buy { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.nq-price { text-align: left; }
.nq-price del { display: block; font-size: .78rem; color: var(--muted); }
.nq-price strong { font-size: 1.3rem; font-weight: 900; color: var(--ink); }
.nq-price small { font-size: .78rem; color: var(--muted); margin-inline-start: 4px; }
.nq-note { display: flex; gap: 8px; align-items: flex-start; margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--blu-50); color: var(--blu-700); font-size: .84rem; }
.nq-note i { font-size: 1.1rem; margin-top: 2px; }

/* Loading */
.nq-loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; text-align: center; background: rgba(245, 248, 253, .82); backdrop-filter: blur(2px); }
.nq-loading p { margin: 10px 0 0; font-weight: 700; color: var(--blu-700); }
.nq-spin { width: 40px; height: 40px; margin: 0 auto; border-radius: 50%; border: 3px solid var(--blu-100); border-top-color: var(--blu-500); animation: nq-spin .8s linear infinite; }
@keyframes nq-spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
    .nq-quote { grid-template-columns: 1fr; gap: 12px; }
    .nq-quote__buy { flex-direction: row; justify-content: space-between; align-items: center; border-top: 1px solid var(--line-2); padding-top: 12px; }
}
@media (max-width: 640px) {
    .nq { padding: 14px 16px 28px; }
    .nq-steps li { padding: 8px; font-size: .74rem; justify-content: center; }
    .nq-grid, .nq-summary dl { grid-template-columns: 1fr; }
    .nq-cats { grid-template-columns: 1fr; }
    .nq-section { padding: 14px; }
    .nq-sort { width: 100%; }
    .nq-sort button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
