:root {
  color-scheme: dark;
  --bg: #06121a;
  --bg-elevated: #0b1822;
  --bg-soft: #0e1f2c;
  --panel: rgba(8, 23, 33, 0.92);
  --line: rgba(104, 201, 255, 0.18);
  --line-strong: rgba(104, 201, 255, 0.32);
  --text: #eef9ff;
  --muted: #9fbcca;
  --accent: #52d7ff;
  --accent-strong: #09bfff;
  --warning: #ffbb55;
  --success: #73f0ad;
  --danger: #ff7f93;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(32, 110, 156, 0.2), transparent 32%),
    linear-gradient(180deg, #081722 0%, var(--bg) 48%, #07151f 100%);
  color: var(--text);
}

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

a,
button,
input,
select,
textarea {
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 3px rgba(82, 215, 255, 0.2);
}

.dashboard-header,
.toolbar,
.dashboard-grid,
.rental-tickets-panel,
.data-tools-panel,
.dashboard-footer {
  width: min(1360px, calc(100% - 48px));
  margin: 0 auto;
}

.module-switcher {
  width: min(1360px, calc(100% - 48px));
  margin: 0 auto 16px;
  display: inline-flex;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 23, 33, 0.82);
  box-shadow: var(--shadow);
}

.module-tab {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.module-tab:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.module-tab.active {
  background: linear-gradient(135deg, rgba(82, 215, 255, 0.18) 0%, rgba(9, 191, 255, 0.16) 100%);
  border-color: rgba(82, 215, 255, 0.22);
  color: var(--text);
}

.dashboard-view[hidden] {
  display: none !important;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 18px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, #a4edff 100%);
  box-shadow: 0 0 0 8px rgba(82, 215, 255, 0.08);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-header h1,
.panel-heading h2,
.modal-head h2 {
  margin: 0;
  font-size: 1.8rem;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.ghost-link,
.ghost-button,
.primary-button,
.upload-label {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  background: rgba(9, 25, 36, 0.66);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.ghost-link:hover,
.ghost-button:hover,
.primary-button:hover,
.upload-label:hover {
  transform: translateY(-1px);
}

.primary-button {
  border: none;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #02131c;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(9, 191, 255, 0.18);
}

.ghost-button.small {
  min-height: 36px;
  padding: 0 12px;
}

.primary-button.small {
  min-height: 36px;
  padding: 0 12px;
}

.ghost-button.danger {
  border-color: rgba(220, 60, 80, 0.55);
  background: rgba(160, 28, 48, 0.35);
  color: #ffd0d6;
}

.ghost-button.danger:hover:not(:disabled) {
  border-color: rgba(255, 90, 110, 0.8);
  background: rgba(190, 35, 55, 0.5);
  color: #fff;
}

.toolbar {
  display: grid;
  grid-template-columns: 1.6fr repeat(2, minmax(180px, 0.6fr)) minmax(140px, 0.4fr) 0.8fr;
  gap: 16px;
  padding: 10px 0 24px;
}

.toolbar-group {
  display: grid;
  gap: 8px;
}

.archive-toggle {
  align-items: end;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.archive-toggle input {
  accent-color: var(--accent);
}

.toolbar-label,
.field-label,
.detail-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.text-input,
.select-input,
.notes-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 17, 24, 0.8);
  color: var(--text);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.text-input,
.select-input {
  min-height: 46px;
  padding: 0 14px;
}

.compact-input {
  min-height: 38px;
  margin-top: 10px;
}

.notes-input {
  min-height: 150px;
  padding: 14px;
  resize: vertical;
  line-height: 1.6;
}

.text-input:hover,
.select-input:hover,
.notes-input:hover,
.text-input:focus,
.select-input:focus,
.notes-input:focus {
  border-color: var(--line-strong);
  background: rgba(8, 21, 31, 0.95);
}

.toolbar-stats {
  align-content: end;
  color: var(--muted);
  font-size: 0.95rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.45fr);
  gap: 18px;
  padding-bottom: 36px;
}

.dashboard-footer {
  padding: 0 0 30px;
  color: var(--muted);
  font-size: 0.92rem;
}

.dashboard-footer p {
  margin: 0;
  text-align: right;
}

.tickets-panel,
.details-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tickets-panel {
  min-height: 760px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 0;
}

.count-pill {
  min-width: 36px;
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(82, 215, 255, 0.1);
  border: 1px solid rgba(82, 215, 255, 0.14);
  color: var(--text);
  font-weight: 700;
}

.ticket-list {
  padding: 18px;
  display: grid;
  gap: 12px;
  overflow: auto;
  align-content: start;
}

.ticket-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 22, 31, 0.82);
  padding: 16px;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.ticket-item:hover {
  transform: translateY(-1px);
  border-color: rgba(82, 215, 255, 0.28);
  background: rgba(11, 24, 34, 0.98);
}

.ticket-item.active {
  border-color: rgba(82, 215, 255, 0.44);
  box-shadow: inset 0 0 0 1px rgba(82, 215, 255, 0.18);
}

.ticket-item.archived {
  opacity: 0.62;
}

.ticket-item-top,
.product-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ticket-item-top {
  align-items: flex-start;
}

.ticket-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.ticket-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.ticket-product,
.ticket-preview,
.message-subtext {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.ticket-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ticket-date {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-badge {
  min-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.status-open {
  background: rgba(82, 215, 255, 0.12);
  color: #b9efff;
}

.status-in-progress {
  background: rgba(255, 187, 85, 0.12);
  color: #ffdca4;
}

.status-waiting {
  background: rgba(255, 187, 85, 0.12);
  color: #ffdca4;
}

.status-resolved {
  background: rgba(115, 240, 173, 0.12);
  color: #c7ffe0;
}

.status-available {
  background: linear-gradient(180deg, rgba(21, 144, 99, 0.42), rgba(15, 112, 76, 0.42));
  border-color: rgba(76, 231, 157, 0.28);
  color: #d9ffeb;
}

.status-rented {
  background: linear-gradient(180deg, rgba(11, 153, 255, 0.35), rgba(8, 110, 201, 0.35));
  border-color: rgba(82, 215, 255, 0.24);
  color: #d6f7ff;
}

.status-expiring-soon {
  background: linear-gradient(180deg, rgba(175, 111, 12, 0.42), rgba(135, 83, 8, 0.42));
  border-color: rgba(255, 187, 85, 0.24);
  color: #ffe2ae;
}

.status-expired {
  background: linear-gradient(180deg, rgba(150, 26, 48, 0.44), rgba(111, 19, 37, 0.44));
  border-color: rgba(255, 127, 147, 0.24);
  color: #ffd8df;
}

.sync-pill {
  min-height: 24px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sync-live {
  background: rgba(115, 240, 173, 0.12);
  border-color: rgba(115, 240, 173, 0.28);
  color: #c7ffe0;
}

.sync-stale {
  background: rgba(255, 187, 85, 0.12);
  border-color: rgba(255, 187, 85, 0.28);
  color: #ffe0a6;
}

.sync-offline {
  background: rgba(255, 127, 147, 0.12);
  border-color: rgba(255, 127, 147, 0.28);
  color: #ffd5dc;
}

.priority-badge {
  min-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.priority-low {
  background: rgba(159, 188, 202, 0.12);
  border-color: rgba(159, 188, 202, 0.22);
  color: #d8eaf2;
}

.priority-normal {
  background: rgba(82, 215, 255, 0.12);
  border-color: rgba(82, 215, 255, 0.24);
  color: #c6f4ff;
}

.priority-urgent {
  background: rgba(255, 127, 147, 0.13);
  border-color: rgba(255, 127, 147, 0.3);
  color: #ffd5dc;
}

.details-panel {
  padding: 0 22px 22px;
}

.details-heading {
  padding-left: 0;
  padding-right: 0;
}

.detail-status-wrap {
  display: grid;
  gap: 8px;
  min-width: 160px;
}

.empty-state {
  min-height: 520px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state[hidden],
.ticket-detail[hidden] {
  display: none !important;
}

.empty-state h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 1.2rem;
}

.ticket-detail {
  padding-top: 22px;
  display: grid;
  gap: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-card,
.message-card,
.notes-card,
.tenant-profile-card,
.payment-history-card,
.activity-card,
.ai-suggestion-card,
.customer-profile-card,
.knowledge-suggest-card,
.product-intel-card,
.conversation-memory-card,
.ai-agent-diagnosis-card,
.ai-agent-actions-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 20, 28, 0.74);
}

.customer-profile-card {
  padding: 16px;
}

.product-intel-card {
  padding: 16px;
}

.conversation-memory-card {
  padding: 16px;
}

.ai-agent-diagnosis-card,
.ai-agent-actions-card {
  padding: 16px;
}

.ai-agent-diagnosis-card[hidden],
.ai-agent-actions-card[hidden] {
  display: none !important;
}

.ai-agent-action-buttons {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.conversation-memory-card[hidden] {
  display: none !important;
}

.conversation-memory-block {
  margin-top: 12px;
}

.conversation-memory-block .health-summary {
  margin-top: 6px;
}

.product-intel-card[hidden] {
  display: none !important;
}

.product-version-banner {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 168, 76, 0.45);
  background: rgba(255, 168, 76, 0.12);
  color: #ffd7a6;
  font-weight: 700;
}

.product-version-banner[hidden],
#productVersionSuggestion[hidden] {
  display: none !important;
}

.product-intel-grid {
  margin-top: 12px;
}

.product-intel-card .ai-suggestion-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.product-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.product-status-pill.active {
  color: var(--success);
  border-color: rgba(115, 240, 173, 0.35);
  background: rgba(115, 240, 173, 0.1);
}

.product-status-pill.beta {
  color: var(--warning);
  border-color: rgba(255, 187, 85, 0.35);
  background: rgba(255, 187, 85, 0.1);
}

.product-status-pill.deprecated {
  color: var(--danger);
  border-color: rgba(255, 127, 147, 0.35);
  background: rgba(255, 127, 147, 0.1);
}

.customer-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 12px;
}

.customer-stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 23, 33, 0.55);
  padding: 12px 12px 10px;
}

.customer-stat .detail-value {
  margin: 6px 0 0;
  font-size: 0.98rem;
}

.customer-profile-lists {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.customer-chip-row {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
}

.customer-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 6px 6px 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(82, 215, 255, 0.08);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
}

.customer-recent-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.customer-recent-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(6, 18, 26, 0.45);
}

.customer-recent-item .ticket-id {
  font-weight: 700;
  color: var(--accent);
}

.customer-recent-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.customer-recent-status {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .customer-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .customer-profile-grid,
  .customer-recent-item {
    grid-template-columns: 1fr;
  }
}

.ai-suggestion-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.ai-suggestion-card[hidden] {
  display: none !important;
}

.knowledge-suggest-card {
  border-color: rgba(115, 240, 173, 0.28);
  background: linear-gradient(180deg, rgba(18, 42, 36, 0.55), rgba(8, 23, 33, 0.92));
}

.knowledge-suggest-card[hidden] {
  display: none !important;
}

.knowledge-suggest-form {
  display: grid;
  gap: 12px;
  margin: 12px 0 14px;
}

.knowledge-suggest-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.knowledge-suggest-form .field-block {
  display: grid;
  gap: 6px;
}

.knowledge-suggest-form .text-input:read-only,
.knowledge-suggest-form .notes-input:read-only,
.knowledge-suggest-form .select-input:disabled {
  opacity: 0.92;
}

@media (max-width: 900px) {
  .knowledge-suggest-row {
    grid-template-columns: 1fr;
  }
}

.ai-suggestion-text {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-suggestion-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ai-suggestion-detail {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
  word-break: break-word;
}

.ai-confidence-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ai-confidence-pill.confidence-high {
  color: #73f0ad;
  border-color: rgba(115, 240, 173, 0.35);
  background: rgba(115, 240, 173, 0.1);
}

.ai-confidence-pill.confidence-medium {
  color: #ffbb55;
  border-color: rgba(255, 187, 85, 0.35);
  background: rgba(255, 187, 85, 0.1);
}

.ai-confidence-pill.confidence-low {
  color: #ff7f93;
  border-color: rgba(255, 127, 147, 0.35);
  background: rgba(255, 127, 147, 0.1);
}

.ai-stats-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 8px;
}

.ai-stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 20, 28, 0.74);
  padding: 14px 16px;
}

