/* =========================================================
   InvoiceTracker — main stylesheet (Fully Responsive)
   Mobile-first approach: 320px → 480px → 768px → 1024px → 1400px+
   ========================================================= */

:root {
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-warning: #d97706;
  --color-info: #0284c7;
  --color-muted: #6b7280;
  --color-bg: #f4f5f9;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #111827;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

*, *::before, *::after { box-sizing: border-box; }

.page-wrapper {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 50px;
  width: 100%;
}

/* ---------- Guest layout (login / register) ---------- */
.guest-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--color-surface);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  font-size: 20px;
  text-align: center;
  margin: 0 0 24px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
}
.btn-google:hover { background: #fafafa; text-decoration: none; }

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--color-muted);
  font-size: 13px;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}
.divider:not(:empty)::before { margin-right: 12px; }
.divider:not(:empty)::after { margin-left: 12px; }

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 15px;
  margin-bottom: 14px;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--color-primary); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23111827%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 10px auto;
  padding-right: 42px;
}

textarea.form-control { border-radius: var(--radius); resize: vertical; }

.btn-block { width: 100%; }

.btn-primary {
  background: #111827;
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
}
.btn-primary:hover { background: #000; }

.auth-footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 18px;
}

.auth-switch {
  text-align: center;
  font-size: 14px;
  margin-top: 20px;
  color: var(--color-muted);
}

/* =========================================================
   TOPBAR / HEADER
   ========================================================= */
.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 999;
  width: 100%;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: relative;
  gap: 10px;
  width: 100%;
}
.brand {
  font-weight: 800;
  font-size: 16px;
  color: var(--color-text);
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 90px);
}
.brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

