/* ============================================================
   SIOCODE — Sistema de diseño v2  (tema claro/oscuro + animaciones)
   ============================================================ */
:root {
  --orange: #f47b20;
  --orange-dark: #df6a0e;
  --orange-light: #fff2e7;
  --navy: #182230;
  --navy-2: #33414f;
  --ink: #212a35;
  --muted: #6b7784;
  --line: #e6eaf0;
  --line-strong: #d3dae3;
  --bg: #f5f7fa;
  --bg-2: #eef1f6;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --blue: #2f6fed;
  --green: #1f9d55;
  --green-bg: #e6f7ee;
  --amber: #b7791f;
  --amber-bg: #fff6e2;
  --red: #dc4b4b;
  --red-bg: #fdecec;
  --violet: #6b46c1;
  --violet-bg: #efe9fb;
  --teal: #0e9aa7;
  --gray-bg: #eef1f5;
  --ring: rgba(244, 123, 32, .35);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 6px 20px rgba(16, 24, 40, .09), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .3);
  --radius: 10px;
  --radius-lg: 16px;
  --sidebar-w: 272px;
  --topbar-h: 60px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme="dark"] {
  --navy: #eef3f9;
  --navy-2: #c3ccd8;
  --ink: #dbe3ec;
  --muted: #8b98a8;
  --line: #26303b;
  --line-strong: #33404e;
  --bg: #0d1117;
  --bg-2: #111823;
  --panel: #151c26;
  --panel-2: #1a222d;
  --orange-light: #2a1d12;
  --green-bg: #11281e;
  --amber-bg: #2a2212;
  --red-bg: #2b1618;
  --violet-bg: #1f1a2e;
  --gray-bg: #1c2531;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 26px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s var(--ease), color .25s var(--ease);
}
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 700; color: var(--navy); letter-spacing: -.02em; }
a { color: var(--blue); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
::selection { background: var(--orange); color: #fff; }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* SVG icon wrapper */
.svg-ico { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.svg-ico svg { width: 100%; height: 100%; display: block; }

/* Tool chips */
.tico {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: color-mix(in srgb, var(--tc) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc) 24%, transparent);
  border-radius: 9px; line-height: 1;
}
.tico-sm { width: 26px; height: 26px; font-size: 13px; border-radius: 8px; }
.tico-md { width: 32px; height: 32px; font-size: 16px; }
.tico-lg { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; line-height: 1.2; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; transition: transform .12s var(--ease), background .15s, border-color .15s, box-shadow .15s;
}
.btn .svg-ico { margin-left: -2px; }
.btn:hover { background: var(--panel-2); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--orange) 92%, #fff) 0%, var(--orange) 100%);
  border-color: var(--orange-dark); color: #fff;
  box-shadow: 0 1px 2px rgba(244, 123, 32, .4), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--orange) 0%, var(--orange-dark) 100%); box-shadow: 0 4px 14px rgba(244, 123, 32, .38); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--ink); }
