/* ========================================================================
   GLEE IT PORTAL — UI FIXES
   Small, compatibility-focused overrides for the existing views.
   These rules are intentionally kept separate so future UI work does not
   require editing the design-system foundations.
   ======================================================================== */

/* ------------------------------------------------------------------------
   Accessibility / skip link
   ------------------------------------------------------------------------ */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 5000;
  transform: translateY(-180%);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--text-strong);
  color: var(--surface) !important;
  text-decoration: none !important;
  font-weight: 800;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ------------------------------------------------------------------------
   Global link normalization inside application surfaces
   ------------------------------------------------------------------------ */
.admin-main a,
.employee-page a {
  text-underline-offset: 3px;
}

/* Cards/actions should behave like controls, not browser-default links. */
.admin-main a.card,
.admin-main a.panel,
.admin-main a.stat-card,
.admin-main a.quick-card,
.admin-main a.attention-card,
.employee-page a.employee-quick-card,
.employee-page a.employee-application-card {
  text-decoration: none;
}

/* ------------------------------------------------------------------------
   Sidebar: prevent labels and groups from collapsing horizontally
   ------------------------------------------------------------------------ */
.sidebar,
.sidebar-nav,
.sidebar-bottom,
.nav-group,
.nav-group-items {
  width: 100%;
  min-width: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  overflow-x: hidden;
}

.nav-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}

.nav-group-toggle {
  flex: 0 0 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-group-toggle > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-group-items {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 3px;
}

.sidebar-link {
  min-width: 0;
  overflow: hidden;
}

.sidebar-link .nav-label,
.sidebar-link > span:not(.nav-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.sidebar-bottom .sidebar-link {
  width: 100%;
}

/* If an older view puts group controls directly in sidebar-nav, keep them
   stacked instead of allowing them to sit beside one another. */
.sidebar-nav > .nav-group-toggle,
.sidebar-nav > .nav-group-items {
  width: 100%;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------------
   Mobile drawer: stable width, clipping and overlay behavior
   ------------------------------------------------------------------------ */
@media (max-width: 850px) {
  .admin-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    width: min(320px, 86vw);
    max-width: 320px;
    padding: 16px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translate3d(-105%, 0, 0);
    will-change: transform;
  }

  body.sidebar-open .sidebar {
    transform: translate3d(0, 0, 0);
  }

  .admin-main {
    width: 100%;
    min-width: 0;
  }

  .admin-topbar {
    position: relative;
    z-index: 80;
  }
}

/* ------------------------------------------------------------------------
   Employee dashboard: resilient quick-access layout
   ------------------------------------------------------------------------ */
.employee-workspace,
.employee-quick-access,
.quick-access,
.employee-dashboard-grid {
  min-width: 0;
}

.employee-workspace,
.employee-quick-access,
.quick-access {
  display: block;
}

/* The current employee view may render quick links without the newer
   employee-quick-card class. Normalize direct links into proper rows. */
.employee-workspace > a,
.employee-quick-access > a,
.quick-access > a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
}

.employee-workspace > a:last-child,
.employee-quick-access > a:last-child,
.quick-access > a:last-child {
  border-bottom: 0;
}

.employee-workspace > a:hover,
.employee-quick-access > a:hover,
.quick-access > a:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.employee-workspace > a strong,
.employee-quick-access > a strong,
.quick-access > a strong {
  color: var(--text-strong);
}

.employee-workspace > a span,
.employee-quick-access > a span,
.quick-access > a span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employee-quick-card {
  min-width: 0;
  overflow: hidden;
}

.employee-quick-card strong,
.employee-quick-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------------------
   Employee dashboard stats: less excessive vertical whitespace
   ------------------------------------------------------------------------ */
.employee-stat-grid {
  align-items: stretch;
}

.employee-stat-grid .stat-card {
  min-height: 96px;
}

@media (max-width: 640px) {
  .employee-stat-grid .stat-card {
    padding: 14px;
    min-height: 88px;
  }

  .employee-stat-grid .stat-card strong {
    font-size: 21px;
  }
}

/* ------------------------------------------------------------------------
   Generic overflow protection
   ------------------------------------------------------------------------ */
.admin-main,
.employee-page,
.page-intro,
.page-header,
.panel,
.card,
.table-card,
.toolbar-card,
.integration-card,
.employee-surface {
  overflow-wrap: anywhere;
}

/* Do not break normal buttons/labels into individual characters. */
.btn,
.button,
.primary,
.secondary,
.sidebar-link,
.nav-group-toggle,
.page-btn {
  word-break: normal;
  overflow-wrap: normal;
}

/* Keep inline action groups usable on narrow screens. */
.inline-actions {
  min-width: 0;
}

@media (max-width: 640px) {
  .inline-actions {
    width: 100%;
  }

  .inline-actions > .btn,
  .inline-actions > .button,
  .inline-actions > .primary,
  .inline-actions > .secondary {
    flex: 1 1 auto;
  }
}


/* ------------------------------------------------------------------------
   UI-8.1 — cache-safe layout hardening
   ------------------------------------------------------------------------ */

/* The mobile drawer is a true overlay; the main document must never be
   squeezed beside it. */
@media (max-width: 850px) {
  .admin-shell {
    display: block !important;
    width: 100%;
    min-width: 0;
  }

  .admin-main {
    width: 100%;
    min-width: 0;
  }

  .sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000 !important;
    width: min(320px, 86vw) !important;
    max-width: 320px;
    transform: translate3d(-105%, 0, 0) !important;
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translate3d(0, 0, 0) !important;
  }

  .sidebar-overlay {
    z-index: 999 !important;
  }

  body.sidebar-open .sidebar-overlay {
    display: block !important;
  }

  /* Remove the older pseudo-overlay. The real button overlay above handles
     clicks and gives assistive technology an actual control. */
  body.sidebar-open::before {
    display: none !important;
  }
}

