
/* ================= public site ================= */
body.pub { background:var(--bg); overflow-x:hidden; }
.pub-nav {
    position:sticky; top:0; z-index:50; display:flex; align-items:center; gap:18px;
    padding:12px clamp(14px,4vw,40px); background:color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter:saturate(1.4) blur(10px); border-bottom:1px solid var(--border);
}
.pub-nav .brand { padding:0; gap:10px; }
.pub-nav .brand > span:last-child { display:flex; flex-direction:column; }
.pub-links { display:flex; gap:20px; margin-inline-start:18px; font-size:13px; }
.pub-links a { color:var(--muted); font-weight:500; }
.pub-links a:hover { color:var(--brand); }
.pub-actions { margin-inline-start:auto; display:flex; align-items:center; gap:8px; }

.hero { position:relative; padding:clamp(48px,9vw,104px) clamp(14px,4vw,40px) clamp(30px,5vw,64px); overflow:hidden; }
.hero-glow {
    position:absolute; inset-inline:0; top:-260px; height:620px; z-index:0; pointer-events:none;
    background:
        radial-gradient(60% 55% at 50% 45%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
        radial-gradient(40% 40% at 82% 20%, color-mix(in srgb, #37b6c9 18%, transparent), transparent 70%);
    filter:blur(10px);
}
.hero-inner { position:relative; z-index:1; max-width:980px; margin:0 auto; text-align:center; }
.hero h1 { font-size:clamp(27px,4.4vw,46px); line-height:1.35; letter-spacing:-.6px; margin:18px 0 0; }
.hero h1 .grad {
    display:inline-block;
    background:linear-gradient(100deg,var(--brand),#2bb3a3 70%);
    -webkit-background-clip:text; background-clip:text; color:transparent;
}
.hero .lead { max-width:720px; margin:16px auto 0; font-size:clamp(14px,1.6vw,16.5px); color:var(--muted); line-height:2; }
.hero-cta { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top:26px; }
.hero .pill {
    display:inline-flex; align-items:center; gap:8px; padding:6px 14px; border-radius:999px;
    max-width:100%; flex-wrap:wrap; justify-content:center; text-align:center;
    background:var(--surface); border:1px solid var(--border); font-size:12px; color:var(--muted);
    box-shadow:var(--shadow);
}
.dot-live { width:7px; height:7px; border-radius:50%; background:var(--ok); box-shadow:0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent); animation:pulse 2.4s infinite; }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.45 } }

.hero-stats {
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px;
    margin-top:38px; padding:16px; border-radius:var(--radius);
    background:var(--surface); border:1px solid var(--border); box-shadow:var(--shadow);
}
.hero-stats > div { display:flex; flex-direction:column; gap:2px; padding:6px 8px; min-width:0; border-inline-start:1px solid var(--border); }
.hero-stats > div:first-child { border:0; }
.hero-stats b { font-size:clamp(15px,2vw,20px); font-weight:800; letter-spacing:-.3px; overflow-wrap:anywhere; }
.hero-stats span { font-size:11.5px; color:var(--muted); }

.pub-section { padding:clamp(34px,6vw,72px) clamp(14px,4vw,40px); max-width:1180px; margin:0 auto; }
.pub-section.alt { background:var(--surface); border-block:1px solid var(--border); max-width:none; }
.pub-section.alt > * { max-width:1180px; margin-inline:auto; }
.sec-head { text-align:center; max-width:720px; margin:0 auto 30px; }
.sec-head h2 { font-size:clamp(20px,2.6vw,28px); margin:8px 0 8px; letter-spacing:-.4px; }
.sec-head p { color:var(--muted); margin:0; font-size:13.5px; }
.eyebrow { font-size:11.5px; font-weight:700; letter-spacing:.14em; color:var(--brand); text-transform:uppercase; }

.pub-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:14px; }
.pub-card {
    background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
    padding:20px; transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.pub-card:hover { transform:translateY(-3px); box-shadow:var(--shadow); border-color:color-mix(in srgb, var(--brand) 35%, var(--border)); }
.pub-card h3 { font-size:14.5px; margin:12px 0 6px; }
.pub-card p { margin:0; color:var(--muted); font-size:13px; line-height:1.95; }
.pc-icon {
    width:40px; height:40px; border-radius:12px; display:grid; place-items:center; font-size:18px;
    background:var(--brand-soft); color:var(--brand); border:1px solid color-mix(in srgb, var(--brand) 18%, transparent);
}

.steps { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:14px; margin-bottom:26px; }
.step { position:relative; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); padding:22px 20px; }
.step-no {
    width:34px; height:34px; border-radius:50%; display:grid; place-items:center; font-weight:800;
    background:linear-gradient(135deg,var(--brand),#37b6c9); color:#fff; margin-bottom:10px;
}
.step h3 { font-size:14.5px; margin-bottom:4px; }
.step p { margin:0; color:var(--muted); font-size:13px; }

.sample-msg {
    max-width:640px; margin:0 auto; border-radius:var(--radius); border:1px solid var(--border);
    background:var(--surface); padding:16px 18px; box-shadow:var(--shadow);
}
.sm-head { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); margin-bottom:10px; }
.sm-dot { width:8px; height:8px; border-radius:50%; background:var(--brand); }
.sample-msg pre {
    margin:0; white-space:pre-wrap; font-family:inherit; font-size:13px; line-height:2;
    color:var(--text); background:var(--surface-2); border-radius:12px; padding:14px 16px; border:1px solid var(--border);
}

