/* ===== Portal Inteligente do Cliente Contábil — Design System ===== */

:root {
  --brand: #1c3d47;
  --brand-dark: #122830;
  --brand-light: #e8eef0;
  --brand-accent: #8b939a;
  --brand-gradient: linear-gradient(135deg, #1c3d47 0%, #3f7886 100%);

  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-hover: #f8f9fd;
  --border: #e6e8f0;

  --text-primary: #1a1d29;
  --text-secondary: #63667a;
  --text-muted: #9497a8;

  --success: #16a34a;
  --success-bg: #ecfdf3;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eff6ff;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(20, 21, 41, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 21, 41, 0.06);
  --shadow-lg: 0 12px 32px rgba(20, 21, 41, 0.10);

  --sidebar-w: 260px;
  --topbar-h: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ===== Layout shell ===== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-content {
  padding: 28px 36px 60px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}

/* ===== Sidebar ===== */

.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: #0f2229;
  color: #c7c9dd;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 22px 18px;
}

.sidebar-brand .logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  font-weight: 700;
  color: #fff;
  font-size: 15px;
  line-height: 1.2;
}

.sidebar-brand .brand-text small {
  display: block;
  font-weight: 400;
  color: #8a8dab;
  font-size: 11.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.sidebar-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6d6f8c;
  padding: 16px 12px 6px;
  font-weight: 600;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.8px;
  font-weight: 500;
  color: #b6b8d1;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.sidebar-nav .badge-count {
  margin-left: auto;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.sidebar-nav a.active .badge-count {
  background: rgba(255,255,255,0.28);
}

.sidebar-footer {
  padding: 14px 22px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.sidebar-footer .who { min-width: 0; }
.sidebar-footer .who strong { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer .who span { display: block; color: #8a8dab; font-size: 11.5px; }
.sidebar-footer a.logout {
  margin-left: auto;
  color: #8a8dab;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.sidebar-footer a.logout svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-footer a.logout:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ===== Topbar ===== */

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  background: rgba(244,245,250,0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

.mobile-menu-btn {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  cursor: pointer;
}

.topbar-title h1 { font-size: 18px; }
.topbar-title .crumbs { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}

.icon-btn svg { width: 19px; height: 19px; }

.icon-btn .dot {
  position: absolute;
  top: 8px; right: 9px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg);
}

.company-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
}

.company-pill .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11.5px;
}

.company-pill .name { font-size: 12.5px; font-weight: 600; line-height: 1.15; }
.company-pill .role { font-size: 10.5px; color: var(--text-muted); }

/* ===== Page header ===== */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 24px; }
.page-header p { color: var(--text-secondary); margin-top: 4px; font-size: 14px; }

.company-banner {
  background: var(--brand-gradient);
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

.company-banner .name { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.company-banner .meta { font-size: 13px; opacity: 0.88; margin-top: 6px; display: flex; gap: 18px; flex-wrap: wrap; }
.company-banner .meta strong { font-weight: 600; }

.competencia-tag {
  background: rgba(255,255,255,0.18);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,0.3); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(79,70,229,0.4); }

.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Cards / grid ===== */

.grid {
  display: grid;
  gap: 18px;
}

.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .grid-5, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.card-lg { padding: 24px 26px; }

.kpi-card .kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kpi-card .kpi-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.kpi-card .kpi-icon svg { width: 19px; height: 19px; }

.kpi-icon.tone-brand { background: var(--brand-light); color: var(--brand); }
.kpi-icon.tone-danger { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.tone-success { background: var(--success-bg); color: var(--success); }
.kpi-icon.tone-warning { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.tone-info { background: var(--info-bg); color: var(--info); }

.kpi-card .kpi-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.kpi-card .kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -0.01em; margin-top: 2px; }
.kpi-card .kpi-foot { margin-top: 10px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }

.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.trend svg { width: 13px; height: 13px; }

/* ===== Badges / status ===== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: #f1f2f7; color: var(--text-secondary); }

/* ===== Section titles ===== */

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title h2 { font-size: 17px; }
.section-title .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.section-block { margin-bottom: 28px; }

/* ===== Tables ===== */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: collapse; min-width: 640px; }

thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13.8px;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }

td.num, th.num { text-align: right; }
td.strong { font-weight: 700; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-link {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand-light);
  color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-link svg { width: 15px; height: 15px; }
.icon-link:hover { background: var(--brand); color: #fff; }
.icon-link.danger { background: var(--danger-bg); color: var(--danger); }
.icon-link.danger:hover { background: var(--danger); color: #fff; }

/* ===== Tabs / filters ===== */

.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.tabs button {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.8px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.tabs button.active {
  background: var(--brand-gradient);
  color: #fff;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}

.select, .input {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
}

.chip-filter {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.8px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.chip-filter.active { background: var(--brand-light); color: var(--brand); border-color: var(--brand-light); }

/* ===== Insight / alert cards ===== */

.insight-card {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 12px;
}
.insight-card .emoji { font-size: 20px; line-height: 1; }
.insight-card p { margin: 0; font-size: 13.8px; color: var(--text-primary); }
.insight-card .date { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.insight-card.tone-warning { background: var(--warning-bg); border-color: #fde8c7; }
.insight-card.tone-success { background: var(--success-bg); border-color: #cdf2dc; }
.insight-card.tone-info { background: var(--info-bg); border-color: #d6e4fd; }

/* ===== Score ring ===== */

.score-wrap { display: flex; align-items: center; gap: 22px; }
.score-ring { position: relative; width: 116px; height: 116px; flex-shrink: 0; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .score-num {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-ring .score-num strong { font-size: 26px; font-weight: 800; }
.score-ring .score-num span { font-size: 10.5px; color: var(--text-muted); }

/* ===== Indicator list ===== */

.indicator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.indicator-row:last-child { border-bottom: none; }
.indicator-row .label { font-size: 13px; color: var(--text-secondary); }
.indicator-row .value { font-weight: 700; font-size: 14px; }
.indicator-bar {
  width: 100%; height: 6px; border-radius: 999px; background: #eef0f6; margin-top: 8px; overflow: hidden;
}
.indicator-bar > div { height: 100%; border-radius: 999px; background: var(--brand-gradient); }

/* ===== Timeline (comunicados) ===== */

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 22px;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 19px; top: 40px; bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; flex: 1; }
.timeline-body .audience { font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.04em; }
.timeline-body h3 { font-size: 14.5px; margin-top: 4px; }
.timeline-body p { font-size: 13.5px; color: var(--text-secondary); margin: 6px 0 0; }
.timeline-body .date { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; }

/* ===== Pendencias list ===== */

.pending-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin-bottom: 10px;
}
.pending-item .check {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.pending-item.done .check { background: var(--success); }
.pending-item.open .check { background: var(--warning); }
.pending-item .title { font-weight: 600; font-size: 14px; }
.pending-item .desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.pending-item .right { margin-left: auto; }

/* ===== DRE ===== */

.dre-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px dashed var(--border);
}
.dre-row:last-child { border-bottom: none; }
.dre-row .left .label { font-weight: 700; font-size: 14.5px; }
.dre-row .left .explain { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; max-width: 480px; }
.dre-row .amount { font-size: 17px; font-weight: 800; white-space: nowrap; margin-left: 20px; }
.dre-row.negative .amount { color: var(--danger); }
.dre-row.total { background: var(--brand-light); margin: 8px -22px -22px; padding: 18px 22px; border-radius: 0 0 var(--radius-md) var(--radius-md); border-bottom: none; }
.dre-row.total .amount { color: var(--brand); font-size: 21px; }

/* ===== Docs grid ===== */

.doc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.doc-item .file-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.doc-item .file-icon svg { width: 19px; height: 19px; }
.doc-item .info { min-width: 0; flex: 1; }
.doc-item .info .name { font-weight: 600; font-size: 13.8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item .info .meta { font-size: 11.8px; color: var(--text-muted); margin-top: 2px; }
.doc-item .actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== Login page ===== */

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -34px) scale(1.08); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes logoPop {
  0% { opacity: 0; transform: scale(0.75); }
  65% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes ringPulse {
  0% { transform: scale(0.85); opacity: 0.55; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 24px;
  background: linear-gradient(120deg, #0f2229 0%, #1c3d47 45%, #3f7886 100%);
  background-size: 220% 220%;
  animation: gradientShift 14s ease infinite;
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  animation: floatBlob 11s ease-in-out infinite;
}
.blob-1 { width: 440px; height: 440px; top: -140px; left: -120px; background: rgba(63,120,134,0.55); }
.blob-2 { width: 380px; height: 380px; bottom: -160px; right: -100px; background: rgba(139,147,154,0.35); animation-delay: -4s; }
.blob-3 { width: 260px; height: 260px; top: 38%; right: 10%; background: rgba(255,255,255,0.08); animation-delay: -7.5s; }

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.98);
  border-radius: 22px;
  box-shadow: 0 30px 70px rgba(5,15,18,0.45);
  padding: 42px 38px 34px;
  width: 100%;
  max-width: 408px;
  animation: fadeInUp 0.55s cubic-bezier(0.16,1,0.3,1) both;
}

.login-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
  animation: logoPop 0.6s cubic-bezier(0.16,1,0.3,1) both;
  animation-delay: 0.08s;
}

.login-logo-icon {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 17px;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 24px;
  box-shadow: 0 12px 26px rgba(28,61,71,0.38);
  margin-bottom: 16px;
}
.login-logo-icon::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 22px;
  border: 2px solid rgba(28,61,71,0.18);
  animation: ringPulse 2.4s ease-out infinite;
}

.login-wordmark-row { display: flex; align-items: baseline; gap: 1px; line-height: 1; }
.login-wordmark-row .word { font-size: 25px; font-weight: 800; color: var(--brand); letter-spacing: -0.02em; }
.login-wordmark-row .plus { font-size: 25px; font-weight: 800; color: var(--brand-accent); }
.login-tagline-small { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--text-muted); margin-top: 3px; }

.login-card h1 { font-size: 21px; text-align: center; margin-bottom: 5px; }
.login-card .subtitle { color: var(--text-secondary); font-size: 13.5px; text-align: center; margin-bottom: 28px; }

.field {
  margin-bottom: 17px;
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
}
.field:nth-of-type(1) { animation-delay: 0.16s; }
.field:nth-of-type(2) { animation-delay: 0.22s; }

.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 7px; }

.field-icon-wrap { position: relative; }
.field-icon-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-muted); pointer-events: none;
}
.field-icon-wrap input { padding-left: 41px; }

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }

.password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--text-muted); width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}
.password-toggle:hover { color: var(--brand); }
.password-toggle svg { width: 18px; height: 18px; }

.field-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; font-size: 12.5px;
  opacity: 0; animation: fadeInUp 0.5s ease both; animation-delay: 0.28s;
}
.field-row a { color: var(--brand); font-weight: 600; }
.checkbox-row { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); }

.login-submit-row { opacity: 0; animation: fadeInUp 0.5s ease both; animation-delay: 0.34s; }

.login-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fbd5d5;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
}
.login-error.show { display: flex; }
.login-error svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}

