*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f4f7fb;
  color: #1f2937;
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.container-wide {
  max-width: 1440px;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 2rem;
}

h1,
h2 {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: -0.5rem 0 1rem;
  font-weight: 500;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
}

button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

.error {
  color: #b91c1c;
  margin-top: 0.5rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.panel {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.muted {
  color: #64748b;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.tab {
  background: #e2e8f0;
  color: #334155;
}

.tab.active {
  background: #2563eb;
  color: #fff;
}

.tab-panel {
  margin-top: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.stack label {
  margin-top: 0.5rem;
}

textarea,
select {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.button-link {
  display: inline-block;
  background: #e2e8f0;
  color: #1e293b;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
}

.button-link:hover {
  background: #cbd5e1;
}

.list {
  margin-top: 1rem;
}

.list-scroll-box {
  max-height: min(420px, 55vh);
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 0.5rem;
}

.list-scroll-box .list {
  margin-top: 0;
}

.list-scroll-box .list-item:last-child {
  margin-bottom: 0;
}

.list-scroll-box-tall {
  max-height: min(560px, 65vh);
}

.summary-card-button {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.summary-card-button:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.summary-card-button.summary-card-active {
  background: #dbeafe;
  border-color: #60a5fa;
}

.pendencia-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.pendencia-meta {
  font-size: 0.9rem;
}

.pendencia-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}

.btn-small-link {
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}

.tag-status-aberta {
  background: #fef3c7;
  color: #92400e;
}

.tag-status-resolvida {
  background: #dcfce7;
  color: #166534;
}

.tag-status-ignorada {
  background: #e2e8f0;
  color: #475569;
}

.list-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8fafc;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
  padding: 0.85rem 1rem;
}

.list-item:hover {
  background: #eff6ff;
}

.list-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: #f8fafc;
}

.list-card h3 {
  margin-bottom: 0.5rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.inline-form input,
.inline-form select {
  margin-bottom: 0;
  width: auto;
  min-width: 140px;
}

.tag {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.85rem;
}

.btn-small {
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

.success {
  color: #15803d;
}

pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
}

ul {
  padding-left: 1.2rem;
}

li {
  margin-bottom: 0.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  border: 1px solid #e2e8f0;
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f1f5f9;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.fechamento-table .col-producao {
  white-space: nowrap;
  font-size: 0.85rem;
}

.filters-bar {
  margin: 1rem 0;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filters-bar label {
  margin: 0;
}

.filters-bar select,
.filters-bar input {
  margin-bottom: 0;
  width: auto;
}

.btn-secondary {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.row-clickable {
  cursor: pointer;
}

.row-clickable:hover {
  background: #eff6ff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.summary-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.summary-grid strong {
  font-size: 1.05rem;
}

.row-excluido {
  opacity: 0.72;
  background: #fef2f2;
}

.plantao-detalhe h4 {
  margin: 1.25rem 0 0.5rem;
}

.override-panel {
  margin-bottom: 1.5rem;
  background: #fff;
}

@media print {
  body {
    background: #fff;
  }

  .header .actions,
  #logout-btn,
  .inline-form,
  #medico-conta,
  #btn-carregar-fechamento,
  #btn-exportar-fechamento,
  #btn-imprimir-fechamento,
  .btn-small {
    display: none !important;
  }

  .container,
  .card,
  .panel {
    box-shadow: none;
    border: none;
  }
}
