/* WhatsApp SVG icon green */
.whatsapp-green {
  color: #25D366 !important;
  stroke: #25D366 !important;
}
:root {
  --primary-red: #d3421a;
  --primary-red-light: #0F083C;
  --primary-red-dark: #8b1528;
  --accent-teal: #00bfa5;
  --accent-blue: #1e88e5;

  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;

  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;

  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);

  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --radius-full: 9999px;
  /* Badge color tokens (used throughout UI) */
  --badge-active-bg: #d1fae5;
  --badge-active-color: #065f46;
  --badge-inactive-bg: #fee2e2;
  --badge-inactive-color: #991b1b;
  --badge-expired-bg: #fef3c7;
  --badge-expired-color: #92400e;
  --badge-online-bg: #28c76f;
  --badge-online-color: #ffffff;
  --badge-offline-bg: #ef4444;
  --badge-offline-color: #ffffff;
  --badge-paid-bg: #d1fae5;
  --badge-paid-color: #065f46;
  --badge-pending-bg: #fef3c7;
  --badge-pending-color: #92400e;

  /* Icon hover backgrounds */
  --hover-edit-bg: #dbeafe;
  --hover-delete-bg: #fee2e2;
  --hover-view-bg: #d1fae5;
  /* Button backgrounds */
  --btn-primary-bg: #ffffff;
  --btn-primary-hover: var(--bg-secondary);
}

