:root {
  --primary: #0056b3;
  --secondary: #0f172a;
  --accent: #00d2ff;
  --light: #f8fafc;
  --text-main: #334155;
  --line: #dbe6f3;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

body.app-page {
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 10% 10%, rgba(0, 86, 179, 0.08), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(0, 210, 255, 0.08), transparent 30%),
    var(--light);
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
.brand-title {
  font-family: 'Manrope', sans-serif;
  color: var(--secondary);
  font-weight: 800;
}

.app-navbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

.app-navbar .navbar-brand {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  color: var(--secondary);
}

.app-navbar .navbar-brand span {
  color: var(--primary);
}

.app-navbar .nav-link {
  color: var(--secondary) !important;
  font-weight: 600;
}

.app-navbar .nav-link:hover {
  color: var(--primary) !important;
}

.app-navbar .dropdown-menu {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.app-navbar .dropdown-item {
  font-weight: 600;
  color: var(--secondary);
}

.app-navbar .dropdown-item:hover {
  background: #eef5fb;
  color: var(--primary);
}

.app-navbar .navbar-toggler {
  border-color: rgba(0, 86, 179, 0.35);
}

.app-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(15, 23, 42, 0.85)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

.app-shell {
  padding: 92px 0 40px;
}

.app-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}

.app-card.compact-card {
  padding: 1.1rem !important;
}

.app-title {
  color: var(--secondary);
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
}

.app-title.compact-title {
  font-size: 1.15rem;
  margin-bottom: 0;
}

.panel-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.toolbar-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  margin-bottom: 1rem;
}

.filter-tabs {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #4b6075;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.filter-tab.active,
.filter-tab:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.search-form {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-form .brand-input {
  min-width: 240px;
}

.mini-stat {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.mini-stat-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.mini-stat-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
  border-color: rgba(0, 86, 179, 0.3);
  color: inherit;
}

.mini-stat-link-active {
  border-color: rgba(0, 86, 179, 0.35);
  background: linear-gradient(180deg, #f8fbff, #eff6ff);
  box-shadow: 0 14px 28px rgba(0, 86, 179, 0.09);
}

.mini-stat-label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.mini-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--secondary);
}

.mini-stat-highlight {
  border-color: rgba(181, 71, 8, 0.25);
  background: linear-gradient(180deg, #fff7e8, #fffdf8);
}

.brand-btn {
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.62rem 1rem;
  transition: 0.2s ease;
}

.brand-btn:hover {
  background: #00428a;
  color: #fff;
}

.brand-btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  background: transparent;
}

.brand-btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.icon-nav-link,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.icon-nav-link {
  min-width: 42px;
  min-height: 42px;
  border-radius: 999px;
}

.icon-nav-link i,
.icon-btn i {
  font-size: 1rem;
}

.icon-btn {
  min-width: 38px;
}

.icon-action-group {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.icon-action-group form {
  margin: 0;
}

.brand-input {
  border-radius: 10px;
  border: 1px solid #d7e2ee;
  padding: 0.64rem 0.8rem;
}

.brand-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(0, 86, 179, 0.14);
}

.brand-table thead {
  background: var(--primary);
  color: #fff;
}

.brand-table.compact-table {
  margin-bottom: 0;
}

.brand-table.compact-table thead th {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.8rem 0.75rem;
}

.brand-table.compact-table tbody td {
  padding: 0.8rem 0.75rem;
  border-color: #edf2f7;
}

.table-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.table-chip.neutral {
  background: #eef4fa;
  color: #4b6075;
}

.table-chip.alert {
  background: #fff1f2;
  color: #b42318;
}

.table-chip.success {
  background: #ecfdf3;
  color: #027a48;
}

.table-chip.progress {
  background: #fff7e8;
  color: #b54708;
}

.ticket-main {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.ticket-title {
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.3;
}

.ticket-subline {
  font-size: 0.78rem;
  color: #64748b;
}

.message-preview {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  color: #64748b;
}

.message-time {
  font-size: 0.74rem;
  color: #94a3b8;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #d92d20;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.payment-grid {
  display: grid;
  gap: 1rem;
}

.payment-card {
  padding: 1.1rem;
}

.payment-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.payment-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.payment-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.payment-inline-box {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  background: #f8fbff;
  margin-bottom: 1rem;
}

.latest-payment-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  background: #fff;
}

.latest-payment-box-highlight {
  border-color: rgba(181, 71, 8, 0.25);
  background: linear-gradient(180deg, #fff7e8, #fffdf8);
}

.pix-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 86, 179, 0.06), rgba(0, 210, 255, 0.08));
  margin-bottom: 1rem;
}

