﻿/* ==========================================
   General modifications over the Steex theme.
   Colour comes from the tokens in brand/app-identity.css only — no literal
   colours and no gradients here. Direction is written logically (inline-start/
   end) so the rules read the same way in the RTL document they serve.
   Every animation below is shortened to an instant by the global
   prefers-reduced-motion block in app-identity.css.
   ========================================== */

.search-box {
  position: relative !important;
}

/* The glyph sits at the inline END of the field (the left, in RTL). */
.search-box .search-icon {
  position: absolute !important;
  inset-inline-start: auto !important;
  inset-inline-end: 1rem !important;
  padding-inline-end: 0 !important;
  color: var(--app-ink-faint) !important;
}

/* A collapsed table's last bottom border sits half outside the table, so the
   wrapper's content is half a pixel taller than its box; with overflow-x auto
   (overflow-y then computes to auto too) that half pixel draws a vertical
   scrollbar beside every table. One pixel of padding keeps it inside. */
.table-responsive {
  padding-block-end: 1px;
}

/*Table header color*/
.table-active {
  background-color: var(--app-surface-sunken) !important;
}

.colomn-before-last--size {
  box-sizing: content-box;
  width: 15%;
}

.colomn-last--size {
  box-sizing: content-box;
  width: 20%;
}

.modal-content {
  border: none !important;
  box-shadow: none !important; /* optional: remove shadow */
}

/* Solid brand fill: white on --app-brand-hover is 6.9:1. The gradient this
   replaced ended on teal-400, where the same white was 2.9:1. */
.form__header--add {
  background: var(--app-brand-hover) !important;
  color: var(--app-on-brand) !important;
}

.modal-header {
  color: var(--app-on-brand) !important;
  border-bottom: 0.25px solid var(--app-brand-hover) !important;
}

.index-btn-add {
  background-color: var(--app-brand) !important;
  color: var(--app-on-brand) !important;
  display: inline-flex;
  align-items: center; /* vertically center icon and text */
  justify-content: center; /* horizontally center content */
  box-shadow: 0 2px 4px rgba(var(--app-brand-rgb), 0.3);
}
.index-btn-add:hover:not(:disabled) {
  background-color: var(--app-brand-hover) !important;
  box-shadow: 0 4px 12px rgba(var(--app-brand-rgb), 0.4);
}

.form-border--radius {
  border: solid 0.5px var(--app-line-strong);
  border-radius: var(--app-radius-md);
}

.form__btn--add,
.form__btn--save,
.form__btn--next {
  background-color: var(--app-brand-hover) !important;
  color: var(--app-on-brand) !important;
  box-shadow: 0 2px 4px rgba(var(--app-brand-rgb), 0.3);
}
.form__btn--add:hover,
.form__btn--save:hover,
.form__btn--next:hover {
  background-color: var(--app-brand-active) !important;
  box-shadow: 0 4px 12px rgba(var(--app-brand-rgb), 0.4);
}

.form__btn--prev {
  background-color: var(--app-ink-muted) !important;
  color: var(--app-on-brand) !important;
}

