/* ── Conecta OSC 2.0 — Global Stylesheet ── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg:        #030712;
  --bg-2:      #0f172a;
  --card:      rgba(255,255,255,0.03);
  --border:    rgba(255,255,255,0.08);
  --border-2:  rgba(255,255,255,0.05);
  --text:      #e2e8f0;
  --muted:     #64748b;
  --muted-2:   #94a3b8;
  --em:        #34d399;
  --em-dark:   #10b981;
  --sky:       #38bdf8;
  --amber:     #fbbf24;
  --rose:      #f87171;
  --sidebar-w: 272px;
  --sidebar-c: 72px;
  --serif:     'Fraunces', Georgia, serif;
  --mono:      'JetBrains Mono', monospace;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(16,185,129,0.06), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(14,165,233,0.04), transparent);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ── Layout shell ── */
.app-shell { display: flex; min-height: 100vh; }
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
main.content { flex: 1; overflow-y: auto; }

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  transition: width .3s ease;
  overflow: hidden;
}
#sidebar.collapsed { width: var(--sidebar-c); }

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #34d399, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px rgba(52,211,153,.2);
}
.logo-text { overflow: hidden; white-space: nowrap; }
.logo-name { font-family: var(--serif); font-size: 1rem; color: #fff; line-height: 1.1; }
.logo-ver  { font-family: var(--mono); font-size: 0.6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.15em; margin-top: 3px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { margin-bottom: 20px; }
.nav-group-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--muted-2);
  cursor: pointer;
  transition: all .15s;
  border: none; background: none; width: 100%; text-align: left;
  text-decoration: none;
  white-space: nowrap;
  border-left: 2px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(52,211,153,.12), transparent);
  border-left-color: var(--em);
}
.nav-item.active svg { color: var(--em); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { overflow: hidden; flex: 1; }
.nav-chevron { margin-left: auto; opacity: 0.5; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 14px 12px;
  flex-shrink: 0;
}
.user-row { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #334155, #1e293b);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600; color: #fff;
  flex-shrink: 0; white-space: nowrap; overflow: hidden;
}
.user-name  { font-size: 0.8rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cargo { font-size: 0.68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-toggle {
  margin-left: auto; background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 6px; display: flex;
  transition: color .15s;
}
.btn-toggle:hover { color: #fff; }

/* ── Topbar ── */
.topbar {
  height: 58px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(3,7,18,0.7);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 30;
  flex-shrink: 0;
}
.topbar-breadcrumb { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.topbar-breadcrumb span:last-child { color: rgba(255,255,255,0.7); }
.topbar-search {
  position: relative; margin-left: auto;
}
.topbar-search input {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px; padding: 7px 36px; font-size: 0.8rem; color: #fff;
  width: 280px; outline: none; transition: border-color .2s, background .2s;
}
.topbar-search input:focus { border-color: rgba(52,211,153,.4); background: rgba(255,255,255,0.06); }
.topbar-search input::placeholder { color: var(--muted); }
.topbar-search .ico-search { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon { background: none; border: none; color: var(--muted); cursor: pointer; padding: 7px; border-radius: 8px; display: flex; position: relative; transition: color .15s, background .15s; }
.btn-icon:hover { color: #fff; background: rgba(255,255,255,0.05); }
.badge-dot { width: 6px; height: 6px; background: var(--rose); border-radius: 50%; position: absolute; top: 5px; right: 5px; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  transition: border-color .2s;
}
.card:hover { border-color: rgba(255,255,255,0.12); }

/* ── Typography ── */
.serif { font-family: var(--serif); }
.mono  { font-family: var(--mono); }
.label-mono { font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }
.section-tag { font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--em); margin-bottom: 4px; }
.page-title { font-family: var(--serif); font-size: 2.2rem; color: #fff; letter-spacing: -0.02em; line-height: 1.1; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 0.8rem; font-weight: 500; cursor: pointer; border: none; transition: all .15s; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 4px 14px rgba(16,185,129,.25); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--muted-2); }
.btn-secondary:hover { background: rgba(255,255,255,0.09); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-ghost { background: none; border: none; color: var(--em); font-size: 0.78rem; cursor: pointer; }
.btn-ghost:hover { color: #6ee7b7; }

/* ── Alerts / badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.68rem; font-family: var(--mono); font-weight: 500; }
.badge-em      { background: rgba(52,211,153,.12); color: #6ee7b7; border: 1px solid rgba(52,211,153,.25); }
.badge-amber   { background: rgba(251,191,36,.12); color: #fde68a; border: 1px solid rgba(251,191,36,.25); }
.badge-rose    { background: rgba(248,113,113,.12); color: #fca5a5; border: 1px solid rgba(248,113,113,.25); }
.badge-sky     { background: rgba(56,189,248,.12); color: #7dd3fc; border: 1px solid rgba(56,189,248,.25); }
.badge-slate   { background: rgba(100,116,139,.12); color: #94a3b8; border: 1px solid rgba(100,116,139,.2); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-em     { background: #34d399; }
.dot-amber  { background: #fbbf24; }
.dot-rose   { background: #f87171; }
.dot-sky    { background: #38bdf8; }
.dot-slate  { background: #64748b; }

/* ── Progress bar ── */
.progress-track { height: 6px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.progress-fill  { height: 100%; border-radius: 999px; transition: width .6s ease; }
.progress-em     { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-amber  { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress-rose   { background: linear-gradient(90deg, #dc2626, #f87171); }
.progress-sky    { background: linear-gradient(90deg, #0284c7, #38bdf8); }

/* ── Grid utilities ── */
.grid-kpi     { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.grid-2       { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3       { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-main    { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.78rem; color: var(--muted-2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 14px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; color: #fff; font-size: 0.875rem; outline: none;
  transition: border-color .2s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(52,211,153,.5);
  background: rgba(255,255,255,0.07);
}
.form-select option { background: #1e293b; }
.form-textarea { resize: vertical; min-height: 100px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th { padding: 10px 14px; text-align: left; font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted); font-weight: 500; }
td { padding: 12px 14px; font-size: 0.85rem; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── KPI card ── */
.kpi-card { padding: 20px; }
.kpi-label { font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); margin-bottom: 14px; }
.kpi-value { font-family: var(--serif); font-size: 2rem; color: #fff; letter-spacing: -0.02em; line-height: 1; }
.kpi-sub   { font-size: 0.68rem; color: var(--muted); margin-top: 6px; }
.kpi-delta { display: flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 0.68rem; }
.kpi-delta.up   { color: var(--em); }
.kpi-delta.down { color: var(--rose); }
.kpi-head  { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }

/* ── Alert row ── */
.alert-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border-2); }
.alert-row:last-child { border-bottom: none; }
.alert-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-icon.critico { background: rgba(248,113,113,.1); color: var(--rose); }
.alert-icon.atencao { background: rgba(251,191,36,.1); color: var(--amber); }
.alert-icon.info    { background: rgba(52,211,153,.1); color: var(--em); }
.alert-title { font-size: 0.875rem; color: #fff; font-weight: 500; }
.alert-desc  { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.alert-prazo { font-family: var(--mono); font-size: 0.68rem; margin-left: auto; flex-shrink: 0; }

/* ── Fluxo chart ── */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 120px; padding-top: 10px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar-pair  { display: flex; gap: 3px; align-items: flex-end; width: 100%; justify-content: center; }
.bar       { border-radius: 4px 4px 0 0; min-height: 4px; transition: opacity .2s; flex: 1; max-width: 18px; }
.bar:hover { opacity: .8; }
.bar.rec   { background: rgba(52,211,153,.7); }
.bar.des   { background: rgba(248,113,113,.5); }
.bar-label { font-family: var(--mono); font-size: 0.6rem; color: var(--muted); }

/* ── Donut score ── */
.donut-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto; }
.donut-wrap svg { transform: rotate(-90deg); }
.donut-value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.p-page  { padding: 28px 28px; }
.gap-3   { gap: 12px; }
.gap-2   { gap: 8px; }
.flex    { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1  { flex: 1; }
.mb-1    { margin-bottom: 4px; }
.mb-2    { margin-bottom: 8px; }
.mb-3    { margin-bottom: 12px; }
.mb-4    { margin-bottom: 16px; }
.mb-6    { margin-bottom: 24px; }
.mt-1    { margin-top: 4px; }
.mt-2    { margin-top: 8px; }
.mt-4    { margin-top: 16px; }
.mt-6    { margin-top: 24px; }
.space-y > * + * { margin-top: 12px; }
.space-y-sm > * + * { margin-top: 8px; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); font-size: 0.82rem; }
.text-em    { color: var(--em); }
.text-rose  { color: var(--rose); }
.text-amber { color: var(--amber); }
.text-white { color: #fff; }
.text-sm    { font-size: 0.85rem; }
.text-xs    { font-size: 0.75rem; }
.font-medium { font-weight: 500; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full     { width: 100%; }
.hidden     { display: none !important; }
.opacity-0  { opacity: 0; }
.pointer    { cursor: pointer; }
.rounded-full { border-radius: 999px; }
.overflow-hidden { overflow: hidden; }

/* ── Animações ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .3s ease both; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: #0f172a; border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px 24px 24px; }
.modal-title { font-family: var(--serif); font-size: 1.2rem; color: #fff; }
.btn-close { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.btn-close:hover { color: #fff; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .grid-main { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  #sidebar { width: var(--sidebar-c); }
  .logo-text, .nav-label, .nav-chevron, .nav-group-label, .user-name, .user-cargo { display: none; }
  .topbar-search input { width: 200px; }
}
@media (max-width: 600px) {
  .topbar-search { display: none; }
  .grid-kpi { grid-template-columns: 1fr 1fr; }
  .p-page { padding: 16px; }
}
