/**
 * ============================================================
 * Token Service — Unified Design System
 * ============================================================
 * A self-contained, framework-free CSS file for the Token Service
 * web application. Styles both the Admin Dashboard and User Portal.
 *
 * Features:
 *   - CSS Custom Properties with light/dark theming
 *   - Mobile-first responsive design
 *   - Progressive enhancement (works without JS)
 *   - Accessibility focused (focus states, contrast, reduced motion)
 *   - Zero external dependencies
 *
 * Sections:
 *   1. CSS Variables & Theme System
 *   2. Base / Reset
 *   3. Layout
 *   4. Navigation (Admin & User)
 *   5. Cards
 *   6. Tables
 *   7. Buttons
 *   8. Forms
 *   9. Badges
 *  10. Navigation Elements
 *  11. Order-Specific Components
 *  12. Expandable Rows
 *  13. Bulk Actions Bar
 *  14. Pagination
 *  15. Tooltips
 *  16. Empty State
 *  17. Alerts / Messages
 *  18. Checkbox
 *  19. Dropdown (Action Menus)
 *  20. Hero Section (Home Page)
 *  21. Footer
 *  22. Accessibility
 *  23. Toast
 *  24. Responsive Breakpoints
 *  25. Utility Classes
 *  26. Print Styles
 *  27. prefers-reduced-motion
 * ============================================================
 */


/* ============================================================
   1. CSS VARIABLES & THEME SYSTEM
   ============================================================ */

:root {
  /* Primary brand color — emerald green */
  --primary: #00b894;
  --primary-hover: #00a383;
  --primary-light: rgba(0, 184, 148, 0.15);
  --primary-rgb: 0, 184, 148;

  /* Semantic colors */
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #d63031;
  --info: #74b9ff;

  /* Backgrounds */
  --bg-body: #f8f9fa;
  --bg-card: #ffffff;
  --bg-table-header: #f8f9fa;
  --bg-hover: #f8f9fa;
  --bg-selected: rgba(0, 184, 148, 0.08);
  --bg-input: #f8f9fa;
  --bg-pill: #e9ecef;

  /* Text */
  --text-primary: #2d3436;
  --text-secondary: #636e72;
  --text-muted: #b2bec3;

  /* Borders */
  --border-color: #dfe6e9;
  --border-light: #f1f3f4;

  /* Shadows */
  --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 24px rgba(0, 0, 0, 0.12);
  --shadow-dropdown: 0 10px 25px rgba(0, 0, 0, 0.15);

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Layout */
  --container-max: 1400px;
  --border-radius: 10px;
  --border-radius-sm: 6px;
  --border-radius-xs: 4px;

  /* Smooth theme transitions */
  --transition-theme: background 0.3s ease, color 0.3s ease,
    border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Dark theme overrides */
[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-table-header: #1e293b;
  --bg-hover: #25282c;
  --bg-selected: rgba(0, 184, 148, 0.15);
  --bg-input: #2d3436;
  --bg-pill: #2d3436;
  --text-primary: #f5f6fa;
  --text-secondary: #b2bec3;
  --text-muted: #636e72;
  --border-color: #2d3436;
  --border-light: #2d3436;
  --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 24px rgba(0, 0, 0, 0.5);
  --shadow-dropdown: 0 10px 25px rgba(0, 0, 0, 0.5);
}


/* ============================================================
   2. BASE / RESET
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition-theme);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.875rem; }
h6 { font-size: 0.8rem; }

/* Paragraphs */
p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--border-radius-xs);
}

/* Code / Monospace */
code,
.token-value,
.token-mask,
.order-id,
.mono {
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
}

code {
  background: var(--bg-pill);
  padding: 0.15rem 0.4rem;
  border-radius: var(--border-radius-xs);
  font-size: 0.85em;
}

pre {
  background: var(--bg-pill);
  padding: var(--space-md);
  border-radius: var(--border-radius);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--space-lg) 0;
}

/* Small text */
small {
  font-size: 0.875em;
  color: var(--text-secondary);
}

strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Structural elements */
article, section, header, footer {
  display: block;
}