.ai-stat-value {
  margin: 8px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.ai-suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-suggestion-block {
  display: grid;
  gap: 6px;
}

@media (max-width: 900px) {
  .ai-stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.detail-card {
  padding: 16px;
}

.detail-value {
  margin: 10px 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.detail-subvalue {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.detail-subvalue.prim-ok {
  color: #c7ffe0;
}

.detail-subvalue.prim-warning {
  color: #ffdca4;
}

.detail-subvalue.prim-over-limit {
  color: #ffb4aa;
}

.detail-mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88rem;
  word-break: break-word;
}

.message-card,
.notes-card,
.tenant-profile-card,
.payment-history-card,
.activity-card {
  padding: 18px;
}

.tenant-profile {
  display: grid;
  gap: 14px;
}

.tenant-profile-empty,
.tenant-profile-muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.tenant-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tenant-profile-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(104, 201, 255, 0.12);
  border-radius: 8px;
  background: rgba(6, 17, 24, 0.46);
}

.tenant-profile-list {
  display: grid;
  gap: 8px;
}

.tenant-profile-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.65fr) minmax(92px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(104, 201, 255, 0.1);
  border-radius: 8px;
  background: rgba(6, 17, 24, 0.38);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.tenant-profile-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.payment-history-list {
  display: grid;
  gap: 10px;
}

.payment-history-entry {
  display: grid;
  grid-template-columns: minmax(130px, 0.55fr) minmax(150px, 0.75fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(104, 201, 255, 0.12);
  border-radius: 8px;
  background: rgba(6, 17, 24, 0.46);
}

.payment-history-amount {
  margin: 0;
  color: #c7ffe0;
  font-size: 1rem;
  font-weight: 800;
}

.activity-list {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
}

.activity-entry {
  display: grid;
  grid-template-columns: minmax(112px, 0.55fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(104, 201, 255, 0.12);
  border-radius: 8px;
  background: rgba(6, 17, 24, 0.54);
}

.activity-time {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.activity-main {
  min-width: 0;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.activity-type,
.activity-actor {
  min-height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(82, 215, 255, 0.18);
  background: rgba(82, 215, 255, 0.09);
  color: #c6f4ff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.activity-actor {
  border-color: rgba(159, 188, 202, 0.18);
  background: rgba(159, 188, 202, 0.08);
  color: #d8eaf2;
}

.activity-message {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.notes-input::placeholder,
.text-input::placeholder {
  color: rgba(159, 188, 202, 0.72);
}

.message-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.message-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.message-body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.72;
  color: var(--text);
}

.ticket-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(52vh, 520px);
  overflow-y: auto;
  padding: 4px 2px 8px;
  scroll-behavior: smooth;
}

.timeline-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline-item {
  display: grid;
  gap: 6px;
  max-width: 88%;
}

.timeline-item.timeline-customer {
  align-self: flex-start;
}

.timeline-item.timeline-support {
  align-self: flex-end;
  text-align: right;
}

.timeline-item.timeline-system {
  align-self: center;
  max-width: 94%;
  text-align: center;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.timeline-support .timeline-meta {
  justify-content: flex-end;
}

.timeline-system .timeline-meta {
  justify-content: center;
}

.timeline-type {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(104, 201, 255, 0.18);
  background: rgba(8, 23, 33, 0.7);
}

.timeline-customer .timeline-type {
  color: #9fd8ff;
  border-color: rgba(82, 170, 255, 0.35);
}

.timeline-support .timeline-type {
  color: #9ef0c2;
  border-color: rgba(115, 240, 173, 0.35);
}

.timeline-system .timeline-type {
  color: #c5d0d8;
  border-color: rgba(160, 176, 188, 0.35);
}

.timeline-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  line-height: 1.55;
}

.timeline-customer .timeline-bubble {
  background: rgba(40, 120, 190, 0.28);
  border-color: rgba(90, 170, 255, 0.35);
  border-bottom-left-radius: 6px;
  text-align: left;
}

.timeline-support .timeline-bubble {
  background: rgba(35, 140, 95, 0.28);
  border-color: rgba(115, 240, 173, 0.35);
  border-bottom-right-radius: 6px;
  text-align: left;
}

.timeline-system .timeline-bubble {
  background: rgba(70, 82, 92, 0.35);
  border-color: rgba(150, 164, 176, 0.28);
  border-radius: 12px;
  text-align: left;
}

.timeline-text {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
}

.timeline-source {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.reply-preview-wrap {
  margin-top: 14px;
}

.reply-command-preview {
  margin: 10px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 17, 24, 0.8);
  color: #c6f4ff;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rental-tickets-panel,
.data-tools-panel {
  margin-bottom: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.data-tools-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  padding: 18px;
}

.data-tool-card {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 20, 28, 0.74);
}

.data-tool-actions,
.cleanup-controls {
  display: grid;
  gap: 10px;
}

.data-tool-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cleanup-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.rental-ticket-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.rental-ticket-header,
.rental-ticket-item {
  display: grid;
  grid-template-columns: minmax(120px, 0.65fr) minmax(150px, 0.75fr) minmax(88px, 0.45fr) minmax(220px, 1.4fr) minmax(170px, 0.9fr) minmax(170px, 0.9fr) minmax(140px, 0.75fr);
  gap: 14px;
}

.rental-ticket-header {
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rental-ticket-item {
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 22, 31, 0.82);
}

.ticket-status-select {
  min-height: 38px;
  padding: 0 10px;
}

.rental-ticket-status-cell {
  min-width: 0;
}

.empty-state.compact {
  min-height: 180px;
}

.action-feedback {
  min-height: 22px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.action-feedback:empty {
  display: none;
}

.action-feedback[data-tone="success"] {
  color: #c7ffe0;
}

.action-feedback[data-tone="error"] {
  color: #ffd5dc;
}

.ghost-button:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.ticket-modal {
  width: min(760px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: rgba(7, 18, 26, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
}

.ticket-modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.ticket-form {
  padding: 24px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.full-width {
  margin-top: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 1120px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-stats {
    grid-column: 1 / -1;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .tickets-panel {
    min-height: 420px;
  }

  .rental-ticket-header,
  .rental-ticket-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .rental-ticket-header {
    display: none;
  }
}

@media (max-width: 760px) {
  .dashboard-header,
  .toolbar,
  .dashboard-grid,
  .rental-tickets-panel,
  .data-tools-panel,
  .dashboard-footer {
    width: min(100% - 28px, 1360px);
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .module-switcher {
    width: min(100% - 28px, 1360px);
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .toolbar,
  .form-grid,
  .detail-grid,
  .tenant-profile-grid,
  .tenant-profile-row,
  .payment-history-entry,
  .activity-entry,
  .rental-ticket-item,
  .data-tools-grid,
  .data-tool-actions,
  .cleanup-row {
    grid-template-columns: 1fr;
  }

  .dashboard-footer p {
    text-align: left;
  }

  .message-header,
  .panel-heading,
  .details-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-status-wrap {
    min-width: 0;
    width: 100%;
  }

  .ghost-link,
  .ghost-button,
  .primary-button,
  .upload-label {
    width: 100%;
  }

  .ticket-form {
    padding: 18px;
  }
}
