/* ============ Diseños: cada bloque redefine las mismas variables ============ */
:root, [data-theme="marino"] {
  --bg: #f5f6f8; --card: #fff; --card-2: #fbfbfc; --line: #dce1e9; --line-2: #ebeef3;
  --text: #14223a; --strong: #0a1a30; --muted: #5b677b; --faint: #8e99ab;
  --primary: #1c3d73; --primary-d: #142f5c; --on-primary: #fff; --accent: #3b68b5;
  --tint: #e4eaf4; --tint-line: #cfd9ea; --tint-text: #1c3d73; --hover: #f2f5fa;
  --side: #0a1a30; --side-2: #12243f; --side-3: #1b3255; --side-line: #12243f;
  --side-text: #b9c5d8; --side-strong: #fff; --side-muted: #6c7f9c; --side-on: #8fb0e6;
  --danger: #a83232; --danger-bg: #f7e6e6; --ok: #1f6f52; --ok-bg: #e3f1ea; --warn: #8a5a12; --warn-bg: #fbf8ee; --warn-line: #e6dcb8;
  --auth-bg: #0a1a30; --col-bg: #eceef2; --head-rule: #0a1a30; --code-bg: #0a1a30; --code-text: #d3deef; --overlay: rgba(10, 26, 48, .5);
  --display: "Manrope", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --body: "Manrope", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display-weight: 600; --display-track: -.015em; --brand-track: .14em; --brand-case: uppercase; --brand-size: 16px;
  --r: 4px; --r-pill: 3px; --card-shadow: none; --shadow-lg: 0 18px 50px rgba(10, 26, 48, .26); --scheme: light;
}
[data-theme="claro"] {      /* minimal claro, al estilo de Linear y Attio */
  --bg: #fff; --card: #fff; --card-2: #fafbfc; --line: #e6e8ec; --line-2: #f0f1f4;
  --text: #1f2937; --strong: #0f172a; --muted: #667085; --faint: #98a2b3;
  --primary: #2f6bff; --primary-d: #1f55e0; --on-primary: #fff; --accent: #2f6bff;
  --tint: #eaf0ff; --tint-line: #d5e0ff; --tint-text: #1d48c9; --hover: #f5f7fb;
  --side: #fafbfc; --side-2: #f0f2f5; --side-3: #e6e9ee; --side-line: #e6e8ec;
  --side-text: #4a5567; --side-strong: #0f172a; --side-muted: #98a2b3; --side-on: #2f6bff;
  --auth-bg: #f4f6fa; --col-bg: #f5f6f8; --head-rule: #e6e8ec; --code-bg: #0f172a; --code-text: #dbe4f5; --overlay: rgba(15, 23, 42, .35);
  --display: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --display-weight: 600; --display-track: -.02em; --brand-track: -.01em; --brand-case: none; --brand-size: 17px;
  --r: 6px; --r-pill: 5px; --card-shadow: none; --shadow-lg: 0 16px 48px rgba(15, 23, 42, .16);
}
[data-theme="cobalto"] {    /* corporativo vivo: barra azul cobalto, superficies suaves y redondeadas */
  --bg: #f6f8fc; --card: #fff; --card-2: #fafbfe; --line: #e1e6f0; --line-2: #edf0f6;
  --text: #1c2540; --strong: #14204a; --muted: #5f6b85; --faint: #94a0b8;
  --primary: #2f5bea; --primary-d: #2448c4; --on-primary: #fff; --accent: #2f5bea;
  --tint: #e8eeff; --tint-line: #d2ddff; --tint-text: #2448c4; --hover: #f1f5ff;
  --side: #17307a; --side-2: #1f3c94; --side-3: #2a4bb0; --side-line: #1f3c94;
  --side-text: #c7d4f5; --side-strong: #fff; --side-muted: #8ea3da; --side-on: #fff;
  --auth-bg: #17307a; --col-bg: #eef2fa; --head-rule: #e1e6f0; --code-bg: #14204a; --code-text: #d5defa; --overlay: rgba(20, 32, 74, .45);
  --display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; --body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --display-weight: 700; --display-track: -.02em; --brand-track: .02em; --brand-case: none; --brand-size: 18px;
  --r: 10px; --r-pill: 999px; --card-shadow: 0 1px 2px rgba(20, 32, 74, .05), 0 4px 14px rgba(20, 32, 74, .05); --shadow-lg: 0 20px 56px rgba(20, 32, 74, .24);
}
[data-theme="editorial"] {  /* estudio jurídico clásico: titulares con serifa, esquinas rectas, filetes finos */
  --bg: #f7f7f5; --card: #fff; --card-2: #fbfbfa; --line: #dedfe2; --line-2: #ecedee;
  --text: #1c2431; --strong: #0d1b2e; --muted: #5d6673; --faint: #9199a5;
  --primary: #17335e; --primary-d: #0f2545; --on-primary: #fff; --accent: #2c5aa0;
  --tint: #e6ebf3; --tint-line: #d0d9e8; --tint-text: #17335e; --hover: #f3f5f8;
  --side: #0d1b2e; --side-2: #15263d; --side-3: #1e3350; --side-line: #15263d;
  --side-text: #b5c0d2; --side-strong: #fff; --side-muted: #6b7c96; --side-on: #c8d6ee;
  --auth-bg: #0d1b2e; --col-bg: #eeeeec; --head-rule: #0d1b2e; --code-bg: #0d1b2e; --code-text: #d3dcea; --overlay: rgba(13, 27, 46, .5);
  --display: "Crimson Pro", Georgia, "Times New Roman", serif; --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --display-weight: 600; --display-track: 0; --brand-track: .1em; --brand-case: uppercase; --brand-size: 19px;
  --r: 2px; --r-pill: 2px; --card-shadow: none; --shadow-lg: 0 18px 50px rgba(13, 27, 46, .28);
}
[data-theme="medianoche"] { /* modo oscuro: azul noche con acento eléctrico */
  --bg: #0b1220; --card: #111a2c; --card-2: #0f1727; --line: #1f2b42; --line-2: #19243a;
  --text: #d6deeb; --strong: #f1f5fb; --muted: #8b99b3; --faint: #62708a;
  --primary: #4c82f7; --primary-d: #3b6fe0; --on-primary: #fff; --accent: #5b8ff9;
  --tint: #172a4d; --tint-line: #23407a; --tint-text: #a9c4ff; --hover: #162036;
  --side: #070d18; --side-2: #0f1727; --side-3: #162036; --side-line: #151f33;
  --side-text: #9fb0cc; --side-strong: #fff; --side-muted: #56647e; --side-on: #5b8ff9;
  --danger: #f08a8a; --danger-bg: #3a1c22; --ok: #5fd0a0; --ok-bg: #12332a; --warn: #e6c36a; --warn-bg: #2b230f; --warn-line: #5a4a1c;
  --auth-bg: #070d18; --col-bg: #0e1626; --head-rule: #2a3956; --code-bg: #070d18; --code-text: #c9d6ee; --overlay: rgba(2, 6, 14, .66);
  --display: "DM Sans", "Segoe UI", system-ui, sans-serif; --body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --display-weight: 600; --display-track: -.02em; --brand-track: .12em; --brand-case: uppercase; --brand-size: 15px;
  --r: 8px; --r-pill: 6px; --card-shadow: none; --shadow-lg: 0 22px 60px rgba(0, 0, 0, .55); --scheme: dark;
}
[data-theme="cielo"] {      /* luminoso y amable: azul cielo, tarjetas blancas muy redondeadas */
  --bg: #eef4fb; --card: #fff; --card-2: #f8fbff; --line: #dbe6f4; --line-2: #e9f0f9;
  --text: #1d2f4d; --strong: #0f2a55; --muted: #5d7092; --faint: #93a5c2;
  --primary: #2d7ff9; --primary-d: #1f6ae0; --on-primary: #fff; --accent: #2d7ff9;
  --tint: #e3efff; --tint-line: #c9defc; --tint-text: #1757b8; --hover: #f3f8ff;
  --side: #f8fbff; --side-2: #e8f0fd; --side-3: #dbe8fc; --side-line: #dbe6f4;
  --side-text: #46587a; --side-strong: #0f2a55; --side-muted: #93a5c2; --side-on: #2d7ff9;
  --auth-bg: #dfeafa; --col-bg: #e4edf9; --head-rule: #dbe6f4; --code-bg: #0f2a55; --code-text: #d6e4fb; --overlay: rgba(15, 42, 85, .35);
  --display: "Outfit", "Segoe UI", system-ui, sans-serif; --body: "Outfit", "Segoe UI", system-ui, sans-serif;
  --display-weight: 600; --display-track: -.01em; --brand-track: .04em; --brand-case: none; --brand-size: 19px;
  --r: 14px; --r-pill: 999px; --card-shadow: 0 2px 10px rgba(45, 127, 249, .07); --shadow-lg: 0 20px 56px rgba(15, 42, 85, .2);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { color-scheme: var(--scheme); }
body { font: 14px/1.5 var(--body); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
a.btn:hover, a.nav:hover, a.rlink:hover, .stabs a:hover { text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: var(--display-weight); letter-spacing: var(--display-track); color: var(--strong); }
svg.ic { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- controles */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 15px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: var(--tint-line); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input, textarea.input { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); color: var(--text); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 76px; padding: 8px 11px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input:disabled { background: var(--card-2); color: var(--muted); }
label.lbl { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 5px; }
.form-row { margin-bottom: 14px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.pill { display: inline-block; max-width: 100%; padding: 1px 8px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; background: var(--tint); color: var(--tint-text); border: 1px solid var(--tint-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.pill.p1 { filter: hue-rotate(-22deg); } .pill.p2 { filter: hue-rotate(24deg); } .pill.p3 { filter: saturate(1.35); } .pill.p5 { filter: hue-rotate(-40deg) saturate(.9); }
.pill.p4 { background: var(--line-2); color: var(--muted); border-color: var(--line); }

/* ---------- acceso */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--auth-bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: var(--r); border: 1px solid var(--line); border-top: 3px solid var(--accent); padding: 36px 34px 32px; box-shadow: var(--shadow-lg); }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 700; font-size: var(--brand-size); letter-spacing: var(--brand-track); text-transform: var(--brand-case); }
.brand-mark { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid currentColor; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: 0; text-transform: none; }
.brand-mark.has-logo { border: 0; overflow: hidden; }
.brand-mark.has-logo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }     /* como una foto de perfil: centrada, llena el círculo, sin deformar */
.brand.plate .brand-mark.has-logo { background: #fff; }
.side .brand-mark.has-logo { box-shadow: 0 0 0 1px var(--side-3); }       /* aro fino para que el círculo se distinga del fondo */
.brand-mark.frame-big { width: 132px; height: 132px; box-shadow: 0 0 0 1px var(--line); }
.frame-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; } .frame-row span { width: 78px; color: var(--muted); font-size: 13px; } .frame-row input { flex: 1; accent-color: var(--primary); }       /* solo se nota si la imagen tiene transparencias */
.logo-prev { width: 250px; height: 110px; border-radius: var(--r); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.logo-prev small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.auth-card .brand { color: var(--strong); }
.auth-card h1 { font-size: 22px; margin: 26px 0 4px; }
.auth-card p { margin: 0 0 22px; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 10px; }

/* ---------- estructura */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100vh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--side-line); }
.side .brand { color: var(--side-strong); padding: 22px 20px 18px; margin: 0 0 6px; border-bottom: 1px solid var(--side-line); }
.side-scroll { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.side-scroll::-webkit-scrollbar { width: 8px; } .side-scroll::-webkit-scrollbar-thumb { background: var(--side-3); border-radius: 8px; }
.side h4 { margin: 20px 10px 8px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); color: inherit; cursor: pointer; border-left: 2px solid transparent; }
.nav:hover { background: var(--side-2); color: var(--side-strong); }
.nav.on { background: var(--side-2); color: var(--side-strong); border-left-color: var(--side-on); }
.nav .n-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.nav .n-count { font-size: 12px; color: var(--side-muted); font-variant-numeric: tabular-nums; }
.f-dot { width: 24px; height: 24px; border-radius: min(var(--r), 7px); display: grid; place-items: center; color: #fff; flex: none; }
.f-dot svg.ic { width: 14px; height: 14px; }
.view-nav { display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 46px; border-radius: var(--r); font-size: 13px; color: var(--side-text); opacity: .85; cursor: pointer; }
.view-nav:hover, .view-nav.on { background: var(--side-2); color: var(--side-strong); opacity: 1; }
.view-nav span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-nav button { visibility: hidden; border: 0; background: none; color: inherit; cursor: pointer; padding: 0 2px; }
.view-nav:hover button { visibility: visible; }
.side-foot { border-top: 1px solid var(--side-line); padding: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--side-muted); color: var(--side-strong); display: grid; place-items: center; font-family: var(--display); font-size: 12.5px; font-weight: 600; flex: none; }
.side-foot .who { flex: 1; min-width: 0; line-height: 1.25; } .side-foot .who b { color: var(--side-strong); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.side-foot .who span { font-size: 12px; color: var(--side-muted); }
.side-foot button { background: none; border: 0; color: var(--side-text); cursor: pointer; padding: 6px; border-radius: var(--r); } .side-foot button:hover { background: var(--side-2); color: var(--side-strong); }
main { min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.page-head { display: flex; align-items: center; gap: 14px; padding: 18px 28px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.page-head h1 { font-size: 21px; display: flex; align-items: center; gap: 11px; }
.page-head .count { font-family: var(--body); font-size: 13px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--card); }
.seg button { display: inline-flex; gap: 6px; align-items: center; border: 0; border-right: 1px solid var(--line); background: none; height: 32px; padding: 0 13px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--hover); }
.seg button.on { background: var(--primary); color: var(--on-primary); }
.search { position: relative; width: 270px; max-width: 100%; } .search svg { position: absolute; left: 10px; top: 9px; color: var(--faint); } .search .input { padding-left: 34px; }
.filterbar { display: flex; align-items: center; gap: 8px; padding: 10px 28px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--card-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: var(--r-pill); background: var(--tint); border: 1px solid var(--tint-line); color: var(--tint-text); font-size: 13px; font-weight: 600; }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 15px; line-height: 1; padding: 0 3px; opacity: .7; } .chip button:hover { opacity: 1; }
.content { flex: 1; min-height: 0; overflow: auto; padding: 24px 28px; }
.content.flush { padding: 0; display: flex; flex-direction: column; }

/* ---------- tabla */
.table-wrap { flex: 1; min-height: 0; overflow: auto; background: var(--card); }
table.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.grid th, .grid td { padding: 10px 16px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.grid th { position: sticky; top: 0; z-index: 2; background: var(--card); font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; cursor: pointer; user-select: none; border-bottom: 1px solid var(--head-rule); }
.grid th:hover { color: var(--accent); }
.grid th:first-child, .grid td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 1px 0 0 var(--line); min-width: 240px; }
.grid th:first-child { z-index: 3; }
.grid tbody tr { cursor: pointer; } .grid tbody tr:hover td { background: var(--hover); }
.grid td.name { font-weight: 600; color: var(--strong); }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; gap: 10px; padding: 9px 28px; border-top: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; }
.empty { padding: 70px 20px; text-align: center; color: var(--muted); } .empty h3 { margin-bottom: 8px; font-size: 19px; }

/* ---------- embudo */
.pipe-tools { display: flex; align-items: center; gap: 10px; padding: 14px 28px 0; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pipe-tools select.input { width: auto; height: 32px; }
.pipe-sum { margin-left: auto; font-family: var(--display); font-weight: var(--display-weight); font-size: 15px; color: var(--strong); }
.funnel { display: flex; gap: 2px; padding: 12px 28px 4px; height: 40px; }
.funnel div { min-width: 6px; border-radius: calc(var(--r) / 3); background: var(--primary); position: relative; transition: opacity .12s; }
.funnel div:hover { opacity: .8; }
.board { flex: 1; min-height: 0; display: flex; gap: 12px; overflow-x: auto; padding: 12px 28px 20px; align-items: stretch; }
.col { flex: 0 0 272px; display: flex; flex-direction: column; background: var(--col-bg); border-radius: var(--r); min-height: 0; border: 1px solid var(--line); overflow: hidden; }
.col.over { border-color: var(--accent); background: var(--tint); }
.col-head { padding: 12px 14px 10px; border-top: 2px solid var(--primary); border-bottom: 1px solid var(--line); background: var(--card); margin: 0; }
.col-head b { display: block; font-family: var(--display); font-size: 15px; font-weight: var(--display-weight); letter-spacing: var(--display-track); color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.card { background: var(--card); border-radius: calc(var(--r) * .75); padding: 10px 12px; cursor: grab; border: 1px solid var(--line); box-shadow: var(--card-shadow); }
.card:hover { border-color: var(--accent); } .card.drag { opacity: .4; }
.card b { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; overflow-wrap: anywhere; color: var(--strong); }
.card .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.card .val { color: var(--strong); font-weight: 600; font-variant-numeric: tabular-nums; }
.card .due { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; padding: 0 6px; border-radius: var(--r-pill); background: var(--line-2); color: var(--muted); }
.card .due.late { background: var(--danger-bg); color: var(--danger); } .card .due.today { background: var(--ok-bg); color: var(--ok); }
.more { text-align: center; font-size: 12.5px; padding: 6px; color: var(--accent); cursor: pointer; }

/* ---------- ficha */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(1040px, 96vw); height: 100%; background: var(--bg); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(40px); } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.d-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.d-head input.title { flex: 1; min-width: 0; border: 1px solid transparent; border-radius: var(--r); font-family: var(--display); font-size: 21px; font-weight: var(--display-weight); letter-spacing: var(--display-track); color: var(--strong); padding: 4px 8px; background: transparent; outline: none; }
.d-head input.title:hover, .d-head input.title:focus { border-color: var(--line); background: var(--card); }
.d-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.d-fields, .d-side { overflow-y: auto; padding: 20px 24px; }
.d-side { border-left: 1px solid var(--line); background: var(--card); }
.sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; box-shadow: var(--card-shadow); }
.sec > summary { list-style: none; cursor: pointer; padding: 12px 16px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--strong); display: flex; align-items: center; gap: 8px; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::before { content: '▸'; color: var(--faint); transition: transform .12s; } .sec[open] > summary::before { transform: rotate(90deg); }
.sec[open] > summary { border-bottom: 1px solid var(--line-2); margin-bottom: 12px; }
.sec > summary .n { margin-left: auto; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--faint); }
.sec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 2px 16px 16px; }
.fld { min-width: 0; } .fld.wide { grid-column: 1 / -1; }
.fld .with-link { display: flex; gap: 6px; }
.fld .chk { display: flex; align-items: center; gap: 8px; height: 36px; }
.fld .chk input { width: 16px; height: 16px; accent-color: var(--primary); }
.tabs { display: flex; gap: 0; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; background: none; padding: 7px 14px; cursor: pointer; font-weight: 600; color: var(--muted); margin-bottom: -1px; } .tabs button.on { color: var(--strong); border-bottom-color: var(--primary); }
.tl { margin-top: 18px; }
.tl-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.tl-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); color: var(--muted); } .tl-ic svg.ic { width: 14px; height: 14px; }
.tl-ic.note { border-color: var(--warn-line); color: var(--warn); background: var(--warn-bg); } .tl-ic.mail { border-color: var(--tint-line); color: var(--tint-text); background: var(--tint); } .tl-ic.bot { background: var(--hover); }
.tl-top { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); } .tl-top b { color: var(--text); font-weight: 600; } .tl-top time { margin-left: auto; white-space: nowrap; }
.tl-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.tl-body.clamp { max-height: 4.5em; overflow: hidden; cursor: pointer; color: var(--muted); }