/* Desktop: navigation must remain a vertical column even when a browser
   inherits unexpected flex/grid rules from another module stylesheet. */
@media (min-width: 851px) {
  .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  .nav-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }

  .nav-group-items {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
  }

  .sidebar-link,
  .nav-group-toggle {
    width: 100% !important;
  }
}

/* The skip link must never occupy a visible row in normal page flow. */
.skip-link {
  position: fixed !important;
  top: 8px !important;
  left: 8px !important;
  transform: translateY(-180%) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0) !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Employee quick links should never concatenate inline text. */
.employee-workspace,
.employee-quick-access,
.quick-access {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 8px !important;
}

.employee-workspace > a,
.employee-quick-access > a,
.quick-access > a {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center;
  width: 100% !important;
  min-width: 0;
  white-space: normal !important;
  word-break: normal !important;
}

.employee-workspace > a br,
.employee-quick-access > a br,
.quick-access > a br {
  display: none;
}


/* UI-9: multi-selection controls */
.modal-card.modal-wide { width: min(920px, calc(100vw - 32px)); max-width: 920px; }

.form-section-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.form-section-heading strong { font-size:.9rem; }
.form-section-heading .muted { font-size:.78rem; }

.selected-user-card {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-subtle, rgba(127,127,127,.05));
}
.selected-user-card > div { display:flex; flex-direction:column; gap:3px; }
.selected-user-card strong { font-size:.9rem; }
.selected-user-card span,
.selected-user-card small { color:var(--muted); font-size:.78rem; }