.form__btn--size {
  box-sizing: border-box;
  min-width: 140px;
  min-height: var(--app-control-height);
  padding: 4px 16px;
  border: 1px solid;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.form__label--odd--color {
  color: var(--app-ink);
}

.form__label--even--color {
  color: var(--app-brand-ink-hover);
}

.form-border {
  border: solid 0.5px var(--app-brand-ink-hover) !important;
}

.form-icon-color {
  color: var(--app-brand-ink);
}

.form__label--padding {
  padding-bottom: 2px;
}

.form-read {
  background: var(--app-surface-sunken) !important;
}
@media (max-width: 390px) {
  .hide-below-390 {
    display: none !important;
  }
}

.select-color {
  background-color: var(--app-surface-sunken) !important;
}

.badge-green {
  background-color: var(--app-brand) !important;
}

.badge-yellow {
  background-color: var(--app-amber-300) !important;
}

/* ==========================================
   App UI Enhancements
   ========================================== */

/* Smooth scroll, only for users who have not asked for less motion. Selection
   and focus rings are owned by assets/css/brand/app-identity.css. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ==========================================
   Card Enhancements
   Card surface (radius, border, resting and hover elevation) is owned by
   assets/css/brand/app-identity.css. Only the lift behaviour lives here.
   ========================================== */
.card-elevated:hover {
  transform: translateY(-2px);
}

/* ==========================================
   Button Enhancements
   ========================================== */
.btn {
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Outline buttons fill on hover, sweeping in from the inline start. There is
   no logical keyword for transform-origin, so the RTL document gets the mirror. */
[class*="btn-outline"]:not(:disabled) {
  position: relative;
  overflow: hidden;
}
[class*="btn-outline"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s ease;
  z-index: -1;
  opacity: 0.1;
}
[class*="btn-outline"]:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}
[dir="rtl"] [class*="btn-outline"]::before {
  transform-origin: left;
}
[dir="rtl"] [class*="btn-outline"]:hover::before {
  transform-origin: right;
}

/* ==========================================
   Table Enhancements
   ========================================== */
.table > tbody > tr {
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}
.table > tbody > tr:hover {
  background-color: rgba(var(--app-brand-ink-rgb), 0.03) !important;
}
/* The hover rule marks the row's leading edge: the first cell's inline-start
   side, which is its RIGHT edge in RTL. A box-shadow offset is physical, so the
   RTL document gets the negative offset. */
.table > tbody > tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--app-brand-hover);
}
[dir="rtl"] .table > tbody > tr:hover td:first-child {
  box-shadow: inset -3px 0 0 var(--app-brand-hover);
}
.table > thead th {
  background: var(--app-surface-sunken);
  font-weight: 600;
}

/* ==========================================
   Form Enhancements
   ========================================== */
.form-control,
.form-select {
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.form-control:hover:not(:disabled):not(:focus),
.form-select:hover:not(:disabled):not(:focus) {
  border-color: rgba(var(--app-brand-ink-rgb), 0.4);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--app-brand-ink-hover);
  box-shadow: var(--app-focus-ring);
}

/* Search box focus expand */
.search-box .form-control {
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    width 0.25s ease;
}
.search-box:focus-within .search-icon {
  color: var(--app-brand-ink-hover) !important;
}

/* Input group coordination */
.input-group:focus-within .input-group-text {
  border-color: var(--app-brand-ink-hover);
  color: var(--app-brand-ink-hover);
}

/* ==========================================
   Modal Enhancements
   ========================================== */
.modal-backdrop.show {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-content {
  border: none;
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-lg);
  overflow: hidden;
}
.modal.fade .modal-dialog {
  transform: scale(0.95) translateY(-20px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
}

/* The fill belongs on the header only — a title carrying the same class would
   paint a second box inside it */
.modal-title.form__header--add {
  background: transparent !important;
}

/* Headings carry their own theme color, so the header's white doesn't inherit
   into the title — force it so every modal title matches the reference */
.modal-header .modal-title {
  color: var(--app-on-brand) !important;
}

/* Modal forms follow the brand form styling: ink labels, brand focus ring */
.modal .form-label {
  color: var(--app-ink);
}
.modal .form-control:focus,
.modal .form-select:focus,
.modal textarea.form-control:focus {
  border-color: var(--app-brand-ink) !important;
  box-shadow: var(--app-focus-ring) !important;
}

/* Labels and their icons are ink in every modal, both add and edit — the
   accent lives in the borders, checks, and buttons only */
.modal .form__label--even--color,
.modal .form__label--odd--color,
.modal .form-icon-color {
  color: var(--app-ink);
}

/* Edit-mode form theme — opt-in via .modal--edit on the modal root (JS toggles
   it with the bg-warning header). Labels keep the unified ink color; the
   accent orange lives in the borders, focus ring, checks, and submit button. */
.modal--edit .form-check-input:checked {
  background-color: var(--app-accent) !important;
  border-color: var(--app-accent) !important;
}
.modal--edit .form-check-input:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 0.15rem rgba(var(--app-accent-rgb), 0.25);
}
.modal--edit .form-border {
  border-color: var(--app-accent) !important;
}
.modal--edit .form-control:focus,
.modal--edit .form-select:focus,
.modal--edit textarea.form-control:focus {
  border-color: var(--app-accent) !important;
  box-shadow: 0 0 0 0.15rem rgba(var(--app-accent-rgb), 0.25) !important;
}
.modal--edit .btn-warning {
  --tb-btn-color: var(--app-on-accent);
  --tb-btn-hover-color: var(--app-on-accent);
  --tb-btn-active-color: var(--app-on-accent);
}
/* Group wizard chrome follows the edit theme (!important beats the inline
   brand color on the bar and the always-active step-1 circle) */
