/* =====================================================
   PORTAL REDE — Design System
   Flat · Light · Sem sombras · Bordas 1px · Raio sutil
   Tipos: Sora (display) + Instrument Sans (texto)
   ===================================================== */

:root {
  /* Cores — tema clean em azul petróleo / cyan */
  --paper: #F7F9FA;
  --surface: #FFFFFF;
  --ink: #15262C;
  --ink-soft: #586B73;
  --ink-faint: #8AA0A9;
  --line: #E3EAED;
  --line-strong: #C4D2D8;

  /* (nomes herdados do tema antigo; valores agora são petróleo/cyan) */
  --pine: #0C6478;       /* primário: azul petróleo */
  --pine-deep: #083344;  /* sidebar, login, fundos escuros */
  --pine-soft: #E7F3F6;  /* hover/fundos suaves */
  --lime: #3BD6E8;       /* acento: cyan vivo */
  --lime-soft: #DFF6FA;

  --danger: #BC4327;
  --danger-soft: #FBEEE9;
  --success: #2E7D4F;
  --success-soft: #E9F5EE;
  --warn: #B07C10;
  --warn-soft: #FBF3DE;

  /* Forma */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-pill: 100px;

  /* Tipografia */
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;

  /* Movimento */
  --ease: cubic-bezier(.22, .9, .3, 1);
}

* { box-sizing: border-box; }

/* O atributo hidden sempre vence, mesmo em elementos com display próprio */
[hidden] { display: none !important; }

/* =====================================================
   Impressão / Exportar PDF — só o conteúdo, sem menus,
   A4 paisagem e tudo reduzido para caber na página
   ===================================================== */
@page { size: A4 landscape; margin: 10mm; }

