/* ==============================================================================
   Cloud MicroEmulator Platform - Minimal SaaS Design System
   Professional, clean, high contrast, blue accent
   ============================================================================== */

:root,
[data-theme="dark"] {
  /* Dark Mode tokens */
  --bg-app: #0B0F19;
  --bg-surface: #111827;
  --bg-sidebar: #111827;
  --bg-secondary: #1F2937;
  --bg-surface-elevated: #1F2937;
  --bg-surface-hover: #1F2937;
  --bg-hover: #1F2937;

  --text-primary: #F9FAFB;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --text-on-accent: #FFFFFF;

  --border-subtle: #374151;
  --border-muted: #374151;
  --border-focus: #3B82F6;

  --accent-primary: #3B82F6;
  --accent-primary-hover: #60A5FA;
  --accent-primary-subtle: rgba(59, 130, 246, 0.12);
  --accent-primary-border: rgba(59, 130, 246, 0.3);

  /* Status Colors */
  --status-success: #10B981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-success-border: rgba(16, 185, 129, 0.25);

  --status-warning: #F59E0B;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-warning-border: rgba(245, 158, 11, 0.25);

  --status-error: #EF4444;
  --status-error-bg: rgba(239, 68, 68, 0.12);
  --status-error-border: rgba(239, 68, 68, 0.25);

  --status-info: #3B82F6;
  --status-info-bg: rgba(59, 130, 246, 0.12);
  --status-info-border: rgba(59, 130, 246, 0.25);

  /* Liquid Glass tokens (Dark) */
  --glass-bg: rgba(17, 24, 39, 0.72);
  --glass-bg-subtle: rgba(17, 24, 39, 0.52);
  --glass-bg-elevated: rgba(31, 41, 55, 0.78);
  --glass-bg-hover: rgba(37, 50, 69, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-light: rgba(255, 255, 255, 0.16);
  --glass-blur: blur(14px) saturate(180%);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 0 rgba(255, 255, 255, 0.07);
  --glass-shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.12);

  /* Shadows: Subtle SaaS */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-popover: 0 20px 25px -5px rgba(0, 0, 0, 0.6);

  --header-bg: rgba(11, 15, 25, 0.82);
  --table-stripe: #131A29;
}

[data-theme="light"] {
  /* Light Mode tokens */
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-secondary: #F1F5F9;
  --bg-surface-elevated: #FFFFFF;
  --bg-surface-hover: #F1F5F9;
  --bg-hover: #F1F5F9;

  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-on-accent: #FFFFFF;

  --border-subtle: #E2E8F0;
  --border-muted: #E2E8F0;
  --border-focus: #2563EB;

  --accent-primary: #2563EB;
  --accent-primary-hover: #1D4ED8;
  --accent-primary-subtle: rgba(37, 99, 235, 0.08);
  --accent-primary-border: rgba(37, 99, 235, 0.2);

  /* Status Colors */
  --status-success: #059669;
  --status-success-bg: rgba(5, 150, 105, 0.08);
  --status-success-border: rgba(5, 150, 105, 0.2);

  --status-warning: #D97706;
  --status-warning-bg: rgba(217, 119, 6, 0.08);
  --status-warning-border: rgba(217, 119, 6, 0.2);

  --status-error: #DC2626;
  --status-error-bg: rgba(220, 38, 38, 0.08);
  --status-error-border: rgba(220, 38, 38, 0.2);

  --status-info: #2563EB;
  --status-info-bg: rgba(37, 99, 235, 0.08);
  --status-info-border: rgba(37, 99, 235, 0.2);

  /* Liquid Glass tokens (Light) */
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-bg-subtle: rgba(255, 255, 255, 0.58);
  --glass-bg-elevated: rgba(255, 255, 255, 0.88);
  --glass-bg-hover: rgba(241, 245, 249, 0.92);
  --glass-border: rgba(226, 232, 240, 0.8);
  --glass-border-light: rgba(37, 99, 235, 0.22);
  --glass-blur: blur(14px) saturate(180%);
  --glass-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.06), inset 0 1px 0 0 rgba(255, 255, 255, 0.85);
  --glass-shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.1), inset 0 1px 0 0 rgba(255, 255, 255, 0.95);

  /* Shadows: Clean & soft */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-popover: 0 20px 25px -5px rgba(0, 0, 0, 0.08);

  --header-bg: rgba(255, 255, 255, 0.85);
  --table-stripe: #F8FAFC;
}

:root {
  /* Typography: Inter font */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, "Liberation Mono", Menlo, monospace;

  /* Radius: Modern Smooth Rounded Corners */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  --sidebar-width: 240px;
}

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