/* Navigation links — hidden by default on mobile, shown on desktop */
.nav-links {
  display: none;
  gap: 8px;
  align-items: center;
  height: 100%;
}
.nav-links > a, .nav-dropdown-toggle {
  color: var(--color-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 0 4px;
  height: 56px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-links > a.active, .nav-links > a:hover,
.nav-dropdown-toggle.active, .nav-dropdown-toggle:hover,
.nav-item-dropdown:hover .nav-dropdown-toggle {
  color: var(--color-text);
  text-decoration: none;
  border-bottom-color: var(--color-primary);
}

.nav-item-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0,0,0,.12);
  min-width: 190px;
  z-index: 500;
  padding: 6px 0;
}
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}
.nav-item-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu.show {
  display: block;
}
.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--color-text);
  font-weight: 500;
  border-bottom: none !important;
  text-decoration: none;
}
.nav-dropdown-menu a:hover {
  background: var(--color-bg);
  color: var(--color-primary);
  text-decoration: none;
}
.nav-dropdown-menu a.active {
  background: #eef2ff;
  color: var(--color-primary);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.quota-pill {
  display: none;
  background: #eef2ff;
  color: var(--color-primary-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  flex-shrink: 0;
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; }
.user-chip span { display: none; }
.user-chip svg { display: none; }
.user-avatar-fallback {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* Mobile hamburger button — shown by default */
.mobile-menu-btn {
  display: inline-flex;
  background: none;
  border: none;
  color: var(--color-text);
  padding: 6px;
  cursor: pointer;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}
.mobile-menu-btn:hover { background: var(--color-bg); }

/* Mobile nav: slide-down panel */
.nav-links.mobile-show {
  display: flex;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-border);
  box-shadow: 0 14px 28px rgba(0,0,0,0.10);
  flex-direction: column;
  padding: 12px 20px;
  gap: 2px;
  height: auto;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  z-index: 1000;
}
.nav-links.mobile-show > a,
.nav-links.mobile-show .nav-dropdown-toggle {
  width: 100%;
  height: auto;
  padding: 12px 14px;
  border-radius: 8px;
  border-bottom: none;
  justify-content: space-between;
  font-size: 15px;
}
.nav-links.mobile-show > a.active,
.nav-links.mobile-show > a:hover,
.nav-links.mobile-show .nav-dropdown-toggle.active,
.nav-links.mobile-show .nav-dropdown-toggle:hover {
  background: #eef2ff;
  color: var(--color-primary);
  border-bottom: none;
}
.nav-links.mobile-show .nav-item-dropdown {
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  height: auto;
}
.nav-links.mobile-show .nav-dropdown-menu {
  position: static;
  box-shadow: none;
  border: none;
  background: #f8fafc;
  border-radius: 8px;
  margin: 2px 0 6px 12px;
  padding: 4px 0;
}
.nav-links.mobile-show .nav-dropdown-menu::before { display: none; }
.nav-links.mobile-show .nav-dropdown-menu a {
  padding: 10px 14px;
  border-radius: 6px;
}

/* Mobile-only account links inside nav — hidden by default */
.mobile-nav-only { display: none !important; }
.mobile-nav-divider { display: none; }
.nav-links.mobile-show .mobile-nav-only { display: flex !important; }
.nav-links.mobile-show .mobile-nav-divider {
  display: block;
  height: 1px;
  background: var(--color-border);
  margin: 8px 0;
}

.btn-link-muted {
  color: var(--color-muted);
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* =========================================================
   PAGE HEADER
   ========================================================= */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 20px; margin: 0; }
.page-subtitle { color: var(--color-muted); font-size: 14px; margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-solid { background: var(--color-primary); color: #fff; }
.btn-solid:hover { background: var(--color-primary-dark); }
.btn-outline { background: #fff; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: #f9fafb; }
.btn-danger-outline { background: #fff; border-color: #fecaca; color: var(--color-danger); }
.btn-danger-outline:hover { background: #fef2f2; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* =========================================================
   TOOLBAR: search + filters
   ========================================================= */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
  margin-bottom: 18px;
  background: var(--color-surface);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}
.search-box {
  position: relative;
  flex: 1 1 100%;
  min-width: 0;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 14px;
}
.search-box .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--color-muted); }

.select-control {
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  flex: 1 1 100%;
  min-width: 0;
  width: 100%;
}

.date-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 10px;
  flex: 1 1 100%;
  min-width: 0;
}
.date-filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.date-filter-group input[type="date"] {
  border: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  outline: none;
  background: transparent;
  padding: 4px 0;
  flex: 1;
  min-width: 0;
  width: 100%;
}

/* =========================================================
   CARD LIST (replaces tables)
   ========================================================= */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

/* Mobile-first: stacked cards */
.item-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  box-shadow: var(--shadow);
  width: 100%;
  min-width: 0;
}

.item-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.item-title {
  font-weight: 700;
  font-size: 15px;
  word-break: break-word;
  min-width: 0;
}
.item-sub {
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.item-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 10px 0;
  border-top: 1px dashed var(--color-border);
  border-bottom: 1px dashed var(--color-border);
  min-width: 0;
}
.meta-block {
  font-size: 13px;
  min-width: 0;
}
/* Hide invisible placeholder blocks on mobile */
.meta-block[style*="visibility:hidden"],
.meta-block[style*="visibility: hidden"] {
  display: none !important;
}
.meta-block .label {
  color: var(--color-muted);
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 2px;
}
.meta-block .value {
  font-weight: 700;
  white-space: normal;
  word-break: break-word;
}

.item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}
.item-actions .badge {
  margin-right: auto;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: #f3f4f6; color: #4b5563; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-muted);
  width: 100%;
}

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-info { color: var(--color-muted); font-size: 13px; }
.pagination-numbers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pagination-numbers button {
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
.pagination-numbers button.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.pagination-numbers button:disabled { opacity: .4; cursor: default; }

/* =========================================================
   FORMS (full page, not modal)
   ========================================================= */
.form-page {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 720px;
  width: 100%;
}
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }

.line-items-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.line-items-table th { text-align: left; font-size: 12px; color: var(--color-muted); padding-bottom: 8px; text-transform: uppercase; }
.line-items-table td { padding: 6px 6px 6px 0; }
.line-items-table input { width: 100%; }

/* =========================================================
   STAT CARDS (dashboard)
   ========================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}
.stat-card .label { color: var(--color-muted); font-size: 12px; margin-bottom: 6px; }
.stat-card .value { font-size: 20px; font-weight: 800; word-break: break-all; }

/* =========================================================
   PRICING / QUOTA PACKAGES
   ========================================================= */
.pricing-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.pricing-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pricing-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.06); }
.pricing-card.featured {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary), 0 10px 25px rgba(79, 70, 229, 0.12);
}
.popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 14px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}
.pricing-card h3 { margin: 0 0 6px; font-size: 18px; }
.pricing-card .price { font-size: 28px; font-weight: 800; margin: 12px 0; color: var(--color-text); }
.pricing-card ul { list-style: none; padding: 0; margin: 18px 0; text-align: left; font-size: 13.5px; color: var(--color-muted); }
.pricing-card ul li { margin-bottom: 9px; display: flex; align-items: center; gap: 8px; }

