/* ==========================================================================
   Grupo JAP - Portal Corporativo
   Design system: tema claro corporativo + navegacao escura
   ========================================================================== */

:root {
  /* Marca */
  --brand:        #0f7b4f;
  --brand-600:    #0c6742;
  --brand-700:    #0a5537;
  --brand-300:    #57b98c;
  --brand-50:     #e8f5ef;
  --accent:       #c9a227;

  /* Navegacao escura */
  --nav-bg:       #0b1220;
  --nav-bg-2:     #111c30;
  --nav-line:     rgba(255, 255, 255, .07);
  --nav-txt:      #93a3bb;
  --nav-txt-on:   #ffffff;
  --nav-hover:    rgba(255, 255, 255, .06);

  /* Superficies claras */
  --bg:           #f4f6fa;
  --surface:      #ffffff;
  --surface-2:    #fafbfd;
  --line:         #e5e9f0;
  --line-2:       #eef1f6;

  /* Texto */
  --txt:          #0f172a;
  --txt-2:        #475569;
  --txt-3:        #8695ab;

  /* Estados */
  --ok:           #15803d;
  --ok-bg:        #e8f7ee;
  --warn:         #b45309;
  --warn-bg:      #fdf3e3;
  --err:          #b91c1c;
  --err-bg:       #fdecec;
  --info:         #1d4ed8;
  --info-bg:      #eaf0ff;

  /* Formas */
  --r-sm:  8px;
  --r:     12px;
  --r-lg:  16px;
  --r-xl:  22px;

  --sh-1: 0 1px 2px rgba(15, 23, 42, .05);
  --sh-2: 0 2px 8px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --sh-3: 0 10px 28px rgba(15, 23, 42, .09), 0 2px 6px rgba(15, 23, 42, .04);
  --sh-4: 0 24px 60px rgba(11, 18, 32, .18);

  --sidebar-w: 268px;
  --topbar-h:  64px;
  --t: .18s cubic-bezier(.4, 0, .2, 1);
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a   { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-700); }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--brand-300); color: #04281a; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--surface);
}

/* Painel esquerdo (institucional) */
.login-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 12% 8%,  rgba(15, 123, 79, .40), transparent 62%),
    radial-gradient(760px 520px at 92% 92%, rgba(201, 162, 39, .22), transparent 60%),
    linear-gradient(150deg, #0b1220 0%, #101d31 52%, #0a1a16 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 56px;
}

.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(78% 78% at 40% 30%, #000 20%, transparent 100%);
  pointer-events: none;
}

.login-hero > * { position: relative; z-index: 1; }

.hero-brand { display: flex; align-items: center; gap: 14px; }

.hero-mark {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 15px;
  background: linear-gradient(140deg, var(--brand) 0%, #0a5537 100%);
  box-shadow: 0 10px 26px rgba(15, 123, 79, .45);
  font-weight: 800; font-size: 18px; letter-spacing: .5px;
  color: #fff;
}

.hero-brand b   { display: block; font-size: 17px; letter-spacing: .2px; }
.hero-brand span{ display: block; font-size: 12px; color: #8fa3bd; letter-spacing: .12em; text-transform: uppercase; }

.hero-mid { max-width: 470px; }
.hero-mid h1 { font-size: 40px; line-height: 1.12; letter-spacing: -.03em; margin-bottom: 16px; }
.hero-mid h1 em { font-style: normal; color: var(--brand-300); }
.hero-mid p  { color: #a9bad2; font-size: 15px; margin: 0 0 30px; }

.hero-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.hero-list li { display: flex; align-items: center; gap: 12px; color: #cbd7e6; font-size: 14px; }
.hero-list i {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(87, 185, 140, .14);
  color: var(--brand-300);
  font-size: 12px;
}

.hero-foot { color: #64748b; font-size: 12px; letter-spacing: .04em; }

/* Painel direito (formulario) */
.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}

.login-card { width: 100%; max-width: 396px; }

.login-card .lc-head { margin-bottom: 28px; }
.login-card .lc-head h2 { font-size: 25px; margin-bottom: 6px; }
.login-card .lc-head p  { margin: 0; color: var(--txt-3); font-size: 14px; }

.login-mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 26px; }

/* ==========================================================================
   FORMULARIOS
   ========================================================================== */
.campo { margin-bottom: 16px; }

.campo > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--txt-2);
  margin-bottom: 7px;
  letter-spacing: .01em;
}

.campo .req { color: var(--err); }

.input, .select, .textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--txt);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  outline: none;
}