body {
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(circle at 12% 14%, rgba(59, 130, 246, 0.07), transparent 42%),
    radial-gradient(circle at 88% 86%, rgba(139, 92, 246, 0.06), transparent 45%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

h1, h2, h3, h4, h5, h6,
.page-title, .card-title, .metric-value, .stat-value,
.plan-price, .brand-link, .keypad-header {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ==============================================================================
   Layout: Sidebar + Content Area Shell
   ============================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.2s ease;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

/* Mobile drawer backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 90;
}

.sidebar-backdrop.open {
  display: none;
}

@media (max-width: 768px) {
  .sidebar-backdrop.open {
    display: block;
  }
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.brand-badge {
  width: 28px;
  height: 28px;
  background: var(--accent-primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title span:first-child {
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sidebar Navigation Items */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  list-style: none;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem 0.25rem 0.5rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.sidebar-item:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.sidebar-item.active {
  color: var(--accent-primary);
  background-color: var(--accent-primary-subtle);
  font-weight: 600;
}

.sidebar-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.sidebar-item i {
  width: 16px;
  font-size: 14px;
  text-align: center;
  flex-shrink: 0;
}

.admin-nav-item {
  color: var(--status-warning) !important;
}

.admin-nav-item:hover {
  background-color: var(--status-warning-bg) !important;
}

/* Sidebar Footer Profile Area */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.user-profile-summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.user-avatar-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-text {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-logout-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

/* ==============================================================================
   Main Content Area & Top Header
   ============================================================================== */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: transparent;
  transition: background-color 0.15s ease;
}

.top-header {
  height: 56px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1.5rem;
  min-width: 0;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.header-brand-mobile {
  display: none;
}

.mobile-brand-badge {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  color: #ffffff;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.header-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.header-breadcrumbs .breadcrumb-root {
  color: var(--text-muted);
  font-weight: 500;
}

.header-breadcrumbs span.separator {
  color: var(--text-muted);
  font-size: 11px;
  opacity: 0.6;
}

.header-breadcrumbs span.current {
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Minimal SaaS Theme Toggle Button */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-elevated);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.btn-theme-toggle:hover {
  background: var(--glass-bg-hover);
  color: var(--accent-primary);
  border-color: var(--glass-border-light);
  transform: rotate(15deg) scale(1.05);
}

/* In dark mode: show sun to switch to light */
[data-theme="dark"] .theme-icon-sun { display: inline-block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* In light mode: show moon to switch to dark */
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: inline-block; }

:root:not([data-theme="light"]) .theme-icon-sun { display: inline-block; }
:root:not([data-theme="light"]) .theme-icon-moon { display: none; }

/* Wallet Badge in Top Header */
.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--glass-bg-elevated);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.wallet-badge:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
  transform: translateY(-1px);
}

.wallet-badge .wallet-icon {
  color: var(--accent-primary);
  font-size: 13px;
}

.wallet-badge .wallet-amount {
  color: var(--text-primary);
  font-weight: 600;
}

.btn-header-create {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.btn-header-create:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.content-container {
  flex: 1;
  padding: 1.75rem 2rem;
  max-width: 1400px;
  width: 100%;
  min-width: 0;
}

/* Mobile Header Hamburger */
.mobile-nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg-elevated);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.mobile-nav-toggle:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
  color: var(--accent-primary);
  transform: scale(1.05);
}

/* ==============================================================================
   Typography & Headings
   ============================================================================== */
.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

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

/* ==============================================================================
   Cards & Surfaces (Liquid Glass & Soft Rounded Style)
   ============================================================================== */
.card {
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  max-width: 100%;
  min-width: 0;
  box-shadow: var(--glass-shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--glass-border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

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

/* Metrics Row */
.metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

/* ==============================================================================
   Dashboard — Hero + Enhanced Metric Cards (Liquid Glass)
   ============================================================================== */
.dash-hero {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--glass-shadow);
}

.dash-hero::after {
  display: none;
}

.dash-hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-primary);
  margin-bottom: 0.35rem;
}

.dash-hero-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.25;
}

.dash-hero-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

.dash-hero-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

/* Metric cards with icon */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  position: relative;
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: var(--glass-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.metric-card:hover {
  border-color: var(--glass-border-light);
  box-shadow: var(--glass-shadow-lg);
  transform: translateY(-2px);
}

.metric-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.metric-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
}

.metric-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.metric-icon i {
  font-size: 15px;
}

.metric-card .metric-label {
  margin-bottom: 0;
}

/* Dashboard tab list */
.dash-list-card .card-header {
  align-items: center;
}

.dash-empty {
  text-align: center;
  padding: 3rem 1rem;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.dash-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
}

.dash-empty-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.dash-empty p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* Dashboard Scientific 2-Column Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.quick-action-tile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.quick-action-tile:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.quick-action-tile i:first-child {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.quick-action-tile div {
  flex: 1;
  min-width: 0;
}

.quick-action-tile strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.quick-action-tile span {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-action-tile .fa-chevron-right {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.quick-action-tile:hover .fa-chevron-right {
  transform: translateX(2px);
  color: var(--accent-primary);
}

.metric-progress-track {
  height: 4px;
  width: 100%;
  background: var(--border-subtle);
  border-radius: 2px;
  margin-top: 0.65rem;
  overflow: hidden;
}

.metric-progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ==============================================================================
   Data Tables (Premium SaaS Aesthetics & High Information Density)
   ============================================================================== */
.table-wrapper,
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Custom sleek modern scrollbars */
.table-wrapper::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}
.table-wrapper::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
  background: rgba(10, 15, 26, 0.5);
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 4px;
  transition: background 0.2s ease;
}
.table-wrapper::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

.clean-table,
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  text-align: left;
  color: var(--text-primary);
}

.clean-table th,
.data-table th {
  background: linear-gradient(180deg, var(--bg-surface-elevated, #1a2234) 0%, rgba(26, 34, 52, 0.98) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary, #94a3b8);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.clean-table th:first-child,
.data-table th:first-child {
  border-top-left-radius: calc(var(--radius-md) - 1px);
}
.clean-table th:last-child,
.data-table th:last-child {
  border-top-right-radius: calc(var(--radius-md) - 1px);
}

.clean-table td,
.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--text-primary);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.clean-table tbody tr:nth-child(even),
.data-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.012);
}

.clean-table tbody tr,
.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.clean-table tbody tr:hover,
.data-table tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.065) !important;
}

.clean-table tbody tr:hover td:first-child,
.data-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-primary);
}

.clean-table tr:last-child td,
.data-table tr:last-child td {
  border-bottom: none;
}

.clean-table tr:last-child td:first-child,
.data-table tr:last-child td:first-child {
  border-bottom-left-radius: calc(var(--radius-md) - 1px);
}
.clean-table tr:last-child td:last-child,
.data-table tr:last-child td:last-child {
  border-bottom-right-radius: calc(var(--radius-md) - 1px);
}

/* Micro-code badge chip */
.table-code {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 11.5px;
  font-weight: 500;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.22);
  padding: 2px 7px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: -0.01em;
  vertical-align: middle;
  line-height: 1.4;
}

/* Custom Checkbox inside tables */
.clean-table input[type="checkbox"],
.data-table input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  border-radius: 3px;
  cursor: pointer;
  vertical-align: middle;
}