.modal--edit #progressBar {
  background-color: var(--app-accent) !important;
}
.modal--edit .hide-below-390 .col-4:first-child .rounded-circle {
  background: var(--app-accent) !important;
}
/* On the orange the label is the Accent's own dark ink: white there is 2.6:1. */
.modal--edit .form__btn--next {
  background-color: var(--app-accent) !important;
  color: var(--app-on-accent) !important;
  box-shadow: 0 2px 4px rgba(var(--app-accent-rgb), 0.3) !important;
}
.modal--edit .form__btn--next:hover {
  background-color: var(--app-accent-hover) !important;
  box-shadow: 0 4px 12px rgba(var(--app-accent-rgb), 0.4) !important;
}

/* ==========================================
   Sidebar Enhancements
   ========================================== */
.navbar-menu .nav-link {
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
  border-radius: var(--app-radius-md);
  margin: 4px 12px;
  position: relative;
}
/* The hover bar sits on the link's leading (inline-start) edge, rounded on the
   side that faces the text. */
.navbar-menu .nav-link::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--app-brand-hover);
  border-start-end-radius: 2px;
  border-end-end-radius: 2px;
  transition: height 0.15s ease;
}
/* A small nudge towards the inline end — leftwards in RTL. */
.navbar-menu .nav-link:hover {
  transform: translateX(4px);
}
[dir="rtl"] .navbar-menu .nav-link:hover {
  transform: translateX(-4px);
}
.navbar-menu .nav-link:hover::before {
  height: 60%;
}
/* The nudge above makes a hovered link 4px wider than the menu's scroll box, and SimpleBar (app.js puts one on
   #scrollbar and another on #navbar-nav) answers with a horizontal scrollbar at the menu's foot for as long as
   the pointer stays. The menu never scrolls sideways — both wrappers are overflow-x: hidden — so its horizontal
   tracks are never shown. */
.navbar-menu .simplebar-track.simplebar-horizontal {
  display: none !important;
}
.navbar-menu .nav-link:hover i,
.navbar-menu .nav-link:hover svg {
  color: var(--app-brand-ink);
  transform: scale(1.1);
}
.navbar-menu .nav-link i,
.navbar-menu .nav-link svg {
  transition:
    color 0.15s ease,
    transform 0.15s ease;
}

/* ==========================================
   Pagination Enhancements
   ========================================== */
.pagination .page-link {
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}
.pagination .page-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(var(--app-brand-rgb), 0.15);
}
.pagination .page-item.active .page-link {
  background: var(--app-brand);
  box-shadow: 0 4px 12px rgba(var(--app-brand-rgb), 0.3);
}

/* ==========================================
   Dropdown Enhancements
   ========================================== */
.dropdown-menu {
  border: none;
  box-shadow: var(--app-shadow-md);
  border-radius: var(--app-radius-md);
  padding: 0.5rem;
  animation: dropdownFadeIn 0.2s ease;
}
.dropdown-item {
  border-radius: var(--app-radius-md);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.dropdown-item:hover {
  background: rgba(var(--app-brand-ink-rgb), 0.08);
  color: var(--app-brand-ink-hover);
}

/* ==========================================
   Badge & Alert Enhancements
   ========================================== */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
  border-radius: var(--app-radius-sm);
}
.alert {
  border: none;
  border-radius: var(--app-radius-md);
}

/* ==========================================
   Animations
   ========================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Opacity only — deliberately NOT transform. Bootstrap positions every
   dropdown through Popper, which writes an inline `transform: translate3d(...)`
   carrying the menu's actual coordinates. A CSS animation outranks an inline
   style, so animating transform here hijacked that positioning for the length
   of the animation: the menu appeared at its unpositioned origin and slid to
   where it belonged, which read as a glitch on open. */
