/**
 * GlassCAM Studio - Design System
 * Tema Industrial Dark Mode, Glassmorphism, Micro-interações e Tipografia Moderna
 */

:root {
  /* ================= DESIGN TOKENS OFICIAIS FEDEX CONCEPT 02 ================= */
  --fx-black: #08090B;
  --fx-white: #FFFFFF;
  --fx-charcoal: #17191D;
  --fx-grey: #9FA3A9;
  --fx-panel: #111316;
  --fx-panel2: #17191D;
  --fx-line: #303236;
  --fx-ink: #F3F4F5;
  --fx-muted: #95999F;
  --fx-radius: 18px;

  /* Mapeamento GlassCAM Studio Pro */
  --bg-base: var(--fx-black);
  --bg-surface: var(--fx-panel);
  --bg-surface-elevated: var(--fx-charcoal);
  --bg-glass: rgba(17, 19, 22, 0.92);
  --border-subtle: var(--fx-line);
  --border-focus: #FFFFFF;
  
  --primary: #FFFFFF;
  --primary-hover: #e0e2e5;
  --primary-glow: rgba(255, 255, 255, 0.2);

  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-purple: #8b5cf6;

  --text-main: var(--fx-ink);
  --text-muted: var(--fx-grey);
  --text-dim: #70757c;

  --sidebar-w: 380px;
  --header-h: 62px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --shadow-sm: 0 2px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 30px -6px rgba(0,0,0,0.7), 0 8px 12px -6px rgba(0,0,0,0.7);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Scrollbar estilizada Concept 02 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: #24272c;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b3f46;
}

/* ================= HEADER SUPERIOR (CONCEPT 02) ================= */
.app-header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: var(--fx-white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fx-black);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.22);
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: scale(1.04);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title .brand-name {
  font-family: 'Michroma', sans-serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--fx-white);
}

.brand-title .brand-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fx-grey);
}

.brand-tag {
  font-family: 'Rajdhani', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 2px 7px;
  background: #17191D;
  color: var(--fx-ink);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.file-badge {
  background: var(--bg-surface-elevated);
  padding: 5px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ================= BOTÕES CONCEPT 02 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid #383b40;
  background: #1c1e22;
  color: #eee;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn:hover {
  background: #282b30;
  border-color: #555960;
  color: #fff;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--fx-white);
  color: var(--fx-black);
  border-color: var(--fx-white);
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  background: #e0e2e5;
  border-color: #e0e2e5;
  color: #000;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.25);
}

.btn-secondary {
  background: #1c1e22;
  color: var(--text-main);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: #282b30;
  border-color: #555960;
}

.btn-success {
  background: #142820;
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}
.btn-success:hover {
  background: #1a362b;
  border-color: #34d399;
  color: #fff;
}

.btn-icon {
  padding: 8px;
  background: #1c1e22;
  color: var(--text-muted);
  border-color: var(--border-subtle);
}
.btn-icon:hover {
  color: #fff;
  border-color: #555960;
  background: #282b30;
}

/* ================= LAYOUT PRINCIPAL ================= */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  position: relative;
  overflow: hidden;
}

/* Elementos de Suporte Mobile/Tablet */
.sidebar-toggle-btn {
  display: none;
}

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

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 80;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* ================= PAINEL LATERAL (CONCEPT 02) ================= */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.3s ease;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.tab-btn {
  flex: 1;
  padding: 13px 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: #ffffff;
  border-bottom-color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* ================= CARDS E SEÇÕES (CONCEPT 02) ================= */
.section-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}

.section-title {
  font-family: 'Michroma', sans-serif;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #ffffff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.prop-item {
  background: var(--bg-surface);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.prop-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.prop-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffffff;
}

/* Inputs de parametrização */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #c6cacf;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25);
}

/* ================= ÁREA DO CANVAS (CONCEPT 02) ================= */
.canvas-container {
  flex: 1;
  position: relative;
  background-color: var(--fx-black);
  overflow: hidden;
  cursor: grab;
}

.canvas-container:active {
  cursor: grabbing;
}

#cadCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Controles Flutuantes do Canvas (HUD) */
.hud-top-right {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
}

.hud-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-lg);
}

.hud-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.hud-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-main);
}

.hud-btn.active {
  background: #25282e;
  color: #ffffff;
  border: 1px solid #4a4e54;
}

/* Barra Flutuante de Simulação CNC */
.hud-simulation-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 30;
  box-shadow: var(--shadow-lg);
}

.sim-slider {
  width: 220px;
  accent-color: #ffffff;
  cursor: pointer;
}

.sim-speed-select {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 600;
}

/* Footer de coordenadas */
.hud-status-footer {
  position: absolute;
  bottom: 8px;
  left: 16px;
  font-family: 'Rajdhani', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(8, 9, 11, 0.92);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  z-index: 20;
}

