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

html[data-theme="dark"] {
  /* Dark Mode tokens — deep navy anchors */
  --bg-app: #041038;
  --bg-surface: #071A44;
  --bg-sidebar: #071A44;
  --bg-secondary: #0A2458;
  --bg-surface-elevated: #0A2458;
  --bg-surface-hover: #0A2458;
  --bg-hover: #0A2458;

  --text-primary: #F5F9FF;
  --text-secondary: #B9C6E2;
  --text-muted: #8FA8D8;
  --text-on-accent: #FFFFFF;

  --border-subtle: rgba(255, 255, 255, 0.10);
  --border-muted: rgba(255, 255, 255, 0.08);
  --border-focus: #7EA2FF;

  --accent-primary: #4D7BFF;
  --accent-primary-hover: #7EA2FF;
  --accent-primary-subtle: rgba(77, 123, 255, 0.16);
  --accent-primary-border: rgba(126, 162, 255, 0.35);
  --accent-gradient: linear-gradient(135deg, #4D7BFF, #184CEC);

  /* Status Colors */
  --status-success: #4ADE80;
  --status-success-bg: rgba(74, 222, 128, 0.12);
  --status-success-border: rgba(74, 222, 128, 0.3);

  --status-warning: #FFD84A;
  --status-warning-bg: rgba(255, 216, 74, 0.12);
  --status-warning-border: rgba(255, 216, 74, 0.3);

  --status-error: #FF7B7F;
  --status-error-bg: rgba(255, 123, 127, 0.12);
  --status-error-border: rgba(255, 123, 127, 0.3);

  --status-info: #7EA2FF;
  --status-info-bg: rgba(126, 162, 255, 0.14);
  --status-info-border: rgba(126, 162, 255, 0.32);

  /* Surface tokens: solid navy surfaces, no glass blur */
  --glass-bg: #071A44;
  --glass-bg-subtle: #0A2458;
  --glass-bg-elevated: #0A2458;
  --glass-bg-hover: #0E2C67;
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-light: rgba(126, 162, 255, 0.28);
  --glass-blur: none;
  --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.22), inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  --glass-shadow-lg: 0 18px 48px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 18px 44px -12px rgba(0, 0, 0, 0.5);
  --shadow-popover: 0 24px 60px -20px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 4px 16px -2px rgba(0, 0, 0, 0.45);

  --header-bg: rgba(7, 26, 68, 0.92);
  --table-stripe: #061638;
  --panel-navy: linear-gradient(150deg, #071A44, #0B2A66);
  --bg-card: #071A44;
}

:root,
[data-theme="light"] {
  /* Light Mode tokens — friendly cloud SaaS */
  --bg-app: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-secondary: #F5F9FF;
  --bg-surface-elevated: #FFFFFF;
  --bg-surface-hover: #EFF4FF;
  --bg-hover: #EFF4FF;

  --text-primary: #08142C;
  --text-secondary: #5B6B85;
  --text-muted: #64748B;
  --text-on-accent: #FFFFFF;

  --border-subtle: #E4EAF4;
  --border-muted: #D7E1F2;
  --border-focus: #184CEC;

  --accent-primary: #184CEC;
  --accent-primary-hover: #0F3FD6;
  --accent-primary-subtle: #E7EEFF;
  --accent-primary-border: rgba(24, 76, 236, 0.22);
  --accent-gradient: linear-gradient(135deg, #184CEC, #0A34B8);

  /* Status Colors */
  --status-success: #12A150;
  --status-success-bg: #DCF4E4;
  --status-success-border: rgba(18, 161, 80, 0.22);

  --status-warning: #B45309;
  --status-warning-bg: #FFF7DE;
  --status-warning-border: #FFE08A;

  --status-error: #E5484D;
  --status-error-bg: #FBE4E8;
  --status-error-border: rgba(229, 72, 77, 0.25);

  --status-info: #184CEC;
  --status-info-bg: #E7EEFF;
  --status-info-border: rgba(24, 76, 236, 0.2);

  /* Surface tokens: solid white surfaces, no glass blur */
  --glass-bg: #FFFFFF;
  --glass-bg-subtle: #F7FAFF;
  --glass-bg-elevated: #FFFFFF;
  --glass-bg-hover: #EFF4FF;
  --glass-border: #E4EAF4;
  --glass-border-light: #C8D8FC;
  --glass-blur: none;
  --glass-shadow: 0 1px 2px rgba(8, 20, 44, 0.04), 0 12px 32px rgba(8, 20, 44, 0.06);
  --glass-shadow-lg: 0 2px 4px rgba(8, 20, 44, 0.05), 0 18px 44px rgba(8, 20, 44, 0.08);

  /* Shadows: hairline-soft cloud SaaS */
  --shadow-sm: 0 1px 2px rgba(8, 20, 44, 0.04);
  --shadow-md: 0 1px 2px rgba(8, 20, 44, 0.04), 0 12px 32px rgba(8, 20, 44, 0.06);
  --shadow-lg: 0 2px 4px rgba(8, 20, 44, 0.05), 0 18px 44px rgba(8, 20, 44, 0.08);
  --shadow-popover: 0 24px 60px -20px rgba(8, 20, 44, 0.18);
  --shadow-glow: 0 4px 14px -2px rgba(8, 20, 44, 0.08);

  --header-bg: rgba(255, 255, 255, 0.88);
  --table-stripe: #F7FAFF;
  --panel-navy: linear-gradient(150deg, #071A44, #0B2A66);
  --bg-card: #FFFFFF;
}

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

  /* Radius: 16–20px cards, 10–12px controls */
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  --sidebar-width: 248px;
  --sidebar-collapsed-width: 68px;
}

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

body {
  background-color: var(--bg-app);
  background-image:
    radial-gradient(800px 400px at 10% -5%, rgba(233, 240, 254, 0.65), transparent 70%),
    radial-gradient(700px 350px at 90% 0%, rgba(239, 244, 255, 0.65), transparent 65%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0;
  -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;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(800px 400px at 10% -5%, rgba(10, 36, 88, 0.45), transparent 70%),
    radial-gradient(700px 350px at 90% 0%, rgba(14, 44, 103, 0.35), transparent 65%);
}

/* Focus visible outline (Craft floor a11y) */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Custom themed scrollbars */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-muted);
  border-radius: var(--radius-pill);
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::selection {
  background: var(--accent-primary-subtle);
  color: var(--text-primary);
}

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: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

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

/* Halftone dot-cloud texture behind the app shell */
.app-layout::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(24, 76, 236, 0.16) 1.2px, transparent 1.7px);
  background-size: 14px 14px;
  -webkit-mask-image:
    radial-gradient(46% 34% at 10% 4%, #000 0%, transparent 72%),
    radial-gradient(38% 30% at 96% 12%, #000 0%, transparent 75%),
    radial-gradient(42% 30% at 88% 96%, #000 0%, transparent 72%);
  mask-image:
    radial-gradient(46% 34% at 10% 4%, #000 0%, transparent 72%),
    radial-gradient(38% 30% at 96% 12%, #000 0%, transparent 75%),
    radial-gradient(42% 30% at 88% 96%, #000 0%, transparent 72%);
  opacity: 0.55;
}

[data-theme="dark"] .app-layout::before {
  background-image: radial-gradient(rgba(126, 162, 255, 0.22) 1.2px, transparent 1.7px);
  opacity: 0.35;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s ease;
}

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

.sidebar-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary-border);
  background: var(--bg-surface-hover);
}

.sidebar-collapse-btn .collapse-icon-right {
  display: none;
}

.sidebar-collapse-btn .collapse-icon-left {
  display: inline-block;
  font-size: 11px;
}

@media (max-width: 768px) {
  .sidebar-collapse-btn {
    display: none !important;
  }
}

/* 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: 14px;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.brand-badge {
  width: 34px;
  height: 34px;
  background: var(--accent-gradient);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

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

.brand-title span:first-child { line-height: 1.4; font-size: 14px; 
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.3;
}

.brand-subtitle { font-size: 12px; line-height: 1.5; 
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.nav-hot-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-gradient);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

/* 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: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  padding: 0.85rem 0.55rem 0.35rem 0.55rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background-color 0.18s ease, color 0.18s 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.9rem 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sidebar);
}

.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);
}

/* ==============================================================================
   Sidebar Collapsed / Rail State (Desktop)
   ============================================================================== */
@media (min-width: 769px) {
  html.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
  }

  html.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
  }

  html.sidebar-collapsed .sidebar-header {
    padding: 1.15rem 0.5rem;
    justify-content: center;
    position: relative;
  }

  html.sidebar-collapsed .brand-link {
    justify-content: center;
    gap: 0;
  }

  html.sidebar-collapsed .brand-title {
    display: none !important;
  }

  html.sidebar-collapsed .sidebar-collapse-btn {
    position: absolute;
    right: -13px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-focus);
    color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    z-index: 105;
  }

  html.sidebar-collapsed .sidebar-collapse-btn:hover {
    transform: translateY(-50%) scale(1.12);
  }

  html.sidebar-collapsed .sidebar-collapse-btn .collapse-icon-left {
    display: none;
  }

  html.sidebar-collapsed .sidebar-collapse-btn .collapse-icon-right {
    display: inline-block;
    font-size: 10px;
  }

  html.sidebar-collapsed .sidebar-nav {
    padding: 0.75rem 0.4rem;
    overflow-x: hidden;
  }

  html.sidebar-collapsed .nav-section-title {
    font-size: 0;
    height: 1px;
    padding: 0;
    margin: 0.65rem 0.4rem;
    background: var(--border-subtle);
    border: none;
    overflow: hidden;
  }

  html.sidebar-collapsed .sidebar-item {
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 2px auto;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-sm);
    position: relative;
  }

  html.sidebar-collapsed .sidebar-item span {
    display: none !important;
  }

  html.sidebar-collapsed .sidebar-item .nav-hot-badge {
    display: none !important;
  }

  html.sidebar-collapsed .sidebar-item i {
    font-size: 16px;
    margin: 0;
    width: auto;
  }

  html.sidebar-collapsed .nav-group-toggle {
    display: none !important;
  }

  html.sidebar-collapsed .nav-group-items {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
  }

  html.sidebar-collapsed .sidebar-footer {
    padding: 0.8rem 0.4rem;
    justify-content: center;
  }

  html.sidebar-collapsed .user-profile-summary {
    justify-content: center;
    width: 100%;
  }

  html.sidebar-collapsed .user-info-text,
  html.sidebar-collapsed .btn-logout-icon {
    display: none !important;
  }
}