.pix-key {
  word-break: break-word;
}

.qr-preview-wrapper {
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-preview {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  padding: 0.35rem;
}

.payment-actions-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 1rem;
  align-items: start;
}

.payment-upload-form {
  display: grid;
  gap: 0.65rem;
}

.empty-state-card {
  text-align: center;
  padding: 2rem 1.25rem;
}

.admin-payment-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.section-stack {
  display: grid;
  gap: 1rem;
}

.form-section-card {
  padding: 1.1rem;
}

.proof-link {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.proof-link:hover {
  text-decoration: underline;
}

.cashflow-in {
  color: #027a48;
  font-weight: 700;
}

.cashflow-out {
  color: #b42318;
  font-weight: 700;
}

.pagination .page-link {
  color: var(--primary);
  border-color: var(--line);
}

.toolbar-card {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  margin-bottom: 1rem;
}

.cashflow-filter-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px)) auto;
  gap: 0.85rem;
  align-items: end;
}

.cashflow-filter-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-start;
}

@media (max-width: 767px) {
  .cashflow-filter-bar {
    grid-template-columns: 1fr;
  }

  .cashflow-filter-actions {
    justify-content: stretch;
  }

  .cashflow-filter-actions .btn {
    flex: 1 1 auto;
  }
}

.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

@media (max-width: 991px) {
  .admin-payment-layout,
  .payment-actions-block,
  .pix-panel {
    grid-template-columns: 1fr;
  }

  .qr-preview-wrapper {
    justify-content: flex-start;
  }
}

.table-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

.row-unread {
  background: linear-gradient(90deg, rgba(0, 86, 179, 0.06), rgba(0, 210, 255, 0.02));
}

.row-unread td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
}

.row-payment-confirmed {
  background: linear-gradient(90deg, rgba(181, 71, 8, 0.08), rgba(255, 247, 232, 0.22));
}

.row-payment-confirmed td:first-child {
  box-shadow: inset 3px 0 0 #b54708;
}

.chat-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: #b42318;
}

.chat-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d92d20;
  box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.45);
  animation: pulseDot 1.4s infinite;
}

.brand-table td,
.brand-table th {
  vertical-align: middle;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  background: #fff;
  padding: 2rem;
}

.page-footer {
  margin-top: 42px;
  padding: 16px;
  text-align: center;
  border-top: 1px solid var(--line);
  color: #64748b;
}

.chat-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #dce8f3;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

.chat-telegram-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.95rem 1rem;
  background: linear-gradient(180deg, #ffffff, #f3f7fb);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.chat-header-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-telegram-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2aabee, #0056b3);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 6px 14px rgba(0, 86, 179, 0.22);
  overflow: hidden;
}

.chat-telegram-avatar img,
.chat-avatar-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  display: block;
}

.chat-telegram-avatar > .chat-avatar-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-avatar-fallback {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.chat-telegram-meta {
  min-width: 0;
}

.chat-telegram-title {
  font-weight: 800;
  color: #10233f;
  line-height: 1.2;
}

.chat-telegram-subtitle {
  font-size: 0.8rem;
  color: #5b728a;
  line-height: 1.35;
  margin-top: 0.15rem;
}

.chat-messages {
  min-height: 320px;
  max-height: 420px;
  overflow-y: auto;
  padding: 1.1rem 0.95rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 18%),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.05), transparent 16%),
    linear-gradient(180deg, #1f2c34 0%, #182229 100%);
}