/* Compact form controls inside tables */
.clean-table .form-input,
.data-table .form-input {
  height: 28px;
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-elevated, #1a2234);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.clean-table .form-input:focus,
.data-table .form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Table action buttons */
.clean-table .btn-sm,
.data-table .btn-sm {
  height: 28px;
  padding: 0 0.6rem;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.clean-table .btn-icon,
.data-table .btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Row action buttons container */
.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.row-actions .btn,
.row-actions .btn-icon,
.row-actions .btn-sm {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.row-actions .btn:hover,
.row-actions .btn-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Empty table state */
.table-empty-row td,
.clean-table td[colspan] {
  text-align: center;
  padding: 2.5rem 1rem !important;
  color: var(--text-muted);
  font-size: 13px;
  background: transparent !important;
}

/* Badges - Modern Pill Radius */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 11px;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  line-height: 1.2;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-running {
  background-color: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid var(--status-success-border);
}
.badge-running::before { background-color: var(--status-success); }

.badge-stopped {
  background-color: var(--status-error-bg);
  color: var(--status-error);
  border: 1px solid var(--status-error-border);
}
.badge-stopped::before { background-color: var(--status-error); }

.badge-starting, .badge-pending {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid var(--status-warning-border);
}
.badge-starting::before, .badge-pending::before { background-color: var(--status-warning); }

.badge-active, .badge-online {
  background-color: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid var(--status-success-border);
}
.badge-active::before, .badge-online::before { background-color: var(--status-success); }

.badge-draining {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid var(--status-warning-border);
}
.badge-draining::before { background-color: var(--status-warning); }

.badge-offline {
  background-color: var(--status-error-bg);
  color: var(--status-error);
  border: 1px solid var(--status-error-border);
}
.badge-offline::before { background-color: var(--status-error); }

.badge-error {
  background-color: var(--status-error-bg);
  color: var(--status-error);
  border: 1px solid var(--status-error-border);
}
.badge-error::before { background-color: var(--status-error); }

.badge-terminated {
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.badge-terminated::before { background-color: var(--text-muted); }

.badge-migrating {
  background-color: var(--status-info-bg);
  color: var(--status-info);
  border: 1px solid var(--status-info-border);
}
.badge-migrating::before { background-color: var(--status-info); }

.badge-sleep {
  background-color: var(--accent-primary-subtle);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary-border);
}
.badge-sleep::before { background-color: var(--accent-primary); }

/* Tab list — sleek compact horizontal toolbar */
.tab-list-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tab-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tab-search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tab-search-icon {
  position: absolute;
  left: 9px;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.tab-search {
  width: 140px;
  height: 30px;
  font-size: 12px;
  padding: 0 0.5rem 0 1.75rem !important;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.tab-search:focus {
  width: 175px;
  border-color: var(--accent-primary);
  background: var(--bg-surface);
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.filter-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: var(--radius-xs, 4px);
  padding: 0.25rem 0.55rem;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.filter-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
}

.tab-farm-btn {
  height: 30px;
  padding: 0 0.65rem;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.tab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 1rem;
}
.tab-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  box-sizing: border-box;
  padding: 1.15rem;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.tab-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--glass-shadow-lg);
  transform: translateY(-2px);
}
.tab-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.tab-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tab-card-name:hover { color: var(--accent-primary); }
.tab-card-badge { flex-shrink: 0; }
.tab-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 12px;
  color: var(--text-secondary);
}
.tab-card-res {
  font-size: 13px;
  color: var(--text-secondary);
}
.tab-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}
.tab-card-time {
  font-size: 12px;
  color: var(--text-muted);
}
.tab-card-actions {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .tab-list-card-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.5rem;
  }
  .tab-toolbar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
  }
  .tab-search-wrap {
    flex: 1;
    min-width: 120px;
  }
  .tab-search {
    width: 100% !important;
  }
  .filter-chips {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-chip {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* Compact launch / upload forms (My Tabs) */
.launch-grid,
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  align-items: end;
}
.launch-grid > .btn,
.upload-grid > .btn {
  justify-self: start;
  min-width: 110px;
}
.advanced-node {
  margin-top: 0.85rem;
}
.advanced-node summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
}
.advanced-node summary::-webkit-details-marker { display: none; }
.advanced-node summary::before { content: "▸ "; }
.advanced-node[open] summary::before { content: "▾ "; }
.advanced-node summary:hover { color: var(--accent-primary); }

/* Tab card overflow menu ("⋯") */
.tab-menu { position: relative; }
.tab-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 0.45rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.tab-menu-btn::-webkit-details-marker { display: none; }
.tab-menu-btn:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.tab-menu-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 50;
  min-width: 170px;
  padding: 0.3rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
}
.tab-menu-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.tab-menu-item:hover { background: var(--bg-surface-hover); }
.tab-menu-item.danger { color: var(--status-error); }
.tab-menu-item.danger:hover { background: var(--status-error-bg); }
@media (max-width: 640px) {
  .launch-grid > .btn,
  .upload-grid > .btn { width: 100%; }
}

/* Pricing Grid (Plans & Billing) */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.plan-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.plan-card:hover {
  border-color: var(--border-muted);
  box-shadow: var(--shadow-md);
}

.plan-card.featured {
  border-color: var(--accent-primary);
  background-color: var(--accent-primary-subtle);
}