.textarea { height: auto; min-height: 96px; padding: 11px 14px; resize: vertical; line-height: 1.6; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 38px;
}

.input::placeholder, .textarea::placeholder { color: #a9b4c5; }

.input:hover, .select:hover, .textarea:hover { border-color: #cdd5e1; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(15, 123, 79, .13);
}

.input:disabled, .select:disabled { background: var(--surface-2); color: var(--txt-3); cursor: not-allowed; }

/* Input com icone */
.campo-icone { position: relative; }
.campo-icone > i:first-child {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: 14px; pointer-events: none; transition: color var(--t);
}
.campo-icone .input { padding-left: 42px; }
.campo-icone:focus-within > i:first-child { color: var(--brand); }

.btn-olho {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; background: transparent; color: #94a3b8;
  border-radius: 7px; cursor: pointer; transition: var(--t);
}
.btn-olho:hover { background: var(--line-2); color: var(--txt-2); }

.campo-hint { font-size: 12px; color: var(--txt-3); margin-top: 6px; }

.linha-form { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 16px; }
.col-2  { grid-column: span 2; }  .col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }  .col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }  .col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }  .col-9  { grid-column: span 9; }
.col-10 { grid-column: span 10; } .col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* Checkbox / switch */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--txt-2); }
.check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; margin: 0; }

.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 42px; height: 24px; border-radius: 99px; background: #cbd5e1;
  position: relative; transition: background var(--t); flex: 0 0 42px;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: var(--sh-1); transition: transform var(--t);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch span:last-child { font-size: 13.5px; color: var(--txt-2); }

/* ==========================================================================
   BOTOES
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; letter-spacing: .01em;
  cursor: pointer; white-space: nowrap;
  transition: var(--t);
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primario {
  background: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(15, 123, 79, .3), 0 4px 12px rgba(15, 123, 79, .18);
}
.btn-primario:hover:not(:disabled) { background: var(--brand-600); color: #fff; }

.btn-escuro { background: var(--nav-bg); color: #fff; }
.btn-escuro:hover:not(:disabled) { background: #1a2740; color: #fff; }

.btn-claro { background: var(--surface); color: var(--txt-2); border-color: var(--line); box-shadow: var(--sh-1); }
.btn-claro:hover:not(:disabled) { background: var(--surface-2); border-color: #cdd5e1; color: var(--txt); }

.btn-perigo { background: var(--err); color: #fff; }
.btn-perigo:hover:not(:disabled) { background: #991b1b; color: #fff; }

.btn-ghost { background: transparent; color: var(--txt-2); }
.btn-ghost:hover:not(:disabled) { background: var(--line-2); color: var(--txt); }

.btn-bloco { width: 100%; height: 47px; font-size: 14.5px; }
.btn-sm    { height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 7px; }

.btn-icone {
  width: 34px; height: 34px; padding: 0; flex: 0 0 34px;
  border-radius: 8px; background: transparent; color: var(--txt-3);
  border: 1.5px solid transparent;
}
.btn-icone:hover { background: var(--line-2); color: var(--txt); }
.btn-icone.perigo:hover { background: var(--err-bg); color: var(--err); }

/* ==========================================================================
   LAYOUT DO PAINEL
   ========================================================================== */
.app { min-height: 100vh; }

/* --- Sidebar escura --- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%);
  color: var(--nav-txt);
  display: flex; flex-direction: column;
  z-index: 60;
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}

.sb-head {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--nav-line);
}

.sb-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--brand) 0%, #0a5537 100%);
  color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 4px 14px rgba(15, 123, 79, .4);
}

.sb-title { min-width: 0; }
.sb-title b    { display: block; color: #fff; font-size: 14.5px; letter-spacing: .01em; }
.sb-title span { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #64748b; }

.sb-nav { flex: 1; overflow-y: auto; padding: 16px 12px 20px; }
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border: 0; }

.sb-grupo {
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: #56647c; padding: 0 12px; margin: 20px 0 8px;
}
.sb-grupo:first-child { margin-top: 0; }

.sb-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 2px;
  border-radius: 9px;
  color: var(--nav-txt); font-size: 13.5px; font-weight: 500;
  transition: var(--t);
}
.sb-item:hover { background: var(--nav-hover); color: #e2e8f0; }

.sb-item > i:first-child,
.sb-item > .sb-dot { width: 19px; flex: 0 0 19px; text-align: center; font-size: 14px; opacity: .9; }

.sb-item.ativo { background: rgba(15, 123, 79, .17); color: #fff; font-weight: 600; }
.sb-item.ativo::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--brand-300);
}
.sb-item.ativo > i:first-child { color: var(--brand-300); opacity: 1; }

.sb-item .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sb-badge {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  background: rgba(255, 255, 255, .09); color: #cbd5e1;
}

/* Ponto colorido da empresa no menu */
.sb-dot { position: relative; }
.sb-dot::after {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c, var(--brand-300));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .07);
}

