:root{--bg:#f6f8fb;--card:#fff;--sidebar:#fff;--text:#17243b;--muted:#79879b;--line:#e7ebf2;--navy:#112d4e;--blue:#2563eb;--blue-soft:#eff5ff;--green:#1a956b;--green-soft:#e9f9f2;--yellow:#bb7d13;--yellow-soft:#fff7e7;--red:#d64752;--red-soft:#fff0ef;--shadow:0 16px 40px #1a294012; font-family:Inter,'Segoe UI',Arial,sans-serif;color:var(--text)}*{box-sizing:border-box}body{margin:0;background:var(--bg)}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{opacity:.5;cursor:default}input,select,textarea{color:var(--text)}[hidden]{display:none!important}.layout{display:flex;min-height:100vh}.sidebar{width:255px;min-width:255px;background:var(--sidebar);border-right:1px solid var(--line);display:flex;flex-direction:column;padding:28px 16px 16px;position:sticky;top:0;height:100vh}.brand{display:flex;align-items:center;gap:12px;margin:2px 11px 39px}.brand-mark{font-size:25px;letter-spacing:-3px;font-weight:900;width:43px;height:43px;display:grid;place-items:center;background:var(--navy);color:#fff;border-radius:13px;flex-shrink:0}.brand-mark span{color:#43d4a0}.brand strong{display:block;letter-spacing:1px;font-size:17px}.brand small{display:block;color:#8c97a6;font-size:10px;margin-top:4px}.side-label{font-size:10px;letter-spacing:1.4px;font-weight:800;color:#9ba6b5;margin:0 14px 12px}.section-label{margin-top:37px}.nav{display:grid;gap:5px}.nav-item{width:100%;height:42px;display:flex;align-items:center;text-align:left;border:none;background:transparent;color:#5c6b80;font-size:12px;font-weight:650;border-radius:9px;padding:0 12px;gap:12px}.nav-item:hover{background:#f2f5fa}.nav-item.active{background:#edf3ff;color:#1d5edb}.nav-icon{font-size:19px;width:21px;text-align:center;font-weight:400}.nav-count{margin-left:auto;background:#e9edf4;color:#68768a;border-radius:7px;padding:2px 8px;font-size:10px}.nav-count.danger{background:#fff0ed;color:#cc5c57}.sidebar-bottom{margin-top:auto}.side-hint{display:flex;align-items:center;gap:9px;background:#f2f7f8;border-radius:11px;padding:14px 11px;margin:10px 0 19px}.hint-dot{height:9px;width:9px;background:#3fbe9b;border:3px solid #c5ecdf;box-sizing:content-box;border-radius:100%}.side-hint strong,.profile strong{display:block;font-size:11px}.side-hint small,.profile small{display:block;color:#8a9ba5;font-size:10px;margin-top:5px}.profile{display:flex;align-items:center;gap:9px;padding:16px 4px 0;border-top:1px solid var(--line)}.avatar{background:#dce9ff;color:#2860bd;width:34px;height:34px;display:grid;place-items:center;border-radius:10px;font-weight:800}.profile-meta{flex:1;min-width:0}.profile-meta strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.icon-button{width:32px;height:32px;border:0;background:transparent;border-radius:8px;color:#7d8a9c;font-size:23px}.icon-button:hover{background:#eef1f7;color:#23354c}.main{flex:1;min-width:0}.topbar{height:77px;border-bottom:1px solid var(--line);background:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 42px}.breadcrumb{font-size:12px;color:#9aabba}.breadcrumb span{margin:0 11px;color:#c2cbd6}.breadcrumb strong{color:#4f6074;font-weight:650}.top-actions{display:flex;align-items:center;gap:19px}.local-indicator{font-size:11px;color:#6e8b7a;display:flex;align-items:center;gap:7px}.local-indicator span{height:7px;width:7px;background:#36bc8e;border-radius:100%}.btn{border:1px solid var(--line);border-radius:9px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 16px;font-size:12px;font-weight:750;white-space:nowrap;transition:.15s}.btn-primary{border-color:#1b5bdf;background:#2160e6;color:#fff;box-shadow:0 4px 9px #1d5de925}.btn-primary:hover{background:#194eca}.btn-ghost{background:#fff;color:#64738a}.btn-ghost:hover{background:#f3f6fa}.btn-outline{background:#fff;color:#2763df;border-color:#d6e3ff}.btn-danger{background:#fff;color:#c64e58;border-color:#ffd8dd}.full{width:100%}.page-content{max-width:1600px;margin:auto;padding:39px 42px}.page-heading{display:flex;justify-content:space-between;align-items:end;gap:15px;margin-bottom:27px}.eyebrow{color:#3a8ea7;font-size:10px;font-weight:850;letter-spacing:1.8px;margin-bottom:12px}.page-heading h1{font-size:29px;letter-spacing:-.85px;margin:0 0 9px;font-weight:800}.page-heading p{font-size:12px;color:#95a0af;margin:0}.date-pill{background:#fff;border:1px solid var(--line);color:#8391a3;border-radius:8px;font-size:11px;padding:11px 14px}.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px;margin-bottom:26px}.stat-card{background:#fff;border:1px solid var(--line);border-radius:12px;padding:19px 20px 17px;display:flex;justify-content:space-between;gap:10px;min-height:110px;box-shadow:0 4px 14px #213a6105}.stat-card small{display:block;color:#9aa8b9;font-size:11px;font-weight:650}.stat-card strong{display:block;font-size:30px;margin-top:9px;line-height:1;font-weight:800;letter-spacing:-1px}.stat-icon{height:38px;width:38px;border-radius:11px;background:#eef3ff;color:#376cdb;display:grid;place-items:center;font-size:22px}.stat-card.green .stat-icon{background:#e8f8f1;color:#20a572}.stat-card.orange .stat-icon{background:#fff5e3;color:#d89520}.stat-card.red .stat-icon{background:#fff0f1;color:#db5664}.case-section{background:#fff;border:1px solid var(--line);border-radius:13px;overflow:hidden;box-shadow:0 4px 15px #213a6105}.section-header{display:flex;justify-content:space-between;align-items:center;padding:24px 23px 19px}.section-header h2{margin:0 0 6px;font-size:15px;font-weight:780}.muted-count{color:#8d9cac;background:#f3f5f8;font-size:10px;border-radius:7px;padding:4px 8px;margin-left:7px}.section-header p{margin:0;color:#a2abba;font-size:11px}.soft-pill{background:#f1f8f5;color:#60a38e;padding:8px 10px;border-radius:8px;font-size:10px;font-weight:700}.filters{display:flex;gap:9px;align-items:center;padding:0 23px 21px}.filters select,.filters input{height:36px;background:#fff;border:1px solid #e3eaf2;border-radius:8px;padding:0 12px;font-size:11px;outline:0}.filters select{max-width:175px}.search-wrap{flex:1;min-width:160px;position:relative}.search-wrap span{position:absolute;top:3px;left:12px;color:#a7b4c4;font-size:23px}.search-wrap input{width:100%;padding-left:38px}.filters input:focus,.filters select:focus,input:focus,select:focus,textarea:focus{border-color:#8ab0ee;outline:2px solid #e8f0ff}.table-scroll{overflow-x:auto}.cases-table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap}.cases-table th{background:#f8fafc;border-top:1px solid #edf1f6;border-bottom:1px solid #edf1f6;color:#a1acbc;font-size:9px;letter-spacing:1.1px;padding:14px 15px;font-weight:800}.cases-table th:first-child,.cases-table td:first-child{padding-left:23px}.cases-table td{border-bottom:1px solid #eef1f5;padding:17px 15px;font-size:11px;color:#69788e}.cases-table tr:last-child td{border-bottom:none}.cases-table tbody tr{cursor:pointer}.cases-table tbody tr:hover{background:#fafcff}.case-main strong{font-size:12px;color:#273b55;display:block;margin-bottom:6px}.case-main span{font-size:10px;color:#95a4b3;display:block;max-width:270px;overflow:hidden;text-overflow:ellipsis}.ref{font-size:9px;color:#3668ca;font-weight:780;letter-spacing:.4px;margin-bottom:6px;display:block}.area-name{font-size:9px;font-weight:850;color:#68778b;letter-spacing:.4px}.category-name{font-size:10px;color:#8190a1;display:block;margin-top:6px}.chip{display:inline-flex;align-items:center;gap:6px;padding:7px 9px;border-radius:7px;font-size:10px;font-weight:750}.chip:before{content:'';height:6px;width:6px;border-radius:100%;background:currentColor}.chip.nuevo{background:#edf3ff;color:#3b6ac9}.chip.en_gestion{background:#eaf1ff;color:#3266db}.chip.pendiente_comercio,.chip.pendiente_interno,.chip.pendiente_externo{background:var(--yellow-soft);color:var(--yellow)}.chip.resuelto{background:var(--green-soft);color:var(--green)}.chip.cerrado{background:#eef0f4;color:#798599}.prio{font-size:11px;font-weight:700;color:#8693a6}.prio.urgente{color:#dc4957}.prio.alta{color:#d78b22}.prio.baja{color:#6b9e9a}.owner{display:flex;align-items:center;gap:6px;color:#607087;font-weight:600}.mini-avatar{width:22px;height:22px;border-radius:100%;background:#edf0fa;color:#5275ac;display:grid;place-items:center;font-size:10px;font-weight:800}.due{font-size:10px;color:#8290a3}.due.overdue{color:#d74e58;font-weight:800}.row-arrow{font-size:20px;color:#b0bdd1}.table-footer{display:flex;justify-content:space-between;align-items:center;border-top:1px solid #eef1f6;padding:10px 20px;font-size:10px;color:#9eabba}.empty-state{padding:55px 20px;text-align:center}.empty-icon{display:grid;place-items:center;margin:auto auto 12px;height:55px;width:55px;border-radius:16px;background:#eff4fd;font-size:25px;color:#5281cd}.empty-state h3{margin:0 0 8px;font-size:16px}.empty-state p{font-size:12px;color:#8f9aab;margin:0 0 22px}.backdrop{position:fixed;inset:0;background:#12243b8c;z-index:20;display:flex;justify-content:center;align-items:center;padding:22px}.modal{background:#fff;max-width:810px;width:100%;max-height:93vh;overflow-y:auto;border-radius:15px;box-shadow:var(--shadow)}.modal-top{display:flex;justify-content:space-between;align-items:start;padding:28px 29px 11px}.modal-top h2{margin:0;font-size:23px}.case-form{padding:0 28px 25px}.case-fields-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:17px;row-gap:15px}.case-fields-grid label,.stack-form label{font-size:11px;color:#536680;font-weight:750;display:block}.case-fields-grid input,.case-fields-grid select,.case-fields-grid textarea,.stack-form input{display:block;margin-top:7px;width:100%;padding:10px 12px;border:1px solid #e1e8f0;border-radius:8px;font-size:12px;min-height:39px;background:#fff}.case-fields-grid textarea{min-height:83px;resize:vertical}.case-fields-grid .span-2{grid-column:span 2}.form-actions{display:flex;gap:10px;justify-content:flex-end;padding-top:23px;margin-top:22px;border-top:1px solid var(--line)}.drawer{background:#fff;width:min(1160px,100%);height:min(95vh,950px);border-radius:16px;overflow-y:auto;box-shadow:0 25px 80px #0d1b3670}.drawer-header{padding:25px 30px;border-bottom:1px solid var(--line);position:sticky;top:0;background:#fff;z-index:3;display:flex;justify-content:space-between;align-items:start}.drawer-header h2{font-size:21px;margin:5px 0 6px}.drawer-subtitle{color:#8b9aa9;font-size:11px}.drawer-head-right{display:flex;gap:9px;align-items:center}.detail-layout{display:grid;grid-template-columns:minmax(350px,1fr) minmax(330px,.9fr);gap:0}.details-left{padding:26px 29px;border-right:1px solid var(--line)}.details-right{padding:26px 29px;background:#fcfdff}.detail-section-head{display:flex;align-items:center;justify-content:space-between;margin:0 0 18px}.detail-section-head h3{font-size:14px;margin:0}.detail-desc{padding:15px 16px;background:#f7f9fc;border-radius:9px;font-size:12px;line-height:1.7;color:#607287;white-space:pre-wrap;margin:0 0 23px;max-height:150px;overflow:auto}.detail-form .case-fields-grid{row-gap:12px;column-gap:11px}.detail-form input,.detail-form select,.detail-form textarea{font-size:11px;padding:8px 10px;min-height:35px}.detail-form label{font-size:10px}.detail-actions{display:flex;gap:8px;margin-top:19px;flex-wrap:wrap}.timeline{position:relative;padding-left:15px;border-left:2px solid #e6edf5;margin:17px 0 22px 6px;max-height:440px;overflow-y:auto}.timeline-item{position:relative;margin:0 0 19px;padding:0 0 0 8px}.timeline-item:before{content:'';position:absolute;left:-21px;top:3px;height:10px;width:10px;background:#c9d8f0;border:3px solid #fff;border-radius:100%}.timeline-item.kind-derivacion:before,.timeline-item.kind-cambio:before{background:#efbc56}.timeline-item.kind-respuesta_comercio:before,.timeline-item.kind-resuelto:before{background:#53bd99}.timeline-meta{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-bottom:8px}.timeline-meta strong{font-size:10px}.timeline-meta span{font-size:9px;color:#93a0b2}.timeline-type{display:inline-block!important;color:#4f7fc8!important;background:#eef5ff;border-radius:5px;padding:3px 5px}.timeline-text{font-size:11px;line-height:1.65;white-space:pre-wrap;color:#63768c;word-break:break-word}.note-form{padding:17px;border:1px solid #e8edf4;background:#fff;border-radius:11px}.note-form h4{margin:0 0 13px;font-size:12px}.note-form select,.note-form input,.note-form textarea{width:100%;padding:9px;border:1px solid #dfe7f1;border-radius:7px;font-size:11px;background:#fff}.note-form textarea{min-height:85px;resize:vertical;margin:10px 0}.note-form-bottom{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.note-form-bottom select{width:auto;max-width:170px}.note-form-bottom button{margin-left:auto}.files-head{display:flex;justify-content:space-between;align-items:center;margin:24px 0 11px;font-size:12px;font-weight:800}.attachment-list{display:grid;gap:8px}.attachment-list a{font-size:11px;color:#2b63b8;text-decoration:none;background:#f2f6fd;padding:11px 12px;border-radius:8px;display:flex;justify-content:space-between;gap:10px}.attachment-list a:hover{text-decoration:underline}.hint-text{font-size:10px;color:#9aa7b6}.upload-picker{font-size:11px;max-width:170px}.toast{position:fixed;bottom:23px;right:22px;background:#112d4e;color:#fff;box-shadow:var(--shadow);padding:14px 20px;border-radius:9px;font-size:12px;z-index:50;max-width:350px}.toast.error{background:#b93849}.auth-view{min-height:100vh;display:grid;place-items:center;padding:20px;background:radial-gradient(circle at 22% 15%,#e6f1ff 0,transparent 40%),radial-gradient(circle at 84% 87%,#e9f8f3 0,transparent 30%),#f7f9fd}.login-card{background:#fff;border:1px solid #e6ecf3;border-radius:20px;max-width:435px;width:100%;padding:42px;box-shadow:0 21px 75px #23477b18}.login-logo{width:49px;height:49px;margin-bottom:25px}.login-card h1{font-size:25px;margin:0 0 12px;letter-spacing:-.5px}.login-card p{font-size:12px;line-height:1.7;color:#8595a8;margin:0 0 25px}.stack-form{display:grid;gap:18px}.stack-form input{min-height:43px}.stack-form .btn{margin-top:8px;padding:13px}.login-card .auth-bottom{margin:24px 0 0;text-align:center;font-size:10px;color:#b0b9c5}.admin-panel{background:#fff;border:1px solid #e3e8f0;padding:25px;border-radius:14px;margin-bottom:20px}.admin-panel h2{margin:0 0 8px;font-size:16px}.admin-panel p{font-size:12px;color:#8c9bab;margin:0 0 19px;line-height:1.6}.admin-users{display:grid;gap:9px;margin:15px 0}.admin-user{border:1px solid #e9edf3;border-radius:9px;padding:13px;display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:12px}.admin-user small{display:block;color:#9aa5b5;margin-top:5px}.admin-user-actions{display:flex;gap:7px}.admin-user-actions button{font-size:10px}.new-user-fields{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.new-user-fields input,.new-user-fields select{width:100%;border:1px solid var(--line);border-radius:8px;padding:11px;font-size:11px}.no-scroll{overflow:hidden}@media(max-width:1200px){.topbar{padding:0 24px}.page-content{padding:29px 24px}.filters{flex-wrap:wrap}.filters .search-wrap{min-width:100%;flex-basis:100%}}@media(max-width:900px){.sidebar{width:70px;min-width:70px;padding:22px 10px}.brand{margin:0 0 34px;justify-content:center}.brand>div:last-child,.side-label,.nav-item{font-size:0}.nav-item{justify-content:center;padding:0}.nav-icon{font-size:19px}.nav-count,.sidebar-bottom .side-hint,.profile-meta,.profile .icon-button{display:none}.profile{justify-content:center}.stats-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:730px){.topbar{padding:0 13px}.breadcrumb{display:none}.page-content{padding:23px 13px}.sidebar{position:fixed;z-index:5;bottom:0;top:auto;width:100%;height:59px;min-width:0;flex-direction:row;padding:4px 8px;align-items:center;border-top:1px solid var(--line)}.brand,.side-label,.sidebar-bottom,.sidebar .nav:nth-of-type(2){display:none}.sidebar .nav{display:flex;width:100%;justify-content:space-around}.nav-item{width:auto;min-width:47px}.main{padding-bottom:60px}.page-heading h1{font-size:23px}.page-heading .date-pill{display:none}.stats-grid{gap:8px}.stat-card{padding:14px;min-height:90px}.stat-card strong{font-size:25px}.filters{padding:0 15px 17px}.section-header{padding:19px 15px}.section-header-end{display:none}.backdrop{padding:0}.modal,.drawer{border-radius:0;height:100vh;max-height:100vh}.detail-layout{grid-template-columns:1fr}.details-left{border-right:0;border-bottom:1px solid var(--line)}.details-left,.details-right{padding:18px}.drawer-header{padding:17px}.case-fields-grid{grid-template-columns:1fr}.case-fields-grid .span-2{grid-column:span 1}.new-user-fields{grid-template-columns:1fr 1fr}}@media(max-width:420px){.topbar{justify-content:flex-end;height:60px}.local-indicator{display:none}.stats-grid{grid-template-columns:1fr 1fr}.stat-icon{height:30px;width:30px}.filters select{flex:1;max-width:none}.form-actions{flex-wrap:wrap}.page-content{padding:15px 9px}}

.quick-fields{display:grid;grid-template-columns:1.3fr 1fr;gap:8px}.quick-fields label{font-size:10px;font-weight:750;color:#63758b}.quick-fields input,.quick-fields select{margin-top:5px;min-height:36px}.quick-fields select{width:100%!important;max-width:none!important}@media(max-width:430px){.quick-fields{grid-template-columns:1fr}}

.message-filters{display:flex;gap:12px;margin:20px 0;flex-wrap:wrap}.message-filters input{flex:1;min-width:200px}.message-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:18px}.message-card{background:white;border:1px solid #dce3ee;border-radius:14px;padding:24px;display:flex;flex-direction:column;min-width:0}.message-card small{color:#4165a4}.message-card h2{font-size:18px;margin:12px 0}.message-card p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6;flex:1}.message-card>div{display:flex;flex-wrap:wrap;gap:8px;margin-top:18px}.message-dialog{border:1px solid #dce3ee;border-radius:16px;padding:28px;width:min(600px,90vw);max-height:90vh}.message-dialog::backdrop{background:#17294588}.message-dialog label{display:grid;gap:8px;margin:16px 0}.message-dialog input,.message-dialog textarea{width:100%;box-sizing:border-box;padding:12px;border:1px solid #bac8db;border-radius:8px;font:inherit}.message-dialog textarea{resize:vertical}.message-error{color:#a4262c}

/* Bandeja del piloto y formularios de gestión */
.stat-card.blue { background: #eef4ff; border-color: #ceddf7; color: #193d78; }
.stat-card.green { background: #eaf8f0; border-color: #c6e9d5; color: #18563e; }
.stat-card.orange { background: #fff5e4; border-color: #f1dcb6; color: #734701; }
.stat-card.red { background: #fff0f2; border-color: #f3ced5; color: #8d263a; }
.stat-card small { color: inherit; font-size: 14px; font-weight: 750; }
.stat-card .stat-icon { color: inherit; background: #ffffffad; }
.cases-table th {
  background: #edf2fa;
  color: #2d4564;
  font-size: 13px;
  letter-spacing: .1px;
  line-height: 1.35;
  text-transform: none;
}
.case-main strong { font-size: 14px; }
.case-main span, .category-name, .due, .owner { color: #465971; font-size: 12px; }
.chip, .prio { font-size: 12px; }
.chip.pendiente_comercio, .chip.pendiente_interno, .chip.pendiente_externo { color: #744510; }
.chip.cancelado { background: #f2e9ee; color: #71334d; }
.chip.cerrado { color: #444f62; }
.task-chip {
  display: block;
  width: fit-content;
  margin: 6px 0 0;
  padding: 5px 8px;
  border-radius: 6px;
  color: #23497f;
  background: #e7effb;
  font-size: 12px;
  font-weight: 700;
}
.task-chip.needs-reply { color: #70440b; background: #fff0cc; }
.drawer-subtitle, .detail-desc, .timeline-text { color: #425671; font-size: 13px; }
.timeline-meta strong, .timeline-meta span { color: #465971; font-size: 11px; }
.detail-form label, .note-form label, .case-fields-grid label, .stack-form label {
  color: #344c69;
  font-size: 13px;
}
.detail-form input, .detail-form select, .detail-form textarea, .note-form textarea,
.case-fields-grid input, .case-fields-grid select, .case-fields-grid textarea { font-size: 13px; }
.pilot-panel { padding: 14px 16px; margin: 0 0 16px; border: 1px solid #dae4f0; border-radius: 10px; background: #f8fafd; }
.detail-form + .pilot-panel { margin-top: 18px; }
.pilot-panel h3, .client-fields h3 { font-size: 15px; margin: 0; }
.pilot-panel p { font-size: 13px; margin: 8px 0; }
.pilot-panel summary { font-size: 13px; font-weight: 700; cursor: pointer; }
.pilot-panel dd, .archive-summary dd { margin: 0 0 8px; overflow-wrap: anywhere; }
.pilot-panel dt, .archive-summary dt { font-size: 12px; font-weight: 700; }
.task-response { white-space: pre-wrap; overflow-wrap: anywhere; }
.inline-actions, .dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dialog-actions { justify-content: flex-end; margin-top: 16px; }
.section-actions { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.upload-actions { margin-top: 14px; }
.message-card small { width: fit-content; background: #edf3fd; border-radius: 5px; padding: 4px 8px; color: #254c85; font-weight: 700; }
.message-card p { color: #314762; font-size: 14px; }
.message-filters input, .message-filters select, .stack-form select, .pilot-dialog select, .client-search input {
  min-height: 40px; border: 1px solid #bac8db; border-radius: 8px; padding: 8px 12px;
  color: #243a56; background: white; font: inherit;
}
.pilot-dialog h2 { margin-top: 0; }
.pilot-dialog .message-error { margin: 8px 0 0; }
.pilot-dialog { color: #273c56; }
.pilot-dialog.client-dialog { width: min(740px, 94vw); }
.pilot-dialog .case-fields-grid { gap: 8px 12px; }
.pilot-dialog .case-fields-grid label { margin: 5px 0; }
.pilot-dialog select { display: block; width: 100%; }
.client-fields { display: grid; gap: 8px; border: 1px solid #dbe4f0; border-radius: 8px; margin: 14px 0; padding: 12px 14px; min-width: 0; }
.client-fields p { margin: 0; font-size: 13px; }
.client-fields .check-label { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.pilot-dialog .check-label input { width: auto; margin: 0; }
.client-row { padding: 9px 0; border-top: 1px solid #dbe4f0; }
.client-cases { list-style: none; margin: 0; padding: 0; }
.client-cases button { white-space: normal; text-align: left; }
.client-search { display: grid; gap: 6px; max-width: 420px; font-weight: 700; }
.field-action { align-self: end; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.cases-table tr:focus-visible { outline: 2px solid #245bb0; outline-offset: 2px; }
@media (max-width: 900px) {
  .sidebar { width: 185px; min-width: 185px; padding: 22px 10px; }
  .sidebar .nav-item { font-size: 12px; justify-content: flex-start; padding: 0 8px; }
  .sidebar .profile .icon-button { display: inline-flex; }
}
@media (max-width: 730px) {
  .sidebar { width: 100%; min-width: 0; padding: 5px 8px; }
  .sidebar .nav { overflow-x: auto; justify-content: flex-start; gap: 5px; }
  .sidebar .nav-item { white-space: nowrap; min-width: max-content; padding: 0 8px; height: 40px; }
  .nav-item .nav-icon { font-size: 14px; }
  .stat-card small { font-size: 13px; }
  .admin-user { align-items: flex-start; flex-wrap: wrap; }
  .admin-user-actions { flex-wrap: wrap; }
}
.task-inbox { margin: 0 0 20px; padding: 16px 20px; background: #edf4ff; color: #223d62; border: 1px solid #c4d7f4; border-radius: 12px; }
.task-inbox h2 { margin: 0; font-size: 17px; }
.task-inbox p { margin: 4px 0 0; font-size: 13px; }
.task-inbox ul { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.task-inbox li button { display: flex; width: 100%; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; border: 1px solid #d4e2f6; border-radius: 7px; padding: 8px 12px; background: #fff; color: #223d62; text-align: left; cursor: pointer; font: inherit; overflow-wrap: anywhere; }
.task-inbox li button:hover { background: #f5f8ff; }
.task-inbox li button:focus-visible { outline: 2px solid #245bb0; outline-offset: 2px; }
.task-inbox li button span { font-size: 12px; }
.nav-count.task-count { background: #245bb0; color: #fff; }
@media (max-width: 900px) { .sidebar .nav-count.task-count { display: inline-flex; } }

.case-filters { display: flex; flex-wrap: wrap; align-items: end; }
.case-filters label { display: grid; gap: 5px; flex: 1 1 165px; min-width: 0; color: #344c69; font-size: 12px; font-weight: 700; }
.case-filters select, .case-filters input { width: 100%; max-width: none; min-width: 0; font-size: 12px; }
.case-filters label:has(input) { flex-basis: 220px; }
.case-filters select:disabled { color: #344c69; background: #eef3fa; opacity: 1; }
.cases-table { min-width: 895px; }
.case-assignees, .task-detail-list { list-style: none; margin: 0; padding: 0; }
.case-assignees { display: grid; gap: 4px; color: #465971; font-size: 12px; }
.case-type { color: #2d4564; font-size: 13px; font-weight: 700; }
.task-detail-list { display: grid; gap: 10px; margin: 10px 0; }
.task-detail-list li { padding: 8px 10px; border-left: 2px solid #cedcf0; background: #fff; }
.task-detail-list .inline-actions, #task-panel > .inline-actions { margin-top: 8px; }

/* Presentación de las bandejas. Los demás módulos usan sus estilos existentes. */
.case-layout {
  --case-ink: #172b49;
  --case-secondary: #495b73;
  --case-line: #dce4ef;
  --case-navy: #16263c;
}
.case-layout .sidebar {
  width: 256px;
  min-width: 256px;
  padding: 23px 14px 15px;
  background: var(--case-navy);
  border-color: #293b52;
  color: #f3f7fc;
  overflow-y: auto;
}
.case-layout .brand { margin: 1px 7px 27px; }
.case-layout .brand-mark { display: flex; align-items: center; justify-content: center; background: #223b5a; border: 1px solid #48617e; letter-spacing: -1px; }
.case-layout .brand small { color: #cfdbeb; font-size: 13px; }
.case-layout .side-label { color: #bacbe0; font-size: 13px; letter-spacing: 0; margin: 0 9px 9px; }
.case-layout .nav { gap: 4px; }
.case-layout .nav-item {
  height: auto;
  min-height: 40px;
  padding: 8px 9px;
  color: #e0e9f5;
  font-size: 13px;
  line-height: 1.23;
  gap: 9px;
}
.case-layout .nav-item:hover { background: #223752; }
.case-layout .nav-item.active {
  background: #2c4666;
  color: #fff;
  box-shadow: inset 3px 0 #91bcff;
}
.case-layout .nav-icon {
  width: 17px;
  min-width: 17px;
  display: inline-grid;
  place-items: center;
  font: 600 16px/1 "Segoe UI Symbol", sans-serif;
  color: #bcd0eb;
}
.case-layout .nav-count { background: #2c415c; color: #eef4ff; font-size: 13px; padding: 1px 6px; }
.case-layout .nav-count.task-count { background: #b8d3ff; color: #1d3555; }
.case-layout .nav-count.danger { background: #512f3d; color: #ffd6df; }
.case-layout .side-hint { display: none; }
.case-layout .profile { padding-top: 13px; border-color: #3b4d63; }
.case-layout .profile-meta strong { color: #f3f7fc; font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
.case-layout .profile-meta small { color: #c2d0e3; font-size: 13px; margin-top: 2px; }
.case-layout .avatar { background: #dbe8fa; color: #233d60; }
.case-layout #logout { color: #f3f7fc; background: #263e5b; border-color: #5c708a; }
.case-layout .topbar { height: 59px; padding: 0 24px; background: #1c2e47; border-color: #31455e; }
.case-layout .breadcrumb, .case-layout .breadcrumb span { color: #c2d2e7; font-size: 13px; }
.case-layout .breadcrumb strong { color: #fff; }
.case-layout .local-indicator { color: #d4e0ee; font-size: 13px; }
.case-layout .local-indicator span { background: #a2b7d3; }
.case-layout .topbar .btn, #cases-page .btn { font-size: 13px; }
.case-layout :is(.sidebar,.topbar) :is(button,a):focus-visible {
  outline: 2px solid #b8d3ff;
  outline-offset: 2px;
}
.case-layout .page-content { padding: 19px 24px 28px; }
#cases-page .page-heading { align-items: center; margin-bottom: 15px; gap: 12px; }
#cases-page .page-heading h1 { font-size: 28px; color: var(--case-ink); margin-bottom: 4px; }
#cases-page .page-heading p { color: var(--case-secondary); font-size: 15px; line-height: 1.35; }
#cases-page .date-pill { color: var(--case-secondary); font-size: 13px; padding: 8px 11px; }
#cases-page .stats-grid { gap: 12px; margin-bottom: 13px; }
#cases-page .stat-card { min-height: 104px; padding: 13px 14px; align-items: flex-start; }
#cases-page .stat-card small { font-size: 14px; line-height: 1.22; }
#cases-page .stat-card strong { font-size: 31px; margin-top: 6px; }
#cases-page .stat-card.violet { background: #f1edff; color: #49357d; border-color: #dfd5f5; }
#cases-page .stat-card.violet .stat-icon { background: #fff9; color: #5b4695; }
#cases-page .task-inbox { margin-bottom: 13px; padding: 9px 14px; }
#cases-page .task-inbox:has(#task-inbox-list[hidden]) { display: none; }
#cases-page .task-inbox .section-actions > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 10px; }
#cases-page .task-inbox h2, #cases-page .task-inbox p { font-size: 13px; margin: 0; }
#cases-page .task-inbox ul { grid-template-columns: repeat(auto-fit,minmax(min(185px,100%),1fr)); margin-top: 7px; }
#cases-page .task-inbox li button span { font-size: 13px; }
#cases-page .case-section { border-color: var(--case-line); }
#cases-page .section-header { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px 8px; }
#cases-page .section-header h2 { color: var(--case-ink); font-size: 17px; margin: 0; }
#cases-page .muted-count { background: #edf2fa; color: #385171; font-size: 13px; margin-left: 5px; }
#cases-page .case-toolbar { display: flex; flex-wrap: wrap; gap: 5px; }
#cases-page .case-toolbar .btn { min-height: 32px; padding: 5px 9px; color: #425775; box-shadow: none; }
#cases-page #clear-filters { border-color: transparent; }
#cases-page .case-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1.18fr 1fr .85fr 1.46fr;
  align-items: end;
  gap: 8px;
  padding: 0 14px 11px;
}
#cases-page .case-filters label { color: #435674; font-size: 13px; min-width: 0; }
#cases-page .case-filters select, #cases-page .case-filters input {
  border-color: #cfd9e8;
  color: #273c58;
  height: 34px;
  padding: 0 7px;
  font-size: 13px;
  text-overflow: ellipsis;
}
#cases-page .case-filters .filter-active :is(select,input) {
  color: #173e78;
  background: #eaf2ff;
  border-color: #7198d3;
  font-weight: 700;
}
#cases-page .cases-table { width: 100%; min-width: 0; table-layout: fixed; white-space: normal; }
#cases-page .case-col { width: 25%; }
#cases-page .type-col { width: 13%; }
#cases-page .status-col { width: 16%; }
#cases-page .priority-col { width: 8%; }
#cases-page .owner-col, #cases-page .assignee-col { width: 13%; }
#cases-page .date-col { width: 12%; }
#cases-page .people-col { display: none; }
#cases-page .cases-table :is(th,td) {
  padding: 8px 9px;
  vertical-align: top;
  overflow-wrap: anywhere;
  line-height: 1.28;
}
#cases-page .cases-table :is(th,td):first-child { padding-left: 14px; }
#cases-page .cases-table th { background: #eaf0f8; color: #2b4565; font-size: 13px; letter-spacing: 0; }
#cases-page .cases-table td { font-size: 14px; color: #314865; }
#cases-page .case-main strong { color: var(--case-ink); font-size: 15px; margin: 0 0 2px; }
#cases-page .case-secondary { display: block; color: var(--case-secondary); font-size: 13px; }
#cases-page .case-main span { max-width: none; overflow: visible; }
#cases-page .case-main .ref { color: #516784; font-size: 13px; letter-spacing: 0; margin: 2px 0 0; font-weight: 600; }
#cases-page .case-person strong, #cases-page .case-type { font-size: 14px; font-weight: 650; }
#cases-page .case-assignees { gap: 6px; }
#cases-page .case-field-label { display: block; color: #465a78; font-size: 13px; font-weight: 750; }
#cases-page .prio { color: #506075; font-size: 13px; }
#cases-page .prio.urgente, #cases-page .prio.alta { color: #68493f; }
#cases-page .chip { font-size: 13px; padding: 4px 6px; gap: 5px; max-width: 100%; font-weight: 700; }
#cases-page .chip::before { flex: 0 0 6px; }
#cases-page .chip.nuevo { color: #27518d; }
#cases-page .chip.en_gestion { background: #eee9fc; color: #523990; }
#cases-page .chip.resuelto { color: #1b6249; background: #e5f4ec; }
#cases-page .case-deadline time { display: block; font-size: 13px; font-weight: 700; color: #243d5d; white-space: nowrap; }
#cases-page .case-overdue { display: block; margin-top: 3px; color: #912e3d; font-size: 13px; font-weight: 700; }
#cases-page tbody tr:hover { background: #f2f7ff; }
#cases-page tbody tr:focus-visible { outline: 2px solid #245bb0; outline-offset: -2px; background: #eaf2ff; }
#cases-page .table-footer { padding: 8px 14px; color: #465a75; font-size: 13px; }
#cases-page .empty-state p { color: var(--case-secondary); font-size: 15px; }
@media (max-width: 1210px) {
  #cases-page .case-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  #cases-page :is(.owner-col,.assignee-col) { display: none; }
  #cases-page .people-col { display: table-cell; width: 24%; }
  #cases-page td.people-col > div + div { margin-top: 6px; }
  #cases-page .date-col { width: 14%; }
}
@media (min-width: 731px) and (max-width: 1080px) {
  .case-layout .sidebar { width: 205px; min-width: 205px; }
  .case-layout .nav-item { gap: 6px; padding-inline: 6px; }
  .case-layout .brand { margin-inline: 0; justify-content: flex-start; }
  .case-layout .profile-meta { display: block; }
}
@media (max-width: 895px) {
  #cases-page .cases-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  #cases-page .cases-table, #cases-page .cases-table tbody { display: block; }
  #cases-page .cases-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding: 5px; border-bottom: 1px solid var(--case-line); }
  #cases-page .cases-table td { display: block; width: auto; padding: 5px 9px; border: 0; }
  #cases-page .cases-table td:is(.owner-col,.assignee-col) { display: none; }
  #cases-page .cases-table td:first-child { padding-left: 9px; grid-column: 1 / -1; }
  #cases-page .cases-table td[data-cell-label]::before { display: block; content: attr(data-cell-label); color: #465a78; font-size: 13px; font-weight: 750; margin-bottom: 2px; }
  #cases-page .cases-table .date-col { grid-column: 2; grid-row: 2; }
  #cases-page .cases-table .people-col > div + div { margin-top: 4px; }
}
@media (max-width: 730px) {
  .case-layout .sidebar { width: 100%; min-width: 0; padding: 5px 8px; overflow-y: visible; }
  .case-layout .sidebar .nav-item { width: auto; white-space: nowrap; }
  .case-layout .sidebar-bottom { display: block; position: fixed; top: 9px; left: 12px; max-width: 48%; }
  .case-layout .profile { padding: 0; border: 0; }
  .case-layout .profile-meta { display: block; }
  .case-layout .profile-meta small { display: none; }
  .case-layout .profile .avatar { display: none; }
  .case-layout .topbar { justify-content: flex-end; padding: 0 12px; }
  .case-layout .topbar .local-indicator { display: none; }
  .case-layout .page-content { padding: 14px 10px 20px; }
  #cases-page .case-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #cases-page .cases-table .case-deadline time { white-space: normal; }
}


/* Mensajes recurrentes */
#messages-page .message-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
#messages-page .message-card {
  display: grid;
  grid-template-rows: 24px 44px 105px auto;
  align-content: start;
  gap: 9px;
  padding: 16px;
}
#messages-page .message-card small {
  display: block;
  max-width: 100%;
  align-self: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#messages-page .message-card h2, #messages-page .message-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  margin: 0;
}
#messages-page .message-card h2 { -webkit-line-clamp: 2; line-height: 1.2; }
#messages-page .message-preview {
  -webkit-line-clamp: 5;
  max-height: 105px;
  line-height: 21px;
  white-space: pre-wrap;
}
#messages-page .message-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  align-self: end;
}
#messages-page .message-card-actions .btn { white-space: normal; min-height: 35px; padding: 6px; }
.message-reader { width: min(700px, 94vw); color: #273c56; overflow-wrap: anywhere; }
.message-reader h2 { margin: 6px 0 12px; }
.message-reader-category { color: #365780; font-size: 13px; font-weight: 700; }
.message-reader-body {
  max-height: 55vh;
  overflow-y: auto;
  padding: 13px;
  border: 1px solid #d6e2f3;
  border-radius: 8px;
  background: #f7faff;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.message-reader-body:focus-visible { outline: 2px solid #245bb0; outline-offset: 2px; }
.message-reader-feedback { min-height: 1.2em; margin: 8px 0 0; font-size: 13px; }
.message-reader .dialog-actions { margin-top: 8px; }
