/* App de clientes ATRYASOL — diseño móvil */
body { background: var(--bg); }
#shell { min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
main { max-width: 640px; margin: 0 auto; padding: 0 16px 1.5rem; }
.center { text-align: center; }
.btn-block { width: 100%; min-height: 50px; font-size: .98rem; box-shadow: 0 8px 24px -8px rgba(245,166,35,.65); }
button:not(.btn-icon):not(.tipo):not(.accion):not(.check-item):not(.menu-fila):not(.icon-btn):not(.chat-form button), .btn:not(.icon-btn) { border-radius: 999px; }
h1 { font-size: 1.5rem; }

/* ---------- Acceso ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(500px 300px at 85% 10%, rgba(245,166,35,.22), transparent 60%), linear-gradient(165deg, #0f2140 0%, #0a1628 55%, #050a14 100%); }
.login-top { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; text-align: center; padding: calc(2.5rem + env(safe-area-inset-top)) 24px 2rem; }
.login-logo { width: 120px; height: auto; margin-bottom: .6rem; filter: drop-shadow(0 8px 24px rgba(232,88,0,.45)); }
.login-top h1 { color: #fff; font-size: 1.9rem; letter-spacing: .06em; margin: 0; }
.login-top p { color: rgba(255,255,255,.75); margin: .4rem 0 0; }
.login-card { background: var(--surface); border-radius: 28px 28px 0 0; padding: 1.6rem 22px calc(1.6rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: .9rem; max-width: 640px; width: 100%; margin: 0 auto; }
.login-card h2 { margin: 0 0 .2rem; font-size: 1.25rem; }

/* ---------- Cabecera (hero) ---------- */
.hero {
  position: relative; overflow: hidden; margin: 0 -16px 1.1rem; padding: calc(1.2rem + env(safe-area-inset-top)) 20px 1.6rem;
  background: linear-gradient(160deg, #0f2140 0%, #0a1628 60%, #050a14 100%); color: #fff; border-radius: 0 0 28px 28px;
}
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(240,160,26,.55), rgba(240,160,26,0) 70%); }
.hero-top { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
.hero-top .brand { display: flex; align-items: center; gap: .5rem; font-weight: 750; letter-spacing: .06em; font-size: .9rem; color: rgba(255,255,255,.9); }
.hero-top .brand img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(232,88,0,.4)); }
.hero h1 { color: #fff; margin: 1.1rem 0 .2rem; font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; position: relative; z-index: 1; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .sub { color: rgba(255,255,255,.78); font-size: .92rem; position: relative; z-index: 1; }
.hero .estado { display: inline-flex; align-items: center; gap: .45rem; margin-top: .9rem; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); padding: .4rem .75rem; border-radius: 999px; font-size: .85rem; font-weight: 600; position: relative; z-index: 1; }
.hero .estado .dot { background: var(--accent); width: 8px; height: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; border: 0; padding: 0; min-height: 0; }
.icon-btn:hover { background: rgba(255,255,255,.2); }
.page-title { display: flex; align-items: center; justify-content: space-between; padding: calc(1rem + env(safe-area-inset-top)) 0 .9rem; }
.page-title h1 { margin: 0; }

/* ---------- Bloques ---------- */
.section-title { font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 1.4rem 4px .6rem; display: flex; align-items: center; gap: .5rem; }
.card { border-radius: 20px; padding: 1.1rem 1.15rem; }
.card + .card { margin-top: .8rem; }
.card h2 { font-size: 1.05rem; }

.acciones { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.accion { display: flex; flex-direction: column; align-items: center; gap: .45rem; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: .85rem .3rem .75rem; color: var(--text); font-size: .74rem; font-weight: 600; text-align: center; text-decoration: none; min-height: 0; box-shadow: var(--shadow-sm); line-height: 1.2; }
.accion:hover { background: var(--surface); border-color: var(--brand); text-decoration: none; }
.accion .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.accion .ico .icon { width: 22px; height: 22px; }

/* Expediente */
.expediente .barra { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: .6rem 0 .9rem; }
.expediente .barra i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--brand)); box-shadow: 0 0 12px rgba(245,166,35,.6); transition: width .6s var(--ease); }
.check-item { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0; min-height: 0; font-weight: 500; text-align: left; justify-content: flex-start; }
.check-item:hover { background: none; text-decoration: none; }
.check-item .estado-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--border-strong); color: transparent; }
.check-item.ok .estado-ico { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-item.ok .txt { color: var(--muted); text-decoration: line-through; }
.check-item .txt { flex: 1; font-size: .92rem; }
.check-item .ir { color: var(--brand-text); font-size: .82rem; font-weight: 650; }

/* Peticiones del equipo */
.pet { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.pet::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent); }
.pet + .pet { margin-top: .7rem; }
.pet-info::before { background: var(--info); } .pet-violet::before { background: var(--violet); } .pet-brand::before { background: var(--brand); }
.pet-head { display: flex; gap: .75rem; align-items: center; }
.pet-head .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.pet-tipo { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.pet-titulo { font-weight: 650; font-size: 1rem; line-height: 1.3; }
.pet-desc { margin: .6rem 0 0; font-size: .92rem; color: var(--text-2); white-space: pre-wrap; }
.cita-fecha { display: flex; gap: .4rem; align-items: center; margin-top: .6rem; font-weight: 650; color: var(--violet); }
.pet-acciones { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .85rem; }
.pet-acciones > * { flex: 1 1 auto; min-height: 44px; border-radius: 12px; }
label.btn { margin: 0; color: var(--brand-ink); font-size: .9rem; cursor: pointer; }
label.btn.btn-ghost { color: var(--text); }
.btn.disabled, button:disabled { opacity: .5; pointer-events: none; }

/* Proyecto */
.proyecto .fase-actual { display: flex; gap: .8rem; align-items: center; background: var(--brand-soft); border-radius: 14px; padding: .8rem .9rem; margin: .8rem 0; }
.proyecto .fase-actual .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); flex: none; }
.proyecto .fase-actual b { display: block; }
.proyecto .fase-actual span { font-size: .86rem; color: var(--text-2); }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; margin-top: .6rem; }
.datos div { background: var(--surface-2); border-radius: 12px; padding: .6rem .75rem; }
.datos b { display: block; font-size: 1.05rem; }
.datos span { font-size: .78rem; color: var(--muted); }
details summary { cursor: pointer; color: var(--brand-text); font-size: .9rem; font-weight: 600; }