.application-picker-grid,
.asset-picker-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  max-height:390px;
  overflow:auto;
  padding:2px;
}
.application-picker-item,
.asset-picker-item {
  position:relative;
  display:flex;
  align-items:flex-start;
  gap:10px;
  min-width:0;
  padding:13px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface, #fff);
  cursor:pointer;
  transition:border-color .15s ease,box-shadow .15s ease,background .15s ease;
}
.application-picker-item:hover,
.asset-picker-item:hover {
  border-color:var(--tenant-secondary,#3b82f6);
}
.application-picker-item:has(input:checked),
.asset-picker-item:has(input:checked) {
  border-color:var(--tenant-secondary,#3b82f6);
  box-shadow:0 0 0 2px color-mix(in srgb,var(--tenant-secondary,#3b82f6) 14%,transparent);
  background:color-mix(in srgb,var(--tenant-secondary,#3b82f6) 5%,var(--surface,#fff));
}
.application-picker-item > input,
.asset-picker-item > input {
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.application-picker-check,
.asset-picker-check {
  width:20px;
  height:20px;
  flex:0 0 20px;
  margin-top:1px;
  border:1.5px solid var(--line-strong,var(--line));
  border-radius:6px;
  background:var(--surface,#fff);
  position:relative;
}
.application-picker-item:has(input:checked) .application-picker-check,
.asset-picker-item:has(input:checked) .asset-picker-check {
  border-color:var(--tenant-secondary,#3b82f6);
  background:var(--tenant-secondary,#3b82f6);
}
.application-picker-item:has(input:checked) .application-picker-check::after,
.asset-picker-item:has(input:checked) .asset-picker-check::after {
  content:"";
  position:absolute;
  left:5px;
  top:2px;
  width:6px;
  height:10px;
  border:solid #fff;
  border-width:0 2px 2px 0;
  transform:rotate(45deg);
}
.application-picker-content,
.asset-picker-content {
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.application-picker-content strong,
.asset-picker-content strong { font-size:.88rem; }
.application-picker-content > span:not(.application-picker-options),
.asset-picker-content > span,
.application-picker-content small,
.asset-picker-content small {
  color:var(--muted);
  font-size:.75rem;
  line-height:1.35;
}
.application-picker-options { margin-top:6px; }
.application-role-inline {
  width:100%;
  min-height:34px;
  font-size:.78rem;
}
@media (max-width:760px) {
  .application-picker-grid,
  .asset-picker-grid { grid-template-columns:1fr; max-height:340px; }
  .selected-user-card { flex-direction:column; align-items:flex-start; }
}

/* ------------------------------------------------------------------------
   UI-14: data tables must scroll horizontally instead of wrapping values
   into one character per line on narrow screens.
   ------------------------------------------------------------------------ */
.table-scroll,
.table-wrap {
  overflow-x: auto !important;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.data-table,
.ui6-table,
.table-wrap > table {
  table-layout: auto;
  min-width: 720px;
}

.data-table td,
.ui6-table td,
.table td,
.data-table th,
.ui6-table th,
.table th {
  white-space: nowrap;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

.data-table td .person-cell,
.ui6-table td .person-cell {
  min-width: 190px;
  white-space: normal;
}

.data-table td .person-cell strong,
.ui6-table td .person-cell strong {
  white-space: nowrap;
}

.data-table td code,
.ui6-table td code {
  white-space: nowrap;
}

/* Opt-in wrapping for genuinely long descriptions. */
.table-cell-wrap {
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  min-width: 180px;
  max-width: 360px;
}

.workflow-routing-note {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--tenant-secondary, #3b82f6) 25%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--tenant-secondary, #3b82f6) 6%, var(--surface));
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
}

.workflow-routing-note strong { color: var(--text-strong); }

@media (max-width: 760px) {
  .data-table,
  .ui6-table,
  .table-wrap > table {
    min-width: 720px;
  }

  .data-table td,
  .ui6-table td,
  .table td {
    padding: 12px 14px;
  }
}


/* UI-14: employee acknowledgement presentation */
.employee-terms-confirm {
  border:1px solid var(--line);
  border-radius:14px;
  padding:16px;
  background:var(--surface-muted,#f8fafc);
}
.employee-terms-confirm > strong { display:block; font-size:.92rem; margin-bottom:5px; }
.employee-terms-confirm > p { margin:0 0 12px; color:var(--muted); font-size:.78rem; line-height:1.55; }
.employee-terms-confirm .check-field { margin:0; }
.ack-item { display:grid; grid-template-columns:32px minmax(0,1fr); gap:12px; padding:14px 0; border-top:1px solid var(--line); }
.ack-item:first-child { border-top:0; }
.ack-item-body { min-width:0; display:grid; gap:5px; }
.ack-item-body > strong { font-size:.9rem; }
.ack-resource-meta { display:flex; flex-wrap:wrap; gap:7px; margin-top:5px; }
.ack-resource-meta span { padding:6px 8px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--muted); font-size:.7rem; }
.ack-resource-meta strong { color:var(--text-strong); }
.ack-policy { margin-top:8px; border:1px solid var(--line); border-radius:12px; background:var(--surface); overflow:hidden; }
.ack-policy-title { display:flex; justify-content:space-between; gap:12px; padding:10px 12px; border-bottom:1px solid var(--line); font-size:.78rem; font-weight:800; }
.ack-policy-title span { color:var(--muted); font-weight:700; }
.ack-policy .policy-text { padding:12px; max-height:340px; overflow:auto; color:var(--text); line-height:1.65; font-size:.78rem; white-space:pre-wrap; }

/* ========================================================================
   UI-17 — Final navigation, icon and mobile directory polish
   ======================================================================== */

/* The navigation has its own scroll area so the bottom controls never fall
   below the viewport when several groups are expanded. */
.admin-shell .sidebar { min-height: 0; }
.admin-shell .sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.admin-shell .sidebar-bottom { flex: 0 0 auto; margin-top: 0; }

/* Local Font Awesome is the primary icon source; keep icons from collapsing
   when a font is still being decoded. */
.fa-solid, .fa-regular, .fa-brands, .nav-icon i, .icon-button i,
.notification-bell i, .avatar-button i, .quick-card-icon i,
.attention-icon i, .request-icon i, .stat-icon i { display: inline-block; line-height: 1; }
.stat-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid !important; place-items: center; border-radius: 12px; font-size: 17px !important; }
.dashboard-stat-card .stat-card-top { align-items: center; }
.dashboard-stat-card .stat-kicker { margin-left: auto; }
.attention-icon { display: grid !important; place-items: center; font-size: 13px; }
.quick-card-icon { display: grid !important; place-items: center; }
.request-icon { display: grid !important; place-items: center; }

/* Header account button is a profile icon, not a raw letter. */
.avatar-button { display: grid; place-items: center; font-size: 15px; }
.avatar-button i { color: var(--text-strong); }

/* Compact employee directory on phones. Only the identity, useful summary,
   statuses and actions remain in the row; department/position/role columns
   are already represented in the summary. This prevents one employee from
   consuming a full screen of stacked table cells. */
@media (max-width: 640px) {
  .people-table-card { margin-inline: 12px !important; }
  .people-table-card .table-meta { padding: 12px 14px; }
  .people-table-card .table-scroll { overflow: visible !important; }
  .people-table { display: table !important; width: 100%; min-width: 0 !important; table-layout: fixed; }
  .people-table thead { display: none !important; }
  .people-table tbody { display: table-row-group !important; }
  .people-table tr.employee-directory-row { display: grid !important; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 11px 12px; min-height: 76px; border-bottom: 1px solid var(--line); }
  .people-table tr.employee-directory-row:last-child { border-bottom: 0; }
  .people-table tr.employee-directory-row td { display: none !important; width: auto !important; border: 0 !important; padding: 0 !important; min-width: 0; }
  .people-table tr.employee-directory-row td:first-child,
  .people-table tr.employee-directory-row td.actions-cell { display: block !important; }
  .people-table tr.employee-directory-row td:first-child::before { display: none !important; }
  .people-table .employee-cell { min-width: 0; gap: 9px; }
  .people-table .employee-cell .avatar { width: 38px; height: 38px; flex-basis: 38px; }
  .people-table .employee-cell-main { min-width: 0; }
  .people-table .employee-cell-main strong { font-size: 13px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .people-table .employee-cell-main small { max-width: 100%; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .employee-mobile-meta { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; min-width: 0; margin-top: 5px; color: var(--muted); font-size: 9px; }
  .employee-mobile-meta span { min-width: 0; max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .employee-mobile-meta span + span::before { content: '·'; margin-right: 5px; color: var(--muted-2); }
  .people-table .actions-cell { display: flex !important; align-items: center; justify-content: flex-end; gap: 3px; white-space: nowrap; }
  .people-table .actions-cell .icon-action { width: 32px; height: 32px; }
  .people-table .actions-cell .icon-action:nth-child(n+4) { display: none; }
  .people-table-card .pagination { padding: 10px 12px; }
}

/* Admin notification inbox. */
.admin-notifications-page { width: min(1100px, 100%); margin-inline: auto; padding-bottom: 32px; }
.admin-notifications-card { margin-inline: 32px; }
.admin-notification-list { display: grid; }
.admin-notification-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: start; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.admin-notification-row:last-child { border-bottom: 0; }
.admin-notification-row.is-unread { background: color-mix(in srgb, var(--info-bg) 45%, transparent); }
.admin-notification-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--primary-2); }
.admin-notification-main { min-width: 0; }
.admin-notification-main > div { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.admin-notification-main p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.admin-notification-main small { color: var(--muted-2); font-size: 10px; }
.admin-notification-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 640px) {
  .admin-notifications-card { margin-inline: 16px; }
  .admin-notification-row { grid-template-columns: 34px minmax(0,1fr); padding: 13px 14px; }
  .admin-notification-actions { grid-column: 2; }
}

/* ========================================================================
   UI-18 — Roles & permissions: compact, editable and mobile-friendly
   ======================================================================== */
.access-v4 { grid-template-columns: minmax(270px,.34fr) minmax(0,.66fr); }
.access-v4 .role-list-panel,
.access-v4 .permission-panel { min-width: 0; }
.access-v4 .role-list { gap: 5px; max-height: min(720px, calc(100vh - 300px)); overflow: auto; padding-right: 2px; }
.access-v4 .role-row { min-height: 58px; padding: 9px 10px; border-color: transparent; }
.access-v4 .role-row-chevron { flex: 0 0 auto; color: var(--muted-2,var(--muted)); font-size: 11px; }
.access-v4 .role-row.selected .role-row-chevron { color: var(--tenant-secondary,var(--primary-2)); }
.access-v4 .role-row-main strong { font-size: 13px; }
.access-v4 .role-row-main small { font-size: 10px; }
.access-v4 .selected-role-bar { padding: 18px 0; }
.access-v4 .selected-role-copy { min-width: 0; }
.access-v4 .selected-role-copy h2 { font-size: 21px; letter-spacing: -.02em; }
.access-v4 .selected-role-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.role-meta-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 10px; font-weight: 800; }
.role-meta-pill.system { background: var(--info-bg); color: var(--info); }
.role-meta-pill.active { background: var(--success-bg); color: var(--success); }
.access-v4 .permission-actions { flex: 0 0 auto; align-items: center; }
.access-v4 .permission-actions .btn { white-space: nowrap; }
.access-v4 .permission-summary { margin: 14px 0; }
.access-v4 .permission-summary > div { min-height: 64px; padding: 10px 12px; }
.access-v4 .permission-summary strong { font-size: 19px; line-height: 1; }
.access-v4 .permission-summary span { font-size: 10px; }
.access-v4 .permission-groups { gap: 10px; }
.access-v4 .permission-group { border-radius: 13px; }
.access-v4 .permission-group-head { padding: 10px 12px; }
.access-v4 .permission-group-title { display: flex !important; flex-direction: row; align-items: center; gap: 9px; min-width: 0; }
.access-v4 .permission-group-title > div { display: grid; gap: 2px; min-width: 0; }
.access-v4 .permission-group-title strong { text-transform: capitalize; font-size: 12px; }
.access-v4 .permission-group-head small { font-size: 9px; }
.access-v4 .module-icon { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-3); color: var(--tenant-secondary,var(--primary-2)); font-size: 11px; }
.access-v4 .module-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--tenant-secondary,var(--primary-2)); font-size: 10px; font-weight: 850; white-space: nowrap; }
.access-v4 .module-toggle input { width: 15px; height: 15px; margin: 0; accent-color: var(--tenant-secondary,var(--primary-2)); }
.access-v4 .permission-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; }
.access-v4 .permission-option { display: grid; grid-template-columns: 18px minmax(0,1fr) minmax(90px,.7fr); align-items: center; gap: 8px; min-height: 57px; padding: 9px 11px; }
.access-v4 .permission-option input { position: absolute; opacity: 0; pointer-events: none; }
.access-v4 .permission-checkmark { width: 17px; height: 17px; display: grid !important; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--surface); }
.access-v4 .permission-option.checked .permission-checkmark { border-color: var(--tenant-secondary,var(--primary-2)); background: var(--tenant-secondary,var(--primary-2)); }
.access-v4 .permission-option.checked .permission-checkmark::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: #fff; font-size: 9px; }
.access-v4 .permission-copy { display: grid !important; gap: 2px !important; min-width: 0; }
.access-v4 .permission-copy strong { color: var(--text-strong); font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.access-v4 .permission-copy small { color: var(--muted); font-size: 9px; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.access-v4 .permission-description { display: block !important; min-width: 0; color: var(--muted); font-size: 9px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.access-v4 .permission-option.checked .permission-description { color: var(--text); }
.access-v4 .permission-option:hover { background: color-mix(in srgb,var(--tenant-secondary,var(--primary-2)) 5%,var(--surface)); }
.access-v4 .permission-option.checked { background: color-mix(in srgb,var(--tenant-secondary,var(--primary-2)) 7%,var(--surface)); }
.access-v4 .save-bar { margin-top: 12px; }
.access-v4 .save-bar i { margin-right: 5px; }

@media (max-width: 1100px) {
  .access-v4 { grid-template-columns: 1fr; }
  .access-v4 .role-list { max-height: 360px; }
}

@media (max-width: 760px) {
  .access-v4 .permission-grid { grid-template-columns: 1fr; }
  .access-v4 .permission-option { grid-template-columns: 18px minmax(0,1fr) 0; }
  .access-v4 .permission-description { display: none !important; }
  .access-v4 .selected-role-bar { flex-direction: column; }
  .access-v4 .permission-actions { width: 100%; }
  .access-v4 .permission-actions .btn { flex: 1; justify-content: center; }
}

@media (max-width: 560px) {
  .access-v4 .permission-summary { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
  .access-v4 .permission-summary > div { min-height: 58px; padding: 9px; }
  .access-v4 .permission-summary strong { font-size: 16px; }
  .access-v4 .permission-summary span { font-size: 9px; }
  .access-v4 .role-row-side .status-badge.info { display: none; }
  .access-v4 .role-row { min-height: 54px; }
  .access-v4 .permission-group-head { padding: 9px 10px; }
  .access-v4 .module-toggle span { font-size: 9px; }
  .access-v4 .permission-option { min-height: 54px; padding: 8px 9px; }
}