@keyframes dropdownFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
/* The skeleton's pulse — opacity on a solid fill, replacing the travelling
   gradient shimmer (the same change app-components.css made to .app-skeleton). */
@keyframes skeletonPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* Animation utilities */
.animate-fade-in-up {
  animation: fadeInUp 0.3s ease both;
}

/* Staggered children */
.stagger-children > * {
  opacity: 0;
  animation: fadeInUp 0.3s ease forwards;
}
.stagger-children > *:nth-child(1) {
  animation-delay: 0.05s;
}
.stagger-children > *:nth-child(2) {
  animation-delay: 0.1s;
}
.stagger-children > *:nth-child(3) {
  animation-delay: 0.15s;
}
.stagger-children > *:nth-child(4) {
  animation-delay: 0.2s;
}
.stagger-children > *:nth-child(5) {
  animation-delay: 0.25s;
}

/* Skeleton loading (common.js list loader, among others) */
.skeleton {
  background-color: var(--app-line);
  animation: skeletonPulse 1.4s ease-in-out infinite;
  border-radius: var(--app-radius-sm);
}
.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}
.skeleton-button {
  height: var(--app-control-height);
  width: 100px;
  border-radius: var(--app-radius-md);
}

/* Loading spinner */
.spinner-teal {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(var(--app-brand-ink-rgb), 0.2);
  border-top-color: var(--app-brand-ink-hover);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================
   Role Selector Enhancements
   ========================================== */

/* Role Accordion Styling */
.role-accordion {
  border-radius: var(--app-radius-lg);
  overflow: hidden;
}

.role-group-item {
  background: var(--app-surface-sunken);
  border-radius: var(--app-radius-md) !important;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.role-group-item:hover {
  box-shadow: 0 2px 8px rgba(var(--app-brand-rgb), 0.1);
}

.role-group-header {
  background: var(--app-surface-sunken) !important;
  border: 1px solid rgba(var(--app-brand-ink-rgb), 0.1);
  border-radius: var(--app-radius-md) !important;
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: var(--app-brand-ink-hover);
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

/* Open group: the solid brand fill (white label 6.9:1). */
.role-group-header:not(.collapsed) {
  background: var(--app-brand-hover) !important;
  color: var(--app-on-brand) !important;
  border-color: transparent;
}

.role-group-header:not(.collapsed) .role-group-title,
.role-group-header:not(.collapsed) .role-count-badge {
  color: var(--app-on-brand) !important;
}

.role-group-header:not(.collapsed) .select-all-btn {
  background: var(--app-on-brand-wash);
  border-color: var(--app-on-brand-wash-hover);
  color: var(--app-on-brand);
}

.role-group-header:not(.collapsed) .select-all-btn:hover {
  background: var(--app-on-brand-wash-hover);
}

.role-group-header::after {
  color: var(--app-brand-ink-hover);
  transition: transform 0.2s ease;
}

.role-group-header:not(.collapsed)::after {
  color: var(--app-on-brand);
}

.role-group-title {
  font-size: 0.95rem;
}

.role-count-badge {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  background: rgba(var(--app-brand-ink-rgb), 0.1);
  border-radius: var(--app-radius-lg);
  color: var(--app-brand-ink-hover);
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.role-group-body {
  background: var(--app-surface);
  padding: 1rem;
  border: 1px solid rgba(var(--app-brand-ink-rgb), 0.1);
  border-top: none;
  border-radius: 0 0 var(--app-radius-md) var(--app-radius-md);
}

/* Role Switch Styling — the switch sits at the inline start */
.role-switch {
  padding: 0.5rem 0.75rem;
  padding-inline-start: 2.5rem;
  background: var(--app-surface-sunken);
  border-radius: var(--app-radius-md);
  transition: background-color 0.15s ease;
  margin-bottom: 0;
}

.role-switch:hover {
  background: rgba(var(--app-brand-ink-rgb), 0.08);
}

.role-switch .form-check-input {
  width: 2.5rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  cursor: pointer;
  background-color: var(--app-line-strong);
  border: none;
  transition:
    background-color 0.2s ease,
    background-position 0.2s ease,
    box-shadow 0.2s ease;
}

.role-switch .form-check-input:checked {
  background-color: var(--app-brand);
}

.role-switch .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(var(--app-brand-ink-rgb), 0.25);
  border: none;
}

.role-label {
  font-size: 0.875rem;
  color: var(--app-ink);
  cursor: pointer;
  transition: color 0.15s ease;
  user-select: none;
}

.role-switch:hover .role-label {
  color: var(--app-brand-ink-hover);
}

.role-switch .form-check-input:checked + .role-label {
  color: var(--app-brand-ink-hover);
  font-weight: 500;
}

/* Select All Button */
.select-all-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--app-radius-sm);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.select-all-btn:hover {
  transform: scale(1.02);
}

/* Role Search Input */
#roleSearchInput {
  border-radius: var(--app-radius-md);
}

#roleSearchInput:focus {
  box-shadow: var(--app-focus-ring);
}

