/* Client Portal — estilos de la app. Recreación de handoff/client-portal/design/Client Portal.dc.html
   (proyecto Claude Design "Portal de Clientes Scale Nearshoring"). Colores solo vía tokens var(--sn-*),
   incluidos los del portal declarados en brand.css; las medidas en px son las del prototipo. */

html, body { margin: 0; height: 100%; background: var(--sn-offwhite); }
body { font-family: var(--sn-font); color: var(--sn-ink); -webkit-font-smoothing: antialiased; }
*, *::before, *::after { box-sizing: border-box; }
a { color: var(--sn-blue-light); text-decoration: none; }
a:hover { color: var(--sn-blue); text-decoration: underline; }
button, input, select, textarea { font-family: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-rows: minmax(0, 1fr); height: 100vh; background: var(--sn-offwhite); }
.app-backdrop { position: fixed; inset: 0; background: rgba(17,17,17,.4); z-index: 30; animation: sn-fade .2s ease-out; }
.sidebar { background: var(--sn-white); border-right: 1px solid var(--sn-gray-cool); display: flex; flex-direction: column; min-height: 0; overflow: auto; top: 0; bottom: 0; left: 0; z-index: 31; }
.sidebar-brand { padding: 22px 22px 18px; border-bottom: 1px solid var(--sn-gray-cool); }
.sidebar-org { margin-top: 18px; display: flex; align-items: center; gap: 12px; }
.org-mark { width: 40px; height: 40px; flex: none; border-radius: 4px; background: var(--sn-blue); color: var(--sn-white); display: grid; place-items: center; font-weight: 900; font-size: 15px; overflow: hidden; }
.org-mark img { width: 100%; height: 100%; object-fit: cover; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; }
.nav-group { margin: 18px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sn-ink-70); }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; cursor: pointer; text-align: left; padding: 10px 12px; border-radius: 4px; font-size: 15px; font-weight: 600; background: transparent; color: var(--sn-ink); }
.nav-item.on { background: var(--sn-offwhite); color: var(--sn-blue); }
.nav-item.locked { color: var(--sn-ink-disabled); cursor: not-allowed; }
.nav-item:focus-visible { outline: 2px solid var(--sn-blue-light); outline-offset: 1px; }
.nav-lock { margin-left: auto; display: flex; }
.nav-note { margin: 4px 22px 0; font-size: 13px; line-height: 1.45; color: var(--sn-ink-70); }
.sidebar-user { margin-top: auto; padding: 14px 12px 16px; border-top: 1px solid var(--sn-gray-cool); position: relative; }
.user-btn { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; cursor: pointer; text-align: left; padding: 8px 10px; border-radius: 4px; color: inherit; }
.user-btn:hover { background: var(--sn-offwhite); }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 4px; background: var(--sn-green); color: var(--sn-on-green); display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.user-menu { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 6px); }
.main { min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--sn-white); border-bottom: 1px solid var(--sn-gray-cool); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--sn-gray-cool); background: var(--sn-white); border-radius: 4px; display: grid; place-items: center; color: var(--sn-blue); cursor: pointer; }
.page { padding: 32px 40px 64px; max-width: 1240px; width: 100%; }
.is-mobile .page { padding: 20px 16px 48px; }

/* ---------- Tipografía ---------- */
.eyebrow { font-size: 14px; font-weight: 700; color: var(--sn-green); }
.h1 { margin: 4px 0 0; font-size: 32px; font-weight: 900; line-height: 1.15; color: var(--sn-blue); }
.is-mobile .h1 { font-size: 26px; }
.card-title { font-size: 18px; font-weight: 900; color: var(--sn-blue); }
.muted { color: var(--sn-ink-70); }
.small { font-size: 13px; }
.label-sm { font-size: 13px; font-weight: 600; color: var(--sn-ink-70); }

/* ---------- Superficies ---------- */
.card { background: var(--sn-white); border: 1px solid var(--sn-gray-cool); border-radius: 10px; }
.card.pad { padding: 24px; }
.card.pad-20 { padding: 20px; }
.grid-auto { display: grid; gap: 16px; align-items: start; }
.stat { text-align: left; background: var(--sn-white); border: 1px solid var(--sn-gray-cool); border-radius: 10px; padding: 20px; font: inherit; color: inherit; cursor: pointer; }
.stat.static { cursor: default; }
.stat:hover { border-color: var(--sn-blue-light); }
.stat-value { margin-top: 6px; font-size: 36px; font-weight: 900; color: var(--sn-blue); line-height: 1.1; }
.welcome { background: var(--sn-green); padding: 28px; box-shadow: 4px 4px 0 rgba(0,0,0,.16); margin-bottom: 24px; color: var(--sn-on-green); }
.bar { height: 6px; background: var(--sn-offwhite); }
.bar > div { height: 6px; }
.tile { width: 48px; height: 48px; flex: none; border-radius: 4px; display: grid; place-items: center; }
.pennant { width: 10px; height: 10px; flex: none; clip-path: polygon(0 0, 100% 50%, 0 100%); }

