/* ============ Tokens ============ */
:root {
  --bg: #f6f7fb;
  --bg-soft: #eef0f6;
  --panel: #ffffff;
  --panel-2: #f9fafc;
  --border: #e4e7ef;
  --border-strong: #d3d8e4;
  --text: #171a23;
  --text-2: #4a5061;
  --muted: #7d8497;
  --accent: #5b4cf0;
  --accent-2: #7c6cff;
  --accent-soft: #eeecff;
  --accent-ink: #3d2fd0;
  --green: #11a36a;
  --green-soft: #e3f7ee;
  --red: #e0445c;
  --red-soft: #fdecef;
  --amber: #d98a0b;
  --amber-soft: #fff4dd;
  --blue: #2878e0;
  --blue-soft: #e6f0fd;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, .06);
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 6px 20px rgba(20, 24, 40, .06);
  --shadow-lg: 0 20px 60px rgba(20, 24, 40, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 248px;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d0f15;
  --bg-soft: #151822;
  --panel: #151821;
  --panel-2: #1a1e29;
  --border: #252a37;
  --border-strong: #323849;
  --text: #eceef4;
  --text-2: #b6bbca;
  --muted: #8189a0;
  --accent: #8b7dff;
  --accent-2: #a396ff;
  --accent-soft: #231f45;
  --accent-ink: #bdb4ff;
  --green: #34d399;
  --green-soft: #10291f;
  --red: #fb7185;
  --red-soft: #33161d;
  --amber: #fbbf24;
  --amber-soft: #2e2410;
  --blue: #60a5fa;
  --blue-soft: #122238;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255,255,255,.02), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 70px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

/* ============ Layout ============ */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), #22c1ee); box-shadow: 0 4px 14px rgba(91, 76, 240, .35);
  font-weight: 700;
}
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.nav-group { margin-top: 14px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px;
  color: var(--text-2); font-weight: 500; text-decoration: none; margin: 1px 0; position: relative;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav a .count {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 0 7px; line-height: 18px;
}
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.guia-mini { background: var(--bg-soft); border-radius: 12px; padding: 12px; font-size: 12.5px; cursor: pointer; }
.guia-mini .bar { margin-top: 8px; background: var(--border); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.search-btn {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 10px 7px 12px; color: var(--muted); cursor: pointer; min-width: 220px;
}
.search-btn kbd { margin-left: auto; font-size: 11px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); color: var(--text-2); position: relative;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid var(--panel); }
.content { padding: 8px 28px 60px; max-width: 1280px; width: 100%; }
.menu-btn { display: none; }

/* ============ Buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none !important; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg.i { width: 16px; height: 16px; }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); filter: none; }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 6px; width: 30px; height: 30px; border-radius: 8px; background: transparent; color: var(--muted); border: none; }
.btn-icon:hover { background: var(--bg-soft); color: var(--text); filter: none; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--muted); font-weight: 400; }
.input, .field input, .field select, .field textarea, select.input {
  width: 100%; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 8px 11px; outline: none; transition: border-color .15s, box-shadow .15s; min-height: 38px;
}
.field textarea { min-height: 84px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin-top: 1px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; background: var(--bg-soft); border-radius: 10px; padding: 3px; gap: 2px; border: 1px solid var(--border); }
.seg button { border: none; background: transparent; padding: 5px 12px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-weight: 500; font-size: 13px; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============ Cards ============ */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.card-head h3 { font-size: 15px; font-weight: 650; }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px 20px 18px; }
.grid { display: grid; gap: 16px; }
.grid > *, .cal-layout > *, .stack > *, .board > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.kpi .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.kpi .ico svg.i { width: 16px; height: 16px; }
.kpi.accent { background: linear-gradient(135deg, var(--accent), #6f5ff7 60%, #2cb6e8); color: #fff; border: none; }
.kpi.accent .label, .kpi.accent .foot { color: rgba(255,255,255,.82); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-accent { background: var(--accent-soft); color: var(--accent-ink); }
.pos { color: var(--green); } .neg { color: var(--red); }

.bar { height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #2cb6e8); border-radius: 99px; transition: width .6s ease; }
.bar.warn > i { background: linear-gradient(90deg, var(--amber), #f97316); }
.bar.danger > i { background: var(--red); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--bg-soft); color: var(--text-2); white-space: nowrap;
}
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: 13.5px; }
.alert svg.i { margin-top: 1px; }
.alert.info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.alert.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.alert.danger { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert b { font-weight: 650; }
.alerts { display: flex; flex-direction: column; gap: 8px; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: none; }
table.t tbody tr:hover { background: var(--panel-2); }
table.t .r { text-align: right; }
table.t .actions { text-align: right; white-space: nowrap; width: 1%; }
table.t tfoot td { font-weight: 700; border-top: 1px solid var(--border-strong); border-bottom: none; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 6px; }

.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: none; }
.li .grow { flex: 1; min-width: 0; }
.li .t1 { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .t2 { font-size: 12.5px; color: var(--muted); }
.date-badge { width: 44px; text-align: center; border-radius: 10px; background: var(--bg-soft); padding: 4px 0; flex-shrink: 0; }
.date-badge .d { font-size: 17px; font-weight: 700; line-height: 1.1; }
.date-badge .m { font-size: 10.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }

/* ============ Modal ============ */
dialog.modal {
  border: none; padding: 0; border-radius: 18px; background: var(--panel); color: var(--text);
  width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow-lg);
}
dialog.modal.wide { width: min(880px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10, 12, 20, .45); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .18s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 6px; }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 12px 22px 8px; overflow-y: auto; max-height: calc(100vh - 190px); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px 18px; }
.modal-foot .left { margin-right: auto; }

/* ============ Toast ============ */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .2s ease; max-width: 360px; }
.toast.error { background: var(--red); color: #fff; }

/* ============ Command palette ============ */
.palette-list { max-height: 360px; overflow-y: auto; margin: 0 -8px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; color: var(--text-2); }
.palette-item.on { background: var(--accent-soft); color: var(--accent-ink); }
.palette-item .k { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.palette-input { font-size: 16px; border: none !important; box-shadow: none !important; padding: 4px 2px !important; background: transparent !important; }

/* ============ Login ============ */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent),
              radial-gradient(900px 500px at 110% 110%, rgba(44,182,232,.18), transparent), var(--bg); }
.login-card { width: min(400px, 100%); padding: 32px; }
.login-card h2 { font-size: 22px; margin: 18px 0 4px; }

/* ============ Chart ============ */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 12px; z-index: 999; white-space: nowrap; }

/* ============ Calendar ============ */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cal .dow { padding: 8px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; background: var(--panel-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal .day { min-height: 108px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--panel); cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day:hover { background: var(--panel-2); }
.cal .day.out { background: var(--bg); }
.cal .day.out .n { color: var(--muted); opacity: .6; }
.cal .day .n { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .n { background: var(--accent); color: #fff; }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.ev { font-size: 11.5px; padding: 2px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; border-left: 3px solid; }
.ev.done { opacity: .5; text-decoration: line-through; }
.ev.more { border: none; color: var(--muted); background: none !important; }
.t-fiscal { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.t-tarea { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.t-cliente { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.t-personal { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.t-ayuda { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.t-nota { background: var(--bg-soft); color: var(--text-2); border-color: var(--muted); }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }

/* ============ Board ============ */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--bg-soft); border-radius: 14px; padding: 10px; min-height: 200px; border: 1px solid var(--border); }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 650; }
.col-head .n { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.col-head .spacer { flex: 1; }
.col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.note {
  background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; cursor: grab;
  box-shadow: var(--shadow-sm); position: relative; border-top: 4px solid var(--nc, transparent);
}
.note:hover { border-color: var(--border-strong); }
.note.dragging { opacity: .4; }
.note .nt { font-weight: 600; margin-bottom: 2px; padding-right: 18px; word-break: break-word; }
.note .nb { font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 110px; overflow: hidden; }
.note .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.note .pin { position: absolute; top: 9px; right: 9px; color: var(--accent); }
.quick-add { width: 100%; border: 1px dashed var(--border-strong); background: transparent; border-radius: 10px; padding: 8px; color: var(--muted); cursor: pointer; margin-top: 8px; font-weight: 500; }
.quick-add:hover { color: var(--text); background: var(--panel); }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.colors button.on { box-shadow: 0 0 0 2px var(--accent); }
.cl-item { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.cl-item input[type=text] { flex: 1; border: none; background: transparent; outline: none; padding: 4px; border-bottom: 1px solid transparent; }
.cl-item input[type=text]:focus { border-bottom-color: var(--accent); }

/* ============ Guide ============ */
.step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: none; }
.step .tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; background: var(--panel); color: transparent; transition: all .15s; }
.step .tick:hover { border-color: var(--green); }
.step.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.step.done .st { color: var(--muted); text-decoration: line-through; }
.step .st { font-weight: 600; }
.step .sd { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.step .links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; }
details.acc { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); margin-bottom: 10px; }
details.acc summary { padding: 14px 18px; cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "+"; margin-left: auto; font-size: 18px; color: var(--muted); }
details.acc[open] summary::after { content: "–"; }
details.acc .acc-body { padding: 0 18px 16px; color: var(--text-2); font-size: 13.5px; }
details.acc .acc-body ul { padding-left: 18px; margin: 6px 0; }
details.acc .acc-body li { margin: 4px 0; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--border) 0); }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 700; font-size: 14px; }

/* ============ Misc ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { border: none; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 13.5px; }
.kv .k { color: var(--text-2); }
.kv .v { text-align: right; font-weight: 600; }
.kv .sep { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 4px 0; }
.lines-table input { min-height: 34px; padding: 6px 8px; }
.skeleton { background: linear-gradient(90deg, var(--bg-soft), var(--panel-2), var(--bg-soft)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.bottom-nav { display: none; }
.hello { font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
.hucha { display: flex; gap: 16px; align-items: center; }
.pill-link { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 600; }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 280px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 16px; }
  .topbar h1 { font-size: 18px; }
  .topbar .sub, .search-btn { display: none; }
  .content { padding: 6px 16px 90px; }
  .g2, .g3, .span2 { grid-template-columns: 1fr; grid-column: auto; }
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .cal .day { min-height: 64px; padding: 3px; }
  .cal .ev { font-size: 0; padding: 0; height: 6px; border-radius: 3px; border-left: none; background: currentColor !important; }
  .cal .ev.more { display: none; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--panel);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 4px 0; font-weight: 600; }
  .bottom-nav a.active { color: var(--accent); }
  .toasts { left: 16px; right: 16px; bottom: 80px; }
  .hide-m { display: none !important; }
  .toolbar > .btn:last-child { margin-left: auto; }
  table.t.stack-mobile thead { display: none; }
  table.t.stack-mobile tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 12px; border-bottom: 1px solid var(--border); gap: 2px 8px; }
  table.t.stack-mobile td { border: none; padding: 0; }
  table.t.stack-mobile td.hide-m { display: none; }
  table.t.stack-mobile td.actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
}

input[type=range] { accent-color: var(--accent); width: 100%; }
.cap::first-letter { text-transform: uppercase; }

.mapa path { transition: filter .15s; cursor: default; }
.mapa path:hover { filter: brightness(.85); stroke: var(--text); stroke-width: .8; }
code { font-size: 12px; background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; }
.stack > details.acc { margin-bottom: 0; }

/* Ficha del usuario en la barra lateral */
.usuario-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--bg-soft); margin-bottom: 10px; }
.usuario-chip .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), #22c1ee); flex-shrink: 0; }
.usuario-chip .t1 { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-chip .t2 { font-size: 11.5px; color: var(--muted); }

/* ---------- Usuarios y permisos ---------- */
.avatar-grande { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), #22c1ee); flex-shrink: 0; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.roles .rol { text-align: left; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.roles .rol b { display: block; font-size: 13.5px; }
.roles .rol span { font-size: 12px; color: var(--muted); }
.roles .rol.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.permisos { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; padding-right: 4px; }
.permiso-fila { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.seg-sm button { padding: 3px 8px; font-size: 12px; }

/* ---------- Entorno de IA ---------- */
.chat-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 460px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.yo { justify-content: flex-end; }
.msg .burbuja { max-width: 80%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.yo .burbuja { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.ia .burbuja { background: var(--bg-soft); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.equipo .burbuja { background: var(--bg-soft); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-bottom-left-radius: 4px; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 5px; opacity: .8; }
.msg.yo .meta { color: rgba(255,255,255,.75); }
.hilo-sop { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.msg-ava { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0; }
.msg-ava svg.i { width: 15px; height: 15px; }
.herramienta { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.herramienta svg.i { width: 14px; height: 14px; }
.escribiendo { color: var(--muted); font-style: italic; }
.chat-sug { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; }
.chat-sug .chip { cursor: pointer; white-space: nowrap; }
.chat-sug .chip:hover { background: var(--accent-soft); color: var(--accent-ink); }
.chat-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input textarea { flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; background: var(--panel); outline: none; font: inherit; max-height: 160px; }
.chat-input textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-input .btn { height: 40px; padding: 0 14px; }
pre.codigo { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 12px; margin: 0; }
@media (max-width: 1100px) { .chat-wrap { grid-template-columns: 1fr; } .chat-card { height: auto; min-height: 420px; } }

/* ---------- Apartado Equipo (antes panel.ia-plugins.com) ---------- */
.eq-ava { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; letter-spacing: -.02em; }
.eq-board { grid-template-columns: repeat(3, minmax(250px, 1fr)); }
.eq-task { cursor: pointer; border-left: 3px solid var(--nc, transparent); }
.eq-task .meta .eq-ava { box-shadow: 0 0 0 2px var(--panel); }
.eq-proj { cursor: pointer; transition: transform .15s, box-shadow .15s; border-top: 3px solid var(--pc); }
.eq-proj:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.eq-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); flex-shrink: 0; }
.eq-dia { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border); padding: 2px 10px; border-radius: 99px; text-transform: capitalize; }
.eq-quien { font-size: 12px; font-weight: 650; color: var(--accent-ink); margin-bottom: 2px; }
.eq-men { color: var(--accent-ink); background: var(--accent-soft); border-radius: 5px; padding: 0 3px; font-weight: 600; }
.eq-men.yo { background: var(--amber-soft); color: var(--amber); }
.msg.yo .eq-men { background: rgba(255,255,255,.2); color: #fff; }
.msg .burbuja a { color: inherit; text-decoration: underline; }
.eq-code { width: 100%; min-height: 55vh; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; tab-size: 2; white-space: pre; resize: vertical; }
.eq-md { font-size: 14px; line-height: 1.65; }
.eq-md h3, .eq-md h4, .eq-md h5 { margin: 16px 0 6px; }
.eq-md p { margin: 0 0 8px; }
.eq-md ul { margin: 0 0 10px; padding-left: 20px; }
.eq-md code { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 5px; padding: 0 4px; font-size: 12.5px; }
.eq-md pre.codigo { margin: 0 0 10px; white-space: pre-wrap; }
.eq-tool { position: relative; transition: border-color .15s; }
.eq-tool:hover { border-color: var(--accent); }
.eq-tool-acc { position: absolute; top: 6px; right: 6px; display: none; gap: 2px; }
.eq-tool:hover .eq-tool-acc { display: flex; }
@media (max-width: 760px) { .eq-board { grid-template-columns: repeat(3, 82vw); } .eq-tool-acc { display: flex; } }

/* ---------- Iconos en lugar de emojis ---------- */
.empty .big { display: none; }
.empty-ico { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent); }
.empty-ico svg.i { width: 24px; height: 24px; stroke-width: 1.6; }
svg.i.h-ico { width: 17px; height: 17px; margin-right: 8px; vertical-align: -3px; color: var(--accent); }
svg.i.in-ico { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; opacity: .8; }
.chip svg.i { width: 13px; height: 13px; vertical-align: -2px; }
.col-tit { display: inline-flex; align-items: center; gap: 7px; }
.col-tit svg.i { width: 16px; height: 16px; color: var(--muted); }
.col[data-col="hecho"] .col-tit svg.i, .col[data-col="done"] .col-tit svg.i { color: var(--green); }
.col[data-col="en-curso"] .col-tit svg.i, .col[data-col="doing"] .col-tit svg.i { color: var(--amber); }
.seg button, .tabs button { display: inline-flex; align-items: center; gap: 6px; }
.seg button svg.i { width: 14px; height: 14px; }
.tabs button svg.i { width: 16px; height: 16px; }
.li-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-2); flex-shrink: 0; }
.li-ico svg.i { width: 16px; height: 16px; }
.li-ico.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 14px; }
.li-ico.sm svg.i { width: 14px; height: 14px; }
.alert > svg.i { color: currentColor; }
.alert.ok > svg.i { color: var(--green); }
details.acc > summary svg.i.in-ico { color: var(--accent); opacity: 1; }
.tool-logo { position: relative; width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: var(--bg-soft); border: 1px solid var(--border); overflow: hidden; }
.tool-logo::before { content: attr(data-ini); font-weight: 700; font-size: 15px; color: var(--muted); }
.tool-logo img { position: absolute; inset: 7px; width: 20px; height: 20px; object-fit: contain; background: var(--bg-soft); }
.brand-img { display: block; flex-shrink: 0; border-radius: 22%; box-shadow: 0 6px 18px -8px rgba(91, 76, 240, .55); }
.login-card .brand-img { margin-bottom: 14px; }
.eq-task { border-top: 1px solid var(--border); border-left: 3px solid var(--nc, transparent); }
/* Login a dos columnas con ilustración */
.login-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: min(940px, 100%); min-height: 580px; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); background: var(--panel); }
.login-split .login-card { width: 100%; border: none; box-shadow: none; border-radius: 0; display: flex; flex-direction: column; justify-content: center; padding: 44px; }
.login-art { position: relative; background: #121327 url("/img/login-ilustracion.webp") center 40% / cover no-repeat; }
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18,19,39,0) 55%, rgba(18,19,39,.94)); }
.login-art-txt { position: absolute; z-index: 1; left: 32px; right: 32px; bottom: 30px; color: #fff; display: grid; gap: 4px; }
.login-art-txt img { border-radius: 22%; margin-bottom: 10px; box-shadow: 0 8px 24px -8px rgba(91,76,240,.7); }
.login-art-txt b { font-size: 19px; letter-spacing: -.01em; }
.login-art-txt span { color: rgba(255,255,255,.72); font-size: 14px; }
@media (max-width: 760px) { .login-split { grid-template-columns: 1fr; min-height: 0; } .login-art { display: none; } .login-split .login-card { padding: 28px 22px; } }
@media (min-width: 761px) { .login-split .login-card .brand-img { display: none; } }

/* ---------- Multiempresa: selector en la barra lateral ---------- */
.empresa-switch { width: 100%; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; border-radius: 12px; margin-bottom: 8px; padding: 6px 10px 10px; }
.empresa-switch:hover { background: var(--accent-soft, rgba(91, 76, 240, .08)); }
.empresa-switch svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }

