:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #fbfdfd;
  --surface: #ffffff;
  --surface-soft: #f7fafb;
  --surface-muted: #edf3f5;
  --ink: #13232c;
  --muted: #657783;
  --line: #dce7ec;
  --line-strong: #c9d8df;
  --accent: #0d856b;
  --accent-2: #28628a;
  --accent-soft: #e7f7f2;
  --accent-line: #b8ded3;
  --warn: #b7791f;
  --danger: #b42318;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(19, 35, 44, 0.05);
  --shadow-md: 0 10px 28px rgba(19, 35, 44, 0.09);
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-color: #bfd0d8 transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
  accent-color: var(--accent);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #bfd0d8;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #aebfc8;
  background-clip: padding-box;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:hover {
  border-color: var(--accent);
  background: #f9fcfc;
  box-shadow: 0 3px 10px rgba(19, 35, 44, 0.08);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(13, 133, 107, 0.16);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 133, 107, 0.1);
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.hidden {
  display: none !important;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--bg);
}

.login-box,
.modal-box,
.form-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.login-box {
  width: min(390px, 100%);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  width: 158px;
  max-width: 70%;
  height: auto;
  justify-self: center;
  margin-bottom: 4px;
}

[data-brand="lume"] .login-logo {
  width: 210px;
  max-width: 82%;
}

.login-box h1,
.section-header h1,
.chat-header h1,
.form-panel h2 {
  margin: 0;
}

.login-box p,
.section-header p,
.chat-header p,
.helper-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.login-box button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#loginError {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 253, 253, 0.96);
  box-shadow: 0 1px 8px rgba(19, 35, 44, 0.04);
}

.brand {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  min-width: 0;
}

[data-brand="lume"] .brand {
  grid-template-columns: 100px minmax(0, 1fr);
}

.brand-logo {
  width: 74px;
  height: auto;
  grid-row: span 2;
}

[data-brand="lume"] .brand-logo {
  width: 100px;
}

.brand strong,
.brand span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar span,
.conversation small,
.ticket-row span,
.user-row span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.tab {
  white-space: nowrap;
}

.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.settings-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.settings-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.settings-page {
  display: none;
}

.settings-page.active {
  display: block;
}

.top-actions,
.actions,
.side-panel header,
.section-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.operator-name {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: var(--surface-soft);
  color: var(--muted);
}

.version-badge {
  display: inline-block;
  align-self: center;
  color: #8a98a1;
  font-size: 11px;
}

.tab-page {
  display: none;
  min-height: 0;
}

.tab-page.active {
  display: grid;
}

#attendanceTab {
  grid-template-columns: 320px minmax(420px, 1fr) 300px;
  height: calc(100vh - 65px);
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 1280px) {
  #attendanceTab {
    grid-template-columns: 280px minmax(0, 1fr) 260px;
  }
}

.sidebar,
.side-panel {
  background: var(--panel);
  min-width: 0;
}

.sidebar {
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 12px;
  background: #f8fbfc;
}

.side-panel {
  border-left: 1px solid var(--line);
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fbfc;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.stats div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 7px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stats strong {
  display: block;
  font-size: 22px;
  line-height: 1.05;
}

.stats span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wide-button {
  width: 100%;
}

.conversation-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.conversation {
  text-align: left;
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface);
}

.conversation:hover,
.ticket-row:hover,
.user-row:hover,
.unit-row:hover,
.contact-row:hover {
  border-color: var(--line-strong);
}

.conversation.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 5px 16px rgba(13, 133, 107, 0.1);
}

.conversation .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #e7eef3;
  color: #24445a;
}

.badge.waiting {
  background: #fff3cd;
  color: var(--warn);
}

.badge.ticket_open {
  background: #e8f3fb;
  color: var(--accent-2);
}

.badge.closed {
  background: #f0f2f3;
  color: var(--muted);
}

.chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #eef4f6;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 8px rgba(19, 35, 44, 0.04);
}

.chat-header > div {
  min-width: min(280px, 100%);
  flex: 1;
}