.plan-price {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1rem 0;
  letter-spacing: -0.03em;
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 2rem;
  font-size: 13px;
  color: var(--text-secondary);
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plan-features li::before {
  content: "✓";
  color: var(--accent-primary);
  font-weight: 700;
}

/* Compatibility aliases for legacy templates */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background-color: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 1rem 1.25rem; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.35rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.03em; line-height: 1.2; }
.stat-trend { font-size: 11px; color: var(--text-muted); margin-top: 0.25rem; }
.table-container { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background-color: var(--bg-surface); box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.data-table th { background-color: var(--bg-secondary); color: var(--text-secondary); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background-color: var(--bg-surface-hover); }

/* ==============================================================================
   Buttons & Interactive Elements (8px Radius, Minimal SaaS)
   ============================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #2563eb);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-primary-hover), #1d4ed8);
  box-shadow: 0 6px 18px 0 rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-secondary {
  background-color: var(--glass-bg-elevated);
  border-color: var(--glass-border);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background-color: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
}

.btn-outline {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: var(--glass-border);
  color: var(--text-secondary);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-outline:hover {
  background-color: var(--glass-bg-hover);
  color: var(--text-primary);
  border-color: var(--glass-border-light);
}

.btn-danger {
  background-color: var(--status-error-bg);
  border-color: var(--status-error-border);
  color: var(--status-error);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-danger:hover {
  background-color: var(--status-error);
  color: #ffffff;
}

.btn-sm {
  font-size: 12px;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-md);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-md);
}
.btn-icon i { font-size: 12px; }

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric-icon i { font-size: 14px; }

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

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

.form-input, .form-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 13px;
  font-family: var(--font-sans);
  background-color: var(--glass-bg-subtle);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  outline: none;
  background-color: var(--glass-bg-elevated);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* Responsive form row: multi-column on desktop, stacked on mobile */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

/* Hide element on small screens */
.hide-sm {
  display: none;
}

@media (min-width: 769px) {
  .hide-sm {
    display: revert;
  }
}

/* ==============================================================================
   Remote Console Header Toolbar (Scientific, Clutter-Free & Responsive)
   ============================================================================== */
.console-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.console-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.console-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
}

.console-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.console-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.console-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.console-restart-form {
  display: inline-flex;
  margin: 0;
}

/* ==============================================================================
   Remote Console Canvas & Viewport (Game-First)
   ============================================================================== */
.console-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0 auto;
}

.console-screen-col {
  width: 100%;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.screen-container {
  background-color: #05070a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.screen-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0.25rem 0;
}

.screen-keypad-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: calc(320px * var(--zoom, 1) + 14px);
  min-width: 320px;
  flex-shrink: 0;
}

.canvas-bezel {
  background-color: #000000;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: none;
  margin: 0 auto;
  flex-shrink: 0;
  transition: width 0.15s ease, height 0.15s ease;
}

.screen-canvas {
  width: calc(320px * var(--zoom, 1));
  max-width: none;
  height: auto;
  aspect-ratio: 3 / 4;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  background-color: #000000;
  border-radius: var(--radius-xs);
  touch-action: manipulation;
  transition: width 0.15s ease, height 0.15s ease;
}

.screen-hud-bar {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hud-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--status-success);
}

/* ==============================================================================
   Virtual Mobile Keypad — Compact Handheld Gaming Layout (Width = Tab Frame)
   ============================================================================== */
.keypad-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.5rem;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  transition: width 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.keypad-container.alpha-open {
  width: 100%;
  max-width: 100%;
}

.keypad-container.alpha-open.qwerty-hidden {
  width: 100%;
  max-width: 100%;
}

/* Chế độ bàn phím nổi có thể di chuyển (Draggable & Floating) */
.keypad-container.keypad-floating {
  position: fixed !important;
  z-index: 9999 !important;
  width: 330px !important;
  max-width: 95vw !important;
  padding: 0.35rem 0.45rem !important;
  background: var(--bg-surface) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-focus) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-popover) !important;
  touch-action: none !important;
}

.keypad-container.keypad-floating.alpha-open {
  width: 340px !important;
}

.keypad-container.keypad-floating.alpha-open.qwerty-hidden {
  width: 330px !important;
}

.keypad-container.keypad-floating.is-dragging {
  cursor: grabbing !important;
  opacity: 0.95 !important;
  box-shadow: var(--shadow-popover) !important;
}

.keypad-container.is-minimized .keypad-body {
  display: none !important;
}

.keypad-drag-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.15rem 0.25rem 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.5rem;
  user-select: none;
  -webkit-user-select: none;
}

.keypad-container.keypad-floating .keypad-drag-bar {
  cursor: grab;
  touch-action: none;
}

.keypad-container.keypad-floating.is-dragging .keypad-drag-bar {
  cursor: grabbing;
}

.keypad-container:not(.keypad-floating) .drag-handle-grip {
  display: none;
}

.drag-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.drag-handle-grip {
  font-size: 13px;
  color: var(--accent-primary);
  opacity: 0.85;
}