/* ==============================================================================
   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;
  position: relative;
  z-index: 1;
  transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease;
}

.top-header {
  height: 56px;
  border: 1px solid var(--border-subtle);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 12px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: calc(100% - 3rem);
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 0 1rem 0 1.15rem;
  min-width: 0;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.top-header:hover {
  border-color: var(--border-muted);
  box-shadow: var(--shadow-lg);
}

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

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

.mobile-brand-badge {
  width: 30px;
  height: 30px;
  background: var(--accent-gradient);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.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(--border-subtle);
  background: var(--bg-surface);
  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(--bg-surface-hover);
  color: var(--accent-primary);
  border-color: var(--accent-primary-border);
  transform: rotate(15deg) scale(1.05);
}

.theme-icon-sun { display: none !important; }
.theme-icon-moon { display: inline-block !important; }
html[data-theme="dark"] .theme-icon-sun { display: inline-block !important; }
html[data-theme="dark"] .theme-icon-moon { display: none !important; }

/* Wallet Badge in Top Header */
.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.42rem 0.8rem;
  border-radius: var(--radius-pill);
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.wallet-badge:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary-border);
  color: var(--accent-primary);
  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: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.btn-header-create:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.content-container {
  flex: 1;
  padding: 1.5rem 1.5rem 84px;
  max-width: 1200px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
}

