/* ENERSU — Panel de administración
   Colores tomados de enersu.cl: naranja #ff6400 → ámbar #ff9000, azul del logo #0898e8 */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e5ea;
  --fg: #1c2026;
  --muted: #6a727e;
  --primary: #ff6400;
  --primary-2: #ff9000;
  --primary-soft: rgba(255, 100, 0, 0.1);
  --primary-ink: #c94f00;
  --blue: #0898e8;
  --blue-soft: rgba(8, 152, 232, 0.12);
  --ok: #1f9d55;
  --ok-soft: rgba(31, 157, 85, 0.12);
  --warn: #c77700;
  --warn-soft: rgba(230, 150, 0, 0.14);
  --bad: #d23f3f;
  --bad-soft: rgba(210, 63, 63, 0.11);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 6px 18px -8px rgba(16, 24, 40, 0.12);
  --radius: 14px;
  --radius-sm: 9px;
  --side: 15.5rem;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1113;
  --surface: #171a1e;
  --surface-2: #1e2227;
  --border: #2a2f37;
  --fg: #eef0f3;
  --muted: #9aa3ae;
  --primary-soft: rgba(255, 120, 20, 0.16);
  --primary-ink: #ff9a4d;
  --blue-soft: rgba(8, 152, 232, 0.2);
  --ok: #3cc57a;
  --ok-soft: rgba(60, 197, 122, 0.15);
  --warn: #f0a530;
  --warn-soft: rgba(240, 165, 48, 0.16);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 24px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 400 14.5px/1.5 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-family: Montserrat, Roboto, sans-serif; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.tiny { font-size: 0.74rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.stack { display: grid; gap: 0.6rem; }
.stack-lg { display: grid; gap: 1.25rem; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-weight: 600; font-size: 0.86rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
  text-decoration: none !important;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }
.btn-primary {
  background: linear-gradient(100deg, var(--primary), var(--primary-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -8px rgba(255, 100, 0, 0.8);
}
.btn-primary:hover { border-color: transparent; filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; border-radius: 8px; }
.btn-icon { padding: 0.45rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 0.3rem; }
.field > label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 0.74rem; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=email], input[type=tel], input[type=url], input[type=search], select, textarea {
  width: 100%;
  padding: 0.58rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.check { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px dashed var(--border); font-family: Montserrat, sans-serif; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { color: var(--bad); font-size: 0.85rem; min-height: 1.2em; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--bg);
}
.login-art {
  position: relative; overflow: hidden;
  background: #121212; color: #fff;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 3rem;
}
.login-art .sun { position: absolute; top: -12rem; right: -10rem; width: 34rem; height: 34rem; border-radius: 50%; background: radial-gradient(circle, rgba(255,144,0,.55), rgba(255,100,0,.18) 35%, transparent 66%); }
.login-art .band { position: absolute; top: 4.5rem; right: 0; width: 55%; height: .8rem; display: flex; }
.login-art .band i:first-child { flex: 1; background: var(--blue); border-radius: 0 999px 999px 0; margin-right: -.8rem; position: relative; z-index: 1; }
.login-art .band i:last-child { flex: 1.1; background: var(--primary-2); }
.login-art svg.panels { position: absolute; right: -3rem; top: 8rem; width: 34rem; max-width: 90%; opacity: .95; }
.login-art h1 { font-size: clamp(2rem, 3.6vw, 3rem); font-weight: 800; position: relative; }
.login-art p { color: #b9bec6; margin-top: .6rem; max-width: 26rem; position: relative; }
.login-art .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(18,18,18,.97), rgba(18,18,18,.55) 45%, transparent 70%); }
.login-form-wrap { display: grid; place-items: center; padding: 2rem 1.25rem; }
.login-card { width: 100%; max-width: 23rem; display: grid; gap: 1.1rem; }
.login-card .logo-chip { justify-self: start; }
.login-card h2 { font-size: 1.5rem; font-weight: 800; }
.login-back { font-size: .82rem; color: var(--muted); }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 15rem; padding: 1.5rem; }
  .login-art svg.panels { top: 3rem; width: 22rem; right: -4rem; }
  .login-art .band { top: 1.5rem; }
}