/* Admin Package Row Styling */
.admin-pkg-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.2s;
}
.admin-pkg-card:hover { border-color: #cbd5e1; }
.admin-pkg-card.is-popular {
  border-color: var(--color-primary);
  background: #fafbff;
}
.pkg-feature-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pkg-tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
}
.pkg-tag.included { background: #ecfdf5; color: #047857; }
.input-currency-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}
.input-currency-prefix {
  position: absolute;
  left: 14px;
  font-weight: 700;
  color: #64748b;
  font-size: 14px;
  pointer-events: none;
}
.input-currency-wrapper .form-control {
  padding-left: 30px;
  margin-bottom: 0;
  font-weight: 600;
}

/* =========================================================
   CUSTOM MODAL (replaces alert/confirm)
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, .5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 380px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
}
.modal-box h3 { margin: 0 0 10px; font-size: 17px; }
.modal-box p { margin: 0 0 20px; color: var(--color-muted); font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* =========================================================
   PRELOADER
   ========================================================= */
.preloader-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  flex-direction: column;
  gap: 12px;
}
.preloader-overlay.show { display: flex; }
.spinner {
  width: 38px; height: 38px;
  border: 4px solid #e5e7eb;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.preloader-text { font-size: 13px; color: var(--color-muted); font-weight: 600; }

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed;
  top: 20px; right: 16px; left: 16px;
  background: #111827;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 3000;
  box-shadow: 0 10px 25px rgba(0,0,0,.2);
  max-width: 320px;
  margin-left: auto;
}
.toast.toast-error { background: var(--color-danger); }
.toast.toast-success { background: var(--color-success); }

.text-muted { color: var(--color-muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* =========================================================
   TABS
   ========================================================= */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 24px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-btn:hover { color: var(--color-text); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =========================================================
   USER DROPDOWN MENU
   ========================================================= */
.user-menu { position: relative; }
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0,0,0,.12);
  min-width: 180px;
  z-index: 500;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--color-text);
  font-weight: 500;
}
.user-dropdown a:hover { background: var(--color-bg); text-decoration: none; }
.dropdown-divider { border-top: 1px solid var(--color-border); margin: 4px 0; }

/* =========================================================
   SETTINGS PAGE
   ========================================================= */
.settings-section { margin-bottom: 28px; }
.settings-section h2 { font-size: 18px; margin: 0 0 16px; }
.settings-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 600px;
  margin-bottom: 20px;
}
.settings-card h3 { margin: 0 0 20px; font-size: 16px; }
.radio-group { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.field-group { margin-bottom: 16px; }
.field-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field-group .help-text { font-size: 12px; color: var(--color-muted); margin-top: 4px; }
.field-group .form-control { border-radius: 8px; }

/* =========================================================
   CHECKOUT PAGE
   ========================================================= */
.checkout-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.order-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  position: static;
}
.order-summary h3 { margin: 0 0 16px; font-size: 16px; }
.order-summary .summary-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 10px; }
.order-summary .summary-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; border-top: 2px solid var(--color-border); padding-top: 12px; margin-top: 12px; }