/* Overlay de Drag and Drop */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  border: 2px dashed #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 100;
  color: #fff;
  font-family: 'Michroma', sans-serif;
  font-size: 16px;
  letter-spacing: 0.08em;
  font-weight: 400;
}
.drop-overlay.active {
  display: flex;
}

/* ================= MODAIS (CONCEPT 02) ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.85);
}

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

.modal-header h3 {
  font-family: 'Michroma', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

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

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

.spin {
  animation: spin 1s linear infinite;
}

.webglass-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #ffffff;
  transition: var(--transition);
}

.webglass-result-item:hover {
  background: #23262c;
  border-color: #555960;
  transform: translateX(2px);
}

/* ================= RESPONSIVIDADE (IPADS, IPHONE 13 PRO & MOBILE) ================= */

/* Tablets em Modo Paisagem / iPads (até 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 330px;
  }

  .app-header {
    padding: 0 14px;
  }

  .header-actions .btn span {
    display: inline;
  }

  .hud-btn {
    min-height: 38px;
    padding: 6px 10px;
  }

  .form-control {
    font-size: 15px;
  }
}

/* iPads em Modo Retrato e Tablets Médios (até 860px) */
@media (max-width: 860px) {
  .sidebar-toggle-btn {
    display: inline-flex;
    margin-right: 2px;
  }

  .sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface-elevated);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(380px, 88vw);
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .hud-top-right {
    top: calc(12px + var(--safe-top));
    right: calc(12px + var(--safe-right));
  }

  .hud-simulation-bar {
    bottom: calc(16px + var(--safe-bottom));
    width: calc(100% - 24px);
    max-width: 520px;
    padding: 8px 14px;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Smartphones / iPhone 13 Pro (Viewport: 390x844px e menores até 520px) */
@media (max-width: 520px) {
  .app-header {
    height: auto;
    min-height: 54px;
    padding: calc(6px + var(--safe-top)) 10px 6px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .brand-wrapper {
    gap: 8px;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .brand-title {
    font-size: 14px;
    gap: 4px;
  }

  .brand-tag {
    display: none; /* Oculta tag para liberar espaço */
  }

  .header-status {
    gap: 6px;
  }

  .file-badge {
    padding: 3px 8px;
    font-size: 11px;
    max-width: 145px;
  }

  #fileNameBadge {
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 3px;
    gap: 6px;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-actions .btn {
    padding: 6px 10px;
    font-size: 11px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
  }

  .app-container {
    height: calc(100dvh - 100px); /* Compensa header com botões rolantes */
  }

  /* HUD Superior no iPhone */
  .hud-top-right {
    top: calc(8px + var(--safe-top));
    right: calc(8px + var(--safe-right));
    gap: 6px;
  }

  .hud-panel {
    padding: 4px;
    gap: 2px;
  }

  .hud-btn {
    padding: 6px 8px;
    font-size: 11px;
    min-height: 36px;
  }

  .hud-btn span {
    font-size: 11px;
  }

  /* Barra de Simulação Compacta */
  .hud-simulation-bar {
    bottom: calc(10px + var(--safe-bottom));
    width: calc(100% - 16px);
    max-width: 370px;
    padding: 6px 10px;
    gap: 6px;
    border-radius: var(--radius-md);
  }

  .hud-simulation-bar .btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .sim-slider {
    width: 100%;
    min-width: 100px;
  }

  .sim-speed-select {
    font-size: 11px;
    padding: 3px 6px;
  }

  #simOrderSelect {
    display: none; /* Deixa a ordem padrão da máquina para economizar espaço */
  }

  #simStatusText {
    font-size: 10px;
    width: 100%;
    text-align: center;
  }

  /* Footer de Coordenadas Compacto */
  .hud-status-footer {
    bottom: calc(4px + var(--safe-bottom));
    left: calc(8px + var(--safe-left));
    font-size: 9px;
    padding: 3px 6px;
    max-width: 90vw;
    flex-wrap: wrap;
  }

  /* Prevenção de Auto-Zoom do Safari iOS em Inputs */
  .form-control,
  input[type="text"],
  input[type="number"],
  select {
    font-size: 16px !important; /* Impede zoom forçado no iPhone 13 Pro */
  }

  /* Modais Adaptados para Mobile */
  .modal-dialog {
    width: 95vw;
    max-width: 95vw;
    max-height: 85dvh;
    margin: 10px;
  }

  .modal-header,
  .modal-footer {
    padding: 12px 14px;
  }

  .modal-body {
    padding: 14px;
  }
}

/* ==========================================================================
   FEDEX SOLUÇÕES — CONCEPT 02 DESIGN SYSTEM & ACCESS GATEWAY
   ========================================================================== */

@font-face {
  font-family: 'Michroma';
  src: url('../designer/fonts/Inter,Michroma,Rajdhani/Michroma/Michroma-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Rajdhani';
  src: url('../designer/fonts/Inter,Michroma,Rajdhani/Rajdhani/Rajdhani-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Rajdhani';
  src: url('../designer/fonts/Inter,Michroma,Rajdhani/Rajdhani/Rajdhani-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Rajdhani';
  src: url('../designer/fonts/Inter,Michroma,Rajdhani/Rajdhani/Rajdhani-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Rajdhani';
  src: url('../designer/fonts/Inter,Michroma,Rajdhani/Rajdhani/Rajdhani-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --fx-black: #08090B;
  --fx-white: #FFFFFF;
  --fx-charcoal: #17191D;
  --fx-grey: #9FA3A9;
  --fx-panel: #111316;
  --fx-panel2: #17191D;
  --fx-line: #303236;
  --fx-ink: #F3F4F5;
  --fx-muted: #95999F;
  --fx-radius: 18px;
}

/* Gateway Overlay Container */
#remoteLockOverlay.gateway-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--fx-black);
  background-image: 
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.05) 0%, transparent 60%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 30px 24px 24px;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

#remoteLockOverlay.portal-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(1.02);
}

/* Topbar in Gateway */
.gateway-topbar {
  width: 100%;
  max-width: 1100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--fx-line);
}

.gateway-micro {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--fx-grey);
}

.gateway-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--fx-line);
  background: rgba(23, 25, 29, 0.7);
  border-radius: 99px;
  padding: 5px 14px;
  color: #e2e4e6;
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Hero Center */
.gateway-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  max-width: 680px;
  width: 100%;
  padding: 16px 0;
}

