/* Tokens de tema (--bg, --panel, --sb-*, radios, sombras) vienen de
   theme-light.css + theme-dark.css + theme-accent.css (ver DESIGN.md).
   Este archivo solo tiene estilos propios de las páginas de PhosCore. */
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { min-height: 100vh; background: var(--bg); }
button { font: inherit; }

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle [data-lucide], .theme-toggle svg { width: 16px; height: 16px; }

.hero {
  max-width: 720px;
  margin: 18vh auto 0;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 6vw, 52px); line-height: 1.02; letter-spacing: -.04em; }
.description { margin: 20px 0 28px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.status { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; font-size: 13px; font-weight: 600; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(16, 185, 129, .12); }
code { display: block; padding: 12px 14px; border-radius: 8px; background: var(--surface); color: var(--muted); font: 12px/1.5 'JetBrains Mono', monospace; }

@media (max-width: 640px) {
  .hero { margin-top: 10vh; padding: 28px 24px; }
}

/* Contenido propio de las páginas de PhosCore (el chrome de sidebar/topbar/
   botones vive en phos-shell.css, compartido con el resto de la suite). */
.main-content { min-height: 100vh; }
.panel { display: none; }
.panel.active { display: block; }
.page-shell { padding: 24px; max-width: 1240px; }.page-header { margin-bottom: 18px; }.page-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }.page-header p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.stats-grid, .ops-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }.data-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs, 0 1px 2px rgba(24,24,27,.04)); }.ops-metric { min-width: 0; padding: 10px 14px 9px; border: 1px solid var(--line); border-top: 3px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); }.ops-metric--blue{border-top-color:#3b82f6}.ops-metric--red{border-top-color:#ef4444}.ops-metric--purple{border-top-color:#8b5cf6}.ops-metric--amber{border-top-color:#f59e0b}.ops-metric-head{display:flex;align-items:center;gap:6px;margin-bottom:6px}.ops-metric-head svg{width:15px;height:15px}.ops-metric-head span,.ops-metric small{display:block;color:var(--muted);font-size:11px}.ops-metric-head span{font-weight:700;letter-spacing:.04em;text-transform:uppercase}.ops-metric strong{display:block;margin:0 0 2px;font-size:26px;line-height:1;font-weight:800}.ops-header,.page-header{display:flex;align-items:center;justify-content:space-between;gap:16px}
.dashboard-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }.data-panel { padding: 20px; }.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }.panel-title small { color: var(--ink-faint); font-size: 10px; letter-spacing: .08em; }.panel-title h2 { margin: 3px 0 0; font-size: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }.product-tile { display: flex; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); text-decoration: none; }.product-tile { border-top: 3px solid var(--p, var(--line)); }.product-tile svg { width: 18px; color: var(--p, var(--accent)); }.product-tile img { width: 28px; height: 28px; border-radius: 6px; flex: 0 0 auto; }.product-tile strong, .product-tile p, .product-tile small { display: block; }.product-tile p { margin: 3px 0; color: var(--muted); font-size: 11px; }.product-tile small { color: var(--ink-faint); font-size: 10px; }.nav-item-producto [data-lucide] { color: var(--p, var(--accent)); opacity: 1; }
.health-list { display: flex; flex-direction: column; }.health-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }.health-row strong.ok { color: var(--success); }.health-row strong.error { color: var(--danger, #dc2626); }.empty { color: var(--muted); font-size: 12px; }.hidden { display: none !important; }
.profile-shell { width: min(680px, calc(100% - 32px)); margin: 40px auto; }.back-link { color: var(--muted); font-size: 13px; }.profile-card { margin-top: 16px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow); }.profile-card h1 { font-size: 28px; }.profile-card > p:not(.eyebrow) { color: var(--muted); }.profile-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }.profile-form label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }.profile-form input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }.profile-form button { align-self: end; min-height: 38px; border-radius: 8px; font: inherit; cursor: pointer; }.password-form { padding-top: 20px; border-top: 1px solid var(--line); }.form-message { min-height: 1em; color: var(--success); font-size: 13px; }

.form-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-top: 24px; max-width: 560px; background: var(--panel); }
/* Patrón procesos: form-card colapsable con header flush + form-grid.
   El padding lo aportan .form-card-header y .form-grid (vía shell). */
