/* GoCore shared HCM-style shell. Use real CSS dimensions at browser zoom 100%. */
@font-face {
  font-family: Inter; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}
:root {
  --bg: #f7f8fa; --panel: #fff; --text: #1e293b; --muted: #64748b;
  --brand: #635bff; --brand-2: #4f46e5;
  --sidebar: #2d2756; --sidebar-2: #1e1a3a;
  --topbar: #2d2756; --topbar-2: #2d2756; --topbar-3: #2d2756;
  --module-toolbar: #635bff; --module-toolbar-2: #4f46e5;
  --app-font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  --table-font-size: 13px; --table-header-font-size: 12px;
  --table-cell-padding-y: 7px; --table-cell-padding-x: 14px;
  --line: #eaecf0; --table-header-bg: #f4f3fb; --table-header-text: #3f3a6b;
  --sidebar-width: 260px; --topbar-height: 56px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--app-font-family); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
button, input, select, textarea { font-family: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
button, summary { touch-action: manipulation; }
.topbar { height: var(--topbar-height); display: flex; align-items: center; gap: 20px; padding: 0 20px 0 0; background: linear-gradient(90deg, var(--topbar), var(--topbar-2), var(--topbar-3)); color: #fff; position: relative; z-index: 100; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand { display: flex; align-items: center; align-self: stretch; width: var(--sidebar-width); flex-shrink: 0; padding: 0 16px; border-right: 1px solid rgba(255,255,255,.06); color: #fff; text-decoration: none; font-size: 16px; font-weight: 700; }
.topbar-spacer { flex: 1; }
.topbar .icon-button { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: transparent; color: #c3bfd9; padding: 0; flex-shrink: 0; }
.topbar .icon-button:hover { background: rgba(255,255,255,.07); color: #fff; }
.account-menu { position: relative; font-size: 13px; }
.account-menu summary { display: flex; align-items: center; gap: 9px; padding: 4px 12px 4px 4px; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; cursor: pointer; font-weight: 600; list-style: none; }
.account-menu summary::-webkit-details-marker, .nav-group summary::-webkit-details-marker { display: none; }
.account-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--topbar); }
.account-chevron { margin-left: 3px; }
.account-dropdown { position: absolute; top: calc(100% + 9px); right: 0; width: 200px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 12px 32px #15102b22; color: var(--text); }
.account-dropdown a, .account-dropdown button { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 7px; color: var(--text); background: transparent; text-decoration: none; font-size: 13px; font-weight: 500; }
.account-dropdown a:hover, .account-dropdown button:hover { background: #f5f3ff; color: var(--brand); }
.account-dropdown form { margin: 0; }
.app-shell { display: flex; height: calc(100dvh - var(--topbar-height)); min-height: 0; overflow: hidden; }
.sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2)); color: #aaa5c3; padding: 16px 10px; display: flex; flex-direction: column; overflow: hidden; }
.sidebar.collapsed { display: none; }
.sidebar nav { overflow: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: #59516f transparent; }
.nav-label { margin: 13px 11px 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #85809f; }
.nav-label:not(:first-child) { margin-top: 25px; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-group { margin: 7px 0; }
.nav-group summary { display: flex; align-items: center; gap: 11px; padding: 9px 11px; cursor: pointer; list-style: none; font-size: 15px; }
.nav-chevron { margin-left: auto; font-size: 12px; transition: transform .15s; }
.nav-group:not([open]) .nav-chevron { transform: rotate(180deg); }
.sidebar a { color: #b5b0ca; text-decoration: none; display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 8px 12px; border-radius: 6px; font-size: 14px; line-height: 22px; border-left: 2px solid transparent; }
.sidebar .nav-items a { padding-left: 40px; }
.sidebar a:hover, .nav-group summary:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar a[aria-current="page"] { color: #fff; background: rgba(99,91,255,.19); border-left-color: var(--brand); font-weight: 600; }
.sidebar-backdrop { display: none; }
.main-content { flex: 1; min-width: 0; padding: 12px 16px 22px; overflow: auto; display: flex; flex-direction: column; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 1000; padding: 10px 16px; background: #fff; color: var(--brand); border-radius: 8px; }
.skip-link:focus { top: 8px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
h1 { margin: 0; font-size: 28px; }
h2 { margin: 0 0 12px; font-size: 18px; }
p { color: var(--muted); }
.panel, .stat, .login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 8px 22px rgba(15, 23, 42, .06); }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 16px; }
.stat span { color: var(--muted); display: block; }
.stat strong { font-size: 34px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
label { display: grid; gap: 6px; font-weight: 650; color: #344054; margin-bottom: 12px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; font: inherit; }
textarea { resize: vertical; }
.btn, button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; padding: 9px 14px; font-weight: 750; text-decoration: none; cursor: pointer; }
.btn.primary, button.primary { color: white; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.btn.secondary { color: #17406d; background: #e8f1fb; }
.icon-button { background: rgba(255,255,255,.14); color: white; width: 36px; height: 36px; padding: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; white-space: nowrap; }
.data-table th { color: #475467; background: #f7f9fc; }
.toolbar, .compact-form { display: flex; gap: 10px; align-items: end; margin-bottom: 16px; flex-wrap: wrap; }
.compact-form input { min-width: 150px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding-top: 14px; }
.login-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #071a31, #1a8295); }
.login-card { width: min(420px, 92vw); }
.alert { color: #9f1239; background: #fff1f2; border: 1px solid #fecdd3; padding: 10px; border-radius: 6px; margin-bottom: 12px; }

/* ===== SELECTION BUTTONS (inside toolbar) ===== */
.sel-btn { border: none; border-radius: 7px; padding: 5px 13px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.sel-btn.view-btn   { background: #1565c0; color: white; }
.sel-btn.edit-btn   { background: #6a1b9a; color: white; }
.sel-btn.delete-btn { background: #c62828; color: white; }
.sel-btn:hover { opacity: .87; }
.sel-divider { width: 1px; height: 22px; background: #c9d6e8; margin: 0 2px; }
/* Selection info line below toolbar */
.sel-info-bar { display: none; padding: 4px 14px 4px; font-size: 12px; color: #344a63; background: #e8f0fb; border-bottom: 1px solid #c2d3ef; }
.sel-info-bar a { color: #1565c0; font-weight: 700; text-decoration: none; }
.sel-info-bar a:hover { text-decoration: underline; }

/* ── Toast notifications (bulk-action results) ─────────────────────────────── */
/* Viewport-anchored feedback uses the shared unscaled typography. */
.toast-host { position: fixed; bottom: 18px; right: 18px; z-index: 100000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { min-width: 180px; max-width: 320px; padding: 10px 14px; border-radius: 8px;
  background: #16324f; color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.22); opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Admin Studio (Phase 8) ────────────────────────────────────────────────── */
.studio-page { padding: 4px 2px 40px; }
.studio-head h1 { margin: 0; font-size: 20px; color: #0a2540; }
.studio-head .studio-sub { color: #607a96; font-size: 13px; margin-top: 2px; }
.studio-flash { margin: 12px 0 0; padding: 9px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.studio-flash.ok  { background: #e3f6ea; color: #0a6b34; border: 1px solid #b6e3c6; }
.studio-flash.err { background: #fdecea; color: #a93226; border: 1px solid #f3c3bd; }
.studio-tabs { display: flex; gap: 4px; margin: 16px 0 0; border-bottom: 1px solid #dbe5f0; }
.studio-tab { padding: 9px 16px; font-size: 13px; font-weight: 700; color: #5a7592;
  text-decoration: none; border-radius: 8px 8px 0 0; border: 1px solid transparent; border-bottom: none;
  position: relative; top: 1px; }
.studio-tab:hover { background: #f0f5fb; color: #134a86; }
.studio-tab.active { background: #fff; color: #0c447c; border-color: #dbe5f0; }
.studio-body { padding-top: 16px; }
.studio-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.studio-search input { min-width: 240px; padding: 7px 11px; border: 1px solid #cdd9e6; border-radius: 7px; font-size: 13px; }
.role-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.role-badge.primary   { background: #e6f1fb; color: #0c447c; }
.role-badge.protected { background: #efe7fb; color: #4b2e83; }
.role-also { color: #6a839c; font-size: 12px; margin-left: 6px; }
.link-btn { background: none; border: none; color: #1565c0; font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 2px 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #c0392b; }
.link-btn.disabled { color: #9fb0c2; cursor: not-allowed; }
.link-btn.disabled:hover { text-decoration: none; }
.studio-modal { width: min(560px, 94vw); }
.studio-modal .field-hint { color: #7c93a8; font-weight: 500; font-size: 11.5px; }
.role-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; margin-top: 6px; }
.role-check { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.studio-placeholder { padding: 28px; color: #5a7592; }
.studio-placeholder h2 { margin: 0 0 6px; color: #0a2540; }

.theme-form { display: grid; gap: 16px; }
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.theme-field {
  display: grid;
  gap: 6px;
  background: #fff;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #31506d;
}
.theme-field input,
.theme-field select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  background: #fff;
  color: #17324d;
  font: inherit;
  font-weight: 600;
  padding: 6px 9px;
}
.theme-color-row { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.theme-color-row input[type="color"] { padding: 3px; min-height: 34px; }
.theme-color-row code {
  padding: 8px 9px;
  border: 1px solid #dbe5f0;
  border-radius: 7px;
  background: #f6f9fc;
  color: #244765;
}
.theme-preview {
  overflow: hidden;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.theme-preview-top {
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--topbar), var(--topbar-2), var(--topbar-3));
  color: #fff;
  font-weight: 800;
}
.theme-preview-body { display: grid; grid-template-columns: 72px 1fr; min-height: 160px; }
.theme-preview-side { background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2)); }
.theme-preview-content { padding: 12px; min-width: 0; }
.theme-preview-toolbar {
  margin: 0 0 10px;
  padding: 8px 10px;
  justify-content: space-between;
}
.theme-preview-table { margin: 0; min-width: 0; }
.theme-actions {
  justify-content: flex-end;
  border: 0;
  padding: 0;
  background: transparent;
}

/* File & Document Engine */
.document-upload {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.document-upload label {
  display: grid;
  gap: 5px;
  color: #31506d;
  font-size: 12px;
  font-weight: 800;
}
.document-upload input {
  min-height: 34px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  padding: 6px 9px;
  font: inherit;
  color: #17324d;
}
.document-upload .span-2 { grid-column: span 2; }
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.inline-form { display: inline; margin: 0; }
.btn.danger { border-color: #f0c4bd; color: #b73525; background: #fff6f4; }
.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}
.check-row input { width: auto; }

/* Reminder / Notification Engine */
.reminder-create {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.reminder-create label {
  display: grid;
  gap: 5px;
  color: #31506d;
  font-size: 12px;
  font-weight: 800;
}
.reminder-create input,
.reminder-create select {
  min-height: 34px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  padding: 6px 9px;
  font: inherit;
  color: #17324d;
}
.reminder-create .span-2 { grid-column: span 2; }
.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
}
.priority-low { background: #eef7f0; color: #2f7d42; }
.priority-normal { background: #eef4fb; color: #245a8d; }
.priority-high { background: #fff4df; color: #9a6200; }
.priority-urgent { background: #ffe9e5; color: #b73525; }
.status-open { background: #eef4fb; color: #245a8d; }
.status-completed { background: #eef7f0; color: #2f7d42; }
.status-cancelled { background: #f3f5f8; color: #62758a; }

/* Workflow / Approval Engine */
.workflow-submit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.workflow-submit label {
  display: grid;
  gap: 5px;
  color: #31506d;
  font-size: 12px;
  font-weight: 800;
}
.workflow-submit input {
  min-height: 34px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  padding: 6px 9px;
  font: inherit;
  color: #17324d;
}
.workflow-submit .span-2 { grid-column: span 2; }
.workflow-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.workflow-summary div {
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.workflow-summary span {
  display: block;
  color: #6a839c;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}
.workflow-summary strong { color: #17324d; }
.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.workflow-actions form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.workflow-actions input {
  min-height: 34px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  padding: 6px 9px;
}
.status-approved { background: #eef7f0; color: #2f7d42; }
.status-rejected { background: #ffe9e5; color: #b73525; }
.status-pending { background: #fff4df; color: #9a6200; }

/* Report & Print Engine */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.report-card {
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.report-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #17324d;
}
.report-card p {
  min-height: 38px;
  color: #5a7592;
  margin: 0 0 10px;
}
.report-filters {
  display: grid;
  gap: 8px;
}
.report-filters input {
  min-height: 34px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  padding: 6px 9px;
}
.report-output { margin-top: 10px; }
.print-page {
  padding: 24px;
  background: #fff;
  color: #111;
}
.print-head {
  border-bottom: 1px solid #ccc;
  margin-bottom: 14px;
  padding-bottom: 10px;
}
@media print {
  body { background: #fff; zoom: 1; }
  .topbar, .sidebar, .toolbar-actions { display: none !important; }
  .app-shell { display: block; }
  .main-content { margin: 0; padding: 0; }
  .data-table th, .data-table td { border-color: #bbb; color: #111; }
}

/* Import / Export Engine */
.import-upload {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.import-upload label {
  display: grid;
  gap: 5px;
  color: #31506d;
  font-size: 12px;
  font-weight: 800;
}
.import-upload input,
.import-upload select {
  min-height: 34px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  padding: 6px 9px;
  font: inherit;
  color: #17324d;
}
.import-upload .span-2 { grid-column: span 2; }

/* API/App Platform */
.api-secret {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #b8dfc5;
  border-radius: 8px;
  background: #f0fbf4;
  color: #235f35;
}
.api-secret code {
  display: block;
  overflow-wrap: anywhere;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
  color: #17324d;
}
.api-token-create {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.api-token-create label {
  display: grid;
  gap: 5px;
  color: #31506d;
  font-size: 12px;
  font-weight: 800;
}
.api-token-create input {
  min-height: 34px;
  border: 1px solid #cdd9e6;
  border-radius: 7px;
  padding: 6px 9px;
  font: inherit;
  color: #17324d;
}

/* CRUD permissions matrix */
.perm-note { color: #5a7592; font-size: 12.5px; margin: 4px 0 10px; }
.perm-filters label { font-size: 12px; color: #44617c; display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
.perm-filters select { padding: 6px 9px; border: 1px solid #cdd9e6; border-radius: 7px; font-size: 13px; }
.perm-matrix th.ctr, .perm-matrix td.ctr { text-align: center; width: 66px; }
.perm-quick .link-btn { font-size: 11.5px; padding: 2px 5px; }
.switch { position: relative; display: inline-block; width: 38px; height: 20px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cdd6e0; border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: #1d9e75; }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: .55; cursor: default; }
/* Hide is restrictive — amber instead of green when on */
.switch input.perm-cb[data-field="hide"]:checked + .slider { background: #c0851b; }

/* Permission sub-tabs (CRUD | Features) */
.perm-subtabs { display: flex; gap: 4px; margin: 0 0 14px; }
.perm-subtab { padding: 6px 16px; font-size: 12.5px; font-weight: 700; color: #5a7592;
  text-decoration: none; border-radius: 7px; border: 1px solid #dbe5f0; }
.perm-subtab:hover { background: #f0f5fb; color: #134a86; }
.perm-subtab.active { background: #0c447c; color: #fff; border-color: #0c447c; }

/* Feature matrix — 14 columns, so compact switches + small headers */
.feat-matrix th.ctr { width: 42px; font-size: 10.5px; font-weight: 700; line-height: 1.15; padding: 6px 2px; white-space: normal; vertical-align: bottom; }
.feat-matrix td.ctr { width: 42px; padding: 6px 2px; }
.feat-matrix .switch { width: 30px; height: 16px; }
.feat-matrix .switch .slider::before { width: 12px; height: 12px; }
.feat-matrix .switch input:checked + .slider::before { transform: translateX(14px); }

/* Assign Roles tab — card per Admin user */
.assign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.assign-card { background: #fff; border: 1px solid #dbe5f0; border-radius: 10px; padding: 14px 16px; }
.assign-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #eef2f7; }
.assign-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e6f1fb; color: #0c447c; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; text-transform: uppercase; flex: 0 0 auto; }
.assign-email { color: #6a839c; font-size: 12px; }
.assign-roles { display: grid; gap: 7px; }

/* ===== MODULE PAGE ===== */
.module-page { background: #eef4fb; border-radius: 12px; overflow: hidden; border: 1px solid #c7d7e8; flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* TOOLBAR */
.module-toolbar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: linear-gradient(135deg, var(--module-toolbar), var(--module-toolbar-2)); color: white; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.tool-btn { border: 1px solid rgba(255,255,255,.22); background: #eef5fc; color: #073763; min-height: 32px; padding: 6px 11px; border-radius: 7px; font-size: 13px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; transition: background .12s; }
.module-toolbar .tool-btn { color: white; background: rgba(255,255,255,.13); box-shadow: inset 0 1px 0 rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); }
.module-toolbar .tool-btn:hover { background: rgba(255,255,255,.22); }
.tool-btn.primary, .module-toolbar .tool-btn.primary { background: linear-gradient(135deg, #155ea8, #0793bd); color: white; border-color: rgba(255,255,255,.28); }
.tool-btn.primary:hover { background: linear-gradient(135deg, #1068ba, #0fa0d0); }
.toolbar-search { min-width: 200px; max-width: 320px; flex: 1; display: flex; }
.toolbar-search input { height: 32px; color: white; background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.28); border-radius: 7px; }
.toolbar-search input::placeholder { color: rgba(255,255,255,.7); }
.module-title-pill { margin-left: auto; padding: 6px 16px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); font-weight: 900; font-size: 13px; }

/* TOOLS DROPDOWN */
.tool-dropdown { position: relative; }
/* Phase 8 reskin — popover card (item styles live near .tools-dd-item below) */
.tools-dd {
  display: none; position: absolute; top: 38px; right: 0; min-width: 188px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px; z-index: 20; transform-origin: top right;
}
.tool-dropdown.open .tools-dd { display: grid; animation: toolsDdIn .12s ease; }
@keyframes toolsDdIn {
  from { opacity: 0; transform: scale(.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* PANELS */
.module-panel { display: none; background: #f2f8ff; border-bottom: 1px solid #c7d7e8; padding: 12px 14px; }
.module-panel.open { display: block; }

/* ADVANCED SEARCH */
.adv-search-panel { padding: 14px; }
.adv-search-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; align-items: end; }
.adv-field { display: grid; gap: 4px; }
.adv-field label { font-size: 12px; font-weight: 700; color: #3d5470; margin-bottom: 0; }
.adv-field input, .adv-field select { height: 32px; font-size: 13px; padding: 6px 8px; }
.adv-actions { display: flex; gap: 6px; align-items: flex-end; padding-top: 16px; }

/* TABLE */
/* overflow: auto on the wrap makes it the scroll container for both axes.
   This is required so position:sticky on <th> works (top:0 = top of table-wrap).
   NOTE: overflow-x alone (even with overflow-y:visible) implicitly sets overflow-y:auto
   per CSS spec, which would still shift sticky top. Use full overflow:auto and give
   the wrap a max-height so the table scrolls inside it, header sticks at top:0. */
.module-table-wrap { overflow: auto; flex: 1 1 auto; min-height: 0; max-height: none; background: white; }
.module-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 2800px; }
/* top:0 — sticks at the top of .module-table-wrap (its scroll container) which starts
   right below the toolbar, so headers touch the toolbar with no gap. */
.module-table th { position: sticky; top: 0; z-index: 2; background: #dfe9f5; color: #1d344f; font-weight: 800; font-size: var(--table-header-font-size); text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid #b8ccdf; }
.module-table th, .module-table td { padding: var(--table-cell-padding-y) var(--table-cell-padding-x); border-right: 1px solid #d6e2f0; border-bottom: 1px solid #d6e2f0; text-align: left; white-space: nowrap; }
/* Only data rows get the larger font — headers, badges, and page text are unaffected */
.module-table tbody td { font-size: var(--table-font-size); }
.module-table th:last-child, .module-table td:last-child { border-right: 0; }
.module-table tbody tr:nth-child(even) { background: #f7fbff; }
.module-table tbody tr:hover { background: #e8f4ff; }
.module-table th.sortable { cursor: pointer; user-select: none; }
.module-table th.sortable:hover { background: #cddaec; }
.cb-col { width: 36px; text-align: center !important; }
.num-col { text-align: right !important; }
.actions-col { width: 80px; text-align: center !important; }

/* ROW ACTIONS */
.row-actions { position: relative; display: inline-flex; justify-content: center; }
.row-action-toggle { width: 28px; height: 28px; border: 1px solid #cfe0f2; border-radius: 7px; background: white; color: #0a416f; font-size: 16px; line-height: 1; padding: 0; }
.row-action-toggle:hover { background: #e8f2fc; }
/* position set to fixed via JS so it escapes overflow:auto clipping on table-wrap */
.row-action-menu { display: none; position: fixed; min-width: 140px; background: white; border: 1px solid #d5e1ee; border-radius: 10px; box-shadow: 0 18px 40px rgba(15,23,42,.18); padding: 6px; z-index: 9999; }
.row-actions.open .row-action-menu { display: grid; }
.row-action-menu a { color: #1d344f; text-decoration: none; padding: 8px 10px; border-radius: 7px; font-weight: 700; font-size: 13px; }
.row-action-menu a:hover { background: #eef5fc; }
.row-action-menu a.danger-action { color: #b91c1c; }
.row-action-menu a.danger-action:hover { background: #fff1f2; }

/* STATUS BADGES */
.status-badge { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; background: #e0e7ff; color: #3730a3; }
.status-badge.active   { background: #d1fae5; color: #065f46; }
.status-badge.inactive { background: #fee2e2; color: #991b1b; }
.status-badge.other    { background: #fef9c3; color: #854d0e; }
.empty-row { text-align: center !important; padding: 32px !important; color: var(--muted); font-size: 14px; }

/* AJAX TABLE LOADING STATE — applied by GT._fetchRows() while a /rows fetch is in-flight */
#genericTableWrap.table-loading {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* PAGINATION BAR */
.module-pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: #f0f6fe; border-top: 1px solid #c7d7e8; flex-wrap: wrap; flex-shrink: 0; }
.pager-info { font-size: 13px; color: #49627e; }
.pager-pages { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 6px; border: 1px solid #c8d9ec; background: white; color: #1d3a5c; font-size: 13px; font-weight: 700; text-decoration: none; transition: background .1s; }
.page-btn:hover { background: #e3effc; }
.page-btn.active { background: linear-gradient(135deg, #155ea8, #0793bd); color: white; border-color: #0b5ea8; }
.pager-size label { font-size: 13px; color: #49627e; font-weight: 600; display: flex; align-items: center; gap: 6px; margin: 0; }
.pager-size select { width: auto; height: 30px; padding: 4px 8px; font-size: 13px; border-radius: 6px; }

/* ===== MODAL ===== */
/* dialog must NOT have display:flex unconditionally — that overrides the UA display:none for closed dialogs.
   Use [open] selector so flex only applies when the browser opens the dialog via showModal(). */
.emp-modal { border: none; border-radius: 14px; padding: 0; width: min(860px, 96vw); max-height: 92vh; overflow: hidden; box-shadow: 0 32px 80px rgba(10,20,50,.28); }
.emp-modal[open] { display: flex; flex-direction: column; }
.emp-modal::backdrop { background: rgba(10,20,50,.55); backdrop-filter: blur(3px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 12px; background: linear-gradient(135deg, var(--module-toolbar), var(--module-toolbar-2)); color: white; flex-shrink: 0; cursor: grab; user-select: none; }
.modal-header:active { cursor: grabbing; }
.modal-header h2 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-close { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); color: white; width: 30px; height: 30px; border-radius: 7px; font-size: 15px; padding: 0; cursor: pointer; }
.modal-close:hover { background: rgba(255,255,255,.28); }
.modal-tabs { display: flex; gap: 2px; padding: 8px 14px 0; background: #0d2d4a; flex-shrink: 0; }
.tab-btn { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.15); border-bottom: none; border-radius: 8px 8px 0 0; padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .12s; }
.tab-btn:hover { background: rgba(255,255,255,.2); color: white; }
.tab-btn.active { background: #f2f8ff; color: #0d2d4a; border-color: #c7d7e8; }
.modal-body { flex: 1; overflow-y: auto; background: #f2f8ff; }
.tab-pane { display: none; padding: 16px 20px; }
.tab-pane.active { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.form-field { display: grid; gap: 4px; }
.form-field.span2 { grid-column: span 2; }
.form-field label { font-size: 12px; font-weight: 700; color: #3d5470; margin: 0; }
.form-field input, .form-field select, .form-field textarea { font-size: 13px; padding: 7px 9px; border: 1px solid #c8d9ec; border-radius: 6px; background: white; width: 100%; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.req { color: #dc2626; }
.modal-footer { display: flex; gap: 8px; align-items: center; padding: 12px 20px; background: white; border-top: 1px solid #d6e2f0; flex-shrink: 0; }

/* ===== BULK VIEW / PRINT PAGE ===== */
.view-table-wrap { max-height: none; overflow: auto; }
.view-table tfoot .totals-row { background: #dfe9f5; }
.totals-label { font-weight: 800; font-size: 12px; color: #1d344f; text-transform: uppercase; letter-spacing: .03em; }
.total-val { font-weight: 800; color: #0b3d91; }
@media print {
  body { zoom: 1 !important; }
  .sidebar, .topbar, .module-toolbar, .module-pager { display: none !important; }
  .main-content { padding: 0 !important; }
  .module-page { border: none !important; }
  .view-table-wrap { max-height: none !important; overflow: visible !important; }
}

/* ─── Generic Table Engine — Phase 5 ───────────────────────────── */

/* ── Sticky checkbox column — stays pinned to left while scrolling ── */
#genericTable th[data-field="_cb"],
#genericTable td[data-field="_cb"] {
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: 2px 0 4px rgba(15,30,60,.07);
}
/* Corner: sticky top + sticky left — needs the highest z-index */
#genericTable thead th[data-field="_cb"] {
  z-index: 6;
  background: #dfe9f5;
}
/* Filter row cb cell */
#genericTable .col-filter-row td[data-field="_cb"] {
  background: #f0f3f8;
}
/* Body rows — explicit backgrounds so the sticky cell is always opaque */
#genericTable tbody td[data-field="_cb"] {
  background: white;
}
#genericTable tbody tr:nth-child(even) td[data-field="_cb"] {
  background: #f7fbff;
}
#genericTable tbody tr:hover td[data-field="_cb"] {
  background: #e8f4ff;
}

/* ── Sticky actions column — stays pinned to right while scrolling ── */
#genericTable th[data-field="_actions"],
#genericTable td[data-field="_actions"] {
  position: sticky;
  right: 0;
  z-index: 3;
  box-shadow: -2px 0 4px rgba(15,30,60,.07);
}
/* Corner: sticky top + sticky right */
#genericTable thead th[data-field="_actions"] {
  z-index: 6;
  background: #dfe9f5;
}
/* When a row's action menu is open, lift that cell above all sibling stacking contexts */
#genericTable td[data-field="_actions"].menu-open {
  z-index: 10000;
}
/* Filter row actions cell */
#genericTable .col-filter-row td[data-field="_actions"] {
  background: #f0f3f8;
}
/* Body rows — explicit backgrounds */
#genericTable tbody td[data-field="_actions"] {
  background: white;
}
#genericTable tbody tr:nth-child(even) td[data-field="_actions"] {
  background: #f7fbff;
}
#genericTable tbody tr:hover td[data-field="_actions"] {
  background: #e8f4ff;
}

/* Override 2800px min-width for generic tables */
.generic-table { min-width: 0; }
.generic-table.table-layout-fixed { table-layout: fixed; }
/* Width is set by JS (_updateTableWidth) as the sum of all col widths,
   so the table grows to the right and the container scrolls. */

/* Default wrap mode — overrides .module-table td { white-space: nowrap } */
#genericTableWrap td { white-space: normal; word-break: break-word; }

/* No-wrap / ellipsis mode */
#genericTableWrap.table-nowrap td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Column resize handle (sits in the right edge of each sortable <th>) */
/* Adapted from POLITE stack col_resize.js / resize.css — zoom-aware version */
th[data-field] { position: relative; }
.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;        /* Fully inside own <th> — avoids being obscured by the next th */
  width: 7px;      /* Slightly wider for easier grab */
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
  z-index: 10;
  background: transparent;
  /* Hidden by default — only shown in resize mode */
  display: none;
  pointer-events: none;
  border-radius: 2px;
  transition: opacity 0.15s ease;
}

/* Resize mode: show handles as a visible blue bar */
.generic-table.resize-mode .col-resize-handle {
  display: block;
  pointer-events: auto;
  background: var(--brand, #0b63ce);
  opacity: 0.35;
}
.generic-table.resize-mode .col-resize-handle:hover,
.generic-table.resize-mode .col-resize-handle:active {
  opacity: 1;
  background: var(--brand, #0b63ce);
}

/* Lock cursor while dragging */
body.resizing-cols,
body.resizing-cols * { cursor: col-resize !important; user-select: none !important; }

/* Column filter row */
.col-filter-row td,
.col-filter-cell {
  padding: 2px 4px;
  background: #f0f3f8;
  position: relative; /* create stacking context */
  z-index: 3;         /* sit above sticky thead th (z-index:2) */
  vertical-align: middle;
}
.col-filter-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: 26px;
  padding: 2px 6px;
  font-size: 0.78rem;
  color: #1d3a5c;
  border: 1px solid #b0bfd4;
  border-radius: 3px;
  background: #fff;
}
.col-filter-input:focus { outline: 2px solid var(--brand); border-color: transparent; }

/* Numeric range filter: two compact inputs stacked (Min / Max) */
.col-filter-range { display: flex; flex-direction: column; gap: 2px; }
.col-filter-range .col-filter-input { height: 22px; font-size: 0.72rem; }

/* Manage columns panel */
.manage-cols-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 300;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(15,23,42,0.13);
  padding: 12px 14px;
  min-width: 180px;
}
.manage-cols-panel h4 { margin: 0 0 8px; font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.manage-cols-grid { display: flex; flex-direction: column; gap: 5px; }
.col-toggle-label { display: flex; align-items: center; gap: 7px; font-size: 0.83rem; cursor: pointer; }
.col-toggle-label input[type="checkbox"] { cursor: pointer; width: auto; }
.manage-cols-panel .panel-footer { margin-top: 10px; display: flex; gap: 6px; }
.manage-cols-panel .panel-footer .tool-btn { font-size: 0.78rem; padding: 5px 10px; }

/* Tools dropdown item style */
/* Phase 8 reskin — menu items: 36px rows, leading icon, hover, active "On" pill */
.tools-dd-sep { border: none; border-top: 1px solid #edf1f6; margin: 5px 4px; }
.tools-dd .tools-dd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 13px;
  width: 100%;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: #1d293b;
  text-decoration: none;
  text-align: left;
  background: none;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.tools-dd .tools-dd-item:hover { background: #eef4fb; color: var(--brand); }

/* Active toggle (No Wrap / Column Filter / Column Resize): small "On" pill at the right */
.tools-dd .tools-dd-item.tool-active { color: #0b4f8a; }
.tools-dd .tools-dd-item.tool-active::after {
  content: "On";
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  color: #0a7d3a;
  background: #d6f2e0;
  padding: 2px 7px;
  border-radius: 999px;
}

/* Destructive Reset Table View action */
.tools-dd .tools-dd-item.tools-dd-danger { color: #c0392b; }
.tools-dd .tools-dd-item.tools-dd-danger:hover { background: #fdecea; color: #a93226; }


/* Background Job Engine */
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-actions form { margin: 0; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn.danger { background: #c0392b; border-color: #c0392b; color: #fff; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 22px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin: 14px 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 14px 0; }
.panel h2 { margin: 0 0 10px; font-size: 17px; }
.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 700; }
.detail-list dd { margin: 0; }
.status-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #eef2f7; color: #344054; }
.job-status-running { background: #dbeafe; color: #1d4ed8; }
.job-status-succeeded { background: #dcfce7; color: #166534; }
.job-status-failed, .job-status-dead, .job-status-panic { background: #fee2e2; color: #991b1b; }
.job-status-queued, .job-status-scheduled, .job-status-retry_wait { background: #fef3c7; color: #92400e; }
.job-status-cancelled, .job-status-cancel_requested { background: #f3f4f6; color: #4b5563; }
.job-progress { min-width: 150px; }
.job-progress-text { font-size: 12px; color: #344054; margin-bottom: 5px; }
.job-progress-bar { height: 7px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.job-progress-bar span { display: block; width: 45%; height: 100%; background: var(--brand); border-radius: inherit; }
.alert.error { margin-top: 10px; padding: 10px 12px; border-radius: 7px; background: #fee2e2; color: #991b1b; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* Shared component finish: HCM typography, horizontal rules and generous controls. */
.module-page { background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 3px 9px #19203712; }
.module-toolbar { gap: 5px; padding: 10px 14px; min-height: 60px; flex-shrink: 0; background: linear-gradient(110deg, var(--module-toolbar), var(--module-toolbar-2)); }
.tool-btn { min-height: 34px; padding: 6px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; line-height: 20px; }
.module-toolbar .tool-btn.primary { background: rgba(255,255,255,.20); border-color: #ffffff55; }
.module-toolbar .tool-btn.primary:hover { background: rgba(255,255,255,.29); }
.toolbar-search { min-width: 180px; max-width: 240px; margin: 0; }
.toolbar-search input { height: 34px; font-size: 13px; padding: 6px 12px; }
.module-title-pill { font-size: 16px; font-weight: 600; padding: 7px 15px; line-height: 24px; }
.tools-dd { top: calc(100% + 6px); left: 0; right: auto; min-width: 210px; }
.module-toolbar .manage-cols-panel { top: 100%; left: 14px; max-height: min(65vh,580px); overflow: auto; min-width: 230px; }
.module-table-wrap { scrollbar-width: thin; scrollbar-color: #cfd4dc #fff; }
.module-table { font-size: var(--table-font-size); }
.module-table:not(.table-layout-fixed) { width: max-content; min-width: 100%; }
.module-table th { background: var(--table-header-bg); color: var(--table-header-text); font-weight: 600; font-size: var(--table-header-font-size); letter-spacing: .04em; line-height: 20px; }
.module-table th, .module-table td { border-right: 0; border-bottom: 1px solid var(--line); padding: var(--table-cell-padding-y) var(--table-cell-padding-x); }
.module-table tbody td { height: 49px; line-height: 20px; color: var(--text); }
.module-table tbody td strong { font-weight: 500; }
.module-table tbody tr:nth-child(even) { background: #fff; }
.module-table tbody tr:hover { background: #f5f3ff; }
.module-table th.sortable:hover { background: #ebe8fa; }
.module-table .cb-col { width: 36px; min-width: 36px; padding-left: 10px; padding-right: 10px; }
.module-table .actions-col { width: 80px; min-width: 80px; padding-left: 8px; padding-right: 8px; }
input[type="checkbox"] { width: 13px; height: 13px; padding: 0; accent-color: var(--brand); vertical-align: middle; flex: 0 0 auto; cursor: pointer; }
#genericTableWrap td { white-space: nowrap; word-break: normal; }
#genericTableWrap:not(.table-nowrap) .table-layout-fixed td { white-space: normal; word-break: break-word; }
#genericTable thead th[data-field="_cb"], #genericTable thead th[data-field="_actions"] { background: var(--table-header-bg); box-shadow: none; }
#genericTable tbody tr:nth-child(even) td[data-field="_cb"], #genericTable tbody tr:nth-child(even) td[data-field="_actions"] { background: #fff; }
#genericTable tbody tr:hover td[data-field="_cb"], #genericTable tbody tr:hover td[data-field="_actions"] { background: #f5f3ff; }
#genericTable td[data-field="_cb"], #genericTable td[data-field="_actions"] { box-shadow: none; }
.row-action-toggle { width: 34px; height: 34px; border: 1px solid #dfe3eb; border-radius: 10px; color: #3f3a6b; box-shadow: 0 3px 7px #1e293b0a; }
.row-action-toggle:hover { color: var(--brand); background: #f5f3ff; }
.row-action-menu a { font-weight: 500; }
#paginationBar { flex-shrink: 0; }
.module-pager { display: grid; grid-template-columns: 1fr auto 1fr; min-height: 70px; padding: 10px 16px; gap: 14px; background: #fff; border-top: 1px solid var(--line); }
.pager-info { color: var(--text); font-size: 13px; }
.pager-info strong { font-weight: 500; }
.pager-pages { justify-content: center; flex-wrap: nowrap; padding: 5px 10px; gap: 5px; border: 1px solid #e0e3eb; border-radius: 999px; background: #f8f9fb; }
.page-btn { min-width: 34px; height: 34px; padding: 0 8px; border: 0; border-radius: 12px; background: transparent; color: #536078; font-size: 13px; font-weight: 600; }
.page-btn:hover { background: #eeeafa; }
.page-btn.active { background: linear-gradient(135deg,var(--brand),var(--sidebar)); color: #fff; box-shadow: 0 4px 10px #635bff22; }
.pager-size { justify-self: end; }
.pager-size label { color: #475569; font-weight: 500; }
.pager-size select { min-width: 116px; height: 38px; border: 1px solid #dfe3eb; border-radius: 12px; background: #fff; padding: 7px 12px; font-size: 13px; color: var(--text); }
.module-panel, .modal-body { background: #f8f9fc; }
.modal-tabs { background: var(--sidebar); }
.tab-btn.active { background: #f8f9fc; color: var(--table-header-text); border-color: var(--line); }
.emp-modal { border: 1px solid var(--line); }
.form-field label, .adv-field label { font-size: 13px; font-weight: 500; color: #475569; }
.form-field input, .form-field select, .form-field textarea { font-size: 14px; min-height: 38px; border-color: #dfe3eb; border-radius: 8px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px #635bff18; }
.btn.primary, button.primary { background: linear-gradient(110deg,var(--brand),var(--brand-2)); }
.btn.secondary { color: #514a80; background: #efedf9; }
.panel, .stat { border-color: var(--line); border-radius: 12px; }
.data-table { font-size: var(--table-font-size); }
.data-table th { color: var(--table-header-text); background: var(--table-header-bg); font-size: var(--table-header-font-size); font-weight: 600; text-transform: uppercase; }
.data-table th, .data-table td { padding: 12px 14px; border-color: var(--line); }
.data-table tbody tr:hover { background: #f5f3ff; }
.studio-tab.active { color: var(--brand); border-color: var(--line); }
.studio-tabs { overflow-x: auto; flex-shrink: 0; }
.studio-tab { white-space: nowrap; }
.studio-body { min-width: 0; overflow-x: auto; }
.perm-subtab.active { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .slider { background: var(--brand); }
.login-body { min-height: 100dvh; background: linear-gradient(135deg,var(--sidebar),var(--brand-2)); }
.login-card { padding: 28px; border-radius: 16px; }
.login-card button { font-size: 14px; }
.sel-info-bar { background: #f1efff; color: #514a80; padding: 8px 14px; }
.sel-info-bar a { color: var(--brand); }
.col-filter-trigger { width: 20px; height: 20px; margin-left: 10px; padding: 3px; vertical-align: middle; border: 0; border-radius: 4px; color: #655e87; background: transparent; }
.col-filter-trigger:hover, .col-filter-trigger.active { color: var(--brand); background: #e7e3fa; }
.col-filter-trigger svg { width: 12px; height: 12px; }
.col-filter-input { font-size: 12px; height: 30px; border-color: #d8d5e5; border-radius: 5px; }
@media (max-width: 1100px) {
  .module-pager { grid-template-columns: 1fr auto; }
  .pager-pages { grid-column: 1 / -1; grid-row: 2; justify-self: center; max-width: 100%; flex-wrap: wrap; }
}
@media (max-width: 860px) {
  .topbar { padding-right: 12px; gap: 10px; }
  .brand { width: auto; flex: 1; border: 0; font-size: 15px; padding-left: 12px; }
  .topbar .icon-button { order: -1; margin-left: 10px; }
  .topbar-spacer { display: none; }
  .account-menu summary { padding-right: 8px; }
  .account-menu summary > span:nth-child(2) { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .sidebar, .sidebar.collapsed { display: none; position: fixed; inset: var(--topbar-height) auto 0 0; width: min(85vw,300px); min-width: 0; z-index: 95; box-shadow: 8px 0 24px #17112933; }
  .sidebar.mobile-open { display: flex; }
  .sidebar.mobile-open + .sidebar-backdrop { display: block; position: fixed; inset: var(--topbar-height) 0 0 0; border-radius: 0; z-index: 90; background: #17112966; }
  .main-content { padding: 10px 10px 14px; }
  .module-page { border-radius: 12px; }
  .module-toolbar { padding: 10px; gap: 6px; }
  .module-title-pill { margin-left: auto; font-size: 14px; padding: 5px 10px; }
  .toolbar-search { order: 9; min-width: 100%; max-width: none; }
  .toolbar-search input { height: 38px; font-size: 16px; }
  .tool-btn { min-height: 36px; }
  .module-pager { padding: 10px; gap: 10px; }
  .pager-pages { gap: 2px; padding: 4px; }
  .page-btn { min-width: 28px; height: 32px; padding: 0 5px; }
  .two-col, .stats-grid, .detail-grid { grid-template-columns: 1fr; }
  .adv-search-grid, .form-grid { grid-template-columns: 1fr 1fr; }
  .emp-modal[open] { width: 96vw; max-height: 94dvh; margin: auto; }
  .modal-tabs { overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
  .data-table { display: block; overflow-x: auto; }
}
@media (max-width: 480px) {
  .adv-search-grid, .form-grid { grid-template-columns: 1fr; }
  .form-field.span2 { grid-column: span 1; }
  .modal-header { padding: 12px; }
  .tab-pane { padding: 14px; }
  .modal-footer { padding: 12px; flex-wrap: wrap; }
  .module-title-pill { order: -1; width: 100%; text-align: center; margin: 0 0 3px; border: 0; background: transparent; padding: 0; }
  .account-menu summary > span:nth-child(2) { max-width: 80px; }
  .pager-size select { min-width: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .topbar, .sidebar, .sidebar-backdrop, .skip-link, .module-toolbar, .module-pager { display: none !important; }
  .app-shell { display: block; height: auto; overflow: visible; }
  .main-content, .module-page, .module-table-wrap { display: block; overflow: visible; height: auto; }
  .module-page { box-shadow: none; }
}

.views-star { color: #ffe066; font-size: 15px; }

/* Keep table headers pinned above the shared column-resize selector. */
.module-table thead th[data-field] { position: sticky; top: 0; }
.tool-btn.primary { background: linear-gradient(110deg,var(--brand),var(--brand-2)); }
.tool-btn.primary:hover { background: var(--brand-2); }
.form-field label, .adv-field label { display: block; }

/* Shared HCM administration layout. Uses the company Theme Engine palette. */
.studio-page{max-width:1368px;margin:12px auto 36px;padding:0;overflow:visible}
.studio-head{display:flex;align-items:center;justify-content:space-between;gap:16px;background:#fff;border:1px solid #ececf1;border-left:4px solid var(--brand);border-radius:13px;padding:18px 20px;box-shadow:0 2px 3px #17132d04}
.studio-head h1{display:flex;gap:12px;align-items:center;font-size:28px;line-height:1.3;font-weight:600;color:#202b3b}
.studio-title-icon{width:30px;height:30px;color:var(--brand);flex-shrink:0}
.studio-head .studio-sub{font-size:13px;margin:6px 0 0;color:#738099}
.studio-tabs{margin:12px 0 0;gap:0;border:0;background:var(--brand);border-radius:11px 11px 0 0;padding:0 8px;min-height:55px}
.studio-tab{display:flex;align-items:center;padding:16px 22px;color:#e6e3ff;border:0;border-radius:7px 7px 0 0;font-size:14px;font-weight:600;text-decoration:none;min-height:55px}
.studio-tab:hover{color:#fff;background:#ffffff17}
.studio-tab.active{color:#fff;background:#ffffff30;border:0;box-shadow:inset 0 -3px #fff}
.studio-body{padding:16px;background:#fff;border-radius:0 0 12px 12px;box-shadow:0 6px 13px #22223b0b;overflow:visible}
.studio-toolbar{margin:0 0 20px;min-height:40px;gap:12px}
.studio-toolbar h2{font-size:20px;font-weight:600;margin:0;color:#242c3b}
.studio-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;background:var(--brand);color:#fff;border:0;border-radius:9px;padding:10px 22px;font:600 14px var(--app-font-family);text-decoration:none;cursor:pointer}
.studio-button:hover{filter:brightness(1.05);color:#fff}
.studio-button.success{background:linear-gradient(110deg,#25ae44,#18c5a3);box-shadow:0 4px 10px #24b77830}
.studio-button.small{min-height:36px;font-size:13px;padding:8px 14px;border-radius:7px}
.studio-filterbar{display:flex;align-items:center;flex-wrap:wrap;gap:10px;background:#f7f8fa;border:1px solid #e0e2e7;border-radius:10px 10px 0 0;padding:14px 18px}
.studio-filterbar input,.studio-filterbar select,.studio-dashboard-form select{height:40px;padding:8px 12px;border:1px solid #dfe4ee;border-radius:9px;color:#455570;background:#fff;font:13px var(--app-font-family);max-width:100%}
.studio-filterbar input[name=q]{width:340px}
.studio-filterbar label{display:flex;align-items:center;gap:8px;margin:0;font-size:13px}
.studio-filterbar>.studio-count{margin-left:auto}
.studio-count,.studio-page .role-badge.primary{display:inline-block;background:#8958ff;color:#fff;font-size:12px;line-height:1.3;font-weight:600;padding:5px 12px;border-radius:20px;white-space:nowrap}
.studio-page .panel.table-wrap{padding:0;border:1px solid #e0e2e7;border-radius:10px;margin:0;overflow:auto;max-height:650px}
.studio-filterbar+.panel.table-wrap{border-top:0;border-radius:0 0 10px 10px}
.studio-page .data-table{width:100%;border-collapse:separate;border-spacing:0;font-size:14px;margin:0;table-layout:auto}
.studio-page .data-table th{position:sticky;top:0;z-index:1;background:var(--brand);color:#fff;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.015em;padding:17px 16px;border:0;white-space:nowrap}
.studio-page .data-table td{background:#fff;padding:16px;border:0;border-bottom:1px solid #ececf1;height:64px;vertical-align:middle;color:#142333}
.studio-page .data-table tr:last-child td{border-bottom:0}
.studio-page .data-table tr:hover td{background:#fbfaff}
.studio-page .data-table .studio-id{color:#8a5aff;font-weight:600}
.studio-page .data-table td strong{font-weight:600}
.studio-page .status-badge{font-size:12px;padding:3px 12px;border-radius:20px}
.studio-page .status-badge.active{background:#d3eedb;color:#095b39}
.studio-page .status-badge.inactive{background:#f8d4da;color:#8c182e}
.studio-page .role-badge.protected{background:#fff3cf;color:#91630b;border-radius:20px;font-size:12px;padding:4px 10px}
.studio-page .role-also{display:block;font-size:12px;margin-top:4px;color:#748197}
.studio-page .link-btn{display:inline-block;background:#eaf3ff;border:0;border-radius:6px;color:#276cac;font-size:12px;padding:7px 9px;text-decoration:none;cursor:pointer}
.studio-page .link-btn.danger{background:#ffecef;color:#c33348}
.studio-page .link-btn.disabled{opacity:.45;cursor:default}
.studio-page .actions-col{white-space:nowrap}
.studio-page .perm-subtabs{display:flex;flex-wrap:wrap;gap:6px;padding:6px;background:#f7f8fa;border-radius:8px;margin-bottom:18px}
.studio-page .perm-subtab{background:#fff;color:#56647c;border:1px solid #dedfe5;padding:12px 18px;font-size:13px;font-weight:500;border-radius:6px;text-decoration:none}
.studio-page .perm-subtab.active{background:linear-gradient(115deg,var(--brand),var(--sidebar));color:#fff;border-color:transparent}
.studio-page .perm-note{font-size:13px;line-height:1.6;color:#66748b;margin:0 0 16px}
.studio-page .perm-filters{justify-content:flex-start;background:#f7f8fa;padding:12px 16px;border:1px solid #e0e2e7;border-radius:9px;margin-bottom:0;flex-wrap:wrap}
.studio-page .perm-filters label{margin:0;font-size:13px}
.studio-page .perm-matrix .ctr{text-align:center;min-width:70px}
.studio-page .perm-matrix td{height:74px}
.studio-page .switch{width:36px;height:18px}
.studio-page .switch .slider::before{width:14px;height:14px}
.studio-page .switch input:checked+.slider{background:#25ae4c}
.studio-page .switch input:checked+.slider::before{transform:translateX(18px)}
.studio-page .switch input:focus-visible+.slider{outline:3px solid #6c64ff66;outline-offset:3px}
.studio-page .feat-matrix th{white-space:normal;min-width:90px}
.studio-page .feat-matrix .switch input:checked+.slider::before{transform:translateX(18px)}
.studio-page .studio-pagination{display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:13px;color:#718097;padding:16px 4px 0;flex-wrap:wrap}
.studio-path{display:block;font-size:11px;color:#7c8797;margin-top:6px;overflow-wrap:anywhere}
.studio-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:0 0 18px}
.studio-summary>div{background:linear-gradient(120deg,var(--brand),var(--sidebar));color:#fff;padding:16px;border-radius:8px}
.studio-summary strong{display:block;font-size:28px;font-weight:600;margin-bottom:6px}
.studio-summary span{font-size:12px}
.studio-access-table input[type=checkbox]{width:16px;height:16px;accent-color:var(--brand);cursor:pointer}
.studio-access-table input:disabled{cursor:default}
.studio-access-table th:first-child{min-width:260px}
.studio-access-table [hidden]{display:none!important}
.studio-dashboard-grid,.workspace-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px;margin-bottom:20px}
.studio-dashboard-card,.workspace-card{background:#fff;border:1px solid #e3e4ed;border-radius:12px;padding:24px}
.studio-dashboard-card h3{font-size:20px;margin:15px 0 8px}
.studio-dashboard-card p{color:#788296;font-size:14px;line-height:1.6}
.studio-dashboard-form{display:flex;justify-content:space-between;align-items:center;gap:16px}
.workspace-card{display:flex;align-items:center;gap:14px;color:#31354b;text-decoration:none;box-shadow:0 5px 14px #22223b08}
.workspace-card-icon{font-size:24px;color:var(--brand)}
.workspace-card>span:last-child{margin-left:auto}
.studio-modal{width:min(650px,94vw);border:1px solid #e3e4ec;border-radius:12px;padding:0}
.studio-modal .modal-header{background:var(--brand);color:#fff}
.studio-modal .modal-header h2{color:#fff}
.studio-modal .modal-close{color:#fff}
.studio-modal .form-field{font-size:13px;color:#43526a}
.studio-modal input:not([type=checkbox]),.studio-modal select{min-height:40px;border:1px solid #dce1ed;border-radius:8px;padding:9px 12px;font:14px var(--app-font-family)}
.studio-modal .role-checks{gap:10px}
.studio-page .assign-card{border:1px solid #e3e4ed;box-shadow:none;border-radius:10px}
@media(max-width:860px){.studio-page{margin:0 0 20px}.studio-head{padding:16px}.studio-head h1{font-size:23px}.studio-head>.studio-button{display:none}.studio-tabs{flex-wrap:nowrap}.studio-tab{padding:14px 18px}.studio-body{padding:12px}.studio-filterbar{padding:12px}.studio-filterbar input[name=q]{width:100%}.studio-summary{grid-template-columns:repeat(2,1fr)}.studio-summary strong{font-size:24px}.studio-toolbar h2{font-size:18px}.studio-button{padding:10px 14px}.studio-dashboard-form{min-width:320px}.studio-modal .form-grid{grid-template-columns:1fr!important}.studio-page .data-table td{padding:14px 12px}.studio-page .data-table th{padding:15px 12px}.studio-page .theme-grid{grid-template-columns:1fr 1fr}.studio-page .perm-quick{white-space:nowrap}}

.studio-page{width:100%}.studio-tabs{overflow-y:hidden}.studio-filterbar select{width:auto;min-width:125px}.studio-filterbar input:not([type=hidden]){width:auto}.studio-filterbar input[name=q]{width:340px}.studio-filterbar label input{max-width:260px}.studio-dashboard-form select{width:auto;min-width:220px}@media(max-width:860px){.studio-filterbar input[name=q]{width:100%}.studio-filterbar label{max-width:100%}.studio-filterbar label input{min-width:0;max-width:100%}}

/* Common-base pages use the shared form and table theme. */
.base-editor{margin:16px 0;border:1px solid var(--border,#ddd);border-radius:8px;padding:14px}.base-editor summary{cursor:pointer;font-weight:600}.document-upload label{min-width:0}.document-upload select,.document-upload textarea{width:100%}.base-editor .document-upload{margin-bottom:0}@media(max-width:720px){.document-upload{grid-template-columns:1fr!important}}

.module-toolbar a.btn{color:inherit;border:1px solid currentColor;border-radius:6px;padding:6px 10px}.pagination{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

.base-record-dialog{width:min(1100px,94vw);max-height:90vh;overflow:auto;border:1px solid #ddd;border-radius:14px;padding:20px;color:var(--text-color,#123);}.base-record-dialog::backdrop{background:#18123c66}.base-record-dialog .modal-header{display:flex;justify-content:space-between;align-items:center}.base-record-dialog .document-upload{margin:0}.row-action-menu .inline-form{display:block}