.drag-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-kp-tool {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  padding: 0.18rem 0.45rem;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.btn-kp-tool:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.keypad-container.keypad-floating .k-btn {
  min-height: 32px;
  font-size: 14px;
  padding: 0.25rem 0.2rem;
  border-radius: var(--radius-md);
}

.keypad-container.keypad-floating .k-btn::after {
  display: none;
}

.keypad-container.keypad-floating .keypad-softkeys {
  margin-bottom: 0.4rem;
  gap: 0.35rem;
}

.keypad-container.keypad-floating .keypad-softkeys .k-btn {
  min-height: 32px;
  font-size: 13px;
}

.keypad-container.keypad-floating .keypad-dpad-grid {
  gap: 0.25rem;
  margin-bottom: 0.45rem;
}

.keypad-container.keypad-floating .keypad-dpad-grid .k-btn {
  min-height: 34px;
  font-size: 15px;
}

.keypad-container.keypad-floating .keypad-dpad-grid .k-btn-ok {
  font-size: 11px;
}

.keypad-container.keypad-floating .keypad-numeric-grid {
  gap: 0.25rem;
}

.keypad-container.keypad-floating .qwerty-row .k-btn {
  min-height: 34px;
  font-size: 13px;
}

.keypad-container.keypad-floating .keypad-tips {
  display: none;
}

.keypad-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.keypad-header::before,
.keypad-header::after {
  content: '';
  height: 1px;
  width: 28px;
  background: var(--border-subtle);
}

/* Top Control Row: Soft 1 (Trái) | Nút Gõ Chữ (Giữa) | Soft 2 (Phải) */
.keypad-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.keypad-control-row .k-btn-soft {
  flex: 0 0 72px;
  min-height: 25px;
  max-height: 27px;
  padding: 0.1rem 0.25rem;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.keypad-control-row .k-btn-soft .k-btn-sub {
  font-size: 9px;
  opacity: 0.75;
}

.keypad-control-row .keypad-toggle-btn {
  flex: 1 1 auto;
  min-height: 25px;
  max-height: 27px;
  margin: 0;
  padding: 0.1rem 0.5rem;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--accent-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.keypad-control-row .keypad-toggle-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

.keypad-toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.keypad-toggle-btn[aria-expanded="true"] .keypad-toggle-arrow {
  transform: rotate(180deg);
}

/* Keypad Main Row: D-Pad on Left | Numbers on Right (Side-by-side, compact) */
.keypad-main-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
}

.keypad-dpad-col {
  flex: 0 0 124px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.keypad-dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.18rem;
  width: 100%;
}

.keypad-dpad-grid .k-btn {
  font-size: 13px;
  min-height: 26px;
  max-height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.keypad-dpad-grid .k-btn-ok {
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  border-color: transparent;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  min-height: 26px;
  max-height: 28px;
  width: 100%;
}

.keypad-dpad-grid .k-btn-ok:hover {
  background: var(--accent-primary-hover);
}

.keypad-dpad-grid .k-btn-ok:active,
.keypad-dpad-grid .k-btn-ok.active {
  background: var(--accent-primary-hover);
  transform: translateY(1px) scale(0.96);
}

.keypad-numeric-col {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.keypad-numeric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.18rem;
  width: 100%;
}

.keypad-numeric-grid .k-btn {
  min-height: 23px;
  max-height: 25px;
  padding: 0.05rem 0.1rem;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  flex-direction: row;
  gap: 0.25rem;
}

.keypad-numeric-grid .k-btn-sub {
  font-size: 8px;
  line-height: 1;
  color: var(--text-muted);
}

/* Keypad Button base (Minimal SaaS) */
.k-btn {
  position: relative;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  min-height: 26px;
  padding: 0.1rem 0.15rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}

.k-btn::after {
  display: none;
}

.k-btn:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface-hover);
}

.k-btn:active,
.k-btn.active {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: #ffffff !important;
  transform: translateY(1px) scale(0.97);
  box-shadow: none;
}

.k-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.k-btn:active .k-btn-sub,
.k-btn.active .k-btn-sub {
  color: rgba(255, 255, 255, 0.85);
}

/* Fast text typing & send box */
.keypad-chat-box {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  padding: 0.35rem 0.45rem;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.keypad-chat-box[hidden] {
  display: none !important;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-input-field {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0.15rem 0.5rem;
  font-size: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
}

.chat-input-field:focus {
  border-color: var(--border-focus);
}

.btn-chat-send {
  height: 28px;
  padding: 0 0.65rem;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.chat-input-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 10.5px;
  color: var(--text-muted);
}

.chat-options-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.chat-option-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}

.chat-hint-text {
  font-size: 10px;
}

/* QWERTY letter keyboard */
.keypad-qwerty {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-subtle);
}

.keypad-qwerty[hidden] {
  display: none;
}

.qwerty-row {
  display: flex;
  justify-content: center;
  gap: 0.18rem;
}

/* Dãy số 1-0 trên bàn phím QWERTY */
.qwerty-numbers {
  gap: 0.15rem;
  margin-bottom: 0.12rem;
}

.qwerty-numbers .k-btn-num {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 12px;
  min-height: 25px;
  max-height: 27px;
  background: var(--bg-surface-elevated, #161b22);
  color: var(--accent-primary, #60a5fa);
  border-color: rgba(96, 165, 250, 0.25);
}

.qwerty-row .k-btn {
  flex: 1 1 0;
  min-width: 0;
  max-width: 44px;
  min-height: 26px;
  max-height: 28px;
  font-size: 12px;
  padding: 0.1rem 0.05rem;
  border-radius: var(--radius-sm);
}

.qwerty-row .k-btn::after {
  display: none;
}

.qwerty-row .k-btn-caps {
  max-width: 50px;
  flex: 1.3 1 0;
  font-size: 10px;
}

.qwerty-row .k-btn-back {
  max-width: 56px;
  flex: 1.4 1 0;
  font-size: 13px;
}

.qwerty-row .k-btn-punct {
  font-size: 13px;
  font-weight: 700;
  max-width: 38px;
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.qwerty-row .k-btn-space {
  flex: 2.2 1 0;
  max-width: none;
  min-height: 26px;
  max-height: 28px;
  flex-direction: row;
  gap: 0.35rem;
  font-size: 11px;
}

/* Zoom control cho màn hình game */
.zoom-control {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  background: var(--bg-surface-elevated);
}

.zoom-control .btn,
.zoom-control .btn-zoom {
  border: none;
  background: transparent;
  padding: 0.25rem 0.55rem;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  min-height: 28px;
  border-radius: calc(var(--radius-sm) - 2px);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.zoom-level {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  min-width: 42px;
  text-align: center;
  user-select: none;
  padding: 0 0.15rem;
}

/* ==============================================================================
   Responsive Breakpoints
   ============================================================================== */
@media (max-width: 1100px) {
  .screen-stage {
    gap: 0.5rem;
  }
}

@media (max-width: 900px) {
  .screen-stage {
    gap: 0.4rem;
  }
}

.screen-container:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  overflow-y: auto;
  border-radius: 0;
  border: none;
  background-color: #05070a;
  padding: 1rem;
  justify-content: center;
}

@media (max-width: 768px) {
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
    font-size: 15px; /* mobile: tăng cỡ chữ gốc */
  }
  .app-sidebar {
    transform: translateX(-100%);
    width: min(78vw, 280px);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  }
  .app-main {
    margin-left: 0;
  }
  .top-header {
    height: calc(52px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    gap: 0.5rem;
  }
  .mobile-nav-toggle {
    display: flex;
    width: 34px;
    height: 34px;
    font-size: 13px;
    border-radius: var(--radius-sm);
  }
  .header-left {
    gap: 0.5rem;
  }
  .header-brand-mobile {
    display: flex;
  }
  .header-breadcrumbs .breadcrumb-root,
  .header-breadcrumbs .separator {
    display: none;
  }
  .header-breadcrumbs span.current {
    font-size: 13.5px;
    font-weight: 700;
    max-width: 110px;
  }
  .header-actions {
    gap: 0.4rem;
  }
  .btn-theme-toggle {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .wallet-badge {
    padding: 0.3rem 0.6rem !important;
    font-size: 11.5px !important;
    gap: 0.3rem !important;
    margin-right: 0 !important;
  }
  .wallet-badge .wallet-icon {
    font-size: 11px;
  }
  .btn-header-create {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    justify-content: center;
    border-radius: 50% !important;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
  }
  .btn-header-create .btn-text {
    display: none;
  }
  .btn-header-create i {
    font-size: 13px;
    margin: 0;
  }
  .content-container {
    padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  }
  .card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }
  .page-title {
    font-size: 1.3rem;
  }
  .page-subtitle {
    display: none; /* mobile: bỏ mô tả dài, gọn gàng */
  }
  .header-breadcrumbs {
    font-size: 13px;
  }
  .card-title {
    font-size: 15px;
  }
  .badge {
    font-size: 12px;
    padding: 0.2rem 0.6rem;
  }
  .form-label {
    font-size: 13px;
  }
  .metric-label, .stat-label {
    font-size: 13px;
  }
  .metric-sub, .stat-trend {
    font-size: 12px;
  }
  .sidebar-item {
    font-size: 14px;
    padding: 0.65rem 0.85rem;
  }
  .nav-section-title {
    font-size: 12px;
  }
  .user-name-text {
    font-size: 13px;
  }
  .user-role-text {
    font-size: 12px;
  }
  .brand-subtitle {
    font-size: 11px;
  }
  .metric-card, .stat-card {
    padding: 0.9rem 1rem;
  }
  .dash-hero {
    padding: 1.15rem 1.15rem;
    border-radius: var(--radius-md);
  }
  .dash-hero-title {
    font-size: 1.25rem;
  }
  .metric-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
  .metric-icon svg {
    width: 15px;
    height: 15px;
  }
  .metric-value, .stat-value {
    font-size: 1.35rem;
  }
  .plan-price {
    font-size: 1.6rem;
  }
  .plan-features {
    font-size: 14px;
  }
  .screen-container {
    padding: 0.75rem 0.5rem;
  }
  .screen-canvas {
    width: calc(min(86vw, 320px) * var(--zoom, 1));
    max-width: none;
  }
  .screen-hud-bar {
    font-size: 11px;
    margin-top: 0.5rem;
  }
  .screen-hud-bar .hud-item:nth-child(2) {
    display: none;
  }
  .keypad-container {
    padding: 0.5rem 0.6rem;
  }
  .keypad-softkeys {
    margin-bottom: 0.4rem;
    gap: 0.35rem;
  }
  .keypad-softkeys .k-btn {
    min-height: 32px;
    font-size: 13px;
    padding: 0.25rem 0.5rem;
  }
  .keypad-dpad-grid {
    gap: 0.25rem;
    margin-bottom: 0.45rem;
  }
  .keypad-dpad-grid .k-btn {
    min-height: 34px;
    font-size: 15px;
    padding: 0.2rem;
    border-radius: var(--radius-md);
  }
  .keypad-dpad-grid .k-btn-ok {
    font-size: 11px;
  }
  .keypad-numeric-grid {
    gap: 0.25rem;
  }
  .k-btn {
    min-height: 32px;
    font-size: 14px;
    padding: 0.25rem 0.2rem;
    border-radius: var(--radius-md);
  }
  .k-btn::after {
    display: none;
  }
  .k-btn-sub {
    font-size: 8px;
  }
  .qwerty-row {
    gap: 0.2rem;
  }
  .qwerty-row .k-btn {
    min-height: 34px;
    font-size: 13px;
    border-radius: var(--radius-md);
  }
  .qwerty-row .k-btn-caps {
    font-size: 10px;
    max-width: 48px;
  }
  .qwerty-row .k-btn-back {
    font-size: 15px;
    max-width: 50px;
  }
  .qwerty-row .k-btn-space {
    min-height: 34px;
  }
  .keypad-toggle-btn {
    font-size: 12px;
    padding: 0.35rem 0.75rem;
    margin-top: 0.45rem;
  }
  .keypad-tips {
    display: none;
  }
  .btn {
    padding: 0.65rem 1.1rem;
    font-size: 14px;
  }
  .btn-sm {
    padding: 0.5rem 0.85rem;
    font-size: 13px;
  }
  /* tables: scroll instead of overflowing the viewport */
  .clean-table th,
  .data-table th {
    padding: 0.6rem 0.75rem;
    font-size: 12px;
  }
  .clean-table td,
  .data-table td {
    padding: 0.65rem 0.75rem;
    font-size: 13px;
  }
  .table-code {
    font-size: 13px;
  }
  .table-wrapper {
    -webkit-overflow-scrolling: touch;
  }
  .form-input, .form-select {
    font-size: 16px; /* prevents iOS zoom-on-focus */
    padding: 0.7rem 0.8rem;
  }
}

@media (max-width: 420px) {
  .content-container {
    padding: 0.75rem 0.75rem calc(1rem + env(safe-area-inset-bottom));
  }
  .screen-canvas {
    width: calc(min(90vw, 300px) * var(--zoom, 1));
    max-width: none;
  }
  .keypad-container {
    padding: 0.45rem 0.5rem;
  }
  .k-btn {
    min-height: 30px;
    font-size: 13px;
    border-radius: var(--radius-md);
  }
  .keypad-dpad-grid .k-btn {
    min-height: 32px;
    font-size: 14px;
  }
  .qwerty-row {
    gap: 0.18rem;
  }
  .qwerty-row .k-btn {
    min-height: 32px;
    font-size: 12px;
    border-radius: var(--radius-md);
  }
  .qwerty-row .k-btn-caps {
    max-width: 44px;
  }
  .qwerty-row .k-btn-back {
    max-width: 46px;
  }
  .page-title {
    font-size: 1.2rem;
  }
  .page-title-row .btn {
    font-size: 13px;
  }
  .console-header-row {
    padding: 0.5rem 0.65rem;
    gap: 0.5rem;
  }
  .console-header-left {
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
  }
  .console-title {
    font-size: 1.05rem;
    max-width: 180px;
  }
  .console-header-right {
    width: 100%;
    justify-content: space-between;
    gap: 0.4rem;
  }
  .console-header-right .zoom-control {
    flex-grow: 1;
    justify-content: space-between;
    max-width: 130px;
  }
  .console-header-right .btn-sm {
    padding: 0.35rem 0.55rem;
    font-size: 12px;
  }
}

/* Touch devices: bigger hit targets, no hover stickiness */
@media (hover: none) and (pointer: coarse) {
  .k-btn:hover {
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
  }
  .k-btn {
    min-height: 48px;
  }
  .btn {
    min-height: 40px;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==============================================================================
   Farm Grid - Multi-Tab Live Monitor Styles
   ============================================================================== */
.farm-grid-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.15rem;
  margin-bottom: 2rem;
}

.farm-tile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.farm-tile-card:hover {
  border-color: var(--border-muted);
  box-shadow: var(--shadow-md);
}

.farm-tile-card.active-focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-subtle), var(--shadow-md);
}

.farm-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.farm-tile-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.farm-tile-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-warning);
  flex-shrink: 0;
}

.farm-tile-dot.dot-live {
  background: var(--status-success);
}

.farm-tile-dot.dot-sleep {
  background: var(--status-info);
}

.farm-tile-dot.dot-offline {
  background: var(--status-error);
}

.farm-tile-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.farm-tile-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.farm-tile-fps {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.btn-tile-zoom {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  transition: color 0.15s ease, background 0.15s ease;
}

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

.farm-canvas-box {
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 280px;
  max-height: 360px;
  cursor: pointer;
  overflow: hidden;
}

.farm-canvas {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  aspect-ratio: 240 / 320;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  outline: none;
}

.farm-focus-banner {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent-primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.farm-tile-card.active-focus .farm-focus-banner {
  opacity: 1;
  transform: translateY(0);
}

.farm-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  gap: 0.4rem;
}

.btn-tile-action {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.btn-tile-action:hover {
  color: var(--text-primary);
  border-color: var(--border-muted);
  background: var(--bg-surface-hover);
}

.btn-tile-sleep.active-sleep {
  background: var(--accent-primary-subtle);
  border-color: var(--accent-primary-border);
  color: var(--accent-primary);
}

/* Floating Farm Keypad */
.farm-keypad-panel {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 170px;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  padding: 0.4rem;
  z-index: 1000;
}

.farm-keypad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.3rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-subtle);
}

.farm-keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.f-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  height: 26px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease, transform 0.05s ease;
}

