/* =====================================================================
   سماتیم — سیستم تیکتینگ | Samatim Ticketing
   هویت بصری: آسفالت جاده، سبز تابلوهای راه، زرد خط‌کشی
   همه فاصله‌ها با خصوصیات منطقی (inline-start/end) تا RTL و LTR هر دو درست باشند
   ===================================================================== */
@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-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f3f5f6;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --ink: #0f1a20;
  --ink-2: #34444c;
  --muted: #66767d;
  --line: #e3e8ea;
  --line-2: #d2dadd;
  --asphalt: #15212a;
  --asphalt-2: #1d2c35;
  --asphalt-3: #2a3c46;
  --sign: #0a7a55;
  --sign-600: #07603f;
  --sign-50: #e9f5f0;
  --lane: #f2b705;
  --lane-50: #fff8e1;
  --danger: #c0342b;
  --danger-50: #fdeeed;
  --r-sm: 6px;
  --r: 10px;
  --shadow: 0 1px 2px rgba(15, 26, 32, .04), 0 2px 6px rgba(15, 26, 32, .05);
  --shadow-lg: 0 12px 32px rgba(15, 26, 32, .16);
  --side-w: 264px;
}
* { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.7; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
body.lang-fa { font-family: "Vazirmatn", Tahoma, sans-serif; font-size: 1.03rem; }
body.lang-en { font-family: "Inter", "Vazirmatn", "Segoe UI", system-ui, sans-serif; line-height: 1.6; letter-spacing: -.005em; }
body.lang-en input, body.lang-en select, body.lang-en textarea, body.lang-en button { font-family: inherit; }
a { color: var(--sign); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--lane); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.35; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; font-weight: 600; margin: 0 0 1rem; }
h3 { font-size: .98rem; font-weight: 600; margin: 1.25rem 0 .6rem; }
small { color: var(--muted); }
.ic { flex: none; vertical-align: middle; }

/* ---------- قاب اصلی ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--asphalt); color: #dce5e8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: .8rem; align-items: center; padding: 1.35rem 1.25rem 1.1rem; color: #fff; text-decoration: none; }
.brand strong { display: block; font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
.brand small { color: #8fa3ab; font-size: .82rem; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--asphalt);
  background: var(--lane); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.lang-fa .brand-mark .ic { transform: scaleX(-1); }
.nav { padding: .25rem .75rem 1rem; flex: 1; }
.nav-group { margin: 1.1rem .6rem .35rem; font-size: .76rem; color: #7f949c; font-weight: 500; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; color: #cdd8dc; text-decoration: none; border-radius: 8px; position: relative; }
.nav a:hover { background: var(--asphalt-2); color: #fff; }
.nav a.on { background: var(--asphalt-3); color: #fff; font-weight: 500; }
.nav a.on::before { content: ""; position: absolute; inset-inline-start: -.75rem; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--lane); }
[dir=rtl] .nav a.on::before { border-radius: 4px 0 0 4px; }
.nav a span { flex: 1; }
.badge { background: var(--lane); color: var(--asphalt); border-radius: 999px; min-width: 1.5rem; padding: 0 .45rem; font-size: .78rem; font-weight: 700; text-align: center; line-height: 1.5rem; }
.side-foot { padding: 1rem 1.25rem 1.25rem; display: flex; align-items: center; gap: .6rem; }
.side-foot small { color: #6f858d; }
.lane { width: 42px; height: 4px; background: repeating-linear-gradient(90deg, var(--lane) 0 10px, transparent 10px 16px); border-radius: 2px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .7rem 2rem; background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.quick { flex: 1; max-width: 420px; display: flex; align-items: center; gap: .5rem; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 .9rem; color: var(--muted); }
.quick:focus-within { border-color: var(--sign); background: #fff; box-shadow: 0 0 0 3px var(--sign-50); }
.quick input[type=search] { border: 0; background: transparent; padding: .5rem 0; width: 100%; font: inherit; color: var(--ink); outline: none; box-shadow: none; }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: .9rem; }
.lang-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang-switch a { padding: .2rem .8rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .88rem; line-height: 1.6; }
.lang-switch a[lang=fa] { font-family: "Vazirmatn", Tahoma, sans-serif; }
.lang-switch a[lang=en] { font-family: "Inter", sans-serif; }
.lang-switch a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: .6rem; cursor: pointer; padding: .2rem .35rem; border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--asphalt); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .9rem; }
.user-meta { display: grid; line-height: 1.3; }
.user-meta strong { font-weight: 600; font-size: .92rem; }
.user-meta small { font-size: .78rem; }
.user-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); min-width: 220px; padding: .9rem; z-index: 30; }
.user-pop p { margin: 0 0 .75rem; }
.user-pop a { display: flex; gap: .5rem; align-items: center; color: var(--danger); text-decoration: none; padding: .4rem .5rem; border-radius: var(--r-sm); }
.user-pop a:hover { background: var(--danger-50); }
.icon-btn { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .4rem; color: var(--ink); cursor: pointer; }
.content { padding: 1.75rem 2rem 3rem; width: 100%; max-width: 1480px; }
.bare { min-height: 100vh; }
.side-scrim { display: none; position: fixed; }

/* ---------- سربرگ صفحه ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { margin: .35rem 0 0; color: var(--muted); max-width: 70ch; }
.crumb { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: .35rem; }
.crumb:hover { color: var(--sign); }
.head-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-top: .6rem; color: var(--muted); font-size: .92rem; }
.head-meta span { display: inline-flex; align-items: center; gap: .3rem; }

/* شماره تیکت: مهر بارنامه‌ای — عنصر شاخص هویت */
.tno { display: inline-flex; align-items: center; direction: ltr; font-family: "Inter", "Vazirmatn", sans-serif; font-weight: 600; letter-spacing: .05em;
  padding: .05rem .6rem; border: 1.5px solid var(--asphalt); border-left: 6px solid var(--lane); border-radius: 4px; background: #fff;
  font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); text-decoration: none; font-size: .92rem; line-height: 1.7; }
