:root {
  --rbmp-blue: #0a84ff;
  --rbmp-blue-dark: #0064d2;
  --rbmp-ink: #1d1d1f;
  --rbmp-muted: #6e6e73;
  --rbmp-line: rgba(60, 60, 67, 0.16);
  --rbmp-soft: #f5f5f7;
  --rbmp-card: rgba(255, 255, 255, 0.78);
  --rbmp-success: #31c48d;
  --rbmp-warning: #f5a524;
  --rbmp-danger: #e5484d;
  --rbmp-radius: 8px;
  --rbmp-shadow: 0 14px 36px rgba(29, 29, 31, 0.08);
  --rbmp-shadow-hover: 0 18px 44px rgba(29, 29, 31, 0.12);
  --rbmp-control: rgba(255, 255, 255, 0.72);
}

[data-bs-theme="dark"] {
  --rbmp-ink: #f5f5f7;
  --rbmp-muted: #b6b6bd;
  --rbmp-line: rgba(235, 235, 245, 0.14);
  --rbmp-soft: #161618;
  --rbmp-card: rgba(34, 34, 38, 0.78);
  --rbmp-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
  --rbmp-shadow-hover: 0 20px 48px rgba(0, 0, 0, 0.32);
  --rbmp-control: rgba(44, 44, 48, 0.84);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 110, 115, 0.35) transparent;
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 42%, #fff 100%);
  color: var(--rbmp-ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-bs-theme="dark"] body {
  background: linear-gradient(180deg, #111113 0%, #17171a 100%);
}

a {
  color: var(--rbmp-blue);
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px;
  background: rgba(255, 255, 255, 0.68);
  border-right: 1px solid var(--rbmp-line);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

[data-bs-theme="dark"] .sidebar {
  background: rgba(24, 24, 27, 0.88);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--rbmp-radius);
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #42a5ff 0%, var(--rbmp-blue) 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 10px 22px rgba(10, 132, 255, 0.25);
}

.login-logo {
  width: min(65px, 86%);
  max-height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 16px 24px rgba(29, 29, 31, 0.14));
}

.invoice-logo-box {
  width: 92px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.invoice-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.settings-logo-preview {
  width: min(65px, 92%);
  max-height: 35px;
  object-fit: contain;
}

.sidebar .nav-link {
  color: var(--rbmp-muted);
  border-radius: var(--rbmp-radius);
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  color: var(--rbmp-ink);
  background: rgba(10, 132, 255, 0.11);
}

.sidebar .nav-link:hover {
  transform: translateX(2px);
}

.sidebar .nav-link i {
  width: 18px;
  text-align: center;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 28px;
  background: rgba(255, 255, 255, 0.66);
  border-bottom: 1px solid var(--rbmp-line);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
}

[data-bs-theme="dark"] .topbar {
  background: rgba(17, 17, 19, 0.82);
}

.content {
  padding: 28px;
  max-width: 1680px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 760;
  margin: 0;
  letter-spacing: 0;
}

.rbmp-card {
  background: var(--rbmp-card);
  border: 1px solid var(--rbmp-line);
  border-radius: var(--rbmp-radius);
  box-shadow: var(--rbmp-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.rbmp-card:hover {
  border-color: rgba(10, 132, 255, 0.18);
  box-shadow: var(--rbmp-shadow-hover);
}

.metric {
  min-height: 124px;
}

.metric-label {
  color: var(--rbmp-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.metric-value {
  font-size: 1.72rem;
  font-weight: 780;
  line-height: 1.15;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--rbmp-radius);
  display: grid;
  place-items: center;
  color: var(--rbmp-blue);
  background: rgba(10, 132, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.btn-primary {
  background: var(--rbmp-blue);
  border-color: var(--rbmp-blue);
  border-radius: var(--rbmp-radius);
  box-shadow: 0 8px 18px rgba(10, 132, 255, 0.22);
  font-weight: 650;
}

.btn-primary:hover {
  background: var(--rbmp-blue-dark);
  border-color: var(--rbmp-blue-dark);
  transform: translateY(-1px);
}

.btn-light {
  background: var(--rbmp-control);
  border-color: var(--rbmp-line);
  color: var(--rbmp-ink);
  border-radius: var(--rbmp-radius);
}

.btn-light:hover {
  background: rgba(10, 132, 255, 0.1);
  border-color: rgba(10, 132, 255, 0.2);
}

.btn-icon {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.form-control,
.form-select {
  border-radius: var(--rbmp-radius);
  border-color: var(--rbmp-line);
  background-color: var(--rbmp-control);
  min-height: 42px;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(10, 132, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

.table {
  vertical-align: middle;
  --bs-table-bg: transparent;
}

.table thead th {
  color: var(--rbmp-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  font-weight: 800;
  border-bottom-color: var(--rbmp-line);
}

.table tbody tr {
  border-color: var(--rbmp-line);
}

.table tbody tr:hover {
  background: rgba(10, 132, 255, 0.045);
}

.badge-soft {
  background: rgba(10, 132, 255, 0.1);
  color: var(--rbmp-blue);
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(9, minmax(120px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.workflow-stage {
  border: 1px solid var(--rbmp-line);
  border-radius: var(--rbmp-radius);
  padding: 12px;
  background: var(--rbmp-card);
  min-height: 88px;
  box-shadow: var(--rbmp-shadow);
}

.search-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: none;
  max-height: 420px;
  overflow-y: auto;
}

.search-popover.show {
  display: block;
}

.alert {
  border-radius: var(--rbmp-radius);
}

.list-group-item {
  background: transparent;
  border-color: var(--rbmp-line);
}

.accordion-item,
.modal-content {
  border-color: var(--rbmp-line);
  border-radius: var(--rbmp-radius);
}

.progress {
  background: rgba(60, 60, 67, 0.12);
  border-radius: 999px;
}

.print-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 22mm;
  background: #fff;
  color: #1d1d1f;
  position: relative;
}

.invoice-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
}

.invoice-header {
  margin-top: 10px;
}

.invoice-type-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.invoice-status-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.invoice-meta-box {
  background: #f7f8fa;
  border-radius: 12px;
  padding: 16px 18px;
}

.invoice-items-table thead th {
  background: #f7f8fa;
  border-bottom: 2px solid #e5e5ea;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6e6e73;
}

.invoice-items-table td {
  vertical-align: middle;
}

.invoice-totals-box {
  background: #f7f8fa;
  border-radius: 12px;
  padding: 16px 18px;
}

.invoice-total-row {
  border-top: 2px solid;
  margin-top: 6px;
  padding-top: 10px !important;
  font-size: 18px;
}

.invoice-payment-box {
  background: #f7f8fa;
  border-radius: 12px;
  padding: 14px 18px;
}

.invoice-footer-note {
  border-top: 1px solid #e5e5ea;
  padding-top: 16px;
}

@media (max-width: 991px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    transform: translateX(-104%);
    transition: transform 0.2s ease;
    z-index: 40;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .topbar,
  .content {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .print-sheet {
    width: auto;
    min-height: auto;
    padding: 0;
  }

  .invoice-logo-box {
    width: 78px;
    height: 78px;
  }
}

.client-picker {
  position: relative;
}

.client-picker select {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