.payment-methods { margin-bottom: 24px; }
.payment-methods h3 { font-size: 16px; margin: 0 0 14px; }
.payment-method-group { margin-bottom: 20px; }
.payment-method-group h4 { font-size: 14px; color: var(--color-muted); margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.03em; }
.payment-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.payment-option:hover { border-color: var(--color-primary); }
.payment-option.selected { border-color: var(--color-primary); background: #eef2ff; }
.payment-option input[type="radio"] { accent-color: var(--color-primary); }
.payment-option .method-name { font-weight: 600; font-size: 14px; }
.payment-option .method-detail { font-size: 12px; color: var(--color-muted); }

/* =========================================================
   PAYMENT STATUS PAGE
   ========================================================= */
.payment-status-page {
  text-align: center;
  max-width: 480px;
  margin: 40px auto;
  padding: 40px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
}
.status-icon.success { background: #dcfce7; color: #166534; }
.status-icon.pending { background: #fef3c7; color: #92400e; }
.status-icon.failed { background: #fee2e2; color: #991b1b; }
.status-icon.expired { background: #f3f4f6; color: #4b5563; }
.payment-status-page h2 { font-size: 22px; margin: 0 0 8px; }
.payment-status-page .status-desc { color: var(--color-muted); font-size: 14px; margin-bottom: 24px; }
.payment-status-page .status-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* =========================================================
   PROFILE PAGE
   ========================================================= */
.profile-form { max-width: 500px; }
.profile-form .form-control { border-radius: 8px; }
.profile-form .form-control:disabled { background: #f3f4f6; color: var(--color-muted); cursor: not-allowed; }

/* Table Container with Horizontal Scroll */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}


/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */

/* ---- Tablet portrait (≥ 768px) ---- */
@media (min-width: 768px) {
  .topbar { padding: 0 24px; }
  .topbar-inner { height: 64px; }

  .container { padding: 24px 24px 60px; }

  .quota-pill { display: inline-block; }
  .user-chip span { display: inline-block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
  .user-chip svg { display: inline; }

  /* Toolbar: 2-col dates, 3-col selects */
  .search-box { flex: 1 1 100%; }
  .date-filter-group { flex: 1 1 calc(50% - 5px); }
  .select-control { flex: 1 1 calc(33.33% - 7px); width: auto; }

  /* Stat grid 2 col */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }

  /* Pricing grid 2 col */
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }

  /* Form grid 2 col */
  .form-grid-2 { grid-template-columns: 1fr 1fr; }

  /* Checkout grid 2 col */
  .checkout-grid { grid-template-columns: 1fr 340px; }
  .order-summary { position: sticky; top: 88px; }

  /* Admin package cards horizontal */
  .admin-pkg-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
  }
  .input-currency-wrapper { width: 170px; }
}

/* ---- Desktop (≥ 1024px) ---- */
@media (min-width: 1024px) {
  .topbar-inner { height: 64px; }

  /* Show desktop nav, hide hamburger */
  .nav-links {
    display: flex !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    flex-direction: row !important;
    background: transparent !important;
    box-shadow: none !important;
    border-bottom: none !important;
    padding: 0 !important;
    gap: 16px !important;
    height: 100% !important;
    max-height: none !important;
    overflow-y: visible !important;
  }
  .nav-links > a, .nav-dropdown-toggle {
    height: 64px !important;
    padding: 0 4px !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    font-size: 14px !important;
    width: auto !important;
    justify-content: center !important;
  }
  .nav-links > a.active,
  .nav-dropdown-toggle.active,
  .nav-item-dropdown:hover .nav-dropdown-toggle {
    border-bottom-color: var(--color-primary) !important;
    background: transparent !important;
  }
  .nav-item-dropdown {
    width: auto !important;
    flex-direction: row !important;
    height: 100% !important;
  }
  .nav-dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    box-shadow: 0 10px 25px rgba(0,0,0,.12) !important;
    border: 1px solid var(--color-border) !important;
    background: var(--color-surface) !important;
    border-radius: var(--radius) !important;
    margin: 0 !important;
  }
  .nav-dropdown-menu::before { display: block !important; }

  .mobile-menu-btn { display: none !important; }

  /* Item cards horizontal row on desktop */
  .item-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
  }
  .item-main {
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    width: 200px;
    flex-shrink: 0;
    gap: 4px;
  }
  .item-sub {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 400;
  }
  .item-meta {
    display: flex;
    flex-direction: row;
    grid-template-columns: unset;
    gap: 16px;
    flex: 1;
    border-top: none;
    border-bottom: none;
    padding: 0;
    min-width: 0;
  }
  .meta-block {
    min-width: 0;
    flex: 1 1 0;
  }
  .meta-block[style*="visibility:hidden"],
  .meta-block[style*="visibility: hidden"] {
    display: block !important;
  }
  .meta-block .label { font-size: 11px; }
  .meta-block .value {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.35;
  }
  .item-actions {
    justify-content: flex-end;
    flex-shrink: 0;
    flex-wrap: nowrap;
    gap: 8px;
    width: 220px;
  }
  .item-actions .badge { margin-right: 0; }

  /* Stat grid 4 col */
  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stat-card .value { font-size: 24px; }

  /* Pricing grid 4 col */
  .pricing-grid { grid-template-columns: repeat(4, 1fr); }

  /* Toolbar all in one row */
  .search-box { flex: 1 1 auto; min-width: 200px; }
  .date-filter-group { flex: 0 1 auto; }
  .select-control { flex: 0 1 auto; width: auto; }
}

/* ---- Large monitor (≥ 1400px) ---- */
@media (min-width: 1400px) {
  .topbar-inner, .container {
    max-width: 1320px;
  }
  .container { padding: 32px 32px 60px; }
  .topbar { padding: 0 32px; }

  .item-main { width: 220px; }
  .item-meta { gap: 24px; }
  .meta-block { min-width: 0; flex: 1 1 0; }
  .item-actions { width: 220px; }
}

/* =========================================================
   USER MANAGEMENT: checkbox, bulk bar, avatar
   ========================================================= */
.card-checkbox {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.card-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  margin: 0;
}
.card-checkbox input[type="checkbox"]:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.item-card.selected {
  border-color: var(--color-primary);
  background: #fafaff;
}

.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 14px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.bulk-select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.bulk-select-all-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.user-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}
.user-card-avatar.user-avatar-fallback {
  width: 36px;
  height: 36px;
  font-size: 15px;
}