/* ---------- Botones ---------- */
.btn { border-radius: 6px; font-weight: 700; font-size: 14px; padding: 10px 18px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { border: 0; background: var(--sn-blue-deep); color: var(--sn-white); }
.btn-secondary { border: 1px solid var(--sn-gray-cool); background: var(--sn-white); color: var(--sn-blue); padding: 10px 16px; }
.btn-danger { border: 0; background: var(--sn-danger); color: var(--sn-white); }
.btn-danger-outline { border: 1px solid var(--sn-danger); background: var(--sn-white); color: var(--sn-danger); padding: 10px 16px; }
.btn-cta { border: 0; background: var(--sn-green); color: var(--sn-on-green); font-weight: 900; font-size: 15px; padding: 12px 20px; }
.btn-cta:hover { background: var(--sn-green-hover); }
.btn-doc { padding: 9px 14px; }
.btn-xs { border: 1px solid var(--sn-gray-cool); background: var(--sn-white); color: var(--sn-blue); font-weight: 600; font-size: 13px; padding: 6px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.btn-xs:disabled { opacity: .45; cursor: not-allowed; }
.btn-check { border: 1px solid var(--sn-gray-cool); background: var(--sn-white); color: var(--sn-blue); font-weight: 700; font-size: 13px; padding: 7px 12px; border-radius: 4px; cursor: pointer; }
.btn:disabled { cursor: not-allowed; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* ---------- Tablas ---------- */
.table-wrap { background: var(--sn-white); border: 1px solid var(--sn-gray-cool); border-radius: 10px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl thead tr { background: var(--sn-offwhite); text-align: left; }
.tbl th { padding: 12px 10px; font-size: 13px; font-weight: 600; color: var(--sn-ink-70); }
.tbl td { padding: 14px 10px; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl tbody tr { border-top: 1px solid var(--sn-gray-cool); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover { background: var(--sn-row-hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; }

/* ---------- Badges ---------- */
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 4px; border: 1px solid; white-space: nowrap; }
.held { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 4px; background: var(--sn-offwhite); color: var(--sn-blue-deep); border: 1px dashed var(--sn-blue-light); white-space: nowrap; }

/* ---------- Estados de lista ---------- */
.state-msg { padding: 56px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.state-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--sn-offwhite); display: grid; place-items: center; }
.state-title { font-size: 20px; font-weight: 900; color: var(--sn-blue); }
.state-body { font-size: 15px; line-height: 1.55; color: var(--sn-ink-70); max-width: 460px; text-wrap: pretty; }
.skeleton { padding: 8px 20px 12px; }
.skeleton-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--sn-gray-cool); }
.skeleton-row div { height: 12px; background: var(--sn-blue-gray); border-radius: 4px; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.input { padding: 10px 12px; border: 1px solid var(--sn-border); border-radius: 4px; font-size: 15px; font-weight: 400; outline: none; background: var(--sn-white); color: var(--sn-ink); }
.input:focus { border-color: var(--sn-blue-light); box-shadow: 0 0 0 3px rgba(66,143,218,.25); }
.input.invalid { border-color: var(--sn-danger); }
.hint { font-size: 13px; font-weight: 400; color: var(--sn-ink-70); }
.err { font-size: 13px; font-weight: 400; color: var(--sn-danger); }
.optional { font-weight: 400; color: var(--sn-ink-70); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--sn-gray-cool); border-radius: 4px; overflow: hidden; }
.segmented button { border: 0; padding: 12px; font-size: 15px; font-weight: 700; cursor: pointer; background: var(--sn-white); color: var(--sn-blue); }
.segmented button + button { border-left: 1px solid var(--sn-gray-cool); }
.segmented button.on { background: var(--sn-blue); color: var(--sn-white); }
.segmented.sm button { padding: 10px; font-size: 14px; }
.check-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--sn-gray-cool); border-radius: 4px; cursor: pointer; }
.check-chip { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border: 1px solid var(--sn-gray-cool); border-radius: 4px; font-weight: 400; cursor: pointer; }
.check-card input, .check-chip input { width: 16px; height: 16px; accent-color: var(--sn-blue); }
.check-card input { margin-top: 3px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; background: var(--sn-offwhite); border: 1px solid var(--sn-gray-cool); border-radius: 4px; font-size: 14px; font-weight: 400; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--sn-ink-70); display: flex; padding: 2px; }

