:root {
  --primary-color: #2563eb;
  --sidebar-width: 250px;
  --header-height: 60px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8f9fa;
  padding-top: var(--header-height);
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
}

/* Navbar */
.navbar-fixed {
  height: var(--header-height);
  background-color: #fff;
  border-bottom: 1px solid #e5e7eb;
  z-index: 1030;
}

/* Sidebar */
.sidebar-fixed {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  z-index: 100;
  padding: 20px 0;
  width: var(--sidebar-width);
  background-color: #fff;
  border-right: 1px solid #e5e7eb;
  overflow-y: auto;
}

.sidebar-fixed .nav-link {
  font-weight: 500;
  color: #4b5563;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-fixed .nav-link:hover {
  color: var(--primary-color);
  background-color: #eff6ff;
}

.sidebar-fixed .nav-link.active {
  color: var(--primary-color);
  background-color: #eff6ff;
  border-right: 3px solid var(--primary-color);
}

.sidebar-heading {
  padding: 20px 24px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 30px;
  max-width: calc(100% - var(--sidebar-width));
}

@media (max-width: 768px) {
  .sidebar-fixed {
    margin-left: calc(-1 * var(--sidebar-width));
    transition: margin 0.3s;
  }

  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 18px 14px 24px;
  }

  .sidebar-fixed.show {
    margin-left: 0;
  }
}

/* Cards */
.card {
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #111827;
}

.table-responsive {
  overflow-x: auto;
  max-width: 100%;
}

.report-table {
  table-layout: auto;
  min-width: 980px;
}

.report-table th,
.report-table td {
  white-space: nowrap;
}

.report-table .message-preview {
  min-width: 180px;
  max-width: 280px;
  white-space: normal;
}

.table-compact th,
.table-compact td {
  white-space: nowrap;
}

.company-edit-main {
  display: flex;
  flex-direction: column;
}

.company-edit-main > #company-form {
  order: 1;
}

.company-edit-main > #credit-charge {
  order: 2;
}

.company-edit-main > #credit-ledger {
  order: 3;
}

.company-edit-main > #payment-history {
  order: 4;
}

/* Badges */
.badge-type {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}

.badge-sms {
  background-color: #e0f2fe;
  color: #0369a1;
}

.badge-lms {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.badge-mms {
  background-color: #fae8ff;
  color: #86198f;
}

.badge-atalk {
  background-color: #fffae0;
  color: #a16207;
}

.badge-status-success {
  background-color: #dcfce7;
  color: #166534;
}

.badge-status-fail {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-status-wait {
  background-color: #f3f4f6;
  color: #4b5563;
}

.badge-status-info {
  background-color: #e0f2fe;
  color: #075985;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background-color: #f8fbff;
}

.message-body-box {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  min-height: 120px;
}

.detail-label {
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-value {
  color: #111827;
  font-weight: 600;
  word-break: break-word;
}

.vendor-raw-table td {
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.vendor-raw-table td:first-child {
  width: 180px;
  color: #6b7280;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.json-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
}

/* Docs specific */
.docs-sidebar .nav-link {
  font-size: 0.9rem;
  padding: 5px 10px;
}

.docs-content h3 {
  margin-top: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

/* Footer */
.site-footer {
  margin-left: var(--sidebar-width);
  padding: 14px 28px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.6;
}

.site-footer .footer-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.site-footer-no-sidebar {
  margin-left: 0;
}

.site-footer .footer-break {
  flex-basis: 100%;
  height: 0;
}

@media (max-width: 768px) {
  .navbar-fixed {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .navbar-brand {
    min-width: 0;
  }

  .navbar-brand span {
    font-size: 0.95rem;
  }

  .dropdown-toggle > div:last-child {
    display: none;
  }

  .page-header {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .page-title {
    font-size: 1.35rem;
  }

  .report-table {
    min-width: 0;
  }

  .report-table .message-preview {
    max-width: none;
  }

  .report-table thead {
    display: none;
  }

  .report-table,
  .report-table tbody,
  .report-table tr,
  .report-table td {
    display: block;
    width: 100%;
  }

  .report-table tbody tr {
    margin: 0 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
  }

  .report-table tbody td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px !important;
    white-space: normal;
    text-align: right !important;
    border-bottom: 1px solid #edf0f3;
  }

  .report-table tbody td:last-child {
    border-bottom: 0;
  }

  .report-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 92px;
    color: #6b7280;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
  }

  .report-table tbody td.message-preview {
    display: block;
    text-align: left !important;
  }

  .report-table tbody td.message-preview::before {
    display: block;
    margin-bottom: 6px;
  }

  .card-body {
    padding: 1rem;
  }

  .site-footer {
    margin-left: 0;
    padding: 16px 18px 20px;
  }
  .site-footer .footer-wrap {
    gap: 4px 10px;
  }
}
