* {
  box-sizing: border-box;
}

:root {
  --blue: #1e51a4;
  --blue-dark: #163f82;
  --blue-soft: #edf3fc;
  --text: #152235;
  --muted: #6b7788;
  --border: #dce3eb;
  --bg: #f4f7fa;
  --ok: #0f7a42;
  --pending: #c77800;
  --na: #707780;
  --danger: #b42318;
  --white: #ffffff;
  --shadow: 0 8px 28px rgba(0,0,0,.06);
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: white;
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  align-items: center;
}

.logo-panel {
  background: white;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
}

.bracell-logo {
  width: 138px;
  height: auto;
  display: block;
}

.topbar-copy {
  min-width: 0;
}

h1 {
  font-size: 24px;
  margin: 0 0 4px;
}

.subtitle {
  margin: 0;
  font-size: 14px;
  opacity: .85;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

h2 {
  font-size: 17px;
  margin: 0 0 4px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.section-title-row p,
.card > p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--text);
  background: white;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,84,166,.10);
}

.activity {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.activity:first-of-type {
  border-top: 0;
}

.activity-name {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 10px;
}

.activity-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0,1fr);
}

.status-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
}

.status-btn {
  border: 1px solid var(--border);
  background: white;
  border-radius: 11px;
  padding: 11px 8px;
  font-weight: 800;
  cursor: pointer;
}

.status-btn[data-status="OK"].active,
.status-btn[data-status="ATUALIZADO"].active {
  background: #e6f6ed;
  color: var(--ok);
  border-color: #9bd5b5;
}

.status-btn[data-status="PENDENTE"].active {
  background: #fff4df;
  color: var(--pending);
  border-color: #efc477;
}

.status-btn[data-status="N/A"].active {
  background: #f0f2f4;
  color: var(--na);
  border-color: #c8cdd3;
}

.warning-card {
  border-color: #f1c36b;
  background: #fffaf0;
}

.empty-state {
  font-size: 14px;
  color: var(--muted);
}

.pending-item,
.extra-item {
  padding: 11px 12px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--border);
  margin-top: 8px;
  font-size: 14px;
}

.pending-item {
  border-color: #f1c36b;
}

.extra-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.extra-item button {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 800;
  cursor: pointer;
}

.preview-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  background: #0d2238;
  color: #f7fbff;
  padding: 16px;
  border-radius: 14px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.actions {
  display: grid;
  gap: 10px;
  margin: 16px 0 28px;
}

button {
  min-height: 48px;
  border-radius: 12px;
  border: 0;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  background: var(--blue);
  color: white;
}

.success {
  background: #198754;
  color: white;
}

.secondary {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border: 1px solid #bed7ee;
}

.danger {
  background: white;
  color: var(--danger);
  border: 1px solid #e4b6b2;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: white;
  padding: 11px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  font-size: 13px;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 520px) {
  .app-shell { padding: 10px; }
  .topbar { border-radius: 18px; padding: 14px; flex-direction: column; align-items: stretch; gap: 12px; }
  .logo-panel { min-width: 0; }
  .bracell-logo { width: 160px; max-width: 70%; margin: 0 auto; }
  h1 { font-size: 21px; }
  .grid.two { grid-template-columns: 1fr; }
  .grid .full { grid-column: auto; }
  .card { border-radius: 16px; padding: 14px; }
  .status-btn { font-size: 13px; }
}


/* Otimizações de agilidade para uso em celular */
.card h2 { color: var(--blue-dark); }
select { cursor: pointer; min-height: 48px; }
.period-input { font-weight: 800; color: var(--blue-dark); background: #f8fbff; }
.status-btn { min-height: 50px; }
@media (max-width: 520px) {
  .status-group { gap: 6px; }
  .status-btn { min-height: 52px; padding: 10px 5px; }
}

.bracell-logo {
  display: block;
  width: min(230px, 62vw);
  height: auto;
  margin-bottom: 12px;
  background: white;
  border-radius: 10px;
  padding: 7px 12px;
}


.field-group {
  display: grid;
  gap: 7px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
}

.period-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.period-btn {
  min-height: 44px;
  padding: 9px 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--blue-dark);
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
}

.period-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(39,89,165,.10);
}

@media (max-width: 390px) {
  .period-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.turno-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.turno-btn {
  min-height: 46px;
  padding: 10px 8px;
  border: 1px solid var(--border);
  background: white;
  color: var(--blue-dark);
  border-radius: 11px;
  font-size: 14px;
  font-weight: 800;
}

.turno-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(39,89,165,.10);
}

@media (max-width: 390px) {
  .turno-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .turno-btn {
    font-size: 13px;
    padding: 9px 5px;
  }
}