/* 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);
}

/* Desktop Sidebar Toggle in Top Header */
.desktop-sidebar-toggle {
  display: inline-flex;
  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);
}

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

@media (max-width: 768px) {
  .desktop-sidebar-toggle {
    display: none !important;
  }
}

/* ==============================================================================
   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.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.3;
}

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

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

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

.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: 16px;
  font-weight: 700;
  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: linear-gradient(160deg, #F6FAFF, #DFEAFF);
  border: 1px solid var(--border-subtle);
  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(--shadow-sm);
}

[data-theme="dark"] .dash-hero {
  background: linear-gradient(160deg, #071A44, #0A2458);
  border-color: rgba(255, 255, 255, 0.08);
}

.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(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

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

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

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-gradient);
  color: #FFFFFF;
  box-shadow: var(--shadow-glow);
}

.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: 16px;
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-md);
  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: transparent;
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: var(--border-muted);
  border-radius: 4px;
  transition: background 0.2s ease;
}
.table-wrapper::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary-border);
}

.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 {
  /* Solid header: a sticky backdrop-filter here re-blurs the scrolling rows
     every frame and is a major cause of scroll stutter on the admin tables. */
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: none;
}

.clean-table th:first-child,
.data-table th:first-child,
.clean-table th:last-child,
.data-table th:last-child {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

[data-theme="light"] .clean-table th,
[data-theme="light"] .data-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: none;
}

[data-theme="light"] .clean-table td,
[data-theme="light"] .data-table td {
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

[data-theme="light"] .clean-table tbody tr:nth-child(even),
[data-theme="light"] .data-table tbody tr:nth-child(even) {
  background-color: rgba(8, 20, 44, 0.018);
}

[data-theme="light"] .clean-table tbody tr:hover,
[data-theme="light"] .data-table tbody tr:hover {
  background-color: var(--bg-surface-hover) !important;
}

.clean-table td,
.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  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: var(--bg-surface-hover) !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: var(--accent-primary);
  background: var(--accent-primary-subtle);
  border: 1px solid var(--accent-primary-border);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  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);
  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(24, 76, 236, 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: 600;
  padding: 0.22rem 0.62rem;
  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-pill);
  padding: 0.28rem 0.65rem;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.15s ease;
}

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

.filter-chip.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}

