:root{--navy:#062d52;--navy2:#0a3f70;--orange:#f47a25;--bg:#f2f5f8;--card:#fff;--text:#172433;--muted:#657486;--line:#dce4eb;--green:#1e9f62;--yellow:#d99500;--red:#d84343;--blue:#1671c7;--shadow:0 10px 28px rgba(17,42,67,.08)}*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:Inter,Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--text)}a{color:inherit}.app-shell{min-height:100vh}.sidebar{position:fixed;left:0;top:0;bottom:0;width:250px;background:linear-gradient(180deg,#052b4e,#061e37);color:#fff;padding:22px 16px;z-index:20;display:flex;flex-direction:column}.brand{display:flex;gap:12px;align-items:center;border-bottom:1px solid rgba(255,255,255,.14);padding:0 7px 20px}.brand-mark{display:grid;place-items:center;width:43px;height:43px;background:var(--orange);border-radius:12px;font-size:24px;font-weight:900}.brand small{display:block;font-size:10px;letter-spacing:1.6px}.brand strong{display:block;font-size:20px;line-height:1.05}.sidebar nav{display:grid;gap:7px;margin-top:22px}.sidebar nav a{padding:13px 14px;border-radius:10px;text-decoration:none;display:flex;gap:11px;align-items:center;color:#e9f2f9}.sidebar nav a:hover{background:rgba(255,255,255,.1)}.sidebar-status{margin-top:auto;font-size:13px;padding:12px}.sidebar-status small{color:#a8bfd2}.online-dot{display:inline-block;width:9px;height:9px;background:#39d97b;border-radius:50%;margin-right:8px}.main-content{margin-left:250px;min-height:100vh;padding:24px}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.topbar h1{margin:0;font-size:28px;color:var(--navy)}.topbar p{margin:4px 0 0;color:var(--muted)}.topbar-user{text-align:right;display:grid;gap:2px}.topbar-user span{font-size:12px;color:var(--muted)}.topbar-user a{font-size:12px;color:var(--orange);text-decoration:none}.menu-button{display:none;border:0;background:var(--navy);color:#fff;border-radius:8px;padding:9px 12px;font-size:18px}.grid{display:grid;gap:18px}.kpis{grid-template-columns:repeat(5,minmax(0,1fr));margin-bottom:18px}.card{background:var(--card);border:1px solid #e4e9ee;border-radius:16px;box-shadow:var(--shadow)}.kpi{padding:19px}.kpi-label{color:var(--muted);font-size:13px}.kpi-value{font-size:31px;font-weight:800;color:var(--navy);margin-top:7px}.kpi small{color:var(--muted)}.dashboard-layout{grid-template-columns:1.05fr 1.5fr .95fr;align-items:start}.card-header{padding:14px 17px;background:var(--navy);color:#fff;border-radius:15px 15px 0 0;display:flex;justify-content:space-between;align-items:center}.card-body{padding:17px}.obra-row{padding:13px 0;border-bottom:1px solid var(--line)}.obra-row:last-child{border-bottom:0}.obra-title{display:flex;justify-content:space-between;align-items:center;font-weight:700}.progress{height:8px;background:#e8edf2;border-radius:99px;overflow:hidden;margin:9px 0 6px}.progress span{display:block;height:100%;background:linear-gradient(90deg,var(--blue),#4fa0e8);border-radius:99px}.meta-row{display:flex;justify-content:space-between;color:var(--muted);font-size:12px}.status{font-size:11px;font-weight:800;border-radius:99px;padding:5px 8px}.status.normal{background:#def5e9;color:#158653}.status.adelantada{background:#dfeeff;color:#1063b2}.status.atencion{background:#fff0cc;color:#a56a00}.status.critico{background:#ffe0e0;color:#b42b2b}.hero-photo{aspect-ratio:16/9;background:linear-gradient(135deg,#b8c7d6,#809ab2);border-radius:12px;overflow:hidden;display:grid;place-items:center;color:#fff;text-align:center}.hero-photo img{width:100%;height:100%;object-fit:cover}.photo-placeholder{font-size:18px;font-weight:700;padding:20px}.thumbs{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:9px}.thumb{aspect-ratio:16/10;border-radius:9px;overflow:hidden;background:#dbe4ec}.thumb img{width:100%;height:100%;object-fit:cover}.metric-list{display:grid}.metric{display:flex;justify-content:space-between;padding:13px 0;border-bottom:1px solid var(--line)}.metric:last-child{border:0}.metric strong{font-size:19px;color:var(--navy)}.metric .negative{color:var(--red)}.section{margin-top:18px}.section-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.section-title h2{margin:0;color:var(--navy);font-size:19px}.table-wrap{overflow:auto}.table{width:100%;border-collapse:collapse}.table th,.table td{padding:12px;border-bottom:1px solid var(--line);text-align:left;font-size:13px}.table th{background:#f7f9fb;color:#536273}.button{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:0;border-radius:10px;padding:11px 15px;background:var(--navy);color:#fff;text-decoration:none;cursor:pointer;font-weight:700}.button.orange{background:var(--orange)}.button.light{background:#eaf0f5;color:var(--navy)}.button.danger{background:var(--red)}.button.small{padding:7px 10px;font-size:12px}.form-card{max-width:1100px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px}.field{display:grid;gap:7px}.field.full{grid-column:1/-1}.field label{font-size:13px;font-weight:700;color:#425164}.field input,.field select,.field textarea{width:100%;padding:12px 13px;border:1px solid #ccd7e0;border-radius:10px;background:#fff;font:inherit}.field textarea{min-height:105px;resize:vertical}.activity-row{border:1px solid var(--line);padding:14px;border-radius:12px;margin-bottom:10px;background:#fbfcfd}.activity-grid{display:grid;grid-template-columns:1.3fr 1.5fr 1fr .65fr .65fr .7fr auto;gap:9px;align-items:end}.activity-grid .field label{font-size:11px}.alert{padding:13px 15px;border-radius:11px;margin-bottom:17px}.alert.success{background:#dff5e8;color:#176c46}.alert.danger{background:#ffe2e2;color:#9e2d2d}.empty{padding:28px;text-align:center;color:var(--muted)}.photo-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.photo-card{overflow:hidden}.photo-card img{width:100%;aspect-ratio:4/3;object-fit:cover;display:block}.photo-info{padding:12px}.tag{display:inline-block;background:#e9f1f8;color:#174f7d;border-radius:99px;padding:4px 8px;font-size:11px;font-weight:700}.login-body{min-height:100vh;background:linear-gradient(135deg,#041d35,#0a467b);display:grid;place-items:center;padding:20px}.login-card{width:min(440px,100%);background:#fff;border-radius:20px;padding:32px;box-shadow:0 28px 70px rgba(0,0,0,.3)}.login-logo{display:flex;gap:12px;align-items:center;margin-bottom:24px}.login-logo h1{margin:0;color:var(--navy);font-size:23px}.login-logo p{margin:2px 0 0;color:var(--muted)}.install-note{background:#fff6e9;border:1px solid #f6d8ae;padding:12px;border-radius:10px;color:#855516;font-size:13px}.totem-body{margin:0;background:#061c32;color:#fff;min-height:100vh}.totem-header{display:flex;justify-content:space-between;align-items:center;padding:17px 25px;background:#06294a}.totem-header h1{margin:0;font-size:28px}.totem-header p{margin:3px 0 0;color:#bad0e2}.totem-main{padding:18px}.totem-kpis{grid-template-columns:repeat(5,1fr)}.totem-kpis .card{color:var(--text)}.totem-layout{grid-template-columns:1fr 1.5fr 1fr;margin-top:18px}.totem-footer{display:flex;justify-content:space-between;padding:12px 25px;color:#a8bfd2;background:#04182b}.pulse{animation:pulse 2s infinite}@keyframes pulse{50%{opacity:.45}}@media(max-width:1200px){.kpis{grid-template-columns:repeat(3,1fr)}.dashboard-layout,.totem-layout{grid-template-columns:1fr 1fr}.dashboard-layout>.card:nth-child(3){grid-column:1/-1}.activity-grid{grid-template-columns:repeat(3,1fr)}.photo-grid{grid-template-columns:repeat(3,1fr)}}@media(max-width:800px){.sidebar{transform:translateX(-100%);transition:.2s}.menu-open .sidebar{transform:translateX(0)}.main-content{margin-left:0;padding:15px}.menu-button{display:block}.topbar h1{font-size:21px}.topbar-user{display:none}.kpis{grid-template-columns:repeat(2,1fr)}.dashboard-layout,.totem-layout,.form-grid{grid-template-columns:1fr}.dashboard-layout>.card:nth-child(3){grid-column:auto}.activity-grid{grid-template-columns:1fr 1fr}.photo-grid{grid-template-columns:repeat(2,1fr)}.totem-kpis{grid-template-columns:repeat(2,1fr)}}@media(max-width:520px){.kpis,.photo-grid{grid-template-columns:1fr}.activity-grid{grid-template-columns:1fr}.kpi-value{font-size:26px}}

/* ===== Dashboard ejecutivo V2 ===== */
.executive-dashboard{max-width:1700px;margin:0 auto}.dashboard-toolbar{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:18px;padding:2px 2px 0}.dashboard-toolbar h2{margin:3px 0 4px;color:var(--navy);font-size:24px}.dashboard-toolbar p{margin:0;color:var(--muted);font-size:13px}.eyebrow{font-size:10px;letter-spacing:1.5px;font-weight:800;color:var(--orange)}.dashboard-live{display:flex;align-items:center;gap:10px;background:#fff;padding:10px 14px;border:1px solid var(--line);border-radius:13px;box-shadow:var(--shadow)}.dashboard-live div{display:grid}.dashboard-live strong{font-size:12px;color:var(--navy)}.dashboard-live small{font-size:11px;color:var(--muted);margin-top:2px}.executive-kpis{grid-template-columns:repeat(5,minmax(0,1fr));}.executive-kpi{display:flex;align-items:center;gap:14px;padding:17px 18px;min-height:112px}.executive-kpi .kpi-value{font-size:30px;margin:3px 0 1px}.kpi-icon{width:52px;height:52px;border-radius:50%;display:grid;place-items:center;flex:0 0 auto;color:#fff;font-weight:900;font-size:21px;box-shadow:inset 0 -5px 12px rgba(0,0,0,.12)}.kpi-icon.blue{background:#1266b0}.kpi-icon.cyan{background:#2388c9}.kpi-icon.orange{background:var(--orange)}.kpi-icon.navy{background:var(--navy)}.negative-value{color:var(--red)!important}.positive-value{color:var(--green)!important}.executive-main-grid{grid-template-columns:1.02fr 1.52fr .95fr;align-items:stretch}.executive-main-grid>.card{min-width:0}.works-panel .card-body{padding:10px 17px}.obra-selector{display:block;width:100%;background:transparent;border:0;text-align:left;font:inherit;color:inherit;cursor:pointer;border-radius:11px;padding:13px 10px;margin:1px 0;transition:.16s}.obra-selector:hover{background:#f2f7fb}.obra-selector.active{background:#eaf4fd;box-shadow:inset 4px 0 0 var(--blue)}.obra-selector.active .work-name{color:var(--blue)}.work-name{font-weight:800;color:var(--navy)}.gallery-panel .card-body{padding:12px}.executive-hero{aspect-ratio:16/9;border-radius:10px}.executive-hero .photo-placeholder{display:grid;gap:6px}.executive-hero .photo-placeholder span{font-size:12px;font-weight:400;color:#e9f1f8}.photo-caption{min-height:25px;padding:8px 2px 0;color:var(--muted);font-size:12px}.photo-caption strong{color:var(--navy)}.photo-caption span{display:block;margin-top:2px}.photo-thumb-button{border:2px solid transparent;padding:0;cursor:pointer;transition:.16s}.photo-thumb-button.active{border-color:var(--orange)}.photo-thumb-button:hover{transform:translateY(-1px)}.detail-panel .card-body{padding:16px 18px}.header-badge{font-size:10px;padding:5px 8px;border-radius:99px;background:#1769aa;color:#fff;font-weight:800}.header-badge.normal{background:#1f9c63}.header-badge.adelantada{background:#1671c7}.header-badge.atencion{background:#d99500}.header-badge.critico{background:#d84343}.metric.compact strong{font-size:13px;text-align:right}.metric strong small{font-size:10px;color:var(--muted);font-weight:500}.metric .positive{color:var(--green)}.alerts-block{margin-top:14px;border-top:1px solid var(--line);padding-top:12px}.alerts-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:5px;color:var(--navy)}.alerts-heading span{display:grid;place-items:center;min-width:24px;height:24px;border-radius:99px;background:#fff1e7;color:var(--orange);font-size:12px;font-weight:800}.alert-item{display:grid;grid-template-columns:10px 1fr;gap:10px;padding:10px 0;border-bottom:1px solid var(--line)}.alert-item:last-child{border-bottom:0}.alert-dot{width:8px;height:8px;border-radius:50%;background:var(--orange);margin-top:5px}.severity-critica .alert-dot{background:var(--red)}.severity-alta .alert-dot{background:#ed7d1b}.severity-media .alert-dot{background:#d9a000}.severity-baja .alert-dot{background:var(--blue)}.alert-item div{display:grid;gap:3px}.alert-item strong{font-size:12px;color:#273849}.alert-item small{font-size:10px;color:var(--muted)}.compact-empty{padding:17px 5px}.executive-bottom-grid{grid-template-columns:minmax(0,1.65fr) minmax(340px,.85fr);margin-top:18px}.chart-panel .card-body{padding:14px 16px 10px}.chart-legend{display:flex;gap:20px;font-size:11px;color:var(--muted);margin:0 0 5px 8px}.chart-legend span{display:flex;align-items:center;gap:7px}.chart-legend i{display:inline-block;width:25px;height:3px;border-radius:9px}.legend-real{background:var(--blue)}.legend-plan{border-top:2px dashed #98a8b8;height:0!important}.progress-chart{width:100%;min-height:260px}.progress-chart svg{display:block;width:100%;height:auto;overflow:visible}.chart-grid-line{stroke:#e4eaf0;stroke-width:1}.chart-axis-label{fill:#728194;font-size:10px}.chart-real-line{fill:none;stroke:var(--blue);stroke-width:4;stroke-linecap:round;stroke-linejoin:round}.chart-real-dot{fill:var(--blue);stroke:#fff;stroke-width:3}.chart-value{fill:#173b5e;font-size:10px;font-weight:800}.chart-plan-line{stroke:#9cabb9;stroke-width:2;stroke-dasharray:7 7}.chart-plan-label{fill:#748394;font-size:10px;font-weight:700}.activity-panel .card-body{padding:6px 16px}.activity-item{display:grid;grid-template-columns:34px 1fr auto;gap:10px;align-items:center;padding:11px 0;border-bottom:1px solid var(--line)}.activity-item:last-child{border-bottom:0}.activity-icon{width:30px;height:30px;border-radius:9px;display:grid;place-items:center;font-weight:900;background:#e9f3fb;color:var(--blue)}.activity-icon.state-aprobada{background:#e0f5e9;color:var(--green)}.activity-icon.state-pendiente{background:#fff1d5;color:#b67a00}.activity-icon.state-rechazada{background:#ffe3e3;color:var(--red)}.activity-copy{display:grid;min-width:0}.activity-copy strong{font-size:12px;color:var(--navy)}.activity-copy span{font-size:10px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.activity-item time{text-align:right;font-size:11px;color:#425164}.activity-item time small{display:block;color:var(--muted);margin-top:2px}.card-header span{font-size:11px}.executive-main-grid .card,.executive-bottom-grid .card{overflow:hidden}
@media(max-width:1350px){.executive-kpis{grid-template-columns:repeat(3,1fr)}.executive-main-grid{grid-template-columns:1fr 1.45fr}.detail-panel{grid-column:1/-1}.detail-panel .card-body{display:grid;grid-template-columns:1fr 1fr;gap:25px}.alerts-block{margin-top:0;border-top:0;border-left:1px solid var(--line);padding:0 0 0 25px}}
@media(max-width:1000px){.executive-bottom-grid{grid-template-columns:1fr}.executive-main-grid{grid-template-columns:1fr}.detail-panel{grid-column:auto}.detail-panel .card-body{display:block}.alerts-block{margin-top:14px;border-top:1px solid var(--line);border-left:0;padding:12px 0 0}.executive-kpis{grid-template-columns:repeat(2,1fr)}}
@media(max-width:650px){.dashboard-toolbar{align-items:flex-start}.dashboard-live{display:none}.executive-kpis{grid-template-columns:1fr 1fr;gap:10px}.executive-kpi{min-height:96px;padding:13px;gap:10px}.kpi-icon{width:40px;height:40px;font-size:16px}.executive-kpi .kpi-value{font-size:24px}.executive-kpi small{display:none}.executive-bottom-grid{grid-template-columns:1fr}.progress-chart{min-height:210px}.card-header{padding:12px 14px}.dashboard-toolbar h2{font-size:20px}}
@media(max-width:440px){.executive-kpis{grid-template-columns:1fr}.executive-kpi{min-height:82px}.executive-hero{aspect-ratio:4/3}.activity-item{grid-template-columns:30px 1fr}.activity-item time{grid-column:2;text-align:left}}

/* ===== Accesos filtrados por cargo V3 ===== */
.no-sidebar .main-content{margin-left:0;max-width:none;padding:20px 28px}.topbar-focus{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:22px;padding:14px 18px;background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);position:relative}.topbar-brand{display:flex;align-items:center;gap:10px;color:var(--navy);padding-right:20px;border-right:1px solid var(--line)}.topbar-brand small{display:block;font-size:9px;letter-spacing:1.5px;font-weight:800}.topbar-brand strong{display:block;font-size:17px;line-height:1.05}.small-mark{width:38px;height:38px;border-radius:10px;font-size:20px}.topbar-title{min-width:0}.topbar-focus .topbar-title h1{font-size:23px}.topbar-focus .topbar-title p{font-size:12px}.topbar-focus .topbar-user{align-self:center}.role-gerencia .main-content{background:radial-gradient(circle at top right,#e7f1fa 0,transparent 34%),var(--bg)}.role-gerencia .executive-dashboard{max-width:1780px}.role-admin-obra .main-content,.role-jefe-obra .main-content{max-width:1250px;margin:0 auto}.role-admin-obra .topbar,.role-jefe-obra .topbar{margin-bottom:18px}.field-entry-card{margin:0 auto}.role-focus-banner{display:flex;justify-content:space-between;align-items:center;gap:24px;background:linear-gradient(135deg,#072f55,#0b527f);color:#fff;border-radius:17px;padding:20px 23px;margin-bottom:18px;box-shadow:0 14px 35px rgba(6,45,82,.16)}.role-focus-banner h2{font-size:25px;margin:3px 0 5px}.role-focus-banner p{margin:0;max-width:790px;color:#d7e7f3;font-size:13px;line-height:1.5}.role-focus-banner .eyebrow{color:#ffae72}.focus-role{white-space:nowrap;padding:8px 12px;border-radius:99px;background:rgba(255,255,255,.13);border:1px solid rgba(255,255,255,.2);font-size:10px;font-weight:900;letter-spacing:.7px}.review-banner{background:linear-gradient(135deg,#073b55,#12706d)}.permissions-summary{display:grid;gap:8px;margin-bottom:20px}.permissions-summary>div{display:grid;gap:2px;padding:10px 12px;background:#f4f8fb;border:1px solid #e0e8ef;border-radius:10px}.permissions-summary strong{font-size:11px;color:var(--navy)}.permissions-summary span{font-size:11px;color:var(--muted)}.users-layout{grid-template-columns:minmax(340px,.8fr) minmax(0,1.4fr)}.field small{font-size:10px;color:var(--muted)}.field-disabled{opacity:.48}.role-pill{display:inline-flex;padding:5px 8px;border-radius:99px;font-size:10px;font-weight:800;background:#e9f1f8;color:#174f7d}.role-pill.role-gerencia{background:#e4efff;color:#155ea8}.role-pill.role-admin_obra{background:#fff0e4;color:#b55b17}.role-pill.role-jefe_obra{background:#e2f4ee;color:#157253}.role-pill.role-super_admin{background:#e7e8ef;color:#373d57}
@media(max-width:900px){.users-layout{grid-template-columns:1fr}.topbar-focus{grid-template-columns:auto 1fr}.topbar-focus .topbar-title{display:none}.topbar-brand{border-right:0;padding-right:0}.no-sidebar .topbar-user{display:grid}.role-focus-banner{align-items:flex-start}.focus-role{font-size:9px}}
@media(max-width:600px){.no-sidebar .main-content{padding:12px}.topbar-focus{padding:11px 12px;gap:10px}.topbar-brand small{display:none}.topbar-brand strong{font-size:14px}.small-mark{width:34px;height:34px;font-size:18px}.topbar-focus .topbar-user strong{font-size:12px;max-width:125px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topbar-focus .topbar-user span{font-size:9px}.topbar-focus .topbar-user a{font-size:10px}.role-focus-banner{display:grid;padding:17px}.role-focus-banner h2{font-size:21px}.role-focus-banner p{font-size:12px}.focus-role{justify-self:start}.role-admin-obra .form-card .card-body{padding:13px}}


/* ===== Rol unificado Encargado de Obra V4 ===== */
.role-encargado-obra .main-content{max-width:1250px;margin:0 auto}
.role-encargado-obra .topbar{margin-bottom:18px}
.role-encargado-obra .form-card .card-body{padding:18px}
.role-pill.role-encargado_obra{background:#fff0e4;color:#b55b17}
.publish-note{margin-top:22px;padding:14px 16px;border-radius:12px;background:#e9f6ef;border:1px solid #bfe5cf;color:#176b46;font-size:13px;line-height:1.45}
.status-aprobada{background:#dcf4e7;color:#167044}
.status-pendiente{background:#fff0d8;color:#a35e00}
.status-rechazada{background:#ffe1e1;color:#a33131}
@media(max-width:600px){.role-encargado-obra .main-content{padding:12px}.publish-note{font-size:12px}}

/* ===== V5: sin validaciones + acceso modo ejecutivo touch ===== */
.dashboard-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}.touch-launch{text-decoration:none;display:inline-flex;align-items:center;justify-content:center;min-height:42px}.role-gerencia .touch-launch{background:#fff7ef;border-color:#ffd4b6;color:#b65312}.role-gerencia .touch-launch:hover{background:#f47a25;color:#fff}
@media(max-width:900px){.dashboard-toolbar{align-items:flex-start}.dashboard-actions{width:100%;justify-content:flex-start}.touch-launch{width:100%}}