/* Monogram X with glow */
.gateway-brand-symbol {
  width: 120px;
  height: 120px;
  margin-bottom: 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 26px rgba(255, 255, 255, 0.22));
  animation: fxFloat 5s ease-in-out infinite;
}

@keyframes fxFloat {
  0%, 100% { transform: translateY(0px) scale(1); filter: drop-shadow(0 0 26px rgba(255, 255, 255, 0.22)); }
  50% { transform: translateY(-5px) scale(1.02); filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.38)); }
}

.gateway-brand-symbol svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Wordmark FEDEX */
.gateway-wordmark-wrap {
  width: 210px;
  max-width: 80%;
  margin: 0 auto 14px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.gateway-wordmark-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Welcome Titles */
.gateway-welcome-title {
  font-family: 'Michroma', sans-serif;
  font-size: clamp(20px, 3.2vw, 30px);
  font-weight: 400;
  color: var(--fx-white);
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  line-height: 1.25;
  text-transform: uppercase;
}

.gateway-welcome-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--fx-grey);
  letter-spacing: 0.08em;
  margin: 0 0 24px;
  line-height: 1.5;
  max-width: 520px;
}

/* Status Pill */
.gateway-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  border-radius: 99px;
  border: 1px solid var(--fx-line);
  background: var(--fx-panel);
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #bdc1c5;
  text-transform: uppercase;
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

.gateway-status-pill.authorized {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.gateway-status-pill.error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.gateway-status-pill.checking {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.gateway-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: fxPulse 1.8s ease-in-out infinite;
}

.gateway-pulse-dot.green {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

.gateway-pulse-dot.red {
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.gateway-pulse-dot.yellow {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
}

@keyframes fxPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

/* Action Button: ACESSAR SISTEMA */
.gateway-actions {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gateway-access-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 34px;
  border-radius: 10px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  outline: none;
  border: 1px solid #383b40;
  background: #181a1d;
  color: #72767c;
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}

.gateway-access-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.gateway-access-btn.ready {
  background: var(--fx-white);
  color: var(--fx-black);
  border-color: var(--fx-white);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.3), 0 8px 24px rgba(0,0,0,0.5);
  animation: fxBtnReady 2.2s infinite ease-in-out;
  cursor: pointer;
}

@keyframes fxBtnReady {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.22), 0 6px 20px rgba(0,0,0,0.4);
  }
  50% {
    box-shadow: 0 0 38px rgba(255, 255, 255, 0.45), 0 8px 28px rgba(0,0,0,0.5);
  }
}

.gateway-access-btn.ready:hover {
  transform: translateY(-2px) scale(1.025);
  background: #ffffff;
  box-shadow: 0 0 45px rgba(255, 255, 255, 0.55), 0 10px 28px rgba(0,0,0,0.6);
}

.gateway-access-btn.ready:active {
  transform: translateY(0px) scale(0.99);
}

.gateway-access-btn.retry {
  background: #241416;
  color: #fca5a5;
  border-color: #ef4444;
  cursor: pointer;
}

.gateway-access-btn.retry:hover {
  background: #33181b;
  border-color: #f87171;
}

.gateway-hint {
  margin-top: 12px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #656b72;
  text-transform: uppercase;
}

/* Footer Telemetry */
.gateway-footer {
  width: 100%;
  max-width: 1100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--fx-line);
  font-family: 'Rajdhani', sans-serif;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #656b72;
  text-transform: uppercase;
}

.gateway-footer strong {
  color: #e2e4e6;
  font-weight: 600;
}

