/* communications.css — Shahdad communications center v31.97 */

.modal.communications-modal,
.modal:has(.comm-hub) {
  width: min(1180px, 96vw);
  height: min(820px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
}
.modal.communications-modal .modal-body,
.modal:has(.comm-hub) .modal-body {
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #061525;
}

.comm-hub {
  --comm-surface: rgba(10, 33, 55, 0.92);
  --comm-surface-2: rgba(13, 41, 68, 0.88);
  --comm-line: rgba(168, 213, 232, 0.14);
  --comm-line-strong: rgba(168, 213, 232, 0.25);
  --comm-accent: #00d4ff;
  --comm-gold: #c9a96e;
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  color: var(--ice-white);
  background:
    radial-gradient(circle at 88% -14%, rgba(0, 212, 255, 0.12), transparent 30%),
    radial-gradient(circle at 4% 108%, rgba(201, 169, 110, 0.1), transparent 30%),
    #061525;
}
.comm-hub button,
.comm-hub input,
.comm-hub textarea {
  font: inherit;
}
.comm-hub button {
  cursor: pointer;
}
.comm-hub button:focus-visible,
.comm-hub input:focus-visible,
.comm-hub textarea:focus-visible,
.comm-hub input[type="checkbox"]:focus-visible + span {
  outline: 2px solid var(--comm-accent);
  outline-offset: 2px;
}
.comm-hub button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.comm-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 22px;
  min-height: 126px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--comm-line);
  background: linear-gradient(90deg, rgba(11, 39, 65, 0.96), rgba(7, 25, 43, 0.72));
}
.comm-hero-copy > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--comm-accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.035em;
}
.comm-hero-copy h2 {
  margin: 5px 0 0;
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 780;
  letter-spacing: -0.025em;
}
.comm-hero-copy p {
  max-width: 560px;
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.7;
}
.comm-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 8px;
}
.comm-summary > div {
  min-width: 96px;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 2px 8px;
  padding: 10px 12px;
  border: 1px solid var(--comm-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}
.comm-summary svg {
  grid-row: 1 / 3;
  align-self: center;
  color: var(--comm-accent);
}
.comm-summary > div:nth-child(2) svg { color: var(--comm-gold); }
.comm-summary > div:nth-child(3) svg { color: #8fd8bf; }
.comm-summary strong {
  color: var(--ice-white);
  font-size: 18px;
  line-height: 1;
}
.comm-summary span {
  color: var(--text-mute);
  font-size: 9px;
  white-space: nowrap;
}
.comm-compose-trigger {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid rgba(0, 212, 255, 0.42);
  border-radius: 12px;
  color: #03202a;
  background: linear-gradient(135deg, #40def6, #00b9dc);
  box-shadow: 0 12px 30px -18px rgba(0, 212, 255, 0.8);
  font-size: 12px;
  font-weight: 800;
  transition: transform 0.2s var(--ease), filter 0.2s var(--ease);
}
.comm-compose-trigger:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.comm-tabs-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 330px);
  align-items: center;
  gap: 18px;
  min-height: 66px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--comm-line);
  background: rgba(4, 17, 30, 0.74);
}
.comm-tabs {
  display: flex;
  align-items: center;
  gap: 5px;
}
.comm-tabs > button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 650;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.comm-tabs > button:hover {
  color: var(--ice-white);
  background: rgba(255, 255, 255, 0.04);
}
.comm-tabs > button.active {
  color: #dffaff;
  border-color: rgba(0, 212, 255, 0.24);
  background: rgba(0, 212, 255, 0.1);
}
.comm-tabs > button svg { color: currentColor; }
.comm-tabs > button b {
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #04101c;
  background: var(--comm-accent);
  font-size: 9px;
}
.comm-search {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--comm-line);
  border-radius: 12px;
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.comm-search:focus-within {
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08);
}
.comm-search input {
  min-width: 0;
  flex: 1;
  color: var(--ice-white);
  font-size: 11.5px;
}
.comm-search input::placeholder { color: var(--text-mute); }
.comm-search button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--text-soft);
}
.comm-search button:hover { color: var(--ice-white); background: rgba(255, 255, 255, 0.06); }

