/* ==========================================================================
   Portal do Cliente - Contabilidade Total
   Design system proprio (sem frameworks) - SaaS financeiro premium
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Sora:wght@600;700;800&display=swap');

:root {
  --navy-950: #06111f;
  --navy-900: #0a1a2e;
  --navy-800: #0f2440;
  --navy-700: #16324f;
  --navy-600: #1e4066;
  --navy-500: #2b527f;
  --gold-500: #c9a227;
  --gold-400: #dab94a;
  --gold-300: #e8cd7a;
  --emerald-500: #16a878;
  --emerald-100: #e3f6ee;
  --red-500: #d64545;
  --red-100: #fbe9e9;
  --ink-900: #101828;
  --ink-700: #344054;
  --ink-500: #667085;
  --ink-400: #98a2b3;
  --line-200: #e4e7ec;
  --line-100: #eef1f5;
  --surface-0: #ffffff;
  --surface-50: #f8fafc;
  --surface-100: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(10, 26, 46, 0.10), 0 2px 6px rgba(10, 26, 46, 0.06);
  --shadow-gold: 0 8px 24px rgba(201, 162, 39, 0.28);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Sora', 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--surface-50);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--gold-300); color: var(--navy-900); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-200); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes floatSlow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-14px, 18px) scale(1.04); }
}
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.animate-in { animation: fadeInUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
.delay-1 { animation-delay: 0.06s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.18s; }
.delay-4 { animation-delay: 0.24s; }
.delay-5 { animation-delay: 0.30s; }

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--navy-950);
}

.login-visual {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(201, 162, 39, 0.16), transparent 45%),
    radial-gradient(circle at 80% 75%, rgba(43, 82, 127, 0.35), transparent 50%),
    linear-gradient(160deg, var(--navy-950) 0%, var(--navy-900) 45%, var(--navy-800) 100%);
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #eef2f7;
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.5;
}
.login-visual::before {
  width: 420px; height: 420px;
  border: 1px solid rgba(201, 162, 39, 0.18);
  top: -120px; right: -140px;
  animation: floatSlow 14s ease-in-out infinite;
}
.login-visual::after {
  width: 280px; height: 280px;
  border: 1px solid rgba(255,255,255,0.08);
  bottom: -80px; left: -60px;
  animation: floatSlow 18s ease-in-out infinite reverse;
}

.login-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 19px; color: var(--navy-950);
  box-shadow: var(--shadow-gold);
}

.brand-text-name { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; letter-spacing: 0.02em; line-height: 1.15; }
.brand-text-tag { font-size: 12px; color: rgba(238,242,247,0.55); letter-spacing: 0.04em; }

.login-pitch { position: relative; z-index: 2; max-width: 460px; }
.login-pitch h1 {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.18;
  font-weight: 700;
  margin-bottom: 18px;
}
.login-pitch h1 span { color: var(--gold-400); }
.login-pitch p {
  font-size: 15.5px;
  line-height: 1.6;
  color: rgba(238,242,247,0.68);
}

.pitch-stats { display: flex; gap: 34px; margin-top: 36px; position: relative; z-index: 2; }
.pitch-stat strong { display: block; font-family: var(--font-display); font-size: 24px; color: #fff; }
.pitch-stat span { font-size: 12.5px; color: rgba(238,242,247,0.55); }

.login-footer-note { position: relative; z-index: 2; font-size: 12.5px; color: rgba(238,242,247,0.4); }

.login-form-side {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-0);
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card-header { margin-bottom: 32px; }
.login-card-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--navy-600);
  background: var(--surface-100);
  border: 1px solid var(--line-200);
  padding: 6px 12px; border-radius: 100px; margin-bottom: 18px;
}
.login-card-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald-500); }
.login-card h2 { font-size: 25px; color: var(--ink-900); margin-bottom: 6px; }
.login-card p.sub { color: var(--ink-500); font-size: 14.5px; }

.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-700); margin-bottom: 7px;
}
.input-wrap { position: relative; }
.input-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-400); pointer-events: none;
}
.input-wrap input {
  width: 100%;
  padding: 13px 14px 13px 42px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-200);
  background: var(--surface-50);
  font-size: 14.5px;
  color: var(--ink-900);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input-wrap input:focus {
  outline: none;
  border-color: var(--navy-600);
  background: var(--surface-0);
  box-shadow: 0 0 0 4px rgba(30, 64, 102, 0.10);
}
.toggle-pass {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--ink-400);
  display: flex; padding: 4px;
}
.toggle-pass:hover { color: var(--ink-700); }

.btn-primary {
  width: 100%;
  padding: 13.5px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-900));
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 24px rgba(10, 26, 46, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  margin-top: 6px;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-primary:active { transform: translateY(0px) scale(0.99); }

.form-alert {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--red-100);
  border: 1px solid rgba(214, 69, 69, 0.25);
  color: #9c2b2b;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
  animation: fadeInUp 0.35s ease both;
}

.login-security-note {
  margin-top: 26px;
  display: flex; align-items: center; gap: 9px;
  color: var(--ink-500); font-size: 12.5px;
}

@media (max-width: 920px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-form-side { padding: 28px; }
}

/* ==========================================================================
   APP SHELL (dashboard / relatorios)
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(190deg, var(--navy-950), var(--navy-900) 55%, var(--navy-800));
  color: #eef2f7;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 30px; }
.sidebar-brand .brand-mark { width: 40px; height: 40px; font-size: 16px; border-radius: 11px; flex-shrink: 0; }
.sidebar-brand .brand-text-name { font-size: 14.5px; }
.sidebar-brand .brand-text-tag { font-size: 11px; }

.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 11px;
  color: rgba(238,242,247,0.62);
  font-size: 14px; font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
  position: relative;
}
.side-link svg { flex-shrink: 0; }
.side-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.side-link.active {
  background: rgba(201, 162, 39, 0.12);
  color: var(--gold-300);
}
.side-link.active::before {
  content: "";
  position: absolute; left: -20px; top: 8px; bottom: 8px; width: 3px;
  background: var(--gold-400); border-radius: 4px;
}

.sidebar-spacer { flex: 1; }

.sidebar-support {
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  padding: 16px;
  font-size: 12.5px;
  color: rgba(238,242,247,0.6);
  margin-bottom: 14px;
}
.sidebar-support strong { display: block; color: #fff; font-size: 13px; margin-bottom: 4px; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 12px;
  background: rgba(255,255,255,0.04);
}
.avatar-chip {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--navy-950); flex-shrink: 0;
}
.sidebar-user-info { line-height: 1.25; overflow: hidden; }
.sidebar-user-info strong { display: block; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: 11.5px; color: rgba(238,242,247,0.5); }

/* Main content */
.main-area { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 36px;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-100);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title h1 { font-size: 21px; color: var(--ink-900); }
.topbar-title p { font-size: 13px; color: var(--ink-500); margin-top: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 14px; }
.pill-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--emerald-100); color: var(--emerald-500);
  font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 100px;
}
.pill-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald-500); }

