/* ==========================================================================
   دستیار نت — سیستم طراحی
   فارسی، راست‌چین، موبایل‌اول؛ رنگ‌ها برگرفته از هویت ریلی (سرمه‌ای/فیروزه‌ای/کهربایی)
   ========================================================================== */

@font-face {
  font-family: Vazirmatn;
  src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url('/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --navy: #0b2b57;
  --navy-2: #123b70;
  --navy-3: #1e4a86;
  --teal: #0f7a6c;
  --teal-2: #0e9a86;
  --amber: #d99a2b;
  --bg: #f2f5fa;
  --bg-2: #e8edf5;
  --card: #ffffff;
  --text: #12203a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #15803d;
  --warn: #b45309;
  --info: #0369a1;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 32, 63, .06), 0 8px 24px -12px rgba(15, 32, 63, .18);
  --shadow-lg: 0 20px 50px -20px rgba(11, 43, 87, .35);
  --sidebar: 264px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, system-ui, 'Segoe UI', Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }
a { color: var(--navy-3); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 6px; line-height: 1.5; font-weight: 700; }
h1 { font-size: 1.18rem; }
h2 { font-size: 1.06rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 8px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: embed; font-size: .86em; }
::selection { background: #cfe3ef; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.ok-text { color: var(--ok); font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ------------------------------- چیدمان کلی ------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
}

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100dvh;
}

.content {
  flex: 1;
  padding: 14px 14px 88px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.page-narrow { max-width: 900px; margin: 0 auto; }
.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.split { display: grid; gap: 12px; grid-template-columns: 1fr; }
.split-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }

/* -------------------------------- نوار کنار -------------------------------- */

.side-nav {
  display: none;
  flex-direction: column;
  gap: 8px;
  width: var(--sidebar);
  padding: 18px 14px;
  background: linear-gradient(180deg, var(--navy) 0%, #0a2447 60%, #071bad 100%);
  background: linear-gradient(180deg, #0b2b57 0%, #0a2447 100%);
  color: #e6eefa;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.side-head { display: flex; align-items: center; gap: 10px; padding: 6px 6px 16px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 8px; }
.side-logo { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.1); }
.side-head strong { display: block; font-size: .98rem; }
.side-head small { color: #9db4d2; font-size: .72rem; display: block; line-height: 1.35; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  color: #cfdcf0; font-size: .92rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(15,122,108,.85), rgba(15,122,108,.45)); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.nav-item .ico { opacity: .9; }

.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
.user-box { display: flex; align-items: center; gap: 10px; padding: 6px 4px 12px; }
.user-meta strong { display: block; font-size: .86rem; }
.user-meta small { color: #9db4d2; font-size: .72rem; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--navy-3));
  color: #fff; font-weight: 700; flex: 0 0 auto;
}
.avatar.big { width: 52px; height: 52px; font-size: 1.2rem; }

/* ---------------------------------- نوار بالا --------------------------------- */

.top-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-title { flex: 1; min-width: 0; }
.top-title h1 { font-size: 1.02rem; margin: 0; }
.top-sub { font-size: .72rem; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.top-actions .btn { gap: 6px; }

/* --------------------------------- نوار پایین -------------------------------- */

.tab-bar {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px -14px rgba(15,32,63,.4);
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 10px; font-size: .68rem; color: var(--muted); font-weight: 500;
}
.tab-item.active { color: var(--navy); }
.tab-item.active .ico { stroke-width: 2.2; }

/* ---------------------------------- دکمه‌ها --------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 12px;
  padding: 9px 14px; font-size: .9rem; font-weight: 600;
  background: var(--bg-2); color: var(--text);
  transition: transform .08s, filter .15s, background .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--navy), var(--navy-3)); color: #fff; box-shadow: 0 8px 20px -12px rgba(11,43,87,.8); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: linear-gradient(135deg, #147a4b, #16a34a); color: #fff; }
.btn.danger { background: linear-gradient(135deg, #b91c1c, #dc2626); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 6px 10px; font-size: .82rem; border-radius: 10px; }
.btn.block { width: 100%; }

.icon-btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-size: 1rem;
}
.icon-btn.danger { color: var(--danger); }
.icon-btn:hover { background: var(--bg); }

.link-btn { background: none; border: none; color: var(--navy-3); font-weight: 600; font-size: .84rem; padding: 0; }

/* ----------------------------------- فرم‌ها ---------------------------------- */

.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field-hint { display: block; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 12px; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,122,108,.12); }
.input.mini { padding: 5px 8px; font-size: .82rem; border-radius: 8px; width: 130px; }
textarea.input { resize: vertical; min-height: 62px; }
.form-grid { display: grid; gap: 4px 14px; grid-template-columns: 1fr; }
.form-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 8px 12px; font-size: .84rem; margin-bottom: 10px; }
.notice { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; padding: 8px 12px; border-radius: 10px; font-size: .84rem; }

.switch { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.switch input { accent-color: var(--teal); width: 16px; height: 16px; }

/* ----------------------------------- ورود ----------------------------------- */

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 18px; position: relative; overflow: hidden; }
.login-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(15,122,108,.35), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, rgba(217,154,43,.22), transparent 55%),
    linear-gradient(160deg, #0b2b57 0%, #081a33 100%);
}
.login-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 2px, transparent 2px 26px);
  opacity: .5;
}
.login-card {
  width: min(430px, 100%); background: rgba(255,255,255,.98); border-radius: 22px;
  padding: 26px 22px; box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 18px; }