.logo-chip { display: inline-flex; align-items: center; background: #fff; border-radius: 10px; padding: .35rem .6rem; border: 1px solid var(--border); }
.logo-chip img { height: 2rem; width: auto; }

/* ---------- Estructura ---------- */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.6rem 1.25rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--blue) 0 38%, var(--primary-2) 38% 70%, var(--primary) 70%); }
.topbar .brand { display: flex; align-items: center; gap: .6rem; flex: none; }
.topbar .brand .title { font-family: Montserrat, sans-serif; font-weight: 700; font-size: .9rem; }
.topbar .brand .title span { display: block; font-size: .7rem; font-weight: 500; color: var(--muted); font-family: Roboto, sans-serif; }
.topbar .spacer { flex: 1; }
.user-pill { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--muted); }
.avatar { width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .75rem; color: #fff; background: linear-gradient(135deg, var(--blue), #0a6fc0); flex: none; }

.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - 3.5rem); }
.sidebar {
  position: sticky; top: 3.5rem; align-self: start;
  height: calc(100vh - 3.5rem); overflow-y: auto;
  padding: 1rem .75rem 2rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.nav-group { margin-bottom: .9rem; }
.nav-label { font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: .4rem .7rem; }
.nav-item {
  display: flex; align-items: center; gap: .65rem; width: 100%;
  padding: .55rem .7rem; border-radius: 9px; border: 0; background: transparent;
  color: var(--muted); font-weight: 600; font-size: .86rem; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-ink); }
.nav-item .count { margin-left: auto; font-size: .7rem; background: var(--bad); color: #fff; border-radius: 999px; padding: 0 .4rem; min-width: 1.2rem; text-align: center; }
.content { padding: 1.5rem clamp(1rem, 2.4vw, 2.25rem) 4rem; min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.crumbs a { color: var(--muted); }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 3.4rem; z-index: 30; height: auto; overflow-x: auto; overflow-y: hidden;
    display: flex; gap: .25rem; padding: .45rem .6rem; border-right: 0; border-bottom: 1px solid var(--border);
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .nav-group { display: contents; }
  .nav-label { display: none; }
  .nav-item { flex: none; width: auto; padding: .45rem .7rem; }
  .topbar .brand .title { display: none; }
  .user-pill .name { display: none; }
}

/* ---------- Tarjetas / paneles ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.25rem; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; flex-wrap: wrap; }
.panel-head h2 { font-size: 1rem; font-weight: 700; }
.panel-head .sub { font-size: .8rem; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.group-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.6rem 0 .75rem; }
.group-label.attention { color: var(--primary-ink); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: .85rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.05rem; display: grid; gap: .25rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.stat.clickable:hover { border-color: var(--primary); transform: translateY(-1px); }
.stat .icon { width: 2rem; height: 2rem; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-bottom: .35rem; }
.stat .label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat .value { font-family: Montserrat, sans-serif; font-size: 1.55rem; font-weight: 800; }
.stat .delta { font-size: .75rem; font-weight: 600; color: var(--muted); }
.stat.money .icon { background: var(--ok-soft); color: var(--ok); }
.stat.money .value { color: var(--ok); }
.stat.brand .icon { background: var(--primary-soft); color: var(--primary-ink); }
.stat.info .icon { background: var(--blue-soft); color: var(--blue); }
.stat.alert.on { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.stat.alert.on .icon { background: var(--bad-soft); color: var(--bad); }
.stat.alert.on .value { color: var(--bad); }

/* ---------- Filas / listas ---------- */
.list { display: grid; gap: .5rem; }
.item {
  display: flex; align-items: center; gap: .85rem; justify-content: space-between;
  padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); flex-wrap: wrap;
}
.item.clickable { cursor: pointer; }
.item.clickable:hover { border-color: var(--primary); }
.item .lead { display: flex; align-items: center; gap: .75rem; min-width: 0; flex: 1; }
.item .title { font-weight: 600; font-size: .92rem; }
.item .meta { font-size: .78rem; color: var(--muted); }
.item .actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.ico { width: 2.1rem; height: 2.1rem; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.ico.brand { background: var(--primary-soft); color: var(--primary-ink); }
.ico.blue { background: var(--blue-soft); color: var(--blue); }
.ico.ok { background: var(--ok-soft); color: var(--ok); }
.ico.bad { background: var(--bad-soft); color: var(--bad); }
.ico.warn { background: var(--warn-soft); color: var(--warn); }
.empty { padding: 1.25rem; text-align: center; color: var(--muted); font-size: .88rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--surface-2); padding: .6rem .75rem; white-space: nowrap; }
.table td { padding: .6rem .75rem; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }

/* ---------- Insignias ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.brand { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; display: inline-block; }

.progress { height: .45rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.progress.ok > i { background: var(--ok); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar input[type=search] { max-width: 18rem; }
.toolbar select { width: auto; min-width: 10rem; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: .38rem .75rem; border-radius: 7px; font-weight: 600; font-size: .8rem; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.2rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; padding: .65rem .9rem; font-weight: 600; font-size: .86rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--fg); }
.tab.active { color: var(--primary-ink); border-bottom-color: var(--primary); }

/* ---------- Búsqueda y notificaciones ---------- */
.search { position: relative; width: min(22rem, 40vw); }
.search input { padding-left: 2.1rem; background: var(--surface-2); border-color: transparent; }
.search > svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-results, .dropdown {
  position: absolute; top: calc(100% + .4rem); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .35); max-height: 26rem; overflow-y: auto; padding: .35rem;
}
.sr-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .45rem .6rem .2rem; }
.sr-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: .5rem .6rem; border-radius: 8px; cursor: pointer; font-size: .86rem; }
.sr-item:hover, .sr-item.focus { background: var(--surface-2); }
.sr-item .meta { font-size: .75rem; color: var(--muted); }
.bell { position: relative; }
.bell .badge-count { position: absolute; top: -2px; right: -2px; background: var(--bad); color: #fff; font-size: .62rem; font-weight: 700; border-radius: 999px; min-width: 1.05rem; height: 1.05rem; display: grid; place-items: center; padding: 0 .25rem; }
.dropdown.notif { left: auto; right: 0; width: min(24rem, 92vw); }
@media (max-width: 640px) { .search { width: auto; flex: 1; } }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 15, 0.55); display: grid; place-items: center; padding: 1rem; animation: fade .15s ease; }
.modal { width: min(44rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 30px 70px -20px rgba(0,0,0,.5); animation: rise .18s ease; }
.modal.wide { width: min(64rem, 100%); }
.modal.narrow { width: min(28rem, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 1.15rem 1.25rem; }
.modal-foot { position: sticky; bottom: 0; background: var(--surface); display: flex; justify-content: flex-end; gap: .5rem; padding: .85rem 1.25rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.toasts { position: fixed; bottom: 1rem; right: 1rem; z-index: 200; display: grid; gap: .5rem; }
.toast { background: #1c2026; color: #fff; padding: .7rem 1rem; border-radius: 10px; font-size: .86rem; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); animation: rise .2s ease; max-width: 22rem; }
.toast.err { background: var(--bad); }
.toast.ok { border-left: 4px solid var(--primary); }

/* ---------- Proyectos ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; display: flex; flex-direction: column; }
.pcard:hover { transform: translateY(-2px); border-color: var(--primary); }
.pcard .cover { aspect-ratio: 16 / 8; background: #15181c center / cover no-repeat; position: relative; }
.pcard .cover.placeholder { background: radial-gradient(circle at 85% -10%, rgba(255,144,0,.55), transparent 55%), linear-gradient(135deg, #1a1d22, #101215); }
.pcard .cover .badge { position: absolute; top: .6rem; left: .6rem; }
.pcard .cover svg { position: absolute; right: .8rem; bottom: .6rem; opacity: .9; }
.pcard .body { padding: .9rem 1rem 1rem; display: grid; gap: .45rem; }
.pcard .name { font-family: Montserrat, sans-serif; font-weight: 700; font-size: 1rem; }
.kv { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .45rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.hero-proj { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; }
.checklist { display: grid; gap: .3rem; }
.checklist label { display: flex; gap: .6rem; align-items: center; padding: .45rem .6rem; border-radius: 8px; cursor: pointer; }
.checklist label:hover { background: var(--surface-2); }
.checklist input { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); flex: none; }
.checklist .done span { text-decoration: line-through; color: var(--muted); }
.timeline { display: grid; gap: 1rem; position: relative; }
.tl-item { display: grid; grid-template-columns: auto 1fr; gap: .8rem; }
.tl-dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--primary); margin-top: .35rem; box-shadow: 0 0 0 4px var(--primary-soft); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .6rem; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--border); cursor: zoom-in; }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: .3rem .45rem; font-size: .7rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.lightbox { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 1.5rem; cursor: zoom-out; }
.lightbox img { max-height: 90vh; max-width: 92vw; border-radius: 8px; }

/* Flujo netbilling */
.flow { display: flex; gap: 0; align-items: flex-start; overflow-x: auto; padding: .25rem 0 .5rem; }
.flow-step { flex: 1; min-width: 6.5rem; display: grid; justify-items: center; text-align: center; gap: .35rem; position: relative; font-size: .72rem; color: var(--muted); }
.flow-step::before { content: ""; position: absolute; top: .85rem; left: -50%; right: 50%; height: 2px; background: var(--border); z-index: 0; }
.flow-step:first-child::before { display: none; }
.flow-dot { width: 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .75rem; background: var(--surface-2); border: 2px solid var(--border); color: var(--muted); position: relative; z-index: 1; }
.flow-step.fs-ok .flow-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.flow-step.fs-progress .flow-dot { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); }
.flow-step.fs-warn .flow-dot { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.flow-step.fs-bad .flow-dot { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.flow-step.fs-ok::before, .flow-step.fs-progress::before, .flow-step.fs-warn::before { background: var(--ok); }
.flow-step .est { font-weight: 700; color: var(--fg); }

/* Calendario */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.cal .dow { background: var(--surface-2); font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: .45rem; text-align: center; }
.cal .day { min-height: 6.2rem; border-top: 1px solid var(--border); border-left: 1px solid var(--border); padding: .35rem; display: flex; flex-direction: column; gap: .2rem; cursor: pointer; background: var(--surface); min-width: 0; }
.cal .day:nth-child(7n + 1) { border-left: 0; }
.cal .day:hover { background: var(--surface-2); }
.cal .day.other { opacity: .45; }
.cal .day.today .num { background: var(--primary); color: #fff; }
.cal .num { font-size: .75rem; font-weight: 700; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; }
.ev { font-size: .7rem; padding: .12rem .35rem; border-radius: 5px; background: var(--primary-soft); color: var(--primary-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ev.mant { background: var(--blue-soft); color: var(--blue); }
.ev.done { opacity: .55; text-decoration: line-through; }
@media (max-width: 760px) { .cal .day { min-height: 3.6rem; } .cal .ev { font-size: 0; padding: 0; height: .4rem; } }

/* Tablero de tareas */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } }
.lane { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; display: grid; gap: .55rem; }
.lane h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; justify-content: space-between; padding: .15rem .25rem .3rem; }
.tcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; display: grid; gap: .35rem; cursor: pointer; border-left: 3px solid var(--border); }
.tcard:hover { border-color: var(--primary); }
.tcard.p-alta, .tcard.p-urgente { border-left-color: var(--bad); }
.tcard.p-media { border-left-color: var(--primary-2); }
.tcard.p-baja { border-left-color: var(--blue); }
.tcard .t { font-weight: 600; font-size: .9rem; }
.tcard .m { font-size: .75rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; }
.tcard .late { color: var(--bad); font-weight: 600; }

/* Gráfico de barras */
.bars { display: flex; align-items: flex-end; gap: .9rem; height: 10rem; padding-top: .5rem; }
.bars .col { flex: 1; display: grid; grid-template-rows: 1fr auto; gap: .35rem; height: 100%; min-width: 0; }
.bars .pair { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.bars .bar { flex: 1; border-radius: 5px 5px 0 0; min-height: 2px; }
.bars .bar.in { background: var(--ok); }
.bars .bar.out { background: var(--primary-2); }
.bars .lbl { font-size: .7rem; color: var(--muted); text-align: center; }
.legend { display: flex; gap: 1rem; font-size: .75rem; color: var(--muted); }
.legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }

/* Cotización */
.items-table input { padding: .4rem .5rem; font-size: .85rem; }
.items-table td { padding: .35rem .4rem; }
.totals { display: grid; grid-template-columns: auto auto; gap: .3rem 1.5rem; justify-content: end; font-size: .9rem; margin-top: .75rem; }
.totals .grand { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 1.1rem; color: var(--primary-ink); }

/* Firma */
.sigpad { width: 100%; height: 13rem; border: 2px dashed var(--border); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }

.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 1.25rem; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }

.chip-list { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .55rem .3rem .7rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .82rem; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0 .15rem; font-size: 1rem; line-height: 1; }

@media print {
  .topbar, .sidebar, .toolbar, .btn { display: none !important; }
  .layout { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-back, .modal, .toast { animation: none; }
}
