:root {
  --navy-900: #0a0e17;
  --navy-800: #121826;
  --navy-700: #1a2235;
  --navy-600: #232d45;
  --orange-1: #ff7b00;
  --orange-2: #ff9d00;
  --txt-main: #f0f4f8;
  --txt-dim: #9aa4b5;
  --txt-soft: #bac4d4;
  --line: rgba(255, 255, 255, 0.08);
  --ok: #20c997;
  --err: #ff4d4f;
}

* { box-sizing: border-box; font-family: 'Segoe UI', system-ui, sans-serif; }
body { margin: 0; background: var(--navy-900); color: var(--txt-main); font-size: 14px; line-height: 1.5; overflow-x: hidden; }

/* Utilitarios */
.hidden { display: none !important; }
.mono { font-family: 'Consolas', monospace; font-size: 13px; }

/* Botoes */
.btn { border: none; padding: 10px 18px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--txt-main); color: var(--navy-900); }
.btn-primary:hover { background: #fff; box-shadow: 0 0 12px rgba(255,255,255,0.2); }
.btn-orange { background: linear-gradient(135deg, var(--orange-1), var(--orange-2)); color: #fff; }
.btn-orange:hover { box-shadow: 0 4px 14px rgba(255,123,0,0.3); }
.btn-ghost { background: transparent; color: var(--txt-dim); border: none; font-weight: 500; cursor: pointer; padding: 6px 10px; border-radius: 4px; transition: .2s; }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: #fff; }
.btn-cancel { background: var(--navy-600); color: var(--txt-main); }
.btn-cancel:hover { background: var(--navy-700); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Inputs */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; font-weight: 700; color: var(--txt-dim); margin-bottom: 6px; letter-spacing: 0.5px; }
.input, .select { width: 100%; background: var(--navy-900); border: 1px solid var(--line); color: var(--txt-main); padding: 10px 12px; border-radius: 6px; font-size: 14px; outline: none; transition: .2s; }
.input:focus, .select:focus { border-color: var(--orange-1); box-shadow: 0 0 0 3px rgba(255,123,0,0.15); }
.input:disabled, .select:disabled { opacity: 0.6; background: var(--navy-800); }
.field-err { color: var(--err); font-size: 12.5px; margin-top: 6px; }

/* Toast */
.toast { position: fixed; bottom: -60px; left: 50%; transform: translateX(-50%); background: var(--navy-600); border: 1px solid var(--line); color: var(--txt-main); padding: 12px 24px; border-radius: 30px; font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,0.5); transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 9999; pointer-events: none; }
.toast.show { bottom: 30px; }
.toast.err { background: #3a1111; border-color: var(--err); color: #ffcccc; }
.toast.ok { background: #0f3024; border-color: var(--ok); color: #ccffeb; }

/* Logo & Marcas */
.logo-word { font-weight: 900; font-size: 42px; letter-spacing: -1px; color: var(--txt-main); }
.logo-word span { color: var(--orange-1); }
.logo-word.sm { font-size: 24px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top right, var(--navy-800), var(--navy-900)); padding: 20px; }
.login-card { background: var(--navy-700); border: 1px solid var(--line); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 40px rgba(0,0,0,0.3); display: flex; flex-direction: column; }
.login-logo { display: flex; justify-content: center; margin-bottom: 24px; }
.brand { text-align: center; margin-bottom: 30px; }
.prog-name { font-size: 22px; font-weight: 800; margin: 0 0 6px 0; line-height: 1.2; letter-spacing: 0.5px; }
.sub { color: var(--txt-dim); font-size: 12px; font-weight: 600; letter-spacing: 1px; margin: 0; }
.login-err { background: #3a1111; border: 1px solid var(--err); color: #ffcccc; padding: 10px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; text-align: center; }
.login-credit { text-align: center; font-size: 11px; color: var(--txt-dim); margin-top: 24px; line-height: 1.4; border-top: 1px solid var(--line); padding-top: 16px; }
.login-credit b { color: var(--txt-soft); }

/* Topbar */
.topbar { background: var(--navy-800); border-bottom: 1px solid var(--line); height: 60px; display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.tb-title { margin-left: 20px; padding-left: 20px; border-left: 1px solid var(--line); font-weight: 700; font-size: 13px; letter-spacing: 1px; color: var(--txt-dim); }
.spacer { flex: 1; }
.tb-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.tb-user span { font-weight: 500; }

/* Badges */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge.admin { background: #3d1c00; color: var(--orange-1); border: 1px solid rgba(255,123,0,0.3); }
.badge.lider { background: #002244; color: #4da6ff; border: 1px solid rgba(77,166,255,0.3); }
.badge.colaborador { background: #1a2c24; color: #4dffa6; border: 1px solid rgba(77,255,166,0.3); }
.count-pill { background: var(--navy-600); padding: 2px 8px; border-radius: 12px; font-weight: bold; font-size: 12px; }

/* Menu App */
.page { max-width: 1100px; margin: 40px auto; padding: 0 20px; }
.welcome h2 { margin: 0 0 6px 0; font-size: 28px; }
.welcome p { margin: 0 0 30px 0; color: var(--txt-dim); font-size: 16px; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.menu-card { background: var(--navy-800); border: 1px solid var(--line); border-radius: 12px; padding: 24px; cursor: pointer; transition: .2s; }
.menu-card:hover { border-color: var(--orange-1); transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.menu-card .ic { font-size: 32px; margin-bottom: 16px; }
.menu-card h3 { margin: 0 0 8px 0; font-size: 17px; }
.menu-card p { margin: 0; color: var(--txt-dim); font-size: 13px; line-height: 1.5; }

.page-head { display: flex; align-items: center; margin-bottom: 30px; gap: 16px; }
.page-head h2 { margin: 0; font-size: 24px; }

/* Modais */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; overflow-y: auto; }
.modal { background: var(--navy-800); border: 1px solid var(--line); border-radius: 12px; padding: 30px; width: 100%; max-width: 500px; box-shadow: 0 20px 40px rgba(0,0,0,0.4); margin: auto; }
.modal h3 { margin: 0 0 20px 0; font-size: 20px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 30px; border-top: 1px solid var(--line); padding-top: 20px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.msub { color: var(--txt-dim); margin-top: -12px; margin-bottom: 20px; font-size: 13px; line-height: 1.5; }

/* Tabelas e Cards Genéricos */
.card { background: var(--navy-800); border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 24px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); }
th { color: var(--txt-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
.empty { text-align: center !important; color: var(--txt-dim); font-style: italic; padding: 30px !important; }
.toolbar { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar .field { margin-bottom: 0; }
.row-actions { display: flex; gap: 8px; }

/* Buscas / Resultados */
.search-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.fund-checks { display: flex; gap: 16px; background: var(--navy-900); padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); }
.fund-chk { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; font-weight: 600; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.result-card { background: var(--navy-800); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.result-card:hover { border-color: rgba(255,255,255,0.15); }
.rc-head { font-weight: bold; color: var(--orange-2); border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 10px; font-size: 15px; }
.rc-row { font-size: 13px; margin-bottom: 6px; color: var(--txt-main); }
.rc-row b { color: var(--txt-dim); display: inline-block; width: 105px; }
.rc-btns { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Dashboard em Tempo Real */
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--err); margin-right: 10px; box-shadow: 0 0 10px var(--err); animation: pulse 1.5s infinite; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; box-shadow: 0 0 6px var(--ok); }
@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.2); } 100% { opacity: 1; transform: scale(1); } }

.prod-row { display: flex; gap: 24px; margin: 24px 0; }
.prod-stat { background: var(--navy-900); border: 1px solid var(--line); border-radius: 12px; padding: 20px; flex: 1; text-align: center; }
.bignum { font-size: 48px; font-weight: 900; color: var(--orange-1); line-height: 1; margin-bottom: 8px; }
.prod-lbl { color: var(--txt-dim); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.prod-media { font-size: 13.5px; color: var(--txt-soft); background: rgba(255,255,255,0.03); padding: 12px; border-radius: 8px; }

.sum-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.sum-card { background: var(--navy-900); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; min-width: 140px; flex: 1; text-align: center; }
.sum-v { font-size: 22px; font-weight: 800; color: var(--orange-2); }
.sum-k { font-size: 11px; color: var(--txt-dim); text-transform: uppercase; font-weight: 600; margin-top: 4px; }

/* =====================================================================
   FOLHA A4 E FORMULARIO
   Atenção: Isolado para não estourar a tela do site!
   ===================================================================== */
.sheet-wrap { background: #525659; padding: 40px 20px; display: flex; justify-content: center; min-height: 100vh; overflow-x: auto; }
.sheet { width: 820px; max-width: 100%; background: #fff; color: #000; padding: 54px 60px 40px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); font-family: 'Times New Roman', Georgia, serif; font-size: 14px; line-height: 1.4; position: relative; margin: 0 auto; box-sizing: border-box; }

.sheet * { box-sizing: border-box; }
.lt-header { display: flex; justify-content: flex-end; border-bottom: 2px solid #173b63; padding-bottom: 8px; margin-bottom: 6px; }
.logo-img { height: 58px; width: auto; }
.term-title { text-align: center; font-size: 16px; font-weight: bold; margin: 14px 0 18px 0; text-transform: uppercase; }

.sec { margin-bottom: 16px; border: 1px solid #000; margin-top: -1px; }
.sec-title { background: #dfe7ef; font-weight: bold; padding: 5px 8px; font-size: 13px; border-bottom: 1px solid #000; }

.row { display: flex; border-bottom: 1px solid #000; }
.row:last-child { border-bottom: none; }
.lbl { width: 190px; font-weight: bold; padding: 6px 8px; border-right: 1px solid #000; display: flex; align-items: center; font-size: 12.5px; flex: none; }
.val { flex: 1; padding: 5px 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }

.opts { display: flex; flex-wrap: wrap; gap: 14px 22px; padding: 7px 8px; font-size: 12.5px; }
.opt { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.opt input[type="radio"], .opt input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; margin: 0; }

.fld { font-family: inherit; font-size: 12.5px; border: none; background: #eef4fb; outline: none; border-bottom: 1.5px dashed #9bb2cc; padding: 2px 5px; color: #000; min-width: 60px; }
.fld.full { flex: 1; width: 100%; }
.fld::placeholder { font-weight: normal; font-style: italic; color: #888; }
.fld:focus { background: #e3edf8; border-bottom-color: #173b63; }
textarea.fld { width: 100%; flex: 1; min-height: 46px; resize: vertical; border: 1px dashed #9bb2cc; border-radius: 4px; font-weight: normal; }

.note { font-size: 10.5px; font-style: italic; margin-bottom: 0; color: #444; padding: 4px 8px; }
.caixa-prefix { font-weight: bold; margin-right: 2px; font-size: 12.5px; }
.resp { padding: 8px; font-size: 12.5px; line-height: 1.6; }

.lt-footer { margin-top: 34px; border-top: 2px solid #173b63; padding-top: 8px; text-align: center; font-size: 9.5px; color: #1d2b3a; line-height: 1.5; }

.term-actions { background: var(--navy-800); border: 1px solid var(--orange-1); border-radius: 8px; padding: 16px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 70px; z-index: 90; box-shadow: 0 10px 20px rgba(0,0,0,0.3); }
.term-hint { color: var(--txt-main); font-size: 13.5px; }
.err-box { background: #3a1111; border: 1px solid var(--err); color: #ffcccc; padding: 16px; border-radius: 8px; margin-bottom: 20px; }
.err-box ul { margin: 8px 0 0 0; padding-left: 20px; }
.err-box li { margin-bottom: 4px; }