.comm-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: 174px minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  overflow: hidden;
}
.comm-rail,
.comm-list-pane,
.comm-detail-pane {
  min-height: 0;
}
.comm-rail {
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  border-inline-end: 1px solid var(--comm-line);
  background: rgba(4, 17, 30, 0.48);
}
.comm-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 9px;
  color: var(--text-mute);
  font-size: 10px;
  font-weight: 700;
}
.comm-rail-head b {
  min-width: 24px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid var(--comm-line);
  border-radius: 999px;
  color: var(--frost);
  font-size: 9px;
}
.comm-rail nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comm-rail nav button {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 11px;
  text-align: start;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.comm-rail nav button:hover {
  color: var(--ice-white);
  background: rgba(255, 255, 255, 0.04);
}
.comm-rail nav button.active {
  color: #e5fbff;
  border-color: rgba(0, 212, 255, 0.2);
  background: rgba(0, 212, 255, 0.09);
}
.comm-rail nav button b {
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #061525;
  background: var(--comm-accent);
  font-size: 9px;
}
.comm-rail-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: auto;
  padding: 11px;
  border: 1px solid rgba(201, 169, 110, 0.16);
  border-radius: 11px;
  color: var(--text-mute);
  background: rgba(201, 169, 110, 0.045);
}
.comm-rail-note svg {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--comm-gold);
}
.comm-rail-note p {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.7;
}
.comm-storage-warning {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 91, 110, 0.28);
  border-radius: 11px;
  color: #ffb7bf;
  background: rgba(255, 91, 110, 0.08);
}
.comm-storage-warning svg { flex: 0 0 auto; margin-top: 2px; }
.comm-storage-warning p { margin: 0; font-size: 10.5px; line-height: 1.65; }

.comm-list-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-inline-end: 1px solid var(--comm-line);
  background: rgba(7, 25, 43, 0.46);
}
.comm-list-pane.has-bulk {
  grid-template-rows: auto auto minmax(0, 1fr);
}
.comm-list-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--comm-line);
}
.comm-select-all {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-mute);
  font-size: 11px;
  cursor: pointer;
}
.comm-select-all input,
.comm-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--comm-accent);
}
.comm-list-head > button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--comm-line);
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 10.5px;
}
.comm-list-head > button:not(:disabled):hover {
  color: var(--ice-white);
  border-color: rgba(0, 212, 255, 0.28);
  background: rgba(0, 212, 255, 0.06);
}
.comm-bulk {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.18);
  background: rgba(0, 212, 255, 0.07);
}
.comm-bulk strong {
  margin-inline-end: auto;
  color: #dcfaff;
  font-size: 10px;
}
.comm-bulk button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--comm-line);
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 10px;
}
.comm-bulk button:hover { color: var(--ice-white); background: rgba(255, 255, 255, 0.05); }
.comm-list {
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.comm-list::-webkit-scrollbar,
.comm-detail-pane::-webkit-scrollbar,
.comm-compose-fields::-webkit-scrollbar { width: 6px; }
.comm-list::-webkit-scrollbar-thumb,
.comm-detail-pane::-webkit-scrollbar-thumb,
.comm-compose-fields::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-strong);
}