.btn-danger { background: var(--panel); border-color: color-mix(in srgb, var(--red) 45%, transparent); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.icon-btn {
  background: transparent; border: none; cursor: pointer;
  width: 40px; height: 40px; border-radius: 10px; color: var(--navy-2);
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  transition: background .15s, color .15s, transform .12s var(--ease);
}
.icon-btn:hover { background: var(--gray-bg); color: var(--navy); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .svg-ico { --sz: 19px; }
.has-badge .badge-count {
  position: absolute; top: 6px; right: 6px; background: linear-gradient(180deg, #ff6b6b, var(--red)); color: #fff;
  font-size: 10px; font-weight: 800; border-radius: 10px; padding: 1px 5px; line-height: 1.4;
  box-shadow: 0 0 0 2px var(--panel);
}

/* ---------- Login ---------- */
.login-screen { display: flex; min-height: 100vh; }
.login-aside {
  flex: 1.15; position: relative; overflow: hidden; color: #eef2f6; padding: 60px 64px;
  display: flex; flex-direction: column;
  background: radial-gradient(1200px 600px at 15% 10%, #2b3a4a 0%, #182230 55%, #0d141d 100%);
}
.login-aside::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 46px 46px; mask-image: radial-gradient(circle at 30% 30%, #000 30%, transparent 75%);
}
.login-aside::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(244,123,32,.45), transparent 68%); filter: blur(10px);
}
.login-brand { position: relative; font-size: 22px; font-weight: 800; letter-spacing: -.03em; display: flex; align-items: center; gap: 11px; }
.login-brand .brand-sub { font-weight: 500; opacity: .55; font-size: 14px; }
.login-aside h1 { position: relative; color: #fff; font-size: 44px; margin: 44px 0 16px; letter-spacing: -.04em; line-height: 1.05; }
.login-aside p { position: relative; color: #b9c6d4; font-size: 16px; line-height: 1.65; max-width: 470px; }
.login-features { position: relative; list-style: none; padding: 0; margin: 32px 0; display: grid; gap: 15px; }
.login-features li { padding-left: 34px; position: relative; color: #cdd8e3; }
.login-features li::before {
  content: "✓"; position: absolute; left: 0; top: -2px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(244,123,32,.18); color: var(--orange); font-weight: 800; font-size: 12px;
  display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(244,123,32,.4);
}
.login-features b { color: #fff; }
.login-foot { position: relative; margin-top: auto; font-size: 12px; color: #7f8d9c; }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 40px; }
.login-card {
  background: var(--panel); padding: 40px; border-radius: 20px;
  box-shadow: 0 30px 70px rgba(16,24,40,.18), 0 2px 6px rgba(16,24,40,.06);
  width: 100%; max-width: 410px; border: 1px solid var(--line);
  animation: popIn .5s var(--ease) both;
}
.login-card h2 { font-size: 26px; letter-spacing: -.03em; }
.login-card label { display: block; font-weight: 600; font-size: 13px; margin: 16px 0 0; color: var(--navy-2); }
.login-card input, .login-card select {
  width: 100%; margin-top: 6px; padding: 11px 13px; border: 1px solid var(--line-strong);
  border-radius: 9px; font: inherit; background: var(--panel); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus, .login-card select:focus, .filterbar input:focus, .filterbar select:focus,
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--ring);
}
.login-card .btn { margin-top: 22px; }
.login-card .btn-ghost { margin-top: 8px; }

/* ---------- App shell ---------- */
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; padding: 0 14px; z-index: 40; flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 4px; min-width: 0; }
.topbar-center { flex: 1; display: flex; justify-content: center; padding: 0 16px; }
.topbar-right { display: flex; align-items: center; gap: 2px; }
.brand-mark {
  background: linear-gradient(140deg, #ff9a4d, var(--orange)); color: #fff; font-weight: 800; width: 32px; height: 32px;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
  box-shadow: 0 2px 8px rgba(244,123,32,.4);
}
.brand-mark.small { width: 28px; height: 28px; font-size: 15px; border-radius: 8px; }
.company-switch, .project-switch { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.company-switch:hover, .project-switch:hover { background: var(--gray-bg); }
.company-meta { display: flex; flex-direction: column; line-height: 1.2; }
.company-name { font-weight: 700; font-size: 13px; }
.company-scope { font-size: 11px; color: var(--muted); }
.project-switch { border-left: 1px solid var(--line); margin-left: 4px; }
.project-name { font-weight: 650; font-size: 13px; color: var(--navy-2); max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { color: var(--muted); margin-left: -2px; }
.global-search { position: relative; width: 100%; max-width: 560px; }
.global-search input {
  width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--line-strong);
  border-radius: 12px; font: inherit; background: var(--bg); color: var(--ink); transition: box-shadow .15s, border-color .15s, background .15s;
}
.global-search input:focus { outline: none; background: var(--panel); border-color: var(--orange); box-shadow: 0 0 0 3px var(--ring); }
.global-search .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer; margin-left: 4px;
  background: linear-gradient(140deg, var(--navy-2), var(--navy)); color: #fff; font-weight: 700; font-size: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .12s var(--ease);
}
.avatar:hover { transform: translateY(-1px); }
.brand-logo { display: block; object-fit: contain; object-position: center; background: #fff; }
.brand-logo-login { width: 190px; height: 96px; border-radius: 10px; padding: 6px 10px; }
.brand-logo-topbar { width: 42px; height: 32px; border-radius: 7px; padding: 2px 4px; flex-shrink: 0; }
.dropdown {
  position: absolute; top: 56px; right: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); min-width: 268px; z-index: 60; overflow: hidden;
  animation: popIn .16s var(--ease) both;
}
.dropdown-head { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; background: var(--panel-2); }
.dropdown-item { display: block; width: 100%; text-align: left; padding: 12px 16px; background: none; border: none; font: inherit; cursor: pointer; border-bottom: 1px solid var(--line); color: var(--ink); transition: background .12s; }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--gray-bg); }
.dropdown-item.danger { color: var(--red); }

.layout { flex: 1; display: flex; min-height: 0; }

/* ---------- Sidebar / toolbox ---------- */
.sidebar {
  width: var(--sidebar-w); background: var(--panel); border-right: 1px solid var(--line);
  overflow-y: auto; flex-shrink: 0; transition: margin-left .25s var(--ease);
}
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-w)); }
.sidebar-search { padding: 14px 14px 10px; position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 2; }
.sidebar-search input { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px; font: inherit; background: var(--bg); color: var(--ink); }
.sidebar-search input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--ring); background: var(--panel); }
.toolbox { padding: 8px 8px 48px; }
.tool-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
  font-weight: 800; padding: 16px 10px 6px;
}
.tool-item {
  display: flex; align-items: center; gap: 11px; padding: 7px 10px; cursor: pointer;
  font-size: 13.5px; color: var(--navy-2); border-radius: 9px; position: relative; margin-bottom: 1px;
  transition: background .13s, color .13s;
}
.tool-item:hover { background: var(--gray-bg); }
.tool-item.active {
  background: color-mix(in srgb, var(--orange) 12%, transparent);
  color: var(--orange-dark); font-weight: 650;
}
[data-theme="dark"] .tool-item.active { color: #ffb066; }
.tool-item.active::before {
  content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px;
  background: var(--orange);
}
.tool-item .t-ico { display: flex; }
.tool-item .flex1 { flex: 1; }
.tool-item .star { position: absolute; right: 8px; opacity: 0; font-size: 13px; transition: opacity .15s, transform .15s; }
.tool-item:hover .star { opacity: .45; }
.tool-item .star.on { opacity: 1; color: var(--orange); }

/* ---------- Content ---------- */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.context-bar { padding: 10px 24px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--panel); }
.context-bar b { color: var(--navy-2); }
.context-bar .sep { margin: 0 8px; opacity: .45; }
.view { flex: 1; overflow-y: auto; padding: 26px; scroll-behavior: smooth; }
.view > * { animation: fadeUp .32s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: .03s; }
.view > *:nth-child(3) { animation-delay: .06s; }
.view > *:nth-child(4) { animation-delay: .09s; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { display: flex; align-items: center; gap: 14px; }
.page-title h1 { font-size: 25px; margin: 0; letter-spacing: -.03em; }
.page-title .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 10px 16px; cursor: pointer; font-weight: 650; color: var(--muted); font-size: 13.5px;
  border: none; background: none; position: relative; transition: color .15s; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--ink); background: var(--gray-bg); }
