:root {
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --text: #1a2530;
  --text-muted: #5b6b7a;
  --border: #dde3e8;
  --primary: #009ee3; /* Mercado Pago blue-ish, fits the domain */
  --primary-dark: #0080b8;
  --success: #1f9d55;
  --success-bg: #e8f8ee;
  --warning: #b8860b;
  --warning-bg: #fdf3e0;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Auth pages (login/register) */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.auth-card h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

.auth-card .subtitle {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
  display: block;
}

form { display: flex; flex-direction: column; gap: 1rem; }

label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  display: block;
}

input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 158, 227, 0.15);
}

button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s;
}

button:hover, .btn:hover { background: var(--primary-dark); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.field-row { display: flex; gap: 0.75rem; }
.field-row > div { flex: 1; }

.hint { font-size: 0.8rem; color: var(--text-muted); margin-top: -0.5rem; }

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  display: none;
}
.form-error.visible { display: block; }

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* App shell (dashboard/onboarding) */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
}

.sidebar .brand { padding: 0 0.5rem; }

.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 1rem; flex: 1; }

.sidebar nav a {
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}
.sidebar nav a:hover { background: var(--bg); text-decoration: none; }
.sidebar nav a.active { background: rgba(0, 158, 227, 0.1); color: var(--primary); }

.sidebar .tenant-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
  margin-top: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 780px;
}

.main h1 { margin-top: 0; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.status-badge.connected { background: var(--success-bg); color: var(--success); }
.status-badge.disconnected { background: var(--warning-bg); color: var(--warning); }

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

@media (max-width: 640px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; align-items: center; padding: 1rem; }
  .sidebar nav { flex-direction: row; margin-top: 0; }
  .sidebar .tenant-name { display: none; }
  .main { padding: 1.5rem; }
}