.f-btn:active {
  background: var(--accent-primary);
  color: #ffffff;
  transform: scale(0.96);
}

.f-btn-ok {
  background: var(--accent-primary);
  border-color: transparent;
  color: #ffffff;
}

/* ==============================================================================
   Admin Navigation Tabs (Minimal SaaS)
   ============================================================================== */
.admin-tab-nav {
  display: flex;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0;
}

.admin-nav-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 0.65rem 1rem;
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.admin-nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.admin-nav-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
  background: var(--accent-primary-subtle);
}

/* ==============================================================================
   Table & Grid Universal Search & Pagination (Minimal SaaS)
   ============================================================================== */
.table-enhanced-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.table-enhanced-container > .table-wrapper,
.table-enhanced-container > .table-container,
.table-enhanced-container > table {
  margin-bottom: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface-elevated, #172033);
  border-bottom: 1px solid var(--border-subtle);
  border-top: none;
  border-left: none;
  border-right: none;
  border-radius: 0;
  flex-wrap: wrap;
}

.table-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  max-width: 360px;
}

.table-search-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.table-search-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 2.2rem;
  font-size: 12px;
  font-family: var(--font-sans);
  background-color: var(--bg-surface, #0f172a);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.table-search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
  background-color: var(--bg-surface);
}