a.tno:hover { background: var(--lane-50); }
.tno-lg { font-size: 1.3rem; padding: .3rem 1rem; border-width: 2px; border-left-width: 12px; box-shadow: var(--shadow); }
.tno-int { border-left-color: var(--sign); }

/* ---------- دکمه ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600; font-size: .95rem; padding: .55rem 1.15rem;
  border-radius: 8px; border: 1px solid var(--sign); background: var(--sign); color: #fff; cursor: pointer; text-decoration: none; line-height: 1.5;
  transition: background .15s, box-shadow .15s; }
.btn:hover { background: var(--sign-600); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-danger { background: #fff; color: var(--danger); border-color: #e7b3af; }
.btn-danger:hover { background: var(--danger-50); }
.btn-sm { padding: .3rem .75rem; font-size: .86rem; font-weight: 500; }
.btn-block { width: 100%; }
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

/* ---------- فرم ---------- */
.field { display: grid; gap: .35rem; margin-bottom: 1.1rem; }
.field > span, .field .label { font-weight: 500; font-size: .93rem; color: var(--ink-2); }
.field small { font-weight: 400; }
.req { color: var(--danger); font-weight: 600; }
input[type=text], input[type=password], input[type=search], select, textarea {
  font: inherit; width: 100%; padding: .55rem .8rem; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: #b9c5c9; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sign); box-shadow: 0 0 0 3px var(--sign-50); }
input:disabled { background: var(--surface-2); color: var(--muted); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366767d' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left .8rem center; padding-left: 2.2rem; }
[dir=ltr] select { background-position: right .8rem center; padding-left: .8rem; padding-right: 2.2rem; }
textarea { min-height: 140px; resize: vertical; line-height: 1.8; }
.check { display: inline-flex; gap: .45rem; align-items: center; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--sign); }
.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.form-card { max-width: 780px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.drop { position: relative; display: flex; align-items: center; gap: .6rem; border: 1.5px dashed var(--line-2); border-radius: 8px; padding: .85rem 1rem;
  color: var(--muted); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--sign); background: var(--sign-50); color: var(--sign-600); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.has { border-style: solid; border-color: var(--sign); color: var(--ink); }

/* ---------- فیلتر ---------- */
.toolbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 1rem; }
.statbar { display: flex; gap: .25rem; padding: .5rem .5rem 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.statbar a { display: inline-flex; gap: .45rem; align-items: center; padding: .55rem .9rem; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; font-weight: 500; }
.statbar a:hover { color: var(--ink); }
.statbar a.on { color: var(--ink); border-bottom-color: var(--lane); }
.statbar a b { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 .45rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; padding: 1rem; }
.filters label { display: grid; gap: .2rem; font-size: .84rem; color: var(--muted); font-weight: 500; }
.filters input, .filters select { padding: .42rem .7rem; }
.filters .form-actions { align-self: end; }

/* ---------- جدول ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .75rem 1rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { background: var(--surface-2); font-weight: 500; font-size: .82rem; color: var(--muted); position: sticky; top: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #f9fbfb; }
tbody tr:last-child td { border-bottom: 0; }
td.subj { white-space: normal; min-width: 220px; font-weight: 500; }
td.subj small { display: block; font-weight: 400; }
td.muted { color: var(--muted); font-size: .9rem; }
.row-link { color: inherit; text-decoration: none; }
.row-link:hover { color: var(--sign); }
.empty-row { text-align: center; color: var(--muted); padding: 3rem 1rem !important; white-space: normal; }
.empty-row .ic { display: block; margin: 0 auto .6rem; color: var(--line-2); }

/* ---------- وضعیت ---------- */
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .1rem .65rem; border-radius: 999px; font-size: .82rem; font-weight: 500; white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-queued   { background: #eef1f3; color: #46555c; }
.st-review   { background: #e7effb; color: #1e56a0; }
.st-answered { background: var(--sign-50); color: var(--sign-600); }
.st-user     { background: #fff3d1; color: #86610a; }
.st-tfs      { background: #efeafb; color: #53379b; }
.st-closed   { background: #f3f4f5; color: #7a878d; }
.st-closed i { background: #b3bdc1; }

/* ---------- کارت‌ها و جزئیات ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.35rem 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; }
.panel-internal { background: linear-gradient(var(--lane-50), #fffdf6 120px); border-color: #efdca0; }
.tag-internal { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 500; color: #7a5a00; background: #fbe8a8; border-radius: 999px; padding: .05rem .65rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .6rem 1rem; margin: 0; font-size: .95rem; }
.facts dt { color: var(--muted); font-size: .88rem; }
.facts dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 1.1rem 0; }
.sticky-aside { position: sticky; top: 80px; }

/* مکالمه */
.thread { display: grid; gap: 1rem; margin-bottom: 1.25rem; }
.msg { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: .75rem; max-width: 88%; }
.msg .avatar { width: 36px; height: 36px; font-size: .85rem; }
.bubble { border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; padding: .8rem 1rem; background: #fff; }
[dir=rtl] .bubble { border-radius: 12px 4px 12px 12px; }
.bubble header { display: flex; justify-content: space-between; gap: 1rem; font-size: .84rem; color: var(--muted); margin-bottom: .3rem; flex-wrap: wrap; }
.bubble header strong { color: var(--ink); font-weight: 600; }
.bubble header em { font-style: normal; font-size: .76rem; background: var(--sign-50); color: var(--sign-600); padding: 0 .5rem; border-radius: 999px; margin-inline-start: .4rem; }
.msg-staff { margin-inline-start: auto; grid-template-columns: minmax(0, 1fr) 36px; }
.msg-staff .avatar { order: 2; background: var(--sign); }
.msg-staff .bubble { background: #f4faf7; border-color: #cfe7dc; border-radius: 12px 4px 12px 12px; }
[dir=rtl] .msg-staff .bubble { border-radius: 4px 12px 12px 12px; }
.msg-internal .avatar { background: #b58900; }
.msg-internal .bubble { background: #fffdf4; border-color: #f0e0a8; }
.msg-body { overflow-wrap: anywhere; line-height: 1.85; }
.msg-tag { display: flex; gap: .35rem; align-items: center; margin: 0 0 .35rem; font-weight: 600; color: var(--sign-600); font-size: .9rem; }
.files { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.files li { display: flex; align-items: center; gap: .45rem; border: 1px solid var(--line); border-radius: 8px; padding: .25rem .6rem .25rem .35rem; background: #fff; font-size: .87rem; max-width: 100%; }
.files a { text-decoration: none; display: inline-flex; gap: .4rem; align-items: center; color: var(--ink); min-width: 0; }
.files a:hover .file-name { color: var(--sign); text-decoration: underline; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-ext { font-size: .66rem; font-weight: 700; background: var(--asphalt); color: #fff; border-radius: 4px; padding: .1rem .35rem; direction: ltr; font-family: "Inter", sans-serif; letter-spacing: .03em; }

/* تب‌ها */
.composer { border-top: 1px solid var(--line); margin: 0 -1.5rem -1.35rem; padding: 0 1.5rem 1.35rem; background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; overflow-x: auto; }
.tabs button { display: inline-flex; gap: .4rem; align-items: center; font: inherit; font-weight: 500; background: none; border: 0; border-bottom: 2.5px solid transparent;
  padding: .85rem .8rem .7rem; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--lane); }
.tab-pane[hidden] { display: none; }

/* امتیاز */
.stars { display: inline-flex; flex-direction: row-reverse; gap: .2rem; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { font-size: 2rem; color: #d3dade; cursor: pointer; line-height: 1; transition: color .1s, transform .1s; }
.stars label:hover { transform: scale(1.1); }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--lane); }
.stars input:focus-visible + label { outline: 3px solid var(--lane); border-radius: 4px; }
.score { color: var(--lane); letter-spacing: .1em; font-size: 1.1rem; }

/* پیام‌های سیستمی */
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--r); margin-bottom: 1.25rem; border: 1px solid; }
.alert ul { margin: 0; padding-inline-start: 1.1rem; }
.alert-ok { background: var(--sign-50); border-color: #b9dccb; color: var(--sign-600); }
.alert-err { background: var(--danger-50); border-color: #efc1bd; color: #8e231c; }
.success { text-align: center; padding: 2.5rem 1.5rem; }
.success .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--sign-50); color: var(--sign); display: grid; place-items: center; margin: 0 auto 1rem; }
.success h1 { margin-bottom: .5rem; }
.success p { color: var(--muted); max-width: 52ch; margin: .5rem auto 1.25rem; }
.success .form-actions { justify-content: center; }
.empty-state { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 3rem 1.5rem; text-align: center; max-width: 560px; margin: 2rem auto; }
.empty-state .ic { color: var(--line-2); }
.empty-state p { color: var(--muted); }

/* KPI */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
a.stat:hover { border-color: var(--sign); }
.stat { color: var(--ink); text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stat small { font-weight: 500; }
.stat b { display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.3; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--lane); }

/* دسترسی */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .45rem 1rem; margin: .75rem 0 0; }
.fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; margin: 0 0 1.25rem; }
.fieldset legend { padding: 0 .4rem; font-weight: 600; }

/* صفحه‌بندی */
.pager { display: flex; gap: .3rem; align-items: center; padding: .75rem 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--surface-2); }
.pager a { min-width: 2rem; text-align: center; padding: .15rem .55rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: #fff; color: var(--ink-2); }
.pager a.on { background: var(--asphalt); color: #fff; border-color: var(--asphalt); }
.pager-info { color: var(--muted); margin-inline-end: auto; font-size: .88rem; }

/* ---------- ورود و نصب ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.auth-art { background: var(--asphalt); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 58%; width: 8px;
  background: repeating-linear-gradient(180deg, var(--lane) 0 46px, transparent 46px 80px); opacity: .9; }
.auth-art h2 { font-size: 2.3rem; line-height: 1.3; font-weight: 700; max-width: 14ch; margin: 0; position: relative; z-index: 1; }
.auth-art p { color: #9fb2b9; max-width: 40ch; position: relative; z-index: 1; }
.auth-art .brand { padding: 0; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 6vw, 5rem); background: #fff; position: relative; }
.auth-form .lang-switch { position: absolute; top: 1.5rem; inset-inline-end: 1.5rem; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h1 { margin-bottom: .35rem; }
.auth-form > form > p { color: var(--muted); margin: 0 0 1.75rem; }
.demo { margin-top: 1.5rem; font-size: .86rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 1rem; }
.demo code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; font-size: .85rem; }

@media (max-width: 1100px) {
  .detail { grid-template-columns: 1fr; }
  .sticky-aside { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
  [dir=rtl] .side { transform: translateX(100%); }
  .side.open { transform: none !important; box-shadow: var(--shadow-lg); }
  .side-scrim.open { display: block; inset: 0; background: rgba(15, 26, 32, .4); z-index: 35; }
  .icon-btn { display: inline-flex; }
  .topbar { padding: .6rem 1rem; }
  .user-meta { display: none; }
  .content { padding: 1.25rem 1rem 2.5rem; }
  .msg { max-width: 100%; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- مدیریت سامانه ---------- */
.admin-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1.5rem; padding: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.admin-tabs a { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .85rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.admin-tabs a:hover { background: var(--surface-2); color: var(--ink); }
.admin-tabs a.on { background: var(--asphalt); color: #fff; }
.inline-input { padding: .35rem .6rem !important; min-width: 150px; }
.inline-num { width: 80px !important; min-width: 0; }
.row-off td { opacity: .55; }
.row-off td:last-child { opacity: 1; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tile { display: flex; gap: .9rem; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--sign); transform: translateY(-1px); }
.tile .tile-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--sign-50); color: var(--sign); display: grid; place-items: center; flex: none; }
.tile strong { display: block; font-weight: 600; }
.tile small { display: block; line-height: 1.6; margin-top: .15rem; }
.warn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.warn-list li { background: var(--lane-50); border: 1px solid #efdca0; color: #7a5a00; border-radius: 999px; padding: .1rem .7rem; font-size: .88rem; }
.split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.list-nav { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); max-height: 70vh; overflow-y: auto; padding: .35rem; }
.list-nav a { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem .75rem; border-radius: 8px; color: var(--ink-2); text-decoration: none; }
.list-nav a:hover { background: var(--surface-2); }
.list-nav a.on { background: var(--asphalt); color: #fff; }
.list-nav a.on small { color: #b9c7cc; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.switch-row:last-of-type { border-bottom: 0; }
.switch-row p { margin: .15rem 0 0; color: var(--muted); font-size: .9rem; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--sign); }
.switch input:checked + span::after { transform: translateX(20px); }
[dir=rtl] .switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 3px solid var(--lane); outline-offset: 2px; }
.ext-grid { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; }
.user-pop .pop-link { color: var(--ink-2); }
.user-pop .pop-link:hover { background: var(--surface-2); }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } .list-nav { max-height: 240px; } }

/* ---------- اعلان‌ها و پیامک ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.alert-warn { background: var(--lane-50); border-color: #efdca0; color: #6e5200; }
.alert a, .alert-warn a { color: inherit; font-weight: 600; }
.st-danger { background: var(--danger-50); color: var(--danger); }
.block { display: block; }
.err-text { color: var(--danger) !important; white-space: normal; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: start; }
tr.row-on { background: var(--lane-50); }
.var-bar { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: 1rem; padding: .6rem .75rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.var-bar .label { font-size: .85rem; color: var(--muted); margin-inline-end: .35rem; }
.var-chip { font: 500 .8rem/1.6 "Inter", monospace; border: 1px solid var(--line-2); background: #fff; color: var(--sign-600); border-radius: 6px; padding: .05rem .5rem; cursor: pointer; }
.var-chip:hover { border-color: var(--sign); background: var(--sign-50); }
.tpl-card { border: 1px solid var(--line); border-radius: var(--r); padding: 0; margin: 0 0 1rem; background: #fff; transition: opacity .15s; }
.tpl-card.is-off .tpl-body { opacity: .5; }
.tpl-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r) var(--r) 0 0; }
.tpl-body { padding: .9rem 1rem .4rem; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin-bottom: .75rem; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: .2rem .8rem; border-radius: 6px; font-size: .88rem; color: var(--muted); }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--lane); }
textarea.sms-text { min-height: 96px; }
.sms-meta { display: flex; justify-content: flex-end; font-size: .8rem; color: var(--muted); margin: .25rem 0 .4rem; }
.sms-meta .over { color: #86610a; font-weight: 600; }
.sms-preview { font-size: .85rem; color: var(--ink-2); background: #f4faf7; border: 1px dashed #cfe7dc; border-radius: 8px; padding: .45rem .7rem; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: .6rem; }
.sms-preview:empty { display: none; }
.sms-preview b { display: block; font-weight: 500; font-size: .76rem; color: var(--muted); }
textarea.sms-params, textarea.mono, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .86rem; min-height: 80px; }
.provider-box { border-top: 1px solid var(--line); padding-top: 1rem; }
.radio-list { display: grid; gap: .5rem; margin-bottom: 1rem; }
.radio-card { display: flex; gap: .7rem; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: .65rem .85rem; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--sign); background: var(--sign-50); }
.radio-card input { margin-top: .35rem; accent-color: var(--sign); }
.radio-card strong { display: block; font-weight: 600; }
.radio-card small { display: block; line-height: 1.6; }
pre.code { background: var(--asphalt); color: #e6eef0; border-radius: 8px; padding: .6rem .8rem; font: .82rem/1.6 ui-monospace, Consolas, monospace; overflow-x: auto; white-space: pre; margin: 0 0 .8rem; text-align: left; }
code.raw { display: block; font: .76rem/1.5 ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .5rem; white-space: pre-wrap; word-break: break-all; margin-top: .3rem; text-align: left; }
td.log-body { white-space: normal; min-width: 220px; max-width: 320px; font-size: .9rem; }
.raw-wrap summary { cursor: pointer; font-size: .8rem; color: var(--muted); }
.stat small + small, .stat b + small { display: block; margin-top: .15rem; }

/* ---------- اولویت و SLA ---------- */
.chip.pr { gap: .35rem; }
.pr-low      { background: #f3f4f5; color: #6b787e; }
.pr-low i    { background: #b3bdc1; }
.pr-normal   { background: #eef3f7; color: #3c5566; }
.pr-high     { background: #fff0dc; color: #9a4d00; }
.pr-blocker  { background: var(--danger); color: #fff; font-weight: 600; }
.pr-blocker .ic { stroke: #fff; }

.sla { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 500; line-height: 1.4; white-space: nowrap; border-radius: 6px; padding: .05rem .45rem; }
.sla > span { font-variant-numeric: tabular-nums; }
.sla-ok      { color: var(--sign-600); background: var(--sign-50); }
.sla-warn    { color: #7a5600; background: var(--lane-50); box-shadow: inset 0 0 0 1px #efdca0; }
.sla-breach  { color: #fff; background: var(--danger); }
.sla-breach .ic { stroke: #fff; }
.sla-paused  { color: var(--muted); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.sla-met     { color: var(--sign-600); background: transparent; padding-inline: 0; }
.sla-missed  { color: var(--danger); background: transparent; padding-inline: 0; }
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
tr.row-breach td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--lane); }
[dir=rtl] tr.row-breach td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
[dir=rtl] tr.row-warn td:first-child { box-shadow: inset -3px 0 0 var(--lane); }
tr.row-breach { background: #fffafa; }

/* انتخاب اولویت در ثبت تیکت */
.prio-field { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
.prio-field legend { padding: 0; margin-bottom: .45rem; font-weight: 500; }
.prio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .5rem; }
.prio-card { align-items: flex-start; }
.prio-card strong { display: inline-flex; align-items: center; gap: .3rem; }
.prio-card.prio-high:has(input:checked) { border-color: #d98a2b; background: #fff6ea; }
.prio-card.prio-high input { accent-color: #c77714; }
.prio-card.prio-blocker strong { color: var(--danger); }
.prio-card.prio-blocker:has(input:checked) { border-color: var(--danger); background: var(--danger-50); }
.prio-card.prio-blocker input { accent-color: var(--danger); }

/* پنل SLA جزئیات تیکت */
.sla-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.sla-step { display: flex; justify-content: space-between; gap: .75rem; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .75rem; border-inline-start-width: 4px; }
.sla-step strong { display: block; font-weight: 600; font-size: .95rem; }
.sla-step small { display: block; font-size: .8rem; }
.sla-step .sla-val { text-align: end; }
.sla-step .sla-val b { font-weight: 600; font-size: .92rem; font-variant-numeric: tabular-nums; }
.sla-step.sla-ok { border-inline-start-color: var(--sign); background: #fff; }
.sla-step.sla-warn { border-inline-start-color: var(--lane); background: var(--lane-50); box-shadow: none; }
.sla-step.sla-breach { border-inline-start-color: var(--danger); background: var(--danger-50); color: var(--ink); }
.sla-step.sla-breach .sla-val b { color: var(--danger); }
.sla-step.sla-paused { border-inline-start-color: #b3bdc1; box-shadow: none; }
.sla-step.sla-met { border-inline-start-color: var(--sign); padding-inline: .75rem; color: var(--ink); }
.sla-step.sla-met .sla-val b { color: var(--sign-600); }
.sla-step.sla-missed { border-inline-start-color: var(--danger); padding-inline: .75rem; color: var(--ink); }
.sla-step.sla-missed .sla-val b { color: var(--danger); }
.sla-step.sla-none { border-inline-start-color: var(--line-2); }

/* صفحه SLA */
.sla-matrix th, .sla-matrix td { text-align: center; padding-inline: .4rem; }
.sla-matrix th:first-child, .sla-matrix td:first-child { text-align: start; padding-inline: .9rem; min-width: 190px; }
.sla-matrix thead tr:first-child th { border-bottom: 0; }
.sla-matrix th.prio-head { border-inline-start: 1px solid var(--line); }
.sla-matrix tbody td:nth-child(2n) { border-inline-start: 1px solid var(--line); }
.sla-matrix .inline-num { width: 64px !important; text-align: center; }
.sla-matrix tr.row-default td { background: var(--sign-50); }
.sla-matrix input::placeholder { color: #a9b5ba; }
.day-grid { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; }
.input-suffix { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.stat-danger { border-color: #f1c4c0; background: #fffafa; }
.stat-danger b { color: var(--danger); }
.hint-list { margin: 0 0 1rem; padding-inline-start: 1.1rem; color: var(--muted); font-size: .88rem; display: grid; gap: .4rem; }
.sla-preview { grid-template-columns: auto 1fr; align-items: center; }
.sla-preview dd { font-weight: 400; font-size: .88rem; }

/* ---------- وضعیت‌های یوزر استوری نسخه ۲ ---------- */
.st-assigned { background: #e9f1f6; color: #2d5b78; }
.st-action   { background: #fdebe3; color: #9a3c12; }
.inline-select { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); }
.inline-select select { width: auto; }
.file-url { margin: .6rem 0 0; font-size: .9rem; display: flex; align-items: center; gap: .35rem; overflow-wrap: anywhere; }

/* ---------- تیم فنی و تسک‌ها (فاز ۳) ---------- */
.team-chips { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.team-chip { display: inline-flex; align-items: center; padding: .05rem .55rem; border-radius: 6px; font-size: .78rem; font-weight: 600;
  background: #eef1f3; color: var(--ink-2); border: 1px solid var(--line); font-family: "Inter", "Vazirmatn", sans-serif; white-space: nowrap; }
.team-picks { display: flex; flex-wrap: wrap; gap: .4rem; }
.team-pick { position: relative; cursor: pointer; }
.team-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.team-pick span { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border: 1px solid var(--line-2); border-radius: 999px;
  background: #fff; font-size: .88rem; font-weight: 500; color: var(--ink-2); font-family: "Inter", "Vazirmatn", sans-serif; transition: background .12s, border-color .12s; }
.team-pick span::before { content: ""; width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid var(--line-2); background: #fff; }
.team-pick:hover span { border-color: var(--sign); }
.team-pick input:checked + span { background: var(--sign-50); border-color: var(--sign); color: var(--sign-600); }
.team-pick input:checked + span::before { background: var(--sign); border-color: var(--sign);
  box-shadow: inset 0 0 0 2px #fff; }
.team-pick input:focus-visible + span { outline: 3px solid var(--lane); outline-offset: 1px; }
.task-list { display: grid; gap: .75rem; margin-bottom: 1rem; }
.task-card { border: 1px solid var(--line); border-inline-start: 4px solid var(--line-2); border-radius: 8px; padding: .75rem 1rem; background: #fff; }
.task-card.task-assigned { border-inline-start-color: #2d5b78; }
.task-card.task-in_progress { border-inline-start-color: #53379b; }
.task-card.task-returned { border-inline-start-color: var(--sign); background: #f7fcf9; }
.task-card.task-cancelled { opacity: .6; }
.task-card header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.task-card header small { margin-inline-start: auto; }
.task-card footer { margin-top: .6rem; }
.task-snippet { margin: .55rem 0 0; color: var(--muted); font-size: .9rem; }
.task-result { margin-top: .65rem; padding: .65rem .8rem; border: 1px dashed #cfe7dc; border-radius: 8px; background: #fff; }
.task-result .link { margin-top: .4rem; display: inline-flex; align-items: center; gap: .3rem; color: var(--sign-600); }
.assign-box { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.assign-box > summary { cursor: pointer; padding: .7rem 1rem; font-weight: 600; display: flex; align-items: center; gap: .4rem; list-style: none; }
.assign-box > summary::-webkit-details-marker { display: none; }
.assign-box[open] > summary { border-bottom: 1px solid var(--line); }
.assign-box form { padding: 1rem; }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.mini-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: .9rem; }
.facts-2 { margin-bottom: 1rem; }
.seg-links { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg-links a { padding: .35rem .9rem; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .9rem; }
.seg-links a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
tr.row-new td:first-child { box-shadow: inset 3px 0 0 var(--lane); }
.lang-fa tr.row-new td:first-child { box-shadow: inset -3px 0 0 var(--lane); }
tr.row-new td { background: #fffdf4; }
.panel h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.panel h3 small { font-weight: 400; font-size: .82rem; }