.sb-foot { border-top: 1px solid var(--nav-line); padding: 12px; }

.sb-user {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  transition: var(--t);
}
.sb-user:hover { background: var(--nav-hover); }
.sb-user .av {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(140deg, #1e3a5f, #0f7b4f);
  color: #fff; font-size: 12px; font-weight: 700;
}
.sb-user .nome { min-width: 0; flex: 1; }
.sb-user .nome b    { display: block; color: #e2e8f0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .nome span { display: block; color: #64748b; font-size: 11.5px; }
.sb-user .sair { color: #64748b; padding: 6px; border-radius: 7px; transition: var(--t); }
.sb-user .sair:hover { color: #f87171; background: rgba(248, 113, 113, .12); }

/* --- Area principal --- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.tb-toggle { display: none; }

.tb-titulo { min-width: 0; flex: 1; }
.tb-titulo h1 { font-size: 17px; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-titulo .crumb { font-size: 12px; color: var(--txt-3); display: flex; align-items: center; gap: 6px; }
.tb-titulo .crumb a { color: var(--txt-3); }
.tb-titulo .crumb a:hover { color: var(--brand); }

.tb-acoes { display: flex; align-items: center; gap: 8px; }

.tb-busca { position: relative; width: 260px; }
.tb-busca i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 13px; }
.tb-busca input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1.5px solid var(--line); border-radius: 99px;
  background: var(--surface-2); outline: none;
  font-size: 13px; transition: var(--t);
}
.tb-busca input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3.5px rgba(15, 123, 79, .1); }

.conteudo { flex: 1; padding: 26px; width: 100%; }

/* Cabecalho de pagina */
.pg-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.pg-head h2 { font-size: 21px; letter-spacing: -.02em; }
.pg-head p  { margin: 4px 0 0; color: var(--txt-3); font-size: 13.5px; }
.pg-head .acoes { display: flex; gap: 9px; flex-wrap: wrap; }

/* ==========================================================================
   CARDS / PAINEIS
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 14.5px; }
.card-head p  { margin: 2px 0 0; font-size: 12.5px; color: var(--txt-3); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }

.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 20px; box-shadow: var(--sh-1);
}
.kpi::after {
  content: ""; position: absolute; right: -26px; top: -26px;
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--c, var(--brand)); opacity: .06;
}
.kpi .ic {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; margin-bottom: 13px;
  background: color-mix(in srgb, var(--c, var(--brand)) 12%, #fff);
  color: var(--c, var(--brand)); font-size: 15px;
}
.kpi .val { font-size: 27px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.kpi .rot { font-size: 12.5px; color: var(--txt-3); margin-top: 3px; }

/* ==========================================================================
   CARDS DE EMPRESA
   ========================================================================== */
.grade-empresas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 18px;
}

.emp-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  color: inherit;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.emp-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-3);
  border-color: color-mix(in srgb, var(--c, var(--brand)) 34%, var(--line));
  color: inherit;
}

.emp-faixa {
  height: 5px;
  background: linear-gradient(90deg, var(--c, var(--brand)), color-mix(in srgb, var(--c, var(--brand)) 45%, #ffffff));
}

.emp-topo { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 0; }

.emp-logo {
  width: 54px; height: 54px; flex: 0 0 54px;
  display: grid; place-items: center;
  border-radius: 14px; overflow: hidden;
  background: color-mix(in srgb, var(--c, var(--brand)) 11%, #fff);
  color: var(--c, var(--brand));
  font-size: 20px; font-weight: 800; letter-spacing: -.02em;
  border: 1px solid color-mix(in srgb, var(--c, var(--brand)) 18%, #fff);
}
.emp-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

.emp-id { min-width: 0; flex: 1; }
.emp-id h3 { font-size: 16px; letter-spacing: -.02em; margin-bottom: 3px; }
.emp-id .seg { font-size: 12px; color: var(--txt-3); }

.emp-corpo { padding: 14px 20px 0; flex: 1; }
.emp-corpo p { margin: 0; font-size: 13px; color: var(--txt-2); line-height: 1.6; }

.emp-meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 20px 0; }

.emp-rodape {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 20px; margin-top: 16px;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--txt-3);
}
.emp-entrar {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 650; font-size: 13px; color: var(--c, var(--brand));
}
.emp-card:hover .emp-entrar i { transform: translateX(3px); }
.emp-entrar i { transition: transform var(--t); }

/* Card "nova empresa" */
.emp-novo {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 216px; padding: 26px;
  border: 1.5px dashed #cbd5e1; border-radius: var(--r-lg);
  background: transparent; color: var(--txt-3); text-align: center;
  transition: var(--t);
}
.emp-novo:hover { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.emp-novo i { font-size: 22px; }
.emp-novo b { font-size: 14px; font-weight: 650; }
.emp-novo span { font-size: 12.5px; }

/* ==========================================================================
   MODULOS (universo da empresa)
   ========================================================================== */
.grade-modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.mod-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--sh-1); color: inherit;
  transition: var(--t);
}
.mod-card:hover { transform: translateY(-2px); box-shadow: var(--sh-3); border-color: color-mix(in srgb, var(--c, var(--brand)) 32%, var(--line)); color: inherit; }

.mod-card .ic {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center; border-radius: 11px;
  background: color-mix(in srgb, var(--c, var(--brand)) 11%, #fff);
  color: var(--c, var(--brand)); font-size: 16px;
}
.mod-card b    { display: block; font-size: 14px; margin-bottom: 3px; }
.mod-card span { display: block; font-size: 12.5px; color: var(--txt-3); line-height: 1.5; }

.mod-card.desabilitado { opacity: .62; pointer-events: none; }
.mod-card.desabilitado .ic { background: var(--line-2); color: var(--txt-3); }

/* ==========================================================================
   TABELAS
   ========================================================================== */
.tabela-wrap { width: 100%; overflow-x: auto; border-radius: var(--r); }

.tabela { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface); }

.tabela thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; padding: 11px 16px;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--txt-3); background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.tabela tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr { transition: background var(--t); }
.tabela tbody tr:hover { background: var(--surface-2); }

.tabela .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabela .acoes-col { text-align: right; white-space: nowrap; width: 1%; }

.cel-emp { display: flex; align-items: center; gap: 11px; }
.cel-emp .mini {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center; border-radius: 9px; overflow: hidden;
  background: color-mix(in srgb, var(--c, var(--brand)) 11%, #fff);
  color: var(--c, var(--brand)); font-weight: 700; font-size: 12px;
}
.cel-emp .mini img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.cel-emp b    { display: block; font-weight: 600; }
.cel-emp span { display: block; font-size: 12px; color: var(--txt-3); }

/* ==========================================================================
   MENU INTERNO DO MÓDULO
   ========================================================================== */
.mod-nav {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 20px; padding: 0 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
  overflow-x: auto;
}
.mod-nav::-webkit-scrollbar { height: 0; }

.mod-nav-marca {
  display: flex; align-items: center; gap: 9px;
  padding: 0 14px; margin-left: 6px;
  border-right: 1px solid var(--line-2);
  align-self: stretch;
  font-size: 13px; font-weight: 700; color: var(--txt);
  white-space: nowrap;
}
.mod-nav-marca i { color: var(--c, var(--brand)); font-size: 14px; }

.mod-nav-itens { display: flex; gap: 2px; padding: 6px 0; }

.mod-nav-item {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 550; color: var(--txt-2);
  white-space: nowrap;
  transition: var(--t);
}
.mod-nav-item i { font-size: 12.5px; opacity: .75; }
.mod-nav-item:hover { background: var(--line-2); color: var(--txt); }

.mod-nav-item.ativo {
  background: color-mix(in srgb, var(--c, var(--brand)) 11%, #fff);
  color: var(--c, var(--brand));
  font-weight: 650;
}
.mod-nav-item.ativo i { opacity: 1; }

@media (max-width: 640px) {
  .mod-nav-marca { display: none; }
  .mod-nav-item span { font-size: 12.5px; }
}

/* ==========================================================================
   LOADER GLOBAL
   Aparece em qualquer navegação/envio de formulário para a tela nunca
   parecer travada — algumas consultas à API do GIRO levam dezenas de segundos.
   ========================================================================== */

/* Barra de progresso no topo */
#gjBarra {
  position: fixed; top: 0; left: 0; z-index: 9999;
  height: 3px; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-300));
  box-shadow: 0 0 10px color-mix(in srgb, var(--brand) 60%, transparent);
  opacity: 0;
  transition: width .25s ease-out, opacity .25s;
  pointer-events: none;
}
#gjBarra.ativo { opacity: 1; }