/* Fieldsets & Legends */
fieldset {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

legend {
  font-weight: 600;
  padding: 0 var(--space-sm);
  color: var(--text-primary);
}

/* Selection */
::selection {
  background: var(--primary-light);
  color: var(--text-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}


/* ============================================================
   3. LAYOUT
   ============================================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-md);
  width: 100%;
}
/* ---- Page Content Headings ---- */
main.container h2:first-child {
  margin-top: 1.5rem;
}

h2 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}


/* Page header — flex row with title + actions */
.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}

/* Grid system */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.grid-4 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}


/* ============================================================
   4. NAVIGATION (ADMIN & USER)
   ============================================================ */

/* ---- Admin Navigation ---- */
.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  transition: var(--transition-theme);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0.75;
  text-decoration: none;
  transition: background 0.2s ease, opacity 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.nav-links a:hover {
  opacity: 1;
  background: var(--bg-hover);
  text-decoration: none;
}

.nav-links a.active {
  opacity: 1;
  color: var(--primary);
  font-weight: 600;
  background: var(--bg-hover);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Right-side nav actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Icon button (theme toggle, etc.) */
.nav-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  font-size: 1rem;
  padding: 0;
}

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

.nav-icon-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Logout button in nav */
.nav-logout-btn {
  padding: 0.4rem 0.875rem;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--border-radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-logout-btn:hover {
  background: var(--bg-hover);
  color: var(--danger);
  border-color: var(--danger);
  text-decoration: none;
}

/* ---- Hamburger Menu Button ---- */
.hamburger {
  display: flex;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  border-radius: var(--border-radius-sm);
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hamburger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---- Mobile Drawer (Nav Overlay) ---- */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-overlay.open {
  display: block;
  opacity: 1;
}

/* ---- Mobile Drawer Panel ---- */
.nav-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  flex-direction: column;
}

.nav-drawer.open {
  display: flex;
  flex-direction: column;
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.drawer-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.drawer-brand:hover {
  text-decoration: none;
}

.drawer-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  font-size: 1.25rem;
  color: var(--text-secondary);
  transition: background 0.2s ease;
  padding: 0;
}

.drawer-close:hover {
  background: var(--bg-hover);
}

.drawer-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Drawer navigation links */
.drawer-nav {
  list-style: none;
  margin: 0;
  padding: var(--space-sm) 0;
  flex: 1;
}

.drawer-nav li {
  margin: 0;
  padding: 0;
}

.drawer-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem var(--space-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
  border-radius: 0;
}

.drawer-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.drawer-nav a.active {
  background: var(--bg-selected);
  color: var(--primary);
  font-weight: 600;
}

.drawer-nav a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.drawer-nav a .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Drawer footer */
.drawer-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.drawer-footer .logout-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.5rem;
  color: var(--danger);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  transition: background 0.2s ease;
}

.drawer-footer .logout-link:hover {
  background: rgba(214, 48, 49, 0.1);
  text-decoration: none;
}

/* ---- User Navigation (simpler) ---- */
.user-nav,
nav.container-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem var(--space-md);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: var(--space-sm);
  transition: var(--transition-theme);
}

.user-nav .nav-brand,
nav.container-fluid .nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.user-nav .nav-links,
nav.container-fluid .nav-links {
  display: none;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.user-nav .nav-links a,
nav.container-fluid .nav-links a {
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
}

.user-nav .nav-links a:hover,
nav.container-fluid .nav-links a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.user-nav .nav-links a.active,
nav.container-fluid .nav-links a.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--bg-hover);
}

/* Container fluid support */
.container-fluid {
  width: 100%;
  padding: 0 var(--space-md);
  margin: 0 auto;
}


/* ============================================================
   5. CARDS
   ============================================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition-theme);
  border: 1px solid var(--border-light);
}

.card > header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.card > header h2,
.card > header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.card > footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.card > .card-body {
  padding: var(--space-md);
}

/* ---- Stat Cards ---- */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 0.875rem 1rem;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

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

.stat-card.active {
  border-color: var(--primary);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Stat card color variants */
.stat-card.all .stat-value { color: var(--text-primary); }
.stat-card.pending .stat-value { color: var(--warning); }
.stat-card.completed .stat-value { color: var(--success); }
.stat-card.failed .stat-value { color: var(--danger); }
.stat-card.revenue .stat-value { color: var(--info); }

/* ---- Stats Row (5-column grid) ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

/* ---- Stats Grid (auto-fit) ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

/* ---- Table Card (wrapper for tables) ---- */
.table-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
  transition: var(--transition-theme);
}