.table-search-clear {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 5px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: color 0.15s ease;
}

.table-search-clear:hover {
  color: var(--text-primary);
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.table-page-size-wrap {
  display: inline-flex;
  align-items: center;
}

.table-page-size-select {
  padding: 0.4rem 0.65rem;
  font-size: 11.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  background-color: var(--bg-surface, #0f172a);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.table-page-size-select:focus,
.table-page-size-select:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.table-pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--bg-surface-elevated, #172033);
  border-top: 1px solid var(--border-subtle);
  border-bottom: none;
  border-left: none;
  border-right: none;
  border-radius: 0;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.table-pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.table-pagination-info strong {
  color: var(--text-primary);
  font-weight: 600;
}

.table-pagination-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.table-page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.table-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.35rem;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-sans);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}

.table-page-btn:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.table-page-btn.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
}

.table-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.table-page-ellipsis {
  padding: 0 0.25rem;
  color: var(--text-muted);
  font-size: 11px;
}

.card-grid-pagination {
  margin-top: 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.table-empty-row td {
  background-color: var(--bg-surface) !important;
}

@media (max-width: 640px) {
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .table-search-wrap {
    max-width: none;
  }
  .table-toolbar-right {
    margin-left: 0;
    justify-content: flex-end;
  }
  .table-pagination-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .table-pagination-nav {
    justify-content: center;
    margin-left: 0;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }
}

/* Dual FPS HUD Metrics Cards (matching user spec) */
.dual-fps-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  justify-content: center;
  align-items: stretch;
}

.dual-fps-card {
  background: #171329;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 18px;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.dual-fps-card:hover {
  border-color: rgba(147, 112, 219, 0.4);
  transform: translateY(-1px);
}