.tab-farm-btn {
  height: 30px;
  padding: 0 0.65rem;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* ==============================================================================
   My Tabs UI Upgrade & Operational Notice
   ============================================================================== */
.tabs-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

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

.tabs-quick-stats {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.quick-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 12px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.quick-stat-pill:hover {
  border-color: var(--border-muted);
  background: var(--bg-surface-hover);
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-dot.dot-running {
  background: var(--status-success);
}

.stat-dot.dot-stopped {
  background: var(--status-warning);
}

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

.stat-value {
  font-weight: 700;
}

.text-running {
  color: var(--status-success);
}

.text-error {
  color: var(--status-error);
}

/* Operational Notice Banner */
.tabs-notice-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1.15rem;
  background: linear-gradient(135deg, rgba(77, 123, 255, 0.08), rgba(24, 76, 236, 0.04));
  border: 1px solid rgba(77, 123, 255, 0.28);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.tabs-notice-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tabs-notice-content {
  flex: 1;
  min-width: 0;
}

.tabs-notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.tabs-notice-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tabs-notice-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--status-success);
  background: var(--status-success-bg);
  border: 1px solid var(--status-success-border);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.tabs-notice-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Launch Tab Studio Card */
.launch-tab-card {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

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

.launch-icon-badge {
  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: 13px;
  flex-shrink: 0;
}

.launch-submit-col {
  display: flex;
  align-items: flex-end;
}

.btn-launch-submit {
  height: 38px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-weight: 600;
  white-space: nowrap;
}

.launch-agreement-wrap {
  margin-top: 0.75rem;
  padding: 0.2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rms-badge-subtle {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.rms-badge-subtle i {
  color: var(--status-success);
}

.terms-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
  color: var(--text-secondary);
  margin: 0;
  user-select: none;
}

.terms-checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}

.advanced-node-box {
  margin-top: 0.65rem;
  padding: 0.85rem 1rem;
  background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.proxy-mode-radios {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.proxy-radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.proxy-radio-pill:hover {
  border-color: var(--accent-primary-border);
  background: var(--bg-surface-hover);
}

.proxy-radio-pill input[type="radio"] {
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.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.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.tab-card:hover {
  border-color: var(--border-muted);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.tab-card[data-status="running"] {
  border-color: rgba(34, 197, 94, 0.35);
}
.tab-card[data-status="stopped"] {
  border-color: rgba(234, 179, 8, 0.35);
}
.tab-card[data-status="error"] {
  border-color: rgba(239, 68, 68, 0.4);
}
.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-lg);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.plan-card:hover {
  border-color: var(--border-muted);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.plan-card.featured {
  border-color: var(--accent-primary);
  background: linear-gradient(160deg, #F6FAFF, #DFEAFF);
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .plan-card.featured {
  background: linear-gradient(160deg, #0A2458, #0B2A66);
  box-shadow: var(--shadow-lg);
}

.plan-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 1rem 0;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.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-lg); padding: 1.1rem 1.3rem; display: flex; flex-direction: column; box-shadow: var(--shadow-md); }
.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: 16px; background-color: var(--bg-surface); box-shadow: var(--shadow-md); }
.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: 600;
  line-height: 1.4;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-primary-hover), #0A34B8);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--accent-primary-border);
  color: var(--accent-primary);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary-border);
}

.btn-outline-primary {
  background-color: var(--bg-surface);
  border-color: var(--accent-primary-border);
  color: var(--accent-primary);
}
.btn-outline-primary:hover {
  background-color: var(--accent-primary-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary-hover);
}

.btn-warning {
  background-color: var(--status-warning-bg);
  border-color: var(--status-warning-border);
  color: var(--status-warning);
}
.btn-warning:hover {
  background-color: var(--status-warning);
  border-color: var(--status-warning);
  color: #08142C;
}

.btn-danger {
  background-color: var(--status-error-bg);
  border-color: var(--status-error-border);
  color: var(--status-error);
}
.btn-danger:hover {
  background-color: var(--status-error);
  color: #ffffff;
}

.btn-sm {
  font-size: 12px;
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius-sm);
}

.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: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-input, .form-select {
  width: 100%;
  padding: 0.62rem 0.8rem;
  font-size: 13.5px;
  font-family: var(--font-sans);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus, .form-select:focus {
  outline: none;
  background-color: var(--bg-surface);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(24, 76, 236, 0.14);
}

/* 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: #041038;
  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: 11px;
  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);
  color: var(--accent-primary);
  border-color: var(--accent-primary-border);
}

.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: 11px;
}

.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: #041038;
  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(56px + env(safe-area-inset-top, 0px));
    top: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: env(safe-area-inset-top, 0px) 0.85rem 0 0.85rem;
    gap: 0.6rem;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    position: sticky;
    z-index: 100;
  }
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  }
  .mobile-nav-toggle:active {
    transform: scale(0.94);
    background: var(--bg-surface-hover);
  }
  .header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
  }
  .header-brand-mobile {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
  }
  .header-brand-mobile img {
    height: 28px;
    width: auto;
    max-width: 42px;
    border-radius: 6px;
    object-fit: contain;
  }
  .header-brand-mobile .mobile-brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent-gradient);
    color: #ffffff;
    font-weight: 800;
    font-size: 12px;
  }
  /* On mobile, page title is in main content; hide header breadcrumbs to prevent ugly truncation */
  .header-breadcrumbs {
    display: none !important;
  }
  .header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
  }
  .btn-theme-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: 1px solid var(--border-subtle) !important;
    background: var(--bg-surface) !important;
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    flex-shrink: 0 !important;
    box-shadow: var(--shadow-sm) !important;
    transition: transform 0.15s ease !important;
  }
  .btn-theme-toggle:active {
    transform: scale(0.92) !important;
  }
  .wallet-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    padding: 0.35rem 0.65rem !important;
    border-radius: var(--radius-pill) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    box-shadow: var(--shadow-sm) !important;
    text-decoration: none !important;
    margin-right: 0 !important;
  }
  .wallet-badge .wallet-icon {
    font-size: 12px;
    color: var(--accent-primary);
  }
  .btn-header-create {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: var(--accent-gradient) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22) !important;
    flex-shrink: 0 !important;
    aspect-ratio: 1 / 1 !important;
    cursor: pointer !important;
    transition: transform 0.15s ease !important;
  }
  .btn-header-create:active {
    transform: scale(0.92) !important;
  }
  .btn-header-create .btn-text {
    display: none !important;
  }
  .btn-header-create i {
    font-size: 14px !important;
    line-height: 1 !important;
    margin: 0 !important;
  }
  @media (max-width: 380px) {
    .btn-theme-toggle {
      display: none !important;
    }
    .header-actions {
      gap: 0.35rem;
    }
    .wallet-badge {
      padding: 0.3rem 0.5rem !important;
      font-size: 11.5px !important;
    }
  }
  .content-container {
    padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  }
  .card {
    padding: 1.1rem;
    border-radius: var(--radius-lg);
  }
  .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: 11px;
  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, Cards & Dynamic Layout (Modern SaaS & Animations)
   ============================================================================== */