/* ---- Filters Card ---- */
.filters-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  border: 1px solid var(--border-light);
  transition: var(--transition-theme);
}

/* ---- Portal Card (home page) ---- */
.portal-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.portal-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  text-decoration: none;
  color: inherit;
}

.portal-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}


/* ============================================================
   6. TABLES
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-md);
  position: relative;
}

/* Scroll shadow indicators */
.table-wrapper::before,
.table-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.table-wrapper.has-scroll-left::before {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.05), transparent);
  opacity: 1;
}

.table-wrapper.has-scroll-right::after {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.05), transparent);
  opacity: 1;
}

[data-theme="dark"] .table-wrapper.has-scroll-left::before {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.25), transparent);
}

[data-theme="dark"] .table-wrapper.has-scroll-right::after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.25), transparent);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

/* Table header */
thead {
  background: var(--bg-table-header);
  border-bottom: 2px solid var(--border-color);
  transition: var(--transition-theme);
}

th {
  padding: 0.875rem 1rem;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-table-header);
}

/* Table cells */
td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-primary);
  transition: var(--transition-theme);
}

/* Row interactions */
tbody tr {
  transition: background 0.15s ease;
}

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

tbody tr.selected {
  background: var(--bg-selected);
}

tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.01);
}

[data-theme="dark"] tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

tbody tr:nth-child(even):hover {
  background: var(--bg-hover);
}

/* Sticky header support for scrolling tables */
.table-wrapper thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Table footer row */
tfoot td {
  font-weight: 600;
  border-top: 2px solid var(--border-color);
  background: var(--bg-table-header);
}


/* ============================================================
   7. BUTTONS
   ============================================================ */

button {
  font-family: inherit;
}

.btn,
[role="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

/* Primary button */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  text-decoration: none;
}

/* Outline button */
.btn-outline {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
  text-decoration: none;
}

/* Danger button (solid) */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #b52b2b;
  border-color: #b52b2b;
  color: #fff;
  text-decoration: none;
}

/* Danger outline variant */
.btn-outline-danger {
  background: var(--bg-card);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-outline-danger:hover {
  background: rgba(214, 48, 49, 0.1);
  color: var(--danger);
  text-decoration: none;
}

/* Small button */
.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.85rem;
  gap: 0.35rem;
}

/* Apply button (primary, fixed height) */
.btn-apply {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  height: 38px;
  padding: 0 1rem;
  font-size: 0.85rem;
}

.btn-apply:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

/* Ghost button (minimal) */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

/* Full-width button */
.btn-block {
  width: 100%;
}

/* Disabled state */
.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}


/* ============================================================
   8. FORMS
   ============================================================ */

/* Base inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.2s ease, background 0.2s ease,
    box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

/* Labels */
label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* Select dropdown arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636e72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b2bec3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Textarea */
textarea {
  resize: vertical;
  min-height: 100px;
}

/* ---- Search Box ---- */
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}

.search-box input {
  padding-left: 2.25rem;
  width: 100%;
}

/* ---- Date Filters ---- */
.date-filters {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  background: var(--bg-pill);
  padding: 0.25rem;
  border-radius: var(--border-radius-sm);
  height: 38px;
  flex-shrink: 0;
}