.comm-row {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 42px;
  align-items: stretch;
  border-bottom: 1px solid rgba(168, 213, 232, 0.09);
  background: transparent;
  transition: background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.comm-row:hover { background: rgba(255, 255, 255, 0.025); }
.comm-row.unread {
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.07), transparent 64%);
  box-shadow: inset 2px 0 rgba(0, 212, 255, 0.65);
}
html[dir="rtl"] .comm-row.unread { box-shadow: inset -2px 0 rgba(0, 212, 255, 0.65); }
.comm-row.selected { background: rgba(0, 212, 255, 0.085); }
.comm-check {
  min-width: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.comm-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.comm-check span {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--comm-line-strong);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.02);
}
.comm-check input:checked + span {
  border-color: var(--comm-accent);
  background: var(--comm-accent);
  box-shadow: inset 0 0 0 3px #07304a;
}
.comm-row-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 2px;
  color: inherit;
  text-align: start;
}
.comm-row-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 212, 255, 0.16);
  border-radius: 11px;
  color: var(--comm-accent);
  background: rgba(0, 212, 255, 0.07);
}
.comm-row-icon.kind-danger,
.comm-detail-icon.kind-danger {
  color: #ff7d8c;
  border-color: rgba(255, 91, 110, 0.24);
  background: rgba(255, 91, 110, 0.09);
}
.comm-row-icon.kind-warn,
.comm-detail-icon.kind-warn,
.comm-row-icon.kind-financial,
.comm-detail-icon.kind-financial {
  color: var(--comm-gold);
  border-color: rgba(201, 169, 110, 0.24);
  background: rgba(201, 169, 110, 0.08);
}
.comm-row-icon.kind-ok,
.comm-detail-icon.kind-ok,
.comm-row-icon.kind-account,
.comm-detail-icon.kind-account {
  color: #79d7ad;
  border-color: rgba(91, 224, 164, 0.22);
  background: rgba(91, 224, 164, 0.08);
}
.comm-row-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.comm-row-kicker {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-mute);
  font-size: 10.5px;
}
.comm-row-kicker > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comm-row-kicker b {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid rgba(255, 91, 110, 0.2);
  border-radius: 999px;
  color: #ff9ca7;
  background: rgba(255, 91, 110, 0.08);
  font-size: 9.5px;
}
.comm-row-kicker b.comm-demo-tag,
.comm-detail-meta b.comm-demo-tag {
  color: #9defff;
  border-color: rgba(0, 212, 255, 0.22);
  background: rgba(0, 212, 255, 0.08);
}
.comm-row-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ice-white);
  font-size: 11.5px;
  font-weight: 720;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.comm-row.unread .comm-row-copy strong { color: #e8fcff; }
.comm-row-copy small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.comm-row-time {
  margin-top: 2px;
  color: var(--text-mute);
  font-size: 10px;
}
.comm-unread-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: var(--comm-accent);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.68);
}
.comm-star {
  width: 40px;
  height: 40px;
  align-self: center;
  display: grid;
  place-items: center;
  margin: 0 2px;
  border-radius: 9px;
  color: var(--text-mute);
}
.comm-star:hover { color: var(--ice-white); background: rgba(255, 255, 255, 0.05); }
.comm-star.on { color: var(--comm-gold); }
.comm-star.on svg { fill: currentColor; }

.comm-empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
}
.comm-empty > span,
.comm-detail-empty > span {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--comm-line);
  border-radius: 17px;
  color: var(--comm-accent);
  background: rgba(0, 212, 255, 0.055);
}
.comm-empty strong {
  max-width: 290px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.7;
}
.comm-empty button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--comm-line);
  border-radius: 9px;
  color: var(--frost);
  font-size: 10px;
}
.comm-empty button:hover { border-color: rgba(0, 212, 255, 0.32); color: var(--ice-white); }

.comm-detail-pane {
  position: relative;
  overflow: auto;
  background:
    radial-gradient(circle at 100% 0, rgba(0, 212, 255, 0.045), transparent 35%),
    rgba(4, 17, 30, 0.25);
}
.comm-detail-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--comm-line);
  background: rgba(6, 21, 37, 0.92);
  backdrop-filter: blur(10px);
}
.comm-detail-toolbar > div {
  display: flex;
  align-items: center;
  gap: 5px;
}
.comm-detail-toolbar > div button,
.comm-icon-action {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--comm-line);
  border-radius: 9px;
  color: var(--text-soft);
  transition: color 0.16s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.comm-detail-toolbar > div button:hover,
