:root {
  --ink: #102a36;
  --muted: #657983;
  --line: #dce7e9;
  --paper: #f5f8f7;
  --white: #fff;
  --petrol-950: #032f42;
  --petrol-900: #063f54;
  --petrol-800: #07546e;
  --cyan: #0795a5;
  --green: #59ba24;
  --green-dark: #34890e;
  --amber: #d88a0d;
  --red: #c73f4d;
  --shadow: 0 24px 70px rgba(4, 50, 64, .14);
  --radius-lg: 24px;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { min-width: 320px; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.login-page {
  min-height: 100vh;
  background: #edf4f3 url("/assets/identidad-focim.png") center / cover no-repeat;
}
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(420px, .7fr); }
.login-copy {
  padding: 46px clamp(34px, 6vw, 96px);
  display: flex;
  flex-direction: column;
  color: white;
  position: relative;
  isolation: isolate;
}
.login-copy::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(3, 47, 66, .94) 0%, rgba(3, 47, 66, .84) 42%, rgba(3, 47, 66, .13) 100%);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; width: fit-content; }
.brand--light { color: white; }
.brand span:last-child { display: grid; line-height: .88; letter-spacing: .04em; }
.brand small { font-size: 11px; font-weight: 600; letter-spacing: .2em; }
.brand strong { font-size: 25px; letter-spacing: -.02em; }
.brand-mark {
  width: 44px; height: 44px; border: 4px solid currentColor; border-top: 0; border-radius: 9px 9px 22px 22px;
  position: relative; display: grid; place-items: center; transform: translateY(2px);
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; width: 27px; height: 5px; background: currentColor; top: -5px; border-radius: 5px;
}
.brand-mark::before { left: -1px; transform: rotate(30deg); transform-origin: left; }
.brand-mark::after { right: -1px; transform: rotate(-30deg); transform-origin: right; }
.brand-mark i { width: 18px; height: 18px; border-radius: 50%; background: var(--green); box-shadow: inset 4px 4px 7px rgba(255,255,255,.5); }
.login-message { margin: auto 0; max-width: 640px; }
.eyebrow { margin: 0 0 10px; color: var(--green-dark); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.login-message .eyebrow { color: #a7e583; }
.login-message h1 { max-width: 610px; margin: 0 0 24px; font-size: clamp(44px, 5.5vw, 76px); line-height: .98; letter-spacing: -.055em; }
.login-message > p:last-child { max-width: 570px; font-size: 18px; line-height: 1.65; color: rgba(255,255,255,.8); }
.login-footnote { margin: 0; color: rgba(255,255,255,.64); font-size: 13px; }
.login-panel { display: grid; place-items: center; padding: 40px; background: rgba(246,250,249,.9); backdrop-filter: blur(20px); }
.login-card { width: min(100%, 440px); padding: 44px; border: 1px solid rgba(255,255,255,.9); border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); }
.login-card h2 { margin: 24px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 28px; color: var(--muted); line-height: 1.6; }
.mobile-brand { display: none; }
.status-dot { display: inline-flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 99px; background: #edf8ea; color: #317a17; font-size: 12px; font-weight: 700; }
.status-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(89,186,36,.13); }
.button {
  border: 0; border-radius: 11px; min-height: 42px; padding: 0 16px; cursor: pointer; display: inline-flex; justify-content: center; align-items: center; gap: 12px; text-decoration: none; font-weight: 750; transition: .2s ease;
}
.button:hover { transform: translateY(-1px); }
.button--primary { color: white; background: linear-gradient(135deg, var(--petrol-800), var(--cyan)); box-shadow: 0 10px 28px rgba(7,109,134,.22); }
.button--secondary { border: 1px solid var(--line); background: var(--white); color: var(--ink); }
.button--danger { background: #fff1f2; color: var(--red); }
.button--large { min-height: 56px; width: 100%; padding: 0 20px; }
.button--large b { margin-left: auto; font-size: 20px; }
.security-note { display: flex; gap: 12px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); }
.security-note > span { color: var(--green-dark); font-size: 19px; }
.security-note p { margin: 0; font-size: 12px; line-height: 1.6; }
.security-note strong { color: var(--ink); }
.alert { padding: 12px 14px; margin: -12px 0 18px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.alert--error { background: #fff0f1; border: 1px solid #f6cbd0; color: #9f2938; }
.content > .alert { margin: 18px 0; background: #eef6f5; border: 1px solid #cfe4e3; color: var(--petrol-800); }

.app-page { overflow: hidden; background: var(--paper); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
  height: 100vh; background: var(--petrol-950); color: white; padding: 24px 16px 16px; display: flex; flex-direction: column;
  overflow-y: auto; z-index: 20;
}
.sidebar-head { padding: 0 8px 25px; display: flex; justify-content: space-between; }
.sidebar .brand-mark { width: 36px; height: 36px; }
.sidebar .brand strong { font-size: 21px; }
.sidebar-close { display: none; color: white; }
.main-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-section { margin: 20px 11px 7px; color: #7ea3b0; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.nav-link {
  width: 100%; min-height: 42px; padding: 9px 11px; border: 0; border-radius: 10px; background: transparent; color: #bcd0d7;
  display: flex; align-items: center; gap: 11px; cursor: pointer; text-align: left; font-size: 13px; font-weight: 650;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: white; }
.nav-link.active { background: rgba(62, 183, 188, .17); color: white; box-shadow: inset 3px 0 var(--green); }
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.08); font-size: 11px; }
.sidebar-foot { margin-top: auto; padding-top: 25px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-version { display: block; margin: 0 11px 8px; color: #658c9a; font-size: 10px; }
.app-main { min-width: 0; height: 100vh; overflow-y: auto; }
.topbar {
  height: 84px; padding: 0 clamp(20px, 3.5vw, 52px); background: rgba(255,255,255,.91); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(16px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.breadcrumb { margin: 0 0 3px; font-size: 11px; color: var(--muted); }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-size: 22px; display: grid; place-items: center; }
.icon-button:hover { background: rgba(9,89,111,.08); }
.menu-button { display: none; }
.quick-button { border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 9px; height: 36px; padding: 0 9px; display: flex; align-items: center; gap: 18px; cursor: pointer; }
.quick-button kbd { border: 0; color: #8c999e; font-size: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, var(--petrol-800), var(--cyan)); color: white; font-weight: 800; }
.user-copy { display: grid; }
.user-copy strong { font-size: 12px; }
.user-copy small { max-width: 190px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 10px; }
.content { max-width: 1600px; margin: 0 auto; padding: 34px clamp(20px, 3.5vw, 52px) 70px; outline: none; }
.welcome { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 28px; }
.welcome h2 { margin: 0 0 8px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.045em; }
.welcome p { margin: 0; color: var(--muted); }
.date-chip { white-space: nowrap; color: var(--petrol-800); background: #e7f3f3; padding: 10px 14px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { min-height: 148px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: white; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 85px; height: 85px; right: -25px; bottom: -25px; border-radius: 50%; background: var(--accent, #e7f5f5); }
.role-card-action { position: absolute; right: 16px; bottom: 16px; z-index: 1; }
.metric-label { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--accent, #e7f5f5); color: var(--petrol-800); font-weight: 800; }
.metric-value { display: block; margin: 20px 0 4px; font-size: 32px; letter-spacing: -.05em; }
.metric-note { color: #87969c; font-size: 11px; }
.panel-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.65fr); gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: white; overflow: hidden; }
.panel-head { min-height: 66px; padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.activity-list { padding: 4px 20px; }
.activity-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid #edf1f1; }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--petrol-800); background: #eaf5f4; font-size: 11px; }
.activity-copy { min-width: 0; }
.activity-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.activity-copy small, .activity-time { color: var(--muted); font-size: 10px; }
.quick-grid { padding: 18px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-action { min-height: 90px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfc; cursor: pointer; text-align: left; }
.quick-action:hover { border-color: #aad1d1; background: #f1f8f7; }
.quick-action span { display: block; color: var(--green-dark); font-size: 20px; }
.quick-action strong { display: block; margin-top: 10px; font-size: 11px; }
.resource-toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 18px; }
.resource-intro h2 { margin: 0 0 5px; font-size: 24px; letter-spacing: -.04em; }
.resource-intro p { margin: 0; color: var(--muted); font-size: 12px; }
.toolbar-actions { display: flex; gap: 9px; }
.search-field { width: min(350px, 36vw); height: 42px; border: 1px solid var(--line); border-radius: 11px; background: white; padding: 0 14px; outline: 0; }
.search-field:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(7,149,165,.1); }
.table-panel { border: 1px solid var(--line); border-radius: var(--radius); background: white; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 13px 16px; border-bottom: 1px solid var(--line); background: #f8faf9; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.data-table td { max-width: 280px; padding: 14px 16px; border-bottom: 1px solid #edf1f1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdfc; }
.record-title { font-weight: 750; color: var(--ink); }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 99px; color: #326c20; background: #edf8e9; font-size: 10px; font-weight: 750; }
.badge--neutral { color: #536a73; background: #eef3f4; }
.row-actions { display: flex; gap: 5px; justify-content: end; }
.row-action { min-width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: white; color: inherit; cursor: pointer; font-size: 11px; display: grid; place-items: center; text-decoration: none; }
.row-action:hover { border-color: #9fc9cb; color: var(--petrol-800); }
.table-empty { padding: 65px 20px; text-align: center; color: var(--muted); }
.table-empty span { display: block; margin-bottom: 10px; font-size: 34px; color: #9fc5c5; }
.pagination { min-height: 58px; padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.pagination-buttons { display: flex; gap: 6px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; padding: 28px; background: rgba(2,31,42,.58); display: grid; place-items: center; backdrop-filter: blur(8px); }
.modal { width: min(720px, 100%); max-height: 90vh; overflow-y: auto; background: white; border-radius: 20px; box-shadow: var(--shadow); }
.modal-head { position: sticky; top: 0; z-index: 2; padding: 21px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); display: flex; justify-content: space-between; align-items: center; backdrop-filter: blur(10px); }
.modal-head h2 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.modal-body { padding: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.field { display: grid; gap: 7px; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: 11px; font-weight: 750; }
.field label em { color: var(--red); font-style: normal; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 43px; border: 1px solid var(--line); border-radius: 10px; background: #fcfdfd; padding: 9px 11px; outline: 0;
}
.field textarea { min-height: 100px; resize: vertical; }
.field-error { color: var(--red); font-size: 10px; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: end; gap: 9px; padding-top: 7px; }
.permission-groups { max-height: 330px; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.permission-groups fieldset { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 7px; }
.permission-groups legend { padding: 0 5px; color: var(--petrol-800); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.permission-groups label { color: var(--muted); font-size: 10px; }
.toast-region { position: fixed; z-index: 200; right: 22px; bottom: 22px; display: grid; gap: 9px; }
.toast { min-width: 280px; max-width: 420px; padding: 13px 15px; border-radius: 11px; color: white; background: var(--petrol-900); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease; }
.toast--error { background: #9f2938; }
.loading-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 15px; background: var(--petrol-950); color: white; }
.loader { width: 37px; height: 37px; border: 3px solid rgba(255,255,255,.22); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-screen p { color: #9fc0ca; font-size: 12px; }
.error-state { max-width: 560px; margin: 80px auto; padding: 35px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.portal-profile { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; padding: 25px; margin-bottom: 20px; color: white; border-radius: var(--radius); background: linear-gradient(120deg, var(--petrol-900), var(--petrol-800) 70%, var(--cyan)); }
.portal-profile .avatar { width: 62px; height: 62px; background: rgba(255,255,255,.15); font-size: 22px; }
.portal-profile h2 { margin: 0 0 5px; }
.portal-profile p { margin: 0; color: #bcd8df; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-copy { display: none; }
  .login-panel { min-height: 100vh; padding: 22px; background: linear-gradient(160deg, var(--petrol-950) 0 29%, #eef5f3 29%); }
  .mobile-brand { margin-bottom: 28px; display: flex; align-items: center; gap: 12px; color: var(--petrol-800); }
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-button { display: grid; }
  .topbar { padding: 0 18px; }
  .content { padding-inline: 18px; }
}
@media (max-width: 640px) {
  .login-card { padding: 30px 23px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 128px; padding: 17px; }
  .metric-value { font-size: 26px; }
  .user-copy, .quick-button { display: none; }
  .resource-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { flex-wrap: wrap; }
  .search-field { flex: 1; width: auto; min-width: 150px; }
  .form-grid { grid-template-columns: 1fr; }
  .field--wide, .form-actions { grid-column: auto; }
  .modal-backdrop { padding: 10px; }
  .welcome { align-items: start; flex-direction: column; }
  .date-chip { display: none; }
}