/* Overlay com o cartão de carregando */
#gjLoader {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  background: rgba(244, 246, 250, .72);
  backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
#gjLoader.ativo { opacity: 1; visibility: visible; }

.gj-load-cartao {
  display: flex; align-items: center; gap: 15px;
  padding: 18px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  max-width: min(90vw, 380px);
  transform: translateY(6px);
  transition: transform .2s;
}
#gjLoader.ativo .gj-load-cartao { transform: none; }

.gj-spin {
  width: 30px; height: 30px; flex: 0 0 30px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: gj-girar .7s linear infinite;
}
@keyframes gj-girar { to { transform: rotate(360deg); } }

.gj-load-txt b    { display: block; font-size: 14px; color: var(--txt); }
.gj-load-txt span { display: block; font-size: 12.5px; color: var(--txt-3); margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  .gj-spin { animation-duration: 2s; }
  #gjBarra { transition: none; }
}

/* ==========================================================================
   MATRIZ DE ACESSOS (usuários × empresas)
   ========================================================================== */
.matriz-wrap { width: 100%; overflow: auto; max-height: 68vh; }

.tabela.matriz { border-collapse: separate; border-spacing: 0; }

.tabela.matriz th,
.tabela.matriz td { border-bottom: 1px solid var(--line-2); }