.comm-icon-action:hover {
  color: var(--ice-white);
  border-color: rgba(0, 212, 255, 0.26);
  background: rgba(0, 212, 255, 0.06);
}
.comm-detail-toolbar > div button.on { color: var(--comm-gold); }
.comm-detail-toolbar > div button.on svg { fill: currentColor; }
.comm-back-mobile { display: none; }
.comm-detail {
  max-width: 690px;
  margin: 0 auto;
  padding: 24px 26px 34px;
}
.comm-detail-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 13px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 15px;
  color: var(--comm-accent);
  background: rgba(0, 212, 255, 0.07);
}
.comm-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--text-mute);
  font-size: 10.5px;
}
.comm-detail-meta b {
  padding: 3px 7px;
  border: 1px solid rgba(201, 169, 110, 0.22);
  border-radius: 999px;
  color: #e9cc93;
  background: rgba(201, 169, 110, 0.07);
  font-size: 9.5px;
}
.comm-detail h3 {
  margin: 8px 0 0;
  color: var(--ice-white);
  font-size: clamp(18px, 2vw, 23px);
  font-weight: 780;
  line-height: 1.55;
  letter-spacing: -0.025em;
}
.comm-letter-address {
  display: grid;
  gap: 7px;
  margin-top: 15px;
  padding: 12px 14px;
  border: 1px solid var(--comm-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}
.comm-letter-address > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.comm-letter-address span { color: var(--text-mute); font-size: 10.5px; }
.comm-letter-address strong {
  overflow: hidden;
  color: var(--frost);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comm-actor {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 6px 9px;
  border: 1px solid var(--comm-line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 9.5px;
}
.comm-detail-body {
  margin-top: 18px;
  color: var(--frost);
  font-size: 12px;
  line-height: 2;
  white-space: pre-wrap;
}
.comm-timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: 20px;
  padding: 8px 0;
  border-top: 1px solid var(--comm-line);
  border-bottom: 1px solid var(--comm-line);
}
.comm-timeline > div {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  padding: 8px 0;
  color: var(--text-soft);
  font-size: 11px;
}
.comm-timeline i {
  width: 7px;
  height: 7px;
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--comm-accent);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.45);
}
.comm-detail-attachments {
  margin-top: 20px;
  padding: 13px;
  border: 1px solid var(--comm-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
}
.comm-detail-attachments h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 11px;
}
.comm-detail-attachments > div {
  min-height: 40px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid rgba(168, 213, 232, 0.1);
  border-radius: 9px;
  color: var(--frost);
  background: rgba(255, 255, 255, 0.018);
  font-size: 10.5px;
}
.comm-detail-attachments > div + div { margin-top: 6px; }
.comm-detail-attachments > div svg { color: var(--comm-accent); }
.comm-detail-attachments > div span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comm-detail-attachments > div small {
  color: var(--text-mute);
  font-size: 9.5px;
}
.comm-detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.comm-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--comm-line);
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  transition: transform 0.18s var(--ease), filter 0.18s var(--ease), border-color 0.18s var(--ease);
}
.comm-btn:hover:not(:disabled) { transform: translateY(-1px); }
.comm-btn.primary {
  color: #03202a;
  border-color: rgba(0, 212, 255, 0.36);
  background: linear-gradient(135deg, #4be1f7, #00bbdb);
}
.comm-btn.secondary {
  color: var(--frost);
  background: rgba(255, 255, 255, 0.035);
}
.comm-btn.secondary:hover:not(:disabled) {
  color: var(--ice-white);
  border-color: rgba(0, 212, 255, 0.3);
}
.comm-detail-empty {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 36px;
  text-align: center;
}
.comm-detail-empty strong {
  max-width: 310px;
  color: var(--frost);
  font-size: 12px;
  line-height: 1.7;
}
.comm-detail-empty p {
  max-width: 320px;
  margin: 0;
  color: var(--text-mute);
  font-size: 10px;
  line-height: 1.8;
}

.comm-compose-layer {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 10, 18, 0.72);
  backdrop-filter: blur(8px);
  animation: commFadeIn 0.2s ease-out both;
}
.comm-compose {
  width: min(680px, 100%);
  max-height: calc(100% - 10px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--comm-line-strong);
  border-radius: 18px;
  background: linear-gradient(180deg, #0a2540, #061a2e);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), inset 0 1px rgba(255, 255, 255, 0.05);
  animation: commComposeIn 0.25s var(--ease) both;
}
.comm-compose > header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--comm-line);
  background: rgba(255, 255, 255, 0.025);
}
.comm-compose > header span {
  color: var(--comm-accent);
  font-size: 10.5px;
}
.comm-compose > header h3 {
  margin: 3px 0 0;
  color: var(--ice-white);
  font-size: 16px;
}
.comm-compose-fields {
  min-height: 0;
  display: grid;
  gap: 11px;
  overflow: auto;
  padding: 16px 18px;
}
.comm-compose-fields > label {
  display: grid;
  gap: 6px;
}
.comm-compose-fields > label > span {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
}
.comm-compose-fields input,
.comm-compose-fields textarea {
  width: 100%;
  border: 1px solid var(--comm-line);
  border-radius: 10px;
  color: var(--ice-white);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.comm-compose-fields input {
  min-height: 42px;
  padding: 0 11px;
  font-size: 11px;
}
.comm-compose-fields textarea {
  min-height: 150px;
  resize: vertical;
  padding: 11px;
  font-size: 11px;
  line-height: 1.9;
}
.comm-compose-fields input:focus,
.comm-compose-fields textarea:focus {
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08);
}
.comm-compose-body { position: relative; }
.comm-compose-body > small {
  position: absolute;
  inset-inline-end: 9px;
  bottom: 8px;
  color: var(--text-mute);
  font-size: 10px;
}
.comm-attachment-control { display: grid; }
.comm-attachment-input {
  width: 100%;
  min-height: 42px;
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  justify-content: center;
  gap: 7px !important;
  border: 1px dashed var(--comm-line-strong);
  border-radius: 10px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.018);
  font-size: 11px;
  cursor: pointer;
}
.comm-attachment-input:hover {
  color: var(--ice-white);
  border-color: rgba(0, 212, 255, 0.36);
  background: rgba(0, 212, 255, 0.04);
}
.comm-attachment-file { display: none; }
.comm-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.comm-attachment-list button {
  min-height: 40px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--comm-line);
  border-radius: 8px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
  font-size: 10px;
}
.comm-attachment-list button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comm-form-error {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 91, 110, 0.25);
  border-radius: 9px;
  color: #ffb1ba;
  background: rgba(255, 91, 110, 0.08);
  font-size: 11px;
}
.comm-compose > footer {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-top: 1px solid var(--comm-line);
  background: rgba(4, 17, 30, 0.72);
}
.comm-compose > footer > div {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-mute);
  font-size: 10px;
  line-height: 1.55;
}
.comm-compose > footer > div svg { color: var(--comm-gold); }