.admin-page-container {
  /* No 'forwards': a finished transform animation keeps a containing block
     and a compositing layer for the whole page (and breaks position:fixed
     modals). Without it the layer is released right after the intro. */
  animation: adminPageIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Large blurred card surfaces are costly to composite while scrolling the
   admin tables. Keep the glass look elsewhere but render admin cards solid. */
.admin-page-container .card {
  background-color: var(--bg-surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

@keyframes adminPageIn {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Metric Cards Micro-interactions */
.metric-card {
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, background 0.2s ease;
  user-select: none;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.45);
  border-color: rgba(24, 76, 236, 0.45);
}

.metric-card:active {
  transform: translateY(-1px) scale(0.985);
}

.metric-card.active-tab-metric {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary), var(--shadow-md);
  background: linear-gradient(135deg, rgba(24, 76, 236, 0.08), rgba(17, 24, 39, 0.95));
}

.metric-card.active-tab-metric::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2.5px;
  background: var(--accent-primary);
  border-radius: 9999px;
  box-shadow: none;
}

/* The active metric gradient above ends on a dark navy stop for dark mode.
   In light mode it must stay light, otherwise the card looks muddy and the
   label/value lose contrast. */
[data-theme="light"] .metric-card.active-tab-metric {
  background: linear-gradient(135deg, var(--accent-primary-subtle), #ffffff 72%);
  box-shadow: 0 0 0 1px var(--accent-primary), var(--shadow-md);
}

[data-theme="light"] .metric-card.active-tab-metric::after {
  box-shadow: none;
}

/* Clean status beacon indicator dot */
.status-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-success);
  margin-right: 0.45rem;
  vertical-align: middle;
}

/* Sticky modern tab navigation wrapper */
.admin-nav-wrapper {
  position: sticky;
  top: 56px;
  z-index: 45;
  margin-bottom: 1.5rem;
  padding: 0.45rem 0.6rem;
  /* Opaque instead of backdrop-filter: the sticky bar would otherwise re-blur
     the table scrolling underneath it on every frame. */
  background: rgba(17, 24, 39, 0.97);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 26px -6px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.admin-nav-category-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-nav-category-bar::-webkit-scrollbar {
  display: none;
}

.admin-category-pill {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.admin-category-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.admin-category-pill.active {
  color: var(--accent-primary);
  background: rgba(24, 76, 236, 0.12);
  border-color: rgba(24, 76, 236, 0.3);
}

.admin-tab-nav-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-tab-nav {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
  width: 100%;
}

.admin-tab-nav::-webkit-scrollbar {
  display: none;
}

.admin-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
  flex-shrink: 0;
}

.admin-nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.06);
}

.admin-nav-tab.active {
  color: #ffffff !important;
  background: var(--accent-gradient) !important;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.admin-nav-tab.active i {
  color: #ffffff !important;
}

.admin-tab-count-badge {
  font-size: 11.5px;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-weight: 600;
  transition: background 0.18s ease;
}

.admin-nav-tab.active .admin-tab-count-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.admin-tab-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

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

/* Admin Nav Light Mode Overrides */
[data-theme="light"] .admin-nav-wrapper {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--border-subtle);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .admin-nav-category-bar {
  border-bottom-color: var(--border-subtle);
}

[data-theme="light"] .admin-category-pill {
  color: var(--text-secondary);
}

[data-theme="light"] .admin-category-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

[data-theme="light"] .admin-category-pill.active {
  color: var(--accent-primary);
  background: rgba(24, 76, 236, 0.1);
  border-color: rgba(24, 76, 236, 0.25);
}

[data-theme="light"] .admin-nav-tab {
  color: var(--text-secondary);
}

[data-theme="light"] .admin-nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
  border-color: var(--border-subtle);
}