.price-box { display:grid; grid-template-columns:1.6fr 1fr; gap:24px; align-items:center; background:var(--surface); border:1px solid var(--border); border-radius:calc(var(--radius) + 4px); padding:clamp(20px,3vw,34px); box-shadow:var(--shadow); }
.price-box h2 { font-size:clamp(19px,2.4vw,26px); margin:6px 0 8px; }
.price-box p { margin:0; font-size:13.5px; line-height:2; }
.ticks { list-style:none; padding:0; margin:14px 0 0; display:grid; gap:7px; font-size:13px; }
.ticks li::before { content:"✓"; color:var(--ok); font-weight:800; margin-inline-end:8px; }
.price-cta { display:flex; flex-direction:column; gap:8px; align-items:stretch; text-align:center; }

.faq { max-width:820px; margin:0 auto; display:grid; gap:10px; }
.faq details { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:14px 18px; }
.faq details[open] { border-color:color-mix(in srgb, var(--brand) 35%, var(--border)); }
.faq summary { cursor:pointer; font-weight:600; font-size:13.5px; list-style:none; position:relative; padding-inline-start:18px; }
.faq summary::before { content:"+"; position:absolute; inset-inline-start:0; color:var(--brand); font-weight:800; }
.faq details[open] summary::before { content:"−"; }
.faq summary::-webkit-details-marker { display:none; }
.faq p { margin:10px 0 0; color:var(--muted); font-size:13px; line-height:2; }

.final-cta { text-align:center; background:linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), var(--surface) 65%); border:1px solid var(--border); border-radius:calc(var(--radius) + 6px); padding:clamp(28px,4vw,48px); }
.final-cta h2 { font-size:clamp(19px,2.6vw,27px); margin-bottom:8px; }
.final-cta p { color:var(--muted); margin:0 0 4px; }