.comm-toast {
  position: absolute;
  z-index: 30;
  inset-inline-start: 50%;
  bottom: 18px;
  min-height: 44px;
  max-width: min(560px, calc(100% - 28px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 13px;
  border: 1px solid rgba(91, 224, 164, 0.28);
  border-radius: 12px;
  color: #ddfff0;
  background: rgba(8, 50, 43, 0.97);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
  animation: commToastIn 0.22s ease-out both;
}
html[dir="rtl"] .comm-toast { transform: translateX(50%); }
.comm-toast > span {
  min-width: 0;
  flex: 1;
  font-size: 11px;
}
.comm-toast > button {
  min-height: 40px;
  padding: 0 8px;
  border-radius: 8px;
  color: #b9fbd5;
  font-size: 10.5px;
  font-weight: 700;
}
.comm-toast > button:last-child {
  width: 40px;
  display: grid;
  place-items: center;
  padding: 0;
}
.comm-toast > button:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }

.comm-mobile-trigger {
  width: 44px;
  height: 44px;
  display: none;
}

.comm-mini-anchor {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.comm-mini-anchor > .icon-btn,
.comm-mini-open {
  touch-action: manipulation;
}

.comm-mini-anchor > .icon-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.comm-mini-preview {
  position: absolute;
  z-index: 80;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: min(320px, calc(100vw - 24px));
  overflow: hidden;
  padding: 10px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 16px;
  color: var(--ice-white);
  background:
    radial-gradient(circle at 88% -12%, rgba(0, 212, 255, 0.13), transparent 38%),
    linear-gradient(168deg, rgba(10, 37, 64, 0.98), rgba(5, 22, 38, 0.99));
  box-shadow:
    0 24px 65px -18px rgba(0, 0, 0, 0.78),
    0 0 0 1px rgba(255, 255, 255, 0.025),
    0 0 30px -22px rgba(0, 212, 255, 0.8);
  backdrop-filter: blur(18px);
  transform-origin: top right;
  animation: commMiniEnter 180ms var(--ease) both;
}

.comm-mini-preview::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset-inline: 16px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.75), transparent);
}