.dual-fps-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #9d9bb6;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.dual-fps-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--font-mono, "JetBrains Mono", Consolas, monospace);
  line-height: 1.15;
}

/* ==============================================================================
   Floating Liquid Glass Bottom Navigation Bar (Icons Only, Can Hide/Show)
   ============================================================================== */
.liquid-bottom-nav-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.dock-container {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--glass-border-light);
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-shadow-lg), 0 0 25px 0 rgba(37, 99, 235, 0.15);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.dock-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  flex-shrink: 0;
}

.dock-action-btn:hover {
  color: var(--text-primary);
  background: var(--glass-bg-hover);
  transform: translateY(-2px) scale(1.08);
}

.dock-action-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-primary), #2563eb);
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.45);
  transform: scale(1.05);
}

.dock-action-btn.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.dock-btn-toggle {
  color: var(--text-muted);
  border-left: 1px solid var(--glass-border);
  border-radius: 50%;
  margin-left: 0.2rem;
  width: 36px;
  height: 36px;
  font-size: 12px;
}

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

/* Collapsed state */
.liquid-bottom-nav-dock.collapsed .dock-container {
  transform: translateY(120px) scale(0.85);
  opacity: 0;
  pointer-events: none;
}

.dock-trigger-pill {
  pointer-events: auto;
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--glass-border-light);
  color: var(--accent-primary);
  box-shadow: var(--glass-shadow-lg);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-trigger-pill:hover {
  transform: scale(1.12);
  color: #ffffff;
  background: var(--accent-primary);
  box-shadow: 0 6px 20px 0 rgba(37, 99, 235, 0.4);
}

.liquid-bottom-nav-dock.collapsed .dock-trigger-pill {
  display: flex;
  animation: dockTriggerFadeIn 0.3s ease;
}

@keyframes dockTriggerFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Extra bottom space across content container so dock never occludes controls */
.content-container {
  padding-bottom: 84px !important;
}

@media (max-width: 768px) {
  .liquid-bottom-nav-dock {
    bottom: 12px;
  }
  .dock-container {
    padding: 0.35rem 0.45rem;
    gap: 0.25rem;
  }
  .dock-action-btn {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
}

/* Duration Selector (1 - 3 - 6 - 12 months) */
.duration-btn-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.btn-duration {
  background: var(--bg-surface, rgba(255,255,255,0.04));
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
  color: var(--text-secondary);
  padding: 0.4rem 0.25rem;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-xs, 4px);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  user-select: none;
}

.btn-duration:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: rgba(37, 99, 235, 0.08);
}

.btn-duration.active {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Tab Card Package & Expiry Indicators */
.tab-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-xs, 4px);
  color: var(--accent-primary);
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-expiry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 11px;
  padding: 0.4rem 0.65rem;
  background: var(--bg-surface, rgba(255,255,255,0.02));
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.07));
  border-radius: var(--radius-xs, 4px);
  margin: 0.45rem 0;
  flex-wrap: wrap;
}

/* ==============================================================================
   Compact & Responsive Dashboard V2 (Mobile-First & Anti-Overflow)
   ============================================================================== */
.dash-command-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
  max-width: 100%;
}

.dash-command-info {
  min-width: 0;
  flex: 1;
}

.dash-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.dash-title-wrap .page-title {
  font-size: 1.25rem;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.badge-role {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(37, 99, 235, 0.25);
  font-weight: 600;
  font-size: 11px;
}

.dash-user-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-command-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Grace period warning */
.card-grace-alert {
  border-color: var(--status-error);
  background: rgba(239, 68, 68, 0.08);
  padding: 0.75rem 1rem;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-radius: var(--radius-md);
}

.grace-alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--status-error);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Metric card components */
.metric-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

.metric-max {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.metric-badge-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.metric-sub-chips {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.35rem;
  font-size: 11px;
  flex-wrap: wrap;
}

.chip-running {
  color: var(--status-success);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.chip-running i {
  font-size: 6px;
}

.chip-stopped {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.chip-stopped i {
  font-size: 6px;
}

.chip-sleeping {
  color: #6366f1;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.chip-sleeping i {
  font-size: 7px;
}

.metric-sub-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-deposit-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

/* Dashboard tab list card */
.dash-tabs-card {
  margin-bottom: 1.15rem;
  padding: 1rem 1.15rem;
  min-width: 0;
  max-width: 100%;
}

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dash-header-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.dash-header-title .card-title {
  font-size: 1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dash-header-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Desktop vs Mobile Tab Switcher */
.dash-tabs-mobile {
  display: none;
}

.dash-tabs-desktop {
  display: block;
  min-width: 0;
  max-width: 100%;
}

.dash-mobile-tab-card {
  background: var(--bg-surface-hover, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 6px);
  padding: 0.6rem 0.75rem;
  transition: all 0.15s ease;
  min-width: 0;
}

.dash-mobile-tab-card:hover {
  background: var(--bg-surface, rgba(255, 255, 255, 0.05));
  border-color: var(--accent-primary-subtle, rgba(37, 99, 235, 0.3));
}

/* Bottom 2-Card Grid */
.dash-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  min-width: 0;
  max-width: 100%;
}

.dash-widget-title {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dash-widget-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  text-decoration: none;
}

.dash-widget-content {
  background: var(--bg-surface-hover, rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius-sm, 6px);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.75rem;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dash-widget-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.dash-widget-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 600;
}

/* Strict Mobile Responsive Optimization */
@media (max-width: 768px) {
  .dash-tabs-desktop {
    display: none;
  }
  .dash-tabs-mobile {
    display: block;
  }
  .dash-bottom-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .dash-command-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }
  .dash-command-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .dash-command-actions .btn {
    justify-content: center;
    padding: 0.45rem 0.5rem;
    font-size: 12px;
  }
  .dash-tabs-card {
    padding: 0.85rem;
  }
  .metrics-row {
    gap: 0.5rem;
  }
}



