/* ============================================================
   باش‌تاپ ۰۰۲ — ارتباطات و نشان
   زنگوله · پانویس و حقِ نشر · صندوقِ پیام · گفت‌وگو · اطلاعیه · صفحهٔ «درباره»
   روی kashi-base.css؛ در بخشِ دانشجو، پنلِ مدیر و صفحهٔ ورود بار می‌شود.
   ============================================================ */

/* ── لوگوی سربرگ در رایانه کمی بزرگ‌تر ── */
@media (min-width: 761px) {
  .bar .brand-tile { height: 46px; padding: 0 14px; border-radius: 12px; }
  .bar .brand-tile img { height: 30px; }
  .bar .brand-name { font-size: 1.02rem; }
}

/* حالتِ فشردهٔ لپ‌تاپ (ارتفاعِ کم): سربرگ باریک می‌ماند */
@media (min-width: 768px) and (max-height: 720px) and (pointer: fine) {
  .bar .brand-tile { height: 34px; padding: 0 9px; border-radius: 9px; }
  .bar .brand-tile img { height: 22px; }
  .bar .bell { width: 34px; height: 34px; }
  .site-foot { margin-top: 16px; }
  .site-foot-in { padding-block: 8px; }
}

/* ── زنگوله ── */
.bell { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 999px; color: var(--ink-soft); }
.bell svg { width: 22px; height: 22px; fill: currentColor; }
.bell:hover { background: var(--lapis-soft); color: var(--lapis); text-decoration: none; }
.bell.has { color: var(--lapis); }
.bell-n { position: absolute; top: 2px; inset-inline-end: 0; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--pomegranate); color: #fff; font-size: .72rem; font-weight: 800;
  line-height: 19px; text-align: center; box-shadow: 0 0 0 2px var(--card); }
.bell-n[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .bell.has svg { animation: bell-ring 3.5s ease-in-out 1s 2; transform-origin: 50% 10%; }
  @keyframes bell-ring { 0%, 86%, 100% { transform: none; } 89% { transform: rotate(14deg); }
    93% { transform: rotate(-12deg); } 96% { transform: rotate(6deg); } }
}

/* ── پانویس: نشان + حقِ نشر ── */
body:has(> .site-foot) { display: flex; flex-direction: column; }
body:has(> .site-foot) > main, body:has(> .site-foot) > .shell { flex: 1 0 auto; width: 100%; }
.site-foot { margin-top: 32px; border-top: 1px solid var(--line); background: var(--card); }
.site-foot-in { max-width: 1360px; margin: 0 auto; display: flex; align-items: center; gap: 12px 18px;
  flex-wrap: wrap; padding: 14px clamp(16px, 4vw, 40px) calc(14px + env(safe-area-inset-bottom, 0px)); }
.foot-brand:hover { text-decoration: none; }
.foot-tile { height: auto; padding: 7px 12px; border-radius: 10px; box-shadow: none; }
.foot-tile img { height: 32px; }
.foot-copy { flex: 1 1 320px; font-size: .82rem; color: var(--ink-soft); line-height: 1.9; }
.foot-links { display: flex; align-items: center; gap: 14px; font-size: .82rem; }
.foot-ver { color: var(--ink-soft); font-size: .76rem; padding: 1px 8px; border-radius: 999px; background: var(--paper); }
.auth-copy { margin-top: 18px; text-align: center; font-size: .78rem; color: var(--ink-soft); line-height: 1.9; }
.msheet-copy { font-size: .74rem; color: var(--ink-soft); text-align: center; line-height: 1.8; margin-top: 2px; }
.cert-issuer { margin-top: 14px; font-size: .74rem; color: #5A6478; }

/* ── «درباره» ── */
.about-lead { color: var(--ink-soft); line-height: 2; margin-bottom: 14px; }
.about-facts { display: grid; gap: 8px; margin: 0 0 16px; }
.about-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px;
  border-radius: var(--r-sm); background: var(--paper); font-size: .9rem; }
.about-facts dt { color: var(--ink-soft); }
.about-facts dd { margin: 0; font-weight: 700; text-align: end; }
.about-h { font-size: 1rem; margin: 6px 0 6px; }
.about-text { font-size: .9rem; line-height: 2.05; margin-bottom: 8px; }

