/* Base compartilhada: tokens, reset e componentes comuns */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-secondary: #344054;
  --text-muted: #667085;

  --primary: #1e3a8a;
  --primary-hover: #172e6e;
  --primary-soft: #eef2fb;

  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --neutral-soft: #f2f4f7;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(16, 24, 40, 0.12), 0 4px 8px -2px rgba(16, 24, 40, 0.05);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-muted); color: var(--text); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

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

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #fda29b; }

.btn-sm { height: 32px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; height: 44px; font-size: 14px; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
}

/* Campos */
.field { margin-bottom: 16px; text-align: left; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.input, .select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #98a2b3; }
.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}
.input[readonly] { background: var(--surface-muted); }
.select { cursor: pointer; padding-right: 32px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-muted); }

/* Alertas */
.alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}
.alert-error { background: var(--danger-soft); border-color: #fecdca; color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: #abefc6; color: var(--success); }

/* Notificações */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  max-width: calc(100vw - 40px);
}
.toast {
  min-width: 280px;
  max-width: 420px;
  padding: 12px 14px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  white-space: pre-line;
  word-break: break-word;
  animation: toast-in 0.2s ease-out;
}
.toast-error { background: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
