:root {
  --bg: #F7F3EC;
  --surface: #ffffff;
  --surface-soft: #eef1fa;
  --text: #061829;
  --muted: #5a6b7a;
  --line: #E6E6E6;
  --primary: #0F41CE;
  --primary-dark: #0a31a8;
  --primary-soft: #e8eeff;
  --accent: #074E48;
  --accent-soft: #e6f2f0;
  --highlight: #F08A4B;
  --sidebar: 248px;
  --topbar: 74px;
  --shadow: 0 14px 40px rgba(6,24,41,.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar) + 24px); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Montserrat, ui-sans-serif, sans-serif; transition: background .25s, color .25s; }
body.dark { --bg: #0a1420; --surface: #111e2e; --surface-soft: #1a2d45; --text: #f0f4fa; --muted: #8a9db5; --line: #1e3048; --primary-soft: #152255; --shadow: 0 14px 40px rgba(0,0,0,.35); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.topbar { position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; }
.brand-mark svg { display: block; }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 18px/1 Montserrat, ui-sans-serif, sans-serif; letter-spacing: -.3px; color: var(--text); }
.brand small { color: var(--muted); font-size: 10px; margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.data-mode-badge { padding: 5px 9px; border-radius: 999px; background: #fff0e3; color: #a25d24; font-size: 9px; font-weight: 700; white-space: nowrap; }
body[data-data-mode="supabase"] .data-mode-badge { background: #e5f6ef; color: #12684f; }
body[data-data-mode="ferozo"] .data-mode-badge { background: #e5f6ef; color: #12684f; }
body[data-data-mode="configuration-error"] .data-mode-badge { background: #fde8ea; color: #b52f3e; }
body[data-data-loading="true"] .data-mode-badge { opacity: .65; }
.account-type-badge { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; font-weight: 700; white-space: nowrap; }
body[data-user-role="platform-admin"] .account-type-badge { border-color: #b8c8ff; color: #0F41CE; background: #edf1ff; }
body:not([data-user-role="platform-admin"]) .account-type-badge { border-color: #b2d8d2; color: #074E48; background: #e6f2f0; }
.tenant-switcher { display: grid; gap: 3px; }
.tenant-label { color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.tenant-switcher select { width: min(220px, 22vw); padding: 6px 28px 6px 9px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--text); background: var(--surface); font-size: 10px; font-weight: 700; }
.tenant-switcher select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,65,206,.1); }
.user-session { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); text-align: left; cursor: pointer; transition: all .18s; }
.user-session-avatar { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--primary); font-size: 10px; font-weight: 900; }
.user-session b, .user-session small { display: block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-session b { font-size: 9px; } .user-session small { margin-top: 1px; color: var(--muted); font-size: 7px; }
/* Prominent CTA when not authenticated */
body.unauthenticated #userSession { background: var(--primary); border-color: var(--primary); color: #fff; padding: 6px 16px 6px 10px; border-radius: 10px; }
body.unauthenticated #userSession .user-session-avatar { background: rgba(255,255,255,.2); font-size: 13px; }
body.unauthenticated #userSession b { font-size: 11px; font-weight: 700; color: #fff; }
body.unauthenticated #userSession small { color: rgba(255,255,255,.75); font-size: 8px; }
body.unauthenticated #userSession:hover { background: #053f39; border-color: #053f39; }
body.unauthenticated .data-mode-badge, body.unauthenticated .portal-button, body.unauthenticated .workspace-shortcut { display: none; }
.system-status { color: var(--muted); font-size: 12px; font-weight: 600; }
.system-status i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #35c98a; box-shadow: 0 0 0 4px rgba(53,201,138,.12); }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); cursor: pointer; }
.workspace-shortcut { height: 38px; padding: 0 15px; border: 0; border-radius: 10px; color: #fff; background: var(--primary); font-size: 11px; font-weight: 700; cursor: pointer; }

.sidebar { position: fixed; top: var(--topbar); bottom: 0; left: 0; z-index: 10; width: var(--sidebar); padding: 18px 14px 26px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.sidebar-heading { margin: 0 10px 10px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; opacity: .6; }

/* ─── Root nav (Home link) ─── */
.nav-root { list-style: none; margin: 0 0 6px; padding: 0; }
.nav-root li { margin: 0; }
.nav-home { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; color: var(--text); font-size: 11px; font-weight: 600; text-decoration: none; transition: background .15s, color .15s; }
.nav-home-icon { font-size: 13px; opacity: .55; }
.nav-home:hover, .nav-home.active { background: var(--primary-soft); color: var(--primary); }
.nav-home.active .nav-home-icon { opacity: 1; }

/* ─── Category groups ─── */
.nav-group { border: none; margin-bottom: 1px; }
.nav-group-header { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 8px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); cursor: pointer; list-style: none; user-select: none; transition: background .12s, color .12s; }
.nav-group-header::-webkit-details-marker { display: none; }
.nav-group-header:hover { background: var(--surface-soft); color: var(--text); }
.nav-group[open] > .nav-group-header { color: var(--text); }
.nav-cat-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; transition: transform .15s, box-shadow .15s; }
.nav-group[open] > .nav-group-header .nav-cat-dot { transform: scale(1.3); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
[data-cat="personas"] .nav-cat-dot { background: #074E48; }
[data-cat="prevencion"] .nav-cat-dot { background: #0F41CE; }
[data-cat="cumplimiento"] .nav-cat-dot { background: #F08A4B; }
[data-cat="gestion"] .nav-cat-dot { background: #061829; }
.nav-cat-count { margin-left: auto; font-size: 9px; font-weight: 700; color: var(--muted); opacity: .55; }
.nav-group ul { list-style: none; margin: 2px 0 4px; padding: 0 0 0 16px; }
.nav-group ul li { margin: 0; }
.nav-group ul li a { display: block; padding: 5px 10px; font-size: 11px; color: var(--muted); text-decoration: none; border-radius: 7px; border-left: 2px solid transparent; transition: all .12s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group ul li a:hover { color: var(--text); background: var(--surface-soft); }
.nav-group ul li a.active { font-weight: 600; }
.nav-group:has([data-cat="personas"]) ul li a.active { color: #074E48; background: #e6f2f0; border-left-color: #074E48; }
.nav-group:has([data-cat="prevencion"]) ul li a.active { color: #0F41CE; background: #e8eeff; border-left-color: #0F41CE; }
.nav-group:has([data-cat="cumplimiento"]) ul li a.active { color: #bf6b29; background: #fdf0e6; border-left-color: #F08A4B; }
.nav-group:has([data-cat="gestion"]) ul li a.active { color: var(--text); background: var(--surface-soft); border-left-color: var(--muted); }

.sidebar-note { margin-top: 20px; padding: 14px; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #0F41CE, #074E48); box-shadow: 0 12px 25px rgba(15,65,206,.18); }
.sidebar-note span, .sidebar-note strong { display: block; }
.sidebar-note span { font-size: 9px; opacity: .7; }
.sidebar-note strong { margin-top: 3px; font-size: 12px; }
.sidebar-note p { margin: 6px 0 0; font-size: 9px; line-height: 1.45; opacity: .8; }

.main-content { margin-left: var(--sidebar); padding-top: var(--topbar); min-height: 100vh; }
.hero { min-height: 465px; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 48px; padding: 74px clamp(40px, 6vw, 92px); overflow: hidden; background: linear-gradient(120deg, var(--surface) 0%, var(--surface) 48%, var(--surface-soft) 100%); border-bottom: 1px solid var(--line); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; }
.eyebrow::before { content: ''; width: 17px; height: 2px; background: var(--primary); }
.hero h1 { margin: 15px 0 20px; font: 700 clamp(38px, 4.5vw, 64px)/1.06 Montserrat, ui-sans-serif, sans-serif; letter-spacing: -2px; }
.hero h1 em { color: var(--primary); font-style: normal; }
.hero-copy > p { max-width: 590px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.75; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; }
.primary-button, .secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 24px; padding: 0 19px; border-radius: 10px; font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; transition: .2s; }
.primary-button { color: #fff; background: var(--primary); border: 1px solid var(--primary); box-shadow: 0 9px 22px rgba(15,65,206,.22); }
.primary-button:hover { transform: translateY(-2px); background: var(--primary-dark); }
.secondary-button { color: var(--text); background: transparent; border: 1px solid var(--line); }
.secondary-button:hover { border-color: var(--primary); color: var(--primary); }
.hero-visual { position: relative; min-height: 320px; }
.orb { position: absolute; border-radius: 50%; filter: blur(1px); }
.orb-one { width: 270px; height: 270px; top: 20px; right: 40px; background: linear-gradient(145deg, #a8d0e8, #0F41CE); opacity: .30; }
.orb-two { width: 150px; height: 150px; left: 25px; bottom: 0; background: #F08A4B; opacity: .35; }
.preview-card { position: absolute; border: 1px solid rgba(255,255,255,.65); background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(16px); box-shadow: 0 20px 45px rgba(6,24,41,.12); }
.preview-main { z-index: 2; width: min(330px, 78%); top: 38px; left: 12%; padding: 24px; border-radius: 20px; transform: rotate(-2deg); }
.preview-head { display: flex; justify-content: space-between; margin-bottom: 25px; color: var(--muted); font-size: 11px; font-weight: 700; }
.preview-head i { width: 8px; height: 8px; border-radius: 50%; background: #36c78b; }
.preview-main > strong { display: block; font: 700 45px Montserrat, ui-sans-serif, sans-serif; letter-spacing: -2px; }
.preview-main > small { color: var(--muted); }
.progress { height: 7px; margin: 17px 0 22px; overflow: hidden; border-radius: 10px; background: var(--line); }
.progress span { display: block; width: 84%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0F41CE, #5b82ef); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats span { color: var(--muted); font-size: 9px; }
.mini-stats b { display: block; margin-bottom: 2px; color: var(--text); font-size: 13px; }
.preview-alert, .preview-team { z-index: 3; display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-radius: 14px; }
.preview-alert { top: 5px; right: 1%; }
.preview-team { right: 0; bottom: 22px; }
.preview-alert > span, .preview-team > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; font-weight: 800; }
.preview-alert > span { color: #F08A4B; background: #fdf0e6; }
.preview-team > span { color: var(--primary); font-size: 11px; background: var(--primary-soft); }
.preview-card b, .preview-card small { display: block; }
.preview-card b { font-size: 11px; }
.preview-card small { margin-top: 2px; color: var(--muted); font-size: 9px; }

.overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; padding: 0 clamp(35px, 5vw, 78px); background: var(--line); border-bottom: 1px solid var(--line); }
.overview article { display: flex; align-items: center; gap: 13px; padding: 24px 18px; background: var(--surface); }
.overview strong, .overview small { display: block; }
.overview strong { font: 700 17px Montserrat, ui-sans-serif, sans-serif; }
.overview small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.stat-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; font-weight: 700; }
.purple { color: #074E48; background: #e6f2f0; } .green { color: #169b6b; background: #e1f7ee; } .orange { color: #F08A4B; background: #fdf0e6; } .blue { color: #0F41CE; background: #e8eeff; }

.explorer-header { display: flex; align-items: end; justify-content: space-between; padding: 65px clamp(35px, 5vw, 78px) 25px; }
.explorer-header h2 { margin: 10px 0 5px; font: 700 30px Montserrat, ui-sans-serif, sans-serif; letter-spacing: -.8px; }
.explorer-header p { margin: 0; color: var(--muted); font-size: 13px; }
.view-switch { display: flex; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.view-switch button { width: 34px; height: 30px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.view-switch button.active { color: var(--primary); background: var(--primary-soft); }
.toolbar { display: flex; align-items: center; gap: 14px; padding: 0 clamp(35px, 5vw, 78px) 16px; }
.search-box { height: 44px; flex: 1; display: flex; align-items: center; gap: 11px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); transition: .2s; }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,65,206,.1); }
.search-box > span { color: var(--muted); font-size: 20px; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: #9aabba; }
kbd { padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--bg); font: 10px inherit; }
.filters { display: flex; gap: 6px; }
.filters button { height: 35px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); font-size: 10px; font-weight: 700; cursor: pointer; }
.filters button:hover, .filters button.active { color: #fff; border-color: var(--primary); background: var(--primary); }
.results-count { margin: 0; padding: 0 clamp(35px, 5vw, 78px) 14px; color: var(--muted); font-size: 11px; }

.modules-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; padding: 0 clamp(35px, 5vw, 78px) 70px; }
.module-card { position: relative; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 0 0 rgba(0,0,0,0); transition: transform .22s, box-shadow .22s, border-color .22s; }
.module-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow); }
.module-card[hidden] { display: none; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.module-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.module-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; color: var(--card-color); background: var(--card-bg); font-size: 17px; font-weight: 700; }
.module-card h2 { margin: 0; color: var(--text); font: 600 14px/1.35 Montserrat, ui-sans-serif, sans-serif; }
.module-number { display: block; margin-bottom: 3px; color: var(--muted); font: 600 9px Montserrat, ui-sans-serif, sans-serif; letter-spacing: .8px; text-transform: uppercase; }
.expand-button { width: 30px; height: 30px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; transition: .2s; }
.module-card.expanded .expand-button { color: var(--primary); background: var(--primary-soft); transform: rotate(45deg); }
.module-summary { margin: 15px 0 13px; color: var(--muted); font-size: 11px; line-height: 1.58; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.module-tag { display: inline-block; padding: 5px 8px; border-radius: 6px; color: var(--card-color); background: var(--card-bg); font-size: 8px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.module-details { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
.module-details > div { overflow: hidden; }
.module-card.expanded .module-details { grid-template-rows: 1fr; }
.detail-inner { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.detail-inner h3 { margin: 0 0 5px; color: var(--text); font-size: 10px; text-transform: uppercase; letter-spacing: .7px; }
.detail-inner p { margin: 0 0 14px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.modules-grid.list-view { grid-template-columns: 1fr; }
.modules-grid.list-view .module-card { display: grid; grid-template-columns: minmax(260px, .7fr) 1fr; gap: 20px; }
.modules-grid.list-view .module-summary { margin-top: 0; }
.modules-grid.list-view .module-tag { align-self: end; }
.empty-state { margin: 10px clamp(35px, 5vw, 78px) 70px; padding: 55px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 16px; background: var(--surface); }
.empty-state > span { color: var(--primary); font-size: 34px; } .empty-state h3 { margin: 10px 0 5px; } .empty-state p { color: var(--muted); font-size: 12px; } .empty-state button { padding: 9px 14px; border: 0; border-radius: 8px; color: #fff; background: var(--primary); cursor: pointer; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 30px clamp(35px, 5vw, 78px); border-top: 1px solid var(--line); background: var(--surface); }
footer p { color: var(--muted); font-size: 11px; } footer > a:last-child { color: var(--primary); font-size: 11px; font-weight: 600; text-decoration: none; }

/* Operational workspace */
body.workspace-open .hero,
body.workspace-open .overview,
body.workspace-open .explorer-header,
body.workspace-open .toolbar,
body.workspace-open .results-count,
body.workspace-open .modules-grid,
body.workspace-open .empty-state,
body.workspace-open footer { display: none; }
.workspace[hidden] { display: none; }
.workspace { min-height: calc(100vh - var(--topbar)); padding: 38px clamp(28px, 4vw, 62px) 70px; background: var(--bg); }
.workspace-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.back-button { margin: 0 0 22px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.back-button:hover { color: var(--primary); }
.workspace-kicker { display: block; margin-bottom: 7px; color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; }
.workspace-header h1 { margin: 0; font-size: clamp(28px, 3vw, 42px); letter-spacing: -1.4px; }
.workspace-header p { max-width: 680px; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.workspace-actions { display: flex; gap: 9px; }
.action-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 15px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); font-size: 10px; font-weight: 700; cursor: pointer; }
.action-button.primary { color: #fff; border-color: var(--primary); background: var(--primary); }
.action-button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.module-tabs { display: flex; gap: 7px; margin-bottom: 22px; padding-bottom: 10px; overflow-x: auto; scrollbar-width: thin; }
.module-tabs button { flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); font-size: 10px; font-weight: 600; cursor: pointer; }
.module-tabs button.active { color: #fff; border-color: var(--primary); background: var(--primary); }
.workspace-body { display: grid; gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.kpi-card, .panel { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 8px 24px rgba(6,24,41,.04); }
.kpi-card { padding: 19px; border-radius: 13px; }
.kpi-card .kpi-label { color: var(--muted); font-size: 10px; font-weight: 600; }
.kpi-card strong { display: block; margin: 9px 0 5px; font-size: 27px; letter-spacing: -1px; }
.kpi-card small { color: var(--muted); font-size: 9px; }
.kpi-card small.good { color: #169b6b; } .kpi-card small.warn { color: #d9782d; } .kpi-card small.bad { color: #db4d5c; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(270px, .7fr); gap: 16px; }
.workspace-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; padding: 20px; border-radius: 14px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.panel-header h2 { margin: 0; font-size: 14px; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.panel-link { padding: 0; border: 0; color: var(--primary); background: transparent; font-size: 9px; font-weight: 700; cursor: pointer; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.data-table th { padding: 10px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 8px; letter-spacing: .6px; text-align: left; text-transform: uppercase; }
.data-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .cell-title { font-weight: 700; } .data-table .cell-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.table-action { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--primary); background: transparent; font-size: 8px; font-weight: 700; cursor: pointer; }
.table-action.danger { color: #c64250; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; font-size: 8px; font-weight: 700; }
.status-pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.good { color: #16865f; background: #e2f7ef; } .status-pill.warn { color: #bf6b29; background: #fff0e2; } .status-pill.bad { color: #c64250; background: #fde8eb; } .status-pill.info { color: #0F41CE; background: #e8eeff; }
.activity-list, .relation-list { display: grid; gap: 10px; }
.company-list-heading, .company-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.company-test-banner { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid #cfeee2; border-radius: 11px; background: #effbf6; color: #166b4e; }
body.dark .company-test-banner { border-color: #285b49; background: #18372d; color: #87d9ba; }
.company-test-banner > span:nth-child(2) { min-width: 0; flex: 1; } .company-test-banner b, .company-test-banner small { display: block; } .company-test-banner b { font-size: 9px; } .company-test-banner small { margin-top: 2px; color: var(--muted); font-size: 8px; } .company-test-banner .panel-link { color: inherit; }
.company-list-heading { margin: 4px 0 14px; }
.company-list-heading h2, .company-section-heading h2 { margin: 0; font-size: 17px; }
.company-list-heading p, .company-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.company-list-heading > span, .company-section-heading > span { color: var(--muted); font-size: 9px; font-weight: 700; }
.company-list { display: grid; gap: 10px; }
.company-list-card { width: 100%; display: grid; grid-template-columns: auto minmax(220px, 1fr) auto auto auto; align-items: center; gap: 18px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--surface); text-align: left; cursor: pointer; transition: .2s; }
.company-list-card:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow); transform: translateY(-2px); }
.company-avatar.small { width: 42px; height: 42px; border-radius: 12px; font-size: 17px; }
.company-list-main, .company-list-status { display: grid; gap: 4px; }
.company-list-title { font-size: 12px; font-weight: 700; }
.company-list-meta { color: var(--muted); font-size: 9px; }
.company-list-stats { display: flex; gap: 20px; color: var(--muted); font-size: 8px; }
.company-list-stats b { display: block; margin-bottom: 2px; color: var(--text); font-size: 12px; }
.company-list-status { justify-items: start; }
.company-list-status small { font-size: 7px; font-weight: 700; } .company-list-status small.complete { color: #16865f; } .company-list-status small.pending { color: #bf6b29; }
.company-list-arrow { color: var(--primary); font-size: 16px; }
.company-empty { padding: 55px 20px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface); text-align: center; }
.company-empty > span { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-size: 21px; } .company-empty h2 { margin: 12px 0 5px; font-size: 15px; } .company-empty p { max-width: 410px; margin: 0 auto 18px; color: var(--muted); font-size: 10px; line-height: 1.5; } .company-empty.compact { padding: 35px 20px; }
.company-back { width: max-content; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; } .company-back:hover { color: var(--primary); }
.setup-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.setup-steps span { display: flex; align-items: center; gap: 7px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); }
.setup-steps i { width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--line); font-size: 8px; font-style: normal; font-weight: 700; } .setup-steps b { font-size: 8px; } .setup-steps .done { color: #16865f; border-color: #cfeee2; } .setup-steps .done i { color: #fff; background: #20aa77; } .setup-steps .current { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); } .setup-steps .current i { color: #fff; background: var(--primary); }
.company-compact-profile { display: flex; align-items: center; gap: 14px; } .company-compact-profile > span:nth-child(2) { min-width: 0; flex: 1; } .company-compact-profile h2 { margin: 0 0 4px; font-size: 17px; } .company-compact-profile p { margin: 0; color: var(--muted); font-size: 9px; }
.company-quick-data { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 20px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); } .company-quick-data span small, .company-quick-data span b { display: block; } .company-quick-data span small { margin-bottom: 5px; color: var(--muted); font-size: 7px; font-weight: 700; text-transform: uppercase; } .company-quick-data span b { font-size: 9px; }
.company-full-data[hidden] { display: none; }
.company-full-data { margin-top: 16px; padding-top: 2px; border-top: 1px dashed var(--line); }
.field-pending { color: #d9782d; font-weight: 700; }
.orange-review { overflow: hidden; border: 1px solid #f2c89f; border-radius: 12px; background: #fff8f0; color: #824713; }
body.dark .orange-review { border-color: #704722; background: #382719; color: #f1b77e; }
.orange-review summary { display: flex; align-items: center; gap: 11px; padding: 13px 15px; list-style: none; cursor: pointer; } .orange-review summary::-webkit-details-marker { display: none; }
.orange-review summary > span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: #fff; background: #F08A4B; font-size: 12px; font-weight: 900; } .orange-review summary > div { min-width: 0; flex: 1; } .orange-review summary b, .orange-review summary small { display: block; } .orange-review summary b { font-size: 10px; } .orange-review summary small { margin-top: 2px; color: #aa6a30; font-size: 8px; } .orange-review summary strong { font-size: 8px; }
.orange-review ul { display: grid; gap: 0; margin: 0; padding: 0 15px 13px; list-style: none; } .orange-review li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid #f2dbc5; } .orange-review li > div { min-width: 0; flex: 1; } .orange-review li b, .orange-review li small { display: block; } .orange-review li b { font-size: 9px; } .orange-review li small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.orange-review li > button { flex: 0 0 auto; padding: 6px 8px; border: 1px solid #e7aa6d; border-radius: 6px; color: #a75b17; background: #fff; font-size: 7px; font-weight: 900; cursor: pointer; } .orange-review li > button:hover { color: #fff; background: #d9782d; }
.orange-connections { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 15px 14px; } .orange-connections > b { width: 100%; margin-bottom: 2px; font-size: 8px; text-transform: uppercase; } .orange-connections > span { padding: 5px 7px; border: 1px solid #f0d3b5; border-radius: 6px; color: #8e5826; background: rgba(255,255,255,.55); font-size: 7px; font-weight: 700; }
.orange-badge { flex: 0 0 auto; min-width: 76px; padding: 4px 6px; border-radius: 5px; color: #a75b17; background: #ffe8d0; font-size: 7px; font-weight: 900; text-align: center; text-transform: uppercase; } .orange-badge.improvement { color: #b0691f; background: #fff0dc; }
.orange-review.complete { display: flex; align-items: center; gap: 11px; padding: 13px 15px; } .orange-review.complete > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: #F08A4B; } .orange-review.complete b, .orange-review.complete small { display: block; } .orange-review.complete b { font-size: 10px; } .orange-review.complete small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.next-version { overflow: hidden; margin-top: 8px; border: 1px dashed #e6a764; border-radius: 12px; background: color-mix(in srgb, #fff5e8 70%, var(--surface)); }
.next-version summary { display: flex; align-items: center; gap: 11px; padding: 13px 15px; list-style: none; cursor: pointer; } .next-version summary::-webkit-details-marker { display: none; } .next-version summary > span { width: 31px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 6px; color: #fff; background: #d9782d; font-size: 8px; font-weight: 900; } .next-version summary > div { min-width: 0; flex: 1; } .next-version summary b, .next-version summary small { display: block; } .next-version summary b { color: #98551d; font-size: 10px; } .next-version summary small { margin-top: 2px; color: var(--muted); font-size: 8px; } .next-version summary strong { color: #b66b27; font-size: 8px; }
.next-version-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 0 15px 15px; } .next-version-grid article { padding: 11px; border: 1px solid #f0d4b6; border-radius: 8px; background: var(--surface); } .next-version-grid b { color: #b26723; font-size: 9px; } .next-version-grid p { margin: 4px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }
.permissions-section { overflow: hidden; margin-top: 8px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.permissions-section summary { display: flex; align-items: center; gap: 11px; padding: 15px 17px; list-style: none; cursor: pointer; } .permissions-section summary::-webkit-details-marker { display: none; } .permissions-section[open] summary { border-bottom: 1px solid var(--line); } .permissions-section summary > div { min-width: 0; flex: 1; } .permissions-section summary b, .permissions-section summary small { display: block; } .permissions-section summary b { font-size: 11px; } .permissions-section summary small { margin-top: 3px; color: var(--muted); font-size: 8px; } .permissions-section summary > strong { color: var(--primary); font-size: 8px; }
.permission-lock { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 900; }
.permissions-content { padding: 16px 17px 18px; } .permissions-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 7px; } .permissions-heading b, .permissions-heading small { display: block; } .permissions-heading b { font-size: 10px; } .permissions-heading small { margin-top: 2px; color: var(--muted); font-size: 8px; } .approval-heading { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.permission-list, .approval-list { display: grid; } .permission-user { display: grid; grid-template-columns: auto minmax(145px, .8fr) minmax(190px, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); } .permission-user:last-child, .approval-row:last-child { border-bottom: 0; } .permission-avatar { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font-size: 9px; font-weight: 900; } .permission-user b, .permission-user small, .permission-role b, .permission-role small { display: block; } .permission-user b { font-size: 9px; } .permission-user small { margin-top: 2px; color: var(--muted); font-size: 7px; line-height: 1.35; } .permission-role b { color: var(--primary); }
.approval-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); } .approval-row > span:first-child { min-width: 0; flex: 1; } .approval-row b, .approval-row small { display: block; } .approval-row b { font-size: 9px; } .approval-row small { margin-top: 3px; color: var(--muted); font-size: 7px; line-height: 1.4; } .approval-actions { display: flex; gap: 5px; } .approval-actions button { padding: 6px 8px; border: 0; border-radius: 6px; color: #fff; background: #20aa77; font-size: 7px; font-weight: 900; cursor: pointer; } .approval-actions button.reject { background: #d85b66; }
.company-section-heading { margin: 9px 0 2px; }
.center-list { display: grid; gap: 10px; }
.center-accordion { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.center-accordion summary { display: flex; align-items: center; gap: 12px; padding: 15px 17px; list-style: none; cursor: pointer; } .center-accordion summary::-webkit-details-marker { display: none; } .center-accordion[open] summary { border-bottom: 1px solid var(--line); }
.center-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 700; }
.center-summary { min-width: 0; flex: 1; } .center-summary b, .center-summary small { display: block; } .center-summary b { font-size: 11px; } .center-summary small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.accordion-chevron { color: var(--muted); transition: transform .2s; } .center-accordion[open] .accordion-chevron { transform: rotate(180deg); }
.center-content { padding: 16px 17px 18px; } .center-info { display: grid; grid-template-columns: 1fr 1fr auto; gap: 20px; align-items: end; } .center-info span small, .center-info span b { display: block; } .center-info span small { margin-bottom: 4px; color: var(--muted); font-size: 7px; text-transform: uppercase; } .center-info span b { font-size: 9px; } .center-controls { display: flex; gap: 6px; }
.areas-heading { display: flex; justify-content: space-between; gap: 15px; margin: 18px 0 7px; padding-top: 14px; border-top: 1px solid var(--line); } .areas-heading b, .areas-heading small { display: block; } .areas-heading b { font-size: 9px; } .areas-heading small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.area-list { display: grid; } .area-row { display: grid; grid-template-columns: minmax(150px, 1fr) auto auto auto auto; align-items: center; gap: 9px; padding: 9px 5px; border-bottom: 1px solid var(--line); } .area-row:last-child { border-bottom: 0; } .area-row > span:first-child b, .area-row > span:first-child small { display: block; } .area-row > span:first-child b { font-size: 9px; } .area-row > span:first-child small { margin-top: 2px; color: var(--muted); font-size: 7px; } .icon-danger { width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 6px; color: #c64250; background: transparent; cursor: pointer; } .area-empty { padding: 18px 5px 5px; color: var(--muted); font-size: 9px; }
.company-profile { display: flex; align-items: center; gap: 16px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.company-avatar { width: 56px; height: 56px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 16px; color: #fff; background: linear-gradient(145deg, #0F41CE, #074E48); font-size: 25px; font-weight: 700; }
.company-profile > div:nth-child(2) { min-width: 0; flex: 1; }
.company-profile h2 { margin: 8px 0 3px; font-size: 18px; }
.company-profile p { margin: 0; color: var(--muted); font-size: 10px; }
.company-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; padding-top: 19px; }
.company-detail-grid .wide { grid-column: 1 / -1; }
.company-detail-grid span, .company-detail-grid b, .company-detail-grid small { display: block; }
.company-detail-grid span { margin-bottom: 5px; color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.company-detail-grid b { font-size: 10px; line-height: 1.45; }
.company-detail-grid small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.integration-row { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px; border: 1px solid transparent; border-radius: 10px; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.integration-row:hover { border-color: var(--line); background: var(--bg); }
.integration-row > span:nth-child(2) { min-width: 0; flex: 1; }
.integration-row b, .integration-row small { display: block; } .integration-row b { font-size: 9px; } .integration-row small { margin-top: 3px; color: var(--muted); font-size: 8px; } .integration-row strong { color: var(--primary); }
.activity-item { display: flex; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { padding-bottom: 0; border: 0; }
.activity-dot { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font-size: 10px; font-weight: 700; }
.activity-item b, .activity-item small { display: block; } .activity-item b { font-size: 9px; } .activity-item small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.progress-row { margin-bottom: 14px; } .progress-row:last-child { margin-bottom: 0; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 9px; } .progress-label b { color: var(--text); }
.progress-bar { height: 7px; overflow: hidden; border-radius: 8px; background: var(--line); } .progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.ecosystem-flow { display: flex; align-items: center; gap: 7px; padding: 18px; overflow-x: auto; }
.flow-node { min-width: 105px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; text-align: center; background: var(--surface); cursor: pointer; } .flow-node b { display: block; font-size: 9px; } .flow-node small { color: var(--muted); font-size: 7px; } .flow-arrow { color: var(--primary); font-weight: 700; }
.empty-panel { padding: 35px 15px; color: var(--muted); text-align: center; font-size: 10px; }
.catalog-open-button { width: 100%; min-height: 34px; margin-top: 14px; border: 0; border-radius: 8px; color: #fff; background: var(--card-color); font-size: 9px; font-weight: 700; cursor: pointer; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(6,24,41,.6); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.app-modal { width: min(560px, 100%); max-height: 90vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 25px 70px rgba(0,0,0,.2); }
.modal-header { display: flex; justify-content: space-between; gap: 20px; padding: 22px 24px 15px; border-bottom: 1px solid var(--line); } .modal-header h2 { margin: 0; font-size: 18px; } .modal-header p { margin: 5px 0 0; color: var(--muted); font-size: 10px; } .modal-close { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.app-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 22px 24px 24px; } .form-field { display: grid; gap: 6px; } .form-field.full { grid-column: 1 / -1; } .form-field label { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; } .form-field input, .form-field select, .form-field textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--text); background: var(--bg); font-size: 11px; } .form-field textarea { min-height: 82px; resize: vertical; } .form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,65,206,.1); } .form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }
.form-field-highlight { margin: -5px; padding: 5px; border-radius: 9px; background: #fff0df; box-shadow: 0 0 0 2px #e99a4c; } .form-field-highlight label { color: #b65f17; }
.toast-stack { position: fixed; z-index: 120; top: 88px; right: 20px; display: grid; gap: 8px; } .toast { min-width: 260px; padding: 13px 15px; border: 1px solid var(--line); border-left: 4px solid #20aa77; border-radius: 10px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); animation: toast-in .25s ease; } .toast b, .toast small { display: block; } .toast b { font-size: 10px; } .toast small { margin-top: 3px; color: var(--muted); font-size: 8px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } }

@media (max-width: 1100px) { .modules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filters { max-width: 380px; overflow-x: auto; } .hero { gap: 15px; } .hero h1 { font-size: 45px; } .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) { :root { --sidebar: 0px; } .sidebar { display: none; } .hero { grid-template-columns: 1fr; padding-top: 50px; } .hero-visual { display: none; } .overview { grid-template-columns: repeat(2, 1fr); } .toolbar { align-items: stretch; flex-direction: column; } .filters { max-width: 100%; } .system-status { display: none; } .workspace-grid, .workspace-grid.equal { grid-template-columns: 1fr; } .workspace-header { align-items: flex-start; flex-direction: column; } .workspace-actions { width: 100%; } .workspace-actions .action-button { flex: 1; } .company-list-card { grid-template-columns: auto 1fr auto; } .company-list-stats { display: none; } .company-list-status { display: none; } .company-quick-data { grid-template-columns: 1fr 1fr; } .center-info { grid-template-columns: 1fr 1fr; } .center-controls { grid-column: 1 / -1; } .setup-steps { grid-template-columns: repeat(2, 1fr); } .permission-user { grid-template-columns: auto 1fr auto auto; } .permission-role { grid-column: 2 / -1; } .permission-user .status-pill { display: none; } }
@media (max-width: 580px) { .topbar { padding: 0 18px; } .workspace-shortcut { display: none; } .hero { min-height: auto; padding: 45px 22px; } .hero h1 { font-size: 38px; letter-spacing: -1.5px; } .overview, .modules-grid, .kpi-grid { grid-template-columns: 1fr; } .explorer-header, .toolbar, .results-count, .modules-grid { padding-left: 20px; padding-right: 20px; } .explorer-header { align-items: flex-start; } .view-switch { display: none; } .filters { padding-bottom: 5px; } .modules-grid.list-view .module-card { display: block; } .hero-actions { align-items: stretch; flex-direction: column; } .primary-button { justify-content: space-between; } footer { align-items: flex-start; flex-direction: column; } footer p { margin: 0; } .workspace { padding: 25px 16px 50px; } .app-form { grid-template-columns: 1fr; } .form-field.full { grid-column: auto; } .form-actions { grid-column: auto; } .data-table { min-width: 580px; } .panel { overflow-x: auto; } .company-profile { align-items: flex-start; flex-wrap: wrap; } .company-profile > .table-action { margin-left: 72px; } .company-detail-grid { grid-template-columns: 1fr; } .company-detail-grid .wide { grid-column: auto; } .company-list-card { gap: 11px; padding: 14px; } .company-list-meta { line-height: 1.4; } .company-quick-data { grid-template-columns: 1fr; } .company-compact-profile { align-items: flex-start; flex-wrap: wrap; } .center-info { grid-template-columns: 1fr; } .center-controls { grid-column: auto; } .area-row { grid-template-columns: 1fr auto auto; } .area-row .status-pill { display: none; } .setup-steps { grid-template-columns: 1fr 1fr; } .company-test-banner { align-items: flex-start; flex-wrap: wrap; } .company-test-banner .panel-link { margin-left: 39px; } .orange-review li { flex-wrap: wrap; } .orange-review li > button { margin-left: 86px; } .next-version-grid { grid-template-columns: 1fr; } .permission-user { grid-template-columns: auto 1fr auto; } .permission-role { grid-column: 2 / -1; } .permission-user .table-action { grid-column: 2; } .approval-row { align-items: flex-start; flex-wrap: wrap; } .approval-actions { width: 100%; margin-left: 0; } .permissions-heading { align-items: flex-start; } }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }

/* Workspace refinement */
.workspace { padding: 28px clamp(22px, 3vw, 48px) 60px; }
.workspace-header, .module-tabs, .workspace-body { width: min(100%, 1480px); margin-inline: auto; }
.workspace-header h1 { font-size: clamp(26px, 2.5vw, 38px); letter-spacing: -1.2px; }
.workspace-body { gap: 18px; }
.company-overview-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .85fr); gap: 16px; align-items: start; }
.company-overview-grid > * { min-width: 0; height: 100%; }
.setup-steps span { min-height: 46px; gap: 9px; padding: 10px 12px; border-radius: 10px; }
.setup-steps i { width: 23px; height: 23px; font-size: 9px; }
.setup-steps b { font-size: 9px; line-height: 1.25; }
.company-quick-data { gap: 18px; }
.company-quick-data span small { font-size: 8px; }
.company-quick-data span b { overflow-wrap: anywhere; font-size: 10px; line-height: 1.4; }
.orange-review summary b { font-size: 11px; }
.orange-review summary small { margin-top: 3px; font-size: 9px; line-height: 1.4; }
.orange-review summary strong { font-size: 9px; }
.orange-review li b { font-size: 10px; }
.orange-review li small { font-size: 9px; line-height: 1.5; }
.orange-review li > button { min-height: 32px; padding: 6px 10px; border-radius: 7px; font-size: 8px; }
.permissions-content { padding: 18px 20px 21px; }
.permissions-heading { margin-bottom: 9px; }
.permissions-heading b { font-size: 11px; }
.permissions-heading small { margin-top: 3px; font-size: 9px; }
.permission-user { grid-template-columns: auto minmax(170px, .85fr) minmax(230px, 1.2fr) auto auto auto; gap: 12px; padding: 12px 4px; }
.permission-avatar { width: 34px; height: 34px; font-size: 10px; }
.permission-user b { font-size: 10px; }
.permission-user small { margin-top: 3px; font-size: 8px; line-height: 1.4; }
.center-content { padding: 18px 20px 20px; }
.center-info { grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto; gap: 22px; }
.center-info span small { margin-bottom: 5px; font-size: 8px; }
.center-info span b { overflow-wrap: anywhere; font-size: 10px; line-height: 1.4; }
.center-controls { flex-wrap: wrap; gap: 7px; }
.app-modal { width: min(760px, 100%); max-height: min(92vh, 900px); display: flex; flex-direction: column; overflow: hidden; }
.modal-header { position: sticky; top: 0; z-index: 2; padding: 20px 24px 16px; background: var(--surface); }
.modal-header h2 { font-size: 19px; }
.modal-header p { max-width: 580px; font-size: 11px; line-height: 1.45; }
.modal-close { width: 34px; height: 34px; flex: 0 0 auto; }
.app-form { gap: 16px 18px; padding: 22px 24px 0; overflow-y: auto; }
.form-field { align-content: start; gap: 7px; }
.form-field input, .form-field select, .form-field textarea { min-height: 42px; padding: 10px 12px; border-radius: 9px; font-size: 12px; }
.form-field textarea { min-height: 92px; }
.form-actions { position: sticky; bottom: 0; margin: 4px -24px 0; padding: 14px 24px 18px; border-top: 1px solid var(--line); background: var(--surface); }

@media (max-width: 1180px) {
  .company-overview-grid { grid-template-columns: 1fr; }
  .permission-user { grid-template-columns: auto minmax(150px, .8fr) minmax(190px, 1fr) auto auto auto; }
}

@media (max-width: 580px) {
  .topbar-actions { gap: 7px; }
  .tenant-label, .user-session > span:last-child { display: none; }
  .tenant-switcher select { width: 116px; }
  .user-session { padding: 4px; }
  .workspace { padding: 22px 14px 44px; }
  .modal-backdrop { padding: 10px; }
  .app-modal { max-height: 94vh; border-radius: 14px; }
  .modal-header { padding: 17px 16px 14px; }
  .app-form { gap: 14px; padding: 18px 16px 0; }
  .form-actions { margin-right: -16px; margin-left: -16px; padding: 12px 16px 16px; }
  .form-actions .action-button { flex: 1; }
  .panel { padding: 17px; }
  .company-quick-data { gap: 12px; }
  .center-info { gap: 13px; }
  .setup-steps { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 3px; }
  .setup-steps span { min-width: 155px; scroll-snap-align: start; }
  .orange-review li > button { width: 100%; margin-left: 0; }
}

/* ═══════════════════════════════════════════
   PLATFORM POLISH & TEMPLATE FEATURE
═══════════════════════════════════════════ */

/* Module card: category-colored top accent */
.module-card { border-top: 2px solid var(--card-color, var(--line)); }

/* KPI card: premium gradient background */
.kpi-card { background: linear-gradient(145deg, var(--surface) 70%, var(--surface-soft)); }

/* Workspace header: bottom separator for clarity */
.workspace-header { padding-bottom: 22px; border-bottom: 1px solid var(--line); }

/* Table: subtle row hover */
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover td { background: var(--bg); }

/* Panel: subtle lift on hover for interactive panels */
.panel.hoverable { transition: transform .2s, box-shadow .2s; cursor: pointer; }
.panel.hoverable:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* Compliance ring KPI card */
.kpi-card.ring-card { display: flex; align-items: center; gap: 16px; }
.ring-wrap { position: relative; width: 58px; height: 58px; flex: 0 0 auto; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ring-label strong { font-size: 13px; font-weight: 700; letter-spacing: -.5px; }
.ring-card-info { min-width: 0; }

/* ─── Smart template banner ─── */
.template-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  background: linear-gradient(130deg, color-mix(in srgb, var(--primary-soft) 65%, var(--surface)), var(--surface));
}
.template-banner-icon {
  width: 46px; height: 46px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 13px; color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  font-size: 19px; font-weight: 700;
}
.template-banner-body { min-width: 0; flex: 1; }
.template-banner-body strong { display: block; font-size: 13px; font-weight: 700; }
.template-banner-body p { margin: 3px 0 9px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.template-banner-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); font-size: 9px; font-weight: 600; color: var(--muted); }
.tpl-pill b { color: var(--primary); font-size: 11px; font-weight: 700; }
.template-banner-actions { display: flex; flex-direction: column; gap: 7px; flex: 0 0 auto; }

/* ─── Template preview modal content ─── */
.template-preview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.tpl-stat-card { padding: 14px 10px; border: 1px solid var(--line); border-radius: 11px; text-align: center; background: var(--bg); }
.tpl-stat-card strong { display: block; font-size: 28px; font-weight: 700; color: var(--primary); letter-spacing: -1.5px; line-height: 1; }
.tpl-stat-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.tpl-section { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.tpl-section + .tpl-section { margin-top: 8px; }
.tpl-section summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; list-style: none; cursor: pointer; font-size: 11px; font-weight: 700; }
.tpl-section summary::-webkit-details-marker { display: none; }
.tpl-section[open] summary { border-bottom: 1px solid var(--line); }
.section-count { margin-left: auto; padding: 2px 8px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 9px; font-weight: 700; }
.tpl-items { padding: 8px 14px 12px; display: grid; gap: 5px; }
.tpl-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 9px 11px; border-radius: 8px; background: var(--bg); font-size: 11px; }
.tpl-item-name { font-weight: 600; flex: 1; min-width: 0; }
.tpl-item-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.tpl-item-meta { color: var(--muted); font-size: 9px; flex: 0 0 auto; text-align: right; white-space: nowrap; }
.risk-badge { padding: 3px 8px; border-radius: 5px; font-size: 8px; font-weight: 700; white-space: nowrap; flex: 0 0 auto; }
.risk-badge.high { color: #c64250; background: #fde8eb; }
.risk-badge.medium { color: #bf6b29; background: #fff0e2; }
.risk-badge.low { color: #16865f; background: #e2f7ef; }
.tpl-scroll { padding: 20px 24px 4px; overflow-y: auto; flex: 1; }

@media (max-width: 700px) {
  .template-banner { flex-direction: column; align-items: flex-start; }
  .template-banner-actions { flex-direction: row; width: 100%; }
  .template-preview-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════
   EVIDENCE UPLOAD + PLAN DE ACCIÓN
═══════════════════════════════════════════ */
.evidence-upload-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.file-upload-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border: 1px dashed var(--primary); border-radius: 8px; color: var(--primary); font-size: 11px; font-weight: 600; cursor: pointer; background: var(--primary-soft); transition: background .15s; white-space: nowrap; }
.file-upload-btn:hover { background: var(--primary); color: #fff; }
.evidence-preview { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding: 8px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.evidence-remove { border: none; background: transparent; color: #c64250; font-size: 10px; font-weight: 700; cursor: pointer; padding: 2px 6px; border-radius: 5px; margin-left: auto; }
.evidence-remove:hover { background: #fde8eb; }
.evidence-exists { font-weight: 400; color: #074E48; font-size: 10px; }
.evidence-badge { font-size: 12px; margin-left: 4px; vertical-align: middle; }
.origin-tag { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--surface-soft); color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.text-bad { color: #c64250; }
.text-warn { color: #bf6b29; }

/* ═══════════════════════════════════════════
   VISUAL DEPTH — PANELS, CARDS, TABLES
═══════════════════════════════════════════ */

/* Workspace header: gradient accent line */
.workspace-header { position: relative; }
.workspace-header::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--primary), var(--accent), transparent); }

/* KPI cards: warm shadow + hover lift */
.kpi-card { transition: transform .18s, box-shadow .18s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,65,206,.10); }

/* Panel: colored left accent by first child category */
.panel { border-radius: 16px; overflow: hidden; }
.panel-header { padding: 18px 20px 14px; }
.panel-header h2 { font-size: 14px; font-weight: 700; }
.panel-header p { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Table: alternating rows for readability */
.data-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bg) 40%, var(--surface)); }
.data-table tbody tr:hover td { background: var(--primary-soft) !important; transition: background .1s; }
.data-table th { font-size: 9px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--bg); }

/* Module cards: top-color accent per category (applied via JS-set --card-color) */
.module-card[data-category="personas"] { --card-color: #074E48; }
.module-card[data-category="prevencion"] { --card-color: #0F41CE; }
.module-card[data-category="cumplimiento"] { --card-color: #F08A4B; }
.module-card[data-category="gestion"] { --card-color: #061829; }

/* Activity dots: color variety */
.activity-dot { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.activity-item:nth-child(1) .activity-dot { background: #e8eeff; color: #0F41CE; }
.activity-item:nth-child(2) .activity-dot { background: #e6f2f0; color: #074E48; }
.activity-item:nth-child(3) .activity-dot { background: #fdf0e6; color: #F08A4B; }
.activity-item:nth-child(4) .activity-dot { background: var(--surface-soft); color: var(--muted); }
.activity-item:nth-child(5) .activity-dot { background: #e8eeff; color: #0F41CE; }

/* Flow nodes: colored borders */
.ecosystem-flow { gap: 10px; flex-wrap: wrap; }
.flow-node { border: 1.5px solid var(--line); background: var(--surface); }
.flow-node:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* Status pills: more refined */
.status-pill { font-size: 10px; padding: 3px 9px; border-radius: 20px; font-weight: 700; letter-spacing: .2px; }
.status-pill.good { background: #e2f7ef; color: #16865f; }
.status-pill.bad { background: #fde8eb; color: #c64250; }
.status-pill.warn { background: #fff0e2; color: #bf6b29; }
.status-pill.info { background: var(--surface-soft); color: var(--muted); }

/* Action button: subtle refinement */
.table-action { font-size: 10px; padding: 4px 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; transition: all .12s; }
.table-action:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* Progress bar: smoother */
.progress-bar { height: 5px; border-radius: 10px; background: var(--line); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, #0F41CE, #5b82ef); border-radius: 10px; transition: width .4s ease; }

/* ═══════════════════════════════════════════
   MODULE STATUS BADGES
═══════════════════════════════════════════ */
.module-status-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 9px; font-weight: 700; letter-spacing: .3px; }
.module-status-badge.status-ready { background: #dbeeff; color: #0a5fd6; }
.module-status-badge.status-improved { background: #fdf0e6; color: #c06c28; }
.module-status-badge.status-pending { background: #fce8f4; color: #9c3f85; }

/* Module card: colored left accent strip per status */
.module-card.status-ready { border-left: 3px solid #0F41CE; }
.module-card.status-improved { border-left: 3px solid #F08A4B; }
.module-card.status-pending { border-left: 3px solid #e879c0; }

/* ═══════════════════════════════════════════
   TRAINING EDIT MODAL
═══════════════════════════════════════════ */
.training-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.training-edit-grid .form-field.full { grid-column: 1 / -1; }
.training-section-title { margin: 18px 0 8px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin-bottom: 4px; }
.check-item { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 8px; background: var(--bg); font-size: 11px; font-weight: 500; cursor: pointer; transition: background .1s; }
.check-item:hover { background: var(--primary-soft); }
.check-item input { accent-color: var(--primary); width: 14px; height: 14px; flex: 0 0 auto; }
.check-item small { color: var(--muted); font-size: 9px; margin-left: 2px; }
.check-disabled { opacity: .5; pointer-events: none; }

/* ═══════════════════════════════════════════
   PORTAL DE EMPRESA
═══════════════════════════════════════════ */
.portal-button { height: 38px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 11px; font-weight: 600; cursor: pointer; transition: all .15s; }
.portal-button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.portal-backdrop { align-items: flex-start; padding: 20px; overflow-y: auto; }
.portal-modal { background: var(--bg); border-radius: 20px; width: 100%; max-width: 860px; margin: 0 auto; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.18); }
.portal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.portal-brand { display: flex; align-items: center; gap: 10px; }
.portal-brand strong { font-size: 15px; font-weight: 700; display: block; }
.portal-brand small { font-size: 10px; color: var(--muted); display: block; }
.portal-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; }

.portal-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin-bottom: 10px; }

/* Top row: profile + company + permissions */
.top-row { display: grid; grid-template-columns: auto auto 1fr; gap: 14px; align-items: start; }
.portal-row { display: contents; }
.portal-profile-card, .portal-company-card { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); min-width: 200px; }
.portal-profile-card strong, .portal-company-card strong { display: block; font-size: 13px; font-weight: 700; }
.portal-profile-card small, .portal-company-card small { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.portal-avatar { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(145deg, var(--primary), var(--accent)); color: #fff; font-size: 18px; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto; }
.portal-company-avatar { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(145deg, var(--accent), #0a7a70); color: #fff; font-size: 18px; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto; }
.portal-role-card { padding: 14px 16px; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); }
.portal-role-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.portal-perms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.portal-perms li { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.portal-perms li span { width: 16px; height: 16px; border-radius: 5px; display: grid; place-items: center; font-size: 9px; font-weight: 900; flex: 0 0 auto; }
.perm-yes span { background: #e2f7ef; color: #16865f; }
.perm-cond span { background: #fdf0e6; color: #c06c28; }

/* Role switcher */
.portal-role-switcher { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.portal-role-btn { padding: 10px 14px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; transition: all .15s; }
.portal-role-btn strong { display: block; font-size: 11px; font-weight: 700; }
.portal-role-btn small { display: block; font-size: 9px; color: var(--muted); margin-top: 2px; max-width: 130px; }
.portal-role-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.portal-role-btn.active { border-color: var(--primary); background: var(--primary-soft); }
.portal-role-btn.active strong { color: var(--primary); }
.portal-sim-card { padding: 14px 16px; background: var(--surface); border-radius: 12px; border: 1.5px solid var(--primary); }
.portal-sim-card strong { font-size: 13px; font-weight: 700; }
.portal-sim-card p { font-size: 11px; color: var(--muted); margin: 4px 0 10px; }
.portal-sim-result { margin-top: -6px; }

/* Module grid in portal */
.portal-modules-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.portal-cat-card { background: var(--surface); border-radius: 14px; padding: 14px 16px; border: 1px solid var(--line); }
.portal-cat-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.portal-cat-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: 0 0 auto; }
.portal-cat-header strong { display: block; font-size: 12px; font-weight: 700; }
.portal-cat-header small { display: block; font-size: 9px; color: var(--muted); }
.portal-cat-modules { display: flex; flex-wrap: wrap; gap: 5px; }
.portal-module-chip { padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: 600; border: 1.5px solid; cursor: pointer; transition: all .12s; background: transparent; }
.portal-module-chip.status-ready { border-color: #0F41CE; color: #0F41CE; }
.portal-module-chip.status-ready:hover { background: #0F41CE; color: #fff; }
.portal-module-chip.status-improved { border-color: #F08A4B; color: #c06c28; }
.portal-module-chip.status-improved:hover { background: #F08A4B; color: #fff; }
.portal-module-chip.status-pending { border-color: #e879c0; color: #9c3f85; opacity: .7; cursor: default; }

/* ── M11 Comité Paritario ── */
.comite-status-ok, .comite-status-warn { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-bottom: 4px; }
.comite-status-ok { background: #e6f2f0; border: 1.5px solid #b2d8d2; }
.comite-status-ok span { font-size: 18px; color: #074E48; flex: 0 0 auto; }
.comite-status-ok b { font-size: 12px; font-weight: 700; color: #074E48; display: block; }
.comite-status-warn { background: #fdf0e6; border: 1.5px solid #f5c89a; }
.comite-status-warn span { font-size: 18px; color: #F08A4B; flex: 0 0 auto; }
.comite-status-warn b { font-size: 12px; font-weight: 700; color: #c06c28; display: block; }
.comite-status-ok small, .comite-status-warn small { font-size: 10px; color: var(--muted); display: block; margin-top: 2px; }
.programa-annual-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.month-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 8px; border: 1.5px solid; text-align: center; }

/* ── M9 Normativa ── */
.norma-bib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.norma-bib-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1.5px dashed var(--line); cursor: pointer; transition: all .15s; }
.norma-bib-card b { font-size: 11px; font-weight: 700; line-height: 1.3; }
.norma-bib-card small { font-size: 9px; color: var(--muted); line-height: 1.4; }
.norma-bib-card:hover { border-color: var(--primary); background: var(--primary-soft); }
.req-list { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.req-row { display: grid; grid-template-columns: 70px 1fr 100px 120px; gap: 8px; align-items: start; padding: 10px 12px; background: var(--surface); border-radius: 10px; border: 1px solid var(--line); }
.req-article { font-size: 9px; font-weight: 700; color: var(--primary); padding-top: 3px; }
.req-text { font-size: 10px; font-weight: 600; line-height: 1.4; }
.req-text .tpl-item-sub { display: block; font-size: 9px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.req-status-sel { font-size: 9px; padding: 3px 6px; border-radius: 6px; border-width: 1px; border-style: solid; background: white; font-weight: 700; font-family: inherit; cursor: pointer; }

@media (max-width: 820px) {
  .top-row { grid-template-columns: 1fr; }
  .portal-modules-grid { grid-template-columns: 1fr; }
  .portal-button { display: none; }
  .req-row { grid-template-columns: 1fr; }
  .norma-bib-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1040px) { .account-type-badge { display: none; } }

/* M17-M21: reportes, configuración, mapa y gestión preventiva */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.settings-grid article { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.settings-grid small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .45px; }
.settings-grid b { font-size: 13px; }
.security-checklist { display: grid; gap: 8px; }
.security-checklist span { padding: 10px 12px; border-radius: 9px; font-size: 11px; font-weight: 650; }
.security-checklist .done { color: #12684f; background: #e5f6ef; }
.security-checklist .pending { color: #a25d24; background: #fff0e3; }

.risk-map-canvas { position: relative; min-height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg, rgba(15,65,206,.04), rgba(7,78,72,.08)); }
.risk-map-grid { position: absolute; inset: 0; opacity: .65; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 42px 42px; }
.risk-map-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.risk-marker { position: absolute; z-index: 2; width: 38px; height: 38px; transform: translate(-50%, -50%); border: 3px solid white; border-radius: 50%; color: white; box-shadow: 0 5px 16px rgba(20,30,50,.22); cursor: pointer; }
.risk-marker span { font-size: 11px; font-weight: 800; }
.risk-marker.high, .risk-legend i.high { background: #cf3e4b; }
.risk-marker.medium, .risk-legend i.medium { background: #ed8a2f; }
.risk-marker.low, .risk-legend i.low { background: #188b67; }
.risk-legend { display: grid; gap: 10px; }
.risk-legend span { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.risk-legend i { width: 12px; height: 12px; border-radius: 50%; }

.program-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.program-card { display: flex; flex-direction: column; gap: 9px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.program-card > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.program-card h3 { margin: 0; font-size: 13px; }
.program-card p { min-height: 34px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.program-card small { color: var(--muted); font-size: 9px; }
.program-card > b { font-size: 10px; }
.program-card .table-action { align-self: flex-start; }

/* ══════════════════════════════════════════════════════════
   LOGIN GATE
══════════════════════════════════════════════════════════ */
.login-gate { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: var(--bg); overflow-y: auto; padding: 24px 16px; }
.login-gate[hidden] { display: none; }
.login-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 36px 32px; box-shadow: 0 24px 64px rgba(6,24,41,.13); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand strong { font: 700 20px/1 Montserrat, sans-serif; color: var(--text); }
.login-brand small { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.login-title { font-size: 22px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.4px; }
.login-subtitle { font-size: 12px; color: var(--muted); margin: 0 0 22px; line-height: 1.55; }

/* Demo profile selector */
.login-demo-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 10px; }
.login-profiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.login-profile-btn { display: flex; align-items: center; gap: 10px; padding: 12px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; transition: all .15s; }
.login-profile-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.login-profile-btn span { font-size: 20px; flex: 0 0 auto; }
.login-profile-btn b { display: block; font-size: 10px; font-weight: 700; }
.login-profile-btn small { display: block; font-size: 9px; color: var(--muted); margin-top: 1px; line-height: 1.3; }
.login-profile-btn[data-profile="platform"] { border-color: #074E48; background: #e6f2f0; }
.login-profile-btn[data-profile="platform"]:hover { background: #c9e8e4; }

/* Divider */
.login-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font-size: 10px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Login form */
.login-form .form-field { margin-bottom: 12px; }
.login-form label { display: block; font-size: 10px; font-weight: 700; margin-bottom: 4px; }
.login-form input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 12px; font-family: inherit; background: var(--surface); color: var(--text); transition: border-color .15s; }
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,65,206,.1); }
.login-error { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: #fde8eb; color: #c64250; font-size: 11px; font-weight: 600; }
.login-submit { width: 100%; margin-top: 6px; padding: 11px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.login-activate { width: 100%; margin-top: 8px; padding: 10px; border-radius: 10px; font-size: 11px; font-weight: 600; background: transparent; border: 1.5px solid var(--line); color: var(--muted); cursor: pointer; }
.login-activate:hover { border-color: var(--primary); color: var(--primary); }
.login-form .login-link { text-align: center; margin-top: 12px; font-size: 11px; color: var(--muted); }
.login-form .login-link button { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 11px; font-weight: 600; padding: 0; }

/* Role badge in topbar */
.role-badge-chip { padding: 4px 9px; border-radius: 999px; font-size: 9px; font-weight: 700; white-space: nowrap; border: 1.5px solid; }
body[data-user-role="platform-admin"] .role-badge-chip { background: #e6f2f0; color: #074E48; border-color: #b2d8d2; }
body[data-user-role="administrador"] .role-badge-chip { background: #e8eeff; color: #0F41CE; border-color: #b0c2f5; }
body[data-user-role="editor"] .role-badge-chip { background: #fdf0e6; color: #c06c28; border-color: #f5c89a; }
body[data-user-role="aprobador"] .role-badge-chip { background: #fdf0e6; color: #c06c28; border-color: #f5c89a; }
body[data-user-role="viewer"] .role-badge-chip, body[data-user-role="solo-lectura"] .role-badge-chip { background: var(--surface-soft); color: var(--muted); border-color: var(--line); }
body[data-user-role="trabajador"] .role-badge-chip { background: #e6f2f0; color: #074E48; border-color: #b2d8d2; }

/* ══════════════════════════════════════════════════════════
   WORKER PORTAL — Mi espacio
══════════════════════════════════════════════════════════ */
.worker-profile-card { display: flex; align-items: center; gap: 18px; padding: 20px 22px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; margin-bottom: 20px; }
.worker-profile-avatar { width: 60px; height: 60px; border-radius: 16px; background: linear-gradient(135deg, #074E48, #0F41CE); color: #fff; font-size: 24px; font-weight: 800; display: grid; place-items: center; flex: 0 0 auto; }
.worker-profile-info { flex: 1; min-width: 0; }
.worker-profile-info h2 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.worker-profile-info p { margin: 2px 0; font-size: 11px; color: var(--muted); }
.worker-profile-company { text-align: right; }
.worker-profile-company b { display: block; font-size: 12px; }
.worker-profile-company small { color: var(--muted); font-size: 10px; }
.text-good { color: #074E48; font-weight: 700; }

/* ══════════════════════════════════════════════════════════
   PLATFORM ADMIN PANEL
══════════════════════════════════════════════════════════ */
.admin-companies-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.admin-company-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; transition: box-shadow .15s; }
.admin-company-card:hover { box-shadow: 0 8px 24px rgba(6,24,41,.08); }
.admin-company-header { display: flex; align-items: flex-start; gap: 12px; }
.admin-company-avatar { width: 42px; height: 42px; border-radius: 10px; background: linear-gradient(135deg, #0F41CE, #074E48); color: #fff; font-size: 16px; font-weight: 800; display: grid; place-items: center; flex: 0 0 auto; }
.admin-company-header strong { display: block; font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.admin-company-header small { font-size: 9px; color: var(--muted); line-height: 1.4; }
.admin-company-header .status-pill { margin-left: auto; flex: 0 0 auto; }
.admin-company-stats { display: flex; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.admin-company-stats span { display: flex; flex-direction: column; align-items: center; gap: 1px; flex: 1; }
.admin-company-stats b { font-size: 18px; font-weight: 800; color: var(--primary); }
.admin-company-stats small { font-size: 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.admin-company-last { font-size: 9px; color: var(--muted); }
.admin-company-actions { display: flex; gap: 6px; margin-top: auto; }

/* Invite user panel */
.invite-info-box { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--primary-soft); font-size: 10px; color: var(--primary); line-height: 1.5; }

/* ── Empty state card (M13, M14 panels sin datos) ── */
.empty-state-card { padding: 24px 20px; text-align: center; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--surface); }
.empty-state-card b { display: block; font-size: 13px; margin-bottom: 8px; }
.empty-state-card p { font-size: 11px; color: var(--muted); margin: 0 0 14px; line-height: 1.6; }

/* ── Training edit modal (used by M11 acta, M13 karin, M14 simulacro result) ── */
.training-edit-modal { max-width: 600px; }
.training-edit-modal .modal-header { padding: 20px 24px 14px; }

@media (max-width: 620px) {
  .settings-grid, .program-grid { grid-template-columns: 1fr; }
  .risk-map-canvas { min-height: 280px; }
}

/* ══════════════════════════════════════════════════════════
   PHASE 1 — ANIMATION & INTERACTION REDESIGN
══════════════════════════════════════════════════════════ */

/* ── Keyframes ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(7, 78, 72, .35); }
  50%       { box-shadow: 0 0 0 6px rgba(7, 78, 72, 0); }
}
@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 54, 54, .4); }
  50%       { box-shadow: 0 0 0 6px rgba(200, 54, 54, 0); }
}
@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes progressFill {
  from { width: 0; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Workspace entry stagger ── */
.kpi-grid .kpi-card {
  animation: fadeInUp .38s cubic-bezier(.22,.68,0,1.2) both;
}
.kpi-grid .kpi-card:nth-child(1) { animation-delay: .04s; }
.kpi-grid .kpi-card:nth-child(2) { animation-delay: .10s; }
.kpi-grid .kpi-card:nth-child(3) { animation-delay: .16s; }
.kpi-grid .kpi-card:nth-child(4) { animation-delay: .22s; }

.workspace-grid > .panel {
  animation: fadeInUp .42s cubic-bezier(.22,.68,0,1.2) both;
}
.workspace-grid > .panel:nth-child(1) { animation-delay: .18s; }
.workspace-grid > .panel:nth-child(2) { animation-delay: .26s; }
.workspace-grid > .panel:nth-child(3) { animation-delay: .34s; }

/* ── Enhanced KPI card ── */
.kpi-card {
  transition: transform .18s ease, box-shadow .18s ease;
  will-change: transform;
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(6, 24, 41, .1);
}
.kpi-card .kpi-value {
  transition: color .2s;
}

/* ── Skeleton loaders ── */
.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 60%, var(--surface)) 50%, var(--line) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
.skeleton-row { height: 14px; border-radius: 5px; margin-bottom: 8px; }
.skeleton-row.wide  { width: 80%; }
.skeleton-row.mid   { width: 55%; }
.skeleton-row.short { width: 35%; }
.skeleton-block { height: 80px; border-radius: 10px; margin-bottom: 12px; }

/* ── Progress bar fill animation ── */
.progress-bar-fill {
  animation: progressFill .6s cubic-bezier(.4,0,.2,1) both;
}
.progress-row .progress-bar-fill {
  animation-delay: .1s;
}

/* ── Custom scrollbar ── */
:root { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Status dots pulse ── */
.status-dot-active {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulseRing 2.4s ease infinite;
}
.status-dot-alert {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulseRed 2s ease infinite;
}
.status-dot-idle {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

/* ── Panel entrance animation ── */
.panel {
  transition: box-shadow .2s ease, transform .2s ease;
}
.panel:hover {
  box-shadow: 0 6px 24px rgba(6,24,41,.07);
}

/* ── Table row interactions ── */
.data-table tbody tr {
  transition: background .12s ease;
}
.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--primary-soft) 60%, transparent);
}

/* ── Module catalog card hover ── */
.module-card {
  transition: transform .2s cubic-bezier(.22,.68,0,1.2), box-shadow .2s ease, border-color .2s ease;
}
.module-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 36px rgba(6,24,41,.11);
  border-color: var(--primary);
}
.catalog-open-button {
  transition: background .15s, color .15s, transform .15s;
}
.catalog-open-button:hover {
  transform: translateX(3px);
}

/* ── Action buttons micro-interactions ── */
.btn, .action-btn, .primary-btn, .ghost-btn {
  transition: transform .12s ease, box-shadow .12s ease, background .15s, color .15s, border-color .15s;
}
.btn:active, .action-btn:active, .primary-btn:active {
  transform: scale(.97);
}
.primary-btn:hover {
  box-shadow: 0 4px 14px rgba(7, 78, 72, .3);
}

/* ── Flow node hover ── */
.flow-node {
  transition: transform .18s cubic-bezier(.22,.68,0,1.2), box-shadow .18s ease, border-color .18s ease, background .18s;
}
.flow-node:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 24px rgba(6,24,41,.12);
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ── Admin company card hover ── */
.admin-company-card {
  transition: transform .18s cubic-bezier(.22,.68,0,1.2), box-shadow .18s ease;
}
.admin-company-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(6,24,41,.1);
}

/* ── Toast animation ── */
#toast-container .toast {
  animation: toastIn .25s cubic-bezier(.22,.68,0,1.2) both;
}

/* ── Modal entrance ── */
.modal-box {
  animation: fadeInScale .22s cubic-bezier(.22,.68,0,1.2) both;
}

/* ── Login gate / session panel entrance ── */
.login-gate, .session-panel {
  animation: fadeInScale .28s cubic-bezier(.22,.68,0,1.2) both;
}

/* ── Enhanced form focus states ── */
.form-input:focus, .form-select:focus, .form-textarea:focus,
input[type="text"]:focus, input[type="email"]:focus,
input[type="password"]:focus, input[type="date"]:focus,
input[type="number"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(7, 78, 72, .15);
  transition: border-color .15s, box-shadow .15s;
}

/* ── Sidebar nav item hover ── */
nav .nav-item, .sidebar-nav a {
  transition: background .12s ease, color .12s ease, padding-left .12s ease;
}
nav .nav-item:hover, .sidebar-nav a:hover {
  background: var(--primary-soft);
}

/* ── Spinner utility ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ── Risk level badge pulse for Alta ── */
.risk-alta, .severity-alta, [data-severity="Alta"] .severity-badge {
  animation: pulseRed 3s ease infinite;
}

/* ── Alert row severity indicator ── */
.alert-row-alta td:first-child {
  border-left: 3px solid #ef4444;
}
.alert-row-media td:first-child {
  border-left: 3px solid #f59e0b;
}

/* ── Slide-in for side panels ── */
.side-panel {
  animation: slideInRight .28s cubic-bezier(.22,.68,0,1.2) both;
}

/* ── Dark mode refinements ── */
@media (prefers-color-scheme: dark) {
  .kpi-card:hover { box-shadow: 0 10px 32px rgba(0,0,0,.28); }
  .panel:hover    { box-shadow: 0 6px 24px rgba(0,0,0,.22); }
  .module-card:hover { box-shadow: 0 12px 36px rgba(0,0,0,.3); }
  .admin-company-card:hover { box-shadow: 0 10px 32px rgba(0,0,0,.28); }
  .flow-node:hover { box-shadow: 0 8px 24px rgba(0,0,0,.28); }
  ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }
  ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }
}
[data-theme="dark"] .kpi-card:hover { box-shadow: 0 10px 32px rgba(0,0,0,.28); }
[data-theme="dark"] .panel:hover    { box-shadow: 0 6px 24px rgba(0,0,0,.22); }
[data-theme="dark"] .module-card:hover { box-shadow: 0 12px 36px rgba(0,0,0,.3); }
[data-theme="dark"] .flow-node:hover { box-shadow: 0 8px 24px rgba(0,0,0,.28); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* ── Compliance ring animation ── */
.compliance-ring-circle {
  transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1);
}

/* ── Activity list item entrance ── */
.activity-item {
  animation: fadeInUp .32s cubic-bezier(.22,.68,0,1.2) both;
}
.activity-item:nth-child(1) { animation-delay: .05s; }
.activity-item:nth-child(2) { animation-delay: .10s; }
.activity-item:nth-child(3) { animation-delay: .15s; }
.activity-item:nth-child(4) { animation-delay: .20s; }
.activity-item:nth-child(5) { animation-delay: .25s; }

/* ── Workspace nav pill active state enhancement ── */
.module-tab.active, .nav-tab.active {
  position: relative;
  transition: background .15s, color .15s;
}
.module-tab.active::after, .nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 50%;
  transform: translateX(-50%);
  width: 60%; height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* ── Responsive animation reduction ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