/* ---------- correos */
.mrow { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding: 13px 28px; border-bottom: 1px solid var(--line-2); cursor: pointer; background: var(--card); }
.mrow:hover { background: var(--hover); }
.m-top { display: flex; gap: 10px; align-items: baseline; } .m-top b { font-weight: 600; color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .m-top time { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.m-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 1px 0 6px; }
.m-links { display: flex; flex-wrap: wrap; gap: 6px; }
.rlink { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 1px 8px; border-radius: var(--r-pill); border: 1px solid var(--tint-line); background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--strong); }
.rlink:hover { background: var(--tint); } .rlink i, .lopt i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.rlink button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 0 0 2px; } .rlink button:hover { color: var(--danger); }
.lopt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--line-2); background: none; color: var(--text); cursor: pointer; text-align: left; } .lopt:hover { background: var(--hover); }

.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--danger-bg); color: var(--danger); font-size: 11.5px; line-height: 18px; text-align: center; font-weight: 700; }
.dupbar { padding: 9px 24px; background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); color: var(--warn); font-size: 13.5px; }

/* ---------- apariencia */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.theme-card { text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); color: var(--text); cursor: pointer; }
.theme-card:hover { border-color: var(--accent); } .theme-card.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.theme-card strong { display: block; margin-top: 10px; font-family: var(--display); } .theme-card small { color: var(--muted); }
.theme-prev { display: grid; grid-template-columns: 26% 1fr; height: 124px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); font-family: var(--body); color: var(--text); }
.tp-side { background: var(--side); border-right: 1px solid var(--side-line); padding: 10px 7px; display: flex; flex-direction: column; gap: 6px; }
.tp-side b { height: 7px; border-radius: 3px; background: var(--side-3); } .tp-side b:first-child { background: var(--side-on); width: 60%; margin-bottom: 4px; }
.tp-main { padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.tp-h { display: flex; align-items: center; justify-content: space-between; font-family: var(--display); font-weight: var(--display-weight); letter-spacing: var(--display-track); font-size: 15px; color: var(--strong); }
.tp-btn { width: 44px; height: 16px; border-radius: var(--r); background: var(--primary); }
.tp-row { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; background: var(--card); border: 1px solid var(--line); border-radius: calc(var(--r) * .75); box-shadow: var(--card-shadow); font-size: 10.5px; color: var(--muted); }
.tp-pill { margin-left: auto; padding: 0 6px; border-radius: var(--r-pill); background: var(--tint); color: var(--tint-text); border: 1px solid var(--tint-line); font-size: 9.5px; font-weight: 600; line-height: 14px; }

/* ---------- varios */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-top: 2px solid var(--primary); border-radius: var(--r); padding: 18px; cursor: pointer; transition: border-color .12s, background .12s; box-shadow: var(--card-shadow); }
.tile:hover { background: var(--card-2); border-color: var(--accent); }
.tile b { font-weight: 600; letter-spacing: .02em; color: var(--strong); }
.tile .big { font-family: var(--display); font-size: 32px; font-weight: 500; letter-spacing: -.03em; color: var(--strong); margin: 12px 0 0; font-variant-numeric: tabular-nums; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; box-shadow: var(--card-shadow); }
.panel > h3 { padding: 14px 18px; font-size: 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.panel .pad { padding: 16px 18px; }
table.list { width: 100%; border-collapse: collapse; } .list th, .list td { padding: 10px 18px; text-align: left; border-bottom: 1px solid var(--line-2); } .list th { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; } .list tr:last-child td { border-bottom: 0; }
.stabs { display: flex; gap: 4px; padding: 0 28px; background: var(--card); border-bottom: 1px solid var(--line); }
.stabs a { padding: 12px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; } .stabs a.on { color: var(--strong); border-color: var(--primary); }
pre.code { background: var(--code-bg); color: var(--code-text); padding: 14px 16px; border-radius: var(--r); overflow-x: auto; font: 12.5px/1.55 Consolas, "Cascadia Mono", monospace; margin: 8px 0 0; }
code.k { background: var(--line-2); padding: 2px 6px; border-radius: 3px; font: 12.5px Consolas, monospace; overflow-wrap: anywhere; }
.modal-bg { position: fixed; inset: 0; z-index: 60; background: var(--overlay); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; background: var(--card); border-radius: var(--r); border: 1px solid var(--line); border-top: 3px solid var(--primary); box-shadow: var(--shadow-lg); }
.modal h3 { padding: 20px 24px 0; font-size: 19px; } .modal .m-body { padding: 16px 24px 4px; } .modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; }
.pop { position: fixed; z-index: 70; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 14px; width: 300px; max-height: 70vh; overflow-y: auto; }
.pop label.opt { display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; } .pop h5 { margin: 10px 0 4px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--code-bg); color: #fff; padding: 9px 16px; border-radius: var(--r); border: 1px solid var(--side-3); box-shadow: var(--shadow-lg); font-weight: 600; } .toast.bad { background: #a83232; border-color: #a83232; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; } .side { display: none; }
  .d-body { grid-template-columns: 1fr; overflow-y: auto; } .d-fields, .d-side { overflow: visible; } .d-side { border-left: 0; border-top: 1px solid var(--line); }
  .sec-grid { grid-template-columns: 1fr; } .page-head, .filterbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* ---------------------------------------------------------------- rendimiento: gráficos con volumen */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--card) 0%, var(--card-2) 100%); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px 14px; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 18px -10px rgba(10, 26, 48, .25); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--accent), var(--primary)); }