.date-btn {
  height: 30px;
  padding: 0 0.75rem;
  border: none;
  background: transparent;
  border-radius: var(--border-radius-xs);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.date-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.date-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---- Filters Row ---- */
.filters-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

/* ---- Controls Row (filters + actions) ---- */
.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

/* Form group */
.form-group {
  margin-bottom: var(--space-md);
}

/* Inline form layout */
.form-inline {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
  flex-wrap: wrap;
}

/* Form hint / help text */
.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Input with error */
input.is-error,
select.is-error,
textarea.is-error {
  border-color: var(--danger);
}

input.is-error:focus,
select.is-error:focus,
textarea.is-error:focus {
  box-shadow: 0 0 0 3px rgba(214, 48, 49, 0.15);
}


/* ============================================================
   9. BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.625rem;
  border-radius: var(--border-radius-xs);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-success {
  background: var(--success);
  color: #fff;
}

.badge-warning {
  background: var(--warning);
  color: #000;
}

.badge-danger {
  background: var(--danger);
  color: #fff;
}

.badge-info {
  background: var(--info);
  color: #000;
}

.badge-muted {
  background: var(--text-muted);
  color: #000;
}

/* Outline badge variants */
.badge-outline-success {
  background: rgba(0, 184, 148, 0.1);
  color: var(--success);
  border: 1px solid var(--success);
}

.badge-outline-danger {
  background: rgba(214, 48, 49, 0.1);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.badge-outline-warning {
  background: rgba(253, 203, 110, 0.15);
  color: #856404;
  border: 1px solid var(--warning);
}

.badge-outline-info {
  background: rgba(116, 185, 255, 0.1);
  color: var(--info);
  border: 1px solid var(--info);
}


/* ============================================================
   10. NAVIGATION ELEMENTS
   ============================================================ */

/* ---- Theme Toggle Button ---- */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---- Breadcrumbs ---- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

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

.breadcrumbs .separator {
  opacity: 0.4;
}

.breadcrumbs .current {
  color: var(--text-primary);
  font-weight: 500;
}

/* ---- Tab Navigation ---- */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-nav a,
.tab-nav button {
  padding: 0.625rem 1rem;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: inherit;
}

.tab-nav a:hover,
.tab-nav button:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab-nav a.active,
.tab-nav button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-nav a:focus-visible,
.tab-nav button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}


/* ============================================================
   11. ORDER-SPECIFIC COMPONENTS
   ============================================================ */

/* ---- Clickable Order ID ---- */
.order-id {
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-selected);
  border-radius: var(--border-radius-xs);
  transition: all 0.2s;
  user-select: none;
  border: none;
  font-weight: 500;
}

.order-id:hover {
  background: var(--primary-light);
}

.order-id:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.order-id .expand-icon {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.order-id.expanded .expand-icon {
  transform: rotate(90deg);
}

/* ---- User Link ---- */
.user-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  background: var(--bg-selected);
  border-radius: var(--border-radius-xs);
  transition: all 0.2s;
  font-size: 0.85rem;
}

.user-link:hover {
  background: var(--primary-light);
  text-decoration: none;
}

/* ---- Amount Display ---- */
.amount {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---- Date Cell ---- */
.date-cell {
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ---- Service Cell (truncated) ---- */
.service-cell {
  color: var(--text-primary);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Token Value Display ---- */
.token-value,
.token-mask {
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  word-break: break-all;
  font-size: 0.85rem;
  line-height: 1.5;
}

.token-display {
  background: var(--bg-hover);
  padding: var(--space-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-lg);
}

.token-display label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  display: block;
}

/* ---- Copy Button ---- */
.copy-btn {
  padding: 0.35rem 0.625rem;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: inherit;
}

.copy-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* ---- Status Dot ---- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
}

.status-dot.success { background: var(--success); }
.status-dot.warning { background: var(--warning); }
.status-dot.danger { background: var(--danger); }
.status-dot.info { background: var(--info); }
.status-dot.muted { background: var(--text-muted); }


/* ============================================================
   12. EXPANDABLE ROWS
   ============================================================ */

.expandable-row {
  display: none;
  background: var(--bg-hover);
}

.expandable-row.expanded {
  display: table-row;
}

.expandable-row td {
  padding: 0;
  border-bottom: 1px solid var(--border-color);
}

/* ---- Actions Panel (inside expanded row) ---- */
.actions-panel {
  padding: 0.75rem var(--space-md) 0.75rem 3.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  min-height: 52px;
}

/* ---- Action Button Row ---- */
.action-btn-row {
  padding: 0.5rem 0.875rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
  font-family: inherit;
  line-height: 1.4;
  text-decoration: none;
}

.action-btn-row:hover {
  background: var(--bg-body);
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.action-btn-row.danger {
  color: var(--danger);
  border-color: #fee2e2;
}

.action-btn-row.danger:hover {
  background: #fee2e2;
  border-color: var(--danger);
  color: var(--danger);
}

.action-btn-row.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.action-btn-row.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* ---- Section Divider ---- */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ---- Service Cards (user services page) ---- */
.services-section .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .services-section .grid {
    grid-template-columns: 1fr;
  }
}

h3 + .grid {
  margin-top: 0.75rem;
}

h2 + h3 {
  margin-top: 1.5rem;
}

.service-card .price {
  font-size: 1.5rem;
  color: var(--accent);
  margin: 0.5rem 0;
}

.service-card .price strong {
  font-weight: 700;
}

.service-card footer {
  text-align: center;
}


/* ---- Actions Divider ---- */
.actions-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 0.25rem;
}


