/* Portal de clientes SAEM — ajusta aquí los colores corporativos */
:root {
  --brand: #16324f;
  --brand-2: #23527c;
  --accent: #c8a24a;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #5b6875;
  --line: #e1e6eb;
  --error: #b42318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
  min-height: 100vh; display: flex; flex-direction: column;
}
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }
main.wrap { flex: 1; padding-top: 40px; padding-bottom: 48px; }
a { color: var(--brand-2); }

/* Cabecera */
.top { background: var(--brand); color: #fff; }
.top-in { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px; background: var(--accent); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 20px;
}
.brand-text { font-size: 18px; line-height: 1.1; }
.brand-text small { display: block; font-size: 12px; opacity: .75; letter-spacing: .4px; text-transform: uppercase; margin-top: 3px; }
.user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.user-email { opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.top .btn-link { color: #fff; }

/* Tarjetas */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.login { max-width: 440px; margin: 0 auto; }
h1 { font-size: 26px; margin: 0 0 8px; color: var(--brand); }
h2 { font-size: 19px; margin: 12px 0 6px; color: var(--brand); }
.muted { color: var(--muted); margin: 0 0 16px; }
.small { font-size: 14px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 18px 0 6px; }
input, select {
  width: 100%; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 3px solid rgba(35, 82, 124, .2); border-color: var(--brand-2); }
.code-input { font-size: 28px; letter-spacing: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.error { color: var(--error); font-size: 14px; min-height: 20px; margin: 8px 0 4px; }

.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  width: 100%; padding: 13px 18px; border: 0; border-radius: 8px;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--brand-2); }
.btn[disabled], .btn.busy { opacity: .6; cursor: progress; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); text-decoration: underline; cursor: pointer; }
.btn-link[disabled] { color: var(--muted); text-decoration: none; cursor: default; }
.resend { display: block; margin: 16px auto 0; font-size: 14px; }

/* Panel */
.selector { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; max-width: 520px; }
.selector label { margin: 0; white-space: nowrap; }
.hello { margin-bottom: 24px; }
.hello h1 { font-size: 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; display: flex; flex-direction: column; }
.tile .muted { flex: 1; }
.tile-icon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: #e8eef5; color: var(--brand); }
.tile-soon { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); }
.tile-soon .tile-icon { background: #eef0f2; color: var(--muted); }
.tile-soon h2 { color: var(--muted); }
.note { font-size: 14px; color: var(--muted); background: #fff8e6; border-radius: 8px; padding: 10px 12px; margin: 0; }
.help { margin-top: 32px; text-align: center; }

/* Cargando */
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.foot { font-size: 13px; color: var(--muted); padding: 20px 0; border-top: 1px solid var(--line); background: #fff; }
.foot a { color: inherit; }

@media (max-width: 560px) {
  main.wrap { padding-top: 24px; }
  .card { padding: 24px 20px; }
  .brand-text small { display: none; }
  .user-email { display: none; }
  .selector { flex-direction: column; align-items: stretch; gap: 6px; }
}

/* Logo */
.brand-logo { display: block; height: 34px; width: auto; }
.brand-sub { font-size: 12px; opacity: .75; letter-spacing: .4px; text-transform: uppercase; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.35); line-height: 1.2; }
@media (max-width: 560px) {
  .brand-logo { height: 26px; }
  .brand-sub { display: none; }
}

/* Pantalla de acceso en ordenador (propuesta 1). En móvil y dentro del panel no cambia nada. */
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
.hero { display: none; }
@media (min-width: 900px) {
  body:not([data-vista="vPanel"]) {
    display: grid; grid-template-columns: minmax(420px, 46%) 1fr; min-height: 100vh; background: #fbfaf7;
  }
  body:not([data-vista="vPanel"]) .top,
  body:not([data-vista="vPanel"]) .foot { display: none; }
  body:not([data-vista="vPanel"]) .hero {
    display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
    background: var(--brand); color: #fff; padding: 56px 64px; min-height: 100vh;
  }
  body:not([data-vista="vPanel"]) main.wrap {
    max-width: none; margin: 0; padding: 56px 64px; display: flex; align-items: center; justify-content: center;
  }
  body:not([data-vista="vPanel"]) .card.login {
    width: 100%; max-width: 400px; margin: 0; padding: 0; background: transparent; box-shadow: none; border-radius: 0;
  }
  body:not([data-vista="vPanel"]) .login h1 {
    font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 34px; margin-bottom: 10px;
  }
  body:not([data-vista="vPanel"]) .login .muted { font-size: 16px; }
  body:not([data-vista="vPanel"]) .login input { border-color: #cfd6dd; border-radius: 6px; padding: 14px 16px; }
  body:not([data-vista="vPanel"]) .login .btn { border-radius: 6px; padding: 15px 20px; min-height: 48px; }
  body:not([data-vista="vPanel"]) .login input:focus { outline-color: rgba(200, 162, 74, .45); border-color: var(--brand); }
}
.hero-logo { display: block; line-height: 0; align-self: flex-start; }
.hero-logo img { height: 36px; width: auto; }
.hero-body { display: flex; flex-direction: column; gap: 26px; max-width: 500px; }
.hero-kicker { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); }
.hero-title { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-weight: 400; font-size: clamp(34px, 3.4vw, 46px); line-height: 1.12; }
.hero-rule { display: block; height: 1px; width: 64px; background: var(--accent); }
.hero-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; font-size: 17px; color: #d6dee7; }
.hero-list li { display: flex; gap: 12px; align-items: flex-start; }
.hero-list svg { flex: none; margin-top: 1px; color: var(--accent); }
.hero-foot { margin: 0; font-size: 13px; color: #9fb0c2; }

/* Panel del cliente: secciones */
.tile h3 { font-size: 19px; margin: 12px 0 6px; color: var(--brand); }
.seccion-titulo { font-size: 20px; margin: 0 0 14px; color: var(--brand); }
.side { display: none; }

/* Panel del cliente en ordenador: menú lateral + casillas de la sección. En móvil no cambia. */
@media (min-width: 900px) {
  body[data-vista="vPanel"] { display: grid; grid-template-columns: 300px 1fr; background: #fbfaf7; }
  body[data-vista="vPanel"] .top,
  body[data-vista="vPanel"] .foot { display: none; }
  body[data-vista="vPanel"] .side {
    display: flex; flex-direction: column; gap: 36px; min-height: 100vh;
    background: var(--brand); color: #fff; padding: 40px 32px;
  }
  body[data-vista="vPanel"] main.wrap { max-width: none; margin: 0; padding: 64px 72px; }
  body[data-vista="vPanel"] .hello { margin-bottom: 40px; }
  body[data-vista="vPanel"] .hello h1 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 36px; line-height: 1.1; margin-bottom: 8px; }
  body[data-vista="vPanel"] .seccion-titulo {
    display: block; font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 28px; margin: 0 0 24px;
  }
  body[data-vista="vPanel"] .seccion-titulo::after { content: ""; display: block; width: 48px; height: 1px; background: var(--accent); margin-top: 10px; }
  body[data-vista="vPanel"] .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 320px)); }
  body[data-vista="vPanel"] .tile { box-shadow: none; border: 1px solid #e6e2d8; border-radius: 10px; padding: 28px; }
  body[data-vista="vPanel"] .tile-icon { width: 48px; height: 48px; border-radius: 10px; background: #eef2f6; }
  body[data-vista="vPanel"] .tile h3 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 22px; margin: 16px 0 6px; }
  body[data-vista="vPanel"] .tile .muted { font-size: 15px; }
  body[data-vista="vPanel"] .tile .btn { width: auto; align-self: flex-start; border-radius: 6px; padding: 12px 24px; min-height: 46px; }
}
.side-logo { display: block; line-height: 0; align-self: flex-start; }
.side-logo img { height: 30px; width: auto; }
.side-kicker { font-size: 15px; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase; color: var(--accent); }
.side-kicker::after { content: ""; display: block; width: 48px; height: 1px; background: var(--accent); margin-top: 10px; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-link {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 8px;
  color: #d6dee7; text-decoration: none; font-weight: 600; font-size: 15px;
}
.side-link svg { flex: none; color: var(--accent); }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link[aria-current="page"] { background: rgba(255,255,255,.1); box-shadow: inset 3px 0 0 var(--accent); color: #fff; }
.side-user { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.18); font-size: 14px; }
.side-email { color: #c9d4df; overflow-wrap: anywhere; }
.side .btn-link { color: #fff; align-self: flex-start; font-weight: 600; }

/* Menú en móvil: barra horizontal deslizable bajo la cabecera */
.tabs { display: none; }
@media (max-width: 899px) {
  body[data-vista="vPanel"] .tabs {
    display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
    background: #fff; border-bottom: 1px solid var(--line); padding: 0 12px; scrollbar-width: none;
  }
  body[data-vista="vPanel"] .tabs::-webkit-scrollbar { display: none; }
}
.tab-link {
  flex: none; scroll-snap-align: start; display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 12px; border-bottom: 3px solid transparent;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap;
}
.tab-link svg { flex: none; width: 18px; height: 18px; }
.tab-link[aria-current="page"] { color: var(--brand); border-bottom-color: var(--accent); }
.tab-link[aria-current="page"] svg { color: var(--accent); }

/* Documentos y modelos (nov 2026) */
.subtabs { display: flex; gap: 6px; margin: -6px 0 18px; }
.subtab { font-size: 14px; font-weight: 600; color: var(--brand); padding: 6px 12px; border-radius: 999px; background: #eef2f6; }
.doc-filtros { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 18px; }
.f-mini { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.f-mini select, .f-mini input { width: auto; min-width: 150px; padding: 9px 12px; font-size: 15px; }
.f-busca input { min-width: 260px; }
.doc-grupo { margin-bottom: 26px; }
.doc-grupo h3 { font-size: 15px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.doc-tabla { background: var(--card); border: 1px solid #e6e2d8; border-radius: 10px; overflow: hidden; }
.doc-fila { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid #efece5; }
.doc-fila:first-child { border-top: 0; }
.doc-badge { flex: none; min-width: 52px; text-align: center; font-weight: 700; font-size: 14px; color: var(--brand); background: #eef2f6; border-radius: 8px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.doc-txt { flex: 1; min-width: 0; }
.doc-tit { font-weight: 600; color: var(--text); }
.doc-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); color: var(--brand); text-decoration: none; font-weight: 600; font-size: 14px; background: #fff; }
.doc-btn:hover { border-color: var(--brand); background: #f6f8fa; }
.doc-vacio { color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: 10px; padding: 22px; text-align: center; }
@media (max-width: 560px) {
  .doc-fila { flex-wrap: wrap; }
  .doc-btn { width: 100%; justify-content: center; }
  .f-mini, .f-mini select, .f-mini input, .f-busca input { width: 100%; min-width: 0; }
  .doc-filtros { flex-direction: column; }
}
