:root {
  --brand: #0a5a8a;
  --brand-dark: #07476e;
  --accent: #e8740c;
  --accent-dark: #c96206;
  --page: #eceff2;
  --white: #ffffff;
  --ink: #222a31;
  --muted: #5c6670;
  --line: #cfd6dd;
  --notice: #fff6d6;
  --error: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Source Sans 3", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cabecera */
.site-header { background: var(--brand); color: #fff; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-size: 23px; font-weight: 700; letter-spacing: -0.3px; }
.logo:hover { color: #fff; }
.logo svg { display: block; }
.logo small { font-weight: 400; opacity: 0.75; }
.site-header nav a { color: #fff; text-decoration: none; font-size: 15px; margin-left: 22px; }
.site-header nav a:hover { text-decoration: underline; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

.notice { background: var(--notice); border-bottom: 1px solid #ecdca0; font-size: 14px; }
.notice .wrap { padding-top: 8px; padding-bottom: 8px; }

main { flex: 1; padding: 32px 0 48px; }

/* Portada */
.home { display: grid; grid-template-columns: 340px 1fr; gap: 40px; align-items: start; }
.intro h1 { font-size: 30px; font-weight: 600; line-height: 1.15; margin: 4px 0 10px; }
.intro p { margin: 0 0 22px; color: var(--muted); max-width: 54ch; }

/* Caja de formulario */
.box { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 24px; }
.box h2 { font-size: 21px; font-weight: 600; margin: 0 0 16px; }
.box .lead { margin: -8px 0 18px; color: var(--muted); font-size: 15px; }
.box-foot { border-top: 1px solid var(--line); margin: 20px -24px -24px; padding: 14px 24px; background: #f7f8fa; font-size: 15px; }

.page-title { font-size: 26px; font-weight: 600; margin: 0 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 20px; }
.narrow { max-width: 600px; }
.narrower { max-width: 420px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.field input, .field select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #a9b4be;
  border-radius: 3px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 3px; }
.field.has-error input { border-color: var(--error); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.date { display: grid; grid-template-columns: 70px 1fr 90px; gap: 8px; }

.addr { display: flex; align-items: center; }
.addr input { border-radius: 3px 0 0 3px; }
.addr span { height: 40px; line-height: 38px; padding: 0 10px; border: 1px solid #a9b4be; border-left: 0; border-radius: 0 3px 3px 0; background: #f2f4f6; color: var(--muted); white-space: nowrap; }

.check { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; margin: 4px 0 16px; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px;
  font: inherit; font-weight: 600;
  color: #fff; background: var(--accent);
  border: 0; border-radius: 3px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn:disabled { opacity: 0.75; cursor: progress; }
.btn.block { width: 100%; }
.btn.plain { background: #fff; color: var(--ink); border: 1px solid #a9b4be; }
.btn.plain:hover { background: #f2f4f6; color: var(--ink); }

.links { margin-top: 12px; font-size: 15px; }

.msg { display: none; padding: 10px 12px; margin-bottom: 16px; font-size: 15px; border-left: 4px solid; background: #fdf0ef; border-color: var(--error); color: #6d1712; }
.msg.show { display: block; }
.msg.ok { background: #eef6fb; border-color: var(--brand); color: var(--brand-dark); }

.spinner { display: none; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Captura simulada de la bandeja */
.mock { background: #fff; border: 1px solid #b9c3cc; border-radius: 6px; overflow: hidden; box-shadow: 0 12px 28px -14px rgba(10, 40, 70, .45); font-size: 13px; user-select: none; }
.mock-bar { display: flex; align-items: center; gap: 10px; background: var(--brand); color: #fff; padding: 7px 12px; }
.mock-bar b { font-size: 14px; }
.mock-search { flex: 1; background: rgba(255,255,255,.18); border-radius: 3px; padding: 3px 8px; color: rgba(255,255,255,.8); }
.mock-body { display: grid; grid-template-columns: 130px 1fr; }
.mock-side { background: #f4f6f8; border-right: 1px solid #e1e6ea; padding: 10px 0; }
.mock-side .compose { display: block; margin: 0 10px 10px; background: var(--accent); color: #fff; text-align: center; border-radius: 3px; padding: 4px 0; font-weight: 600; }
.mock-side div { padding: 4px 12px; color: var(--muted); display: flex; justify-content: space-between; }
.mock-side .on { background: #dde8f1; color: var(--brand-dark); font-weight: 600; }
.mock-list div { display: grid; grid-template-columns: 120px 1fr 44px; gap: 10px; padding: 7px 12px; border-bottom: 1px solid #edf0f2; color: var(--muted); }
.mock-list div span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-list div span:last-child { text-align: right; }
.mock-list .new { color: var(--ink); font-weight: 600; }

.facts { margin: 18px 0 0; padding: 0 0 0 18px; color: var(--muted); font-size: 15px; }
.facts li { margin-bottom: 4px; }

/* Ayuda */
.help h2 { font-size: 19px; font-weight: 600; margin: 26px 0 6px; }
.help h2:first-of-type { margin-top: 0; }
.help p { margin: 0 0 10px; max-width: 70ch; }
.help table { border-collapse: collapse; font-size: 15px; margin: 6px 0 12px; }
.help th, .help td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; }
.help th { background: #f2f4f6; font-weight: 600; }

/* Pie */
.site-footer { border-top: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding-top: 16px; padding-bottom: 16px; }
.site-footer nav a { color: var(--muted); margin-right: 16px; }

/* Consentimiento de cookies */
#cookie-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.08); font-size: 15px; }
#cookie-bar .wrap { padding-top: 16px; padding-bottom: 16px; }
#cookie-bar h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
#cookie-bar p { margin: 0 0 12px; color: var(--muted); max-width: 80ch; }
#cookie-bar .actions { display: flex; flex-wrap: wrap; gap: 8px; }
#cookie-bar .prefs { display: none; margin: 0 0 12px; padding: 0; list-style: none; }
#cookie-bar.open .prefs { display: block; }
#cookie-bar .prefs li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid #edf0f2; }
#cookie-bar .prefs small { color: var(--muted); display: block; }

@media (max-width: 800px) {
  .home { grid-template-columns: 1fr; }
  .mock-body { grid-template-columns: 1fr; }
  .mock-side { display: none; }
  .mock-list div { grid-template-columns: 95px 1fr 40px; }
  .row { grid-template-columns: 1fr; }
  .site-header nav a:first-child { display: none; }
  #cookie-bar .actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