.demo-hint {
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-hover);
  border: 1px dashed var(--border);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

/* Variante do aviso de demonstração usada sobre o fundo escuro da tela de login */
.login-hint {
  margin-top: 20px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.08);
  border: 1px dashed rgba(255,255,255,0.25);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: center;
  max-width: 408px;
  width: 100%;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.42s;
}
.login-hint a { color: #fff; text-decoration: underline; font-weight: 600; }

.login-footer-note {
  position: absolute;
  right: 24px;
  bottom: 18px;
  z-index: 1;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  text-align: right;
}

@media (max-width: 460px) {
  .login-card { padding: 34px 24px 28px; }
}

/* ===== Seleção de empresa (login multiempresa) ===== */

.picker-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.98);
  border-radius: 22px;
  box-shadow: 0 30px 70px rgba(5,15,18,0.45);
  padding: 40px 40px 34px;
  width: 100%;
  max-width: 640px;
  animation: fadeInUp 0.55s cubic-bezier(0.16,1,0.3,1) both;
}
.picker-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.picker-card .subtitle { color: var(--text-secondary); font-size: 13.5px; text-align: center; margin-bottom: 28px; }

.empresa-picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .empresa-picker-grid { grid-template-columns: 1fr; } }

.empresa-picker-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  text-align: left;
  background: var(--surface);
}
.empresa-picker-card:hover { border-color: var(--brand); box-shadow: 0 8px 20px rgba(28,61,71,0.12); transform: translateY(-1px); }
.empresa-picker-card .avatar-img, .empresa-picker-card .avatar-fallback {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
}
.empresa-picker-card .avatar-fallback {
  background: var(--brand-gradient); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.empresa-picker-card .nome { font-weight: 700; font-size: 14px; }
.empresa-picker-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.picker-logout { text-align: center; margin-top: 24px; }
.picker-logout a { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.picker-logout a:hover { color: var(--brand); }

/* ===== Chart containers ===== */

.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 220px; }

/* ===== Mobile ===== */

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10,10,20,0.4);
  z-index: 35;
}

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .company-pill .name-block { display: none; }
  .page-content { padding: 20px 18px 50px; }
  .topbar { padding: 0 18px; }
  .sidebar-backdrop.open { display: block; }
}

