/* =====================================================================
   Viltron Hub — sistema de estilos
   Identidade derivada do símbolo Viltron: azul #1B50B6 (amostrado da logo),
   geometria angular em detalhes (marcadores, grafismos de login), interface clara.
   Layout: menu lateral azul + conteúdo cinza-claro + cartões brancos.
   ===================================================================== */
:root {
  /* Cores da marca (a cor principal pode ser ajustada em Configurações) */
  --brand: #1B50B6;
  --brand-dark: #153778;
  --brand-soft: #EAF0FC;
  --brand-ink: #FFFFFF;
  --primary: var(--brand);
  --primary-ink: var(--brand-ink);
  --primary-soft: var(--brand-soft);
  --accent: var(--brand-dark);

  /* Neutros com leve viés para o azul da marca */
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;
  --surface-3: #EFF3F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #172033;
  --text-2: #3D4A5F;
  --muted: #64748B;

  /* Estados (sempre acompanhados de texto ou ícone) */
  --success: #15803D; --success-bg: #EAF7EF; --success-line: #BBE5C8;
  --warning: #A15C07; --warning-bg: #FFF6E5; --warning-line: #F6D9A4;
  --danger: #B42318;  --danger-bg: #FDEEEC;  --danger-line: #F6C8C2;
  --info: var(--brand); --info-bg: var(--brand-soft);
  --neutral-bg: #EEF2F7;

  /* Tipografia */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px; --fs-kpi: 24px;

  /* Espaçamento */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  /* Bordas e sombras */
  --r-sm: 8px; --radius: 10px; --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(21, 55, 120, .05);
  --shadow-md: 0 2px 8px rgba(21, 55, 120, .07);
  --shadow-lg: 0 12px 32px rgba(21, 55, 120, .16);
  --focus: 0 0 0 3px rgba(27, 80, 182, .28);

  /* Layout */
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.012em; color: var(--text); text-wrap: balance; }
h1 { font-size: var(--fs-2xl); font-weight: 700; }
h2 { font-size: var(--fs-lg); font-weight: 600; }
h3 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0 0 .75em; }
small, .small { font-size: var(--fs-xs); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.ic { width: 18px; height: 18px; flex: none; }
.ic-sm { width: 15px; height: 15px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-4) 0; }
code { background: var(--neutral-bg); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand-soft); }

