/* Municipal identity shared with the Lonquimay ERP reference. */
:root {
  --navy-950:#080f3d; --navy-900:#0d1650; --navy-800:#16226a; --navy-700:#22307f; --navy-500:#4868a8;
  --sky-300:#b8d8f8; --sky-200:#d4e6f9; --sky-100:#ebf3fc; --sky-50:#f5f9fe;
  --red:#c80c0c; --ink:#141c3d; --ink-2:#2c365a; --muted:#4f5a78; --line:#dde2ee; --line-strong:#c3cadc;
  --surface:#fff; --canvas:#f4f6fb; --radius:8px; --sidebar:248px;
  --shadow:0 1px 2px rgb(13 22 80 / 6%),0 1px 1px rgb(13 22 80 / 4%);
  font:14px/1.5 "Segoe UI Variable Text","Segoe UI",system-ui,sans-serif;
  color:var(--ink); background:var(--canvas); color-scheme:light; -webkit-font-smoothing:antialiased;
}
*{box-sizing:border-box}
body{margin:0;display:flex}
[hidden]{display:none!important}
button,input,select,textarea{font:inherit}
button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:9px 15px;border:1px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--ink-2);font-size:13px;font-weight:600;cursor:pointer;transition:background-color .16s,border-color .16s}
button:hover{background:var(--sky-50);border-color:var(--navy-500)}
button:disabled{opacity:.5;cursor:not-allowed}
:is(button,input,select,textarea,a,summary):focus-visible{outline:2px solid var(--navy-500);outline-offset:3px}
a{color:var(--navy-700);text-underline-offset:3px}
.primary{background:var(--navy-800);border-color:var(--navy-800);color:white;box-shadow:var(--shadow)}
.primary:hover{background:var(--navy-700);border-color:var(--navy-700)}
.danger{color:#9e0c0c}
.danger:hover{background:#fbe9e8;border-color:#f2c9c6}
/* Navigation */
aside{width:var(--sidebar);position:fixed;inset:0 auto 0 0;overflow-y:auto;min-height:100vh;padding:26px 16px 20px;display:flex;flex-direction:column;background:linear-gradient(180deg,var(--navy-900),var(--navy-950));box-shadow:inset -3px 0 0 var(--red);color:var(--sky-200)}
.brand{display:flex;align-items:center;gap:12px;padding:0 8px 16px}
.brand-mark{width:42px;height:56px;display:grid;place-items:center;flex:none}
.brand-mark img{display:block;width:100%;height:100%;object-fit:contain}
.brand strong{display:block;font-size:18px;font-weight:600;line-height:1.3;color:white;letter-spacing:-.02em}
.brand small{display:block;font-size:12px;color:var(--sky-300);letter-spacing:0;margin-bottom:2px}
.module-label{padding:0 8px 20px;border-bottom:1px solid #ffffff1f;font-size:12px;color:var(--sky-300)}
.module-label strong{display:block;margin-top:0;font-size:14px;font-weight:600;color:white}
aside>p{font-size:10px;font-weight:600;letter-spacing:.8px;margin:18px 12px 10px;color:var(--sky-300)}
nav{display:grid;gap:3px}
nav button{position:relative;justify-content:flex-start;text-align:left;width:100%;min-height:42px;padding:10px 12px;border:0;background:transparent;color:var(--sky-200);font-weight:400}
nav button:hover{background:#b8d8f817;border:0}
nav button.active{background:#b8d8f824;color:white;font-weight:600}
nav button.active:before{content:"";position:absolute;left:-16px;top:9px;bottom:9px;width:3px;background:var(--sky-300);border-radius:0 3px 3px 0}
.nav-icon{width:18px;height:18px;flex:none;margin-right:3px}
nav button.active .nav-icon{color:var(--sky-300)}
footer{margin-top:auto;padding:22px 12px 0;border-top:1px solid #ffffff1f;font-size:12px;line-height:1.8;color:var(--sky-300)}
footer strong{font-weight:500;color:white}
/* Workspace */
main{margin-left:var(--sidebar);width:calc(100% - var(--sidebar));min-width:0;padding:0 44px 30px}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:78px;margin:0 -44px;padding:16px 44px;background:var(--surface);border-bottom:1px solid var(--line)}
.breadcrumb{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:12px}
.breadcrumb span{font-size:20px;color:#6b7592}
#account{font-size:12px;color:var(--muted)}
#account button{margin-left:12px}
.page-heading{padding-top:30px;margin-bottom:26px}
small{font-size:11px;letter-spacing:.5px;color:var(--muted)}
h1,h2,h3{font-family:"Segoe UI Variable Display","Segoe UI",system-ui,sans-serif;font-weight:600;color:var(--ink)}
h1{font-size:26px;line-height:1.2;letter-spacing:-.022em;margin:8px 0 9px}
h2{font-size:20px;line-height:1.3;letter-spacing:-.015em;margin:0 0 8px}
h3{font-size:15px}
p{color:var(--muted);line-height:1.65;margin:8px 0 16px}
.page-heading p{font-size:13px;margin:0}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;margin:22px 0;box-shadow:var(--shadow);min-width:0}
#login-panel{max-width:460px;margin:48px auto}
#login-title:focus{outline:0}
#login-submit:disabled{cursor:wait}
#login-message{margin:12px 0 0}
#login-message:empty{display:none}
.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
.stat{background:white;border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px;box-shadow:var(--shadow);min-width:0}
.stat strong{display:block;font-size:30px;line-height:1.3;font-weight:600;color:var(--navy-900);margin:7px 0 3px;font-variant-numeric:tabular-nums}
.stat span{display:flex;align-items:center;gap:7px;color:var(--muted);font-size:12px}
.stat span:before{content:"";width:7px;height:7px;flex:none;border-radius:50%;background:var(--navy-700)}
.stat:nth-child(2) span:before{background:var(--navy-500)}
.stat:nth-child(3) span:before{background:#7a4d00}
.stat:nth-child(4) span:before{background:#286818}
.toolbar,.actions{display:flex;align-items:center;justify-content:space-between;gap:16px}
.toolbar{margin-top:30px}
.toolbar p{font-size:13px;margin:6px 0 0}
.toolbar h2{margin:0}
#search{max-width:390px;margin-top:20px}
.table-wrap{overflow:auto;padding:0}
table{border-collapse:collapse;width:100%;text-align:left;white-space:nowrap}
td,th{padding:16px 18px;border-bottom:1px solid var(--line);font-size:12px}
th{background:#eceff7;color:var(--muted);font-weight:600}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover{background:var(--sky-50)}
td strong{display:block;font-size:13px;font-weight:600}
td small{display:block;letter-spacing:0;font-size:11px;margin-top:5px}
.badge{font-size:10px;background:var(--sky-100);border:1px solid var(--sky-200);color:var(--navy-800);border-radius:20px;padding:4px 9px;display:inline-flex;align-items:center;gap:5px;font-weight:600}
.badge:before{content:"";width:6px;height:6px;flex:none;border-radius:50%;background:currentColor}
.badge[data-state="OBSERVADA"]{background:#fbf1da;border-color:#efd9a6;color:#7a4d00}
.badge[data-state="LISTA PARA CONTRATO"]{background:#e6f1e2;border-color:#c6dfbd;color:#1d4f12}
.badge[data-state="RECHAZADA"]{background:#fbe9e8;border-color:#f2c9c6;color:#9e0c0c}
#empty,#departments-empty{padding:24px}
#notice{color:#9e0c0c;background:#fbe9e8;border:1px solid #f2c9c6;border-radius:6px;padding:12px 16px}
#notice:empty{display:none}
/* Forms and dialogs */
#editor{max-width:1100px}
#editor-title:focus{outline:none}
#editor-status:empty,#editor-load-error:empty{display:none}
#request-form{margin-top:20px}
.field-help{display:block;margin-top:7px;font-size:12px;font-weight:400;line-height:1.5;color:var(--muted)}
input,textarea,select{width:100%;min-width:0;border:1px solid var(--line-strong);border-radius:6px;padding:10px 12px;background:white;color:var(--ink);font-size:13px;min-height:42px}
label{display:block;min-width:0;font-size:12px;font-weight:600;margin:14px 0;color:var(--ink-2)}
label input,label textarea,label select{margin-top:7px}
textarea{min-height:90px;resize:vertical}
input[readonly],select:disabled{background:#eceff7;color:var(--ink-2);font-weight:600;cursor:default;opacity:1}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 20px}
.actions{justify-content:flex-end;flex-wrap:wrap;margin-top:25px}
dialog{border:1px solid var(--line);border-radius:10px;padding:28px;max-width:780px;width:calc(100% - 32px);max-height:90vh;color:var(--ink);box-shadow:0 28px 70px -12px #080f3d59}
dialog::backdrop{background:#080f3d80}
dialog h2{padding-bottom:18px;margin-bottom:10px;border-bottom:1px solid var(--line)}
.form-error,.field-error{color:#9e0c0c}
.field-success{color:#1d4f12}
input[aria-invalid="true"]{border-color:#9e0c0c}
#history{padding-left:20px;font-size:13px}
#history li{padding:8px;line-height:1.6}
#detail-body{white-space:pre-wrap;line-height:1.8;overflow-wrap:anywhere}
summary{cursor:pointer;font-weight:600}
#user-form{max-width:450px}
#user-account-form{max-width:900px}
#user-account-form h3{margin-top:0}
#user-menu-fieldset{border:1px solid var(--line);border-radius:var(--radius);padding:16px;min-width:0}
#user-menu-fieldset legend{font-weight:600;padding:0 8px}
.permission-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));gap:8px 20px}
.permission-options label{display:flex;align-items:center;gap:10px;margin:4px 0;font-weight:400}
.permission-options input{width:18px;height:18px;min-height:0;flex:none;margin:0;accent-color:var(--navy-800)}
#users-status:empty,#users-error:empty,#user-account-error:empty{display:none}
#users-empty{padding:24px}
#users-rows td{white-space:normal;overflow-wrap:anywhere;min-width:140px}
#users-rows td:nth-child(4){min-width:240px;max-width:400px}
#users-rows td:last-child{min-width:120px}
#user-rut-feedback.field-error{color:#9e0c0c}
#user-rut-feedback.field-success{color:#1d4f12}
:is(#rut-feedback,#department-help,#net-explanation){display:block;margin-top:7px;font-size:12px;font-weight:400;line-height:1.5}
#net-explanation{color:var(--muted)}
#parameters form{max-width:650px}
.currency-field{display:flex;align-items:center;margin-top:7px;border:1px solid var(--line-strong);border-radius:6px;background:white;overflow:hidden}
.currency-field>span{padding-left:12px;color:var(--muted);font-size:15px}
.currency-field input{margin:0;border:0;border-radius:0;min-width:0;font-variant-numeric:tabular-nums}
.currency-field:focus-within{outline:2px solid var(--navy-500);outline-offset:3px}
.currency-field input:focus{outline:none}
/* Catalog and report menus */
.parameter-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px;margin-top:26px}
.parameter-tile{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;text-align:left;gap:16px;padding:24px;min-height:260px;border:1px solid var(--line);border-radius:var(--radius);background:white;box-shadow:var(--shadow)}
.parameter-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:8px;background:var(--sky-100);color:var(--navy-700);font-size:25px;font-weight:500}
.parameter-tile strong{font-size:17px;color:var(--ink);font-weight:600}
.parameter-tile>span:not(.parameter-icon){font-size:13px;line-height:1.6;font-weight:400;color:var(--muted)}
.parameter-tile .parameter-link{margin-top:auto;color:var(--navy-700)!important;font-weight:600!important}
.parameter-tile:not(:disabled):hover{border-color:var(--navy-500);background:var(--sky-50)}
.parameter-tile.upcoming{opacity:1;cursor:not-allowed;background:#f9fafe}
.upcoming .parameter-icon{background:#eceff7;color:var(--muted)}
.parameter-status{margin-top:auto;background:#eceff7;border-radius:20px;padding:4px 12px;font-size:11px!important}
.back-link{margin:0 0 16px;padding:8px 6px;border:0;background:transparent;color:var(--navy-700)}
#catalog-form h3{margin:0 0 4px}
#catalog-code-help{font-size:12px;margin:0}
#catalog-status:empty,#catalog-error:empty{display:none}
#catalog-access{padding:12px 16px;border:1px solid var(--sky-200);border-radius:var(--radius);background:var(--sky-100);color:var(--navy-800)}
#catalog-empty{padding:24px}
#catalog-rows td:nth-child(1){font-variant-numeric:tabular-nums;white-space:normal;overflow-wrap:anywhere;min-width:120px;max-width:240px}
#catalog-rows td:nth-child(2){white-space:normal;overflow-wrap:anywhere;min-width:180px}
.catalog-row-actions{display:flex;gap:8px;flex-wrap:wrap}
.report-details,#column-picker{border:1px solid var(--line);border-radius:8px;padding:18px;margin:22px 0 0;min-width:0}
.report-details legend,#column-picker legend{font-weight:600;padding:0 8px}
.report-details p{font-size:12px}
#report-columns{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:4px 20px;margin-top:16px}
#report-columns label{display:flex;align-items:center;gap:10px;font-weight:400;margin:8px 0}
#report-columns input{width:17px;height:17px;min-height:0;flex:none;margin:0;accent-color:var(--navy-800)}
#report-preview:empty{display:none}
#report-preview th{white-space:normal;min-width:150px}
#report-preview td{max-width:400px;white-space:normal;overflow-wrap:anywhere}
@media(max-width:1200px){main{padding:0 28px 28px}.topbar{margin:0 -28px;padding:16px 28px}.parameter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:1000px){:root{--sidebar:220px}.stats{grid-template-columns:repeat(2,minmax(0,1fr))}.toolbar{align-items:flex-start}.toolbar>button{flex:none}}
@media(max-width:760px){body{display:block}aside{position:static;width:100%;min-height:0;padding:18px 16px;box-shadow:inset 0 -3px 0 var(--red)}.brand{padding:0 4px 14px}.brand-mark{width:36px;height:48px}.brand strong{font-size:17px}.module-label{padding:0 4px 14px}aside>p,footer{display:none}nav{display:flex;overflow-x:auto;gap:5px;margin-top:14px;padding-bottom:2px}nav button{width:auto;flex:none;white-space:nowrap}nav button.active:before{display:none}main{margin:0;width:100%;padding:0 20px 24px}.topbar{margin:0 -20px;padding:14px 20px;min-height:64px;flex-wrap:wrap}.page-heading{padding-top:24px}.parameter-grid{gap:16px}.parameter-tile{min-height:250px;padding:20px}}
@media(max-width:520px){main{padding:0 16px 24px}.topbar{margin:0 -16px;padding:12px 16px}.breadcrumb{font-size:11px}.toolbar{flex-direction:column;gap:14px}.grid,.parameter-grid{grid-template-columns:1fr}.parameter-tile{min-height:230px}h1{font-size:24px}.stat{padding:16px 12px}.stat span{font-size:11px}.stats{gap:10px}dialog{padding:20px 16px}.report-details,#column-picker{padding:12px}.actions{gap:10px}.actions button{flex:1 1 auto}#account button{margin-left:6px;padding:8px 10px}}
@media(prefers-reduced-motion:reduce){button{transition:none}}