.tab.active { color: var(--orange-dark); }
[data-theme="dark"] .tab.active { color: #ffb066; }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--orange); }

/* ---------- Cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s;
}
.card-pad { padding: 20px; }
.card-head { padding: 15px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1180px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* Clickable cards (quick links) */
.card[data-goto], .card[data-project] { cursor: pointer; }
.card[data-goto]:hover, .card[data-project]:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--orange) 35%, var(--line)); }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 5px; }
.kpi .kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kpi .kpi-value { font-size: 30px; font-weight: 800; color: var(--navy); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.kpi .kpi-delta { font-size: 12.5px; font-weight: 650; }
.kpi .up { color: var(--green); } .kpi .down { color: var(--red); }
.kpi-card { position: relative; overflow: hidden; }
.kpi-card::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--orange)); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.kpi-spark { height: 34px; margin-top: 12px; }
.kpi-spark canvas { width: 100%; height: 100%; }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data thead th {
  text-align: left; padding: 12px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); position: sticky; top: 0;
  white-space: nowrap; cursor: pointer; user-select: none; font-weight: 750; transition: color .15s, background .15s;
}
table.data thead th:hover { color: var(--navy-2); }
table.data thead th.no-sort { cursor: default; }
table.data tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.selected { background: color-mix(in srgb, var(--orange) 10%, transparent); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .chev { color: var(--muted); }
table.data tfoot td { padding: 12px 14px; border-top: 1px solid var(--line-strong); }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge.gray { background: var(--gray-bg); color: var(--muted); }
.badge.blue { background: #e7effd; color: var(--blue); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.orange { background: var(--orange-light); color: var(--orange-dark); }
[data-theme="dark"] .badge.blue { background: #14233d; color: #7aa7ff; }
[data-theme="dark"] .badge.orange { color: #ffb066; }
[data-theme="dark"] .badge.green { color: #57d695; }
[data-theme="dark"] .badge.amber { color: #e2b355; }
[data-theme="dark"] .badge.red { color: #ff8f8f; }
[data-theme="dark"] .badge.violet { color: #b79dff; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 750; background: var(--gray-bg); color: var(--muted); }

/* ---------- Filter bar ---------- */
.filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filterbar .search { position: relative; }
.filterbar input[type=search], .filterbar input[type=text], .filterbar select {
  padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: 9px; font: inherit; background: var(--panel); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.filterbar input[type=search] { min-width: 260px; }
.filterbar .spacer { flex: 1; }
.filters-active { display: flex; gap: 8px; flex-wrap: wrap; }
.filters-active .badge b { cursor: pointer; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 650; font-size: 12.5px; color: var(--navy-2); }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px; font: inherit; background: var(--panel); color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 20%, transparent); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }

/* ---------- Detail ---------- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-list { display: grid; grid-template-columns: 168px 1fr; gap: 12px 18px; }
.detail-list dt { color: var(--muted); font-weight: 650; font-size: 12.5px; }
.detail-list dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 20px 24px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 22%, transparent); }
.timeline .t-when { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.attachments { display: grid; gap: 8px; }
.attach { display: flex; align-items: center; gap: 11px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; transition: border-color .15s, background .15s; }
.attach:hover { border-color: var(--line-strong); background: var(--panel-2); }
.attach .a-ico { display: flex; }

/* ---------- Gantt ---------- */
.gantt { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: var(--panel); box-shadow: var(--shadow-sm); }
.gantt-head, .gantt-row { display: grid; grid-template-columns: 320px 1fr; min-width: 900px; }
.gantt-head { position: sticky; top: 0; z-index: 3; background: var(--panel-2); border-bottom: 1px solid var(--line-strong); font-size: 11px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.gantt-head .name { padding: 11px 14px; border-right: 1px solid var(--line); }
.gantt-scale { display: flex; }
.gantt-scale .cell { flex: 1; padding: 11px 6px; text-align: center; border-right: 1px solid var(--line); }
.gantt-row { border-bottom: 1px solid var(--line); }
.gantt-row .name, .gantt-row .track { padding: 10px 14px; font-size: 12.5px; }
.gantt-row .name { border-right: 1px solid var(--line); }
.gantt-row .track { position: relative; height: 44px; background:
  repeating-linear-gradient(90deg, transparent, transparent calc(100% / 12 - 1px), var(--line) calc(100% / 12 - 1px), var(--line) calc(100% / 12)); }
.gantt-bar {
  position: absolute; top: 10px; height: 24px; border-radius: 6px; color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; padding: 0 9px; overflow: hidden; white-space: nowrap;
  background: linear-gradient(180deg, #4a83f0, var(--blue)); box-shadow: 0 2px 6px rgba(47,111,237,.35);
  animation: barIn .6s var(--ease) both;
}
.gantt-bar.done { background: linear-gradient(180deg, #34b06c, var(--green)); box-shadow: 0 2px 6px rgba(31,157,85,.35); }
.gantt-bar.late { background: linear-gradient(180deg, #ee6b6b, var(--red)); box-shadow: 0 2px 6px rgba(220,75,75,.35); }
.gantt-bar.milestone { background: linear-gradient(180deg, #8a68d8, var(--violet)); border-radius: 4px; box-shadow: 0 2px 6px rgba(107,70,193,.4); }
.gantt-bar .pct { margin-left: 8px; opacity: .85; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--orange); z-index: 2; box-shadow: 0 0 8px var(--orange); }

/* ---------- Drawings grid ---------- */
.dwg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 16px; }
.dwg { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }
.dwg:hover { box-shadow: var(--shadow); transform: translateY(-4px); border-color: color-mix(in srgb, var(--orange) 35%, var(--line)); }
.dwg .thumb { aspect-ratio: 4/3; background: #fff; display: grid; place-items: center; border-bottom: 1px solid var(--line); }
.dwg .dwg-meta { padding: 12px 13px; }
.dwg .dwg-meta b { font-size: 13px; }
.dwg .dwg-meta .rev { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.dwg-viewer { background: #22303f; border-radius: var(--radius); display: grid; place-items: center; padding: 20px; }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 14px; }
.photo { border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line); cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.photo:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.photo .ph { aspect-ratio: 4/3; display: grid; place-items: center; font-size: 32px; overflow: hidden; background: var(--gray-bg); }
.photo .ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.photo:hover .ph img { transform: scale(1.06); }
.photo .ph-meta { padding: 10px 12px; font-size: 12px; }

/* ---------- Portadas de proyecto / héroe ---------- */
.proj-card { overflow: hidden; }
.proj-card .cover { position: relative; height: 118px; overflow: hidden; }
.proj-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s var(--ease); }
.proj-card:hover .cover img { transform: scale(1.05); }
.cover-logo { position: absolute; left: 12px; bottom: 10px; font-size: 26px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.hero { position: relative; height: 156px; border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 20px; color: #fff; display: flex; flex-direction: column; gap: 3px;
  background: linear-gradient(to top, rgba(10,16,24,.82), rgba(10,16,24,0)); }
.hero-text b { font-size: 18px; }
.hero-text span { font-size: 12.5px; opacity: .85; }

/* ---------- Directory ---------- */
.dir-list { display: grid; gap: 10px; }
.dir-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.dir-ava { width: 44px; height: 44px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 750; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.dir-card .meta { flex: 1; min-width: 0; }
.dir-card .meta b { font-size: 14px; }
.dir-card .meta .sub { font-size: 12.5px; color: var(--muted); }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; height: 240px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 600; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(12, 18, 26, .55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 80; padding: 24px; animation: overlayIn .18s ease both; }
.overlay-card { background: var(--panel); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 580px; max-height: 90vh; overflow: auto; border: 1px solid var(--line); animation: popIn .22s var(--ease) both; }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1120px; }
.overlay-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.overlay-head h3 { margin: 0; font-size: 18px; }
.overlay-body { padding: 24px; }
.overlay-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--panel); }
.toolbox-card { max-width: 940px; }
.toolbox-grid { padding: 22px 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 760px) { .toolbox-grid { grid-template-columns: 1fr; } }
.toolbox-grid h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; font-weight: 800; }
.toolbox-grid .tg-link { display: flex; align-items: center; gap: 9px; padding: 7px 8px; color: var(--navy-2); cursor: pointer; font-size: 13.5px; border-radius: 8px; transition: background .13s; }
.toolbox-grid .tg-link:hover { background: var(--gray-bg); color: var(--orange-dark); }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel); color: var(--ink); padding: 13px 18px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; border: 1px solid var(--line);
  border-left: 4px solid var(--blue); animation: toastIn .28s var(--ease) both; display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 64px 20px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 12px; filter: grayscale(.1); }
.empty b { color: var(--navy-2); font-size: 15px; }

/* ---------- Progress ---------- */
.progress { background: var(--gray-bg); border-radius: 20px; height: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, #34b06c, var(--green)); transition: width .6s var(--ease); }
.progress.warn > i { background: linear-gradient(90deg, #e0ac4e, var(--amber)); }
.progress.bad > i { background: linear-gradient(90deg, #ee6b6b, var(--red)); }

/* ---------- Map pins ---------- */
.map-pin { transition: transform .15s var(--ease), filter .15s; }
.map-pin:hover { transform: translate(-50%, -100%) scale(1.25) !important; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); z-index: 5; }

/* ---------- Utilities ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.flex1 { flex: 1; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes barIn { from { opacity: 0; transform: scaleX(.4); transform-origin: left; } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Responsive */
@media (max-width: 900px) {
  .login-aside { display: none; }
  .topbar-center { display: none; }
  .sidebar { position: absolute; z-index: 50; height: calc(100% - var(--topbar-h)); box-shadow: var(--shadow); }
  .sidebar:not(.collapsed) ~ .content::before { content: ""; }
  .view { padding: 18px; }
}
