:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --primary: #1f5fd6;
  --primary-dark: #174db0;
  --soft-blue: #eef5ff;
  --green: #0f8a5f;
  --orange: #f97316;
  --purple: #7c3aed;
  --red: #d92d20;
  --shadow: 0 14px 36px rgba(16, 24, 40, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--line);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #2f80ed, #0f8a5f);
  font-weight: 900;
  font-size: 26px;
}

.brand-logo-mark {
  width: 56px;
  height: 56px;
  border-radius: 0;
  display: block;
  object-fit: contain;
  object-position: center;
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.15;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav a, .nav button {
  border: 0;
  background: transparent;
  color: #344054;
  padding: 12px 14px;
  border-radius: 12px;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
}

.nav a.active, .nav button.active {
  background: var(--soft-blue);
  color: var(--primary);
  font-weight: 800;
}

.user-box {
  margin-top: auto;
  padding: 18px 10px 0;
  border-top: 1px solid var(--line);
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
  background: transparent;
}

.user-box strong {
  display: block;
  font-size: 14px;
  color: #142958;
}

.user-box span {
  display: block;
  margin-top: 2px;
  color: #536789;
  font-size: 13px;
  font-weight: 600;
}

.online {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.main {
  padding: 28px;
}

.topbar {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-weight: 700;
  font-size: 14px;
}

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

.card-pad { padding: 22px; }

.card-title {
  margin: 0 0 16px;
  font-size: 18px;
  letter-spacing: -0.02em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.link {
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric {
  padding: 24px;
  min-height: 132px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.metric-icon {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 26px;
}

.metric h3 {
  margin: 0;
  color: #344054;
  font-size: 15px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.metric span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.blue { color: var(--primary); background: #eaf2ff; }
.orange { color: var(--orange); background: #fff3e7; }
.purple { color: var(--purple); background: #f2edff; }
.green { color: var(--green); background: #e9f8f1; }
.red { color: var(--red); background: #fff0f0; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
  gap: 18px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  color: #475467;
  font-size: 13px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 13px 8px;
  border-bottom: 1px solid #edf1f7;
  font-size: 14px;
  vertical-align: middle;
}

.table small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-pendente { background: #fff3e7; color: #b54708; }
.badge-andamento { background: #eaf2ff; color: var(--primary); }
.badge-retorno { background: #f2edff; color: var(--purple); }
.badge-finalizada { background: #e9f8f1; color: var(--green); }
.badge-atraso { background: #fff0f0; color: var(--red); }

.alert-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #fbfdff;
  border: 1px solid #edf1f7;
  margin-bottom: 10px;
}

.alert-icon {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.alert-row strong {
  display: block;
  font-size: 14px;
}

.alert-row span {
  color: var(--muted);
  font-size: 13px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: center;
}

.donut {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(
    var(--primary) 0 var(--andamento),
    var(--orange) var(--andamento) var(--pendentes),
    var(--purple) var(--pendentes) var(--retorno),
    var(--green) var(--retorno) 100%
  );
  position: relative;
}

.donut::after {
  content: attr(data-total) "\A Total";
  white-space: pre;
  position: absolute;
  inset: 34px;
  background: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.legend-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #344054;
  font-size: 14px;
}

.legend-row i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #eaf2ff, transparent 35%), var(--bg);
}

.login-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 32px;
}

.login-card h1 {
  margin: 18px 0 8px;
  font-size: 28px;
}

.login-card p {
  color: var(--muted);
  margin-bottom: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 16px;
}

.form-full { grid-column: 1 / -1; }

label {
  display: block;
  font-weight: 800;
  font-size: 14px;
  color: #263244;
  margin-bottom: 7px;
}

.required::after {
  content: " *";
  color: var(--red);
}


.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #cfd8e6;
  border-radius: 11px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  outline: none;
  min-height: 45px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 95, 214, 0.12);
}

textarea {
  resize: vertical;
  min-height: 82px;
  line-height: 1.4;
}

input:disabled, select:disabled, textarea:disabled {
  background: #f2f4f7;
  color: #98a2b3;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: #fff;
  color: #344054;
  border: 1px solid #cfd8e6;
}

.btn-danger {
  background: #fff0f0;
  color: var(--red);
  border: 1px solid #ffd0d0;
}

.actions {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.notice {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid #bad7ff;
  background: #f0f7ff;
  color: #18427a;
  border-radius: 13px;
  font-size: 14px;
}

.login-info {
  min-height: 45px;
  border: 1px solid #cfd8e6;
  border-radius: 11px;
  padding: 10px 13px;
  background: #f8fbff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-info strong {
  font-size: 14px;
  color: #172033;
  line-height: 1.2;
}

.login-info span {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.radio-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cfd8e6;
  border-radius: 999px;
  padding: 10px 13px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
}

.choice input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.checkbox-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid #cfd8e6;
  background: #fbfdff;
  border-radius: 13px;
}

.checkbox-box input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.checkbox-box strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.checkbox-box span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.section {
  margin-bottom: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #101828;
  font-size: 15px;
  font-weight: 900;
  margin: 0 0 14px;
}

.section-title span {
  width: 25px;
  height: 25px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--soft-blue);
  color: var(--primary);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  background: #101828;
  color: #fff;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  font-size: 14px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; }
  .actions { flex-direction: column-reverse; }
  .btn { width: 100%; }
}


.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 999px;
  margin-right: 8px;
  background: #98a2b3;
}

.status-dot.online { background: var(--green); }
.status-dot.offline { background: #98a2b3; }

.form-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 40;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 24px;
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

.chip-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  background: #f2f4f7;
  color: #344054;
  border: 1px solid #e4e7ec;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}

@media print {
  .sidebar, .topbar, .toolbar, .btn, .nav, .user-box {
    display: none !important;
  }
  .app {
    display: block !important;
  }
  .main {
    padding: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 0 !important;
  }
}

/* Painel unificado de usuários */
.users-dashboard-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  margin-bottom: 22px;
}

.permission-list {
  display: grid;
  gap: 12px;
}

.permission-item {
  border: 1px solid #edf1f7;
  background: #fbfdff;
  border-radius: 14px;
  padding: 13px 14px;
}

.permission-item strong {
  display: block;
  font-size: 14px;
  color: #172033;
  margin-bottom: 4px;
}

.permission-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.users-list-card {
  margin-top: 22px;
}

.users-card-title {
  align-items: flex-start;
  gap: 16px;
}

.users-filter-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px 180px;
  gap: 10px;
  width: min(760px, 100%);
}

.users-filter-row input,
.users-filter-row select {
  min-height: 40px;
  padding: 9px 11px;
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-wrap .table {
  min-width: 980px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

@media (max-width: 1120px) {
  .users-dashboard-grid { grid-template-columns: 1fr; }
  .users-card-title { flex-direction: column; }
  .users-filter-row { width: 100%; }
}

@media (max-width: 700px) {
  .users-filter-row { grid-template-columns: 1fr; }
}


/* Menu lateral padronizado - Interconsultas / Pendências */
.nav a, .nav button {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  font-weight: 850;
  color: #1f314f;
}
.nav a svg, .nav button svg {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  stroke: #315e8e;
}
.nav a.active svg, .nav button.active svg {
  stroke: var(--primary);
}
.nav-divider {
  height: 1px;
  background: var(--line);
  margin: 10px 8px;
}


/* Ajuste global: exibir somente um ponto verde no status Online do menu lateral */
.user-box .online .dot{display:none!important;}
.user-box .online::before{content:"";width:8px;height:8px;border-radius:999px;background:var(--green,#22c55e);display:inline-block;flex:0 0 8px;}