/* ---------- Finanzas ---------- */
.fin-conf { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.fin-conf i { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--border, #e5e7eb); overflow: hidden; position: relative; }
.fin-conf i b { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--green, #16a34a); }
.fin-conf.media i b { background: var(--amber, #d97706); }
.fin-conf.baja i b { background: var(--red, #dc2626); }
.fin-explica { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.fin-hucha { display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--hucha, var(--accent)); }
.fin-drop { border: 2px dashed var(--border, #d1d5db); border-radius: 14px; padding: 28px; text-align: center; cursor: pointer; transition: background .15s; }
.fin-drop.on, .fin-drop:hover { background: var(--accent-soft, rgba(91, 76, 240, .06)); }
.fin-sel { width: 16px; height: 16px; }

/* ---------- Expedientes y portal del cliente ---------- */
.exp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .exp-layout { grid-template-columns: minmax(0, 1fr); } }
.hilo { display: flex; flex-direction: column; gap: 10px; max-height: 56vh; overflow-y: auto; padding: 4px 2px 10px; }
.hilo-msg { max-width: min(86%, 620px); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 9px 12px; align-self: flex-start; }
.hilo-msg.mio { align-self: flex-end; background: var(--accent-soft); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.hilo-msg.cli:not(.mio) { background: var(--blue-soft); border-color: transparent; }
.hilo-msg.interno { background: var(--amber-soft); border: 1px dashed var(--amber); }
.hilo-cab { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 3px; }
.hilo-cab .muted { margin-left: auto; }
.hilo-txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.hilo-sis { align-self: center; font-size: 12px; color: var(--muted); text-align: center; padding: 2px 8px; }
.hilo-adjs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hilo-adj { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--panel); border-radius: 9px; padding: 5px 9px; cursor: pointer; font-size: 12.5px; max-width: 100%; }
.hilo-adj span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.hilo-adj small { color: var(--muted); }
.hilo-adj:hover { background: var(--accent-soft); }
.hilo-form { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.hilo-form textarea { width: 100%; resize: vertical; min-height: 70px; border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; background: var(--panel); outline: none; }
.hilo-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hilo-acc { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hilo-files { display: flex; gap: 6px; flex-wrap: wrap; }
.hilo-q { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--muted); padding: 0 2px; }