.login-logo { width: 68px; height: 68px; border-radius: 18px; box-shadow: 0 12px 28px -14px rgba(11,43,87,.7); }
.login-brand h1 { margin-top: 10px; font-size: 1.34rem; }
.login-brand p { margin: 2px 0; font-size: .86rem; color: var(--muted); }
.login-hint { margin-top: 14px; text-align: center; font-size: .76rem; color: var(--muted); }
.login-hint code { background: var(--bg-2); padding: 1px 6px; border-radius: 6px; }

/* ----------------------------------- کارت‌ها ---------------------------------- */

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; }
.panel-body { padding: 12px 14px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

.hello-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, var(--teal) 160%);
  color: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-lg);
}
.hello-card h2 { margin: 0; font-size: 1.1rem; }
.hello-card .muted { color: #c3d4ea; font-size: .8rem; margin: 2px 0 0; }
.hello-date { text-align: left; font-size: .74rem; color: #cfe0f5; display: grid; }
.hello-date strong { font-size: .98rem; color: #fff; }

.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 10px 4px; font-size: .74rem; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow);
}
.quick-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); color: var(--navy); }
.quick-btn.tone-danger .quick-ico { background: #fee2e2; color: #b91c1c; }
.quick-btn.tone-ok .quick-ico { background: #dcfce7; color: #15803d; }
.quick-btn.tone-warn .quick-ico { background: #fef3c7; color: #b45309; }
.quick-btn.tone-info .quick-ico { background: #e0f2fe; color: #0369a1; }
.quick-btn:hover { border-color: #cbd5e1; }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-card {
  text-align: right; background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 12px; box-shadow: var(--shadow); display: grid; gap: 2px; position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--navy-3); }
.stat-card.tone-info::before { background: #0284c7; }
.stat-card.tone-danger::before { background: var(--danger); }
.stat-card.tone-ok::before { background: var(--ok); }
.stat-value { font-size: 1.42rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .78rem; color: var(--muted); }
.stat-note { font-size: .7rem; color: #94a3b8; }

/* ------------------------------- فهرست دستورکار ------------------------------ */

.order-row {
  display: flex; align-items: center; gap: 8px; padding: 11px 12px;
  border-bottom: 1px solid var(--border); color: inherit; transition: background .12s;
}
.order-row:last-child { border-bottom: none; }
.order-row:hover { background: #f8fafc; }
.or-main { flex: 1; min-width: 0; }
.or-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.or-code { font-size: .95rem; color: var(--navy); }
.type-chip { font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 7px; background: var(--bg-2); color: var(--navy-2); }
.type-chip.t-PM { background: #e0f2fe; color: #075985; }
.type-chip.t-EM { background: #fee2e2; color: #b91c1c; }
.type-chip.t-CM { background: #ede9fe; color: #5b21b6; }
.type-chip.t-INS { background: #dcfce7; color: #166534; }
.or-eq { font-size: .86rem; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.or-eq .muted { font-size: .74rem; }
.or-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: .72rem; color: var(--muted); }
.or-progress { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 58px; height: 16px; background: var(--bg-2); border-radius: 8px; overflow: hidden; font-size: .66rem; color: var(--navy); font-weight: 600; }
.or-progress i { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; background: rgba(15,122,108,.28); }
.or-arrow { color: #b6c2d4; font-size: 1.2rem; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); font-size: .7rem; font-weight: 600; color: var(--text); }
.status-chip { background: color-mix(in srgb, var(--chip-color) 14%, #fff); color: var(--chip-color); border: 1px solid color-mix(in srgb, var(--chip-color) 30%, #fff); }
.status-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--chip-color); }
.badge { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-2); color: var(--muted); font-size: .68rem; padding: 1px 7px; border-radius: 7px; font-weight: 600; }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #b45309; }

/* --------------------------------- ابزارها --------------------------------- */

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.search-box { position: relative; flex: 1; display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 0 10px; }
.search-box .ico { color: var(--muted); flex: 0 0 auto; }
.search-box .input, .search-box input { border: none; box-shadow: none; padding-inline: 0; background: transparent; }
.search-box input:focus { outline: none; }

.chip-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.filter-chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.filter-chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-row .input { width: auto; min-width: 150px; padding: 6px 10px; font-size: .84rem; }

.eq-results { max-height: 190px; overflow: auto; border: 1px dashed var(--border); border-radius: 10px; padding: 6px; margin-top: 6px; }
.eq-item { display: block; width: 100%; text-align: right; border: none; background: none; padding: 7px 8px; border-radius: 8px; }
.eq-item:hover { background: var(--bg); }
.eq-item strong { display: block; font-size: .84rem; }
.eq-item small { color: var(--muted); font-size: .72rem; }
.picked { padding: 8px; background: #ecfdf5; border-radius: 10px; border: 1px solid #a7f3d0; }
.picked small { display: block; color: var(--muted); font-size: .72rem; }

.eq-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: right; background: #fff; border: none; border-bottom: 1px solid var(--border); padding: 10px 12px; }
.eq-row:hover { background: #f8fafc; }
.eq-row strong { display: block; font-size: .88rem; }
.eq-row small { color: var(--muted); font-size: .72rem; }
.chip-link { display: inline-block; margin: 3px 0 3px 6px; padding: 3px 9px; border-radius: 8px; background: var(--bg-2); font-size: .78rem; color: var(--navy-3); }
.sub-list { margin-top: 10px; }
.sub-list h4 { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }

/* ------------------------------- جزئیات دستورکار ------------------------------ */

.order-head { padding: 14px; margin-bottom: 12px; }
.oh-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.oh-code { font-size: .82rem; color: var(--muted); }
.oh-code strong { font-size: 1.2rem; color: var(--navy); }
.oh-type { font-size: .78rem; color: var(--muted); }
.oh-eq { margin: 8px 0 2px; font-size: 1.04rem; }
.oh-sub { font-size: .8rem; color: var(--muted); }
.oh-desc { margin-top: 8px; font-size: .88rem; background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.meta-item { background: var(--bg); border-radius: 10px; padding: 7px 10px; display: grid; }
.meta-item span { font-size: .7rem; color: var(--muted); }
.meta-item strong { font-size: .84rem; }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.checklist { padding: 4px 0; }
.check-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.check-item:last-child { border-bottom: none; }
.check-item.answered { background: #fbfdfc; }
.ci-seq { width: 24px; height: 24px; border-radius: 8px; background: var(--bg-2); display: grid; place-items: center; font-size: .74rem; font-weight: 700; color: var(--navy); flex: 0 0 auto; }
.ci-body { flex: 1; min-width: 0; }
.ci-desc { font-size: .88rem; }
.ci-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pill { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 2px 10px; font-size: .74rem; font-weight: 600; color: var(--muted); }
.pill.ok.active { background: #dcfce7; border-color: #86efac; color: #15803d; }
.pill.danger.active { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.pill.muted.active { background: var(--bg-2); color: var(--text); }
.checklist-foot { padding: 10px 14px; border-top: 1px solid var(--border); background: #fbfdff; }

.list-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item strong { font-size: .86rem; display: block; }
.list-item small { font-size: .72rem; }
.list-item.compact { padding: 6px 0; }

.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { display: flex; gap: 10px; padding: 6px 0; position: relative; }
.timeline li:not(:last-child)::before { content: ''; position: absolute; inset-inline-start: 4px; top: 18px; bottom: -4px; width: 1px; background: var(--border); }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); margin-top: 7px; flex: 0 0 auto; }
.timeline strong { display: block; font-size: .84rem; }
.timeline small { font-size: .72rem; }

.status-bars { display: grid; gap: 7px; }
.status-bar { display: grid; grid-template-columns: 1fr 2fr auto; align-items: center; gap: 8px; font-size: .76rem; }
.sb-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-track { height: 8px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.sb-fill { height: 100%; border-radius: 6px; transition: width .4s; }
.sb-count { font-weight: 700; font-size: .78rem; }

.info-banner { display: grid; gap: 2px; background: linear-gradient(135deg, #ecfdf5, #f0f9ff); border: 1px solid #bae6fd; border-radius: 12px; padding: 10px 14px; font-size: .8rem; color: #0c4a6e; }

/* --------------------------------- ربات/دستیار -------------------------------- */

.assistant-wrap { display: flex; flex-direction: column; gap: 10px; }
.assistant-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(135deg, var(--navy), var(--teal) 150%);
  color: #fff; border-radius: var(--radius); padding: 14px 16px;
}
.ah-title { display: flex; align-items: center; gap: 10px; }
.ah-title h2 { margin: 0; font-size: 1.04rem; }
.ah-title p { margin: 2px 0 0; font-size: .78rem; color: #cfe0f5; }
.quick-grid-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.section-label { font-size: .76rem; color: var(--muted); margin: 0 4px 8px; font-weight: 600; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.quick-action {
  display: flex; align-items: center; gap: 8px; text-align: right;
  border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 8px 10px;
  font-size: .8rem; font-weight: 600; color: var(--text);
}
.quick-action small { display: none; color: var(--muted); font-weight: 400; font-size: .68rem; }
.quick-action:hover { background: #f8fafc; }
.qa-ico { width: 28px; height: 28px; border-radius: 9px; background: var(--bg-2); display: grid; place-items: center; color: var(--navy); flex: 0 0 auto; }
.quick-action.tone-danger .qa-ico { background: #fee2e2; color: #b91c1c; }
.quick-action.tone-ok .qa-ico { background: #dcfce7; color: #15803d; }
.quick-action.tone-warn .qa-ico { background: #fef3c7; color: #b45309; }
.quick-action.tone-primary .qa-ico { background: #dbeafe; color: #1d4ed8; }
.quick-action.tone-info .qa-ico { background: #e0f2fe; color: #0369a1; }

.chat-log {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  min-height: 320px; max-height: min(56vh, 560px); overflow-y: auto; box-shadow: var(--shadow);
}
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg-user { flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(135deg, var(--navy), var(--teal)); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.msg-bubble { max-width: 86%; border-radius: 14px; padding: 9px 12px; background: var(--bg); font-size: .88rem; }
.msg-user .msg-bubble { background: var(--navy); color: #fff; border-bottom-left-radius: 4px; }
.msg-assistant .msg-bubble { background: #f1f5f9; border-bottom-right-radius: 4px; }
.msg-system .msg-bubble { background: #ecfdf5; border: 1px solid #a7f3d0; width: 100%; max-width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.msg-text { white-space: pre-wrap; word-break: break-word; }

.draft-card { margin-top: 8px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px; box-shadow: var(--shadow); }
.draft-card.cancelled { opacity: .55; }
.draft-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.intent-chip { font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--bg-2); color: var(--navy); }
.intent-chip.tone-danger { background: #fee2e2; color: #b91c1c; }
.intent-chip.tone-ok { background: #dcfce7; color: #15803d; }
.intent-chip.tone-warn { background: #fef3c7; color: #b45309; }
.intent-chip.tone-primary { background: #dbeafe; color: #1d4ed8; }
.intent-chip.tone-info { background: #e0f2fe; color: #0369a1; }
.draft-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.draft-fields .field { margin: 0; }
.draft-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.hint-box { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 9px; padding: 6px 9px; font-size: .76rem; margin-top: 6px; }
.preview-box { display: grid; gap: 3px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 9px; padding: 7px 9px; font-size: .78rem; margin-bottom: 8px; }
.preview-box span { color: var(--muted); }
.preview-box small { font-size: .72rem; }
.typing { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); padding: 0 4px; }
.quick-replies { display: flex; gap: 6px; flex-wrap: wrap; padding-inline-start: 38px; }
.reply-chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: .78rem; color: var(--navy-3); }
.reply-chip:hover { background: var(--bg); }
.mini-orders { display: grid; gap: 6px; padding-inline-start: 38px; }
.mini-order { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; font-size: .82rem; }
.mini-order strong { color: var(--navy); }
.mini-order .muted { margin-inline-start: auto; font-size: .72rem; }

.chat-compose { display: flex; gap: 8px; align-items: flex-end; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.chat-input { flex: 1; border: none; resize: none; min-height: 44px; max-height: 130px; padding: 8px; background: transparent; }
.chat-input:focus { outline: none; }
.send-btn { padding: 10px 18px; border-radius: 12px; }
.compose-hint { text-align: center; margin: 0; }

/* ----------------------------------- نمودار ---------------------------------- */

.rbar { display: grid; grid-template-columns: 1fr 1.4fr auto; align-items: center; gap: 8px; font-size: .78rem; margin-bottom: 7px; }
.rbar-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rbar-track { height: 9px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.rbar-fill { height: 100%; border-radius: 6px; transition: width .5s; }
.rbar-value { font-weight: 700; font-size: .78rem; }
.spark-bars { display: flex; align-items: flex-end; gap: 5px; height: 130px; padding-top: 10px; }
.spark-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.spark-fill { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--teal-2), var(--teal)); min-height: 4px; }
.spark-col span { font-size: .66rem; color: var(--muted); }

/* -------------------------------- جدول و پروفایل ------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.table th { text-align: right; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); font-size: .76rem; }
.table td { padding: 8px; border-bottom: 1px dashed var(--border); }
.profile-box { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.profile-box strong { display: block; }
.about-logo { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 8px; }
.about p { margin: 2px 0; font-size: .86rem; }
.plain-list { margin: 8px 0 0; padding-inline-start: 18px; font-size: .8rem; color: var(--muted); }
.plain-list li { margin-bottom: 4px; }
.bot-code-box { display: grid; gap: 6px; }
.bot-code { display: flex; gap: 8px; direction: ltr; justify-content: center; margin: 8px 0; }
.bot-code span {
  width: 40px; height: 48px; display: grid; place-items: center;
  background: var(--navy); color: #fff; border-radius: 10px;
  font-size: 1.3rem; font-weight: 700;
}

/* --------------------------------- حالت خالی --------------------------------- */

.empty { text-align: center; padding: 26px 14px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: .92rem; }
.empty-icon { width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 14px; background: var(--bg-2); display: grid; place-items: center; font-size: 1.2rem; color: #94a3b8; }
.loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 26px; color: var(--muted); font-size: .86rem; }
.spinner { width: 16px; height: 16px; border: 2px solid #cbd5e1; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------- اعلان‌ها --------------------------------- */

.toast-host { position: fixed; bottom: 78px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; padding: 0 14px; }
.toast { background: #0f172a; color: #fff; padding: 9px 16px; border-radius: 12px; font-size: .84rem; box-shadow: var(--shadow-lg); transition: opacity .3s, transform .3s; max-width: 460px; }
.toast.hide { opacity: 0; transform: translateY(6px); }
.toast-ok { background: #15803d; }
.toast-error { background: #b91c1c; }
.toast-warn { background: #b45309; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 20, 40, .55); display: grid; place-items: center; padding: 14px; z-index: 80; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: 88dvh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-wide { width: min(660px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 14px 16px; overflow: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-start; padding: 12px 16px; border-top: 1px solid var(--border); }

/* --------------------------------- ریسپانسیو -------------------------------- */

.only-mobile { display: grid; }
.hide-xs { display: none; }

@media (min-width: 560px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .meta-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .hide-xs { display: inline; }
}

@media (min-width: 900px) {
  .app-shell { grid-template-columns: var(--sidebar) 1fr; }
  .side-nav { display: flex; }
  .tab-bar { display: none; }
  .only-mobile { display: none; }
  .content { padding: 18px 22px 28px; }
  .split { grid-template-columns: 1fr 1fr; }
  .split-2 { grid-template-columns: minmax(280px, 380px) 1fr; align-items: start; }
  .quick-row { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-action small { display: block; }
  .quick-action { align-items: flex-start; flex-wrap: wrap; }
  .chat-log { max-height: 52vh; }
  .hello-card { padding: 18px 20px; }
  .order-row { padding: 12px 16px; }
}

@media (min-width: 1200px) {
  .stats-grid { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* اسکرول‌بار نازک */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