.comm-mini-letters {
  border-color: rgba(201, 169, 110, 0.24);
  background:
    radial-gradient(circle at 88% -12%, rgba(201, 169, 110, 0.13), transparent 38%),
    linear-gradient(168deg, rgba(10, 37, 64, 0.98), rgba(5, 22, 38, 0.99));
}

.comm-mini-letters::before {
  background: linear-gradient(90deg, transparent, rgba(201, 169, 110, 0.78), transparent);
}

.comm-mini-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 2px 2px 9px;
}

.comm-mini-head-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 212, 255, 0.22);
  border-radius: 10px;
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.08);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.comm-mini-letters .comm-mini-head-icon {
  border-color: rgba(201, 169, 110, 0.25);
  color: var(--gold);
  background: rgba(201, 169, 110, 0.08);
}

.comm-mini-head-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.comm-mini-head-copy strong {
  overflow: hidden;
  color: #eefcff;
  font-size: 12px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-mini-head-copy small {
  overflow: hidden;
  color: var(--text-mute);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-mini-count {
  min-width: 26px;
  height: 24px;
  display: grid;
  place-items: center;
  padding-inline: 7px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 999px;
  color: #bff7ff;
  background: rgba(0, 212, 255, 0.08);
  font-size: 10px;
  font-weight: 800;
}

.comm-mini-letters .comm-mini-count {
  border-color: rgba(201, 169, 110, 0.22);
  color: #f0d9a5;
  background: rgba(201, 169, 110, 0.08);
}

.comm-mini-demo {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px 7px;
  padding: 0 8px;
  border: 1px solid rgba(168, 213, 232, 0.1);
  border-radius: 999px;
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.025);
  font-size: 9.5px;
}

.comm-mini-demo > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 7px rgba(0, 212, 255, 0.75);
}

.comm-mini-list {
  display: grid;
  gap: 4px;
}

.comm-mini-item {
  min-height: 55px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 7px;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.023);
}

.comm-mini-item.unread {
  border-color: rgba(0, 212, 255, 0.1);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.055), rgba(255, 255, 255, 0.023));
}

.comm-mini-item-mark {
  position: relative;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 212, 255, 0.16);
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.06);
}

.comm-mini-item-mark::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 7px rgba(0, 212, 255, 0.65);
}

.comm-mini-item-mark.kind-danger::before,
.comm-mini-item-mark.kind-deadline::before,
.comm-mini-item-mark.kind-high::before {
  background: var(--danger);
  box-shadow: 0 0 7px rgba(239, 107, 122, 0.65);
}

.comm-mini-item-mark.kind-warn::before,
.comm-mini-item-mark.kind-regulation::before,
.comm-mini-item-mark.kind-financial::before {
  background: var(--gold);
  box-shadow: 0 0 7px rgba(201, 169, 110, 0.65);
}