.kpi span { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-family: var(--display); font-size: 30px; line-height: 1.15; color: var(--strong); margin: 6px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi small { color: var(--faint); font-size: 12.5px; }
.perf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.perf-grid > .panel { min-width: 0; }
.chart3d { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--body); }
.g-line { stroke: var(--line-2); stroke-width: 1; }
.g-tick { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.g-floor { fill: var(--line-2); opacity: .7; }
.g-val { fill: var(--strong); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.g-cat { fill: var(--muted); font-size: 12px; font-weight: 600; }
.g-end { fill: var(--muted); font-size: 11.5px; font-weight: 600; }
.g-endv { fill: var(--strong); font-weight: 700; }
.g-cross { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.f-lead { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.f-n { fill: var(--strong); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.f-p { fill: var(--accent); font-size: 12px; font-weight: 600; }
.f-l { fill: var(--muted); font-size: 12px; }
.b3 { transform-box: fill-box; transform-origin: bottom; animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; cursor: default; }
.b3:hover { filter: brightness(1.08) saturate(1.1); }
.fz { animation: fadein .6s ease both; cursor: default; }
.fz:hover { filter: brightness(1.1); }
.ln { stroke-dasharray: 3000; stroke-dashoffset: 3000; animation: draw 1.2s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes rise { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .b3, .fz, .ln { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i, .tt-row i, .perf-t .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
#chart-tip { position: fixed; z-index: 90; pointer-events: none; min-width: 140px; max-width: 280px; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
  background: rgba(10, 22, 42, .94); color: #e8eef8; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); backdrop-filter: blur(4px); }
#chart-tip b { color: #fff; }
.tt-row { display: flex; align-items: center; gap: 8px; }
.tt-row span { margin-left: auto; padding-left: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.perf-t td.num, .perf-t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.perf-t .dot { margin-right: 8px; vertical-align: -1px; }

/* ---------------------------------------------------------------- seguridad */
.pill.ok { background: #e3f6ec; color: #0c6b3e; border-color: #b6e6cb; }
.pill.bad { background: #fde8e8; color: #a61b1b; border-color: #f5c2c2; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.secret-key { font-family: Consolas, monospace; font-size: 18px; letter-spacing: .08em; text-align: center; padding: 12px; border: 1px dashed var(--line); border-radius: var(--r); background: var(--card-2); color: var(--strong); user-select: all; }
.input.totp { font-family: Consolas, monospace; font-size: 20px; letter-spacing: .4em; text-align: center; max-width: 200px; }
.auth-card .input.totp { max-width: none; }
tr.alert-row td { background: #fff1f1; }
tr.alert-row td b { color: #a61b1b; }
.ver { border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
.ver-h { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.ver-d > div { padding: 1px 0; }
.with-link { display: flex; gap: 6px; }
.with-link .input { flex: 1; min-width: 0; }
[data-theme="medianoche"] .pill.ok { background: #10301f; color: #6fdc9f; border-color: #1d4d33; }
[data-theme="medianoche"] .pill.bad, [data-theme="medianoche"] tr.alert-row td { background: #3a1416; color: #ff9b9b; border-color: #5a1f22; }
[data-theme="medianoche"] .kpi { box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .6); }