[data-theme="dark"] {
  --bg-primary: #0f1419;
  --bg-secondary: #1a202c;
  --bg-card: #1e2530;

  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-light: #9ca3af;

  --border-color: #374151;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  /* Dark variants for badges and hover states to keep contrast */
  --badge-active-bg: rgba(16,185,129,0.12); /* subtle green */
  --badge-active-color: #10b981;
  --badge-inactive-bg: rgba(239,68,68,0.08);
  --badge-inactive-color: #fecaca;
  --badge-expired-bg: rgba(245,158,11,0.06);
  --badge-expired-color: #f59e0b;
  --badge-online-bg: #10b981;
  --badge-online-color: #08120a;
  --badge-offline-bg: #ef4444;
  --badge-offline-color: #fff;
  --badge-paid-bg: rgba(16,185,129,0.12);
  --badge-paid-color: #10b981;
  --badge-pending-bg: rgba(245,158,11,0.06);
  --badge-pending-color: #f59e0b;

  --hover-edit-bg: rgba(30,64,175,0.06);
  --hover-delete-bg: rgba(220,38,38,0.06);
  --hover-view-bg: rgba(5,150,105,0.06);

  --btn-primary-bg: var(--bg-card);
  --btn-primary-hover: rgba(255,255,255,0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Typography */
h1 { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
h2 { font-size: 20px; font-weight: 600; margin-bottom: 10px; }
h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
h4 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }

p { margin-bottom: 8px; }

/* Page Header */
.page-header {
  margin-bottom: 20px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}


/* Layout */
.app-container {
  min-height: 100vh;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 80px;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Top bar spans full width viewport */
.top-bar-full-width {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

.page-content {
  padding-top: 15px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Page greeting line placed before stats */
.page-greeting {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  margin-bottom: 12px;
  display: block;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  box-shadow: none;
  font-weight: 600;
  color: var(--text-primary);
}

.text-success{
  color: #10b981 !important
}

.text-primary{
  color: #357bf2 !important
}

.text-danger
{
  color: #ef4444 !important
}

.text-warning
{
  color: #ff9f43 !important
}

.page-greeting .greeting-text {
  font-size: 18px;
  margin: 0; /* inline plain text */
  line-height: 1.2;
}

/* Top Bar styling */
.top-bar {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  background: var(--bg-secondary);
  padding: 7px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  height: 36px;
  width: auto;
  margin-left: 4px;
}

.greeting {
  font-size: 13px;
  color: var(--text-secondary);
}

.top-bar-icons {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  justify-content: flex-end;
}

/* Ensure the left block uses available space so icons sit flush to the right */
.top-bar-left { flex: 1 1 auto; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  color: var(--text-secondary);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-primary);
  color: var(--primary-red);
}

/* Toggle SVG colors for client online/offline toggle */
.toggle-svg { display: block; width: 20px; height: 20px; }
.toggle-online { color: var(--badge-online-bg); }
.toggle-offline { color: var(--badge-offline-bg); }
.btn-toggle { background: transparent; border: none; padding: 0; cursor: pointer; }

/* small icons used in clients table */
.icon-small { width: 12px; height: 12px; display: inline-block; vertical-align: middle; }
.btn-copy, .btn-download, .btn-whatsapp, .btn-reload { background: transparent; border: none; border-radius: 4px; cursor: pointer; color: var(--text-secondary); }
.btn-copy:hover { background: rgba(0,0,0,0.04); }
.btn-whatsapp:hover { background: rgba(37, 211, 102, 0.08); }
.btn-reload:hover { background: rgba(0,0,0,0.04); }
.client-phone { font-size: 12px; color: var(--text-secondary); }

.icon-btn svg {
  width: 25px;
  height: 25px;
  color: #0F083C;
}

.table-title {
  position: relative;
}

.table-title .float-end {
  float: right;
  margin-left: 20px; /* keeps it from touching the text */
}

.float-end
{
  float: right;
  margin-left: 20px;
}

.pt-3 {
  padding-top: 3px;
}

.msg-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

/* Compact pagination styles used by billing page */
.compact-pagination{display:flex;align-items:center;gap:6px;flex-wrap:nowrap;white-space:nowrap;overflow:auto}
.compact-pagination .cp-badge{display:inline-block;padding:6px 8px;border-radius:8px;background:var(--bg-primary);font-weight:700;font-size:13px;color:var(--text-primary);}
.compact-pagination .cp-btn{background:transparent;border:1px solid rgba(0,0,0,0.06);padding:4px 8px;border-radius:8px;cursor:pointer;font-size:13px;min-width:28px;line-height:1}
.compact-pagination .cp-btn:disabled{opacity:0.5;cursor:default}
.compact-pagination .cp-btn-active{background:var(--btn-primary-hover);color:var(--text-primary);border-color:transparent}
.compact-pagination .cp-ellipsis{padding:0 6px;color:var(--text-secondary);font-size:13px}

@media (max-width:520px){
  .compact-pagination .cp-badge{padding:4px 6px;font-size:12px}
  .compact-pagination .cp-btn{padding:3px 6px;font-size:12px;min-width:26px}
}

.msg-tab {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #777;
    transition: 0.25s ease;
}

.msg-tab:hover {
    color: #333;
}

.msg-tab.active {
    color: #000;
    border-bottom-color: #0d6efd;
}

.msg-tab .icon svg {
    width: 18px;
    height: 18px;
}

.send-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--primary-red);
  color: white;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.balance-chip {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Homepage-specific SMS balance style: outlined rectangle with label on top and amount below */
.balance-chip.home-balance {
  background: transparent; /* remove pill background */
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d3421a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 20px;
  gap: 4px;
  color: var(--text-primary);
}

.balance-chip.home-balance .balance-label {
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.6px;
}

.balance-chip.home-balance .balance-amount {
  font-size: 11px;
  color: var(--primary-red);
}

.top-up-btn {
  background: var(--primary-red);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.top-up-btn:hover {
  background: var(--primary-red-dark);
  transform: scale(1.05);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  box-shadow: none;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  display: flex;

/* Compact expense table styles */
.table-wrapper #expenseTable {
  width: 100%;
  border-collapse: collapse;
}
.table-wrapper #expenseTable td, .table-wrapper #expenseTable th {
  padding: 6px 8px;
  vertical-align: middle;
  font-size: 13px;
}
.table-wrapper #expenseTable tr { border-bottom: 1px solid var(--border-color); }
.expense-desc-btn { background: none; border: none; padding: 0; margin: 0; }
.expense-desc-btn:focus { outline: 2px solid rgba(59,130,246,0.18); }

@media (max-width: 520px) {
  .table-wrapper #expenseTable thead { display: none; }
  .table-wrapper #expenseTable td { display: block; width: 100%; }
  .table-wrapper #expenseTable tr { display: block; margin-bottom: 8px; }
}
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-red);
  margin: 8px 0;
}

.card-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

/* Responsive: 2 columns at small tablets, 4 columns on wide screens */
@media (min-width: 520px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Modal status badge and view modal actions styling */
.status-badge {
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  display: inline-block;
}
.status-badge.active {
  border: 1px solid #0F083C;
  color: var(--badge-active-color);
}
.status-badge.inactive {
  border: 1px solid #d3421a;
  color: var(--badge-inactive-color);
}
.view-modal-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Generic small button styles for modals (fallback if not present) */
.btn { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--btn-primary-bg); cursor: pointer; font-weight:600; }
.btn-sm{
  padding: 5px 12px !important;
}
.btn-danger { border: 1px solid #ef4444 !important}
.btn-success { border: 1px solid #10b981 !important; }
.btn-warning { background: var(--warning); color: #fff; border: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

@media (min-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* New layout: icon on left, value and label stack on right */
.stat-layout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-bottom { display: flex; align-items: center; }

/* Preloader overlay and spinner */
.preloader-overlay {
  position: fixed;
  inset: 0;
  display: none; /* shown by JS */
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.85);
  z-index: 9999;
  transition: opacity 0.25s ease;
}

[data-theme="dark"] .preloader-overlay {
  background: rgba(6,10,14,0.7);
}

.preloader-spinner {
  width: 88px; /* increased size */
  height: 88px;
  border-radius: 50%;
  border: 10px solid rgba(0,0,0,0.08);
  border-top-color: #0F083C; /* updated color from user */
  animation: preloader-spin 0.9s linear infinite;
  box-shadow: var(--shadow-sm);
}

@keyframes preloader-spin { to { transform: rotate(360deg); } }

/* While preloading, prevent pointer events and make UI inert */
.preloading * { pointer-events: none !important; user-select: none !important; }
.preloading .modal, .preloading .modal *, .preloading .modal-card, .preloading .modal-card * { pointer-events: auto !important; }
.preloading body { opacity: 1; }

/* Small responsive tweaks */
@media (max-width: 480px) {
  .preloader-spinner { width: 64px; height: 64px; border-width: 8px; }
}

/* Localized loader for Mikrotik carousel */
.mikrotik-loader {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px 0;
}

.mikrotik-loader .mini-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 6px solid rgba(0,0,0,0.07);
  border-top-color: #0F083C;
  animation: preloader-spin 0.9s linear infinite;
}

@media (max-width: 480px) {
  .mikrotik-loader .mini-spinner {
    width: 40px;
    height: 40px;
    border-width: 5px;
  }
}

.mini-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.08);
  border-top-color: #0F083C;
  animation: preloader-spin 0.9s linear infinite;
}

@keyframes preloader-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}


/* Fetch status block used on clients page */
.fetch-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  margin: 10px 0;
}
.fetch-status.loading { color: var(--text-secondary); }
.fetch-status.success { color: var(--text-primary); }
.fetch-status.error { color: var(--error); }