[data-theme="light"] .admin-nav-tab.active {
  color: #ffffff !important;
  background: var(--accent-gradient) !important;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(8, 20, 44, 0.12);
}

[data-theme="light"] .admin-tab-count-badge {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
}

[data-theme="light"] .admin-nav-tab.active .admin-tab-count-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

[data-theme="light"] .admin-tab-nav-arrow {
  background: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

[data-theme="light"] .admin-tab-nav-arrow:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Tab Panes: switch instantly. Animating a pane that contains an entire table
   forces the browser to composite/raster the full page on every tab click,
   which is what made the admin panel feel jerky. */
.admin-tab-pane {
  display: none;
  contain: layout style;
}

.admin-tab-pane.active {
  display: block !important;
}

/* Quick In-Tab Search Toolbar */
.admin-filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.admin-filter-search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 440px;
}

.admin-filter-search-box input {
  width: 100%;
  padding-left: 2rem;
  padding-right: 1.75rem;
  height: 32px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-filter-search-box input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-primary-subtle);
}

.admin-filter-search-box .search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.admin-filter-search-box .clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  display: none;
}

.admin-filter-search-box .clear-btn:hover {
  color: var(--text-primary);
}

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

.admin-filter-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-filter-chip:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.admin-filter-chip.active {
  background: rgba(24, 76, 236, 0.15);
  color: var(--accent-primary);
  border-color: rgba(24, 76, 236, 0.35);
  font-weight: 600;
}

.admin-count-indicator {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Toast notification container and items */
.admin-toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 380px;
  width: calc(100% - 2.5rem);
}