.messages {
  min-height: 0;
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #eef4f6;
}

.empty {
  color: var(--muted);
  text-align: center;
  margin-top: 15vh;
}

.empty.compact {
  margin: 16px 0;
}

.message {
  max-width: 74%;
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.message.out {
  margin-left: auto;
  background: #e6f6f1;
  border-color: var(--accent-line);
}

.message.system {
  max-width: 100%;
  background: var(--surface-soft);
  color: var(--muted);
  box-shadow: none;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.message-header strong,
.message strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-header time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.message p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.35;
}

.audio-message {
  display: grid;
  gap: 6px;
  min-width: min(280px, 100%);
  margin-top: 6px;
}

.audio-message audio {
  width: 100%;
  max-width: 360px;
}

.audio-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.audio-message a,
.transcription strong {
  color: var(--accent-2);
  font-size: 12px;
}

.image-message img {
  width: min(340px, 100%);
  max-height: 280px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.document-message {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.document-message a {
  color: var(--accent-2);
}

.transcription {
  display: grid;
  gap: 3px;
  border-left: 3px solid var(--accent-2);
  padding-left: 8px;
}

.transcription p {
  color: var(--ink);
}

.transcription.muted,
.muted {
  color: var(--muted);
}

.history-message {
  display: grid;
  gap: 4px;
  margin: 8px 0;
}

.history-message .message-header {
  margin-bottom: 0;
}

.composer {
  display: grid;
  grid-template-columns: 190px minmax(180px, 1fr) minmax(160px, 220px) minmax(160px, 220px) auto auto;
  gap: 8px;
  padding: 14px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 8px rgba(19, 35, 44, 0.04);
}

.details-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.details-box strong {
  color: var(--ink);
  font-size: 15px;
}

.workspace {
  padding: 18px;
  gap: 14px;
  align-content: start;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.details-box hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
}

.previous-ticket {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.previous-ticket small {
  color: var(--muted);
}

#integrationStatusBox {
  display: grid;
  gap: 6px;
}

.integration-status {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
  text-decoration: none;
}

.integration-status.online {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.integration-status.offline,
.integration-status.warning {
  border-color: #f0c5c0;
  background: #fff5f4;
}

.integration-status.disabled,
.integration-status.missing_url {
  color: var(--muted);
}

.unit-mini-summary {
  display: grid;
  gap: 6px;
}

.mini-summary-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  align-items: start;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
}

.mini-summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.mini-summary-item strong {
  min-width: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.mini-summary-item.online {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.mini-summary-item.warning,
.mini-summary-item.offline {
  border-color: #f0c5c0;
  background: #fff5f4;
}

.mini-summary-item.disabled,
.mini-summary-item.loading {
  color: var(--muted);
}

.mini-summary-link {
  display: inline-flex;
  justify-content: center;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent-2);
  text-decoration: none;
}

.mini-summary-link:hover {
  border-color: var(--accent);
}

.report-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.ticket-table,
.user-list,
.unit-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.ticket-row,
.user-row,
.unit-row,
.activity-row {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 0.8fr;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.unit-row {
  grid-template-columns: 1.2fr 1fr 1.4fr auto;
}

.unit-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.activity-row {
  grid-template-columns: 1fr;
}

.activity-row header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.activity-row.done {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.activity-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.checklist {
  display: grid;
  gap: 7px;
}

.check-row small {
  color: var(--muted);
  font-size: 12px;
}

.unit-workspace {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.group-workspace {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.group-history-panel {
  min-height: 360px;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.panel-header h2 {
  margin: 0;
}

.group-history-messages {
  max-height: 520px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #eef4f6;
}

.unit-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
}

.unit-photo-gallery a {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.unit-photo-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.unit-photo-gallery.large {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

.unit-detail-panel {
  min-height: 420px;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.unit-detail-body {
  display: grid;
  gap: 12px;
}

.detail-grid,
.integration-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.detail-item,
.integration-card,
.problem-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px;
  background: var(--surface-soft);
}

.detail-item span,
.integration-card span,
.problem-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-item strong,
.integration-card strong,
.problem-row strong {
  display: block;
  margin-top: 4px;
}

.integration-card.online {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.integration-card.offline,
.integration-card.warning {
  border-color: #f0c9a0;
  background: #fff8ef;
}

.integration-card.disabled,
.integration-card.missing_url {
  color: var(--muted);
}

.integration-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.monitor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.button-link:hover {
  border-color: var(--accent);
}

.zabbix-problems h3,
.detail-note strong {
  margin: 0 0 8px;
  display: block;
}

.problem-row.severity-4,
.problem-row.severity-5 {
  border-color: #f0b8b2;
  background: #fff5f4;
}

.inline-button {
  margin-top: 8px;
  padding: 6px 9px;
  font-size: 12px;
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.danger-button {
  border-color: #f0b8b2;
  background: #fff5f4;
  color: var(--danger);
}

.danger-button:hover {
  border-color: var(--danger);
}

.ticket-row details {
  grid-column: 1 / -1;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.ticket-row summary {
  cursor: pointer;
  font-weight: 700;
}

.ticket-panel-body {
  max-height: min(56vh, 520px);
  overflow: auto;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.ticket-audit-body {
  max-height: 260px;
}

.ticket-row p {
  margin: 8px 0 0;
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.report-cards article,
.grafana-panel {
  border: 1px solid #26343d;
  border-radius: var(--radius-lg);
  background: #101820;
  color: #edf5f7;
  box-shadow: 0 8px 24px rgba(16, 24, 32, 0.12);
}

.report-cards article {
  padding: 16px;
}

.report-cards strong {
  display: block;
  font-size: 30px;
}

.report-cards span {
  color: #9eb0b8;
  font-size: 13px;
}

.grafana-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grafana-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  min-height: 260px;
}

.grafana-panel h2 {
  margin: 0;
  font-size: 16px;
  color: #f2c94c;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 36px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #25343e;
}

.bar-track div {
  height: 100%;
  border-radius: inherit;
  background: #31ad83;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #27323a;
  padding: 8px 0;
  color: #dbe7eb;
}

.metric-row span {
  min-width: 0;
  color: #9eb0b8;
}

.metric-row small {
  display: block;
  margin-top: 2px;
  color: #6f828b;
}

.metric-row strong {
  color: #f2c94c;
  white-space: nowrap;
}

.integration-flags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.integration-flags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.integration-flags span.on {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.admin-layout,
.whatsapp-layout,
.email-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.form-panel {
  padding: 16px;
}

.form-panel h3 {
  margin: 6px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.form-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.permission-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.contacts-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.contact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
  background: var(--surface-soft);
}

.contact-row span {
  min-width: 0;
}

.contact-row strong,
.contact-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-row small {
  color: var(--muted);
}

.zapi-status {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.qr-box {
  min-height: 260px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.qr-box img {
  width: min(260px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  align-items: start;
  justify-items: center;
  overflow: auto;
  padding: 18px;
  background: rgba(19, 35, 44, 0.38);
}

.modal-box {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
}

.modal-box h2 {
  margin: 0;
}

.modal-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form-status.error {
  color: var(--danger);
}

.form-status.success {
  color: var(--accent);
}

@media (max-width: 1100px) {
  .topbar,
  #attendanceTab,
  .admin-layout,
  .whatsapp-layout,
  .email-layout,
  .filters,
  .detail-grid,
  .integration-cards,
  .report-filters {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .side-panel {
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .chat {
    height: 70vh;
    min-height: 520px;
  }

  #attendanceTab {
    height: auto;
    overflow: visible;
  }

  .actions,
  .composer,
  .ticket-row,
  .user-row,
  .unit-row,
  .activity-row,
  .report-cards,
  .grafana-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px) and (min-width: 1101px) {
  .composer {
    grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto auto;
  }

  .composer #attachmentInput,
  .composer #attachmentCaption {
    grid-column: span 2;
  }
}