/* Billing filters responsive layout and soft input styles */
.billing-filters {
  /* Desktop-first compact layout: dates side-by-side and occupy available width */
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
}
.billing-filters .filter-dates {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  flex: 1 1 auto;
}
.billing-filters .filter-dates > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
  max-width: 240px;
  flex: 1 1 140px;
}
.billing-filters label { font-size:11px; color:var(--text-secondary); margin:0; }
.billing-filters .soft-input {
  padding:6px 8px;
  border-radius:8px;
  border:1px solid rgba(0,0,0,0.08);
  box-sizing:border-box;
  font-size:13px;
  background:var(--bg-input, #fff);
}
.billing-filters > div:last-child { display:flex; gap:8px; align-items:center; }

/* On narrow screens stack vertically and let inputs grow to full width */
@media (max-width: 540px) {
  .billing-filters { flex-direction: column; align-items: stretch; gap:8px; }
  .billing-filters .filter-dates { flex-direction: row; gap:8px; }
  .billing-filters .filter-dates > div { flex: 1 1 auto; min-width:0; max-width:100%; }
  .billing-filters > div:last-child { justify-content:flex-start; }
}

/* Soft, system-like input appearance */
.soft-input {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04) inset;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.soft-input:focus {
  box-shadow: 0 0 0 4px rgba(15,8,60,0.06);
  border-color: rgba(15,8,60,0.12);
}

/* Make filters stack on small screens: plan on top, dates below */
/* Desktop: place filters on a single row */
@media (min-width: 721px) {
  .billing-filters { flex-direction: row; align-items: center; gap: 12px; }
  .billing-filters .filter-top { flex-direction: row; align-items: center; gap: 8px; }
  .billing-filters .filter-dates { flex-direction: row; gap: 12px; }
  .billing-filters .filter-dates > div { flex: 1; }
  .table-actions { display: flex; flex-direction: row; align-items: center; gap: 12px; }
  .filter-actions { justify-content: flex-end; margin-left: auto; }
}

/* Ensure action buttons sit in a single row on mobile */
.filter-actions { display: flex; gap: 8px; justify-content: flex-start; width: 100%; }
@media (min-width: 721px) { .filter-actions { width: auto; } }

/* compact button sizes */
.filter-actions .btn { padding: 6px 10px; font-size: 13px; }

/* ensure table-actions compact spacing on mobile */
.table-actions { gap: 8px; }

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

/* When icon should appear left of the content, use this helper on stat-layout */
.stat-layout.stat-layout-row { display:flex; flex-direction:row; gap:8px; align-items:center; }
.stat-layout.stat-layout-row .stat-content { align-items:flex-start; }

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white; /* ensure svg stroke uses white color */
}

