/* ═══════════════════════════════════════════════════
   OQUEI PORTAL — CSS PIXEL-PERFECT
   Mobile-first (400px target)
   ═══════════════════════════════════════════════════ */

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

:root {
  --bg-dark: #0b3162;
  --bg-dark-2: #0d3a72;
  --bg-header: #173e6e;
  --primary-green: #6aab35;
  --login-green: #c5cf7a;
  --login-green-hover: #b5c06e;
  --card-bg: #ffffff;
  --body-bg: #eef1f6;
  --text-dark: #1a1a1a;
  --text-muted: #525252;
  --text-light: #737373;
  --text-white: #ffffff;
  --border-color: #d4d4d4;
  --border-light: #e5e7eb;
  --badge-green-bg: #dcfce7;
  --badge-green-text: #15803d;
  --badge-red-bg: #fef2f2;
  --badge-red-text: #b91c1c;
  --badge-normal-bg: #dcfce7;
  --badge-normal-text: #166534;
  --tab-active-border: #c5d444;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.12);
  --shadow-login: 0 10px 40px rgba(0,0,0,0.25);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { height: 100%; overflow-x: hidden; }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; min-height: 100%; overflow-x: hidden; }

/* ═══════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════ */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0d3a72 0%, #0a2f5f 40%, #091e42 100%);
  padding: 40px 20px;
  overflow-x: hidden;
}

.login-logo {
  margin-bottom: 28px;
  text-align: center;
}

.login-logo-img {
  width: 160px;
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.35));
}

/* Card */
.login-card {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: var(--shadow-login);
  width: calc(100% - 8px);
  max-width: 400px;
  overflow: hidden;
}

/* Tab — single tab with active green-yellow border */
.login-tabs {
  display: flex;
}

.login-tab {
  flex: 1;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  background: var(--card-bg);
  border: none;
  border-top: 3px solid var(--tab-active-border);
  text-align: center;
  cursor: default;
}

.login-tab.inactive {
  background: #f0f0f0;
  color: var(--text-light);
  font-weight: 500;
  border-top-color: transparent;
  cursor: pointer;
}

/* Content */
.login-tab-content {
  display: none;
  padding: 28px 24px 32px;
}

.login-tab-content.active {
  display: block;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Floating Label Input — matches original exactly */
.input-group {
  position: relative;
  margin-bottom: 20px;
}

.login-input {
  width: 100%;
  padding: 18px 14px 8px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
  height: 56px;
}

.login-input:focus {
  border-color: #6aab35;
  border-width: 2px;
  padding: 17px 13px 7px;
}

.login-input.error {
  border-color: #ef4444;
}

/* Floating label */
.input-label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-light);
  pointer-events: none;
  transition: all 0.15s ease-out;
  background: transparent;
  padding: 0 4px;
  line-height: 1;
}

.login-input:focus + .input-label,
.login-input:not(:placeholder-shown) + .input-label {
  top: 0;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--card-bg);
}

.login-input:focus + .input-label {
  color: #6aab35;
}

/* Button — olive/sage green like original */
.login-btn {
  width: 100%;
  padding: 14px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  background: var(--login-green);
  border: none;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}

.login-btn:hover {
  background: var(--login-green-hover);
}

.login-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.login-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Error */
.login-error {
  margin-top: 12px;
  font-size: 13px;
  color: #ef4444;
  text-align: center;
  min-height: 18px;
}

/* ═══════════════════════════════════════════════════
   DASHBOARD PAGE
   ═══════════════════════════════════════════════════ */
.dashboard-body {
  min-height: 100vh;
  background: var(--body-bg);
  display: flex;
}

/* Sidebar (desktop) */
.sidebar {
  width: 200px;
  background: var(--bg-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 16px;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  padding: 12px 20px 28px;
  text-align: center;
}

.sidebar-logo img {
  width: 110px;
  height: auto;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar-link.active {
  background: var(--primary-green);
  color: #fff;
  font-weight: 600;
}

.sidebar-link:hover:not(.active) {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-link svg { width: 20px; height: 20px; }

/* Main content */
.main-content {
  flex: 1;
  margin-left: 200px;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Header bar */
.header-bar {
  background: var(--bg-header);
  color: rgba(255,255,255,0.9);
  padding: 8px 20px;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
}

.header-bar-info {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.header-bar-info strong { font-weight: 700; white-space: nowrap; }

.header-bar-info span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-sair {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.9);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-sair:hover { background: rgba(255,255,255,0.1); }
.btn-sair svg { width: 18px; height: 18px; }

/* Dashboard body */
.dash-body {
  padding: 24px 20px;
  max-width: 600px;
  overflow-x: hidden;
  box-sizing: border-box;
  width: 100%;
}

.dash-greeting {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.dash-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 24px;
}

/* Section title */
.dash-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.dash-section-title svg { width: 18px; height: 18px; color: var(--text-light); }

/* Fatura card */
.fatura-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  overflow: hidden;
  box-sizing: border-box;
}

.fatura-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}

.fatura-badge.a-vencer {
  background: var(--badge-green-bg);
  color: var(--badge-green-text);
}

.fatura-badge.vencida {
  background: var(--badge-red-bg);
  color: var(--badge-red-text);
}

.fatura-valor {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.fatura-vencimento {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.fatura-vencimento svg { width: 15px; height: 15px; }

/* Botão pagar */
.btn-pagar {
  width: 100%;
  max-width: 100%;
  padding: 13px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--primary-green);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  margin-bottom: 28px;
  box-sizing: border-box;
}

.btn-pagar:hover { background: #5e9a2e; }
.btn-pagar:active { transform: scale(0.98); }
.btn-pagar svg { width: 20px; height: 20px; }

/* Acesso rapido + Subtitle */
.dash-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 14px;
}

/* Plano card */
.plano-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.plano-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--badge-normal-bg);
  color: var(--badge-normal-text);
  margin-bottom: 10px;
}

.plano-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 14px;
  line-height: 1.35;
}

.plano-info-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.plano-info-value {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════
   PAYMENT DRAWER
   ═══════════════════════════════════════════════════ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--card-bg);
  z-index: 101;
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
}