/* ---------- Layout geral ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .2s ease; }
.content { padding: var(--sp-6); max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }

/* ---------- Menu lateral (azul da marca) ---------- */
.sidebar { width: var(--sidebar-w); background: var(--brand); color: var(--brand-ink); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: width .2s ease, transform .2s ease; }
.brand { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-4) var(--sp-3); color: inherit; min-height: 72px; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 40px; height: 40px; flex: none; display: block; }
.brand-logo img { width: 40px; height: 40px; display: block; }
.brand-text { min-width: 0; line-height: 1.2; }
.brand-text strong { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand-text small { display: block; font-size: 11.5px; opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand img.custom-logo { max-height: 34px; max-width: 170px; }
.nav { padding: var(--sp-2) var(--sp-3) var(--sp-4); overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.78); padding: var(--sp-4) 10px 6px; font-weight: 600; white-space: nowrap; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-sm); color: rgba(255,255,255,.88); font-weight: 500; margin-bottom: 2px; white-space: nowrap; }
.nav a .ic { opacity: .9; }
.nav a:hover { background: rgba(255,255,255,.10); color: #fff; text-decoration: none; }
.nav a.active { background: #fff; color: var(--brand-dark); font-weight: 600; box-shadow: 0 1px 2px rgba(10, 30, 70, .18); }
.nav a.active .ic { color: var(--brand); opacity: 1; }
/* Marcador angular inspirado no símbolo */
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 50%; width: 7px; height: 18px; transform: translateY(-50%); background: #fff; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.nav a .count { margin-left: auto; background: #fff; color: var(--brand-dark); font-size: 11px; border-radius: 99px; padding: 0 7px; font-weight: 700; }
.nav a.active .count { background: var(--brand); color: #fff; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.16); padding: var(--sp-2) var(--sp-3); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: 11.5px; color: rgba(255,255,255,.7); }
.collapse-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; color: rgba(255,255,255,.85); font: inherit; font-size: 12.5px; padding: 8px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; }
.collapse-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.collapse-btn .ic { transition: transform .2s ease; }
.sidebar :focus-visible { outline-color: #fff; }

/* Menu recolhido (computador) */
@media (min-width: 861px) {
  body.nav-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  body.nav-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
  body.nav-collapsed .brand { justify-content: center; padding-inline: 0; }
  body.nav-collapsed .brand-text, body.nav-collapsed .nav a span, body.nav-collapsed .nav-label, body.nav-collapsed .sidebar-foot .ver, body.nav-collapsed .collapse-btn span, body.nav-collapsed .nav a .count { display: none; }
  body.nav-collapsed .nav-label { display: block; height: 1px; padding: 0; margin: 10px 8px; background: rgba(255,255,255,.18); font-size: 0; }
  body.nav-collapsed .nav a { justify-content: center; padding: 10px 0; }
  body.nav-collapsed .sidebar-foot { justify-content: center; }
  body.nav-collapsed .collapse-btn .ic { transform: rotate(180deg); }
}

/* ---------- Barra superior ---------- */
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-6); position: sticky; top: 0; z-index: 30; }
.topbar .search { flex: 1; max-width: 440px; position: relative; }
.topbar .search input { padding-left: 34px; background: var(--surface-2); }
.topbar .search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; display: grid; place-items: center; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.menu-toggle { display: none; }
.mobile-brand { display: none; }
.backdrop { display: none; }

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.crumbs { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; position: relative; }
.btn:hover { background: var(--surface-2); border-color: #B7C3D4; text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--danger-line); background: var(--surface); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #116B33; border-color: #116B33; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 32px; padding: 0 11px; font-size: var(--fs-sm); }
.btn-xs { height: 27px; padding: 0 9px; font-size: var(--fs-xs); border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--border-strong); border-top-color: var(--brand); animation: spin .7s linear infinite; }
.btn-primary[aria-busy="true"]::after, .btn-success[aria-busy="true"]::after { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* ---------- Cartões e grades ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-head { padding: 14px var(--sp-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; min-height: 54px; }
.card-body { padding: var(--sp-5); }
.card-body.tight { padding: 0; }
.card + .card { margin-top: var(--sp-4); }
.grid { display: grid; gap: var(--sp-4); }
.grid > * { min-width: 0; }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }
a.card:hover { border-color: #B9CBEA; box-shadow: var(--shadow-md); text-decoration: none; }

/* ---------- Indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: var(--sp-3); }
.kpi { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px var(--sp-4); color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
a.kpi:hover { border-color: #B9CBEA; box-shadow: var(--shadow-md); text-decoration: none; }
.kpi-label { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: var(--fs-kpi); font-weight: 700; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.kpi.is-danger .kpi-value { color: var(--danger); }
.kpi.is-success .kpi-value { color: var(--success); }
.kpi.is-warning .kpi-value { color: var(--warning); }
/* Indicadores de destaque (primeira linha do painel) */
.kpis-hero { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-hero { padding: var(--sp-5); position: relative; overflow: hidden; }
.kpi-hero .kpi-value { font-size: 28px; }
.kpi-hero.is-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi-hero.is-brand .kpi-label, .kpi-hero.is-brand .kpi-foot { color: rgba(255,255,255,.82); }
.kpi-hero.is-brand::after { content: ""; position: absolute; right: -18px; bottom: -26px; width: 120px; height: 90px; background: rgba(255,255,255,.07); clip-path: polygon(0 0, 22% 0, 50% 62%, 78% 0, 100% 0, 50% 100%); }
.state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-contratado { background: var(--brand-soft); color: var(--brand-dark); }
.state-previsto { background: var(--surface-3); color: var(--text-2); }
.state-realizado { background: var(--success-bg); color: var(--success); }
.state-pendente { background: var(--warning-bg); color: var(--warning); }
.state-vencido { background: var(--danger-bg); color: var(--danger); }
.kpi-hero.is-brand .state { background: rgba(255,255,255,.16); color: #fff; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin: var(--sp-6) 0 10px; }
.section-title::before { content: ""; width: 10px; height: 8px; background: var(--brand); clip-path: polygon(0 0, 30% 0, 50% 55%, 70% 0, 100% 0, 50% 100%); flex: none; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #F7F9FE; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); }
.t-title { font-weight: 600; color: var(--text); }
a.t-title:hover { color: var(--brand); }
.t-sub { font-size: var(--fs-xs); color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Etiquetas de estado ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-info { background: var(--brand-soft); color: var(--brand-dark); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--neutral-bg); color: var(--text-2); }
.badge-primary { background: var(--brand-soft); color: var(--brand); }
.badge-success::before, .badge-warning::before, .badge-danger::before, .badge-info::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--neutral-bg); color: var(--text-2); font-size: var(--fs-xs); margin: 0 4px 4px 0; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-5 { grid-column: span 5; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field label, .label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 5px; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], input[type=tel], input[type=month], select, textarea, .input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select { padding-right: 30px; }
input::placeholder, textarea::placeholder { color: #94A3B8; }
input:hover, select:hover, textarea:hover { border-color: #B1BED0; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--focus); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
input[type=file] { font: inherit; font-size: var(--fs-sm); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 550; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--r-sm); padding: 6px 12px; margin-right: 10px; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: middle; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 2px; flex: none; }
.is-invalid { border-color: var(--danger) !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .18) !important; }
.field-error { display: flex; align-items: center; gap: 5px; color: var(--danger); font-size: var(--fs-xs); margin-top: 5px; font-weight: 500; }
.field-error::before { content: "!"; display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; flex: none; }
.form-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-5); flex-wrap: wrap; }
.filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.filters input:not([type=checkbox]):not([type=radio]), .filters select { height: 36px; width: auto; min-width: 140px; font-size: var(--fs-sm); }
.filters input[type=search] { min-width: 220px; flex: 1; }
.filters .check { white-space: nowrap; font-size: var(--fs-sm); color: var(--text-2); }

/* ---------- Alertas ---------- */
.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: var(--sp-4); border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.flash-success { background: var(--success-bg); border-color: var(--success-line); color: #14532D; }
.flash-error { background: var(--danger-bg); border-color: var(--danger-line); color: #7A1A12; }
.flash-warning { background: var(--warning-bg); border-color: var(--warning-line); color: #6B3D05; }
.flash-info { background: var(--brand-soft); border-color: #C9D8F5; color: var(--brand-dark); }
.note { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px 14px; color: var(--text-2); font-size: var(--fs-sm); }
.note-internal { background: #FFFBF1; border: 1px solid var(--warning-line); border-style: solid; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .ic { width: 30px; height: 30px; margin-bottom: 8px; color: #AFC0DB; }

/* ---------- Abas e segmentos ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--text-2); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; font: inherit; font-weight: 550; border-radius: 6px 6px 0 0; }
.tabs a:hover, .tabs button:hover { color: var(--brand); background: var(--surface-3); text-decoration: none; }
.tabs .active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }
.tab-panel[hidden] { display: none; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg a { padding: 7px 13px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 550; }
.seg a + a { border-left: 1px solid var(--border-strong); }
.seg a.active { background: var(--brand); color: #fff; }
.seg a:hover:not(.active) { background: var(--surface-3); text-decoration: none; }
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.pill-nav a { padding: 6px 13px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); font-weight: 550; background: var(--surface); }
.pill-nav a.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.pill-nav a:hover:not(.active) { border-color: #B9CBEA; color: var(--brand); text-decoration: none; }

/* ---------- Chave/valor ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 9px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: var(--fs-sm); }
.kv dd { margin: 0; word-break: break-word; }

/* ---------- Linha do tempo ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline .meta { font-size: var(--fs-xs); color: var(--muted); }
.timeline .body { margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: var(--sp-3); overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kanban-col { flex: 0 0 284px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kanban-col-head { padding: 12px 12px 8px; display: flex; justify-content: space-between; align-items: center; font-weight: 650; font-size: var(--fs-sm); }
.kanban-col-head .sum { font-weight: 500; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.kanban-list { padding: 4px 8px 10px; overflow-y: auto; min-height: 60px; flex: 1; border-radius: var(--radius); }
.kanban-list.drag-over { background: var(--brand-soft); outline: 2px dashed #9DB6E6; outline-offset: -4px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; display: block; color: var(--text); }
.kcard:hover { border-color: #B9CBEA; text-decoration: none; }
.kcard.dragging { opacity: .5; }
.kcard .k-title { font-weight: 600; margin-bottom: 4px; }
.kcard .k-title:hover { color: var(--brand); text-decoration: none; }
.kcard .k-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: var(--fs-xs); color: var(--muted); }
.kcard .k-move { margin-top: 8px; display: none; }
.kcard .k-move select { height: 32px; font-size: var(--fs-xs); }

/* ---------- Progresso ---------- */
.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px var(--sp-5); border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.checklist li { padding: 6px 0; display: flex; gap: 8px; align-items: center; }
.checklist li.done span { text-decoration: line-through; color: var(--muted); }

/* ---------- Menus suspensos e modais ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 50; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.dropdown-menu .head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); color: var(--text); background: var(--surface); }
dialog.modal.wide { width: min(820px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(21, 32, 51, .5); }
.modal-head { padding: 16px var(--sp-5); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-body { padding: var(--sp-5); max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px var(--sp-5); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--sp-2); background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* ---------- Notificações ---------- */
.notif { display: flex; gap: 12px; padding: 13px var(--sp-4); border-bottom: 1px solid var(--border); align-items: flex-start; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: #F6F9FF; box-shadow: inset 3px 0 0 var(--brand); }
.notif .ic-wrap { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.notif .grow { flex: 1; min-width: 0; }

/* ---------- Paginação ---------- */
.pagination { display: flex; gap: 6px; justify-content: space-between; align-items: center; padding: 12px var(--sp-4); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; align-items: center; }

/* ---------- Gráficos ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 210px; }

/* ---------- Biblioteca de anúncios ---------- */
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.ad-card { display: flex; flex-direction: column; overflow: hidden; }
.ad-thumb { aspect-ratio: 16 / 10; max-width: 100%; background: var(--surface-3) center / cover no-repeat; border-bottom: 1px solid var(--border); display: grid; place-items: center; color: #9AAECF; }
.ad-thumb:hover { text-decoration: none; }
.ad-card .card-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ad-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: var(--fs-xs); margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.ad-metrics b { display: block; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.fav { color: #D97706; }
.fav-off { color: var(--border-strong); }
.preview-media { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

/* ---------- Telas de acesso (login, convite, instalação) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.auth-side { position: relative; overflow: hidden; background: var(--brand); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; }
.auth-side .auth-mark { width: 112px; height: 112px; display: block; margin-left: -17px; }
.auth-side .auth-mark img { width: 112px; height: 112px; display: block; }
.auth-side h2 { color: #fff; font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 18px; }
.auth-side .auth-org { color: rgba(255,255,255,.78); margin-top: 6px; font-size: 15px; }
.auth-side .auth-foot { color: rgba(255,255,255,.66); font-size: 12px; position: relative; }
.auth-side .auth-top { position: relative; z-index: 1; }
/* Grafismo: feixes angulares que retomam os ângulos do símbolo, sem redesenhá-lo */
.auth-graphic { position: absolute; inset: auto -12% -6% auto; width: 92%; max-width: 640px; height: auto; pointer-events: none; }
.auth-graphic path { fill: none; stroke: #fff; stroke-width: 1.4; stroke-linejoin: miter; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); background: var(--bg); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card.wide { max-width: 640px; }
.auth-card .card { box-shadow: var(--shadow-md); }
.auth-card .card-body { padding: 30px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth .auth-sub { color: var(--muted); margin-bottom: 20px; }
.auth-mobile-brand { display: none; }

/* ---------- Portal do cliente ---------- */
.portal-top { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 30; }
.portal-top-inner { max-width: 1140px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 14px; }
.portal-top .brand { padding: 0; min-height: 0; }
.portal-top .icon-btn { color: rgba(255,255,255,.9); }
.portal-top .icon-btn:hover { background: rgba(255,255,255,.12); }
.portal-top .icon-btn .dot { border-color: var(--brand); }
.portal-top .avatar { background: #fff; color: var(--brand-dark); }
.portal-client { font-size: var(--fs-sm); padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.16); color: #fff; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.portal-navbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 64px; z-index: 29; }
.portal-nav { max-width: 1140px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.portal-nav a { padding: 12px 12px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; }
.portal-nav a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }
.portal-nav a:hover { text-decoration: none; color: var(--brand); }
.portal-main { max-width: 1140px; margin: 0 auto; padding: 24px 20px 48px; }
.hero { position: relative; overflow: hidden; background: var(--brand-dark); color: #fff; border-radius: var(--radius-lg); padding: 24px 28px; margin-bottom: 20px; }
.hero h1 { color: #fff; font-size: 22px; position: relative; }
.hero p { color: rgba(255,255,255,.8); margin: 6px 0 0; position: relative; max-width: 65ch; }
.hero::after { content: ""; position: absolute; right: 24px; top: 50%; width: 120px; height: 84px; transform: translateY(-50%); background: rgba(255,255,255,.08); clip-path: polygon(0 0, 22% 0, 50% 62%, 78% 0, 100% 0, 50% 100%); }

/* ---------- Diversos ---------- */
.overdue { color: var(--danger); font-weight: 600; }
.soon { color: var(--warning); font-weight: 600; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 6px; padding: 8px 10px; }
.swatch { width: 40px; height: 40px; padding: 2px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); cursor: pointer; background: var(--surface); }
.split { display: flex; gap: 8px; }
.split > * { flex: 1; min-width: 0; }
.hide { display: none !important; }
details > summary::-webkit-details-marker { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid-4, .kpis-hero, .kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-mobile-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
  .auth-mobile-brand .mb-mark { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; background: var(--brand); }
  .auth-mobile-brand .mb-mark img { width: 48px; height: 48px; display: block; }
  .auth-mobile-brand strong { font-size: 17px; }
  .auth-main { align-items: flex-start; padding-top: 32px; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(21, 32, 51, .45); z-index: 35; }
  .collapse-btn { display: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
  .mobile-brand img { width: 30px; height: 30px; border-radius: 7px; }
  .mobile-brand:hover { text-decoration: none; }
  .topbar { padding: 0 12px; }
  .topbar .search { display: none; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  h1 { font-size: 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 19px; }
  .kpi-hero .kpi-value { font-size: 21px; }
  .kpi-hero { padding: 14px; }
  table.table.responsive thead { display: none; }
  table.table.responsive, table.table.responsive tbody, table.table.responsive tr, table.table.responsive td { display: block; width: 100%; }
  table.table.responsive tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  table.table.responsive td { border: 0; padding: 4px 14px; text-align: left !important; display: flex; justify-content: space-between; gap: 10px; }
  table.table.responsive td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-xs); font-weight: 500; flex: none; }
  table.table.responsive td.actions { justify-content: flex-end; }
  table.table.responsive tfoot { display: block; }
  .kanban-col { flex-basis: 85vw; max-height: none; }
  .kcard .k-move { display: block; }
  .filters input:not([type=checkbox]):not([type=radio]), .filters select { min-width: 0; flex: 1 1 140px; }
  .page-actions { width: 100%; }
  .portal-top-inner { height: 58px; padding: 0 14px; }
  .portal-navbar { top: 58px; }
  .portal-nav, .portal-main { padding-left: 14px; padding-right: 14px; }
  .portal-top .brand-text small { display: none; }
  .hero::after { display: none; }
}
@media (hover: none) { .kcard .k-move { display: block; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print {
  .sidebar, .topbar, .page-actions, .filters, .form-actions, .no-print { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; }
}