/* =========================================================
   PASSWORD INPUT WITH EYE TOGGLE
   ========================================================= */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 14px;
}
.password-input-wrapper .form-control {
  margin-bottom: 0 !important;
  padding-right: 44px !important;
}
.toggle-password-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s, background-color 0.15s;
  z-index: 2;
}
.toggle-password-btn:hover {
  color: var(--color-text);
  background-color: rgba(0, 0, 0, 0.05);
}
.toggle-password-btn:focus {
  outline: none;
  color: var(--color-primary);
}

/* ---------- Floating Bottom Footer ---------- */
.floating-footer {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
  pointer-events: none;
  width: auto;
  max-width: calc(100vw - 32px);
}

.floating-footer-inner {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  font-size: 13px;
  color: var(--color-muted);
  white-space: nowrap;
}

.floating-footer-inner .footer-copy {
  font-weight: 500;
  color: #4b5563;
}

.floating-footer-inner .footer-separator {
  color: #9ca3af;
  font-weight: bold;
}

.floating-footer-inner .footer-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.floating-footer-inner .footer-link:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

@media (max-width: 600px) {
  .floating-footer {
    bottom: 10px;
  }
  .floating-footer-inner {
    padding: 6px 14px;
    gap: 8px;
    font-size: 11.5px;
  }
}

/* Ensure content is not hidden behind floating footer */
.container {
  padding-bottom: 75px !important;
}

.guest-wrapper {
  padding-bottom: 75px !important;
}

/* ---------- Legal pages (Terms & Privacy) ---------- */
.legal-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  padding: 36px 40px;
  max-width: 900px;
  margin: 0 auto;
}

.legal-card h2, .legal-card h3 {
  color: var(--color-text);
  margin-top: 24px;
  margin-bottom: 8px;
  font-size: 18px;
}

.legal-card h2:first-child, .legal-card h3:first-child {
  margin-top: 0;
}

.legal-card p {
  color: #374151;
  line-height: 1.7;
  margin-bottom: 14px;
  font-size: 15px;
}

.legal-card ul, .legal-card ol {
  color: #374151;
  line-height: 1.7;
  margin-bottom: 14px;
  padding-left: 24px;
}

.legal-card li {
  margin-bottom: 6px;
}

@media (max-width: 768px) {
  .legal-card {
    padding: 24px 18px;
  }
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.public-header .brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
}
.public-header .public-nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}
.legal-container {
  max-width: 940px;
  margin: 32px auto 0;
  padding: 0 20px 85px;
}

