/* TraumAstur V5 | mobile-first finishing layer, corporate violet and orange */
:root{--purple:#3a145a;--orange:#ffba99;--ink:#2f2040;--line:#e5dbea;--surface:#fff;--mist:#faf8fb}
html{scroll-behavior:smooth}body{background:#f8f6fa;color:var(--ink)}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #9b65b4;outline-offset:2px}
button:disabled{opacity:.54;cursor:not-allowed}
button{transition:background-color .15s, box-shadow .15s}
.primary{background:var(--orange);color:var(--purple);border:1px solid #ec9b71;font-weight:750}
.primary:hover{background:#ffa980}
.top{background:var(--purple);border-bottom:3px solid var(--orange)}
.task{box-shadow:0 2px 10px #3a145a0a;border:1px solid var(--line)}
.task:hover{border-color:#c7a9d8;box-shadow:0 5px 20px #3a145a14}
.taskhead h3{font-size:15px;line-height:1.35}
.quickcontact{overflow:hidden}.quickperson{min-width:0;overflow:hidden}.quickperson strong{overflow:hidden;text-overflow:ellipsis}
.history-actions{padding:8px 15px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}
.history-actions .secondary{font-size:12px;color:#8b2b48;border-color:#e8c8d0}
.admin-modal{max-width:1020px}.adminbar{display:flex;align-items:center;gap:15px;margin:0 0 20px;flex-wrap:wrap}
.admin-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:11px}
.user-card{border:1px solid var(--line);border-radius:14px;background:var(--surface);padding:15px;display:flex;flex-direction:column;gap:8px;min-width:0}
.user-name{display:flex;justify-content:space-between;align-items:start;gap:8px}
.user-card strong{color:var(--purple)}.user-card small{overflow-wrap:anywhere;color:#7a6c85}
.user-card .user-meta{display:flex;flex-wrap:wrap;gap:6px}
.user-card .user-meta span{background:#f4eff7;color:#5f3c76;border-radius:20px;padding:4px 8px;font-size:11px;font-weight:700}
.user-card .user-meta .inactive{background:#ffebe8;color:#a23d37}
.user-card .secondary{margin-top:auto;align-self:flex-start}
.admin-flags{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:18px 0}
.admin-flags label,.prefrow{border:1px solid var(--line);background:var(--mist);border-radius:10px;padding:12px;display:flex;align-items:center;gap:10px;font-size:13px;line-height:1.35}
.admin-flags input,.prefrow input{width:17px;height:17px;accent-color:var(--purple);flex:none}
.admin-audit{margin-top:22px;border-top:1px solid var(--line);padding-top:14px}
.admin-audit summary{color:var(--purple);cursor:pointer;font-weight:700}
.admin-audit .audit-item{font-size:12px;border-bottom:1px solid var(--line);padding:8px 2px;color:#685a72}
.prefs-list{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.prefrow{justify-content:space-between}.prefrow span{flex:1}.prefrow small{display:block;color:#82718b;margin-top:3px}
#pushStatus{margin:12px 0}.more-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.more-actions button{text-align:left;min-height:48px}
.mobile-nav{display:none}.modal-v5{max-width:640px}.cal-mobile-title{font-size:11px;color:#7f6c88}
.day.has-tasks{background:#fff9f4}.calendar-count{display:inline-grid;place-items:center;background:#f1ddef;color:var(--purple);border-radius:50%;width:21px;height:21px;font-size:11px;font-weight:700;margin-top:5px}
.day-button{width:100%;min-height:61px;text-align:left;background:transparent;color:var(--purple);padding:5px;border:0;border-radius:5px;display:flex;align-items:flex-start;justify-content:space-between;gap:3px}
.day-button.today{outline:2px solid #e9a16c;outline-offset:-2px}.day-button:active{background:#f3ecf8}
.more-actions .secondary{color:var(--purple)}.admin-flags label:has(input:disabled){opacity:.6}
@media(max-width:790px){
 .top{gap:8px;padding:8px 12px;min-height:63px}.top .logo{min-width:0}.brandlogo{width:155px;max-width:42vw;height:47px}
 .top .right{gap:5px}.top #who{display:none}.top #prefsbtn,.top #adminbtn,.top #pwbtn,.top #helpbtn{display:none!important}
 .top .right button{padding:8px 9px;font-size:12px;min-height:40px}.top #notifbtn{display:inline-flex;align-items:center}
 .page{padding:19px 12px 100px}.intro{display:block;margin-bottom:15px}.intro h1{font-size:25px}.intro p{font-size:13px}
 .topactions{margin-top:11px;gap:7px}.topactions .secondary{display:none}.topactions .primary{width:100%;min-height:47px}
 .stats{grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;margin-bottom:13px}.stat{padding:9px 6px;border-radius:10px;text-align:center}.stat .num{font-size:21px}.stat .label{font-size:10px;line-height:1.2;margin-top:5px}
 .toolbar{gap:8px}.toolbar input{width:100%;flex:1 1 100%}.toolbar select{flex:1 1 calc(50% - 4px)}
 .viewbar{gap:8px}.tabs{width:100%}.tabs button{flex:1;min-height:41px}
 .viewbar select{width:100%;font-size:13px}.task{border-radius:13px}.taskbody{padding:12px}.taskfoot{padding:8px 12px}
 .taskline{gap:6px}.taskbuttons{gap:5px}.taskbuttons button{min-height:38px}.commentsbadge{font-size:11px;line-height:1.5}
 .modalback{padding:0;align-items:end;z-index:100}.modal{width:100%;max-width:none;max-height:95dvh;min-height:0;overflow:auto;border-radius:20px 20px 0 0;padding:18px 15px 28px}
 .urgentback{align-items:center;padding:12px;z-index:110}.urgentbox{width:100%;border-radius:17px;max-height:92dvh}
 .formgrid{grid-template-columns:1fr}.field input,.field select,.field textarea,.control{font-size:16px!important}
 .field input,.field select,.control{min-height:44px}.field textarea{min-height:110px}
 .actions{gap:10px}.actions>div{display:flex;flex-wrap:wrap;gap:8px}
 .modalheader h2{font-size:21px}.modalheader{align-items:flex-start}
 .mobile-nav:not(.hide){display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;bottom:0;left:0;right:0;z-index:50;background:#fff;box-shadow:0 -2px 18px #3a145a20;border-top:1px solid var(--line);padding:7px 6px max(8px,env(safe-area-inset-bottom))}
 .mobile-nav button{background:transparent;color:#5f4871;display:flex;flex-direction:column;align-items:center;gap:3px;font-size:10px;font-weight:650;min-width:0;padding:5px 0;min-height:45px}.mobile-nav button span{font-size:20px;color:var(--purple)}
 .modal-v5,.admin-modal{width:100%;max-height:95dvh}.prefs-list{grid-template-columns:1fr}
 .admin-grid{grid-template-columns:1fr}.admin-flags{grid-template-columns:1fr}.more-actions{grid-template-columns:1fr}
 .quickpanel{max-height:94dvh}.quickcontacts{grid-template-columns:repeat(2,minmax(0,1fr))}.quickcontact strong{white-space:nowrap}
 .calendar-count{font-size:10px}.calgrid .day{min-height:62px;padding:0}.calgrid .weekday{font-size:10px;padding:8px 2px}
}
@media(min-width:791px){.admin-modal{max-height:92vh}}
@media(max-width:370px){.top #logout{display:none!important}.quickcontacts{grid-template-columns:1fr}}
@media print{.top,.mobile-nav,.topactions,.toolbar,.viewbar,.taskbuttons{display:none!important}.page{max-width:100%;padding:0}.task{break-inside:avoid}}
.presence-dot.push{background:#488cc5;border-color:#a9c8ec}

/* V5.0.1: identify the account on mandatory password change and allow switching. */
.password-account{margin:0 0 18px;padding:11px 13px;border:1px solid #e5dbea;border-radius:10px;background:#faf8fb;color:#3a145a;font-size:14px;font-weight:650;overflow-wrap:anywhere}
#passwordOverlay .actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:9px}
#pwSwitchUser{border-color:#bea8ca;color:#3a145a;font-weight:700}
@media(max-width:500px){#passwordOverlay .actions>button{flex:1 1 100%;min-height:45px}}

/* V5.0.2 — contraseña clara y comprobación sin bloquear el acceso. */
#passwordOverlay .pw-show{display:flex;align-items:center;gap:9px;margin:12px 0 4px;font-size:13px;color:#50356c;cursor:pointer}
#passwordOverlay .pw-show input{height:17px;width:17px;accent-color:#3a145a}
#passwordOverlay #pwMatchHint{min-height:17px;margin:8px 0 3px}
#passwordOverlay .pw-good{color:#166534}
#passwordOverlay .pw-bad,#passwordOverlay .pw-error{color:#a02132}
#passwordOverlay button:disabled{opacity:.6;cursor:wait}

/* V5.0.3 — Team quick-contact panel, compact on desktop and mobile. */
.top{position:relative}
.top #teamToggle{display:inline-flex;align-items:center;justify-content:center;gap:4px;white-space:nowrap;border-color:#b18aaf;background:#532676;color:#fff;font-weight:750;min-height:40px;line-height:1}
.top #teamToggle:hover,.top #teamToggle[aria-expanded="true"]{background:#6b3688}
.top .team-toggle-label{display:inline!important;font-size:12px}
.team-pop{position:absolute;right:max(14px,calc((100vw - 1170px)/2));top:calc(100% + 7px);width:min(386px,calc(100vw - 22px));z-index:85;background:#fff;color:#35213f;border:1px solid #dfcfe8;box-shadow:0 18px 48px #27113335;border-radius:16px;overflow:hidden;text-align:left}
.team-pop-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:15px 15px 12px;background:#f8f3fa;border-bottom:1px solid #ebdeef}
.team-pop-head strong{display:block;color:#3a145a;font-size:17px}
.team-pop-head small{display:block;color:#776582;font-size:12px;margin-top:4px}
.team-pop-close{flex:none;background:#ece2f2;color:#4e2a6a;border-radius:8px;width:31px;height:31px;font-size:24px;line-height:1;display:grid;place-items:center}
.team-list{padding:4px 10px;max-height:min(55vh,380px);overflow-y:auto}
.team-user{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;padding:9px 3px;border-bottom:1px solid #f0e9f2}
.team-user:last-child{border-bottom:0}
.team-user-main{min-width:0;display:flex;gap:9px;align-items:flex-start}
.team-user-names{min-width:0}
.team-user-name{display:block;font-size:13px;font-weight:750;color:#3a145a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.team-user-state{display:block;color:#85778b;font-size:11px;line-height:1.45;margin-top:1px}
.team-user-state time{font-style:normal}
.team-status-dot{height:9px;width:9px;flex:none;border-radius:99px;background:#b9b1bd;margin-top:5px}
.team-status-dot.online{background:#19966a;box-shadow:0 0 0 3px #dcf5e9}
.team-status-dot.push{background:#4289cf;box-shadow:0 0 0 3px #e5f1ff}
.team-actions{display:flex;align-items:center;gap:6px}
.top .team-actions button{color:#482462;background:#f4eef7;border:1px solid #e8daed;display:grid;place-items:center;width:36px;height:36px;padding:7px;border-radius:9px}
.top .team-actions .team-call{background:#ffba99;border-color:#f1a887;color:#3a145a}
.top .team-actions button:hover:not(:disabled){filter:brightness(.96);box-shadow:0 2px 7px #3a145a1a}
.top .team-actions button:disabled{background:#f3f1f4;border-color:#e9e5ec;color:#aaa3ae;opacity:1;cursor:not-allowed}
.team-actions svg{width:18px;height:18px;display:block;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.team-compose{background:#fbf7fc;border-top:1px solid #e4d8ea;padding:12px 14px}
.team-compose label{display:block;font-size:12px;color:#503763;margin-bottom:7px}
.team-compose input{width:100%;border:1px solid #cfbadb;border-radius:8px;padding:10px;font-size:15px;min-height:42px}
.team-compose-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}
.top .team-compose button{font-size:12px;min-height:37px;padding:8px 11px}
.top .team-compose .primary{color:#3a145a;background:#ffba99;border-color:#e5a184}
.top .team-compose .secondary{color:#593b6b;border-color:#decde6;background:#fff}
.team-error{color:#a32643;font-size:12px;margin:6px 0 0;min-height:0}
.team-note{color:#796d82;font-size:11px;line-height:1.5;padding:8px 14px 12px;margin:0;border-top:1px solid #f3edf5}
@media(max-width:790px){
 .top #teamToggle{display:inline-flex;min-width:47px;min-height:40px;padding:8px 9px;font-size:13px}
 .top .team-toggle-label{display:none!important}
 .team-pop{position:fixed;top:70px;right:8px;width:min(382px,calc(100vw - 16px));max-height:calc(100dvh - 90px);overflow:auto}
 .team-list{max-height:45dvh}
 .top .team-actions button{min-height:38px;min-width:38px}
}
@media(max-width:390px){.top #teamToggle{min-width:41px;padding:7px 8px}.team-user{gap:7px}.team-user-name{font-size:12px}.top .team-actions button{width:34px;min-width:34px}}
@media(max-width:790px){.top #teamToggle>span{display:inline!important}.top #teamToggle>.team-toggle-label{display:none!important}}

/* V5.0.4 — Widget de equipo PERMANENTE entre menú y tareas. Sin popup ni abrir menú. */
.team-widget{position:relative;display:block;overflow:visible;width:100%;margin:0 0 22px;background:#fff;border:1px solid #e4d8eb;border-radius:17px;box-shadow:0 3px 17px #3a145a0c;color:#35213f}
.team-widget .team-pop-head{border-radius:16px 16px 0 0;padding:13px 17px;background:linear-gradient(90deg,#f9f4fb,#fff8f4);border-bottom:1px solid #eadfeb}
.team-widget .team-pop-head strong{font-size:16px}
.team-widget .team-pop-head small{font-size:11px;margin-top:2px}
.team-widget .team-online-badge{white-space:nowrap;display:inline-flex;align-items:center;gap:5px;background:#e6f5ed;border:1px solid #c8e8d8;border-radius:999px;padding:6px 10px;color:#205f48;font-size:11px;font-weight:700}
.team-widget .team-online-badge strong{font-size:12px;color:#205f48}
.team-widget .team-online-badge .team-status-dot{width:7px;height:7px;margin:0}
.team-widget .team-list{max-height:none;overflow:visible;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:11px 13px 9px}
.team-widget .team-user{min-width:0;min-height:70px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:center;padding:10px 11px;border:1px solid #eee5f2;border-radius:11px;background:#fff;box-shadow:0 1px 3px #3a145a05}
.team-widget .team-user:last-child{border-bottom:1px solid #eee5f2}
.team-widget .team-user-main{gap:8px;align-items:flex-start}
.team-widget .team-user-name{font-size:13px}
.team-widget .team-user-state{font-size:10.5px;line-height:1.35;margin-top:3px;overflow-wrap:anywhere}
.team-widget .team-actions{display:flex;gap:5px}
.team-widget .team-actions button{width:35px;height:35px;min-width:35px;flex:none;border:1px solid #e8daed;background:#f5edf8;color:#482462;display:grid;place-items:center;padding:7px;border-radius:9px;cursor:pointer}
.team-widget .team-actions button.team-call{background:#ffba99;border-color:#f1a887;color:#3a145a}
.team-widget .team-actions button:disabled{background:#f3f1f4;border-color:#e9e5ec;color:#aaa3ae;cursor:not-allowed;opacity:1}
.team-widget .team-actions button:hover:not(:disabled){filter:brightness(.97);box-shadow:0 2px 7px #3a145a1a}
.team-widget .team-compose{border-top:1px solid #e4d8ea;padding:12px 16px;border-radius:0;background:#fbf7fc}
.team-widget .team-compose label{font-size:13px}
.team-widget .team-compose input{width:100%;max-width:100%;font-size:16px;min-height:42px}
.team-widget .team-compose button{min-height:38px;padding:8px 13px}
.team-widget .team-compose .primary{color:#3a145a;background:#ffba99;border-color:#e5a184}
.team-widget .team-compose .secondary{color:#593b6b;border:1px solid #decde6;background:#fff}
.team-widget .team-note{padding:5px 16px 11px;border:0;font-size:10.5px}
@media(max-width:1000px){.team-widget .team-list{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:790px){
 .team-widget{margin-bottom:16px;border-radius:14px}
 .team-widget .team-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;padding:9px}
 .team-widget .team-user{display:flex;flex-direction:column;align-items:stretch;gap:6px;padding:9px;min-height:97px}
 .team-widget .team-actions{justify-content:flex-end}
 .team-widget .team-actions button{width:33px;height:33px;min-width:33px}
 .team-widget .team-user-name{font-size:12px;white-space:normal;overflow-wrap:break-word}
 .team-widget .team-user-state{font-size:10px}
 .team-widget .team-pop-head{padding:11px 12px}
 .team-widget .team-pop-head strong{font-size:15px}
 .team-widget .team-note{font-size:10px;padding:4px 12px 10px}
}
@media(max-width:350px){
 .team-widget .team-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;padding:6px}
 .team-widget .team-user{padding:7px;min-height:103px}
 .team-widget .team-pop-head{gap:6px}
 .team-widget .team-pop-head strong{font-size:14px}
 .team-widget .team-online-badge{font-size:10px;padding:5px 7px}
}
@media print{.team-widget{display:none!important}}

/* Ajuste final móvil: preservar espacio para las tareas. */
@media(max-width:790px){
 .team-widget .team-user{min-height:83px;padding:7px;gap:4px}
 .team-widget .team-actions button{width:31px;height:31px;min-width:31px;padding:6px}
 .team-widget .team-user-state{line-height:1.2}
 .team-widget .team-note{display:none}
}

/* V5.0.5: casillas de privacidad / colaboradores legibles en iOS y escritorio. */
#allowed,#followers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;width:100%;min-width:0}
#allowed label,#followers label{display:flex;align-items:center;gap:12px;min-width:0;min-height:46px;width:100%;padding:10px 12px;margin:0;border:1px solid #e8dbed;border-radius:10px;line-height:1.35;overflow-wrap:anywhere;white-space:normal;font-weight:550}
#allowed input[type=checkbox],#followers input[type=checkbox],.field #allowed input[type=checkbox]{display:block;flex:none;width:19px!important;height:19px!important;min-width:19px;max-width:19px;margin:0;accent-color:#65318a;appearance:auto;-webkit-appearance:checkbox}
#accessbox{min-width:0;overflow:visible}
#accessbox .help{line-height:1.45}
.employee-invoice-mode .invoice-financial,.employee-invoice-mode .invoice-management{display:none!important}
.employee-invoice-mode #invoiceForm{max-width:700px}
.employee-invoice-mode #invoiceIntro{border-left:4px solid #7a4da0;padding:8px 12px;background:#f7f1fa;border-radius:5px}
@media(max-width:680px){#allowed,#followers{grid-template-columns:minmax(0,1fr)}#allowed label,#followers label{padding:12px;min-height:48px}}
