/* ==========================================================
   Artemis I · Asistente Legal — Hoja de estilos
   Paleta: azul marino institucional + dorado + marfil
   ========================================================== */
:root {
  --navy-950: #070f22;
  --navy-900: #0b1730;
  --navy-800: #12244a;
  --navy-700: #1b3466;
  --navy-600: #284a8a;
  --gold-500: #c9a44c;
  --gold-400: #dcbc6a;
  --gold-300: #ebd396;
  --gold-100: #f8efd6;
  --ivory: #f6f3eb;
  --paper: #ffffff;
  --ink: #1a2235;
  --muted: #6b7285;
  --line: #e6e1d4;
  --ok: #1f8a5b;
  --ok-bg: #e3f4ec;
  --warn: #b7791f;
  --warn-bg: #fdf1dc;
  --danger: #b4323a;
  --danger-bg: #fbe5e6;
  --info: #2b6cb0;
  --info-bg: #e4eefa;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(11, 23, 48, .06), 0 1px 3px rgba(11, 23, 48, .08);
  --shadow: 0 10px 30px -12px rgba(11, 23, 48, .25);
  --shadow-gold: 0 8px 24px -10px rgba(201, 164, 76, .55);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* evita el desplazamiento horizontal en pantallas estrechas */
}
img, video, canvas { max-width: 100%; height: auto; }
a { color: var(--navy-600); text-decoration: none; }
a:hover { color: var(--gold-500); }
h1, h2, h3, h4 { font-variant-numeric: lining-nums; font-family: var(--serif); color: var(--navy-900); margin: 0 0 .4em; letter-spacing: .2px; }
h1 { font-size: 2.1rem; font-weight: 700; }
h2 { font-size: 1.6rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------------- Pantalla de acceso ---------------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
.auth-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 56px 64px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1200px 500px at -10% -20%, rgba(201,164,76,.25), transparent 60%),
    radial-gradient(800px 600px at 120% 120%, rgba(40,74,138,.6), transparent 60%),
    linear-gradient(160deg, var(--navy-950), var(--navy-800));
}
.auth-hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  pointer-events: none;
}
.auth-hero h1 { color: #fff; font-size: 3.2rem; line-height: 1.05; margin-top: 40px; }
.auth-hero h1 em { color: var(--gold-400); font-style: italic; }
.auth-hero p.lead { color: #c8d1e6; font-size: 1.08rem; max-width: 520px; line-height: 1.6; }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; margin-top: 32px; max-width: 560px; position: relative; z-index: 1; }
.feature-list div { display: flex; gap: 10px; align-items: flex-start; color: #dfe5f3; font-size: .93rem; }
.feature-list svg { color: var(--gold-400); margin-top: 1px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--ivory); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .tabs { margin-bottom: 22px; }
.trial-pill {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 6px 14px; border-radius: 99px;
  background: rgba(201,164,76,.15); border: 1px solid rgba(201,164,76,.45);
  color: var(--gold-300); font-size: .85rem; position: relative; z-index: 1;
}

/* Marca */
.brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--gold-300), var(--gold-500) 55%, #9c7a2b);
  box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255,255,255,.5);
  color: var(--navy-900);
}
.brand-mark svg { width: 24px; height: 24px; stroke-width: 2; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; line-height: 1; color: #fff; }
.brand-name span { display: block; font-family: var(--sans); font-size: .68rem; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--gold-400); margin-top: 4px; }