/* Role Item Animation */
.role-item {
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.role-item[style*="display: none"] {
  opacity: 0;
  transform: scale(0.95);
}

/* ==========================================
   Centre branding on the auth shell

   What is left of the old "auth wallpaper": the Midnight wash, its dot grid,
   the translucent card and the white brand text are gone with their last
   consumer. /auth moved to the split card (brand/app-auth.css) and
   Views/Errors/* followed it, so nothing selects .auth-page-wrapper any more.
   Two gradients left the codebase with it — docs/design-system.md §7.

   .auth-poweredby below IS still live: the centre-locked login renders it, and
   app-auth.css re-binds the white below for the split card's white panel.
   ========================================== */
.auth-center-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-logo-center-hero {
  max-height: 140px;
  max-width: 240px;
  background: var(--app-paper);
  padding: 14px 20px;
  border-radius: var(--app-radius-lg);
  object-fit: contain;
  box-shadow: var(--app-shadow-lg);
}

.auth-center-name {
  color: var(--app-on-brand);
  text-shadow: 0 2px 8px rgba(var(--app-gray-900-rgb), 0.45);
  letter-spacing: 0.3px;
}

.auth-poweredby {
  color: var(--app-on-brand-muted) !important;
  font-size: 0.8rem;
  line-height: 1;
  transition: opacity 0.15s ease;
}

.auth-poweredby:hover {
  color: var(--app-on-brand) !important;
  opacity: 1;
}

.auth-poweredby-text {
  letter-spacing: 0.5px;
}

.auth-poweredby-logo {
  height: 22px;
  width: auto;
  opacity: 0.9;
  filter: drop-shadow(0 2px 6px rgba(var(--app-gray-900-rgb), 0.35));
}

/* ==========================================
   Topbar — moved out of _topbar.cshtml's inline <style> (this file is linked
   on every page, which was the only reason that block was inline). Literal
   whites became the --app-on-brand tokens.
   ========================================== */

/* ===== Notifications dropdown ===== */
.notification-dropdown-menu {
  border-radius: var(--app-radius-md);
}
/* 380px on a desktop, never wider than the viewport minus a 16px gutter. */
#notificationDropdown .notification-dropdown-menu {
  min-width: min(380px, calc(100vw - 32px));
}
.notification-head .notification-head-icon {
  width: 40px;
  height: 40px;
}
.notification-head .text-white-75 {
  color: var(--app-on-brand-muted) !important;
}
.notification-head .mark-all-read-btn:hover {
  background-color: var(--app-on-brand-wash-hover) !important;
}
.notification-empty .notification-empty-icon {
  width: 64px;
  height: 64px;
}
/* Item polish: subtle hover + smooth read/unread transition */
#notificationDropdown .notification-item {
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}
#notificationDropdown .notification-item:hover {
  background-color: var(--app-surface-sunken);
}
#notificationDropdown .notification-item-wrapper + .notification-item-wrapper {
  border-top: 1px solid var(--app-line);
}
#notificationDropdown .notification-item .min-width-0 {
  min-width: 0;
}
#notificationDropdown .notification-item h6,
#notificationDropdown .notification-item p {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Quick-access buttons =====
   Solid fills at both states rather than the brand gradient: the gradient
   ended on teal-400, and white text over that is ~2.6:1 — under AA for UI
   text. Surface Tint + Primary Hover at rest is ~6.9:1, and white on Primary
   Hover is ~7:1, so the label is legible in both states. */