/* ── زبانه‌های صندوق ── */
.seg-tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); }
.seg-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 18px; border-radius: 999px;
  font-weight: 700; font-size: .9rem; color: var(--ink-soft); }
.seg-tabs a:hover { text-decoration: none; color: var(--ink); }
.seg-tabs a.on { background: var(--lapis); color: #fff; }
.seg-tabs .n { min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: .74rem; text-align: center;
  background: var(--pomegranate); color: #fff; }
@media (prefers-color-scheme: dark) { .seg-tabs a.on { color: #0F1729; } }
.btn .ic { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* وضعیتِ گفت‌وگو */
.st-chip { display: inline-block; font-size: .74rem; font-weight: 800; padding: 0 10px; border-radius: 999px;
  line-height: 1.9; white-space: nowrap; }
.st-chip.st-open { background: var(--saffron-soft); color: #8A5A0F; }
.st-chip.st-answered { background: var(--turquoise-soft); color: var(--turquoise); }
.st-chip.st-closed { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .st-chip.st-open { color: var(--saffron); } }

/* ── فهرستِ گفت‌وگوها ── */
.conv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.conv-row { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px;
  align-items: start; padding: 14px 16px; border-radius: var(--r); background: var(--card);
  border: 1px solid var(--line); color: var(--ink); box-shadow: 0 1px 2px rgba(23, 33, 51, .04); }
.conv-row:hover { text-decoration: none; border-color: var(--lapis); }
.conv-row.unread { border-inline-start: 4px solid var(--lapis); }
.conv-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--lapis-soft); color: var(--lapis); }
.conv-ic.from-admin { background: var(--saffron-soft); color: #8A5A0F; }
@media (prefers-color-scheme: dark) { .conv-ic.from-admin { color: var(--saffron); } }
.conv-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.conv-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.conv-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-row.unread .conv-subj { color: var(--lapis); }
.conv-top time { flex: none; font-size: .76rem; color: var(--ink-soft); }
.conv-snip { font-size: .86rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.conv-dot { width: 10px; height: 10px; margin-top: 8px; border-radius: 50%; background: var(--pomegranate);
  box-shadow: 0 0 0 3px var(--pomegranate-soft); }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 36px 20px; }
.empty-state svg { fill: none; stroke: var(--t-learning); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty-state .btn { margin-top: 6px; }

/* ── فرمِ تیکت ── */
.ticket-form { display: flex; flex-direction: column; gap: 14px; }
.ticket-form textarea, .send-form textarea { width: 100%; font: inherit; line-height: 1.9; padding: 11px 14px;
  border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); resize: vertical; }
.ticket-form textarea:focus { border-color: var(--lapis); outline: none; box-shadow: 0 0 0 3px var(--lapis-soft); }
.ticket-form input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; }
.ticket-about { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--lapis-soft); color: var(--lapis); font-size: .9rem; }
.ticket-about svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ticket-about b { color: var(--ink); }

/* «سؤال دارم» در درس و بازخورد */
.ask-link { display: inline-flex; align-items: center; gap: 8px; width: max-content; font-size: .88rem;
  font-weight: 700; color: var(--turquoise); padding: 4px 0; }
.ask-link svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

/* ── گفت‌وگو ── */
.chat-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.chat-head h1 { font-size: clamp(1.25rem, 2.6vw, 1.55rem); }
.chat-head-tags { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.chat-log { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; }
.chat-log > .msg, #end { scroll-margin-bottom: 200px; }
.msg { max-width: min(84%, 560px); display: flex; flex-direction: column; gap: 4px; padding: 10px 14px 6px;
  border-radius: 18px; background: var(--card); border: 1px solid var(--line); align-self: flex-end;
  box-shadow: 0 1px 2px rgba(23, 33, 51, .05); }
.msg.mine { align-self: flex-start; background: var(--lapis-soft); border-color: transparent;
  border-start-start-radius: 6px; }
.msg.theirs { border-start-end-radius: 6px; }
.msg.theirs.from-staff { border-inline-end: 3px solid var(--turquoise); }
.msg-who { font-size: .74rem; font-weight: 800; color: var(--ink-soft); }
.msg.from-staff .msg-who { color: var(--turquoise); }
.msg.mine .msg-who { color: var(--lapis); }
.msg-body { line-height: 1.95; overflow-wrap: anywhere; white-space: normal; }
.msg-body a { text-decoration: underline; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.msg-img img { display: block; max-width: 220px; max-height: 220px; border-radius: 12px; object-fit: cover;
  border: 1px solid var(--line); background: var(--paper); }
.msg-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 12px;
  border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-size: .86rem; }
.msg-file:hover { text-decoration: none; border-color: var(--lapis); }
.msg-file svg { flex: none; fill: none; stroke: var(--lapis); stroke-width: 1.8; stroke-linejoin: round; }
.msg-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.msg-file small { flex: none; color: var(--ink-soft); }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: .7rem; color: var(--ink-soft); }
.tick svg { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tick .t2 { opacity: 0; }
.tick.seen svg { stroke: var(--turquoise); }
.tick.seen .t2 { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .chat-log > .msg:last-child { animation: msg-in .25s ease-out; }
  @keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
.chat-closed { margin: 8px 0; padding: 10px 14px; border-radius: var(--r-sm); background: var(--paper);
  color: var(--ink-soft); font-size: .88rem; text-align: center; }

.chat-form { position: sticky; bottom: 0; z-index: 5; margin-top: 12px; padding: 10px 12px 8px;
  border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--lift); }
.chat-form textarea { width: 100%; min-height: 48px; max-height: 240px; font: inherit; line-height: 1.85; resize: none;
  padding: 8px 10px; border: 0; background: transparent; color: var(--ink); }
.chat-form textarea:focus { outline: none; box-shadow: none; }
.chat-form:focus-within { border-color: var(--lapis); box-shadow: 0 0 0 3px var(--lapis-soft), var(--lift); }
.chat-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 6px;
  border-top: 1px dashed var(--line); }
.chat-attach { display: inline-grid; place-items: center; width: 40px; height: 40px; margin: 0; border-radius: 50%;
  cursor: pointer; color: var(--ink-soft); }
.chat-attach:hover, .chat-attach:focus-within { background: var(--paper); color: var(--lapis); }
.chat-attach:focus-within { outline: 3px solid var(--saffron); }
.chat-attach svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-files { flex: 1; min-width: 0; font-size: .8rem; color: var(--lapis); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.chat-close-opt { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .82rem; font-weight: 500;
  color: var(--ink-soft); }
.chat-send { margin-inline-start: auto; }
.chat-send svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; transform: scaleX(-1); }
.chat-send.busy { opacity: .6; }
.chat-hint { font-size: .72rem; color: var(--ink-soft); margin-top: 4px; }

/* پنلِ مدیر: گفت‌وگو + ستونِ مشخصات */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.chat-side { position: sticky; top: 16px; }
.chat-side p { margin: 0 0 8px; }
.chat-side-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--line); }
.chat-side-actions .btn { justify-content: center; }
@media (max-width: 1100px) { .chat-layout { grid-template-columns: minmax(0, 1fr); } .chat-side { position: static; order: -1; } }
.tbl-inbox .row-unread td { background: color-mix(in srgb, var(--saffron-soft) 55%, transparent); }
.tbl-inbox .row-unread b { color: var(--lapis); }
.inbox-snip { display: block; max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── پیام به دانشجو ── */
.send-to { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 12px; margin: 0 0 14px;
  display: flex; flex-direction: column; gap: 6px; }
.send-to legend { font-weight: 800; color: var(--lapis); padding: 0 6px; }
.send-opt { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink); font-weight: 500; cursor: pointer; border: 1.5px solid transparent; }
.send-opt:has(input:checked) { background: var(--lapis-soft); border-color: var(--lapis); }
.send-opt input { margin-top: 6px; }
.send-opt > span { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.send-opt select { max-width: 420px; }
.send-names { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── اطلاعیه‌ها ── */
.ann-banners { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ann-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 14px 16px; border-radius: var(--r-lg); background: var(--saffron-soft);
  border: 1px solid color-mix(in srgb, var(--saffron) 50%, transparent); border-inline-start: 5px solid var(--saffron); }
.ann-banner-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--saffron); color: #3A2608; }
.ann-banner-ic svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ann-banner-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ann-banner-body b { font-size: 1.02rem; }
.ann-banner-text { font-size: .92rem; line-height: 1.95; color: var(--ink); }
.ann-banner-text p { margin: 0; }
.ann-banner-more { font-size: .82rem; font-weight: 700; color: #8A5A0F; }
@media (prefers-color-scheme: dark) { .ann-banner-more { color: var(--saffron); } }
.ann-banner form { margin: 0; }
.ann-close { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: transparent; color: var(--ink-soft); cursor: pointer; }
.ann-close:hover { background: var(--card); color: var(--ink); }
.ann-close svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ann { scroll-margin-top: 80px; }
.ann-body { line-height: 2; }
.ann-aud-line { margin-top: 8px; }
.ann-st { display: inline-block; font-size: .76rem; font-weight: 800; padding: 0 10px; border-radius: 999px; line-height: 1.9; }
.ann-st-active { background: var(--turquoise-soft); color: var(--turquoise); }
.ann-st-scheduled { background: var(--lapis-soft); color: var(--lapis); }
.ann-st-draft { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); }
.ann-st-expired { background: var(--paper); color: var(--ink-soft); text-decoration: line-through; }
.ann-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.ann-form .course-checks { margin: 4px 0 4px 0; padding-inline-start: 22px; }

/* کاشیِ «پیام‌ها» در برگهٔ «بیشتر» و نقطهٔ نوارِ پایین */
.tile-ic { position: relative; display: inline-grid; }
.tile-n { position: absolute; top: -6px; inset-inline-end: -10px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--pomegranate); color: #fff; font-size: .68rem; font-weight: 800; line-height: 18px; }
.tile-n[hidden], .bnav-dot[hidden] { display: none; }
.bnav-dot { position: absolute; top: 5px; inset-inline-start: calc(50% - 24px); min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--pomegranate); color: #fff; font-style: normal; font-size: .64rem; font-weight: 800;
  line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--card); }