/* ---------------- Estructura principal ---------------- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #c4cde2;
  display: flex; flex-direction: column;
  padding: 22px 14px;
  border-right: 1px solid rgba(201,164,76,.18);
}
.sidebar .brand { padding: 4px 10px 22px; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav .sect { font-size: .68rem; text-transform: uppercase; letter-spacing: 2px; color: #6f7c9c; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: #c4cde2; font-weight: 500;
  transition: background .18s, color .18s, transform .18s;
  position: relative;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active {
  background: linear-gradient(90deg, rgba(201,164,76,.2), rgba(201,164,76,.04));
  color: var(--gold-300);
}
.nav a.active::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  background: var(--gold-400); border-radius: 0 3px 3px 0;
}
.nav .count { margin-left: auto; background: var(--danger); color: #fff; font-size: .7rem; padding: 1px 7px; border-radius: 99px; font-weight: 700; }
.side-foot { border-top: 1px solid rgba(255,255,255,.07); padding-top: 14px; margin-top: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-600), var(--navy-700));
  border: 1.5px solid var(--gold-500);
  display: grid; place-items: center; color: var(--gold-300); font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.user-chip .who { min-width: 0; }
.user-chip .who b { color: #fff; display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who small { color: #8794b3; font-size: .75rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 32px;
  background: rgba(246,243,235,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .crumb { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; color: var(--navy-900); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 28px 32px 60px; max-width: 1400px; width: 100%; }

.trial-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 12px; margin-bottom: 20px;
  background: linear-gradient(90deg, var(--navy-800), var(--navy-700));
  color: #e8ecf6; font-size: .9rem;
  border: 1px solid rgba(201,164,76,.35);
}
.trial-banner b { color: var(--gold-300); }
.trial-banner .btn { margin-left: auto; }

/* ---------------- Componentes ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--muted); }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
}
.card + .card { margin-top: 18px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head h3 svg { color: var(--gold-500); }
.grid { display: grid; gap: 18px; }
.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; }
.span-all { grid-column: 1 / -1; }

.stat {
  position: relative; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.stat::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,164,76,.18), transparent 70%);
}
.stat .lbl { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.stat .lbl svg { color: var(--gold-500); }
.stat .val, .price, .score, .date-badge .d, .brand-name, .topbar .crumb { font-variant-numeric: lining-nums; }
.stat .val { font-family: var(--serif); font-size: 2.1rem; font-weight: 700; color: var(--navy-900); margin-top: 6px; line-height: 1.1; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat.dark { background: linear-gradient(145deg, var(--navy-800), var(--navy-900)); border-color: var(--navy-700); }
.stat.dark .val { color: var(--gold-300); }
.stat.dark .lbl, .stat.dark .sub { color: #a9b5d1; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); color: var(--navy-900);
  font: 600 .88rem var(--sans); cursor: pointer;
  transition: transform .12s, box-shadow .18s, background .18s, border-color .18s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold-400); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--navy-700), var(--navy-900));
  color: #fff; border-color: var(--navy-900);
}
.btn.primary:hover { box-shadow: 0 8px 18px -8px rgba(18,36,74,.7); }
.btn.gold {
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500) 60%, #a8842f);
  color: var(--navy-950); border-color: #b8933c; box-shadow: var(--shadow-gold);
}
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(11,23,48,.05); box-shadow: none; }
.btn.sm { padding: 6px 10px; font-size: .8rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .78rem; font-weight: 600; color: var(--navy-800); text-transform: uppercase; letter-spacing: .8px; }
.field .hint { font-size: .75rem; color: var(--muted); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d9d3c3; border-radius: 10px;
  background: #fffdf8; color: var(--ink);
  font: 400 .92rem var(--sans);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201,164,76,.2); background: #fff; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--navy-700); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-section { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; color: var(--navy-800); margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); display: flex; align-items: center; gap: 8px; }
.form-section svg { color: var(--gold-500); }

/* Selector de materia */
.materia-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.materia-pick label {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer;
  text-align: center; font-weight: 600; background: #fffdf8; transition: all .15s;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .88rem;
}
.materia-pick label svg { color: var(--navy-600); width: 22px; height: 22px; }
.materia-pick input { display: none; }
.materia-pick label:hover { border-color: var(--gold-400); }
.materia-pick input:checked + span, .materia-pick label.on {
  border-color: var(--gold-500); background: var(--gold-100); color: var(--navy-900); box-shadow: var(--shadow-gold);
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; padding: 3px; background: #fff; gap: 2px; flex-wrap: wrap; }
.seg label { padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.seg input { display: none; }
.seg label.on { background: var(--navy-800); color: var(--gold-300); }

.office-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fffdf8; transition: all .2s; }
.office-box.current { border-color: var(--gold-500); background: linear-gradient(180deg, var(--gold-100), #fffdf8); box-shadow: var(--shadow-gold); }
.office-box h4 { font-family: var(--sans); font-size: .82rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.office-box h4 .tag { margin-left: auto; }

/* Tablas */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #efebe0; vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); background: #faf8f2; font-weight: 700; white-space: nowrap; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fdfbf5; }
tbody tr.clickable { cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }
td .main-t { font-weight: 600; color: var(--navy-900); }
td .sub-t { font-size: .8rem; color: var(--muted); }

/* Etiquetas */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: .72rem; font-weight: 700; letter-spacing: .3px;
  background: #eef0f5; color: var(--navy-700); white-space: nowrap;
}
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.gold { background: var(--gold-100); color: #8a6a1f; }
.tag.dark { background: var(--navy-800); color: var(--gold-300); }
.m-penal { background: #fbe5e6; color: #9b2c33; }
.m-civil { background: #e4eefa; color: #2b5a99; }
.m-administrativo { background: #ece6fa; color: #5b3fa0; }
.m-ambiental { background: #e3f4ec; color: #1c7a50; }
.m-minero { background: #f3ece2; color: #7a5528; }
.m-militar { background: #e6ebe1; color: #4a5a32; }
.m-societario { background: #e2f1f4; color: #1d6b7a; }
.m-familia { background: #fbe8f3; color: #9c2f6c; }
.m-empresarial { background: #fdf1dc; color: #94621a; }

/* Barra de honorarios */
.progress { height: 8px; border-radius: 99px; background: #ece7da; overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold-400), var(--gold-500)); }
.progress.ok > div { background: linear-gradient(90deg, #36b37e, var(--ok)); }

/* Pestañas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  border: none; background: none; padding: 11px 16px; cursor: pointer;
  font: 600 .9rem var(--sans); color: var(--muted);
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; white-space: nowrap;
}
.tabs button:hover { color: var(--navy-800); }
.tabs button.on { color: var(--navy-900); border-bottom-color: var(--gold-500); }
.tabs .badge { background: var(--navy-800); color: var(--gold-300); border-radius: 99px; padding: 0 7px; font-size: .7rem; }

/* Encabezado del caso */
.case-hero {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-950));
  border-radius: 18px; padding: 24px 28px; color: #dbe2f1; position: relative; overflow: hidden;
  margin-bottom: 20px; border: 1px solid rgba(201,164,76,.3);
}
.case-hero::after { content: '⚖'; position: absolute; right: 24px; bottom: -40px; font-size: 180px; color: rgba(201,164,76,.08); }
.case-hero h2 { color: #fff; font-size: 1.9rem; }
.case-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; font-size: .9rem; }
.case-hero .meta span { display: inline-flex; gap: 6px; align-items: center; }
.case-hero .meta svg { color: var(--gold-400); }
.case-hero .btn-row { position: absolute; right: 24px; top: 22px; z-index: 1; }
.case-hero .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.case-hero .btn:hover { background: rgba(255,255,255,.16); border-color: var(--gold-400); }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 9px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; color: var(--navy-900); }

/* Listas */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid #f0ece2; }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; color: var(--navy-900); }
.list-item .s { font-size: .8rem; color: var(--muted); }
.date-badge {
  width: 52px; flex-shrink: 0; text-align: center; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #fff;
}
.date-badge .m { background: var(--navy-800); color: var(--gold-300); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 2px 0; }
.date-badge .d { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; color: var(--navy-900); padding: 2px 0; }
.date-badge.danger .m { background: var(--danger); color: #fff; }
.date-badge.warn .m { background: var(--warn); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty svg { width: 36px; height: 36px; color: var(--gold-400); display: block; margin: 0 auto 8px; }

.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 6px; border-bottom: 1px solid #f0ece2; }
.task.done .t { text-decoration: line-through; color: var(--muted); }
.task input { margin-top: 3px; width: 17px; height: 17px; }

/* Documentos */
.dropzone {
  border: 2px dashed #d4c79f; border-radius: 14px; padding: 26px; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, #fffdf6, #fbf6e8); transition: all .15s; color: var(--muted);
}
.dropzone:hover, .dropzone.over { border-color: var(--gold-500); background: var(--gold-100); color: var(--navy-800); }
.dropzone svg { width: 32px; height: 32px; color: var(--gold-500); }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.file-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.file-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.file-thumb { height: 110px; display: grid; place-items: center; background: #f7f4ec; font-weight: 800; font-size: 1.2rem; letter-spacing: 1px; overflow: hidden; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ft-pdf { background: #fbe5e6; color: #b4323a; }
.ft-doc { background: #e4eefa; color: #2b5a99; }
.ft-ppt { background: #fde8dc; color: #c4502b; }
.ft-xls { background: #e3f4ec; color: #1c7a50; }
.file-info { padding: 9px 11px; font-size: .8rem; }
.file-info .n { font-weight: 600; color: var(--navy-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-actions { display: flex; gap: 4px; padding: 0 8px 8px; }

/* ---------------- Calendario ---------------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-toolbar h2 { margin: 0 8px; min-width: 210px; }
.cal-toolbar h2::first-letter { text-transform: uppercase; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.cal .dow { background: var(--navy-900); color: var(--gold-300); text-align: center; padding: 10px 0; font-size: .72rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.cal .day { min-height: 118px; border-right: 1px solid #efebe0; border-bottom: 1px solid #efebe0; padding: 6px; cursor: pointer; transition: background .12s; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: none; }
.cal .day:hover { background: #fdfaf1; }
.cal .day.other { background: #faf8f3; color: #b5b0a3; }
.cal .day.today .num { background: var(--gold-500); color: var(--navy-950); }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--gold-500); }
.cal .num { font-weight: 700; font-size: .82rem; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 2px; }
.chip {
  font-size: .72rem; padding: 3px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid; font-weight: 600; display: flex; gap: 4px; align-items: center;
}
.chip.audiencia { background: #e8ecf8; border-color: var(--navy-600); color: var(--navy-800); }
.chip.diligencia { background: #ece6fa; border-color: #6a4fc0; color: #4a3290; }
.chip.reunion { background: #e3f4ec; border-color: var(--ok); color: #17603f; }
.chip.otro { background: #f0ede4; border-color: #8a7f66; color: #5c5442; }
.chip.notif { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.chip.venc { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.chip.consulta { background: var(--gold-100); border-color: var(--gold-500); color: #7b5d18; }
.chip.cruce { box-shadow: 0 0 0 1.5px var(--warn); }
.chip.muted { opacity: .55; text-decoration: line-through; }
.more { font-size: .7rem; color: var(--muted); padding-left: 4px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-layout { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
.day-panel { position: sticky; top: 84px; }
.ev { border: 1px solid var(--line); border-left: 4px solid var(--navy-600); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.ev.diligencia { border-left-color: #6a4fc0; }
.ev.reunion { border-left-color: var(--ok); }
.ev.otro { border-left-color: #8a7f66; }
.ev.venc { border-left-color: var(--danger); }
.ev.notif { border-left-color: var(--info); }
.ev.consulta { border-left-color: var(--gold-500); }
.ev .h .btn-row { flex-wrap: nowrap; gap: 2px; }
.ev .h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ev .t { font-weight: 700; color: var(--navy-900); }
.ev .s { font-size: .8rem; color: var(--muted); margin-top: 3px; }

/* Cruce de agenda */
.conflict-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; margin: 14px 0; }
.conflict-grid .vs { display: grid; place-items: center; font-family: var(--serif); font-size: 1.4rem; color: var(--gold-500); font-weight: 700; }
.c-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; background: #fffdf8; }
.c-card.suggest { border-color: var(--gold-500); background: var(--gold-100); box-shadow: var(--shadow-gold); }
.score { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--navy-800); }
.callout { padding: 12px 14px; border-radius: 10px; background: var(--info-bg); color: #1e4f86; font-size: .88rem; display: flex; gap: 10px; align-items: flex-start; }
.callout.warn { background: var(--warn-bg); color: #7c5214; }
.callout.gold { background: var(--gold-100); color: #6b4f12; border: 1px solid var(--gold-300); }
.callout.danger { background: var(--danger-bg); color: #8a2229; }
.resolve-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.resolve-opts button { text-align: left; padding: 12px 14px; height: auto; flex-direction: column; align-items: flex-start; white-space: normal; gap: 3px; }
.resolve-opts button small { font-weight: 400; }

/* ---------------- Planes ---------------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.plan {
  border: 1.5px solid var(--line); border-radius: 18px; padding: 24px; background: #fff; position: relative; cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.plan:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.plan.on { border-color: var(--gold-500); box-shadow: var(--shadow-gold); }
.plan.featured { background: linear-gradient(160deg, var(--navy-800), var(--navy-950)); color: #cfd7ea; border-color: var(--navy-700); }
.plan.featured h3 { color: #fff; }
.plan.featured .price { color: var(--gold-300); }
.plan .ribbon { position: absolute; top: -11px; right: 18px; }
.price { font-family: var(--serif); font-size: 2.4rem; font-weight: 700; color: var(--navy-900); }
.price small { font-family: var(--sans); font-size: .85rem; font-weight: 500; }
.plan ul { padding-left: 18px; margin: 12px 0 0; line-height: 1.9; font-size: .88rem; }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pay-method {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; cursor: pointer; background: #fff;
  display: flex; flex-direction: column; gap: 8px; align-items: center; transition: all .15s; font-weight: 600;
}
.pay-method:hover:not(.off) { border-color: var(--gold-500); box-shadow: var(--shadow-gold); }
.pay-method.off { opacity: .5; cursor: not-allowed; }
.pay-method .logo { font-family: var(--serif); font-size: 1.25rem; font-weight: 800; height: 34px; display: flex; align-items: center; gap: 6px; }
.logo.stripe { color: #635bff; }
.logo.paypal { color: #003087; }
.logo.paypal b { color: #009cde; }
.logo.mp { color: #009ee3; }
.logo.wu { color: #000; background: #ffdd00; padding: 2px 10px; border-radius: 4px; font-size: 1rem; }

/* ---------------- Modal y avisos ---------------- */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(7,15,34,.55); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
  animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 640px; background: var(--paper); border-radius: 18px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45);
  animation: pop .2s ease; border-top: 4px solid var(--gold-500);
}
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-h h3 { margin: 0; font-size: 1.4rem; }
.modal-b { padding: 16px 22px; }
.modal-f { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--navy-900); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: center; min-width: 260px; max-width: 420px; animation: pop .2s ease;
  border-left: 4px solid var(--gold-500); font-size: .9rem;
}
.toast.error { border-left-color: #ef6b73; }
.toast.ok { border-left-color: #3ccf8e; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 170px; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; }
.toolbar .search input { width: 100%; padding-left: 38px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.loading .spinner { border-color: rgba(11,23,48,.12); border-top-color: var(--gold-500); width: 32px; height: 32px; }

.captcha-img { display: block; margin: 10px auto; border: 1px solid var(--line); border-radius: 8px; max-width: 100%; image-rendering: pixelated; min-height: 60px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: .85rem; }
.bar-row .name { width: 110px; flex-shrink: 0; }
.bar-row .bar { flex: 1; height: 10px; border-radius: 99px; background: #efeadc; overflow: hidden; }
.bar-row .bar div { height: 100%; background: linear-gradient(90deg, var(--navy-600), var(--navy-800)); border-radius: 99px; }
.bar-row b { width: 28px; text-align: right; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .cal-layout { grid-template-columns: 1fr; }
  .day-panel { position: static; }
  .pay-methods { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 24px; }
  .auth-hero h1 { font-size: 2.3rem; margin-top: 24px; }
  .feature-list { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; width: 270px; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.4); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 50px; }
  .g2, .g3, .form-grid, .form-grid.three, .plans, .resolve-opts { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .cal .day { min-height: 74px; }
  .cal .chip { font-size: 0; padding: 0; height: 6px; border-left-width: 0; }
  .conflict-grid { grid-template-columns: 1fr; }
  .case-hero .btn-row { position: static; margin-top: 14px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr; }
  .pay-methods { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .hide-sm { display: none; }
  .topbar .crumb { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn, .page-head .btn-row .btn { width: 100%; justify-content: center; }
  .modal, .modal.wide { max-width: 100%; border-radius: 14px; }
  .modal-b { max-height: 70vh; overflow-y: auto; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .btn-row { flex-wrap: wrap; }
}

/* Pantallas muy pequeñas: relojes inteligentes y móviles compactos */
@media (max-width: 360px) {
  body { font-size: 13.5px; }
  .content { padding: 12px 10px 40px; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .topbar .crumb { font-size: 1rem; }
  .card { padding: 14px; }
  .g4, .pay-methods, .plans, .g2, .g3 { grid-template-columns: 1fr; }
  .btn { padding: 9px 12px; }
  .sidebar { width: 86vw; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  .stat .val { font-size: 1.5rem; }
  .tabs { gap: 2px; }
  .tabs button { padding: 8px 10px; font-size: .85rem; }
  .auth-hero { display: none; } /* en relojes/móviles mínimos, solo el formulario */
  .auth-panel { padding: 14px 8px; }
  input, select, textarea, .field, .grid, .form-grid > *, .toolbar > * { min-width: 0; }
  .toolbar input, .toolbar select, .toolbar .search { min-width: 0; width: 100%; }
  .card, .card-head, .list-item, .stat { min-width: 0; }
  .card-head { flex-wrap: wrap; gap: 6px 8px; }
  .card-head .btn { margin-left: 0; }
}
@media (max-width: 280px) {
  body { font-size: 12.5px; }
  .content { padding: 8px 7px 32px; }
  .brand-name { font-size: 1.1rem; }
  .btn { padding: 8px 10px; font-size: .85rem; }
}

/* Pantallas grandes: aprovecha el ancho sin estirar en exceso */
@media (min-width: 1700px) {
  .content { max-width: 1680px; padding: 34px 48px 80px; }
  body { font-size: 15.5px; }
  .shell { grid-template-columns: 300px 1fr; }
}
@media (min-width: 2200px) {
  .content { max-width: 1960px; }
}

/* ---------------- Tarjetas del panel como accesos ---------------- */
a.stat.link { display: block; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.stat.link:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--gold-400); color: inherit; }
a.stat.link .sub { transition: color .15s; }
a.stat.link:hover .sub { color: var(--gold-500); }

/* ---------------- Carpeta del caso ---------------- */
.pending { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pending:empty { display: none; }
.chip-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 5px 6px 5px 11px; border-radius: 99px; background: var(--gold-100); border: 1px solid var(--gold-300);
  font-size: .8rem; font-weight: 600; color: var(--navy-800);
}
.chip-file small { color: var(--muted); font-weight: 500; }
.chip-file button { border: none; background: transparent; cursor: pointer; color: var(--muted); display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.chip-file button:hover { background: rgba(180,50,58,.12); color: var(--danger); }
.chip-file svg.i { width: 14px; height: 14px; }
.link-add { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 8px; margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font: 600 .8rem var(--sans); color: var(--muted); cursor: pointer; }
.chips button span { background: #efebe0; border-radius: 99px; padding: 0 6px; margin-left: 4px; font-size: .72rem; }
.chips button.on { background: var(--navy-800); color: var(--gold-300); border-color: var(--navy-800); }
.chips button.on span { background: rgba(255,255,255,.15); }
a.file-thumb { text-decoration: none; }
.ft-video { background: #ece6fa; color: #5b3fa0; }
.ft-audio { background: #e2f1f4; color: #1d6b7a; }
.ft-link { background: #e8ecf8; color: var(--navy-600); }
svg.i.big { width: 38px; height: 38px; stroke-width: 1.5; }

/* ---------------- Consultas ---------------- */
.debt { font-weight: 700; color: var(--danger); }
.debt-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--danger-bg); color: #8a2229; font-weight: 600; }
.debt-box.ok { background: var(--ok-bg); color: var(--ok); }
.debt-box b { font-family: var(--serif); font-size: 1.5rem; font-variant-numeric: lining-nums; }

/* ---------------- Foto de perfil ---------------- */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar { overflow: hidden; }
.avatar.xl { width: 104px; height: 104px; font-size: 2rem; border-width: 3px; }
.photo-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }

@media (max-width: 860px) { .link-add { grid-template-columns: 1fr; } }
.dropzone { display: block; }
.dropzone svg { display: block; margin: 0 auto 6px; }

/* ---------------- Ingreso a SINOE paso a paso ---------------- */
.steps { display: grid; gap: 6px; margin-bottom: 14px; }
.step { display: flex; gap: 8px; align-items: center; font-size: .86rem; padding: 7px 10px; border-radius: 9px; background: #f6f3ea; color: var(--muted); }
.step.ok { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.step.now { background: var(--gold-100); color: #6b4f12; font-weight: 700; border: 1px solid var(--gold-300); }
.step svg.i { width: 16px; height: 16px; }
.captcha-img { width: 280px; height: auto; background: #fff; padding: 6px; }
.captcha-input { font-size: 1.5rem; text-align: center; letter-spacing: 6px; font-weight: 700; max-width: 280px; display: block; margin: 0 auto; }
.file-note { font-size: .72rem; font-weight: 600; color: var(--ok); padding: 0 11px 9px; display: flex; gap: 4px; align-items: center; }
.file-note.warn { color: var(--warn); }
.file-note svg.i { width: 13px; height: 13px; }
.task .t .tag svg.i { width: 12px; height: 12px; }
.howto { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: .88rem; line-height: 1.5; }
.howto .bookmarklet { margin-left: 6px; cursor: grab; }
kbd { font: 600 .75rem var(--sans); background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }

/* ---------------- Menú desplegable de opción múltiple ---------------- */
.msel { position: relative; }
.msel-btn {
  width: 100%; min-height: 42px; display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  padding: 6px 12px; border: 1px solid #d9d3c3; border-radius: 10px; background: #fffdf8; font: 400 .92rem var(--sans); color: var(--ink);
}
.msel-btn:focus-visible, .msel.open .msel-btn { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201,164,76,.2); background: #fff; }
.msel-btn svg.i { margin-left: auto; color: var(--muted); transition: transform .15s; }
.msel.open .msel-btn svg.i { transform: rotate(180deg); }
.msel-label { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.msel-chip { background: var(--navy-800); color: var(--gold-300); border-radius: 99px; padding: 3px 10px; font-size: .78rem; font-weight: 600; }
.msel-panel {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.msel-opt { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.msel-opt:hover { background: var(--gold-100); }
.msel-opt input { width: 17px; height: 17px; }
.msel-hint { font-size: .72rem; color: var(--muted); padding: 6px 10px 2px; border-top: 1px solid #f0ece2; margin-top: 4px; }
.field .msel-opt { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .9rem; color: var(--ink); }

/* ---------------- Visor de documentos ---------------- */
.modal.viewer { max-width: min(1100px, 100%); }
.modal.viewer .modal-h h3 { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.viewer-frame { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 10px; background: #f4f1ea; }
.viewer-img { display: grid; place-items: center; background: #f4f1ea; border-radius: 10px; padding: 10px; max-height: 72vh; overflow: auto; }
.viewer-img img { max-width: 100%; max-height: 68vh; object-fit: contain; }
.viewer-media { width: 100%; max-height: 72vh; border-radius: 10px; background: #000; }
.viewer-doc { max-height: 72vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px 34px; font-family: 'Times New Roman', Georgia, serif; font-size: 15px; line-height: 1.6; color: #111; }
.viewer-doc table { border-collapse: collapse; margin: 10px 0; }
.viewer-doc td, .viewer-doc th { border: 1px solid #ccc; padding: 4px 8px; }
.viewer-doc img { max-width: 100%; }
@media (max-width: 860px) { .viewer-frame { height: 65vh; } .viewer-doc { padding: 16px; } }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .form-grid.four { grid-template-columns: 1fr; } }
.hero-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(201,164,76,.6); text-underline-offset: 3px; }
.hero-link:hover { color: var(--gold-300); }
hr.sep { border: none; border-top: 1px dashed var(--line); margin: 18px 0; }

/* Marcador (bookmarklet) Artemis CEJ */
.howto-box .bookmarklet { cursor: grab; margin-left: 6px; }
.howto-box .bookmarklet:active { cursor: grabbing; }
.howto-box code { background: var(--navy-50, #eef1f6); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.howto kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--paper); font: 600 .82em monospace; }
