:root {
  --brand: #a9571d;
  --brand-dark: #8a4515;
  --brand-soft: #fbf3ec;
  --blue: #2164d9;
  --blue-dark: #1a51b3;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --control: #d1d5db;
  --bg: #f3f4f6;
  --card: #ffffff;
  --danger-bg: #fef2f2;
  --danger: #b42318;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; min-height: 100vh; }
a { color: var(--blue); }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 8px 0; }
.muted { color: var(--muted); margin: 0 0 24px; }

/* Barra superior en el marrón de la marca, como el menú de la App Proyectos */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--brand); color: #fff; padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { border-radius: 50%; background: #fff; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand small { font-size: 11px; letter-spacing: .12em; opacity: .85; }
.userbox { display: flex; align-items: center; gap: 12px; margin: 0; }
.who { font-size: 14px; opacity: .95; }
.btn-link { background: none; border: 1px solid rgba(255,255,255,.6); color: #fff; border-radius: 4px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.btn-link:hover { background: rgba(255,255,255,.12); }

main { padding: 28px 16px 48px; }

/* Inicio: botones con imagen */
.home { max-width: 760px; margin: 0 auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.tile {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px 20px 26px; text-decoration: none; color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tile:hover, .tile:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.08); border-color: var(--brand); outline: none; }
.tile img { width: 100%; max-width: 220px; height: auto; margin-bottom: 8px; }
.tile-title { font-size: 20px; font-weight: 700; }
.tile-sub { font-size: 14px; color: var(--muted); }

/* Páginas interiores */
.narrow { max-width: 620px; margin: 0 auto; }
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; margin-top: 16px; }
.card-img { display: block; margin: 0 auto 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px;
  background: var(--blue); color: #fff; border: 0; border-radius: 4px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--blue-dark); }

/* Inicio de sesión */
body.bare { display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--brand-soft), var(--bg)); }
body.bare main { padding: 0; width: 100%; }
.login-wrap { width: 100%; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login-brand strong { display: block; font-size: 22px; font-weight: 600; }
.login-brand b { color: var(--brand); }
.login-brand small { color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.stack input { height: 42px; padding: 0 12px; border: 1px solid var(--control); border-radius: 4px; font: inherit; font-weight: 400; }
.stack input:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.stack .btn { min-height: 44px; margin-top: 4px; }
.alert { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.login-foot { color: var(--muted); font-size: 13px; text-align: center; margin: 18px 0 0; }

@media (max-width: 480px) {
  h1 { font-size: 22px; }
  .who { display: none; }
  .tile { padding: 18px 14px 20px; }
}