/* ============================================================
   13. BULK ACTIONS BAR
   ============================================================ */

.bulk-bar {
  display: none;
  background: var(--primary);
  color: white;
  padding: 0.75rem var(--space-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-md);
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease;
}

.bulk-bar.visible {
  display: flex;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bulk-count {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.bulk-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.bulk-btn {
  padding: 0.4rem 0.75rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.bulk-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.bulk-btn.danger {
  background: var(--danger);
  border-color: rgba(214, 48, 49, 0.5);
}

.bulk-btn.danger:hover {
  background: #c0392b;
}


/* ============================================================
   14. PAGINATION
   ============================================================ */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem var(--space-md);
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.pagination-info {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.pagination-buttons {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.page-btn {
  padding: 0.4rem 0.625rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  font-family: inherit;
  font-weight: 500;
}

.page-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.page-btn.active,
.page-btn[aria-current="page"] {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Ellipsis in pagination */
.page-btn[aria-hidden="true"] {
  border-color: transparent;
  background: transparent;
  cursor: default;
  min-width: auto;
}


/* ============================================================
   15. TOOLTIPS
   ============================================================ */

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #2d3436;
  color: white;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 100;
  pointer-events: none;
  max-width: 280px;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Tooltip arrow */
.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #2d3436 transparent transparent transparent;
}

/* Show tooltip on hover of parent */
:hover > .tooltip,
.tooltip-trigger:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* Dark mode tooltip */
[data-theme="dark"] .tooltip {
  background: #f5f6fa;
  color: #2d3436;
}

[data-theme="dark"] .tooltip::after {
  border-color: #f5f6fa transparent transparent transparent;
}


/* ============================================================
   16. EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 3rem var(--space-md);
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  max-width: 480px;
  margin: 0 auto;
  border: 1px solid var(--border-light);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
  line-height: 1;
}

.empty-state h3 {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  font-size: 1.25rem;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  font-size: 0.9rem;
}

.empty-state .btn {
  margin-top: var(--space-sm);
}


/* ============================================================
   17. AUTH CARD (Login pages)
   ============================================================ */

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .auth-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.auth-card header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  border: none;
  padding: 0;
}

.auth-card form {
  margin-top: 1.5rem;
}

.auth-card .text-center {
  text-align: center;
  margin-top: 1.5rem;
}

.auth-card .alert {
  margin-top: 1rem;
}

/* ============================================================
   17. ALERTS / MESSAGES
   ============================================================ */

.alert {
  padding: var(--space-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-md);
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert-error {
  background: rgba(214, 48, 49, 0.08);
  border-color: var(--danger);
  color: #c0392b;
}

.alert-success {
  background: rgba(0, 184, 148, 0.1);
  border-color: var(--success);
  color: #00897b;
}

.alert-info {
  background: rgba(116, 185, 255, 0.1);
  border-color: var(--info);
  color: #1e88e5;
}

.alert-warning {
  background: rgba(253, 203, 110, 0.15);
  border-color: var(--warning);
  color: #856404;
}

/* Dark mode alert overrides */
[data-theme="dark"] .alert-error {
  background: rgba(214, 48, 49, 0.15);
  color: #ff7675;
}

[data-theme="dark"] .alert-success {
  background: rgba(0, 184, 148, 0.15);
  color: #55efc4;
}

[data-theme="dark"] .alert-info {
  background: rgba(116, 185, 255, 0.15);
  color: #74b9ff;
}

[data-theme="dark"] .alert-warning {
  background: rgba(253, 203, 110, 0.2);
  color: #ffeaa7;
}


/* ============================================================
   18. CHECKBOX
   ============================================================ */

.checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}


/* ============================================================
   19. DROPDOWN (Action Menus)
   ============================================================ */

.action-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-dropdown);
  min-width: 180px;
  z-index: 50;
  overflow: hidden;
  margin-top: 0.25rem;
  animation: fadeIn 0.15s ease;
}

.action-dropdown.open {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.875rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: rgba(214, 48, 49, 0.08);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.25rem 0;
}

.dropdown-header {
  padding: 0.5rem 0.875rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}


/* ============================================================
   20. HERO SECTION (Home Page)
   ============================================================ */

.hero {
  text-align: center;
  padding: 3rem var(--space-md) 2rem;
  background: linear-gradient(135deg, rgba(0, 184, 148, 0.12) 0%, transparent 60%);
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  background: linear-gradient(90deg, var(--primary), #00cec9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1rem;
  opacity: 0.75;
  max-width: 520px;
  margin: 0 auto;
  color: var(--text-secondary);
  line-height: 1.6;
}

.logo-hero {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-md);
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-lg);
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Dark mode hero */
[data-theme="dark"] .hero {
  background: linear-gradient(135deg, rgba(0, 184, 148, 0.06) 0%, transparent 60%);
}


/* ============================================================
   21. FOOTER
   ============================================================ */

footer {
  text-align: center;
  padding: 2rem var(--space-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  opacity: 0.7;
  margin-top: auto;
}

footer a {
  color: var(--text-secondary);
  text-decoration: underline;
  transition: color 0.15s;
}

footer a:hover {
  color: var(--primary);
}

.footer-compact {
  padding: 1rem var(--space-md);
  font-size: 0.8rem;
}


/* ============================================================
   22. ACCESSIBILITY
   ============================================================ */

/* Screen-reader only */
.visually-hidden,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  z-index: 10000;
  transition: top 0.2s;
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 0 0 var(--border-radius-sm) 0;
}

.skip-link:focus {
  top: 0;
}

/* Remove outline for mouse users, keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure focus-visible is prominent */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}


/* ============================================================
   23. TOAST NOTIFICATIONS
   ============================================================ */

.toast,
#copy-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  max-width: 320px;
  min-width: 200px;
  text-align: center;
  line-height: 1.4;
}