/* ── گوشی ── */
@media (max-width: 760px) {
  .bar .bell { width: 38px; height: 38px; }
  .site-foot { margin-top: 0; background: transparent; border-top: 0; }
  .site-foot-in { flex-direction: column; text-align: center; gap: 6px; padding: 8px 18px 12px; }
  .foot-brand { display: none; }                   /* لوگو در سربرگِ گوشی هست */
  .foot-copy { flex: none; font-size: .74rem; }
  .foot-links { font-size: .76rem; }
  body:has(.bnav) .site-foot-in { padding-bottom: calc(var(--bnav-h, 62px) + env(safe-area-inset-bottom, 0px) + 14px); }
  body:has(.bnav) > main.page { padding-bottom: 12px; }
  .panel-app .site-foot-in { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

  .seg-tabs { display: flex; }
  .seg-tabs a { flex: 1; justify-content: center; }
  .conv-row { grid-template-columns: 38px minmax(0, 1fr) auto; padding: 12px; gap: 10px; }
  .conv-ic { width: 38px; height: 38px; }
  .msg { max-width: 88%; }
  .msg-img img { max-width: 180px; max-height: 180px; }
  .chat-form { bottom: calc(var(--bnav-h, 62px) + env(safe-area-inset-bottom, 0px) + 6px); border-radius: 18px; }
  .panel-app .chat-form { bottom: 8px; }
  .chat-hint { display: none; }
  .chat-log > .msg, #end { scroll-margin-bottom: calc(var(--bnav-h, 62px) + 170px); }
  .chat-close-opt { order: 5; flex-basis: 100%; }
  .ann-banner { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
  .ann-banner-ic { display: none; }
  .list-head .btn { flex: 1; }
}
@media print { .site-foot, .bell { display: none; } }

/* درخواست‌های حساب: ردیفِ دکمه‌ها زیرِ هر درخواست */
.tbl tr:has(+ tr.req-actions) td { border-bottom: 0; padding-bottom: 4px; }
.tbl tr.req-actions td { padding-top: 0; }
.tbl tr.req-actions:hover td { background: none; }
@media (max-width: 760px) {
  .tbl-cards tr:has(+ tr.req-actions) { border-bottom: 0; padding-bottom: 4px; }
  .tbl-cards tr.req-actions { padding: 0 16px 14px; }
  .tbl-cards tr.req-actions td { flex-basis: 100%; }
}
