:root {
  --kaju: #e85d04;
  --kaju-dark: #c44d00;
  --nexum: #1a2744;
  --bg: #f0f2f6;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #6c757d;
  --danger: #c1121f;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: linear-gradient(165deg, #fff8f3 0%, var(--bg) 45%, #e8edf5 100%);
  color: var(--text);
  min-height: 100dvh;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 20px 16px 32px;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

.login-shell { padding-top: 12px; }

.login-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}

.login-logos img {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.login-logos .sep {
  width: 1px;
  height: 36px;
  background: #d1d5db;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: 0 8px 32px rgba(26, 39, 68, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-card h1 {
  font-size: 1.35rem;
  margin: 0 0 6px;
  color: var(--nexum);
}

.login-card .lead {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.card-click { cursor: pointer; }

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 { font-size: 1.25rem; margin: 0 0 8px; }
p { margin: 0 0 8px; line-height: 1.45; }
.muted { color: var(--muted); font-size: 0.9rem; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--nexum);
}

input, textarea {
  width: 100%;
  padding: 14px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
  margin-bottom: 14px;
  background: #fafbfc;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--kaju);
  box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.15);
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}

.btn-inline {
  width: auto;
  padding: 8px 14px;
  min-height: 40px;
  margin: 0;
}

.btn-tab { flex: 1; font-size: 0.9rem; padding: 10px; min-height: 42px; }

.btn-back { margin-bottom: 12px; }

.btn-primary {
  background: linear-gradient(180deg, var(--kaju) 0%, var(--kaju-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(232, 93, 4, 0.35);
}

.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: #e9ecef;
  color: var(--text);
  margin-top: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--kaju); }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #fff3cd;
  color: #856404;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--nexum);
  margin-bottom: 10px;
}

.field-list { display: flex; flex-direction: column; gap: 10px; }

.field-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--nexum);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-value {
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-word;
}

.field-value--multilinha {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.thumb-grid--compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
  aspect-ratio: 1;
  cursor: pointer;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 13px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.lightbox-loading {
  color: #fff;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.alert-error { background: #fde8e8; color: var(--danger); }

.file-input-row {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  align-items: stretch;
}

.file-input-row .file-input {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}

.file-input-row .btn-secondary {
  margin-top: 0;
}

.file-input {
  position: relative;
  display: block;
  margin: 12px 0;
}

.file-input input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-input .btn-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  pointer-events: none;
}

.upload-hint {
  margin: 8px 0 0;
  font-size: 0.88rem;
}

.upload-progress {
  margin: 8px 0 0;
  font-size: 0.88rem;
}

.thumb-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ececec 25%, #f6f6f6 50%, #ececec 75%);
  background-size: 200% 100%;
  animation: thumb-shimmer 1.2s infinite;
}

@keyframes thumb-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-header .brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header .brand-mini img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

#blazor-error-ui {
  color-scheme: light only;
  background: lightyellow;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.loading-progress {
  position: relative;
  display: block;
  width: 8rem;
  height: 8rem;
  margin: 20vh auto 1rem auto;
}

.loading-progress circle {
  fill: none;
  stroke: #e0e0e0;
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--kaju);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
  position: absolute;
  text-align: center;
  font-weight: bold;
  inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
  content: var(--blazor-load-percentage-text, "Carregando");
}