.toast.show,
#copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  background: var(--danger);
}

.toast-info {
  background: var(--info);
}

.toast-warning {
  background: var(--warning);
  color: #000;
}


/* ============================================================
   24. RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ---- Small devices (480px+) ---- */
@media (min-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }
}

/* ---- Small tablets (640px+) ---- */
@media (min-width: 640px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- Tablets (768px+) ---- */
@media (min-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

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

  .page-header {
    flex-direction: row;
    align-items: center;
  }

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

  .filters-row {
    flex-direction: row;
    align-items: center;
  }

  .search-box {
    max-width: 350px;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .actions-panel {
    padding-left: 3.5rem;
  }

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

/* ---- Desktop (1024px+) ---- */
@media (min-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(5, 1fr);
  }

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

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

  /* Show desktop nav, hide mobile elements */
  .user-nav .nav-links {
    display: flex !important;
  }

  .hamburger {
    display: none !important;
  }

  .nav-overlay,
  .nav-drawer {
    display: none !important;
  }
}


/* ---- Tablet (768px - 1199px) ---- */
/* Hamburger is visible by default (mobile-first), no rule needed */
/* Nav-links is hidden by default (mobile-first), shown at 1024px */


/* ---- Drawer Mobile Actions (visible only on mobile) ---- */
.drawer-mobile-actions {
  display: flex;
  padding: 0.75rem var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.drawer-mobile-actions .btn {
  margin-right: auto;
}

/* Hide desktop nav logout on mobile */
@media (max-width: 1199px) {
  .nav-links .logout-btn {
    display: none !important;
  }
}

/* ---- Mobile-specific overrides (< 768px) ---- */
@media (max-width: 767px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .header-actions {
    width: 100%;
  }

  .pagination {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .actions-panel {
    padding-left: var(--space-md);
  }

  .action-btn-row {
    flex: 1 1 auto;
    justify-content: center;
  }

  .controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .date-filters {
    justify-content: center;
  }

  .bulk-actions {
    margin-left: 0;
  }
}


/* ============================================================
   25. UTILITY CLASSES
   ============================================================ */

/* ---- Text alignment ---- */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ---- Text colors ---- */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: #856404; }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

/* ---- Margin utilities ---- */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ---- Padding utilities ---- */
.p-0 { padding: 0; }
.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }

/* ---- Flex utilities ---- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-xs); }
.gap-2 { gap: var(--space-sm); }
.gap-3 { gap: var(--space-md); }
.gap-4 { gap: var(--space-lg); }

/* ---- Width utilities ---- */
.w-full { width: 100%; }
.max-w-sm { max-width: 480px; }
.max-w-md { max-width: 640px; }
.max-w-lg { max-width: 960px; }

/* ---- Display utilities ---- */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* ---- Font utilities ---- */
.font-mono { font-family: 'SF Mono', 'Consolas', 'Courier New', monospace; }
.font-bold { font-weight: 700; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

/* ---- Border radius ---- */
.rounded { border-radius: var(--border-radius); }
.rounded-sm { border-radius: var(--border-radius-sm); }

/* ---- Background ---- */
.bg-card { background: var(--bg-card); }
.bg-hover { background: var(--bg-hover); }

/* ---- Cursor ---- */
.cursor-pointer { cursor: pointer; }

/* ---- Overflow ---- */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }


/* ============================================================
   26. PRINT STYLES
   ============================================================ */

@media print {
  .admin-nav,
  .user-nav,
  .hamburger,
  .nav-overlay,
  .nav-drawer,
  .theme-toggle,
  .action-btn,
  .action-dropdown,
  .actions-panel,
  .bulk-bar,
  .toast,
  #copy-toast,
  .btn-outline,
  .header-actions,
  .skip-link {
    display: none !important;
  }

  .expandable-row {
    display: table-row !important;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
  }

  .card,
  .table-card,
  .stat-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }

  a {
    text-decoration: underline;
    color: #000 !important;
  }

  table {
    font-size: 10pt;
  }

  th,
  td {
    padding: 0.5rem;
  }
}


/* ============================================================
   27. PREFERS-REDUCED-MOTION
   ============================================================ */

/* ============================================================
   28. V2 DASHBOARD COMPONENTS (shared across v2 and user_services)
   ============================================================ */

/* Balance bar */
.v2-balance-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
}
.v2-balance-info {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
.v2-balance-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}
.v2-balance-euro {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.v2-balance-actions {
    display: flex;
    gap: 0.5rem;
}
.v2-btn-sm {
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s;
    border: none;
}
.v2-btn-primary {
    background: #16a34a;
    color: white;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}
.v2-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
    filter: brightness(1.05);
}

/* Welcome compact (0 credits state) */
.v2-welcome-compact {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    color: white;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.v2-welcome-text {
    flex: 1;
}
.v2-welcome-compact h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
}
.v2-welcome-compact p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}
.v2-welcome-compact .big-cta {
    background: white;
    color: var(--primary);
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.15s, box-shadow 0.15s;
}
.v2-welcome-compact .big-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .portal-card:hover,
  .stat-card:hover {
    transform: none !important;
  }

  .toast,
  #copy-toast {
    transition: none !important;
  }

  .tooltip {
    transition: none !important;
  }
}