.chat-entry-form {
  padding: 0.85rem 0.95rem 0.95rem;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, #f9fbfd, #ffffff);
}

.chat-compose-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.7rem;
  flex-wrap: wrap;
}

.chat-attachment-picker {
  border-radius: 999px;
}

.chat-compose-row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-end;
}

.chat-compose-input {
  min-height: 52px;
  max-height: 112px;
  resize: none;
  border-radius: 18px;
  background: #fff;
  padding: 0.85rem 1rem;
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  padding: 0;
  box-shadow: 0 12px 24px rgba(0, 86, 179, 0.2);
}

.chat-message-item {
  display: flex;
  margin-bottom: 0.7rem;
}

.chat-message-shell {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.chat-message-in {
  justify-content: flex-start;
}

.chat-message-out {
  justify-content: flex-end;
}

.chat-message-out .chat-message-shell {
  flex-direction: row-reverse;
}

.chat-avatar-badge {
  width: 30px;
  height: 30px;
  min-width: 30px;
  max-width: 30px;
  max-height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2aabee, #0056b3);
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 86, 179, 0.16);
  overflow: hidden;
  margin-top: 0.15rem;
}

.chat-bubble {
  position: relative;
  max-width: min(78%, 540px);
  padding: 0.5rem 0.75rem 0.55rem;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
}

.chat-bubble::after {
  display: none;
}

.chat-bubble-client,
.chat-bubble-client-own,
.chat-bubble-admin,
.chat-bubble-admin-own {
  background: #202c33;
  color: #f8fafc;
}

.chat-empty {
  color: #c6d0d8;
  text-align: center;
  padding: 2rem 1rem;
}

.chat-message-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
}

.chat-sender {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 0;
  color: #16d6c9;
}

.chat-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.38;
  color: #f8fafc;
}

.chat-time {
  font-size: 0.78rem;
  color: rgba(226, 232, 240, 0.72);
  white-space: nowrap;
}

.chat-attachment-image-link {
  display: block;
  margin-top: 0.55rem;
  text-decoration: none;
}

.chat-attachment-image {
  width: 100%;
  max-width: 220px;
  max-height: 220px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
  object-fit: cover;
}

.chat-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.55rem;
  text-decoration: none;
  color: #d8ecff;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
}

.chat-attachment-file:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.chat-upload-placeholder {
  opacity: 0.96;
}

.chat-upload-preview {
  display: grid;
  gap: 0.45rem;
}

.chat-upload-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.chat-upload-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #16d6c9, #5ef0a5);
  transition: width 0.15s ease;
}

.chat-upload-status {
  font-size: 0.76rem;
  color: rgba(226, 232, 240, 0.78);
}

.chat-budget-box {
  margin: 0.85rem 0.95rem 0;
}
  border: 1px solid rgba(148, 163, 184, 0.18);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
.chat-time {
  font-size: 0.72rem;
  color: rgba(15, 23, 42, 0.58);
}

.table-pagination-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.9rem;
}

.table-pagination .page-link {
  border: 1px solid var(--line);
  color: var(--secondary);
  font-weight: 700;
  border-radius: 10px;
  margin: 0 0.15rem;
  min-width: 40px;
  text-align: center;
}

.table-pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.table-pagination .page-item.disabled .page-link {
  color: #94a3b8;
  background: #f8fafc;
}

@keyframes pulseDot {
  0% {
    box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(217, 45, 32, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(217, 45, 32, 0);
  }
}

@media (max-width: 768px) {
  .app-shell {
    padding-top: 84px;
  }

  .auth-card {
    padding: 1.4rem;
  }

  .message-preview {
    max-width: 180px;
  }

  .search-form .brand-input {
    min-width: 100%;
  }

  .chat-compose-row {
    align-items: stretch;
  }

  .chat-header-actions {
    width: 100%;
  }

  .chat-header-actions .btn {
    width: 100%;
  }

  .chat-message-shell {
    gap: 0.4rem;
  }

  .chat-bubble {
    max-width: 88%;
  }

  .table-pagination-wrap {
    justify-content: center;
  }
}