.btn-logout {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-200);
  background: var(--surface-0);
  color: var(--ink-700);
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-logout:hover { border-color: var(--red-500); color: var(--red-500); background: var(--red-100); }

.content { padding: 34px 36px 60px; flex: 1; }

/* Page header inside content */
.page-heading { margin-bottom: 28px; }
.page-heading h2 { font-size: 24px; color: var(--ink-900); margin-bottom: 6px; }
.page-heading p { color: var(--ink-500); font-size: 14.5px; }

/* Stat / summary cards */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 34px;
}
.stat-card {
  background: var(--surface-0);
  border: 1px solid var(--line-100);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-200); }
.stat-card-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.stat-card-icon.navy { background: var(--navy-900); color: var(--gold-300); }
.stat-card-icon.gold { background: linear-gradient(135deg, var(--gold-400), var(--gold-500)); color: var(--navy-950); }
.stat-card-icon.emerald { background: var(--emerald-100); color: var(--emerald-500); }
.stat-card-icon.slate { background: var(--surface-100); color: var(--navy-700); }
.stat-card h3 { font-size: 26px; color: var(--ink-900); margin-bottom: 4px; }
.stat-card p.label { font-size: 13.5px; color: var(--ink-500); font-weight: 500; }
.stat-card .trend { position: absolute; top: 22px; right: 22px; font-size: 12px; font-weight: 700; color: var(--emerald-500); }

/* Section card */
.panel {
  background: var(--surface-0);
  border: 1px solid var(--line-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 26px;
  margin-bottom: 26px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-head h3 { font-size: 17px; color: var(--ink-900); }
.panel-head a.link-more { font-size: 13px; font-weight: 600; color: var(--navy-700); }

/* Report cards grid */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.report-card {
  display: block;
  background: var(--surface-0);
  border: 1px solid var(--line-100);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}
.report-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--navy-500);
}
.report-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.report-icon {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--navy-900);
  color: var(--gold-300);
  display: flex; align-items: center; justify-content: center;
}
.report-type-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  padding: 5px 10px; border-radius: 100px;
  background: var(--surface-100); color: var(--ink-700);
  text-transform: uppercase;
}
.report-card h4 { font-size: 16.5px; color: var(--ink-900); margin-bottom: 6px; }
.report-card p.desc { font-size: 13px; color: var(--ink-500); margin-bottom: 18px; }
.report-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; border-top: 1px solid var(--line-100);
  font-size: 12px; color: var(--ink-400);
}
.report-open {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--navy-700);
}
.report-card:hover .report-open { color: var(--gold-500); }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-500);
}
.empty-state svg { color: var(--ink-400); margin-bottom: 16px; }
.empty-state h4 { color: var(--ink-700); font-size: 16px; margin-bottom: 6px; }
.empty-state code {
  background: var(--surface-100);
  padding: 2px 8px; border-radius: 6px; font-size: 12.5px;
}

/* Activity / quick list */
.quick-list { display: flex; flex-direction: column; gap: 2px; }
.quick-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 8px;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.quick-item:hover { background: var(--surface-50); }
.quick-item-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-100); color: var(--navy-700);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.quick-item-text strong { display: block; font-size: 13.5px; color: var(--ink-900); }
.quick-item-text span { font-size: 12px; color: var(--ink-500); }
.quick-item-meta { margin-left: auto; font-size: 12px; color: var(--ink-400); }

footer.portal-footer {
  padding: 24px 36px 40px;
  color: var(--ink-400);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1180px) {
  .grid-cards { grid-template-columns: repeat(2, 1fr); }
  .reports-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 24px 18px 50px; }
  .topbar { padding: 16px 18px; }
}

@media (max-width: 640px) {
  .grid-cards { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .topbar-title h1 { font-size: 18px; }
}

/* Mobile bottom nav (shown only under 900px) */
.mobile-nav {
  display: none;
  position: sticky; bottom: 0; z-index: 20;
  background: var(--navy-950);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  align-items: center; justify-content: space-around;
}
.mobile-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: rgba(238,242,247,0.55); font-size: 11px; font-weight: 500;
}
.mobile-nav a.active { color: var(--gold-300); }
@media (max-width: 900px) { .mobile-nav { display: flex; } }
