:root {
  --c-bg: #f6f7fb;
  --c-fg: #1e293b;
  --c-muted: #64748b;
  --c-card: #ffffff;
  --c-border: #e2e8f0;
  --c-primary: #16a34a;
  --c-primary-2: #15803d;
  --c-secondary: #0ea5e9;
  --c-danger: #dc2626;
  --c-warn: #d97706;
  --c-ok: #16a34a;
  --c-chip: #eef2ff;
  --c-chip-text: #4338ca;
  --c-top-bar: #1e293b;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
  --shadow-md: 0 8px 24px rgba(15,23,42,0.08);
}

/* ============= HEADER UNIMAUÁ (duas linhas) ============= */
.fm-unimaua { width: 100%; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.fm-unimaua-contacts {
  background: var(--c-top-bar); color: #f8fafc;
  padding: 8px 20px; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
  gap: 10px; font-size: 12px;
}
.fm-unimaua-contacts .infos { display:flex; flex-wrap:wrap; gap: 18px; align-items:center; }
.fm-unimaua-contacts .infos span i { color:#22c55e; margin-right:6px; }
.fm-unimaua-contacts .portais { display:flex; flex-wrap:wrap; gap: 10px; align-items:center; }
.fm-unimaua-contacts .portais a {
  color: #e2e8f0; text-decoration: none; padding: 4px 10px; border-radius: 999px;
  border: 1px solid #334155; transition: .15s;
}
.fm-unimaua-contacts .portais a:hover { background:#334155; color:#fff; }
.fm-unimaua-contacts .portais a.home { background:#16a34a; border-color:#16a34a; color:#fff; font-weight:600; }
.fm-unimaua-contacts .portais a.home:hover { background:#15803d; }

.fm-unimaua-main {
  background: linear-gradient(135deg, #16a34a 0%, #047857 55%, #0f766e 100%);
  color:#fff; padding: 14px 20px; display:flex; align-items:center; gap: 14px;
}
.fm-unimaua-main .logos { display:flex; align-items:center; gap: 12px; min-width:0; }
.fm-logo-maua {
  background:#fff; border-radius: 10px; padding: 6px 10px; display:flex; align-items:center; gap: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
}
.fm-logo-maua img { height: 68px; object-fit: contain; display:block; }
.fm-logo-finmed { display:flex; align-items:center; gap: 8px; }
.fm-logo-finmed .fm-sep { width: 1px; height: 68px; background:rgba(255,255,255,.3); }
.fm-logo-finmed h1 { font-size: 17px; margin:0; font-weight: 700; line-height: 1.15; color:#fff; }
.fm-logo-finmed h1 small { display:block; font-weight: 500; font-size: 12px; opacity:.9; margin-top:2px; }

.fm-unimaua-main .meio { flex:1; display:flex; align-items:center; justify-content:center; min-width:0; }
.fm-unimaua-main .usuario-acoes { display:flex; align-items:center; gap: 10px; }

/* Userchip antigo reaproveitado dentro de usuario-acoes */
.fm-userchip { margin:0; }
.fm-userchip .fm-btn-ghost { font-size:.85rem; }

/* ============= FOOTER UNIMAUÁ ============= */
.fm-footer-unimaua { margin-top: 28px; background:#fff; border-top: 2px solid #dcfce7; }
.fm-footer-main { max-width: 1440px; margin: 0 auto; padding: 18px 20px; display:flex; align-items:center; justify-content:space-between; gap: 14px; flex-wrap:wrap; }
.fm-footer-main img { height: 30px; object-fit: contain; }
.fm-footer-links { display:flex; flex-wrap:wrap; gap: 10px 18px; font-size: 12px; color: var(--c-muted); }
.fm-footer-links a { color: #1d4ed8; text-decoration: none; font-weight: 500; }
.fm-footer-links a:hover { text-decoration: underline; }
.fm-footer-bottom { background: #16a34a; color:#fff; padding: 10px 20px; text-align:center; font-size: 12px; }
.fm-footer-bottom p { margin:0; }

/* Responsivo header UniMauá */
@media (max-width: 720px) {
  .fm-unimaua-main .meio { display:none; }
  .fm-unimaua-contacts .portais a { font-size: 11px; padding: 3px 8px; }
  .fm-logo-maua img { height: 52px; }
  .fm-logo-finmed h1 { font-size: 14px; }
  .fm-logo-finmed .fm-sep { height: 52px; }
}

/* BOTÃO NOVO: Salvar rascunho (Etapa 3 Fiador — topo página) */
.fm-btn-save-rasc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 16px;
  border: 2px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.18s ease;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 2px 6px rgba(29,78,216,.06);
  font-family: inherit;
  text-decoration: none;
}
.fm-btn-save-rasc:hover { background:#dbeafe; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(29,78,216,.12); }
.fm-btn-save-rasc:active { transform: translateY(0); }
.fm-btn-save-rasc:disabled { opacity: .6; cursor: not-allowed; }
@media (max-width: 720px) {
  .fm-btn-save-rasc { font-size: 1.05rem; padding: 12px 16px; border-radius: 14px; }
}

.fm-stage-head > div:first-child { min-width: 0; flex: 1 1 auto; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--c-bg); color: var(--c-fg); font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--c-secondary); text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; line-height: 1.2; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; line-height: 1.5; }

.fm-hidden { display: none !important; }
.fm-muted { color: var(--c-muted); }
.fm-req { color: var(--c-danger); font-weight: 700; }

.fm-btn-primary, .fm-btn-secondary, .fm-btn-ghost, .fm-btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: .95rem;
  cursor: pointer; transition: transform .08s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.fm-btn-primary { background: var(--c-primary); color: #fff; }
.fm-btn-primary:hover { background: var(--c-primary-2); }
.fm-btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.fm-btn-secondary { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.fm-btn-secondary:hover { background: #dbeafe; }
.fm-btn-ghost { background: transparent; color: #334155; border-color: var(--c-border); }
.fm-btn-ghost:hover { background: #f1f5f9; }
.fm-btn-danger { background: #fee2e2; color: var(--c-danger); border-color: #fecaca; }
.fm-btn-danger:hover { background: #fecaca; }

.fm-card { background: var(--c-card); border-radius: var(--radius); box-shadow: var(--shadow-md); border: 1px solid var(--c-border); }

.fm-container { max-width: 1080px; margin: 0 auto; padding: 32px 20px; }

.fm-topbar {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, #15803d, #059669);
  color: #fff;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.fm-topbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.fm-brand { display: flex; align-items: baseline; gap: 10px; }
.fm-brand-accent { font-weight: 800; font-size: 1.25rem; letter-spacing: .04em; }
.fm-brand-sub { color: #d1fae5; font-size: .85rem; }
.fm-userchip {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.12); padding: 6px 6px 6px 14px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.fm-userchip span { font-size: .92rem; color: #ecfdf5; }
.fm-userchip .fm-btn-ghost { color: #ecfdf5; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.06); padding: 6px 12px; }
.fm-userchip .fm-btn-ghost:hover { background: rgba(255,255,255,.16); color: #fff; }

.fm-app { max-width: 1440px; margin: 0 auto; padding: 28px 20px 80px; }

/* Login */
.fm-auth-wrap { display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; }
.fm-auth-card { max-width: 460px; width: 100%; padding: 32px 28px; display: flex; flex-direction: column; gap: 18px; }
.fm-auth-head h1 { font-size: 1.5rem; margin-bottom: 8px; }
.fm-auth-card form { display: flex; flex-direction: column; gap: 14px; }
.fm-auth-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; }
.fm-auth-card input {
  padding: 12px 14px; border: 1px solid var(--c-border); border-radius: 10px; font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fm-auth-card input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 4px rgba(22,163,74,.14); }
.fm-footnote { font-size: .82rem; color: var(--c-muted); }

.fm-msg {
  padding: 10px 12px; border-radius: 10px; font-size: .92rem; border: 1px solid transparent;
}
.fm-msg.fm-err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.fm-msg.fm-ok  { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

/* Dashboard */
.fm-dash-wrap { display: flex; flex-direction: column; gap: 20px; }
.fm-dash-hero { padding: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.fm-dash-hero h1 { margin-bottom: 8px; }
.fm-dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.fm-progress-card { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.fm-progress-head { display: flex; align-items: baseline; justify-content: space-between; }
.fm-progress-pct { font-size: 1.3rem; font-weight: 800; color: var(--c-primary); }
.fm-progress-bar { width: 100%; height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.fm-progress-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .35s ease; border-radius: 999px; }

.fm-etapas {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr; gap: 8px;
}
.fm-dash-wrap .fm-etapas { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.fm-etapa {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--c-border); border-radius: 12px;
  background: #fafbff; cursor: pointer; transition: all .15s ease;
}
.fm-etapa:hover { background: #f1f5f9; border-color: #cbd5e1; }
.fm-etapa-idx {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: #e2e8f0; color: #475569; font-weight: 700; font-size: .9rem;
}
.fm-etapa-ok .fm-etapa-idx { background: #dcfce7; color: #166534; }
.fm-etapa-partial .fm-etapa-idx { background: #fef3c7; color: #92400e; }
.fm-etapa-active .fm-etapa-idx { background: var(--c-primary); color: #fff; }
.fm-etapa-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fm-etapa-title { font-weight: 600; font-size: .95rem; }
.fm-etapa-sub { color: var(--c-muted); font-size: .8rem; }

/* Inscrição shell */
.fm-insc-wrap {
  display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: flex-start;
}
.fm-sidebar {
  position: sticky; top: 90px;
  padding: 18px 16px; display: flex; flex-direction: column; gap: 16px;
}
.fm-sidebar-head h2 { font-size: 1.05rem; margin-bottom: 4px; }
.fm-sidebar-foot { margin-top: auto; }
.fm-etapas-side { gap: 6px; }

.fm-stage { display: flex; flex-direction: column; gap: 16px; }
.fm-stage-head {
  padding: 18px 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.fm-etapa-chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--c-chip); color: var(--c-chip-text); font-size: .78rem; font-weight: 600; margin-bottom: 8px;
}
.fm-stage-head h1 { margin-bottom: 4px; }
.fm-stage-nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.fm-stage-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }

/* Doc card */
.fm-doccard { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.fm-doccard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fm-doc-nome { display: flex; align-items: baseline; gap: 6px; font-size: 1.02rem; }
.fm-doc-desc { font-size: .86rem; margin-top: 4px; }
.fm-doc-rules { font-size: .82rem; margin-top: 6px; }
.fm-doc-status { flex: 0 0 auto; }

.fm-status {
  display: inline-block; padding: 6px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; letter-spacing: .01em;
}
.fm-status-none { background: #f1f5f9; color: #475569; }
.fm-status-ok { background: #dcfce7; color: #166534; }
.fm-status-warn { background: #fef3c7; color: #92400e; }
.fm-status-err { background: #fee2e2; color: #991b1b; }

.fm-dropzone {
  display: block; width: 100%; border: 2px dashed #cbd5e1; border-radius: 14px;
  padding: 20px 16px; cursor: pointer; background: #f8fafc; transition: all .15s ease;
}
.fm-dropzone:hover, .fm-dropzone.fm-drag { background: #eff6ff; border-color: #60a5fa; }
.fm-dropzone-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; pointer-events: none; }
.fm-drop-ico {
  width: 44px; height: 44px; border-radius: 50%; background: #dcfce7; color: #166534;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700;
}
.fm-drop-title { font-weight: 600; }
.fm-drop-sub { font-size: .82rem; }

.fm-doccard-preview { display: flex; flex-direction: column; gap: 12px; }
.fm-doccard-info {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--c-border);
}
.fm-docfile-nome { font-weight: 600; font-size: .95rem; word-break: break-word; }
.fm-docfile-meta { font-size: .82rem; margin-top: 4px; }
.fm-docfile-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.fm-doc-msg { padding: 10px 12px; border-radius: 10px; font-size: .9rem; border: 1px solid transparent; }
.fm-doc-msg.fm-err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.fm-doc-msg.fm-ok  { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.fm-doc-msg.fm-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.fm-loader {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #bbf7d0; border-top-color: var(--c-primary); animation: fmspin .8s linear infinite; vertical-align: middle; margin-right: 8px;
}
@keyframes fmspin { to { transform: rotate(360deg); } }

/* Responsivo */
@media (max-width: 960px) {
  .fm-insc-wrap { grid-template-columns: 1fr; }
  .fm-sidebar { position: static; }
  .fm-stage-head { padding: 18px; }
  .fm-stage-head h1 { font-size: 1.35rem; }
}
@media (max-width: 520px) {
  .fm-auth-card { padding: 22px 18px; }
  .fm-dash-hero, .fm-progress-card { padding: 18px; }
  .fm-stage-body { grid-template-columns: 1fr; }
  .fm-docfile-actions .fm-btn-secondary,
  .fm-docfile-actions .fm-btn-ghost,
  .fm-docfile-actions .fm-btn-danger { padding: 8px 10px; font-size: .85rem; }
  .fm-userchip { padding: 6px; }
  .fm-userchip span { display: none; }
}
