/* المحادثات (sheikh/inbox.js): the inbox on the start side, the open thread beside it, both inside one white card
   (the navy design canvas: the student's messages white on a soft shadow, his navy, the freed-time offer a gold card). */
.ib-box { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); height: max(520px, calc(100vh - 230px)); height: max(520px, calc(100dvh - 230px)); background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow); overflow: hidden; }

/* the inbox */
.ib-inbox { min-height: 0; overflow-y: auto; border-inline-end: 1px solid var(--line); }
.ib-list { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.ib-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; color: inherit; text-decoration: none; transition: background-color 150ms ease-out; }
.ib-item .small-avatar { width: 44px; height: 44px; }
.ib-item[aria-current="true"] { background: var(--navy-wash); box-shadow: inset 0 0 0 1px #DCE3F3; }
.ib-item[aria-current="true"] .small-avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--navy-2); }
@media (hover: hover) and (pointer: fine) { .ib-item:not([aria-current="true"]):hover { background: var(--fill); } }
.ib-it { min-width: 0; display: flex; flex-direction: column; gap: 3px; line-height: 1.35; }
.ib-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ib-top b { min-width: 0; font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-top small { flex: none; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.ib-row2 { display: flex; align-items: center; gap: 8px; }
.ib-prev { flex: 1; min-width: 0; font-size: var(--text-md); line-height: 1.45; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-item.unread .ib-prev { color: var(--ink); font-weight: 500; }
.ib-item.unread .ib-top small { color: var(--gold-ink); font-weight: 700; }
.ib-count { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); display: inline-grid; place-items: center; background: var(--gold); color: var(--gold-ink); font-size: var(--text-xs); font-weight: 800; }
.ib-none { padding: 16px; }

/* the thread: who, the messages on a soft ground, the composer */
.ib-thread { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.ib-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.ib-head .small-avatar { width: 44px; height: 44px; }
.ib-head .ib-it { flex: 1 1 220px; }
.ib-head b { font-size: 17px; font-weight: 800; }
.ib-head small { font-size: 13.5px; color: var(--ink-2); }
.ib-reached { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.ib-pos { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 8px; background: var(--gold); color: var(--gold-ink); font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.btn.ib-file { height: 36px; padding: 0 16px; border: 0; background: var(--surface); box-shadow: var(--shadow); color: var(--brand); font-size: 14.5px; font-weight: 700; transition: transform 160ms ease-out, box-shadow 200ms ease; }
.btn.ib-file:hover { box-shadow: 0 0 0 1px rgba(16, 27, 58, .07), 0 14px 30px -14px rgba(16, 27, 58, .22); }

.ib-msgs { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 18px 24px 20px; display: flex; flex-direction: column; gap: 10px; background: var(--fill); }
.ib-msgs > :first-child { margin-top: auto; }   /* a short thread sits by the composer, like any chat */
.ib-day { align-self: center; margin: 6px 0 2px; padding: 5px 12px; border-radius: var(--radius-pill); background: var(--fill-2); font-size: 12.5px; font-weight: 700; line-height: 1.2; color: var(--ink-2); }
.ib-msg { max-width: min(70%, 540px); padding: 10px 15px 8px; border-radius: 18px; }
.ib-msg p { margin: 0; font-size: 15.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.ib-msg small { display: block; margin-top: 3px; font-size: var(--text-xs); font-weight: 500; line-height: 1.2; color: var(--ink-3); }
.ib-msg.them { align-self: flex-start; background: var(--surface); box-shadow: var(--shadow); border-start-start-radius: 6px; }
.ib-msg.me { align-self: flex-end; background: var(--grad); color: var(--on-accent); border-start-end-radius: 6px; box-shadow: 0 10px 22px -16px rgba(22, 41, 92, .7); }
.ib-msg.me small { color: rgba(255, 255, 255, .72); text-align: end; }

/* a freed-time offer: a gold-edged card in the middle of the thread, its state in a tinted box */
.ib-offer { align-self: center; width: min(100%, 500px); margin-top: 4px; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow), inset 0 0 0 1px var(--gold-edge); }
.ib-offer-head { margin: 0; display: flex; align-items: center; gap: 10px; }
.ib-offer-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--gold-ink); }
.ib-offer-head b { flex: 1; font-size: 15.5px; font-weight: 800; }
.ib-offer-head small { font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.ib-offer-text { margin: 0; font-size: 15.5px; line-height: 1.6; }
.ib-offer-state { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--gold); color: var(--gold-ink); }
.ib-offer-state p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; font-size: var(--text-md); font-weight: 700; line-height: 1.4; }
.ib-offer-state .tag { height: auto; padding: 0; border-radius: 0; background: none; color: inherit; font-size: inherit; font-weight: inherit; }
.ib-offer-state small { font-size: var(--text-md); font-weight: 500; }
.ib-offer-state .bar { height: 6px; background: rgba(138, 100, 32, .16); }
.ib-offer-state .bar i { background: var(--gold-mark); }
.ib-offer-state.ok { background: var(--live-soft); color: var(--live); }
.ib-offer-state.done { background: var(--neutral-bg); color: var(--neutral); }
.ib-offer-note { margin: 0; font-size: 13.5px; font-weight: 500; line-height: 1.5; color: var(--ink-3); }

/* an empty pane: an icon in a circle over its line */
.ib-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px 20px; color: var(--ink-2); font-size: var(--text-base); text-align: center; }
.ib-empty > :first-child { margin-top: 0; }
.ib-empty p { margin: 0; max-width: 340px; line-height: 1.6; }
.ib-empty-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }

/* the composer: quick replies as soft navy pills, the message in a pill, send in navy */
.ib-compose { display: flex; flex-direction: column; gap: 10px; padding: 12px 22px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.ib-quicks { display: flex; flex-wrap: wrap; gap: 8px; }
.ib-quick { min-height: 34px; padding: 0 14px; border: 0; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand); font-size: 13.5px; font-weight: 700; transition: transform 150ms cubic-bezier(.23, 1, .32, 1), background-color 200ms ease; }
.ib-quick:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .ib-quick:hover { background: #DDE3F4; } }
.ib-form { display: flex; align-items: center; gap: 8px; }
.ib-form input { flex: 1; min-width: 0; height: 48px; padding: 0 18px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--fill); transition: border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out; }
.ib-form input::placeholder { color: #8E96AE; }
.ib-form input:focus { outline: none; border-color: var(--navy-2); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.ib-form .btn { height: 52px; padding: 0 22px; font-size: var(--text-input); font-weight: 700; }
.ib-note { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-3); }
.ib-note svg { flex: none; }
@media (prefers-reduced-motion: reduce) { .ib-quick { transition: none; } .ib-quick:active { transform: none; } }

@media (max-width: 1100px) { .ib-box { grid-template-columns: 300px minmax(0, 1fr); } .ib-msg { max-width: 85%; } }
/* a phone (inbox.js PHONE): the list alone, or one thread filling the space between the app's two bars (nav.css), its
   messages scrolling over the composer; the top bar carries the student's name */
@media (max-width: 760px) {
  .ib-box { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ib-box:not(.has-open) .ib-thread, .ib-box.has-open .ib-inbox { display: none; }
  .ib-inbox { border-inline-end: 0; }
  .i-page:has(.ib-box.has-open) { padding: 0; }
  .i-wrap:has(> .ib-box.has-open) { height: 100%; gap: 0; }
  .i-wrap:has(> .ib-box.has-open) > .page-head { display: none; }
  .ib-box.has-open { flex: 1; min-height: 0; border-radius: 0; box-shadow: none; }
  .ib-box.has-open .ib-head > .ib-it { display: none; }
  .ib-msgs { padding: 16px 14px; }
  .ib-item { min-height: 64px; }
  .ib-msg { max-width: 86%; }
  .ib-head { padding: 14px 16px; }
  .ib-compose { padding: 12px 14px; }
  .ib-form .btn { padding: 0 16px; }
}