.comm-mini-item-mark.kind-ok::before,
.comm-mini-item-mark.kind-account::before {
  background: var(--sage);
  box-shadow: 0 0 7px rgba(126, 226, 184, 0.62);
}

.comm-mini-item-mark i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
}

.comm-mini-item-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.comm-mini-item-copy > strong {
  display: -webkit-box;
  overflow: hidden;
  color: #dcecf3;
  font-size: 11.25px;
  font-weight: 680;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.comm-mini-item.unread .comm-mini-item-copy > strong {
  color: #f1fdff;
}

.comm-mini-item-copy > small {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: var(--text-mute);
  font-size: 9.75px;
}

.comm-mini-item-copy > small > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-mini-item-copy time {
  flex: 0 0 auto;
  color: rgba(168, 213, 232, 0.58);
  white-space: nowrap;
}

.comm-mini-unread {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.85);
}

.comm-mini-empty {
  min-height: 74px;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--text-mute);
  font-size: 10.5px;
  text-align: center;
}

.comm-mini-open {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 11px;
  color: #bff7ff;
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.09), rgba(0, 212, 255, 0.035));
  font-size: 10.5px;
  font-weight: 750;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.comm-mini-open:hover {
  border-color: rgba(0, 212, 255, 0.36);
  color: #fff;
  background: rgba(0, 212, 255, 0.12);
}

.comm-mini-open:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.comm-mini-letters .comm-mini-open {
  border-color: rgba(201, 169, 110, 0.21);
  color: #f0d9a5;
  background: linear-gradient(90deg, rgba(201, 169, 110, 0.09), rgba(201, 169, 110, 0.03));
}

