@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Paleta azul (SaaS clean) */
  --bg: #EEF2FB;
  --panel: #FFFFFF;
  --panel2: #F1F5FB;
  --line: #E3E8F2;
  --txt: #0F1B33;
  --muted: #64748B;
  --accent: #2A4BD4;        /* azul royal — botões/ativos */
  --accent-hover: #1E39AC;
  --navy: #1E3A8A;          /* navy — marca */
  --danger: #EF4444;
  --danger-bg: #FEE2E2;
  --warn-bg: #FEF3C7;
  --warn-txt: #92400E;
  --warn-border: #FCD34D;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 33, 80, 0.08), 0 1px 2px rgba(16, 33, 80, 0.06);
  --shadow-lg: 0 10px 25px -5px rgba(16, 33, 80, 0.12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--txt); font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { color: var(--accent-hover); }
.hidden { display: none !important; }
.container { max-width: 1000px; margin: 0 auto; padding: 20px; }

/* Header */
header.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16, 33, 80, 0.05); position: sticky; top: 0; z-index: 20;
}
header.topbar h1 { font-size: 18px; margin: 0; flex: 1; display: flex; align-items: center; gap: 8px; }
header.topbar .who { color: var(--muted); font-size: 13px; font-weight: 500; text-align: right; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; margin-bottom: 6px; color: var(--navy); }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 8px; background: var(--navy); color: #fff; font-weight: 800; font-size: 17px;
}
.role-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: #E0EAFF; color: var(--accent); border: 1px solid #C7D6FF; margin-left: 6px; }

/* Tabs (desktop = pílulas no topo) */
nav.tabs { display: flex; gap: 8px; margin: 0 0 20px; flex-wrap: wrap; }
nav.tabs button {
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px;
  transition: all .18s; display: flex; align-items: center; gap: 8px; font-family: inherit;
}
nav.tabs button .tab-ico { font-size: 16px; line-height: 1; }
nav.tabs button:hover { background: var(--panel2); color: var(--txt); }
nav.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 14px -4px rgba(42, 75, 212, .4); }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 16px; font-size: 17px; font-weight: 700; }
.card h3 { margin: 22px 0 12px; font-size: 14px; color: var(--txt); border-bottom: 1px solid var(--line); padding-bottom: 8px; }

/* Formulários */
label { display: block; font-size: 13px; font-weight: 600; color: var(--txt); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; background: #fff; color: var(--txt); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; font-size: 15px; transition: all .15s; font-family: inherit;
}
input::placeholder { color: #94A3B8; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(42, 75, 212, .15); }
input[disabled] { background: var(--panel2); color: var(--muted); cursor: not-allowed; }
input.input-erro { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(239, 68, 68, .12) !important; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }

/* Botões */
button.btn {
  background: var(--accent); color: #fff; border: 1px solid var(--accent); padding: 11px 20px;
  border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 14px; transition: all .18s; font-family: inherit;
}
button.btn:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.btn.secondary { background: #fff; color: var(--accent); border: 1px solid #C7D6FF; }
button.btn.secondary:hover { background: var(--panel2); }
button.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); padding: 7px 12px; font-size: 13px; }
button.btn.danger:hover { background: var(--danger-bg); }
button.btn.mini { padding: 5px 10px; font-size: 12px; background: #E0EAFF; color: var(--accent); border: 1px solid #C7D6FF; }
button.btn.mini:hover:not(:disabled) { background: #C7D6FF; }
button.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.actions { display: flex; gap: 12px; margin-top: 18px; align-items: center; flex-wrap: wrap; }

/* Tabelas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: #F7F9FD; }
tr:hover td { background: var(--panel2); }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.saude { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFD5FF; }
.badge.trab { background: #E0F2FE; color: #0369A1; border: 1px solid #BAE6FD; }
.badge.desp { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }

/* Mensagens */
.msg { padding: 12px 14px; border-radius: 10px; margin: 12px 0; font-size: 14px; font-weight: 500; }
.msg.err { background: var(--danger-bg); color: #991B1B; border: 1px solid #FECACA; }
.msg.ok { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.msg.warn { background: var(--warn-bg); color: var(--warn-txt); border: 1px solid var(--warn-border); }

pre.preview { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; font-size: 13px; white-space: pre; font-family: 'Courier New', monospace; }
ol.steps { line-height: 1.8; padding-left: 22px; }
ol.steps li { margin-bottom: 8px; }

/* Auth */
.center-screen { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { width: 400px; max-width: 100%; padding: 30px 26px; border-radius: 16px; box-shadow: var(--shadow-lg); }
.switch-auth { text-align: center; margin-top: 22px; font-size: 14px; color: var(--muted); }
.switch-auth a { cursor: pointer; }

/* ============ MOBILE: barra de abas fixa embaixo (estilo app) ============ */
@media (max-width: 680px) {
  .container { padding: 14px 14px 84px; }         /* espaço p/ a bottom bar */
  header.topbar { padding: 12px 14px; }
  header.topbar h1 { font-size: 16px; }
  header.topbar .who { font-size: 11px; }
  .row, .row3 { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 16px; border-radius: 14px; }

  nav.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 2px;
    box-shadow: 0 -4px 16px rgba(16, 33, 80, .08); flex-wrap: nowrap; justify-content: space-around;
  }
  nav.tabs button {
    flex: 1; flex-direction: column; gap: 3px; border: none; background: transparent;
    padding: 6px 2px; border-radius: 10px; font-size: 10px; font-weight: 600; color: var(--muted); min-width: 0;
  }
  nav.tabs button .tab-ico { font-size: 20px; }
  nav.tabs button .tab-lbl { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  nav.tabs button:hover { background: transparent; }
  nav.tabs button.active { background: transparent; color: var(--accent); box-shadow: none; }
  nav.tabs button.active .tab-ico { transform: translateY(-1px); }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button.btn { width: 100%; }
  button.btn { padding: 13px 20px; }              /* alvos de toque maiores */
  input, select, textarea { font-size: 16px; }    /* evita zoom no iOS */
}