.stat-icon.green { background: #0F083C }
.stat-icon.blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.stat-icon.red { background: linear-gradient(135deg, #fee2e2, #fecaca); }
.stat-icon.yellow { background: linear-gradient(135deg, #fef3c7, #fde68a); }

.stat-icon svg {
  width: 20px;
  height: 20px;
  color: #d3421a;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  word-break: break-word;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* MikroTik Carousel */
.mikrotik-section {
  margin: 5px 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.carousel-container {
  position: relative;
  overflow: visible;
  margin: 0;
  padding: 0 8px;
}

.carousel-track {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Mobile: snap to center and show 1 card + peek */
  scroll-snap-type: x mandatory;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.mikrotik-card {
  flex: 0 0 280px;
  scroll-snap-align: center;
  background: transparent;
  border-radius: var(--radius-lg);
  padding: 7px 16px 16px 16px;
  margin: 0;
  color: white;
  position: relative;
  overflow: visible;
  min-width: 280px;
  max-width: 280px;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.kpi-grid{
  padding-top: 15px;
}

.chart-wrap{
  height: 120px !important;
}

/* Force status-specific card backgrounds (status class overrides color-N variants) */
.mikrotik-card.status-online { background: linear-gradient(135deg, #0F083C, #0f083c) !important; }
.mikrotik-card.status-offline { background: linear-gradient(135deg, #d3421a, #d3421a) !important; }

/* Active card styling */
.mikrotik-card.active {
  transform: none;
  box-shadow: none;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.mikrotik-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  pointer-events: none;
}

/* Add Business Card */
.add-business-card {
  background: linear-gradient(135deg, rgba(15, 8, 60, 0.6), rgba(15, 8, 60, 0.4)) !important;
  border: 2px dashed rgba(239, 68, 68, 0.5) !important;
  cursor: pointer !important;
  transition: all 0.3s ease;
}

.add-business-card:hover {
  background: linear-gradient(135deg, rgba(15, 8, 60, 0.8), rgba(15, 8, 60, 0.6)) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2) !important;
}

/* New card content structure */
.server-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.info-btn:hover {
  opacity: 0.8;
  transform: scale(1.1);
  transition: all 0.2s ease;
}

.server-name {
  font-size: 16px;
  font-weight: 700;
  color: white;
  margin-bottom: 0;
  text-align: left;
  flex: 1;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
  color: white;
}

.status-badge.online {
  border: 2px solid #d3421a !important;
}

@keyframes blink-dot {
  0%, 100% {
    background: white;
    opacity: 1;
  }
  50% {
    background: #1a1a1a;
    opacity: 0.6;
  }
}

.status-badge.online .status-dot-badge {
  animation: blink-dot 1.2s infinite;
}

.status-dot-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  flex-shrink: 0;
}

.status-text {
  font-weight: 600;
}

.separator {
  color: rgba(255, 255, 255, 0.6);
  margin: 0 4px;
}

.expiry-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

.stat-mini {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px;
  border-radius: 6px;
  backdrop-filter: blur(10px);
}

.stat-label-mini {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value-mini {
  font-size: 13px;
  font-weight: 700;
  color: white;
}

/* Action Icons Grid */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-bottom: 8px;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  height: 78px;
  width: 78px;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.action-item:active {
  transform: scale(0.95);
}


.action-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  background: #0F083C;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.action-icon svg {
  width: 20px;
  height: 20px;
  color: #d3421a;
  transition: none;
}

.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin: 16px 0;
}

.table-header {
  padding: 8px 10px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column; /* mobile-first: title on top, actions below */
  gap: 8px;
  align-items: stretch;
}

/* Page-specific header style for inline title + action buttons (Voucher page) */
.table-header.table-header-inline {
  flex-direction: row; /* keep horizontal on all sizes for this layout */
  align-items: center;
  justify-content: space-between;
}
.table-header.table-header-inline .table-title { margin: 0; flex: 1; min-width: 0; }
.table-header.table-header-inline .btn { display: inline-flex; align-items: center; gap:8px; flex: 0 0 auto; white-space: nowrap; padding: 6px 12px; font-size:13px; }
.table-header.table-header-inline .btn svg { margin-right: 6px; }

@media (min-width: 721px) {
  .table-header { flex-direction: row; align-items: center; }
  .table-header .table-header-top { margin-right: 12px; }
}

.table-title {
  font-size: 15px;
  font-weight: 600;
}

/* Compact adjustments for billing filters on mobile */
.billing-filters .soft-input, .billing-filters select.soft-input { width: 100%; box-sizing: border-box; }
.table-header-top { padding-bottom: 4px; }

.table-actions {
  display: flex;
  gap: 8px;
}

/* Filter chips wrapper - extends full screen width */
.filter-chips-wrapper {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 0 12px;
  box-sizing: border-box;
  max-width: 100vw;
  overflow: visible;
}

.filter-chips {
  display: flex;
  gap: 5px;
  /*padding: 12px 16px;*/
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

/* Service type filters (same treatment as filter-chips) */
.service-type-filters {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

/* Desktop: adjust for page-content padding */
@media (min-width: 1025px) {
  .filter-chips-wrapper {
    margin-left: calc(-50vw + 50% - 24px);
    padding-left: 40px;
    padding-right: 40px;
  }
}

.chip {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1.5px solid #d3421a;
  background: transparent;
  color: #0F083C;
  display: inline-block;
  user-select: none;
  flex-shrink: 0;
}

.chip:hover {
  background: rgba(15, 8, 60, 0.08);
  border-color: #d3421a;
  transform: translateY(-1px);
}

.chip:active {
  transform: translateY(0px);
}

.chip.active {
  background: #d3421a;
  border-color: #d3421a;
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(211, 66, 26, 0.3);
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

/* Inline amount layout for invoice table cells - compact single line view for mobile */
#invoiceTable .amount-col { text-align: right; }
#invoiceTable .amount-col .amount-flex {
  display:flex;
  flex-direction:row !important; /* override inline column layout */
  align-items:center;
  gap:8px;
  justify-content:flex-end;
  white-space:nowrap; /* prevent wrapping */
  overflow:hidden; /* clip if too long */
  text-overflow:ellipsis;
  min-width: 0; /* allow flex items to shrink inside table cell */
}

/* Compact stacked (vertical) layout for mobile and small cells */
#invoiceTable .amount-col .amount-stack {
  display:flex;
  flex-direction:column;
  align-items:flex-end; /* keep numbers right aligned */
  gap:2px; /* small spacing between stacked rows */
  line-height:1;
  min-width: 0; /* allow shrink */
}
#invoiceTable .amount-col .amount-stack .amount-prefix { font-size:11px; color:var(--text-secondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:6rem; }
#invoiceTable .amount-col .amount-stack .amount-value { font-weight:700; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:7rem; }
#invoiceTable .amount-col .amount-stack .invoice-balance { font-size:11px; color:var(--text-secondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:6rem; }

@media (max-width: 420px) {
  #invoiceTable .amount-col .amount-stack .amount-value { font-size:12px; }
  #invoiceTable .amount-col .amount-stack .amount-prefix, #invoiceTable .amount-col .amount-stack .invoice-balance { font-size:10px; }
}
#invoiceTable .amount-col .amount-prefix { font-size:11px; color:var(--text-secondary); }
#invoiceTable .amount-col .amount-value { font-weight:700; font-size:13px; }
#invoiceTable .amount-col .invoice-balance { font-size:11px; color:var(--text-secondary); }

@media (max-width: 420px) {
  /* On very narrow screens, reduce size to keep values inline */
  #invoiceTable .amount-col .amount-value { font-size:12px; }
  #invoiceTable .amount-col .amount-prefix, #invoiceTable .amount-col .invoice-balance { font-size:10px; }
  #invoiceTable th { font-size:10px; }
}

/* Compact clients table: remove horizontal scroller and allow wrapping so table fits mobile */
#clientsTableWrapper {
  overflow: visible; /* remove scroller for clients table specifically */
}

/* Make clients table more compact and responsive like staff table */
#clientsTable {
  font-size: 12px;
}

#clientsTable th, #clientsTable td {
  padding: 4px 6px;
}

#clientsTable td {
  white-space: normal; /* allow wrapping for long text */
}

#clientsTable thead th {
  font-size: 11px;
}

/* Transaction row (billing) - match staff table visual weight */
.tx-row {
  transition: background 0.15s ease;
}
.tx-row { border-bottom: 1px solid var(--border-color); }
.tx-row > div { padding: 8px 0; }

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: var(--bg-primary);
}

.account-id {
  font-weight: 600;
  color: var(--accent-teal);
  font-size: 12px;
}

.status-badge {
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.status-badge.expired { background: var(--badge-expired-bg); color: var(--badge-expired-color); }
.status-badge.online { color: var(--badge-online-color); }
.status-badge.offline { border: 2px solid #0F083C; }
.status-badge.paid { background: var(--badge-paid-bg); color: var(--badge-paid-color); }
.status-badge.pending { background: var(--badge-pending-bg); color: var(--badge-pending-color); }

.action-btns {
  display: flex;
  gap: 4px;
}

.btn-icon {
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
  border: none;
  background: none;
}

/* Eye icon button style (compact) */
.btn-eye,.btn-topup {
  display:flex; align-items:center; justify-content:center; border-radius:6px; background:none; border:none; cursor:pointer;
  padding: 2px;
}

td {
  font-size: 13px !important;
}

.top-table-text
{
  font-weight: 600;
  font-size:13px;  
  overflow:hidden; 
  text-overflow:ellipsis; 
  white-space:nowrap;
}

.bottom-table-text {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 7px;
  align-items: center;
}

.form-response
{
  display: block;
  margin-top: 14px; 
  padding: 10px 12px; 
  background: rgba(37, 99, 235, 0.1); 
  border-radius: 8px; 
  font-size: 12px; 
  color: var(--text-secondary); 
  display: flex; 
  align-items: center; 
  gap: 8px;
}

.form-response.success {
  color: green; /* Success color */
}

.form-response.error {
  color: red; /* Error color */
}

/* Modal Preloader - Unified styling for all modals */
.modal-preloader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 44px;
}

.modal-preloader.hidden {
  display: none;
}

.modal-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.08);
  border-top-color: #0F083C;
  animation: preloader-spin 0.9s linear infinite;
}

/* Modal Response Message - Shows feedback inside modal */
.modal-response {
  display: none;
  padding: 10px 12px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.modal-response.show {
  display: block;
}

.modal-response.success {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
  border-left: 3px solid #16a34a;
  padding-left: 9px;
}

.modal-response.error {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border-left: 3px solid #dc2626;
  padding-left: 9px;
}

/* Reuse staff filter button visual style */

.filter-btn {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  border: 1.5px solid #d3421a;
  background: transparent;
  cursor: pointer;
  color: #0F083C;
  transition: all 0.2s ease;
  user-select: none;
  display: inline-block;
}

.filter-btn:hover {
  background: rgba(15, 8, 60, 0.08);
  border-color: #d3421a;
  transform: translateY(-1px);
}

.filter-btn:active {
  transform: translateY(0px);
}

.filter-btn.active {
  background: #d3421a;
  border-color: #d3421a;
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(211, 66, 26, 0.3);
}

.btn-icon:hover {
  transform: scale(1.05);
}

.btn-icon.edit { color: var(--accent-blue); }
.btn-icon.edit:hover { background: var(--hover-edit-bg); }

.btn-icon.delete { color: var(--error); }
.btn-icon.delete:hover { background: var(--hover-delete-bg); }

.btn-icon.view { color: var(--success); }
.btn-icon.view:hover { background: var(--hover-view-bg); }

/* Color theming for copy/download icons */
.btn-icon.btn-copy { color: var(--accent-blue); }
.btn-icon.btn-download { color: var(--success); }

.btn-icon svg {
  width: 24px;
  height: 24px;
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

/* Small variant of system button for compact header controls */
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
}

/* Fluid header actions row for billing page */
.table-actions .actions-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.table-actions .actions-row .search-input {
  flex: 1 1 240px; /* grow and shrink, but prefer 240px */
  min-width: 160px;
}

.table-actions .actions-row .btn {
  flex: 0 0 auto;
}

.btn svg.btn-icon-sm {
    width: 16px;
    height: 16px;
}

.btn:active {
  transform: scale(0.98);
}

/* Make badges inline and never wrap their text */
.status-badge 
{ 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  white-space: nowrap; 
  padding: 0px 10px; 
  border-radius: 999px; 
  font-size: 12px; 
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-outline-primary
{
  background: transparent;
  color: var(--text-primary);
  border: 1px solid #0F083C;
}

.btn-secondary {
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline {
  background: transparent;
  color: #0F083C;
  border: 1.5px solid #0F083C;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.btn-outline:hover {
  background: rgba(15,8,60,0.10);
  color: #fff;
}

/* Toggle Button Group - For Individual/Group selection */
.toggle-btn-group {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  text-align: center;
}

.toggle-btn:hover {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

.toggle-btn.active {
  background: transparent;
  border-color: #2563eb;
  color: #2563eb;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.toggle-btn.active:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: #1d4ed8;
  color: #1d4ed8;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #d3421a;
  text-decoration: none;
  border-radius: var(--radius-md);
  min-width: 60px;
}

.nav-item.active {
  color: #0F083C;
  /*background: #0F083C;*/
}

.nav-item:hover {
  color: var(--primary-red);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  /* Keep modals above the global preloader overlay */
  z-index: 10050;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Entity rows: make name and amount sit side-by-side with polished styling */
#entitySection {
  margin-top: 6px;
}
#entityRows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.entity-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: rgba(15,8,60,0.02);
  border-radius: 8px;
}
.entity-row + .entity-row { border-top: 1px dashed rgba(0,0,0,0.04); }
.entity-row input[type="text"], .entity-row input[type="number"] {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.06);
  background: #fff;
  color: var(--text-primary);
  font-size: 13px;
}
.entity-row input[type="text"] { flex: 1; min-width: 0; }
.entity-row input[type="number"] { width: 120px; flex: 0 0 120px; }
.entity-row button { flex: 0 0 auto; }

/* Stronger rules to ensure inputs stay side-by-side inside the entity row */
.entity-row { flex-wrap: nowrap; }
.entity-row .form-input, .entity-row input { width: auto !important; }
.entity-row .btn-danger { margin-left: 8px; margin-right: 0; }
.entity-row .remove-spacer { margin-left: auto; }

/* Responsive: stack vertically on very narrow screens */
@media (max-width: 520px) {
  .entity-row {
    flex-direction: column;
    align-items: stretch;
  }
  .entity-row input[type="number"] { width: 100%; flex: 1; }
  .entity-row button { align-self: flex-end; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideDown {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(50px); opacity: 0; }
}

/* Graceful hide state for modals - used when we want to wait for animationend before fully removing */
.modal.hiding {
  display: flex; /* keep visible while animation runs */
  animation: fadeOut 0.25s ease forwards;
}

.modal.hiding .modal-content {
  animation: slideDown 0.3s ease forwards;
}

/* Global confirm modal should appear above other overlays/backdrops */
.modal.global-confirm {
  z-index: 11060; /* above other modal/backdrop layers */
}

.modal.global-confirm .modal-content {
  max-width: 420px;
}

.modal-card
{
  position: relative; 
  background: var(--bg-primary, #fff); 
  border-radius: 12px; 
  padding: 20px; 
  width: min(620px, 96%); 
  box-shadow: 0 20px 50px rgba(0,0,0,0.2); 
  z-index:2;
  pointer-events: auto;
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  display: flex;
  margin-bottom: 15px;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-secondary);
}

/* ============ Unified Modal Response System ============ */
/* Use these classes across all modal types for consistent response display */

.modal-response {
  display: none;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin: 12px 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
  border-left: 4px solid #ddd;
}

.modal-response.show {
  display: block;
}

.modal-response.success {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  border-left-color: #10b981;
}

.modal-response.error {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border-left-color: #ef4444;
}

.modal-response.warning {
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
  border-left-color: #f59e0b;
}

.modal-response.info {
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
  border-left-color: #3b82f6;
}

/* Dark theme support for modal responses */
[data-theme="dark"] .modal-response.success {
  background: rgba(16, 185, 129, 0.12);
  color: #86efac;
}

[data-theme="dark"] .modal-response.error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

[data-theme="dark"] .modal-response.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

[data-theme="dark"] .modal-response.info {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

/* Modal footer unified styling */
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  margin-top: 12px;
}
.modal-close:hover {
  color: var(--error);
}

.modal-body {
  padding: 9px 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Modal details grid used by Plan Details and similar modals */
.modal-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  align-items: center;
}
/* Keep any legacy details-col usage working, but most modals use .detail-row directly */
.modal-details-grid .details-col { display:flex; flex-direction:column; gap:10px; }
.modal-details-grid .detail-row {
  font-size:14px;
  display:flex;
  flex-direction:column; /* label on top of value */
  align-items:flex-start;
  gap:6px;
  width:100%;
  min-width: 0; /* allow contents to shrink in tight containers */
  padding: 6px 0;
}
.modal-details-grid .detail-label {
  color:var(--text-secondary);
  font-weight:400; /* light weight for labels */
  font-size:12px; /* smaller label text */
  display:block;
  margin: 0;
}
.modal-details-grid .detail-value {
  color:var(--text-primary);
  font-weight:700; /* make values bold */
  font-size:14px;
  display:block;
  margin: 0;
  word-break: break-word; /* allow long values to wrap inside their cell */
}

/* Keep two columns by default; stack only on very narrow screens */
@media (max-width: 340px) {
  .modal-details-grid { grid-template-columns: 1fr; }
}

/* Confirmation modal (dial-up) styles - matches system modal tokens */
.confirm-action-modal .modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  width: min(520px, 92%);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  max-width: 520px;
  text-align: left;
}

.confirm-action-modal #confirmActionTitle {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px 0;
}

.confirm-action-modal #confirmActionMsg {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 8px 0;
}

/* Modal buttons - reuse names used across pages */
.btn-modal-cancel {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(0,0,0,0.06);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  min-width: 96px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

/* Hide native scrollbars but keep scrolling functional */
/* Apply to modal form content areas so mobile/desktop can still scroll by touch/wheel/keyboard */
.hide-scrollbar, #addClientFormContent, #editClientFormContent, #editPlanFormContent {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar, #addClientFormContent::-webkit-scrollbar, #editClientFormContent::-webkit-scrollbar, #editPlanFormContent::-webkit-scrollbar {
  display: none; /* WebKit browsers */
  width: 0; height: 0;
}
/* ensure smooth touch scrolling on iOS */
#addClientFormContent, #editClientFormContent, #editPlanFormContent { -webkit-overflow-scrolling: touch; }

/* Optional: reveal a thin scrollbar on hover for desktop users (improves discoverability) */
.hide-scrollbar:hover, #addClientFormContent:hover, #editClientFormContent:hover, #editPlanFormContent:hover {
  scrollbar-width: thin; /* Firefox will show thin scrollbar on hover */
}

.btn-modal-cancel:hover { background: rgba(0,0,0,0.04); }

.btn-modal-danger:disabled { opacity: 0.7; cursor: default; }

/* Forms */
.form-group {
  margin-bottom: 5px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #B58424;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Search Bar */
.search-bar {
  position: relative;
  margin-bottom: 16px;
  padding-top: 5px;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 14px;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 70%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.search-icon svg {
  width: 18px;
  height: 18px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.3s ease;
}

.toggle-switch.active {
  background: var(--accent-blue);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.toggle-switch.active .toggle-thumb {
  transform: translateX(22px);
}

/* Login Page Specific */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e3e8ef 100%);
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px 30px;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 100%;
  position: relative;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 60px;
}

.market-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(39, 174, 96, 0.4) !important;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}

/* Login error styling */
.error-message {
  /* Toast-style popup used on login and other pages */
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--error);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  min-width: 180px;
  text-align: center;
}

.error-message.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Success variant */
.error-message.success {
  background: var(--success);
}

/* Error variant (default) */
.error-message.error {
  background: var(--error);
}

/* Custom Toast Notification */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.toast {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease, fadeOut 0.5s ease 2.7s forwards;
  transform: translateX(110%);
}

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

.toast-icon {
  font-size: 20px;
}

.toast.success { background-color: var(--success); color: white; }
.toast.error { background-color: var(--error); color: white; }
.toast.info { background-color: var(--info); color: white; }

/* Modal Toast (floating center) */
.modal-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #0F083C; /* outline using requested color */
  background: rgba(255,255,255,0.98); /* subtle background, not full color */
  color: #0F083C; /* text uses the color */
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 30px rgba(15,8,60,0.08);
  animation: modalToastIn 900ms cubic-bezier(.2,.9,.2,1) forwards;
  opacity: 0;
  max-width: 320px;
  z-index: 11000;
  pointer-events: none; /* don't block clicks */
}

@keyframes modalToastIn {
  0% { opacity: 0; transform: translate(-50%, -45%) scale(0.98); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(0.98); }
}

/* Tooltip for individual voucher code cards */
.voucher-tooltip {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) translateY(-2px) scale(0.98);
  background: #0F083C;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 12000;
  box-shadow: 0 6px 18px rgba(15,8,60,0.12);
  opacity: 0;
}