@keyframes commMiniEnter {
  from { opacity: 0; transform: translateY(-5px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes commFadeIn {
  from { opacity: 0; }
}
@keyframes commComposeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
}
@keyframes commToastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
}
html[dir="rtl"] .comm-toast {
  animation-name: commToastInRtl;
}
@keyframes commToastInRtl {
  from { opacity: 0; transform: translate(50%, 8px); }
}

@media (max-width: 1040px) {
  .comm-hero {
    grid-template-columns: minmax(230px, 1fr) auto;
    gap: 16px;
  }
  .comm-summary > div { min-width: 84px; }
  .comm-compose-trigger {
    grid-column: 1 / -1;
    justify-self: end;
    min-height: 38px;
  }
  .comm-shell { grid-template-columns: 150px minmax(300px, 0.94fr) minmax(330px, 1.06fr); }
}

@media (max-width: 900px) {
  .modal.communications-modal,
  .modal:has(.comm-hub) {
    width: 96vw;
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
  }
  .comm-hub { min-height: 0; }
  .comm-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 108px;
    padding: 16px 18px;
  }
  .comm-summary { grid-template-columns: repeat(3, 78px); }
  .comm-summary > div {
    min-width: 0;
    min-height: 62px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    place-items: center;
    gap: 3px;
    padding: 7px;
  }
  .comm-summary svg { display: none; }
  .comm-summary strong { font-size: 16px; }
  .comm-summary span { font-size: 10px; }
  .comm-compose-trigger { display: none; }
  .comm-tabs-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
    gap: 10px;
    padding: 9px 12px;
  }
  .comm-tabs > button { padding: 0 10px; }
  .comm-tabs > button span { display: none; }
  .comm-tabs > button svg { width: 18px; height: 18px; }
  .comm-shell {
    grid-template-columns: minmax(300px, 0.92fr) minmax(330px, 1.08fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .comm-rail {
    grid-column: 1 / -1;
    display: block;
    padding: 8px 12px;
    border-inline-end: 0;
    border-bottom: 1px solid var(--comm-line);
    overflow-x: auto;
  }
  .comm-rail-head,
  .comm-rail-note,
  .comm-storage-warning { display: none; }
  .comm-rail nav {
    min-width: max-content;
    flex-direction: row;
    gap: 5px;
  }
  .comm-rail nav button {
    min-height: 36px;
    padding: 0 11px;
  }
  .comm-list-pane { grid-column: 1; grid-row: 2; }
  .comm-detail-pane { grid-column: 2; grid-row: 2; }

  /* The base mobile rules hide every top-bar icon. Keep one compact hub trigger. */
  .top-actions .account-pill,
  .top-actions .comm-desktop-trigger { display: none !important; }
  .top-actions .comm-mobile-trigger { display: grid !important; }
}

@media (max-width: 680px) {
  .modal.communications-modal .modal-head .rh button:not(.close),
  .modal:has(.comm-hub) .modal-head .rh button:not(.close) { display: none; }
  .comm-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 94px;
    padding: 13px 14px;
  }
  .comm-hero-copy h2 { font-size: 17px; }
  .comm-hero-copy p { display: none; }
  .comm-hero-copy > span { font-size: 10px; }
  .comm-summary {
    grid-template-columns: repeat(2, 55px);
    gap: 5px;
  }
  .comm-summary > div {
    min-height: 52px;
    padding: 5px;
    border-radius: 11px;
  }
  .comm-summary > div:nth-child(2) { display: none; }
  .comm-summary strong { font-size: 14px; }
  .comm-summary span {
    max-width: 52px;
    overflow: hidden;
    font-size: 9.5px;
    text-overflow: ellipsis;
  }
  .comm-tabs-toolbar {
    grid-template-columns: 1fr;
    gap: 7px;
    min-height: 100px;
  }
  .comm-tabs { justify-content: stretch; }
  .comm-tabs > button {
    min-width: 0;
    flex: 1;
    justify-content: center;
  }
  .comm-tabs > button span {
    display: inline;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .comm-search { min-height: 38px; }
  .comm-shell {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .comm-rail { grid-column: 1; grid-row: 1; }
  .comm-list-pane,
  .comm-detail-pane {
    grid-column: 1;
    grid-row: 2;
    border-inline-end: 0;
  }
  .comm-list-pane.is-hidden-mobile { display: none; }
  .comm-detail-pane:not(.has-selection) { display: none; }
  .comm-detail-toolbar {
    justify-content: space-between;
    padding: 7px 10px;
  }
  .comm-back-mobile {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 7px;
    color: var(--text-soft);
    font-size: 10.5px;
  }
  .comm-detail { padding: 18px 16px 28px; }
  .comm-detail h3 { font-size: 18px; }
  .comm-detail-body { font-size: 11.5px; }
  .comm-row { grid-template-columns: 40px minmax(0, 1fr) 42px; }
  .comm-row-main { padding: 10px 2px; }
  .comm-list-head { min-height: 46px; }
  .comm-compose-layer { padding: 8px; }
  .comm-compose {
    max-height: 100%;
    border-radius: 14px;
  }
  .comm-compose > header { min-height: 62px; padding: 10px 12px; }
  .comm-compose-fields { padding: 12px; }
  .comm-compose-fields textarea { min-height: 120px; }
  .comm-compose > footer {
    grid-template-columns: 1fr 1fr;
    padding: 9px 12px;
  }
  .comm-compose > footer > div { grid-column: 1 / -1; }
  .comm-compose > footer .comm-btn { width: 100%; }
}

@media (max-width: 420px) {
  .comm-hero-copy h2 { font-size: 15px; }
  .comm-summary { grid-template-columns: repeat(2, 48px); }
  .comm-tabs > button { padding: 0 6px; }
  .comm-tabs > button span { font-size: 9.5px; }
  .comm-row-icon { width: 32px; height: 32px; }
  .comm-row-main { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 7px; }
  .comm-row-copy strong { font-size: 11.5px; }
  .comm-row-copy small { font-size: 10px; }
}

@media (hover: none), (pointer: coarse) {
  .comm-mini-preview { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .comm-hub *,
  .comm-compose-layer,
  .comm-compose,
  .comm-toast,
  .comm-mini-preview {
    scroll-behavior: auto !important;
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