.topbar-quick-action {
  display: inline-flex;
  align-items: center;
  border: none;
  padding-inline: 0.85rem;
  font-weight: var(--app-weight-medium);
  background-color: var(--app-brand-soft);
  color: var(--app-brand-ink-hover);
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}
.topbar-quick-action:hover,
.topbar-quick-action:focus {
  background-color: var(--app-brand-hover);
  color: var(--app-on-brand);
  box-shadow: var(--app-shadow-md);
}
/* The glyph is part of the label, so it must not keep its own colour */
.topbar-quick-action i {
  color: inherit;
}

/* ===== Account menu =====
   The toggle reads as part of the topbar — no panel of its own behind it
   (--tb-topbar-user-bg is transparent in app-identity.css); only hover and
   the open state tint it, the way every other topbar control behaves. */
.topbar-user .topbar-user-btn {
  padding: 0.25rem 0.5rem;
  border-radius: var(--app-radius-md);
  min-height: 0;
  transition: background-color 0.16s var(--app-ease);
}
.topbar-user .topbar-user-btn:hover,
.topbar-user.show .topbar-user-btn {
  background-color: var(--app-surface-sunken);
}
.topbar-user .header-profile-user {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border: 1px solid var(--app-line);
}
.topbar-user .user-name-text {
  font-size: var(--app-text-body);
  font-weight: var(--app-weight-semibold);
  line-height: 1.25;
  color: var(--app-ink);
}
.topbar-user .user-role-text {
  font-size: var(--app-text-caption);
  line-height: 1.3;
  color: var(--app-ink-muted);
}
.topbar-user .topbar-user-caret {
  color: var(--app-ink-faint);
  transition: transform 0.18s var(--app-ease);
}
.topbar-user.show .topbar-user-caret {
  transform: rotate(180deg);
}

.user-menu {
  min-width: 264px;
  padding: var(--app-space-2);
}
.user-menu__head {
  display: flex;
  align-items: center;
  gap: var(--app-space-3);
  padding: var(--app-space-3);
  margin-bottom: var(--app-space-2);
  border-radius: var(--app-radius-md);
  background-color: var(--app-brand-soft);
}
.user-menu__avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;
  flex-shrink: 0;
}
.user-menu__id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.user-menu__name {
  font-size: var(--app-text-body);
  font-weight: var(--app-weight-semibold);
  color: var(--app-ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu__role {
  font-size: var(--app-text-caption);
  color: var(--app-brand-ink-hover);
}
.user-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--app-space-2);
  padding: 0.55rem 0.65rem;
  border-radius: var(--app-radius-md);
  font-size: var(--app-text-body);
  color: var(--app-ink);
}
.user-menu .dropdown-item i {
  font-size: 1.1rem;
  color: var(--app-ink-faint);
}
.user-menu .dropdown-item:hover i {
  color: inherit;
}
/* The danger INK (6.5:1 on white), not the spec's red hue (3.8:1). */
.user-menu__logout,
.user-menu__logout i {
  color: var(--app-danger-ink);
}
.user-menu__logout:hover {
  background-color: rgba(var(--app-danger-ink-rgb), 0.1);
  color: var(--app-danger-ink);
}

/* ===== Theme switcher ===== */
.theme-menu {
  min-width: 11rem;
}
.theme-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--app-space-2);
  padding: 0.5rem 0.65rem;
  border-radius: var(--app-radius-md);
  font-size: var(--app-text-body);
  color: var(--app-ink);
}
.theme-menu .dropdown-item i {
  font-size: 1.05rem;
  color: var(--app-ink-faint);
}
/* The ticked row carries the Surface Tint the spec assigns to a selected
   item, so it reads the same as the selected entry in the sidebar. */
.theme-menu .dropdown-item.active {
  background-color: var(--app-brand-soft);
  color: var(--app-brand-ink);
  font-weight: var(--app-weight-medium);
}
.theme-menu .dropdown-item.active i {
  color: inherit;
}

/* A region App.Page.refresh swaps after a save (#page-body, #topbarQuickActions). The wrapper
   exists only to be found and replaced; display: contents keeps it out of the layout, so its
   children sit in the grid or flex row exactly as they did before it was added. */
.app-region {
  display: contents;
}