/* ---------- Menús, modales, toast ---------- */
.menu { background: var(--sn-white); border: 1px solid var(--sn-gray-cool); border-radius: 6px; box-shadow: var(--sn-shadow-card); padding: 6px; display: flex; flex-direction: column; text-align: left; }
.menu-item { border: 0; background: none; text-align: left; padding: 10px 12px; font-size: 14px; cursor: pointer; border-radius: 4px; color: var(--sn-ink); }
.menu-item:hover { background: var(--sn-offwhite); text-decoration: none; }
.menu-item:disabled { color: var(--sn-ink-disabled); cursor: not-allowed; }
.menu-item.danger { color: var(--sn-danger); }
.menu-item.danger:disabled { color: var(--sn-ink-disabled); }
.row-menu { position: fixed; z-index: 40; min-width: 240px; }
.row-menu .menu-item { padding: 9px 12px; }
.overlay { position: fixed; inset: 0; background: rgba(17,17,17,.45); display: grid; place-items: center; padding: 16px; animation: sn-fade .2s ease-out; }
.dialog { width: 100%; background: var(--sn-white); border-radius: 10px; box-shadow: var(--sn-shadow-card); animation: sn-rise .25s ease-out; }
.dialog-head { display: flex; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--sn-gray-cool); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--sn-gray-cool); background: var(--sn-offwhite); }
.close-btn { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--sn-ink-70); display: flex; }
.secret-once { background: var(--sn-green); padding: 20px; border-radius: 4px; box-shadow: 4px 4px 0 rgba(0,0,0,.16); color: var(--sn-on-green); }
.secret-once code.link { flex: 1; min-width: 200px; padding: 11px 12px; background: var(--sn-white); border-radius: 4px; font-size: 13px; word-break: break-all; color: var(--sn-ink); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 70; background: var(--sn-ink-strong); color: var(--sn-white); padding: 12px 18px; border-radius: 6px; font-size: 15px; display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 32px); animation: sn-fade .2s ease-out; }

/* ---------- Pantallas públicas (Handoff 11–16) ---------- */
.auth { min-height: 100vh; display: flex; background: var(--sn-white); color: var(--sn-ink); }
.auth.is-mobile { flex-direction: column; }
.auth-panel { flex: 0 0 44%; background: var(--sn-blue); color: var(--sn-white); padding: 56px 64px; display: flex; flex-direction: column; }
.auth-topbar { padding: 20px 24px; border-bottom: 1px solid var(--sn-gray-cool); display: flex; align-items: center; gap: 12px; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 64px; }
.auth.is-mobile .auth-main { align-items: flex-start; padding: 28px 24px 40px; }
.auth-col { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.auth-h1 { margin: 0; font-weight: 900; color: var(--sn-blue); line-height: 1.15; }
.auth-sub { margin: 8px 0 0; font-size: 16px; line-height: 1.5; color: var(--sn-ink-70); }
.auth-input { padding: 12px 14px; font-size: 16px; }
.auth-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--sn-blue-light); font-weight: 600; font-size: 13px; cursor: pointer; padding: 6px; }
.auth-rules { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; font-weight: 400; }
.auth-rules li { display: flex; gap: 6px; align-items: center; }
.auth-rules li span { width: 8px; height: 8px; flex: none; }
.auth-turnstile { display: flex; align-items: center; gap: 12px; height: 65px; padding: 0 14px; border: 1px solid var(--sn-gray-cool); border-radius: 4px; background: var(--sn-offwhite); font-size: 14px; }
.auth-turnstile-check { width: 22px; height: 22px; border: 2px solid var(--sn-green); border-radius: 3px; display: grid; place-items: center; color: var(--sn-green); }
.auth-alert { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--sn-danger); border-radius: 4px; background: var(--sn-white); color: var(--sn-danger); font-size: 15px; line-height: 1.45; }
.auth-btn { border: 0; font-weight: 900; font-size: 16px; padding: 14px; border-radius: 6px; cursor: pointer; }
.auth-btn:disabled { opacity: .6; cursor: not-allowed; }
.auth-btn-primary { background: var(--sn-blue-deep); color: var(--sn-white); }
.auth-btn-primary:hover:not(:disabled) { background: var(--sn-blue); }
.auth-btn-cta { background: var(--sn-green); color: var(--sn-on-green); }
.auth-btn-cta:hover:not(:disabled) { background: var(--sn-green-hover); }
.auth-foot { font-size: 14px; line-height: 1.55; color: var(--sn-ink-70); border-top: 1px solid var(--sn-gray-cool); padding-top: 16px; }

@keyframes sn-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sn-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .overlay, .dialog, .toast, .app-backdrop { animation: none; } }