@media (max-width: 560px) {
  .company-banner { flex-direction: column; align-items: flex-start; }
}

/* ===== Admin: modal ===== */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,20,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 28px;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h2 { font-size: 18px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); flex-shrink: 0;
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover { background: var(--surface-hover); color: var(--text-primary); }

/* ===== Admin: forms ===== */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }

.form-field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--text-secondary); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light);
}
.form-field textarea { resize: vertical; min-height: 70px; }
.form-field input[type="file"] { padding: 8px 10px; font-size: 12.5px; }
.form-field input.readonly-auto {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 700;
  cursor: not-allowed;
}

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.inline-form {
  background: var(--surface-hover);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 18px;
  display: none;
}
.inline-form.open { display: block; }
.inline-form h3 { font-size: 14px; margin-bottom: 14px; }

/* ===== Admin: tabs & empresa view ===== */

.admin-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
}
.admin-tabs button {
  padding: 12px 16px;
  background: none; border: none;
  font-size: 13.3px; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  margin-bottom: -1px;
}
.admin-tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.admin-tabs button:hover { color: var(--text-primary); }

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

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
  margin-bottom: 16px; cursor: pointer;
}
.back-link svg { width: 15px; height: 15px; }
.back-link:hover { color: var(--brand); }

.mini-table td, .mini-table th { padding: 11px 16px; font-size: 13px; }

/* ===== Logo da empresa (avatar) ===== */

.avatar-img { border-radius: 50%; object-fit: cover; display: block; flex-shrink: 0; }
.company-pill .avatar-img { width: 28px; height: 28px; }
.sidebar-footer .avatar-img { width: 34px; height: 34px; }
.company-banner .avatar-img { width: 50px; height: 50px; border: 2px solid rgba(255,255,255,0.5); }

.row-company { display: flex; align-items: center; gap: 10px; }
.row-company .avatar-img, .row-company .avatar-fallback { width: 32px; height: 32px; }
.row-company .avatar-fallback {
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-preview {
  width: 60px; height: 60px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-top: 8px;
  display: none;
}
.logo-preview.show { display: block; }