.drawer.open { right: 0; }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 2;
}

.drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.drawer-close:hover { color: var(--text-dark); }
.drawer-close svg { width: 24px; height: 24px; }

.drawer-body { padding: 20px; }

/* Invoice summary in drawer */
.drawer-invoice-info {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 14px;
  background: #f8f9fb;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 20px;
}

.drawer-info-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-light);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.drawer-info-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 2px;
}

/* PIX Section */
.pix-section { margin-top: 20px; }

.pix-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.pix-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.pix-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 20px;
  background: #f8f9fb;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  margin-bottom: 20px;
}

.pix-qr-container img {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

.pix-qr-valor {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-green);
  margin-top: 10px;
}

.pix-copia-cola { margin-bottom: 16px; overflow: hidden; }

.pix-code-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pix-code-box {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.pix-code-text {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-muted);
  background: #f8f9fb;
  word-break: break-all;
  line-height: 1.4;
  max-height: 60px;
  overflow: hidden;
}

.btn-copiar {
  padding: 10px 18px;
  background: var(--primary-green);
  color: #fff;
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-copiar:hover { background: #5e9a2e; }
.btn-copiar.copied { background: #16a34a; }

.pix-timer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 14px;
}

.pix-timer strong { color: var(--text-dark); font-weight: 700; }

.pix-instructions {
  margin-top: 20px;
  padding: 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}

.pix-instructions h4 {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 8px;
}

.pix-instructions ol {
  font-size: 12px;
  color: #78350f;
  padding-left: 18px;
  line-height: 1.8;
}

/* ═══════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,49,98,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.loading-overlay.show { opacity: 1; pointer-events: auto; }

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--primary-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 14px;
}

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

.loading-text {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════
   MOBILE HEADER (shown only on mobile)
   ═══════════════════════════════════════════════════ */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-dark);
}

.mobile-header-logo {
  height: 36px;
  width: auto;
}

.mobile-header-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  padding: 6px;
}

.mobile-header-btn svg { width: 22px; height: 22px; }

/* Contract card (mobile only) */
.contract-card {
  display: none;
  margin: 12px 16px 0;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.contract-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.contract-card-address {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Visibility helpers */
.desktop-only { display: flex; }
.mobile-only { display: none; }

/* ═══════════════════════════════════════════════════
   BOTTOM NAV (Mobile) — matches original pill style
   ═══════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-dark);
  z-index: 50;
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 50%;
  transition: all 0.2s;
}

.bottom-nav-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  transition: all 0.2s;
  color: rgba(255,255,255,0.5);
}

.bottom-nav-icon-wrap.active {
  background: var(--primary-green);
  color: #fff;
}

.bottom-nav-icon-wrap svg { width: 22px; height: 22px; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE — Mobile-first
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .bottom-nav { display: block; }
  .mobile-header { display: flex; }
  .mobile-only { display: block; }
  .desktop-only { display: none !important; }
  .dash-body { padding: 20px 16px 100px; max-width: 100%; }
  .drawer { width: 100vw; }
  
  .fatura-valor { font-size: 24px; }
  .dash-name { font-size: 18px; }
  
  .plano-title { word-break: break-word; }
  .plano-info-value { word-break: break-word; }
  
  .pix-qr-container img { width: 180px; height: 180px; }
}

@media (max-width: 420px) {
  .login-body { padding: 20px 16px; }
  .login-logo-img { width: 140px; }
  .login-card { border-radius: 8px; }
  .login-tab-content { padding: 24px 20px 28px; }
  .login-title { font-size: 20px; }
  .login-subtitle { font-size: 12px; }
  .dash-body { padding: 16px 14px 100px; }
}