@media print {
  .sidebar, .topbar, .sidebar-backdrop, .flash-stack, .usheet,
  .page-actions, .fin-head, .fin-views, .filters-bar, .no-print,
  .btn, .icon-btn, button[type="submit"], .qcell-empty,
  .qpop-backdrop, .qpop[open] > .qpop-body { display: none !important; }

  .app-shell, html.nav-collapsed .app-shell { display: block; }
  html, body { width: auto; height: auto; background: #fff; }
  body { font-size: 10px; }
  .main { max-width: 100%; padding: 0; }

  .page-head { margin-bottom: 8px; }
  .page-head h1 { font-size: 17px; }
  .page-head .crumb { font-size: 9px; margin-bottom: 2px; }
  .countdown { border: 1px solid #999; background: #fff; color: #000; font-size: 10px; padding: 3px 10px; }
  .risk-banner { font-size: 10px; padding: 6px 12px; margin-bottom: 8px; border-radius: 4px; }
  .risk-adjust { display: none !important; }

  /* Planilha de cotações compacta */
  .sheet-scroll { overflow: visible; border: none; border-radius: 0; }
  .qsheet { font-size: 8.5px; width: 100%; min-width: 0; border-top: 1px solid #bbb; }
  .qsheet th, .qsheet td {
    white-space: normal;
    padding: 3px 5px;
    border-color: #ccc;
    vertical-align: top;
    overflow-wrap: anywhere;
  }
  .qsheet tbody tr { break-inside: avoid; }
  .qsheet thead { display: table-header-group; }
  .qsheet .item-col { position: static; min-width: 110px; max-width: 160px; }
  .item-name { font-size: 9px; gap: 4px; }
  .item-name .qty { font-size: 8px; padding: 0 5px; }
  .item-sub { font-size: 7.5px; }
  .istatus { width: 6px; height: 6px; }
  .prio-chip { font-size: 8px; padding: 0 5px; border-color: #bbb; }
  .prio-chip.late { border-color: #BC4327; }

  /* Cards de cotação empilhados em largura total */
  .qcell-list { width: auto; }
  .qcards { display: block; }
  .qcard {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-bottom: 3px;
    break-inside: avoid;
    border: 1px solid #bbb;
    border-radius: 3px;
    background: #fff;
  }
  .qcard.chosen { border: 1.5px solid #2E7D4F; }
  .qcard > summary { padding: 3px 6px; }
  .qcard .qc-top { margin-bottom: 0; }
  .qcard .qc-sup { font-size: 8.5px; }
  .qcard .qc-price { font-size: 9px; }
  .qcard .qc-price small { font-size: 8px; }
  .chosen-flag { font-size: 8px; padding: 0 5px; border: 1px solid #2E7D4F; background: #fff; }
  .homolog { background: #fff !important; border: 1px solid #999; font-size: 7.5px; }
  .qdelivery { font-size: 8px; margin-top: 0; }
  .qdelivery.late { color: #BC4327; }
  .qnotes { font-size: 8px; -webkit-line-clamp: unset; max-width: none; color: #444; }

  /* Tabelas e painéis genéricos */
  .panel, .kpi, .stat-card, .table-wrap { border-color: #ccc; break-inside: avoid; }
  .report-table { font-size: 9.5px; }
  .report-table th, .report-table td { padding: 4px 8px; }
}

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

a { color: var(--pine); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--lime); color: var(--pine-deep); }

/* =====================================================
   Botões
   ===================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease), transform .18s var(--ease);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.985); }

.btn-primary { background: var(--pine); color: #fff; }
.btn-primary:hover { background: var(--pine-deep); }

.btn-accent { background: var(--lime); color: var(--pine-deep); }
.btn-accent:hover { background: #2AC6DA; }

.btn-outline { background: transparent; color: var(--pine); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--pine); background: var(--pine-soft); }

.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--pine-soft); color: var(--pine); }

.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* =====================================================
   Formulários
   ===================================================== */

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.field .hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 5px; }

.input, .select {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .18s var(--ease), background-color .18s var(--ease);
  appearance: none;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus, .select:focus { border-color: var(--pine); }
.input:hover:not(:focus), .select:hover:not(:focus) { border-color: var(--ink-faint); }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235C6562' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--pine);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 20px;
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}

.form-section {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 22px;
}
.form-section > h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
  margin-bottom: 16px;
}

.form-errors {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 14px;
  padding: 12px 16px;
  margin-bottom: 22px;
}
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }

/* =====================================================
   Painéis, tabelas, badges
   ===================================================== */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}

.panel-title {
  font-size: 16px;
  margin-bottom: 18px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color .15s var(--ease); }
.table tbody tr:hover { background: var(--pine-soft); }
.table .actions { text-align: right; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
}
.badge-pine   { background: var(--pine-soft); color: var(--pine); }
.badge-lime   { background: var(--lime-soft); color: #0B6B7C; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn   { background: var(--warn-soft); color: var(--warn); }
.badge-muted  { background: transparent; color: var(--ink-faint); border-color: var(--line-strong); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-pill);
  background: var(--pine);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar.lime { background: var(--lime); color: var(--pine-deep); }

/* =====================================================
   Shell do app — ver navigation.css (sidebar, topbar,
   submenus, modo recolhido e drawer mobile)
   ===================================================== */

/* =====================================================
   Dashboard
   ===================================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s var(--ease);
}
.stat-card:hover { border-color: var(--pine); }
.stat-card .stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--pine);
  line-height: 1.15;
  margin-top: 4px;
}
.stat-card .stat-dot {
  position: absolute;
  top: 22px; right: 22px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--lime);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.list-rows { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-weight: 600; }
.list-row .s { font-size: 12.5px; color: var(--ink-faint); }

/* =====================================================
   Flash / vazios / utilidades
   ===================================================== */

.flash-stack {
  position: fixed;
  top: 22px; right: 22px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}
.flash {
  border-radius: var(--radius-sm);
  border: 1px solid;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 500;
  animation: flash-in .35s var(--ease);
}
.flash-notice { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.flash-alert  { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-faint);
}
.empty-state h3 { font-size: 17px; color: var(--ink-soft); margin-bottom: 6px; }
.empty-state p { margin: 0 0 18px; font-size: 14px; }

.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filters-bar .input, .filters-bar .select { width: auto; min-width: 220px; }

.muted { color: var(--ink-faint); }
.mb-0 { margin-bottom: 0; }

/* =====================================================
   Hub de módulos (tela inicial)
   ===================================================== */

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
@media (max-width: 760px) { .mod-grid { grid-template-columns: 1fr; } }

.mod-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.mod-card:hover {
  border-color: var(--pine);
  transform: translateY(-2px);
  text-decoration: none;
}

.mod-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px; height: 54px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--pine-soft);
  color: var(--pine);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.mod-card:hover .mod-ico { background: var(--lime); color: var(--pine-deep); }

.mod-body { flex: 1; min-width: 0; }
.mod-title {
  display: block;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 5px;
}
.mod-desc {
  display: block;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.mod-arrow {
  align-self: center;
  font-size: 20px;
  color: var(--ink-faint);
  transition: transform .2s var(--ease), color .2s var(--ease);
}
.mod-card:hover .mod-arrow { transform: translateX(4px); color: var(--pine); }

/* Ícone "i" com explicação no hover */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px;
  margin-left: 5px;
  vertical-align: 1px;
  border: 1px solid var(--ink-faint);
  border-radius: 50%;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  cursor: help;
  position: relative;
}
.info-tip:hover { border-color: var(--pine); color: var(--pine); }
.info-tip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: 250px;
  background: var(--pine-deep);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  white-space: normal;
  text-align: left;
  pointer-events: none;
}
.info-tip:hover::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  border: 6px solid transparent;
  border-top-color: var(--pine-deep);
  border-bottom: none;
  pointer-events: none;
}

/* =====================================================
   LOGIN — palco visual
   ===================================================== */

.auth-body { background: var(--pine-deep); }

.auth-split {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
}
@media (max-width: 940px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-stage { display: none; }
}

/* ---- Lado esquerdo: palco ---- */
.auth-stage {
  position: relative;
  background: var(--pine-deep);
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
}

.auth-stage .brand { padding: 0; }

.stage-copy { position: relative; z-index: 2; max-width: 480px; }
.stage-copy h2 {
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 700;
  color: #fff;
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.stage-copy h2 em {
  font-style: normal;
  color: var(--lime);
  position: relative;
  white-space: nowrap;
}
.stage-copy h2 em::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 3px;
  background: var(--lime);
  border-radius: 2px;
  transform-origin: left;
  animation: underline-grow 1.1s var(--ease) .4s both;
}
@keyframes underline-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.stage-copy p {
  margin-top: 16px;
  font-size: 15.5px;
  color: rgba(255, 255, 255, .62);
  line-height: 1.65;
}

.stage-foot {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 28px;
  font-size: 13px;
  color: rgba(255, 255, 255, .45);
}
.stage-foot span { display: flex; align-items: center; gap: 8px; }
.stage-foot i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--lime);
  display: inline-block;
}

/* Constelação animada de nós da rede */
.net {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.net line {
  stroke: rgba(59, 214, 232, .18);
  stroke-width: 1;
}
.net circle {
  fill: var(--lime);
  opacity: .85;
}
.net .n1 { animation: drift 9s ease-in-out infinite; }
.net .n2 { animation: drift 11s ease-in-out -2s infinite; }
.net .n3 { animation: drift 13s ease-in-out -5s infinite; }
.net .n4 { animation: drift 10s ease-in-out -7s infinite; }
.net .halo {
  fill: none;
  stroke: rgba(59, 214, 232, .4);
  stroke-width: 1;
  animation: halo 3.6s var(--ease) infinite;
  transform-origin: center;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  33%      { transform: translate(10px, -14px); }
  66%      { transform: translate(-8px, 10px); }
}
@keyframes halo {
  0%   { transform: scale(.4); opacity: .9; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* Faixa plana decorativa no rodapé do palco */
.stage-band {
  position: absolute;
  z-index: 0;
  bottom: -120px;
  left: -10%;
  width: 120%;
  height: 320px;
  background: var(--pine);
  border-radius: 50% 50% 0 0;
}

/* ---- Lado direito: formulário ---- */
.auth-pane {
  background: var(--paper);
  border-radius: 22px 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
}
@media (max-width: 940px) { .auth-pane { border-radius: 0; } }

.auth-card {
  width: 100%;
  max-width: 396px;
  animation: card-rise .5s var(--ease) both;
}
@keyframes card-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-card .eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--pine);
  margin-bottom: 10px;
}
.auth-card h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.auth-card .sub {
  color: var(--ink-soft);
  font-size: 14.5px;
  margin: 0 0 30px;
}

/* Campo com rótulo flutuante discreto */
.auth-field { position: relative; margin-bottom: 16px; }
.auth-field .input {
  padding: 22px 16px 9px;
  font-size: 15px;
  background: var(--surface);
}
.auth-field label {
  position: absolute;
  left: 16px; top: 16px;
  font-size: 14.5px;
  color: var(--ink-faint);
  pointer-events: none;
  transition: all .16s var(--ease);
}
.auth-field .input:focus + label,
.auth-field .input:not(:placeholder-shown) + label {
  top: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--pine);
}
.auth-field .input::placeholder { color: transparent; }

.auth-aux {
  display: flex;
  justify-content: flex-end;
  margin: 2px 0 22px;
}
.auth-aux a { font-size: 13.5px; color: var(--ink-soft); }
.auth-aux a:hover { color: var(--pine); }

.btn-auth {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}
.btn-auth span { position: relative; z-index: 1; transition: color .3s var(--ease); }
.btn-auth::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--lime);
  transform: translateX(-101%);
  transition: transform .3s var(--ease);
}
.btn-auth:hover::before { transform: translateX(0); }
.btn-auth:hover span { color: var(--pine-deep); }

.auth-flash {
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  padding: 12px 16px;
  margin-bottom: 20px;
  animation: flash-in .3s var(--ease);
}
.auth-flash.ok {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.auth-foot {
  margin-top: 34px;
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
}