.pub-foot { border-top:1px solid var(--border); background:var(--surface); padding:34px clamp(14px,4vw,40px) 18px; margin-top:20px; }
.pub-foot-inner { max-width:1180px; margin:0 auto; display:grid; grid-template-columns:1.4fr 2fr; gap:30px; }
.pub-foot p { margin:8px 0 0; max-width:380px; line-height:1.95; }
.pub-foot-cols { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
.pub-foot-cols a { display:block; color:var(--muted); font-size:12.5px; padding:2px 0; }
.pub-foot-cols a:hover { color:var(--brand); }
.foot-title { font-weight:700; font-size:12.5px; margin-bottom:6px; }
.pub-foot-bar { max-width:1180px; margin:22px auto 0; padding-top:14px; border-top:1px solid var(--border); display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; font-size:11.5px; color:var(--muted); }
.muted { color:var(--muted); }
.small { font-size:12px; }

.btn.lg { padding:12px 22px; font-size:14px; border-radius:12px; }
.btn.block { width:100%; justify-content:center; }

.legal { max-width:780px; margin:0 auto; padding:clamp(26px,5vw,56px) clamp(14px,4vw,40px) 56px; }
.legal h1 { font-size:clamp(22px,3vw,30px); margin-bottom:6px; }
.legal h2 { font-size:15.5px; margin:26px 0 8px; }
.legal p, .legal li { color:var(--muted); font-size:13.5px; line-height:2.1; }
.legal ul { padding-inline-start:18px; }
.legal-meta { font-size:12px; color:var(--muted); margin:0 0 18px; }
.legal .notice { background:color-mix(in srgb, var(--warn) 12%, var(--surface)); border:1px solid color-mix(in srgb, var(--warn) 40%, var(--border)); color:var(--text); border-radius:12px; padding:12px 16px; font-size:12.5px; }
.back-link { font-size:12.5px; color:var(--muted); display:inline-block; margin-bottom:14px; }

@media (max-width:860px) {
    .pub-links { display:none; }
    .hero-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .hero-stats > div:nth-child(3) { border-inline-start:0; }
    .price-box { grid-template-columns:1fr; }
    .pub-foot-inner { grid-template-columns:1fr; }
}
@media (max-width:520px) {
    .pub-actions .btn.ghost { display:none; }
    .pub-foot-cols { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .hero h1 { letter-spacing:-.2px; }
    .hero .lead { font-size:13.5px; }
    .hero-stats { padding:12px; gap:6px; }
    .sample-msg pre { font-size:12px; }
    .legal { padding-inline:16px; }
}
/* ---------- webfont (self-hosted) ---------- */
@font-face {
    font-family: "Vazirmatn";
    src: url("/fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("/fonts/Vazirmatn-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("/fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand:#0b6bcb; --brand-strong:#0958a8; --brand-soft:#e6f0fb;
    --bg:#f2f5f9; --surface:#ffffff; --surface-2:#f8fafc; --border:#e3e9f1;
    --text:#16202e; --muted:#66758a; --ok:#0f9d58; --warn:#d9822b; --danger:#d64545;
    --shadow:0 1px 2px rgba(16,32,54,.06), 0 8px 24px -12px rgba(16,32,54,.18);
    --radius:16px; --radius-sm:10px;
    --sidebar:248px;
}
[data-theme="dark"] {
    --brand:#4c9aff; --brand-strong:#77b4ff; --brand-soft:#14304f;
    --bg:#0a1220; --surface:#101a2b; --surface-2:#16233a; --border:#1f2f47;
    --text:#e7eefb; --muted:#8fa3bf; --ok:#37c37a; --warn:#e0a458; --danger:#ff7a7a;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 12px 30px -14px rgba(0,0,0,.6);
}
* { box-sizing:border-box; }
html, body { height:100%; }
body {
    margin:0; background:var(--bg); color:var(--text); font-size:14px; line-height:1.75;
    font-family:"Vazirmatn","IRANSans",Tahoma,"Segoe UI",system-ui,sans-serif;
    -webkit-font-smoothing:antialiased;
}
a { color:var(--brand); text-decoration:none; }
a:hover { color:var(--brand-strong); }
h1,h2,h3 { margin:0; font-weight:700; letter-spacing:-.1px; }
h1 { font-size:22px; } h2 { font-size:16px; } h3 { font-size:14px; }

/* ---------- shell ---------- */
.shell { display:flex; min-height:100vh; }
.sidebar {
    width:var(--sidebar); flex:0 0 var(--sidebar); background:var(--surface);
    border-inline-start:1px solid var(--border); display:flex; flex-direction:column;
    position:sticky; top:0; height:100vh; padding:18px 14px; gap:6px; z-index:30;
    transition:transform .25s ease, width .2s ease;
}
.brand { display:flex; align-items:center; gap:10px; padding:6px 8px 18px; }
.brand-logo {
    width:36px; height:36px; border-radius:11px; display:grid; place-items:center;
    background:linear-gradient(135deg,var(--brand),#37b6c9); color:#fff; font-weight:800; font-size:15px;
    box-shadow:0 6px 16px -8px var(--brand);
}
.brand-name { font-weight:800; font-size:15px; line-height:1.2; }
.brand-sub { font-size:11px; color:var(--muted); }
.nav-item {
    display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:12px;
    color:var(--muted); font-weight:500; transition:background .15s ease, color .15s ease;
}
.nav-item svg { width:18px; height:18px; flex:0 0 18px; }
.nav-item:hover { background:var(--surface-2); color:var(--text); }
.nav-item.active { background:var(--brand-soft); color:var(--brand); font-weight:700; }
.nav-item .badge-dot { margin-inline-start:auto; }
.sidebar-foot { margin-top:auto; font-size:11px; color:var(--muted); padding:10px 8px; border-top:1px dashed var(--border); }

.main { flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar {
    display:flex; align-items:center; gap:12px; padding:14px 26px; background:var(--surface);
    border-bottom:1px solid var(--border); position:sticky; top:0; z-index:20;
}
.topbar .crumbs { color:var(--muted); font-size:12.5px; }
.topbar .crumbs b { color:var(--text); }
.searchbox { margin-inline-start:auto; position:relative; }
.searchbox input {
    width:280px; padding:9px 36px 9px 12px; border-radius:12px; border:1px solid var(--border);
    background:var(--surface-2); color:var(--text); font-family:inherit; font-size:13px;
}
.searchbox svg { position:absolute; inset-inline-end:10px; top:9px; width:16px; height:16px; color:var(--muted); }
.icon-btn {
    width:38px; height:38px; border-radius:12px; border:1px solid var(--border); background:var(--surface);
    display:grid; place-items:center; cursor:pointer; color:var(--muted); transition:all .15s ease;
}
.icon-btn:hover { color:var(--brand); border-color:var(--brand); }
.icon-btn svg { width:18px; height:18px; }
.content { padding:24px 26px 48px; max-width:1500px; width:100%; }

/* ---------- page header ---------- */
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; flex-wrap:wrap; }
.page-head .sub { color:var(--muted); font-size:13px; margin-top:2px; }
.page-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* ---------- cards & kpi ---------- */
.card {
    background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
    padding:18px 20px; box-shadow:var(--shadow); margin-bottom:16px;
}
.card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.card-head .hint { color:var(--muted); font-size:12px; }
.kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:14px; margin-bottom:16px; }
.kpi {
    background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
    padding:16px 18px; box-shadow:var(--shadow); position:relative; overflow:hidden;
}
.kpi .label { color:var(--muted); font-size:12px; display:flex; align-items:center; gap:6px; }
.kpi .value { font-size:26px; font-weight:800; margin-top:4px; letter-spacing:-.5px; }
.kpi .delta { font-size:11.5px; margin-top:2px; color:var(--muted); }
.kpi .spark { position:absolute; inset-inline-start:0; inset-block-end:0; opacity:.9; }
.kpi.accent .value { color:var(--brand); }

.grid-2 { display:grid; grid-template-columns:1.35fr 1fr; gap:16px; }
.grid-2.even { grid-template-columns:1fr 1fr; }
@media (max-width:1100px) { .grid-2, .grid-2.even { grid-template-columns:1fr; } }

/* ---------- buttons ---------- */
.btn {
    display:inline-flex; align-items:center; justify-content:center; gap:7px; padding:9px 16px;
    border-radius:12px; border:1px solid var(--border); background:var(--surface); color:var(--text);
    font-family:inherit; font-size:13px; font-weight:600; cursor:pointer; transition:all .15s ease;
}
.btn svg { width:16px; height:16px; }
.btn:hover { border-color:#c7d5e5; transform:translateY(-1px); }
.btn:active { transform:translateY(0); }
.btn.primary { background:var(--brand); border-color:var(--brand); color:#fff; box-shadow:0 8px 18px -10px var(--brand); }
.btn.primary:hover { background:var(--brand-strong); }
.btn.subtle { background:var(--surface-2); }
.btn.ghost { background:transparent; }
.btn.danger { color:var(--danger); border-color:color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn.sm { padding:6px 11px; font-size:12px; border-radius:10px; }
.btn.icon { padding:0; width:34px; height:34px; }
.btn[disabled] { opacity:.55; cursor:not-allowed; }

/* ---------- forms ---------- */
.field { display:flex; flex-direction:column; gap:6px; }
.field > span { font-size:12.5px; color:var(--muted); font-weight:600; }
.field .hint { font-size:11.5px; color:var(--muted); font-weight:400; }
input[type=text], input[type=search], input[type=number], input[type=password], select, textarea {
    width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:12px;
    background:var(--surface); color:var(--text); font-family:inherit; font-size:13px;
    transition:border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline:none; border-color:var(--brand); box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.switches { display:flex; gap:14px; flex-wrap:wrap; }
.switch { display:inline-flex; align-items:center; gap:8px; font-size:13px; cursor:pointer; }
.switch input { width:auto; }

/* ---------- tables ---------- */
.table-wrap { overflow:auto; border-radius:var(--radius); border:1px solid var(--border); background:var(--surface); }
table.table { width:100%; border-collapse:collapse; font-size:13px; }
.table th {
    text-align:right; font-size:11.5px; color:var(--muted); font-weight:700; padding:12px 14px;
    background:var(--surface-2); border-bottom:1px solid var(--border); white-space:nowrap; position:sticky; top:0;
}
.table th a { color:inherit; }
.table td { padding:12px 14px; border-bottom:1px solid var(--border); vertical-align:top; }
.table tbody tr:hover { background:color-mix(in srgb, var(--brand) 4%, transparent); }
.table tr:last-child td { border-bottom:none; }
.title-cell { min-width:280px; }
.title-cell .t { font-weight:600; }
.title-cell .s { color:var(--muted); font-size:11.5px; }
.num { white-space:nowrap; font-variant-numeric:tabular-nums; }
.muted { color:var(--muted); }
.small { font-size:11.5px; }
.mono { font-family:ui-monospace,Consolas,monospace; direction:ltr; }

/* ---------- badges / pills ---------- */
.pill { display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; padding:3px 9px; border-radius:999px; background:var(--surface-2); color:var(--muted); }
.pill.board-auction { background:#e8f1ff; color:#0b6bcb; }
.pill.board-tender { background:#fff3e0; color:#b26a00; }
.pill.board-procurement { background:#e9f7ef; color:#0b7a42; }
.pill.pending { background:#fff4e0; color:#a06200; }
.pill.sent { background:#e6f7ee; color:#0b7a42; }
[data-theme="dark"] .pill.board-auction { background:#14304f; color:#7fb6ff; }
[data-theme="dark"] .pill.board-tender { background:#3a2a12; color:#e7b169; }
[data-theme="dark"] .pill.board-procurement { background:#12301f; color:#6fd39b; }
[data-theme="dark"] .pill.pending { background:#3a2a12; color:#e7b169; }
[data-theme="dark"] .pill.sent { background:#12301f; color:#6fd39b; }
.dot { width:7px; height:7px; border-radius:50%; display:inline-block; }
.dot.ok { background:var(--ok); box-shadow:0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.bad { background:var(--danger); box-shadow:0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }

/* ---------- filters ---------- */
.filters { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; margin-bottom:16px; }
.filters .field { min-width:150px; }
.filters .grow { flex:1; min-width:220px; }
.chips { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.chip {
    display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border-radius:999px;
    background:var(--surface); border:1px solid var(--border); font-size:12px; color:var(--muted); cursor:pointer;
}
.chip.active { background:var(--brand-soft); border-color:var(--brand); color:var(--brand); font-weight:700; }

/* ---------- misc ---------- */
.empty { text-align:center; padding:48px 20px; color:var(--muted); }
.empty svg { width:44px; height:44px; opacity:.5; margin-bottom:10px; }
.pager { display:flex; gap:10px; align-items:center; justify-content:center; margin-top:18px; }
.alert { padding:12px 16px; border-radius:12px; margin-bottom:14px; font-size:13px; border:1px solid transparent; }
.alert.ok { background:#e9f7ef; color:#0b7a42; border-color:#c9ebd7; }
.alert.error { background:#fdecec; color:#b02a2a; border-color:#f6cfcf; }
.console { background:#0c1624; color:#d8e4f2; border-radius:14px; padding:14px 16px; margin-bottom:16px; overflow:auto; }
.console pre { margin:8px 0 0; white-space:pre-wrap; font-size:12px; line-height:1.65; direction:ltr; text-align:left; }
.console .console-title { font-size:11.5px; opacity:.75; }

/* ---------- modal ---------- */
.modal-backdrop {
    position:fixed; inset:0; background:rgba(6,12,22,.55); backdrop-filter:blur(2px);
    display:none; align-items:center; justify-content:center; z-index:100; padding:20px;
}
.modal-backdrop.open { display:flex; }
.modal {
    background:var(--surface); border:1px solid var(--border); border-radius:18px; box-shadow:0 30px 80px -30px rgba(0,0,0,.6);
    max-width:640px; width:100%; max-height:85vh; overflow:auto; padding:20px 22px;
}
.modal-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }

/* ---------- toast ---------- */
.toasts { position:fixed; inset-block-end:20px; inset-inline-start:20px; display:flex; flex-direction:column; gap:10px; z-index:200; }
.toast {
    background:var(--surface); border:1px solid var(--border); border-inline-start:4px solid var(--brand);
    padding:12px 16px; border-radius:12px; box-shadow:var(--shadow); font-size:13px; min-width:260px;
    animation:slide-in .25s ease;
}
.toast.ok { border-inline-start-color:var(--ok); }
.toast.error { border-inline-start-color:var(--danger); }
@keyframes slide-in { from { transform:translateY(8px); opacity:0; } to { transform:none; opacity:1; } }

/* ---------- auth ---------- */
.auth-wrap { min-height:100vh; display:grid; place-items:center; padding:24px; background:radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent), var(--bg); }
.auth-card { width:400px; max-width:100%; background:var(--surface); border:1px solid var(--border); border-radius:22px; padding:30px 28px; box-shadow:var(--shadow); }
.auth-card .brand { padding:0 0 16px; }

/* ---------- responsive ---------- */
.menu-btn { display:none; }
@media (max-width:900px) {
    .sidebar { position:fixed; inset-block:0; inset-inline-start:0; transform:translateX(110%); box-shadow:0 0 60px rgba(0,0,0,.25); }
    [dir="rtl"] .sidebar { transform:translateX(110%); }
    .sidebar.open { transform:none; }
    .menu-btn { display:grid; }
    .searchbox input { width:150px; }
    .content { padding:18px 16px 40px; }
    .topbar { padding:12px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation:none !important; transition:none !important; } }

/* ---------- charts ---------- */
.chart { width:100%; height:auto; display:block; }
.legend { display:flex; gap:14px; flex-wrap:wrap; font-size:12px; color:var(--muted); margin-top:10px; }
.legend i { width:10px; height:10px; border-radius:3px; display:inline-block; margin-inline-end:5px; }

/* ---------- preview box (interests) ---------- */
.preview {
    margin-top:14px; border:1px dashed var(--border); border-radius:14px; padding:14px 16px; background:var(--surface-2);
    font-size:13px; color:var(--muted); transition:border-color .2s ease;
}
.preview strong { color:var(--text); font-size:18px; margin-inline-end:4px; }
.preview.hit { border-color:var(--brand); }
.preview .samples { margin-top:8px; display:grid; gap:4px; font-size:12px; }

.user-chip { display:flex; align-items:center; gap:8px; padding:4px 10px 4px 4px; border-radius:999px; background:var(--surface-2); border:1px solid var(--border); }
.user-chip .avatar { width:26px; height:26px; border-radius:50%; display:grid; place-items:center; background:var(--brand); color:#fff; font-size:12px; font-weight:700; }
.user-chip .who { font-size:12.5px; max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:900px) { .user-chip .who { display:none; } }


/* ================= interests ================= */
.istat-bar {
    display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px;
    background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
    padding:14px 18px; margin-bottom:18px; box-shadow:var(--shadow);
}
.istat { display:flex; flex-direction:column; gap:2px; border-inline-start:1px solid var(--border); padding-inline-start:14px; min-width:0; }
.istat:first-child { border:0; padding-inline-start:0; }
.istat b { font-size:17px; font-weight:800; letter-spacing:-.2px; }
.istat span { font-size:11.5px; color:var(--muted); }
.istat.wide b { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.igrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(330px,1fr)); gap:14px; margin-bottom:22px; }
.icard {
    background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
    padding:16px 18px; display:flex; flex-direction:column; gap:10px;
    box-shadow:var(--shadow); transition:border-color .15s ease, transform .15s ease;
}
.icard:hover { border-color:color-mix(in srgb, var(--brand) 32%, var(--border)); }
.icard.off { opacity:.62; background:var(--surface-2); }
.icard-head { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.icard h3 { font-size:14.5px; margin:0 0 4px; word-break:break-word; }
.icard-sub { display:flex; align-items:center; gap:6px; font-size:11.5px; color:var(--muted); flex-wrap:wrap; }
.icard-sub .sep { opacity:.45; }
.dot { width:7px; height:7px; border-radius:50%; display:inline-block; }
.dot.on { background:var(--ok); box-shadow:0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.off { background:var(--muted); }
.icard-badges { display:flex; gap:4px; flex-wrap:wrap; justify-content:flex-end; }
.icard-tags { display:flex; gap:6px; flex-wrap:wrap; }
.kw { background:var(--brand-soft); color:var(--brand); font-size:11.5px; font-weight:600; padding:3px 9px; border-radius:8px; }
.kw.more, .kw.none { background:var(--surface-2); color:var(--muted); font-weight:500; }
.tag { background:var(--surface-2); border:1px solid var(--border); color:var(--muted); font-size:11px; padding:3px 8px; border-radius:8px; }
.icard-kv { display:flex; gap:16px; flex-wrap:wrap; font-size:12px; background:var(--surface-2); border-radius:12px; padding:10px 12px; }
.icard-kv .k { color:var(--muted); display:block; font-size:10.5px; margin-bottom:2px; }
.icard-kv b { font-weight:700; font-size:12.5px; }
.icard-stats { display:flex; gap:8px; font-size:11.5px; color:var(--muted); align-items:center; }
.icard-stats b { color:var(--text); }
.icard-stats .sep { opacity:.4; }
.icard-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:auto; align-items:center; }
.icard-actions .push-end { margin-inline-start:auto; }
.icard-actions form { margin:0; }

.editor-form { display:flex; flex-direction:column; gap:16px; }
.editor-section {
    border:1px solid var(--border); border-radius:14px; padding:16px;
    display:flex; flex-direction:column; gap:14px; background:var(--surface-2);
}
.editor-section h4 { margin:0; font-size:12px; color:var(--muted); font-weight:700; letter-spacing:.02em; }
.editor-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.editor-actions .push-end { margin-inline-start:auto; }
.editor-actions form { margin:0; }

.chips-input {
    display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:8px 10px;
    border:1px solid var(--border); border-radius:12px; background:var(--surface); min-height:46px; cursor:text;
}
.chips-input:focus-within { border-color:var(--brand); box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.chips-input .chip-entry {
    border:0; outline:0; background:transparent; flex:1; min-width:140px; padding:4px;
    font-family:inherit; font-size:13px; color:var(--text);
}
.kw-chip {
    display:inline-flex; align-items:center; gap:4px; background:var(--brand-soft); color:var(--brand);
    border-radius:8px; padding:3px 6px 3px 9px; font-size:12px; font-weight:600;
}
.kw-chip button {
    border:0; background:transparent; color:inherit; cursor:pointer; font-size:15px;
    line-height:1; padding:0 2px; opacity:.65;
}
.kw-chip button:hover { opacity:1; }

.picker { display:flex; flex-wrap:wrap; gap:8px; }
.cat-option {
    display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border:1px solid var(--border);
    border-radius:10px; background:var(--surface); font-size:12px; cursor:pointer;
}
.cat-option:has(input:checked) { border-color:var(--brand); background:var(--brand-soft); color:var(--brand); }
.cat-option input { width:auto; }
.cat-option em { font-style:normal; font-size:10.5px; color:var(--muted); }
.province-chip {
    border:1px solid var(--border); background:var(--surface); color:var(--muted);
    border-radius:999px; padding:5px 11px; font-size:12px; cursor:pointer; font-family:inherit;
}
.province-chip.active { background:var(--brand-soft); border-color:var(--brand); color:var(--brand); font-weight:600; }
.seg { display:inline-flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.seg button {
    border:1px solid var(--border); background:var(--surface); color:var(--muted);
    border-radius:8px; padding:4px 9px; font-size:11.5px; cursor:pointer; font-family:inherit;
}
.seg button.active { border-color:var(--brand); color:var(--brand); background:var(--brand-soft); }
.empty-samples { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-top:12px; }

@media (max-width:860px) {
    .istat-bar { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .istat { border:0; padding-inline-start:0; }
}

/* ================= reminders ================= */
.rlist { display:flex; flex-direction:column; gap:10px; margin-bottom:20px; }
.rgroup {
    display:flex; align-items:center; gap:10px; font-size:12px; font-weight:700;
    color:var(--muted); margin:8px 2px 2px;
}
.rgroup::after { content:""; flex:1; border-top:1px dashed var(--border); }
.ritem {
    display:grid; grid-template-columns:112px 1fr auto; gap:14px; align-items:start;
    background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
    padding:14px 16px; box-shadow:var(--shadow);
}
.ritem.due { border-color:color-mix(in srgb, var(--warn) 45%, var(--border)); background:color-mix(in srgb, var(--warn) 5%, var(--surface)); }
.rtime { display:flex; flex-direction:column; gap:2px; }
.rtime b { font-size:18px; font-weight:800; letter-spacing:-.4px; }
.rtime span { font-size:10.5px; color:var(--muted); }
.rbody { min-width:0; display:flex; flex-direction:column; gap:6px; }
.rtitle { font-weight:700; font-size:13.5px; word-break:break-word; }
.rmeta { display:flex; gap:6px; flex-wrap:wrap; }
.rnotes { font-size:12px; color:var(--muted); line-height:1.9; }
.ractions { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.ractions form, .rrow form { margin:0; }
.arch summary { cursor:pointer; font-weight:700; font-size:13px; }
.rtable { display:flex; flex-direction:column; gap:8px; margin-top:12px; }
.rrow { display:flex; gap:10px; align-items:center; flex-wrap:wrap; font-size:12.5px; border-top:1px solid var(--border); padding-top:8px; }
.rrow .rtitle { flex:1; }
.rban {
    display:flex; align-items:center; gap:12px; padding:12px 16px; margin-bottom:14px;
    border-radius:14px; border:1px solid color-mix(in srgb, var(--brand) 28%, var(--border));
    background:color-mix(in srgb, var(--brand) 7%, var(--surface)); color:var(--text);
}
.rban-ico { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; background:var(--brand-soft); color:var(--brand); }
.rban b { display:block; font-size:13px; }
.rban span { font-size:11.5px; color:var(--muted); }
.rban .push-end { margin-inline-start:auto; font-size:12px; color:var(--brand); font-weight:700; }
@media (max-width:900px) {
    .ritem { grid-template-columns:1fr; }
    .ractions { justify-content:flex-start; }
}

/* ================= search ================= */
.searchbox { position:relative; }
.searchbox input { width:340px; }
.search-pop {
    position:absolute; top:calc(100% + 8px); inset-inline-end:0; width:420px; max-width:calc(100vw - 40px);
    background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow);
    padding:6px; z-index:60; max-height:60vh; overflow:auto;
}
.sp-group { font-size:10.5px; font-weight:700; color:var(--muted); padding:8px 10px 4px; letter-spacing:.04em; }
.sp-item {
    display:flex; align-items:center; gap:8px; width:100%; text-align:start; border:0; background:transparent;
    padding:8px 10px; border-radius:10px; cursor:pointer; font-family:inherit; font-size:12.5px; color:var(--text);
}
.sp-item:hover, .sp-item.active { background:var(--brand-soft); }
.sp-type { flex:0 0 auto; font-size:10px; font-weight:700; color:var(--brand); background:var(--surface-2); border-radius:6px; padding:2px 6px; }
.sp-label { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sp-hint { flex:0 0 auto; font-size:10.5px; color:var(--muted); }
.sp-help { padding:4px 10px 8px; font-size:11.5px; color:var(--muted); }
.sp-help code { background:var(--surface-2); border-radius:5px; padding:1px 5px; color:var(--brand); font-size:11px; }

.searchbar { display:flex; gap:8px; align-items:flex-start; margin-bottom:12px; flex-wrap:wrap; }
.searchbar-field {
    flex:1; min-width:280px; display:flex; align-items:center; gap:10px; background:var(--surface);
    border:1px solid var(--border); border-radius:14px; padding:0 14px; box-shadow:var(--shadow);
}
.searchbar-field:focus-within { border-color:var(--brand); box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.searchbar-field svg { width:18px; height:18px; color:var(--muted); flex:0 0 18px; }
.searchbar-field input {
    flex:1; border:0; outline:0; background:transparent; padding:14px 0; font-family:inherit;
    font-size:14px; color:var(--text);
}
.syntax { position:relative; }
.syntax summary {
    cursor:pointer; list-style:none; font-size:12px; color:var(--muted); padding:14px 6px; white-space:nowrap;
}
.syntax summary::-webkit-details-marker { display:none; }
.syntax summary::after { content:"؟"; margin-inline-start:4px; color:var(--brand); font-weight:700; }
.syntax-body {
    position:absolute; inset-inline-end:0; top:calc(100% + 6px); z-index:55; width:380px; max-width:calc(100vw - 40px);
    background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow);
    padding:12px 14px; display:grid; gap:6px;
}
.syntax-body div { display:flex; gap:10px; align-items:center; font-size:11.5px; color:var(--muted); }
.syntax-body code { background:var(--surface-2); border-radius:6px; padding:2px 7px; color:var(--brand); font-size:11px; white-space:nowrap; }

.active-chips { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-bottom:14px; }
.fchip {
    display:inline-flex; align-items:center; gap:6px; border:1px solid var(--border); background:var(--surface);
    border-radius:999px; padding:4px 10px; font-size:11.5px; color:var(--text);
}
.fchip .k { font-size:10px; color:var(--brand); font-weight:700; }
.fchip .x { color:var(--muted); font-size:13px; }
.fchip:hover { border-color:var(--brand); }
.fchip.clear { color:var(--muted); }
.adv { margin-bottom:14px; }
.adv summary { cursor:pointer; font-size:12px; color:var(--muted); margin-bottom:8px; }

mark { background:color-mix(in srgb, var(--warn) 35%, transparent); color:inherit; border-radius:3px; padding:0 1px; }
.sep { opacity:.4; margin:0 4px; }

@media (max-width:900px) {
    .searchbox input { width:200px; }
    .search-pop { width:min(92vw, 420px); }
}

/* ================= mobile polish (≤640px) ================= */
.scrim {
    position: fixed; inset: 0; z-index: 29;
    background: rgba(6,12,22,.48); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
body.nav-open .scrim { opacity: 1; pointer-events: auto; }
body.nav-open { overflow: hidden; }
@media (min-width: 901px) { .scrim { display: none; } }

.t, .rtitle, .icard h3, .title-cell .t { overflow-wrap: anywhere; }

@media (max-width: 640px) {
    /* --- نوار بالا: جستجو یک ردیف کامل می‌گیرد --- */
    .topbar { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
    .topbar .crumbs { display: none; }
    .topbar .searchbox { order: 10; flex: 1 0 100%; margin: 0; width: 100%; }
    .topbar .searchbox input { width: 100%; padding: 10px 36px 10px 12px; font-size: 13.5px; }
    .topbar .searchbox svg { top: 50%; transform: translateY(-50%); }
    .icon-btn { width: 36px; height: 36px; }
    .user-chip { padding: 2px; }
    .search-pop { width: 100%; max-width: none; inset-inline: 0; }

    /* --- محتوا --- */
    .content { padding: 14px 12px calc(40px + env(safe-area-inset-bottom)); }
    .page-head { gap: 10px; margin-bottom: 14px; }
    .page-head h1 { font-size: 19px; }
    .page-head .sub { font-size: 12px; }
    .page-actions { width: 100%; gap: 6px; }
    .page-actions .btn { flex: 1 1 auto; }

    .card { padding: 14px; border-radius: 14px; margin-bottom: 12px; }
    .card-head { margin-bottom: 10px; }
    .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
    .kpi { padding: 12px 14px; }
    .kpi .value { font-size: 22px; }

    /* --- جدول‌ها به کارت تبدیل می‌شوند --- */
    .table-wrap { border: 0; background: transparent; border-radius: 0; overflow: visible; }
    .table { display: block; font-size: 13.5px; }
    .table thead { display: none; }
    .table tbody, .table tr, .table td { display: block; }
    .table tr {
        background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
        padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow);
    }
    .table tbody tr:hover { background: var(--surface); }
    .table td { border: 0; padding: 2px 0; display: flex; gap: 8px; align-items: flex-start; line-height: 1.7; }
    .table td::before {
        content: attr(data-label); flex: 0 0 48px; font-size: 10.5px; font-weight: 600;
        color: var(--muted); padding-top: 3px;
    }
    .table td:not([data-label])::before { display: none; }
    .table td.title-cell { display: block; padding: 0 0 9px; margin-bottom: 6px; border-bottom: 1px dashed var(--border); }
    .table td.title-cell .t { font-size: 13.5px; line-height: 1.65; }
    .table td.num, .table td.small { white-space: normal; }
    .title-cell { min-width: 0; }
    .table td[data-label="دلیل"] { flex-wrap: wrap; }

    /* --- مودال: شیت پایین صفحه --- */
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal {
        max-width: none; width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0;
        padding: 16px 16px 22px;
    }
    .modal-head { position: sticky; top: -16px; background: var(--surface); padding: 4px 0 10px; margin-bottom: 6px; }

    /* --- فرم‌ها --- */
    .filters { gap: 10px; }
    .filters .field, .filters .grow { min-width: 0; flex: 1 0 100%; }
    .filters .btn { width: 100%; }
    .searchbar { gap: 10px; }
    .searchbar-field { min-width: 0; flex: 1 0 100%; }
    .searchbar .btn.primary { flex: 1; }
    .syntax { width: 100%; }
    .syntax summary { padding: 6px 2px; }
    .syntax-body { position: static; width: auto; max-width: none; margin-top: 6px; }

    .istat-bar { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 12px 14px; }
    .igrid { grid-template-columns: 1fr; gap: 10px; }
    .icard { padding: 14px; }
    .ritem { padding: 12px 14px; }
    .rban { padding: 10px 12px; }
    .rban .push-end { display: none; }
    .editor-section { padding: 12px; }
    .editor-actions .btn { flex: 1; }
    .auth-card { padding: 22px 18px; }
    .toasts { inset-inline: 12px; inset-block-end: 12px; }
    .toast { min-width: 0; width: 100%; }
}

@media (max-width: 340px) {
    .kpis { grid-template-columns: 1fr; }
    .brand-name { font-size: 14px; }
}

@media (max-width: 640px) {
    .auth-wrap { padding: 16px; grid-template-columns: minmax(0, 1fr); }
    .auth-card { width: 100%; max-width: 100%; padding: 20px 16px; }
}

@media (max-width: 420px) {
    .user-chip { display: none; }
    .brand-logo { width: 32px; height: 32px; border-radius: 10px; font-size: 14px; }
}