.aviso-card { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--text); background: var(--info-soft); border: 1px solid transparent; border-radius: 18px; padding: .9rem 1rem; margin-top: .8rem; }
.aviso-card:hover { text-decoration: none; }
.aviso-card .grow { flex: 1; }
.aviso-card.warn { background: var(--warn-soft); }

/* Listas */
.fila { display: flex; align-items: center; gap: .8rem; padding: .75rem 0; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; }
.fila:first-of-type { border-top: 0; }
.card > .fila:first-child, .card > h2 + .fila { border-top: 0; }
.fila:hover { text-decoration: none; }
.fila .grow { min-width: 0; flex: 1; }
.fila .t { font-weight: 600; overflow-wrap: anywhere; }
.fila .d { font-size: .8rem; color: var(--muted); }
.file-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; font-size: .62rem; font-weight: 800; }

/* Subir documento: tipos */
.tipos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.tipo { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .8rem .3rem; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font-size: .76rem; font-weight: 600; min-height: 0; text-align: center; }
.tipo:hover { background: var(--surface); border-color: var(--border-strong); }
.tipo.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.tipo .icon { width: 22px; height: 22px; }
.subir-zona { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .8rem; }
.subir-zona label { margin: 0; }
.subir-zona .btn { width: 100%; min-height: 50px; border-radius: 14px; }
.archivos-sel { margin-top: .6rem; font-size: .85rem; color: var(--text-2); }

/* Perfil */
.perfil-head { display: flex; align-items: center; gap: 1rem; margin: .4rem 0 1rem; }
.perfil-head .avatar { width: 64px; height: 64px; border-radius: 20px; font-size: 1.3rem; }
.perfil-head h1 { margin: 0; font-size: 1.3rem; }
.dato { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--border); font-size: .92rem; }
.dato:first-of-type { border-top: 0; }
.dato span { color: var(--muted); }
.dato b { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.menu-fila { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .85rem 0; border-top: 1px solid var(--border); background: none; color: var(--text); border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; min-height: 0; font-weight: 550; justify-content: flex-start; }
.menu-fila:hover { background: none; }
.menu-fila:first-child { border-top: 0; }
.menu-fila .grow { flex: 1; text-align: left; }
.menu-fila.peligro { color: var(--bad); }

/* Chat */
.chat-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat { height: calc(100vh - 300px); min-height: 300px; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; background: var(--surface-2); }
.msg { max-width: 82%; padding: .6rem .85rem; border-radius: 18px; font-size: .95rem; box-shadow: var(--shadow-sm); }
.msg.yo { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 6px; }
.msg.ellos { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg-autor { font-size: .72rem; font-weight: 700; color: var(--brand-text); margin-bottom: .1rem; }
.msg-txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-hora { font-size: .68rem; opacity: .7; margin-top: .2rem; text-align: right; }
.msg-doc { display: inline-flex; gap: .35rem; align-items: center; margin-top: .35rem; font-size: .85rem; font-weight: 600; color: inherit; text-decoration: underline; }
.chat-form { display: flex; gap: .5rem; padding: .6rem; border-top: 1px solid var(--border); background: var(--surface); align-items: flex-end; }
.chat-form textarea { min-height: 44px; resize: none; border-radius: 22px; padding: .6rem .95rem; }
.chat-form button { width: 44px; min-height: 44px; border-radius: 50%; padding: 0; flex: none; }
.chips-gestion { display: flex; gap: .5rem; overflow-x: auto; padding: .1rem 0 .8rem; }
.chips-gestion button { white-space: nowrap; border-radius: 999px; min-height: 36px; font-size: .84rem; }

/* Barra inferior */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: .4rem 0; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 650; }
.tabbar a .tab-ico { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 15px; transition: background .2s; }
.tabbar a.active { color: var(--brand-text); }
.tabbar a.active .tab-ico { background: var(--brand-soft); }
.tab-badge { position: absolute; top: -4px; right: 4px; background: var(--bad); color: #fff; border-radius: 999px; font-size: .62rem; padding: 0 .35rem; line-height: 1.5; font-weight: 750; }

.preview-banner { background: var(--accent); color: #fff; font-weight: 650; font-size: .8rem; text-align: center; padding: .45rem 1rem; position: sticky; top: 0; z-index: 20; }
body.preview .hero { padding-top: 1.2rem; }
@media (min-width: 700px) { .acciones { gap: .8rem; } }