.admin-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: adminToastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-theme="light"] .admin-toast {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.admin-toast.toast-success {
  border-color: rgba(18, 161, 80, 0.4);
}

.admin-toast.toast-success i {
  color: var(--status-success);
}

.admin-toast.toast-error {
  border-color: rgba(229, 72, 77, 0.4);
}

.admin-toast.toast-error i {
  color: var(--status-error);
}

.admin-toast.toast-info {
  border-color: rgba(24, 76, 236, 0.4);
}

.admin-toast.toast-info i {
  color: var(--accent-primary);
}

.admin-toast.toast-out {
  opacity: 0;
  transform: translateX(20px);
}

@keyframes adminToastIn {
  0% { opacity: 0; transform: translateY(-10px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==============================================================================
   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.2);
  overflow: hidden;
}

/* Seamless blend when inside a card to avoid nested box-in-box look */
.card .table-enhanced-container {
  margin-bottom: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.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;
}

/* Ensure no th cell has rounded corners when nested inside container */
.table-enhanced-container .clean-table th,
.table-enhanced-container .data-table th,
.table-enhanced-container th:first-child,
.table-enhanced-container th:last-child {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

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

/* Table Light Mode Overrides */
[data-theme="light"] .table-enhanced-container {
  background-color: #ffffff;
  border-color: var(--border-subtle);
  box-shadow: 0 2px 12px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .table-toolbar {
  background: var(--bg-secondary);
  border-bottom-color: var(--border-subtle);
}

[data-theme="light"] .table-search-input {
  background-color: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

[data-theme="light"] .table-page-size-select {
  background-color: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

[data-theme="light"] .table-pagination-footer {
  background: var(--bg-secondary);
  border-top-color: var(--border-subtle);
}

[data-theme="light"] .table-page-btn {
  background-color: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

[data-theme="light"] .table-page-btn:hover:not(:disabled) {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

[data-theme="light"] .table-empty-row td {
  background-color: #ffffff !important;
}

/* Subtle Action Buttons (Copy, View Pass, Close, etc.) */
.btn-icon-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.05));
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-icon-subtle:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.1));
  color: var(--text-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.btn-icon-subtle:active {
  transform: translateY(0);
}

[data-theme="light"] .btn-icon-subtle {
  background: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

[data-theme="light"] .btn-icon-subtle:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.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);
  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(24, 76, 236, 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);
  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);
  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: #071A44;
  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: var(--text-muted);
  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(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  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: var(--accent-gradient);
  box-shadow: var(--shadow-glow);
  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(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--accent-primary);
  box-shadow: var(--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: var(--shadow-glow);
}

.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);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.45rem 0.25rem;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  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-border);
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.btn-duration.active {
  background: var(--accent-gradient) !important;
  border-color: transparent !important;
  color: #ffffff !important;
  box-shadow: var(--shadow-glow);
}

/* Tab Card Package & Expiry Indicators */
.tab-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 11px;
  padding: 2px 8px;
  background: var(--accent-primary-subtle);
  border: 1px solid var(--accent-primary-border);
  border-radius: var(--radius-xs);
  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: 1.1rem 1.3rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  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.4rem;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.badge-role {
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary-border);
  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(229, 72, 77, 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: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

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

.chip-available {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.chip-available 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(24, 76, 236, 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;
  }
}

/* ============================================================
   SIDEBAR (compact + grouped) — redesign
   ============================================================ */
.sidebar-nav {
  padding: 0.7rem 0.6rem;
  gap: 0.12rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

.nav-section-title {
  font-size: 11px;
  padding: 0.6rem 0.55rem 0.25rem 0.55rem;
  letter-spacing: 0.02em;
}

.sidebar-item {
  padding: 0.42rem 0.6rem;
  font-size: 13px;
  line-height: 1.5;
  gap: 0.55rem;
  border-radius: 8px;
  position: relative;
}

.sidebar-item i {
  width: 15px;
  font-size: 13px;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--accent-primary);
}

/* Collapsible "more" group */
.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.55rem 0.25rem 0.55rem;
  font-family: inherit;
}

.nav-group-toggle:hover {
  color: var(--text-primary);
}

.nav-group-toggle .nav-group-chevron {
  transition: transform 0.18s ease;
  font-size: 11px;
}

.nav-group-toggle.open .nav-group-chevron {
  transform: rotate(180deg);
}

.nav-group-items {
  display: grid;
  gap: 0.12rem;
}

.nav-group-items.collapsed {
  display: none;
}

/* ============================================================
   BOTTOM DOCK — primary actions + "more" sheet
   ============================================================ */
.dock-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.dock-sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.dock-sheet {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(14px) scale(0.97);
  width: min(430px, calc(100vw - 20px));
  padding: 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-popover);
  z-index: 1200;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-sheet.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.dock-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 0.3rem;
  border-radius: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.dock-sheet-item i {
  font-size: 17px;
  color: var(--accent-primary);
}

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

.dock-sheet-item.danger i {
  color: var(--status-error);
}

@media (max-width: 480px) {
  .dock-sheet {
    bottom: 78px;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   DEPOSIT PAGE (Nạp tiền) — redesign
   ============================================================ */
.dep-wrap {
  max-width: 880px;
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
}

.dep-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(rgba(120, 160, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 255, 0.12) 1px, transparent 1px),
    radial-gradient(120% 140% at 0% 0%, rgba(77, 123, 255, 0.35), transparent 58%),
    var(--panel-navy);
  background-size: 24px 24px, 24px 24px, auto, auto;
  padding: 1.5rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}

.dep-hero-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #8FA8D8;
  font-weight: 700;
}

.dep-hero-balance {
  font-family: var(--font-display);
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  line-height: 1.1;
  margin-top: 0.2rem;
}

.dep-hero-balance small {
  font-size: 1rem;
  font-weight: 600;
  color: #C8D8FC;
}

.dep-hero-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  color: #B9C6E2;
  margin-top: 0.35rem;
}

.dep-step-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
}

.dep-step-num {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

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

.dep-step-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0;
}

.dep-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.dep-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  padding: 0.62rem 0.4rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dep-chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.dep-chip.active {
  border-color: var(--accent-primary);
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary-border) inset;
}

.dep-amount-row {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.dep-amount-field {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dep-amount-field:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(24, 76, 236, 0.14);
}

.dep-amount-field i {
  color: var(--accent-primary);
  font-size: 15px;
}

.dep-amount-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0;
}

.dep-amount-field .dep-currency {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.dep-hint {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  margin-top: 0.7rem;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.dep-cta {
  width: 100%;
  min-width: 190px;
  padding: 0.8rem 1.2rem;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.dep-qr-grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 760px) {
  .dep-qr-grid {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }
}

.dep-qr-box {
  background: #ffffff;
  padding: 0.75rem;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  max-width: 260px;
  margin: 0 auto;
}

.dep-qr-box img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.dep-info {
  display: grid;
  gap: 0.55rem;
}

.dep-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}

.dep-info-row .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 700;
}

.dep-info-row .value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 14px;
  margin-top: 0.15rem;
  word-break: break-word;
}

.dep-info-row .value.mono {
  font-family: var(--font-mono);
}

.dep-info-row .value.amount {
  color: var(--accent-primary);
  font-size: 1.05rem;
}

.dep-info-row.required {
  background: var(--accent-primary-subtle);
  border-color: var(--accent-primary);
}

.dep-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.06em;
}

.dep-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}

.dep-countdown {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12px;
  font-weight: 700;
  color: var(--status-warning);
  background: var(--status-warning-bg);
  border: 1px solid var(--status-warning-border);
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-pill);
}

.dep-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.dep-history-head h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

/* ==============================================================================
   AI Support Chatbox
   ============================================================================== */
.support-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1100;
  font-family: var(--font-sans);
}

.support-chat[hidden],
.support-chat-panel[hidden] {
  display: none !important;
}

.support-chat-launcher {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--accent-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.support-chat-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.35);
}