/* ============================================================
   APP LAYOUT (Sidebar + Main Content)
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.app-sidebar {
  width: 260px;
  background: linear-gradient(180deg, #1a3c5a 0%, #0f2942 100%);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}

.app-sidebar .sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-brand:hover {
  color: white;
  text-decoration: none;
}

.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.7;
}

.sidebar-close:hover {
  opacity: 1;
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.4);
  padding: 0 1.5rem;
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  text-decoration: none;
}

.nav-item.active {
  background: rgba(0, 184, 148, 0.15);
  color: #00b894;
  border-left-color: #00b894;
}

.nav-item .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-item .nav-text {
  flex: 1;
}

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
}

/* ---- Main Content Area ---- */
.app-main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Top Bar ---- */
.app-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-topbar .hamburger {
  display: none;
}

.app-topbar .topbar-title {
  flex: 1;
}

.app-topbar .topbar-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.app-topbar .topbar-title {
  flex: 1;
  margin-left: 1rem;
}

.app-topbar .topbar-title h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1;
}

.app-topbar .topbar-spacer {
  flex: 1;
}

.app-topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Page Content ---- */
.app-content {
  flex: 1;
  padding: 1.5rem;
}

/* ---- Footer ---- */
.app-footer {
  padding: 1.5rem;
  text-align: center;
  opacity: 0.6;
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  
  .app-sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-close {
    display: block;
  }
  
  .sidebar-overlay.open {
    display: block;
  }
  
  .app-main {
    margin-left: 0;
  }
  
  .app-topbar .hamburger {
    display: flex;
  }
}

/* Active nav highlighting based on current page */