.form-card.has-header { padding: 0; }
.form-card .field-group label { color: var(--ink); font-weight: 600; margin: 0; }
.form-card label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.form-card input, .form-card select, .form-card textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit;
}
.form-card textarea { font-family: 'JetBrains Mono', monospace; font-size: 12px; min-height: 70px; }
.form-card .btn-danger-link { background: none; color: var(--danger, #ef4444); border: none; cursor: pointer; font: inherit; }
.msg { font-size: 13px; margin-top: 10px; min-height: 1em; }
.msg.error { color: var(--danger, #ef4444); }
.msg.ok { color: var(--success); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Modal overlay compartido (iframe embebido) — 2 variantes: fullscreen (Studio,
   mantiene el sidebar detrás) y centrado (Suite Phos, deja ver el dashboard de fondo). */
.modal-overlay { position: fixed; inset: 0; z-index: 500; }
.modal-overlay.hidden { display: none; }
.modal-overlay--fullscreen { background: var(--bg); display: flex; flex-direction: column; }
.modal-overlay--fullscreen .modal-frame { flex: 1; width: 100%; border: none; display: block; }
.modal-overlay--centrado {
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay--centrado .modal-panel {
  width: min(1100px, 92vw); height: min(800px, 90vh);
  border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal-overlay--centrado .modal-frame { width: 100%; height: 100%; border: none; display: block; }
.help-link{margin:2px 10px 6px;display:flex;align-items:center;gap:10px;min-height:32px;padding:7px 10px;border-radius:8px;color:var(--sb-text);text-decoration:none;font-size:13px;font-weight:500}.help-link:hover{background:var(--sb-hover);color:var(--sb-active-text)}.help-link svg{width:17px;height:17px}.notif-bell{position:relative}.notif-badge{position:absolute;right:-3px;top:-4px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#ef4444;color:#fff;font-size:10px;line-height:16px}.ops-chart-panel{margin-top:18px;padding:18px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel)}.ops-chart-panel h3{display:flex;align-items:center;gap:8px;margin:0 0 16px;font-size:14px}.activity-chart{display:grid;grid-template-columns:repeat(7,1fr);align-items:end;gap:10px;height:150px}.chart-day{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:6px}.chart-bar{width:min(34px,80%);min-height:3px;border-radius:5px 5px 2px 2px;background:var(--accent)}.chart-day small{color:var(--muted);font-size:10px}.history-list{display:grid;gap:8px}.history-card{display:grid;grid-template-columns:160px 1fr auto;gap:14px;align-items:center;padding:12px 14px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel)}.history-card strong,.history-card small{display:block}.history-card small{color:var(--muted);font-size:11px}.status-pill{padding:3px 8px;border-radius:999px;background:var(--surface);font-size:11px}.notif-overlay{position:fixed;inset:0;z-index:599;background:rgba(0,0,0,.25)}.notif-drawer{position:fixed;z-index:600;right:0;top:0;width:min(420px,100%);height:100vh;padding:18px;background:var(--panel);border-left:1px solid var(--line);box-shadow:var(--shadow-lg)}.notif-drawer-header{display:flex;align-items:center;justify-content:space-between}.notif-drawer-header h3{display:flex;gap:8px;align-items:center}.notif-list{display:grid;gap:8px;margin-top:16px}

/* ── Visor de eventos / ejecuciones (paridad con PhosFlow: styles.css) ──── */
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-title-group { display: flex; align-items: baseline; gap: 10px; }
.panel-title { font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.panel-meta { font-size: 12px; color: var(--muted); }
.panel-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.runs-filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.runs-filter-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.runs-filter-label svg { width: 14px; height: 14px; }
.filter-group { position: relative; }
.filter-group[hidden] { display: none; }
.filter-trigger { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; font-size: 13px; font-weight: 500; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; }
.filter-trigger:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.filter-group.open .filter-trigger { border-color: var(--accent); }
.filter-trigger svg { width: 15px; height: 15px; }
.filter-caret { transition: transform .18s; opacity: .7; }
.filter-group.open .filter-caret { transform: rotate(180deg); }
.filter-badge { min-width: 18px; padding: 1px 6px; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; color: var(--panel); background: var(--accent); border-radius: 999px; }
.filter-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: 280px; max-width: calc(100vw - 40px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.filter-panel-head { padding: 8px; border-bottom: 1px solid var(--line); }
.filter-search { width: 100%; }
.filter-panel-actions { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.filter-link { background: none; border: none; padding: 2px 4px; font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; }
.filter-link:hover { text-decoration: underline; }
.filter-options { max-height: 260px; overflow-y: auto; padding: 4px; }
.filter-option { display: flex; align-items: center; gap: 9px; padding: 7px 8px; font-size: 13px; color: var(--ink); border-radius: var(--radius); cursor: pointer; }
.filter-option:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.filter-option input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.filter-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-empty { padding: 14px 8px; font-size: 12px; text-align: center; color: var(--muted); }
.filter-clear-all { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: none; border: none; cursor: pointer; }
.filter-clear-all:hover { color: var(--ink); }
.filter-clear-all svg { width: 14px; height: 14px; }

.archivos-table-wrap { overflow-x: auto; margin-top: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.data-table, .archivos-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table thead, .archivos-table thead { background: var(--surface); border-bottom: 1px solid var(--line); }
.data-table th, .archivos-table th { padding: 9px 12px; text-align: left; white-space: nowrap; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface); }
.data-table td, .archivos-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); vertical-align: middle; }
.data-table tr:last-child td, .archivos-table tbody tr:last-child td { border-bottom: none; }
.data-table tr:hover td, .archivos-table tbody tr:hover td { background: color-mix(in srgb, var(--surface) 60%, var(--accent-dim)); }

th.visor-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.visor-sortable:hover { color: var(--accent); }
th.visor-sortable .visor-sort-arrow { font-size: 10px; margin-left: 3px; opacity: .8; }
.visor-entity { display: grid; gap: 2px; min-width: 0; }
.visor-entity strong { overflow: hidden; color: var(--ink); font-size: 12.5px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.visor-entity code { width: fit-content; max-width: 100%; overflow: hidden; padding: 1px 6px; border-radius: 5px; background: var(--surface); color: var(--muted); }
.visor-sev, .visor-estado { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; background: var(--surface); color: var(--muted); }
.visor-sev--error, .visor-estado--error, .visor-estado--error_login, .visor-estado--error_flujo { background: rgba(220, 38, 38, .12); color: #dc2626; }
.visor-sev--warning, .visor-estado--sesion_expirada { background: rgba(217, 119, 6, .12); color: #d97706; }
.visor-sev--info, .visor-estado--exitoso, .visor-estado--finished { background: rgba(22, 163, 74, .12); color: #16a34a; }
.visor-estado--cancelado, .visor-estado--cancelled { background: rgba(113, 113, 122, .15); color: #71717a; }
.visor-detalle, .visor-runid { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { padding: 34px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.surface-empty { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.empty-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; }
.empty-icon [data-lucide] { width: 22px; height: 22px; stroke-width: 1.5; opacity: .6; }
.empty-state p { font-size: 14px; font-weight: 500; }

@media (max-width: 850px) { .stats-grid { grid-template-columns: 1fr 1fr; }.dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .page-shell { padding: 16px; }.stats-grid { grid-template-columns: 1fr; }.profile-form { grid-template-columns: 1fr; } }

.platform-grid { display:grid; grid-template-columns:minmax(260px,.75fr) minmax(480px,1.5fr); gap:16px; }
.inline-form { display:flex; gap:8px; flex-wrap:wrap; margin:12px 0; }
.inline-form input,.inline-form select { min-width:120px; flex:1; }
.platform-list { display:grid; gap:6px; }
.platform-org { width:100%; padding:10px; text-align:left; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink); cursor:pointer; }
.platform-org.active { border-color:var(--accent); background:var(--accent-dim); }
.platform-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:9px 0; border-bottom:1px solid var(--line); }
.platform-row-actions { display:flex; gap:6px; }
.platform-members-title { margin-top:22px; }
@media (max-width:900px){.platform-grid{grid-template-columns:1fr}}

/* Fase 36: organizaciones/miembros/entitlements como pantallas separadas. */
.form-actions { display:flex; gap:8px; margin-top:14px; }
.member-avatar { width:28px; height:28px; border-radius:50%; object-fit:cover; display:inline-block; background:var(--surface); border:1px solid var(--line); }
.member-avatar--empty { background:var(--accent-dim); }

/* Fase 40: selector "actuar como organización" (solo superadmin). */
.actuar-como-bar { display:flex; align-items:center; gap:6px; padding:4px 8px; border:1px solid var(--accent); border-radius:8px; background:var(--accent-dim); }
.actuar-como-bar svg { width:15px; height:15px; color:var(--accent); }
.actuar-como-bar select { border:none; background:transparent; color:var(--ink); font:inherit; font-size:12px; max-width:180px; cursor:pointer; }
.actuar-como-bar .btn-icon { width:26px; height:26px; }