.support-chat-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
}

.support-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.support-chat-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.support-chat-title strong {
  font-size: 13.5px;
  color: var(--text-primary);
}

.support-chat-title span {
  font-size: 12px;
  color: var(--text-muted);
}

.support-chat-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.support-chat-close:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-surface);
}

.support-chat-bubble {
  max-width: 86%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  font-size: 12.8px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.support-chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.support-chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: var(--text-on-accent);
  border-bottom-right-radius: 4px;
}

/* Markdown rendered inside assistant bubbles */
.support-chat-bubble.support-chat-markdown {
  white-space: normal;
}

.support-chat-bubble.support-chat-markdown > :first-child {
  margin-top: 0;
}

.support-chat-bubble.support-chat-markdown > :last-child {
  margin-bottom: 0;
}

.support-chat-bubble.support-chat-markdown p {
  margin: 0 0 0.5rem;
}

.support-chat-bubble.support-chat-markdown p:last-child {
  margin-bottom: 0;
}

.support-chat-bubble.support-chat-markdown strong {
  font-weight: 700;
}

.support-chat-bubble.support-chat-markdown a {
  color: var(--accent-primary);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.support-chat-bubble.support-chat-markdown a:hover {
  color: var(--accent-primary-hover);
}

.support-chat-bubble.support-chat-markdown .md-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1px 5px;
}

.support-chat-bubble.support-chat-markdown .md-pre {
  margin: 0.5rem 0;
  padding: 0.6rem 0.7rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow-x: auto;
}

.support-chat-bubble.support-chat-markdown .md-code-block {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre;
  color: var(--text-primary);
}

.support-chat-bubble.support-chat-markdown .md-list {
  margin: 0.35rem 0 0.55rem;
  padding-left: 1.15rem;
}

.support-chat-bubble.support-chat-markdown .md-list li {
  margin: 0.15rem 0;
}

.support-chat-bubble.support-chat-markdown .md-list li::marker {
  color: var(--accent-primary);
}

.support-chat-bubble.support-chat-markdown .md-heading {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.3;
  margin: 0.55rem 0 0.25rem;
}

.support-chat-bubble.support-chat-markdown .md-h1 { font-size: 15px; }
.support-chat-bubble.support-chat-markdown .md-h2 { font-size: 14px; }
.support-chat-bubble.support-chat-markdown .md-h3,
.support-chat-bubble.support-chat-markdown .md-h4 { font-size: 13px; }

.support-chat-bubble.support-chat-markdown .md-hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: 0.6rem 0;
}

.support-chat-bubble.support-chat-markdown .md-quote {
  margin: 0.4rem 0;
  padding-left: 0.6rem;
  border-left: 2px solid var(--border-subtle);
  color: var(--text-secondary);
}

.support-chat-bubble.support-chat-markdown .md-table {
  display: block;
  width: 100%;
  margin: 0.5rem 0;
  border-collapse: collapse;
  font-size: 11.5px;
  overflow-x: auto;
}

.support-chat-bubble.support-chat-markdown .md-table th,
.support-chat-bubble.support-chat-markdown .md-table td {
  border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.45rem;
  text-align: left;
  white-space: normal;
}

.support-chat-bubble.support-chat-markdown .md-table th {
  background: var(--bg-surface);
  font-weight: 700;
}

.support-chat-typing {
  color: var(--text-muted);
  font-style: italic;
}

.support-chat-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.support-chat-form input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 0.7rem;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.support-chat-form input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-subtle);
}

.support-chat-form button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: none;
  background: var(--accent-gradient);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.support-chat-form button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.support-chat-note {
  padding: 0 0.75rem 0.55rem;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface);
}

@media (max-width: 768px) {
  .support-chat {
    right: 14px;
    bottom: 84px;
  }

  .support-chat-panel {
    bottom: 64px;
    width: calc(100vw - 28px);
    height: min(70vh, 480px);
  }

  .support-chat-form input {
    font-size: 16px;
  }
}

/* ==============================================================================
   AUTH PAGES — Clean cloud SaaS entry cards
   ============================================================================== */
.auth-shell {
  max-width: 460px;
  margin: 3.5rem auto;
}

.auth-card {
  position: relative;
  padding: 2rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-head {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background: var(--accent-gradient);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.auth-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent-primary);
  margin-bottom: 0.4rem;
}

.auth-card .page-title {
  font-size: 1.65rem;
}

.auth-card .form-input {
  min-height: 44px;
}

.auth-card .auth-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 0.75rem;
}

.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-links a {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
}

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

/* Status alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.alert i {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.alert-error {
  background: var(--status-error-bg);
  border-color: var(--status-error-border);
  color: var(--status-error);
}

.alert-success {
  background: var(--status-success-bg);
  border-color: var(--status-success-border);
  color: var(--status-success);
}

.alert-warning {
  background: var(--status-warning-bg);
  border-color: var(--status-warning-border);
  color: var(--status-warning);
}

/* End of sidebar/dock/deposit redesign */