/* Primeira coluna fixa na rolagem horizontal */
.tabela.matriz .col-fixa {
  position: sticky; left: 0; z-index: 2;
  background: var(--surface);
  min-width: 236px;
  box-shadow: 1px 0 0 var(--line);
}
.tabela.matriz thead .col-fixa { z-index: 4; background: var(--surface-2); }
.tabela.matriz tbody tr:hover .col-fixa { background: var(--surface-2); }

/* Cabeçalho de empresa */
.tabela.matriz thead th { z-index: 3; padding: 0; }

.col-empresa { min-width: 104px; text-align: center; }

.cab-empresa {
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 8px;
  background: transparent; border: 0; cursor: pointer;
  transition: background var(--t);
}
.cab-empresa:hover { background: color-mix(in srgb, var(--c, var(--brand)) 8%, transparent); }

.cab-empresa .marca-emp {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--c, var(--brand)) 14%, #fff);
  color: var(--c, var(--brand));
  font-size: 11px; font-weight: 800; letter-spacing: -.01em;
}
.cab-empresa .nome-emp {
  font-size: 11px; font-weight: 600; color: var(--txt-2);
  letter-spacing: 0; text-transform: none;
  max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Célula de permissão */
.cel-acesso { text-align: center; padding: 8px !important; position: relative; }
.cel-acesso::before {
  content: ""; position: absolute; inset: 0;
  background: var(--c, var(--brand)); opacity: 0; transition: opacity var(--t);
  pointer-events: none;
}
.cel-acesso:hover::before { opacity: .05; }

.quadro { display: inline-grid; place-items: center; cursor: pointer; }
.quadro input { position: absolute; opacity: 0; width: 0; height: 0; }

.quadro .marca {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: transparent;
  font-size: 11px;
  transition: var(--t);
}
.quadro:hover .marca { border-color: var(--c, var(--brand)); }

.quadro input:checked + .marca {
  background: var(--c, var(--brand));
  border-color: var(--c, var(--brand));
  color: #fff;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--c, var(--brand)) 40%, transparent);
}
.quadro input:focus-visible + .marca {
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--c, var(--brand)) 25%, transparent);
}

.trava {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--warn-bg); color: var(--warn); font-size: 10px;
}

.linha-admin { background: linear-gradient(90deg, rgba(201, 162, 39, .05), transparent 60%); }

.acoes-linha { white-space: nowrap; text-align: right; }
.acoes-linha .btn-linha { width: 28px; height: 28px; flex: 0 0 28px; font-size: 11px; }
.contador-linha { min-width: 26px; justify-content: center; }