@keyframes slideInRight {
  from { transform: translateX(110%); }
  to { transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; display: none; }
}


/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.ms-3 { margin-left: 24px;}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none; }

/* Responsive */
@media (max-width: 640px) {
  .action-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Mobile: show 1 full card + peek of next, no overflow cut */
  .carousel-container {
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .carousel-track {
    padding: 8px 16px;
    /* Snap scroll for mobile cards */
    scroll-snap-type: x mandatory;
  }

  .mikrotik-card {
    scroll-snap-align: start;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 10px 12px;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  /* Tablet: show more cards */
  .carousel-container {
    margin: 0;
    padding: 0 8px;
    overflow: visible;
  }

  .carousel-track {
    padding: 8px 0;
  }

  .mikrotik-card {
    flex: 0 0 calc(50vw - 30px);
    min-width: calc(50vw - 30px);
    max-width: calc(50vw - 30px);
  }
}

@media (min-width: 1025px) {
  /* Desktop: fixed width cards */
  .carousel-container {
    margin: 0;
    padding: 0 8px;
    overflow: visible;
  }

  .carousel-track {
    padding: 8px 0;
  }

  .mikrotik-card {
    flex: 0 0 280px;
    min-width: 280px;
    max-width: 280px;
  }

  .page-content {
    padding: 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Plan results modal styling to match billing visuals */
.plan-result {
  padding: 12px 16px;
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border-color);
  display: block;
}
.plan-result:last-child { border-bottom: none; }
.plan-result-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.plan-result-title { font-weight:700; font-size:15px; color:var(--text-primary); }
.plan-result-subtitle { font-size:13px; color:var(--text-secondary); margin-top:6px; }
.plan-result-right { flex: 0 0 auto; }
.plan-result-left { flex: 1 1 auto; min-width:0; }

.plan-result-details { padding-top:8px; font-size:13px; color:var(--text-secondary); }

/* Voucher modal scrollable content - improved for large batches */
#voucherDetailsContent > div[style*="overflow-y: auto"] {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

#voucherDetailsContent > div[style*="overflow-y: auto"]::-webkit-scrollbar {
  width: 6px;
}

#voucherDetailsContent > div[style*="overflow-y: auto"]::-webkit-scrollbar-track {
  background: transparent;
}

#voucherDetailsContent > div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 3px;
}

#voucherDetailsContent > div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-secondary);
}

/* ============================================
   INVOICE ITEMS COMPACT STYLES
   ============================================ */
.invoice-items-compact {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.invoice-items-table {
  display: flex;
  flex-direction: column;
  max-height: 150px;
  overflow-y: auto;
}

.invoice-items-table > div {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  align-items: center;
}

.invoice-items-table > div:last-child {
  border-bottom: none;
}

.invoice-items-table > div:hover {
  background: rgba(0, 0, 0, 0.01);
}

.invoice-items-table .item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invoice-items-table .item-left .item-desc {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.invoice-items-table .item-left .item-qty {
  font-size: 10px;
  color: var(--text-secondary);
}

.invoice-items-table .item-right {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.invoice-items-table .item-amount {
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.invoice-items-table .item-unit {
  font-size: 10px;
  color: var(--text-secondary);
}

.invoice-items-table::-webkit-scrollbar {
  width: 4px;
}

.invoice-items-table::-webkit-scrollbar-track {
  background: transparent;
}

.invoice-items-table::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.invoice-items-table::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

