:root {
  --brand: #0d5c46;
  --brand-dark: #08402f;
  --bg: #f4f6f8;
}

body {
  background: var(--bg);
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

.topbar {
  background: var(--brand-dark);
  min-height: 56px;
  flex-wrap: nowrap;
}

.app-wrapper {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 230px;
  background: var(--brand);
  flex-shrink: 0;
  padding-top: 10px;
}

.sidebar .nav-link {
  color: rgba(255,255,255,0.85);
  padding: 10px 18px;
  font-size: 14.5px;
  border-left: 3px solid transparent;
}

.sidebar .nav-link i {
  width: 20px;
  display: inline-block;
}

.sidebar .nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar .nav-link.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-left: 3px solid #ffc107;
  font-weight: 600;
}

.main-content {
  flex-grow: 1;
  padding: 22px;
  min-width: 0; /* lets long table content shrink instead of pushing the page width */
}

/* ---------------------------------------------------
   Mobile layout (below Bootstrap's lg breakpoint, 992px)
   Sidebar becomes an off-canvas drawer opened via the
   hamburger button in the top bar.
--------------------------------------------------- */
@media (max-width: 991.98px) {
  .navbar-brand {
    max-width: 50vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.1rem;
  }
  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 250px;
    max-width: 80vw;
    z-index: 1040;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    top: 56px;
    background: rgba(0,0,0,0.45);
    z-index: 1035;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }
  .main-content {
    padding: 14px;
    width: 100%;
  }
}

@media (min-width: 992px) {
  .sidebar-backdrop { display: none; }
}

.kpi-card {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  height: 100%;
}

.kpi-card .kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand-dark);
  word-break: break-word;
}

.kpi-card .kpi-label {
  font-size: 13px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: .03em;
}

@media (max-width: 575.98px) {
  .kpi-card { padding: 14px; }
  .kpi-card .kpi-value { font-size: 21px; }
}

.card-panel {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

@media (max-width: 575.98px) {
  .card-panel { padding: 14px; }
}

.table thead th {
  background: #eef2f0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.badge-status-active { background:#1e8e3e; }
.badge-status-suspended { background:#e8a400; }
.badge-status-expired { background:#b3261e; }
.badge-status-disconnected { background:#6c757d; }
.badge-status-lead { background:#0d6efd; }
.badge-status-pending { background:#6c757d; }

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d5c46, #08402f);
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 12px;
  padding: 36px 32px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

@media (max-width: 400px) {
  .login-card { padding: 28px 22px; }
}

.invoice-box {
  background: #fff;
  padding: 30px;
  border-radius: 8px;
  max-width: 720px;
  margin: 0 auto;
}

@media (max-width: 575.98px) {
  .invoice-box { padding: 16px; }
}

/* ---------------------------------------------------
   Android WebView / mobile app-shell friendliness
--------------------------------------------------- */
html, body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

a, button, .btn, .nav-link, input[type="checkbox"], input[type="radio"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Comfortable minimum tap target size on touch devices */
@media (pointer: coarse) {
  .btn, .nav-link, .list-group-item-action {
    min-height: 40px;
  }
  .btn-sm {
    min-height: 34px;
  }
  input.form-control, select.form-select, textarea.form-control {
    min-height: 42px;
    font-size: 16px; /* prevents iOS/Android auto-zoom on focus */
  }
}

/* Avoid accidental text selection on interactive chrome (buttons, nav, badges) */
.btn, .nav-link, .badge, .navbar-brand {
  -webkit-user-select: none;
  user-select: none;
}