@media (max-width: 640px) {
  .matriz-wrap { max-height: none; }
  .tabela.matriz .col-fixa { min-width: 170px; }
  .cab-empresa .nome-emp { display: none; }
  .col-empresa { min-width: 56px; }
}

/* ==========================================================================
   BADGES / ALERTAS / VAZIO
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
  background: var(--line-2); color: var(--txt-2);
}
.badge i { font-size: 9px; }
.badge.ok    { background: var(--ok-bg);   color: var(--ok); }
.badge.warn  { background: var(--warn-bg); color: var(--warn); }
.badge.err   { background: var(--err-bg);  color: var(--err); }
.badge.info  { background: var(--info-bg); color: var(--info); }
.badge.marca { background: var(--brand-50); color: var(--brand-700); }

.alerta {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 16px; border-radius: var(--r-sm);
  font-size: 13.5px; margin-bottom: 16px;
  border: 1px solid transparent;
}
.alerta i { margin-top: 2px; }
.alerta.sucesso { background: var(--ok-bg);   color: #14532d; border-color: #bbf7d0; }
.alerta.erro    { background: var(--err-bg);  color: #7f1d1d; border-color: #fecaca; }
.alerta.alerta2 { background: var(--warn-bg); color: #78350f; border-color: #fde68a; }
.alerta.info    { background: var(--info-bg); color: #1e3a8a; border-color: #c7d7fe; }
.alerta .fechar { margin-left: auto; background: none; border: 0; color: inherit; opacity: .5; cursor: pointer; padding: 0 2px; }
.alerta .fechar:hover { opacity: 1; }

.vazio { text-align: center; padding: 54px 24px; color: var(--txt-3); }
.vazio .ic {
  width: 62px; height: 62px; margin: 0 auto 16px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--line-2); color: #94a3b8; font-size: 23px;
}
.vazio h4 { font-size: 15.5px; color: var(--txt-2); margin-bottom: 5px; }
.vazio p  { margin: 0 0 18px; font-size: 13.5px; }

/* ==========================================================================
   UTILITARIOS
   ========================================================================== */
.w-full { width: 100%; }
.flex   { display: flex; }
.itens-centro { align-items: center; }
.entre  { justify-content: space-between; }
.gap-6  { gap: 6px; }  .gap-8 { gap: 8px; }  .gap-12 { gap: 12px; }  .gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; }  .mt-16 { margin-top: 16px; }  .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.texto-dir { text-align: right; }
.texto-mudo { color: var(--txt-3); }
.pequeno { font-size: 12.5px; }
.esconde-mob { display: initial; }

/* Overlay do menu mobile */
.overlay {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(11, 18, 32, .5);
  backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.overlay.aberto { opacity: 1; visibility: visible; }

/* Animacao de entrada */
@keyframes sobe { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.anima { animation: sobe .32s cubic-bezier(.4, 0, .2, 1) both; }

/* ==========================================================================
   RESPONSIVO
   ========================================================================== */
@media (max-width: 1100px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-mobile-brand { display: flex; }
  .login-form-wrap { min-height: 100vh; background: linear-gradient(160deg, #f8fafc 0%, #eef2f7 100%); }
  .login-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-xl); padding: 32px 28px; box-shadow: var(--sh-3);
    max-width: 430px;
  }
}

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--sh-4); }
  .sidebar.aberto { transform: none; }
  .main { margin-left: 0; }
  .tb-toggle { display: grid; }
  .tb-busca { display: none; }
  .conteudo { padding: 18px 16px; }
  .topbar { padding: 0 16px; }
  .linha-form > [class^="col-"] { grid-column: span 12; }
  .col-6.meio-mob, .col-4.meio-mob, .col-3.meio-mob { grid-column: span 6; }
}

@media (max-width: 640px) {
  body { font-size: 13.5px; }
  .grade-empresas { grid-template-columns: 1fr; }
  .grade-modulos  { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 22px; }
  .pg-head { align-items: stretch; }
  .pg-head .acoes { width: 100%; }
  .pg-head .acoes .btn { flex: 1; }
  .esconde-mob { display: none !important; }
  .tb-titulo h1 { font-size: 15.5px; }
  .card-body { padding: 16px; }
  .login-form-wrap { padding: 20px 14px; }
  .login-card { padding: 26px 20px; }
  .hero-mid h1 { font-size: 30px; }
}

@media (max-width: 400px) {
  .kpis { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .pg-head .acoes { display: none !important; }
  .main { margin-left: 0; }
  .card { box-shadow: none; border-color: #ccc; }
}
