/* ==========================================================================
   ui-enhancements.css — inlined here (was an @import).
   An @import forced the browser to download and parse core.css before it
   even discovered this file, adding a second render-blocking round trip to
   every page load. Inlined at the top so the cascade order is unchanged.
   ========================================================================== */


:root {
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-3:  0 12px 40px rgba(20, 37, 60, 0.14);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --transition-fast: 0.14s ease;
  --transition-base: 0.22s ease;
  --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --gradient-page: linear-gradient(160deg, #f1f4f9 0%, #f4f6fa 50%, #f2f5f9 100%);
  --gradient-primary: linear-gradient(135deg, #1f5fb2 0%, #2563c4 60%, #17467f 100%);
  --gradient-sidebar: linear-gradient(185deg, #0c1f39 0%, #111c2d 50%, #0a1927 100%);
  --focus-ring: 0 0 0 3px rgba(31, 95, 178, 0.22);
  --topbar-h: 64px;
  --color-primary-light: #e8f0fb;
  --color-surface-raised: #f8fafc;
  --color-border-subtle: #e4ecf4;

  --skeleton-base: #e2e8f0;
  --skeleton-highlight: #f1f5f9;
}

@keyframes ui-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ui-fade-in-fast {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ui-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}

@keyframes ui-slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ui-zoom-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes ui-bounce-in {
  from { opacity: 0; transform: scale(0.86); }
  60%  { transform: scale(1.04); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes section-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes app-progress-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.78; }
  50%      { transform: scale(1);    opacity: 1; }
}
@keyframes app-progress-orbit {
  to { transform: rotate(360deg); }
}

@keyframes notify-curtain-in {
  from { opacity: 0; transform: translateY(-130%) scale(0.94); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}
@keyframes notify-curtain-out {
  to { opacity: 0; transform: translateY(-110%) scale(0.97); }
}
@keyframes notify-curtain-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(120%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(120%) scale(0.92); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: 0.6; }
}

@keyframes btn-ripple {
  to { transform: scale(4); opacity: 0; }
}

@keyframes stat-pop {
  from { transform: scale(0.88); opacity: 0.4; }
  60%  { transform: scale(1.08); }
  to   { transform: scale(1); opacity: 1; }
}

body.app-ready .app-main {
  animation: ui-fade-in 0.32s ease both;
}
body.app-ready .content > * {
  animation: ui-fade-in 0.38s ease both;
}
body.app-ready .content > *:nth-child(2) { animation-delay: 0.05s; }
body.app-ready .content > *:nth-child(3) { animation-delay: 0.10s; }
body.app-ready .content > *:nth-child(4) { animation-delay: 0.14s; }

body {
  background: var(--gradient-page);
  background-attachment: fixed;
}

.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  background: linear-gradient(90deg, #1f5fb2, #4a90e2, #1f5fb2);
  background-size: 200% auto;
  animation: skeleton-shimmer 1.2s linear infinite;
  transform-origin: left;
  transition: opacity 0.3s ease;
}
.page-loader[hidden] { display: none; }

.topbar {
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar__title {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

body.app-ready .topbar {
  animation: ui-slide-down 0.3s ease both;
}

.sidebar {
  background: var(--gradient-sidebar);
  box-shadow: none;
}

.sidebar__link.is-active {
  position: relative;
}
.sidebar__link.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-sidebar-active);
}

.tabbar,
.tabs {
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
}

.tabbar__tab {
  position: relative;
  overflow: hidden;
  transition: background var(--transition-fast), color var(--transition-fast),
              box-shadow var(--transition-fast), transform var(--transition-fast);
}

.tabbar__tab.is-active {
  background: var(--gradient-primary);
  box-shadow: 0 2px 12px rgba(31, 95, 178, 0.35);
  transform: translateY(-1px);
}

.tab {
  position: relative;
  transition: color var(--transition-fast);
}
.tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--color-primary);
  transform: scaleX(0);
  transition: transform 0.22s var(--transition-bounce);
}
.tab.is-active::after { transform: scaleX(1); }

.btn {
  border-radius: var(--btn-radius);
  position: relative;
  overflow: hidden;
  transition: background var(--transition-fast), transform var(--transition-fast),
              box-shadow var(--transition-fast), filter var(--transition-fast);
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn__ripple {
  position: absolute;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,0.35);
  transform: scale(0);
  pointer-events: none;
  animation: btn-ripple 0.5s linear;
}

.btn--primary {
  background: var(--gradient-primary);
  border: none;
  box-shadow: 0 2px 8px rgba(31, 95, 178, 0.32);
}
.btn--primary:hover {
  box-shadow: 0 6px 20px rgba(31, 95, 178, 0.42);
  filter: brightness(1.04);
}

.btn--success {
  background: var(--color-success);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(26, 122, 74, 0.3);
}
.btn--success:hover {
  box-shadow: 0 6px 16px rgba(26, 122, 74, 0.38);
  filter: brightness(1.06);
}

.btn--danger {
  background: var(--color-danger);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(192, 55, 44, 0.3);
}
.btn--danger:hover {
  box-shadow: 0 6px 16px rgba(192, 55, 44, 0.38);
  filter: brightness(1.06);
}

.btn--info {
  background: var(--color-info);
  color: #fff;
  border-color: transparent;
}
.btn--warning {
  background: var(--color-warning);
  color: #fff;
  border-color: transparent;
}
.btn--accent {
  background: var(--color-accent);
  color: #fff;
  border-color: transparent;
}
.btn--purple {
  background: var(--color-purple);
  color: #fff;
  border-color: transparent;
}

.btn--sm {
  padding: 5px 14px;
  font-size: 0.82rem;
}
.btn--ghost {
  background: transparent;
  border: 1px solid var(--color-border, #d4dae6);
  box-shadow: none;
}
.btn--ghost:hover {
  background: var(--color-surface-hover);
  transform: none;
  box-shadow: 0 1px 4px rgba(15,23,42,0.07);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
}

.form__input,
.form__select,
.form__textarea {
  border-radius: 7px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
              background var(--transition-fast);
}
.form__input:hover,
.form__select:hover,
.form__textarea:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
}
.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
  background: var(--color-surface);
}

.fieldset {
  background: var(--color-surface-raised);
  border-radius: var(--radius-md);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}
.fieldset:focus-within {
  border-color: var(--color-info-border);
  box-shadow: 0 2px 12px rgba(31,95,178,0.08);
}
.fieldset legend {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.table-wrap {
  border-radius: 13px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  transition: box-shadow var(--transition-base);
}
.table-wrap:hover {
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.1);
}
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-thead-bg);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  user-select: none;
}
.table-wrap tbody tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}
.table-wrap tbody tr:hover { background: var(--color-surface-hover) !important; }
.table-wrap tbody tr:nth-child(even) { background: var(--color-surface-stripe); }
.table-wrap tbody tr:nth-child(even):hover { background: var(--color-surface-hover) !important; }

.table-wrap tbody tr:active { background: var(--color-surface-active) !important; }

.table-wrap tbody tr.row--sent-back td {
  background: var(--color-warning-soft);
}
.table-wrap tbody tr.row--sent-back:hover td,
.table-wrap tbody tr.row--sent-back:nth-child(even) td,
.table-wrap tbody tr.row--sent-back:nth-child(even):hover td {
  background: var(--color-warning-soft);
}
.table-wrap tbody tr.row--sent-back {
  box-shadow: inset 4px 0 0 var(--color-warning-text);
}

.skeleton {
  display: inline-block;
  height: 1em;
  border-radius: 5px;
  background: linear-gradient(
    105deg,
    var(--skeleton-base) 0%,
    var(--skeleton-highlight) 42%,
    color-mix(in srgb, var(--color-primary) 16%, var(--skeleton-highlight)) 50%,
    var(--skeleton-highlight) 58%,
    var(--skeleton-base) 100%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.7s ease-in-out infinite;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
}
.skeleton-row:last-child { border-bottom: none; }
.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(
    105deg,
    var(--skeleton-base) 0%,
    var(--skeleton-highlight) 42%,
    color-mix(in srgb, var(--color-primary) 16%, var(--skeleton-highlight)) 50%,
    var(--skeleton-highlight) 58%,
    var(--skeleton-base) 100%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.7s ease-in-out infinite;
}
.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.skeleton-line {
  height: 12px;
  border-radius: 5px;
  background: linear-gradient(
    105deg,
    var(--skeleton-base) 0%,
    var(--skeleton-highlight) 42%,
    color-mix(in srgb, var(--color-primary) 16%, var(--skeleton-highlight)) 50%,
    var(--skeleton-highlight) 58%,
    var(--skeleton-base) 100%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.7s ease-in-out infinite;
}
.skeleton-line--sm { height: 10px; width: 60%; }
.skeleton-line--lg { height: 14px; }

.skeleton-table-row td {
  padding: 12px 16px;
}
.skeleton-cell {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(
    105deg,
    var(--skeleton-base) 0%,
    var(--skeleton-highlight) 42%,
    color-mix(in srgb, var(--color-primary) 16%, var(--skeleton-highlight)) 50%,
    var(--skeleton-highlight) 58%,
    var(--skeleton-base) 100%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.7s ease-in-out infinite;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(31, 95, 178, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner--sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
.spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}
.spinner--white {
  border-color: rgba(255,255,255,0.3);
  border-top-color: #fff;
}

.loading-overlay {
  position: relative;
  pointer-events: none;
}
.loading-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--overlay-veil);
  backdrop-filter: blur(1px);
  border-radius: inherit;
  z-index: 10;
  animation: ui-fade-in-fast 0.15s ease both;
}

.card,
.placeholder-card {
  border-radius: 13px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.08), 0 0 0 1px rgba(15,23,42,0.03);
  transition: box-shadow var(--transition-base), transform var(--transition-base),
              border-color var(--transition-base);
}
.card:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.11);
  transform: translateY(-1px);
}

.tile,
.stat-card {
  border-radius: 13px;
  transition: transform var(--transition-base), box-shadow var(--transition-base),
              border-color var(--transition-base);
}
.tile:hover,
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  border-color: var(--color-border-strong);
}

.tile__value,
.stat-card__value {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: stat-pop 0.55s var(--transition-bounce) both;
}

.tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 13px 13px 0 0;
}

.modal__backdrop {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  background: rgba(12, 24, 44, 0.55);
  animation: ui-fade-in-fast 0.2s ease both;
}
.modal__dialog {
  border-radius: 16px;
  animation: ui-bounce-in 0.32s var(--transition-bounce) both;
  border: 1px solid var(--modal-border);
  box-shadow: 0 24px 64px rgba(12, 24, 44, 0.22), 0 0 0 1px rgba(255,255,255,0.15);
}
.modal__header {
  background: var(--color-surface-raised);
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid var(--color-border);
}
.modal__header h3 {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal__close {
  transition: background var(--transition-fast), color var(--transition-fast),
              transform var(--transition-fast);
}
.modal__close:hover {
  background: var(--color-surface-hover);
  transform: scale(1.1);
}

/* —— Modern confirm dialog (App.confirm) —— */
.app-confirm {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.app-confirm.is-open { opacity: 1; }
.app-confirm.is-leaving { opacity: 0; pointer-events: none; }

.app-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 24, 44, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.app-confirm__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 400px);
  padding: 28px 28px 22px;
  border-radius: 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow:
    0 28px 64px rgba(12, 24, 44, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.12);
  text-align: center;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.22s var(--transition-bounce, cubic-bezier(0.34, 1.4, 0.64, 1));
}
.app-confirm.is-open .app-confirm__dialog {
  transform: translateY(0) scale(1);
}

.app-confirm__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}
.app-confirm__icon svg { width: 26px; height: 26px; }
.app-confirm__icon--danger {
  color: var(--color-danger-text, #b42318);
  background: var(--color-danger-soft, #fef3f2);
}
.app-confirm__icon--primary,
.app-confirm__icon--info {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

.app-confirm__title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--color-text);
}

.app-confirm__body {
  margin: 0 0 14px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.app-confirm__tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 20px;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-subtle, var(--color-border));
  border-radius: 10px;
}
.app-confirm__tip-label {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-top: 1px;
}

.app-confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: stretch;
}
/* Size by content and wrap: .btn is nowrap + overflow:hidden, so equal
   halves would clip a longer label such as "Print this page". */
.app-confirm__actions .btn {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  min-height: 42px;
  padding-inline: 14px;
  font-weight: 600;
  white-space: normal;
}
.app-confirm__cancel {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.app-confirm__cancel:hover {
  background: var(--color-surface-hover);
}

@media (max-width: 420px) {
  .app-confirm__dialog { padding: 24px 18px 18px; }
  .app-confirm__actions { flex-direction: column-reverse; }
}

.app-print-pick .app-confirm__dialog {
  width: min(100%, 440px);
}
.app-print-pick__list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(48vh, 360px);
  overflow: auto;
}
.app-print-pick__btn {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  color: inherit;
  cursor: pointer;
}
.app-print-pick__btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.app-print-pick__name {
  grid-column: 1;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.app-print-pick__meta {
  grid-column: 1;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.app-print-pick__action {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-weight: 700;
  color: var(--color-primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.badge:hover {
  transform: scale(1.04);
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s ease-in-out infinite;
}

.alert,
.notice {
  border-radius: 8px;
  animation: ui-fade-in-fast 0.2s ease both;
}
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2500;
  align-items: flex-end;
}

.toast {
  border-radius: 12px;
  animation: toast-in 0.32s var(--transition-bounce) both;
  font-weight: 500;
  font-size: 0.9rem;
  min-width: 240px;
  max-width: 380px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.2), 0 0 0 1px rgba(255,255,255,0.1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: rgba(255,255,255,0.5);
  border-radius: 12px 0 0 12px;
}
.toast.is-leaving {
  animation: toast-out 0.3s ease forwards;
}
.toast--error   { background: linear-gradient(135deg, #c0372c 0%, #e04438 100%); }
.toast--info    { background: linear-gradient(135deg, #1f5fb2 0%, #2e74cc 100%); }
.toast--success { background: linear-gradient(135deg, #1a7a4a 0%, #22a061 100%); }
.toast--warning { background: linear-gradient(135deg, #b56b08 0%, #d4840e 100%); }

.toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  opacity: 0.9;
}
.toast__text { flex: 1; }
.toast__close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background var(--transition-fast);
}
.toast__close:hover { background: rgba(255,255,255,0.28); }

.notify-curtain {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  width: min(460px, calc(100vw - 28px));
  pointer-events: none;
}
.notify-curtain__item {
  pointer-events: auto;
  background: var(--curtain-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--curtain-border);
  border-radius: 18px;
  padding: 0;
  margin-bottom: 12px;
  box-shadow: 0 16px 48px rgba(20, 37, 60, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
  overflow: hidden;
  animation: notify-curtain-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.notify-curtain__item:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 56px rgba(20, 37, 60, 0.26);
}
.notify-curtain__item--success {
  background: var(--curtain-bg);
  border-color: var(--color-success-border);
}
.notify-curtain__item.is-leaving {
  animation: notify-curtain-out 0.28s ease forwards;
}
.notify-curtain__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}
.notify-curtain__head strong {
  flex: 1;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  font-weight: 800;
}
.notify-curtain__icon {
  width: 22px; height: 22px; flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f5fb2' stroke-width='1.75'%3E%3Cpath d='M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 1 0-12 0v3.2c0 .5-.2 1-.6 1.4L4 17h5'/%3E%3Cpath d='M9.5 17a2.5 2.5 0 0 0 5 0'/%3E%3C/svg%3E") center/contain no-repeat;
}
.notify-curtain__item--success .notify-curtain__head strong { color: var(--color-success-text); }
.notify-curtain__item--success .notify-curtain__icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23157a48' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
.notify-curtain__close {
  background: none; border: none;
  font-size: 1.25rem; line-height: 1;
  color: var(--color-muted); cursor: pointer;
  padding: 2px 6px; border-radius: 6px;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.notify-curtain__close:hover { color: var(--color-text); background: rgba(0,0,0,0.06); }
.notify-curtain__msg {
  margin: 8px 16px 14px;
  font-size: 0.9rem; line-height: 1.48;
  color: var(--color-text);
}
.notify-curtain__progress {
  height: 3px;
  background: linear-gradient(90deg, #1f5fb2, #4a90e2);
  animation: notify-curtain-progress 5s linear forwards;
  border-radius: 0 0 18px 18px;
}
.notify-curtain__item--success .notify-curtain__progress {
  background: linear-gradient(90deg, #1a7a4a, #34d399);
}

.approval-trail__item {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 16px;
  backdrop-filter: blur(6px);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.approval-trail__item:hover {
  box-shadow: 0 4px 12px rgba(15,23,42,0.08);
  transform: translateX(2px);
}
.approval-trail__meta {
  font-size: 0.85rem;
  color: var(--color-muted);
}
.approval-trail__meta em {
  font-style: normal;
  font-weight: 700;
  color: var(--color-primary);
}

.timeline {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
}
.timeline li {
  padding: var(--space-2) 0 var(--space-3) var(--space-4);
  border-left: 2px solid var(--color-border);
  margin-left: 8px;
  position: relative;
  transition: border-color var(--transition-fast);
}
.timeline li::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-border);
  transition: box-shadow var(--transition-fast), background var(--transition-fast);
}
.timeline li:hover::before {
  box-shadow: 0 0 0 3px rgba(31,95,178,0.25);
  background: var(--color-primary);
}
.timeline li:first-child { border-color: var(--color-primary); }
.timeline li:first-child::before { background: var(--color-primary); box-shadow: 0 0 0 3px rgba(31,95,178,0.2); }
.timeline .tl-meta { font-size: 0.78rem; color: var(--color-muted); }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-muted);
  animation: ui-fade-in 0.4s ease both;
}
.empty-state__icon { display: none; }
.empty-state__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-secondary, #4a5568);
  margin-bottom: 6px;
}
.empty-state__text {
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 38ch;
  margin: 0 auto 20px;
}

.dept-section,
.proc-section,
.exec-section,
.stores-section,
.fin-section,
.tab-panel,
.utab-panel {
  animation: none;
}
.dept-section.is-active,
.proc-section.is-active,
.exec-section.is-active,
.stores-section.is-active,
.fin-section.is-active,
.tab-panel.is-active,
.utab-panel.is-active {
  animation: section-enter 0.24s ease both;
}

.st-draft        { background: var(--color-btn-bg); color: var(--color-text-secondary); }
.st-submitted    { background: var(--color-info-soft); color: var(--color-info-text); }
.st-dept_pending,
.st-procurement_pending,
.st-executive_pending { background: var(--color-warning-soft); color: var(--color-warning-text); }
.st-dept_rejected,
.st-procurement_rejected,
.st-executive_rejected,
.st-cancelled    { background: var(--color-danger-soft); color: var(--color-danger-text); }
.st-ceo_approved,
.st-closed       { background: var(--color-success-soft); color: var(--color-success-text); }
.st-grv_created  { background: var(--color-success-soft); color: var(--color-success-text); }
.st-po_issued    { background: var(--color-purple-soft); color: var(--color-purple-text); }
.st-receiving    { background: var(--color-warning-soft); color: var(--color-warning-text); }
.st-invoice_processing { background: var(--color-warning-soft); color: var(--color-warning-text); }
.st-paid,
.st-approved     { background: var(--color-success-soft); color: var(--color-success-text); }
.st-dispatch_pending { background: var(--color-warning-soft); color: var(--color-warning-text); }
.st-rejected     { background: var(--color-danger-soft); color: var(--color-danger-text); }
.st-processing   { background: var(--color-warning-soft); color: var(--color-warning-text); }

.search-bar__input {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.search-bar__input:focus {
  background: var(--color-surface);
  box-shadow: 0 2px 12px rgba(31, 95, 178, 0.12), 0 0 0 3px rgba(31, 95, 178, 0.14);
}

.searchbox input {
  transition: width 0.3s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.searchbox input:focus {
  width: 320px;
  box-shadow: 0 4px 16px rgba(31,95,178,0.15);
}

.summary {
  background: var(--color-surface-raised);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06);
}

.notice--delivery {
  background: var(--color-success-soft);
  border: 1px solid var(--color-success-border);
  color: var(--color-success-text);
  border-radius: 10px;
}

.profile-photo-preview__img {
  width: 100%; height: 100%; object-fit: cover;
}
.profile-security-banner {
  background: var(--color-info-soft);
  border: 1px solid var(--color-info-border);
  border-radius: 10px;
  padding: 13px 18px;
  margin-bottom: 16px;
  animation: ui-fade-in 0.3s ease both;
}

.table-wrap,
.sidebar__nav,
.modal__dialog,
.ai-panel__body,
.lines-editor__list {
  scrollbar-width: thin;
}
.table-wrap,
.modal__dialog,
.ai-panel__body,
.lines-editor__list {
  scrollbar-color: var(--color-scrollbar) transparent;
}
.sidebar__nav {
  scrollbar-color: var(--color-sidebar-scrollbar) transparent;
}
.table-wrap::-webkit-scrollbar,
.sidebar__nav::-webkit-scrollbar,
.modal__dialog::-webkit-scrollbar { width: 6px; height: 6px; }
.table-wrap::-webkit-scrollbar-thumb,
.modal__dialog::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar); border-radius: 999px;
}
.sidebar__nav::-webkit-scrollbar-thumb {
  background: var(--color-sidebar-scrollbar); border-radius: 999px;
}
.table-wrap::-webkit-scrollbar-thumb:hover,
.modal__dialog::-webkit-scrollbar-thumb:hover { background: var(--color-scrollbar-hover); }
.sidebar__nav::-webkit-scrollbar-thumb:hover { background: var(--color-sidebar-scrollbar-hover); }

.ai-fab {
  transition: transform var(--transition-bounce), box-shadow var(--transition-base);
}
.ai-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 32px rgba(31,95,178,0.38);
}

.line-item {
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.line-item:hover {
  border-color: var(--color-info-border);
  box-shadow: 0 2px 10px rgba(31,95,178,0.08);
}
.line-item:focus-within {
  border-color: var(--color-info-border);
  box-shadow: 0 0 0 3px rgba(31, 95, 178, 0.1);
  transform: none;
}

:focus-visible {
  outline: 3px solid rgba(31, 95, 178, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
a:focus-visible {
  border-radius: 6px;
}

.sidebar__link.is-active {
  position: relative;
}
.sidebar__link.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-sidebar-active);
}

.sidebar__link:not(.is-active):hover {
  background: var(--color-sidebar-link-hover);
  color: var(--color-sidebar-active);
}

/* Sidebar footer user block (nav.php) — must stay readable on the dark panel */
.sidebar__footer .sidebar__user-block .sidebar__user {
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-sidebar-active);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: default;
}
.sidebar__footer .sidebar__user-block .sidebar__user:hover {
  background: transparent;
  box-shadow: none;
}
.sidebar__footer .sidebar__user-block .sidebar__user-title {
  color: var(--color-sidebar-text);
}

/* Optional avatar row layout (not used in main nav today) */
.sidebar__user--card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--color-sidebar-surface);
  border: 1px solid var(--color-sidebar-border);
  margin: 8px;
  color: var(--color-sidebar-active);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
  cursor: default;
}
.sidebar__user--card:hover {
  background: var(--color-sidebar-link-hover);
  box-shadow: none;
}
.sidebar__user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.sidebar__user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role {
  font-size: 0.7rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__group-label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-muted);
  padding: 14px 16px 4px;
  pointer-events: none;
  user-select: none;
}

.sidebar__brand {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: 4px;
}
.sidebar__brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(37,99,235,0.45);
}
.sidebar__brand-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.sidebar__brand-tagline {
  font-size: 0.65rem;
  color: var(--color-muted);
  letter-spacing: 0.04em;
}

.searchbox {
  position: relative;
  display: flex;
  align-items: center;
}
.searchbox::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' d='M9 4a5 5 0 100 10A5 5 0 009 4zM15 15l3 3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 14px;
  pointer-events: none;
  opacity: 0.65;
}
.searchbox input { padding-left: 32px; }

@keyframes bell-ring {
  0%, 100% { transform: rotate(0deg); }
  10%       { transform: rotate(12deg); }
  20%       { transform: rotate(-10deg); }
  30%       { transform: rotate(8deg); }
  40%       { transform: rotate(-6deg); }
  50%       { transform: rotate(4deg); }
  60%       { transform: rotate(-2deg); }
}
.topbar__bell.has-unread {
  animation: bell-ring 2.5s ease 0.5s;
  animation-iteration-count: 1;
}
.topbar__bell.has-unread .topbar__badge {
  animation: badge-pop 0.4s var(--transition-bounce) both;
}
@keyframes badge-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.topbar__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--color-surface);
  line-height: 1;
}

.topbar__user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
  font: inherit;
  font-size: 0.875rem;
}
.topbar__user-btn:hover {
  background: var(--color-primary-light);
  box-shadow: 0 2px 8px rgba(31,95,178,0.12);
}
.topbar__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #2563c4);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.topbar {
  position: relative;
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-border);
  pointer-events: none;
}

.content {
  background: var(--color-bg, #f4f7fb);
}

.admin-section.is-active > *,
.workflow-panel:not([hidden]) > * {
  animation: sec-child-in 0.3s ease both;
}
.admin-section.is-active > *:nth-child(1) { animation-delay: 0ms; }
.admin-section.is-active > *:nth-child(2) { animation-delay: 40ms; }
.admin-section.is-active > *:nth-child(3) { animation-delay: 80ms; }
.admin-section.is-active > *:nth-child(4) { animation-delay: 120ms; }
.admin-section.is-active > *:nth-child(5) { animation-delay: 160ms; }
@keyframes sec-child-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.badge {
  transition: background var(--transition-base), color var(--transition-base), transform var(--transition-fast);
}
.badge.is-new-status {
  animation: badge-highlight 0.8s ease both;
}
@keyframes badge-highlight {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(31,95,178,0.18); }
  100% { transform: scale(1); box-shadow: none; }
}

.table-wrap table tbody tr {
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.table-wrap table tbody tr:hover td:first-child {
  font-weight: 600;
}
.table-wrap table tbody tr .row-action-btn {
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  transform: translateX(4px);
}
.table-wrap table tbody tr:hover .row-action-btn {
  opacity: 1;
  transform: translateX(0);
}

.floating-save-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  padding: 12px 24px;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 20px rgba(15,23,42,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  animation: float-bar-in 0.3s ease both;
}
@keyframes float-bar-in {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: none; }
}

.card {
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card:focus-within {
  box-shadow: 0 0 0 3px rgba(31,95,178,0.12), 0 4px 16px rgba(15,23,42,0.09);
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  box-shadow: var(--focus-ring);
  border-color: rgba(31,95,178,0.45);
  outline: none;
}

.modal__dialog {
  transform-origin: center bottom;
}
.modal:not([hidden]) .modal__dialog {
  animation: modal-spring 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes modal-spring {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__header {
  background: var(--color-surface-raised);
  border-bottom: 1px solid var(--color-border);
  padding: 18px 24px;
}
.modal__header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}

@media (max-width: 768px) {
  .topbar__title { font-size: 1.08rem; }
  .notify-curtain { width: calc(100vw - 20px); top: 10px; }
  .toast-stack { right: 12px; bottom: 12px; }
  .toast { min-width: 200px; max-width: calc(100vw - 40px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Stage indicator ── */
.stage-indicator {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  background: var(--color-primary-light);
  border: 1px solid var(--color-info-border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.stage-indicator__badge {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 30px;
}
.stage-indicator__step,
.stage-indicator__holder {
  color: var(--color-text-secondary);
}
.stage-indicator__step strong,
.stage-indicator__holder strong {
  color: var(--color-primary);
}
.stage-indicator__workflow {
  font-size: 0.8rem;
}

/* ── Audit trail (shared App.auditTrailHtml) ── */
.approval-trail__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.approval-trail__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.approval-trail__avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f5fb2, #3b82f6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}
.approval-trail__head {
  flex: 1;
  min-width: 0;
}
.approval-trail__note {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  background: var(--color-surface-raised);
  border-left: 3px solid var(--color-info-border);
  padding: 4px 8px;
  border-radius: 0 4px 4px 0;
  white-space: pre-wrap;
}
.approval-trail__stage {
  margin: 2px 0 0;
  font-size: 0.78rem;
}

.approval-trail__item--branch-reply .approval-trail__edits,
.approval-trail__edits {
  margin-top: 0.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface-raised);
}
.approval-trail__edits-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 0.35rem;
}
.approval-trail__edits ul {
  margin: 0;
  padding-left: 1.1rem;
}
.approval-trail__edits li {
  margin: 0.15rem 0;
  line-height: 1.4;
  font-size: 0.85rem;
  color: var(--color-text);
  white-space: normal;
}
.approval-trail__edit-area {
  display: inline-block;
  font-weight: 700;
  color: var(--color-text);
  background: var(--color-primary-soft, var(--color-surface-hover));
  border: 1px solid var(--color-primary-border, var(--color-border));
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  font-size: 0.78rem;
}
.approval-trail__edits--compact {
  margin-top: 0.4rem;
}
.approval-trail__edits-pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  font-size: 0.85rem;
}
.audit-table__row--branch-reply td {
  vertical-align: top;
  white-space: normal;
}

/* ── Audit table (from openTrack) ── */
.audit-table th,
.audit-table td {
  white-space: nowrap;
  font-size: 0.82rem;
}
.audit-table__title {
  font-size: 0.78rem;
  display: block;
}




:root {

  --color-bg:             #f3f5f9;
  --color-surface:        #ffffff;
  --color-surface-raised: #f8fafd;
  --color-surface-hover:  #f3f8ff;
  --color-surface-stripe: #fafbfd;
  --color-surface-active: #ddeeff;
  --color-border:         #dde3ec;
  --color-border-subtle:  #e9edf4;
  --color-border-strong:  #b8c5d6;
  --color-text:           #16202f;
  --color-text-secondary: #4c5a6d;
  --color-text-muted:     #4c5a6d;
  --color-muted:          #64748b;
  --color-primary:        #1f5fb2;
  --color-primary-dark:   #174f96;
  --color-primary-light:  #e8f0fb;
  --color-success:        #1a7a4a;
  --color-danger:         #c0372c;
  --color-warning:        #b56b08;
  --color-accent:         #a97614;
  --color-accent-soft:    #f7efdd;

  --color-success-soft:   #e8f7ee;
  --color-success-text:   #1a7a4a;
  --color-success-border: #b5e0c8;
  --color-danger-soft:    #fdecea;
  --color-danger-text:    #c0372c;
  --color-danger-border:  #f5c6c0;
  --color-warning-soft:   #fef5e4;
  --color-warning-text:   #96590a;
  --color-warning-border: #f5d9a0;
  --color-info:           #1a56c4;
  --color-info-soft:      #e8f0fe;
  --color-info-text:      #1a56c4;
  --color-info-border:    #c2d6f2;
  --color-purple:         #5b21b6;
  --color-purple-soft:    #ede9fe;
  --color-purple-text:    #5b21b6;

  --ramp-1: #86b6ef;
  --ramp-2: #5598e7;
  --ramp-3: #2a78d6;
  --ramp-4: #256abf;
  --ramp-5: #1c5cab;
  --ramp-6: #104281;

  --color-thead-bg:       #f4f7fb;
  --color-btn-bg:         #eaedf2;
  --color-btn-bg-hover:   #dde2ea;
  --color-toast-bg:       #14253c;
  --color-scrollbar:      var(--color-scrollbar);
  --color-scrollbar-hover:var(--color-scrollbar-hover);
  --topbar-bg:            rgba(255, 255, 255, 0.97);
  --overlay-veil:         rgba(255, 255, 255, 0.65);
  --curtain-bg:           rgba(255, 255, 255, 0.84);
  --curtain-border:       rgba(255, 255, 255, 0.65);
  --modal-border:         rgba(255, 255, 255, 0.75);

  --color-sidebar-bg:     #0c1f39;
  --color-sidebar-surface: rgba(255, 255, 255, 0.1);
  --color-sidebar-text:   #b8c8e0;
  --color-sidebar-active: #ffffff;
  --color-sidebar-border: rgba(255, 255, 255, 0.14);
  --color-sidebar-link-hover: rgba(255, 255, 255, 0.1);
  --color-sidebar-link-active: rgba(255, 255, 255, 0.16);
  --color-sidebar-heading: rgba(255, 255, 255, 0.45);
  --color-sidebar-scrollbar: rgba(255, 255, 255, 0.22);
  --color-sidebar-scrollbar-hover: rgba(255, 255, 255, 0.35);
  --gradient-sidebar: linear-gradient(185deg, #0c1f39 0%, #103056 48%, #0a1927 100%);
  --sidebar-width:        248px;
  --sidebar-width-narrow: 56px;

  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius:    8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --btn-radius: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-1:  0 1px 4px rgba(15, 23, 42, 0.09), 0 0 0 1px rgba(15, 23, 42, 0.03);
  --shadow-2:  0 4px 16px rgba(15, 23, 42, 0.13);
  --shadow-3:  0 12px 40px rgba(15, 23, 42, 0.18);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.55);

  --font:      "Segoe UI Variable Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Cascadia Mono", "SF Mono", "Fira Code", "Consolas", monospace;
  --font-size-base: 14px;

  --transition-fast: 0.14s ease;
  --transition-base: 0.22s ease;
  --focus-ring: 0 0 0 3px rgba(31, 95, 178, 0.22);

  --topbar-h: 58px;
  --content-max: 1300px;
  color-scheme: light;
}

/* ============================================================
   Keystone dark theme — activated by <html data-theme="dark">.
   The theme boot script in app_head_meta.php stamps the attribute
   before first paint; default is light.
   ============================================================ */
:root[data-theme="dark"] {
  --color-bg:             #0d1322;
  --color-surface:        #151d30;
  --color-surface-raised: #1a2338;
  --color-surface-hover:  #1d2942;
  --color-surface-stripe: #182238;
  --color-surface-active: #24345a;
  --color-border:         #27324a;
  --color-border-subtle:  #202a40;
  --color-border-strong:  #35415e;
  --color-text:           #e8edf6;
  --color-text-secondary: #a3b0c5;
  --color-text-muted:     #a3b0c5;
  --color-muted:          #8593a9;
  --color-primary:        #5b96e8;
  --color-primary-dark:   #8ab4f0;
  --color-primary-light:  rgba(91, 150, 232, 0.14);
  --color-success:        #2e9e63;
  --color-danger:         #e05252;
  --color-warning:        #d98a1c;
  --color-accent:         #e3a63d;
  --color-accent-soft:    rgba(227, 166, 61, 0.13);

  --color-success-soft:   rgba(46, 158, 99, 0.15);
  --color-success-text:   #6fd08a;
  --color-success-border: rgba(46, 158, 99, 0.4);
  --color-danger-soft:    rgba(224, 82, 82, 0.14);
  --color-danger-text:    #f09090;
  --color-danger-border:  rgba(224, 82, 82, 0.4);
  --color-warning-soft:   rgba(217, 138, 28, 0.15);
  --color-warning-text:   #f0bd6e;
  --color-warning-border: rgba(217, 138, 28, 0.4);
  --color-info:           #5b96e8;
  --color-info-soft:      rgba(91, 150, 232, 0.14);
  --color-info-text:      #8ab4f0;
  --color-info-border:    rgba(91, 150, 232, 0.35);
  --color-purple:         #7c5cbf;
  --color-purple-soft:    rgba(150, 120, 240, 0.16);
  --color-purple-text:    #b7a4f2;

  --ramp-1: #b7d3f6;
  --ramp-2: #86b6ef;
  --ramp-3: #5598e7;
  --ramp-4: #3987e5;
  --ramp-5: #256abf;
  --ramp-6: #184f95;

  --color-thead-bg:       #1a2338;
  --color-btn-bg:         #232e46;
  --color-btn-bg-hover:   #2b3854;
  --color-toast-bg:       #223050;
  --color-scrollbar:      #33405c;
  --color-scrollbar-hover:#45536f;
  --topbar-bg:            rgba(18, 25, 42, 0.95);
  --overlay-veil:         rgba(13, 19, 34, 0.6);
  --curtain-bg:           rgba(26, 35, 56, 0.92);
  --curtain-border:       rgba(255, 255, 255, 0.12);
  --modal-border:         rgba(255, 255, 255, 0.08);

  --color-sidebar-bg:     #0c1f39;
  --color-sidebar-surface: rgba(255, 255, 255, 0.1);
  --color-sidebar-text:   #b8c8e0;
  --color-sidebar-active: #ffffff;
  --color-sidebar-border: rgba(255, 255, 255, 0.14);
  --color-sidebar-link-hover: rgba(255, 255, 255, 0.1);
  --color-sidebar-link-active: rgba(255, 255, 255, 0.16);
  --color-sidebar-heading: rgba(255, 255, 255, 0.45);
  --color-sidebar-scrollbar: rgba(255, 255, 255, 0.22);
  --color-sidebar-scrollbar-hover: rgba(255, 255, 255, 0.35);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-1:  0 1px 4px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-2:  0 4px 16px rgba(0, 0, 0, 0.42);
  --shadow-3:  0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --focus-ring: 0 0 0 3px rgba(91, 150, 232, 0.3);

  /* ui-enhancements.css tokens, re-themed */
  --gradient-page: linear-gradient(160deg, #0c1220 0%, #0e1526 50%, #0c1322 100%);
  --gradient-primary: linear-gradient(135deg, #2a6fd0 0%, #3b82e6 60%, #2159ab 100%);
  --gradient-sidebar: linear-gradient(185deg, #132d54 0%, #0f2847 48%, #0c1f39 100%);
  --skeleton-base: #232e46;
  --skeleton-highlight: #2b3854;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: var(--font-size-base);
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-2);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 var(--space-2); }
ul, ol { margin: 0; padding-left: var(--space-4); }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-surface-raised);
  padding: 2px 5px;
  border-radius: var(--radius-xs);
  color: var(--color-primary-dark);
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 4px;
  z-index: 9999;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { left: var(--space-2); }

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: margin-left var(--transition-base);
}

/* Chromeless focus views (no sidebar) — reclaim full width */
.app-main.app-main--solo {
  margin-left: 0;
  width: 100%;
  max-width: none;
}

.content {
  flex: 1;
  padding: var(--space-4);
}

/* System announcements (Admin → Communication → Announcements) */
.app-announcements {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4) 0;
}
.app-announcements[hidden] { display: none; }
.app-announcement {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-info-border, var(--color-border));
  background: var(--color-info-soft);
  color: var(--color-info-text, var(--color-text));
  box-shadow: var(--shadow-xs);
}
.app-announcement__body { flex: 1; min-width: 0; }
.app-announcement__title {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.app-announcement__message {
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.app-announcement__dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
.app-announcement__dismiss:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
}
:root[data-theme="dark"] .app-announcement__dismiss:hover {
  background: rgba(255, 255, 255, 0.08);
}

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  max-height: var(--topbar-h);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--space-4);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--color-border-subtle), 0 2px 8px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.topbar__title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.topbar__tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
  min-width: 0;
  flex-wrap: nowrap;
}

.topbar__tools .searchbox {
  position: relative;
  z-index: 5;
  flex: 0 1 auto;
  min-width: 0;
}
.topbar__tools .searchbox input {
  width: min(200px, 100%);
}

/* Title left · tools right; logo overlaid in the middle (does not wrap the bar) */
.topbar--branded {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  position: relative;
  gap: var(--space-2);
}
.topbar--branded .topbar__title {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 38%;
  position: relative;
  z-index: 2;
}
.topbar-brand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  text-align: center;
  max-width: 7rem;
  line-height: 0;
}
.topbar--branded .topbar__tools {
  flex: 0 1 auto;
  margin-left: auto;
  min-width: 0;
  max-width: 58%;
  justify-content: flex-end;
  position: relative;
  z-index: 2;
}
.topbar-brand__logo__img {
  max-height: 40px;
  max-width: 2.75rem;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  opacity: 1;
  image-rendering: auto;
}
.topbar-brand__logo__text {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

@media (max-width: 1100px) {
  .topbar--branded .topbar__title { max-width: 32%; }
  .topbar--branded .topbar__tools { max-width: 62%; }
  .topbar-brand { max-width: 5.5rem; }
  .topbar-brand__logo__img {
    max-height: 24px;
    max-width: 5.25rem;
  }
}

@media (max-width: 900px) {
  .topbar-brand__logo__img {
    max-height: 22px;
    max-width: 4.5rem;
    opacity: 1;
  }
  .topbar-brand__logo__text { opacity: 1; }
}

@media (max-width: 720px) {
  .topbar-brand { display: none; }
  .topbar--branded .topbar__title { max-width: 40%; }
  .topbar--branded .topbar__tools { max-width: 60%; }
}

.topbar__user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 3px;
  border-radius: 999px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  cursor: default;
}
.topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, #2563c4 100%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(31, 95, 178, 0.3);
}
.topbar__avatar--has-photo {
  background: #fff;
  box-shadow: 0 0 0 1px var(--color-border), 0 1px 3px rgba(15, 23, 42, 0.12);
}
.topbar__avatar--wide {
  width: auto;
  min-width: 44px;
  max-width: 72px;
  height: 32px;
  border-radius: 8px;
  padding: 2px 6px;
}
.topbar__avatar--tall {
  width: 28px;
  height: 36px;
  border-radius: 8px;
}
.topbar__avatar-img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}
.topbar__avatar--wide .topbar__avatar-img,
.topbar__avatar--tall .topbar__avatar-img {
  object-fit: contain;
  object-position: center;
}

/* Live date/time clock in the topbar */
.topbar__clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  line-height: 1.05;
  user-select: none;
}
.topbar__clock-icon {
  display: inline-flex;
  align-items: center;
  color: var(--color-primary);
  flex-shrink: 0;
}
.topbar__clock-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar__clock-time {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.topbar__clock-date {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
}

@media (max-width: 1100px) {
  .topbar__clock-date { display: none; }
  .topbar__clock { padding: 6px 10px; }
}
@media (max-width: 900px) {
  .topbar__clock { display: none; }
  .topbar__user { max-width: 100px; }
}
.topbar__user {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 0;
  text-decoration: none;
}
.bell:hover { text-decoration: none; }

.topbar__bell {
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  padding: 0;
  color: var(--color-primary);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-xs);
  transition: background var(--transition-fast), transform var(--transition-fast),
              box-shadow var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar__bell:hover {
  background: var(--color-primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 95, 178, 0.2);
  text-decoration: none;
}
.topbar__bell:focus-visible {
  outline: 3px solid rgba(31, 95, 178, 0.32);
  outline-offset: 2px;
}
button.topbar__bell {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
}
.bell__svg { display: block; }

/* Theme toggle (light / dark) */
.topbar__theme {
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  padding: 0;
  color: var(--color-primary);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast),
              box-shadow var(--transition-fast);
}
.topbar__theme:hover {
  background: var(--color-primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 95, 178, 0.2);
}
.topbar__theme:focus-visible {
  outline: 3px solid rgba(31, 95, 178, 0.32);
  outline-offset: 2px;
}
.topbar__theme svg { width: 19px; height: 19px; display: block; }
.topbar__theme .theme-icon--sun { display: none; }
:root[data-theme="dark"] .topbar__theme .theme-icon--sun { display: block; }
:root[data-theme="dark"] .topbar__theme .theme-icon--moon { display: none; }
.bell__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: #fff;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  padding: 0 5px;
  min-width: 18px;
  height: 18px;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
  border: 2px solid var(--color-surface);
  box-shadow: 0 1px 4px rgba(192, 57, 43, 0.4);
}
.bell__badge[hidden] { display: none; }

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 150;
  background: var(--gradient-sidebar);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-sidebar-border);
  overflow: hidden;
  transition: width var(--transition-base);
}

.sidebar__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: stretch;
  padding: var(--space-2) var(--space-2) 2px;
  border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--color-sidebar-border);
  border-radius: var(--radius-md);
  background: var(--color-sidebar-surface);
  color: var(--color-sidebar-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.sidebar__toggle:hover {
  background: var(--color-sidebar-link-active);
  border-color: rgba(255,255,255,0.24);
  color: var(--color-sidebar-active);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 4px 10px rgba(6, 14, 29, 0.28);
  transform: translateY(-1px);
}
.sidebar__toggle:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.sidebar__toggle:focus-visible {
  outline: 2px solid var(--color-sidebar-active);
  outline-offset: 2px;
}
.sidebar__toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
}
.sidebar__toggle-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
html[data-sidebar="collapsed"] .sidebar__toggle-icon--collapse { display: none; }
html[data-sidebar="expanded"] .sidebar__toggle-icon--expand { display: none; }
.sidebar__toggle-label {
  white-space: nowrap;
  color: inherit;
}

@media (min-width: 901px) {
  html[data-sidebar="collapsed"] .sidebar {
    width: var(--sidebar-width-narrow);
  }
  html[data-sidebar="collapsed"] .app-main {
    margin-left: var(--sidebar-width-narrow);
  }
  html[data-sidebar="collapsed"] .app-main.app-main--solo {
    margin-left: 0;
  }
  html[data-sidebar="collapsed"] .sidebar__head {
    justify-content: center;
    padding: var(--space-2) 4px 0;
  }
  html[data-sidebar="collapsed"] .sidebar__toggle {
    justify-content: center;
    padding: 9px;
    width: 100%;
  }
  html[data-sidebar="collapsed"] .sidebar__toggle-label,
  html[data-sidebar="collapsed"] .sidebar__label,
  html[data-sidebar="collapsed"] .sidebar__user-block,
  html[data-sidebar="collapsed"] .sidebar__brand {
    display: none;
  }
  html[data-sidebar="collapsed"] .sidebar__nav {
    padding: var(--space-1) 4px;
  }
  html[data-sidebar="collapsed"] .sidebar__link {
    justify-content: center;
    padding: 10px;
    gap: 0;
  }
  html[data-sidebar="collapsed"] .sidebar__badge {
    position: absolute;
    top: 4px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.6rem;
  }
  html[data-sidebar="collapsed"] .sidebar__link:hover {
    transform: none;
  }
  html[data-sidebar="collapsed"] .sidebar__nav-heading {
    display: none;
  }
  html[data-sidebar="collapsed"] .sidebar__nav-divider {
    margin: var(--space-1) 6px;
  }
  html[data-sidebar="collapsed"] .sidebar__footer {
    padding: var(--space-2) 4px;
  }
  html[data-sidebar="collapsed"] .sidebar__footer .sidebar__link {
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .sidebar__head,
  .sidebar__toggle-label {
    display: none;
  }
}

.sidebar__brand {
  display: block;
  padding: 16px 14px 12px;
  text-decoration: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo {
  font-weight: 700;
  color: var(--color-text);
  font-size: 1.05rem;
}
.sidebar__logo__plate {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  border: none;
  transition: transform var(--transition-base);
}
.sidebar__brand:hover .sidebar__logo__plate {
  transform: translateY(-1px);
}
.sidebar__logo__img {
  max-height: 42px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.sidebar__logo__text {
  font-weight: 700;
  color: var(--color-text);
  font-size: 1.05rem;
  display: block;
}

.sidebar__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-2) var(--space-1);
  scrollbar-width: thin;
  scrollbar-color: var(--color-sidebar-scrollbar) transparent;
  overscroll-behavior: contain;
}
.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-thumb {
  background: var(--color-sidebar-scrollbar);
  border-radius: 999px;
}

.sidebar__nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar__nav li { margin: 2px 0; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--color-sidebar-text);
  font-size: 0.9rem;
  border-left: none;
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast),
              transform var(--transition-fast);
}
.sidebar__link:hover {
  background: var(--color-sidebar-link-hover);
  color: var(--color-sidebar-active);
  text-decoration: none;
  transform: translateX(2px);
}
.sidebar__link.is-active {
  background: var(--color-sidebar-link-active);
  color: var(--color-sidebar-active);
  font-weight: 600;
}
.sidebar__icon { flex-shrink: 0; opacity: 0.82; }
.sidebar__link.is-active .sidebar__icon { opacity: 1; }
.sidebar__label { flex: 1; line-height: 1.3; }
.sidebar__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.sidebar__badge[hidden] { display: none; }
.sidebar__link.is-active .sidebar__badge {
  box-shadow: 0 0 0 2px var(--color-sidebar-link-active);
}
.sidebar__link--logout {
  font-size: 0.87rem;
  opacity: 0.88;
}
.sidebar__link--impersonation-exit {
  background: var(--color-purple-soft);
  color: var(--color-purple-text);
  font-weight: 600;
}
.sidebar__link--impersonation-exit:hover {
  background: var(--color-purple-soft);
  color: var(--color-purple-text);
  filter: brightness(0.96);
}
.sidebar__link--impersonation-exit .sidebar__icon {
  color: var(--color-purple-text);
}

.sidebar__nav-divider {
  height: 1px;
  background: var(--color-sidebar-border);
  margin: var(--space-2) var(--space-2);
  list-style: none;
}

.sidebar__nav-heading {
  list-style: none;
  padding: var(--space-1) 14px var(--space-1);
}
.sidebar__nav-heading .sidebar__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-sidebar-heading);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .sidebar__nav-heading { display: none; }
  .sidebar__nav-divider { margin: var(--space-1) 6px; }
}

.sidebar__footer {
  flex-shrink: 0;
  padding: var(--space-3);
  border-top: 1px solid var(--color-sidebar-border);
  background: transparent;
}
.sidebar__user-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-sidebar-surface);
  border: 1px solid var(--color-sidebar-border);
}
.sidebar__user {
  font-weight: 600;
  color: var(--color-sidebar-active);
  font-size: 0.88rem;
  line-height: 1.35;
}
.sidebar__user-title {
  font-size: 0.74rem;
  color: var(--color-sidebar-text);
  display: block;
  margin-top: 1px;
  line-height: 1.35;
}

.card,
.placeholder-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}

.fx-usd-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-muted);
  line-height: 1.3;
}
.fx-official-chip {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm, 4px);
  background: var(--color-info-soft, transparent);
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 600;
}
.fx-official-hint { margin: 4px 0 0; }
.right { text-align: right; }

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form__label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form__input:hover,
.form__select:hover,
.form__textarea:hover {
  border-color: var(--color-border-strong);
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.form__input--readonly,
.form__input[readonly] {
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
  cursor: default;
  border-style: dashed;
}

.form__input--readonly:hover,
.form__input[readonly]:hover {
  border-color: var(--color-border);
}

.form__input--readonly:focus,
.form__input[readonly]:focus {
  border-color: var(--color-border);
  box-shadow: none;
}

.form__input--readonly.is-provisional {
  font-style: italic;
}

.form__textarea {
  min-height: 96px;
  resize: vertical;
}

.form__check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.approver-tools {
  border-color: var(--color-border, #d0d5dd);
}
.approver-tools__row {
  margin-top: var(--space-1, 6px);
  display: flex;
  align-items: center;
  gap: var(--space-2, 10px);
  flex-wrap: wrap;
}
.approver-tools__docs {
  margin-top: var(--space-2, 10px);
}
.approver-doc__del {
  margin-left: var(--space-1, 6px);
  color: var(--color-danger, #b42318);
}

.req-notify-recipients {
  margin: var(--space-3, 12px) 0;
}
.notify-recipients__hint {
  margin: 0 0 var(--space-2, 8px);
  font-size: 0.9em;
}
.notify-recipients__actions {
  margin-bottom: var(--space-2, 8px);
}
.notify-recipients--readonly .form__check {
  cursor: default;
}
.notify-recipients__hint {
  margin: 0 0 var(--space-2, 8px);
  font-size: 0.9em;
}
.notify-recipients__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.notify-recipients__list li {
  padding: 2px 0;
}
.notify-recipients__list .nr-name {
  font-weight: 600;
}
.notify-recipients__list .nr-reason::before {
  content: "· ";
}
.notify-recipients__list .nr-email {
  font-weight: 400;
}

.proc-mail-editor {
  margin: var(--space-3, 12px) 0;
}
.proc-mail-editor__hint {
  margin: 0 0 var(--space-3, 12px);
  font-size: 0.9em;
  max-width: 62ch;
}
.proc-mail-editor__client {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-1, 0 1px 4px rgba(15, 23, 42, 0.08));
}
.proc-mail-editor__meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--color-surface-raised);
  border-bottom: 1px solid var(--color-border-subtle);
}
.proc-mail-editor__row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  align-items: center;
  gap: var(--space-2, 8px);
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  font-weight: 500;
}
.proc-mail-editor__row:last-child { border-bottom: 0; }
.proc-mail-editor__k {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.proc-mail-editor__v {
  color: var(--color-text);
  font-size: 0.92rem;
  word-break: break-word;
}
.proc-mail-editor__subject {
  width: 100%;
  font-weight: 600;
}
.proc-mail-editor__preview {
  background: var(--color-surface-raised);
}
.proc-mail-editor__preview-label {
  padding: 8px 16px 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.proc-mail-editor__iframe {
  display: block;
  width: 100%;
  height: 380px;
  border: 0;
  background: var(--color-surface-raised);
}
.proc-mail-editor__compose {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  font-weight: 600;
  font-size: 0.9rem;
}
.proc-mail-editor__body {
  min-height: 14em;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  background: var(--color-surface-raised);
}
@media (max-width: 640px) {
  .proc-mail-editor__row {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 4px;
  }
}

.form__label.is-invalid .form__input,
.form__label.is-invalid .form__select,
.form__label.is-invalid .form__textarea {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 2px rgba(192, 55, 44, 0.15);
}

.line-field.is-invalid .line-field__input,
.line-field.is-invalid .line-field__input:disabled {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 2px rgba(192, 55, 44, 0.15);
}

.fieldset.is-invalid {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 2px rgba(192, 55, 44, 0.12);
}

.fieldset.is-invalid > .field-error {
  display: block;
  margin: 0 0 var(--space-2);
}

#attachRow.is-invalid {
  outline: 2px solid rgba(192, 55, 44, 0.35);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
  padding: var(--space-2);
}

.field-error {
  color: var(--color-danger);
  font-weight: 500;
  font-size: 0.82rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-3);
}

.fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--color-surface-raised);
}
.fieldset legend {
  font-weight: 700;
  padding: 0 var(--space-2);
  color: var(--color-primary-dark);
  font-size: 0.875rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--btn-radius);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-btn-bg);
  color: var(--color-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: background var(--transition-fast), transform var(--transition-fast),
              box-shadow var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover {
  background: var(--color-btn-bg-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
  text-decoration: none;
}
.btn:active { transform: translateY(0); box-shadow: none; }

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #2563c4 60%, var(--color-primary-dark) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(31, 95, 178, 0.32);
}
.btn--primary:hover {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  box-shadow: 0 6px 18px rgba(31, 95, 178, 0.38);
}

.btn--danger {
  background: var(--color-danger);
  color: #fff;
  border-color: transparent;
}
.btn--danger:hover { background: #a32e25; }

.btn--success {
  background: var(--color-success);
  color: #fff;
  border-color: transparent;
}
.btn--success:hover {
  filter: brightness(1.06);
}

.btn--info {
  background: var(--color-info);
  color: #fff;
  border-color: transparent;
}
.btn--info:hover {
  background: var(--color-info);
  color: #fff;
  filter: brightness(1.08);
}

.btn--warning {
  background: var(--color-warning);
  color: #fff;
  border-color: transparent;
}
.btn--warning:hover {
  background: var(--color-warning);
  color: #fff;
  filter: brightness(1.08);
}

.btn--accent {
  background: var(--color-accent);
  color: #fff;
  border-color: transparent;
}
.btn--accent:hover {
  background: var(--color-accent);
  color: #fff;
  filter: brightness(1.08);
}

.btn--purple {
  background: var(--color-purple);
  color: #fff;
  border-color: transparent;
}
.btn--purple:hover {
  background: var(--color-purple);
  color: #fff;
  filter: brightness(1.08);
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--color-border);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--color-surface-hover); }

.btn--sm {
  padding: 4px 12px;
  font-size: 0.82rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-fast);
}
.link-btn:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.alert {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
  font-size: 0.9rem;
  line-height: 1.5;
}
.alert--error,
.alert--danger {
  background: var(--color-danger-soft);
  color: var(--color-danger-text);
  border: 1px solid var(--color-danger-border);
}
.alert--success {
  background: var(--color-success-soft);
  color: var(--color-success-text);
  border: 1px solid var(--color-success-border);
}
.alert--info {
  background: var(--color-info-soft);
  color: var(--color-info-text);
  border: 1px solid var(--color-info-border);
}
.alert--warning {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
  border: 1px solid var(--color-warning-border);
}

.notice {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  margin: var(--space-2) 0;
  font-size: 0.9rem;
}
.notice--ok,
.notice--success { background: var(--color-success-soft); color: var(--color-success-text); border: 1px solid var(--color-success-border); }
.notice--info    { background: var(--color-info-soft); color: var(--color-info-text); border: 1px solid var(--color-info-border); }
.notice--warn    { background: var(--color-warning-soft); color: var(--color-warning-text); border: 1px solid var(--color-warning-border); }
.notice--bad,
.notice--error,
.notice--danger  { background: var(--color-danger-soft); color: var(--color-danger-text); border: 1px solid var(--color-danger-border); }

.impersonation-banner {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 260;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px var(--space-4);
  background: linear-gradient(90deg, #5b21b6 0%, #6d28d9 100%);
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.impersonation-banner__text strong { font-weight: 600; }
.impersonation-banner__meta {
  opacity: 0.85;
  font-size: 0.8125rem;
  margin-left: 0.35rem;
}
.impersonation-banner--super {
  background: linear-gradient(90deg, #1e40af 0%, #2563eb 100%);
}
.impersonation-banner__tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.impersonation-banner__exit {
  flex-shrink: 0;
  background: #ffffff;
  color: #5b21b6;
  border-color: #ffffff;
}
.impersonation-banner__exit:hover {
  background: #f3e8ff;
  color: #4c1d95;
}

table { border-collapse: collapse; width: 100%; }
th, td {
  text-align: left;
  padding: 10px var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
th {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: var(--color-text-secondary);
  background: var(--color-thead-bg);
  white-space: nowrap;
}
tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: var(--color-surface-hover); }
tbody tr:nth-child(even) { background: var(--color-surface-stripe); }
tbody tr:nth-child(even):hover { background: var(--color-surface-hover); }

.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: auto;
  box-shadow: var(--shadow-1);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar) transparent;
}
.table-wrap::-webkit-scrollbar { width: 7px; height: 7px; }
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar);
  border-radius: 999px;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--color-scrollbar-hover); }

.table-wrap table { min-width: 640px; }

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.row-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--color-btn-bg);
  color: var(--color-text-secondary);
}
.badge--on  { background: var(--color-success-soft); color: var(--color-success-text); }
.badge--off { background: var(--color-danger-soft); color: var(--color-danger-text); }

.twm-flags { list-style: none; margin: 0 0 var(--space-3, 16px); padding: 0; display: flex; flex-direction: column; gap: 6px; }
.twm-flag { padding: 8px 12px; border-radius: 6px; font-size: 0.85rem; border-left: 3px solid; }
.twm-flag--warn { background: var(--color-warning-soft); border-color: var(--color-warning); color: var(--color-warning-text); }
.twm-flag--error { background: var(--color-danger-soft); border-color: var(--color-danger); color: var(--color-danger-text); }

.urg-low      { background: var(--color-btn-bg); color: var(--color-text-secondary); }
.urg-medium   { background: var(--color-info-soft); color: var(--color-info-text); }
.urg-high     { background: var(--color-warning-soft); color: var(--color-warning-text); }
.urg-critical { background: var(--color-danger-soft); color: var(--color-danger-text); }

.st-approved,
.st-paid,
.st-closed,
.st-collected          { background: var(--color-success-soft); color: var(--color-success-text); }
.st-rejected,
.st-cancelled          { background: var(--color-danger-soft); color: var(--color-danger-text); }
.st-pending,
.st-draft,
.st-submitted          { background: var(--color-info-soft); color: var(--color-info-text); }
.st-processing,
.st-invoice_processing,
.st-issued             { background: var(--color-warning-soft); color: var(--color-warning-text); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 28, 50, 0.52);
  backdrop-filter: blur(3px);
}

.modal__dialog {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-3), 0 0 0 1px var(--modal-border);
  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar) transparent;
}
.modal__dialog--wide { max-width: 780px; }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-raised);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.modal__header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.modal__header .req-open-full {
  margin-left: auto;
  margin-right: var(--space-2);
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 7px 16px;
  letter-spacing: 0.01em;
}

.modal__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.modal__close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.modal__tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.modal__tab {
  border: none;
  background: none;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: 0.9rem;
  color: var(--color-muted);
  border-bottom: 3px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.modal__tab.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

.utab-panel { display: none; }
.utab-panel.is-active { display: block; }

.toast-stack {
  position: fixed;
  right: var(--space-3);
  bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 2500;
}
.toast {
  background: var(--color-toast-bg);
  color: #fff;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  min-width: 220px;
  font-size: 0.9rem;
  font-weight: 500;
}
.toast--error   { background: var(--color-danger); }
.toast--info    { background: var(--color-primary); }
.toast--success { background: linear-gradient(135deg, #1a7a4a, #157a48); }

.searchbox { position: relative; }
.searchbox input {
  width: 240px;
  max-width: 50vw;
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.searchbox input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}
.searchbox__results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  max-width: 90vw;
  max-height: 55vh;
  overflow: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  z-index: 1500;
}
.searchbox__results[hidden] { display: none; }
.search-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border-subtle);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  transition: background var(--transition-fast);
}
.search-item:hover { background: var(--color-surface-hover); }
.search-item small { color: var(--color-muted); }

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 var(--space-4);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}
.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: var(--space-3) var(--space-3);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-muted);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab:hover { color: var(--color-text); }
.tab.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.tab[hidden] { display: none; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-1);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.stat-card:hover {
  box-shadow: var(--shadow-2);
}
.stat-card__value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.1;
  margin-bottom: var(--space-1);
}
.stat-card__label {
  font-size: 0.78rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 6px;
}

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.notif-list li.is-unread { background: var(--color-surface-hover); }
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--color-border);
  flex: none;
}
.notif-list li.is-unread .notif-dot { background: var(--color-primary); }
.notif-body { flex: 1; min-width: 0; }
.notif-body .notif-meta { font-size: 0.78rem; color: var(--color-muted); }

/* Inbox cards — used on Notifications, Home, and the top-bar bell. */
.notif-inbox { max-width: none; width: 100%; }
.notif-inbox__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.notif-inbox__eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
}
.notif-inbox__titleblock h2 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.notif-inbox__lede {
  margin: 0;
  max-width: 58ch;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--color-muted);
}
.notif-inbox__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.notif-inbox__count {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.notif-inbox__toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--overlay-veil);
  border: 1px solid var(--curtain-border);
  box-shadow: var(--shadow-inset), var(--shadow-xs);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
}
.notif-inbox__search { position: relative; }
.notif-inbox__search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--color-muted);
  pointer-events: none;
}
.notif-inbox__search .form__input {
  width: 100%;
  padding-left: 38px;
  background: var(--curtain-bg);
  border-color: var(--curtain-border);
  box-shadow: var(--shadow-inset);
}
.notif-inbox__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.notif-inbox__chip {
  border: 1px solid var(--curtain-border);
  background: var(--curtain-bg);
  color: var(--color-text-secondary);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.notif-inbox__chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.notif-inbox__chip.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.notif-inbox__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.notif-inbox__group { display: flex; flex-direction: column; gap: 8px; }
.notif-inbox__day {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  border-radius: var(--radius-md);
  background: var(--overlay-veil);
  border: 1px solid var(--curtain-border);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.notif-inbox__day::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--curtain-border);
}
.notif-inbox__day-count {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 700;
  color: var(--color-text-secondary);
}
.notif-inbox__group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid var(--curtain-border);
  border-radius: var(--radius-lg);
  background: var(--overlay-veil);
  overflow: hidden;
  box-shadow: var(--shadow-inset), var(--shadow-1);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
.notif-inbox__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}
.notif-inbox__item:last-child { border-bottom: 0; }
.notif-inbox__item:hover,
.notif-inbox__item:focus-visible { background: var(--curtain-bg); }
.notif-inbox__item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--color-primary);
}
.notif-inbox__item.is-unread { box-shadow: inset 3px 0 0 var(--color-primary); }
.notif-inbox__item.is-unread .notif-inbox__message { font-weight: 700; }
.notif-inbox__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.notif-inbox__icon svg { width: 18px; height: 18px; }
.notif-inbox__icon--primary { background: var(--color-primary-light); color: var(--color-primary); }
.notif-inbox__icon--ok { background: var(--color-success-soft); color: var(--color-success-text, var(--color-success)); }
.notif-inbox__icon--warn { background: var(--color-warning-soft); color: var(--color-warning-text); }
.notif-inbox__icon--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.notif-inbox__icon--info { background: var(--color-info-soft); color: var(--color-info-text); }
.notif-inbox__body { min-width: 0; }
.notif-inbox__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.notif-inbox__message {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-inbox__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.78rem;
}
.notif-inbox__type {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--color-btn-bg);
  color: var(--color-text-secondary);
}
.notif-inbox__type--ok { background: var(--color-success-soft); color: var(--color-success-text, var(--color-success)); }
.notif-inbox__type--warn { background: var(--color-warning-soft); color: var(--color-warning-text); }
.notif-inbox__type--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.notif-inbox__type--info { background: var(--color-info-soft); color: var(--color-info-text); }
.notif-inbox__type--primary { background: var(--color-primary-light); color: var(--color-primary); }
.notif-inbox__ref {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 700;
  background: var(--curtain-bg);
  border: 1px solid var(--curtain-border);
  color: var(--color-text-secondary);
}
.notif-inbox__time {
  flex: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}
.notif-inbox__go {
  align-self: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  opacity: 0;
}
.notif-inbox__item:hover .notif-inbox__go,
.notif-inbox__item:focus-visible .notif-inbox__go { opacity: 1; }
.notif-inbox__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: var(--space-5) var(--space-4);
  text-align: center;
  border: 1px solid var(--curtain-border);
  border-radius: var(--radius-lg);
  background: var(--overlay-veil);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}
.notif-inbox__list--compact { gap: 8px; }
.notif-inbox__list--compact .notif-inbox__item,
.ooo-notif-list .notif-inbox__item {
  padding: 10px 12px;
  border: 1px solid var(--curtain-border);
  border-radius: var(--radius-md);
  background: var(--overlay-veil);
  box-shadow: var(--shadow-inset);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.notif-inbox__item--compact .notif-inbox__go { display: none; }

.topbar-notif { position: relative; }
.topbar-notif__panel {
  position: fixed;
  z-index: 5000;
  width: min(440px, calc(100vw - 20px));
  max-height: min(72vh, 540px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--overlay-veil);
  border: 1px solid var(--curtain-border);
  box-shadow: var(--shadow-inset), var(--shadow-3);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
}
.topbar-notif__panel[hidden] { display: none !important; }
.topbar__bell { cursor: pointer; }
.topbar-notif__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--curtain-border);
  flex: none;
}
.topbar-notif__head strong { font-size: 0.95rem; }
.topbar-notif__list {
  overflow: auto;
  padding: 10px;
  gap: 8px;
  flex: 1;
}
.topbar-notif__list .notif-inbox__go { display: none; }

.notify-curtain__item.notif-inbox__item {
  display: grid;
  grid-template-columns: auto 1fr;
  margin-bottom: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--curtain-border);
  background: var(--overlay-veil);
  padding: 12px 14px 0;
}
.notify-curtain__item .notify-curtain__progress {
  grid-column: 1 / -1;
  margin: 10px -14px 0;
}

.summary {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}
.summary dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px var(--space-3);
  margin: 0;
}
.summary dt { font-weight: 600; color: var(--color-muted); }

.timeline { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.timeline li {
  padding: var(--space-2) 0 var(--space-2) var(--space-3);
  border-left: 2px solid var(--color-border);
  margin-left: 6px;
}
.timeline .tl-meta { font-size: 0.78rem; color: var(--color-muted); }

.empty-state {
  text-align: center;
  padding: 48px var(--space-4);
  color: var(--color-muted);
}
.empty-state::before {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px;
  opacity: 0.7;
}
.empty-state__icon { display: none; }
.empty-state__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-secondary, #4a5568);
  margin: 0 0 6px;
}
.empty-state__text {
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 38ch;
  margin: 0 auto 20px;
}

@media (max-width: 900px) {
  .sidebar {
    width: var(--sidebar-width-narrow);
  }
  .app-main {
    margin-left: var(--sidebar-width-narrow);
  }
  .app-main.app-main--solo {
    margin-left: 0;
  }
  .sidebar__label,
  .sidebar__user-block,
  .sidebar__brand { display: none; }
  .sidebar__nav { padding: var(--space-1) 4px; }
  .sidebar__link {
    justify-content: center;
    padding: 10px;
    gap: 0;
  }
  .sidebar__link:hover { transform: none; }
  .sidebar__footer {
    padding: var(--space-2) 4px;
  }
  .sidebar__footer .sidebar__link {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  /* Phone content density only — navigation is the ≤900px drawer, not a bottom bar. */
  .content {
    padding: var(--space-3);
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar__title { font-size: 1.05rem; }
  .searchbox input { width: 160px; }
  .summary dl { grid-template-columns: 1fr; }
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: -0.02em;
  user-select: none;
  background: linear-gradient(135deg, var(--color-primary) 0%, #2563c4 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(31, 95, 178, 0.3);
}
.avatar--xs  { width: 24px; height: 24px; font-size: 0.6rem; }
.avatar--sm  { width: 32px; height: 32px; font-size: 0.72rem; }
.avatar--md  { width: 40px; height: 40px; font-size: 0.85rem; }
.avatar--lg  { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar--xl  { width: 68px; height: 68px; font-size: 1.4rem; }
.avatar--green   { background: linear-gradient(135deg, #1a7a4a, #22a061); }
.avatar--purple  { background: linear-gradient(135deg, #7c3aed, #9f67fa); }
.avatar--orange  { background: linear-gradient(135deg, #b45309, #f59e0b); }
.avatar--teal    { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.avatar--red     { background: linear-gradient(135deg, #c0372c, #e04438); }
.avatar--img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.avatar-group {
  display: flex;
  align-items: center;
}
.avatar-group .avatar {
  border: 2px solid var(--color-surface);
  margin-left: -8px;
  transition: transform var(--transition-fast), z-index 0s;
}
.avatar-group .avatar:first-child { margin-left: 0; }
.avatar-group .avatar:hover { transform: translateY(-2px); z-index: 10; }

.progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-primary), #4a90e2);
  transition: width 0.6s ease;
}
.progress-bar--success .progress-bar__fill { background: linear-gradient(90deg, #1a7a4a, #34d399); }
.progress-bar--warning .progress-bar__fill { background: linear-gradient(90deg, #b45309, #f59e0b); }
.progress-bar--danger  .progress-bar__fill { background: linear-gradient(90deg, #c0372c, #e04438); }
.progress-bar--thin    { height: 4px; }
.progress-bar--thick   { height: 12px; }

.app-progress {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}
.app-progress.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.app-progress.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.app-progress__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--color-text) 22%, transparent);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
}
.app-progress__card {
  position: relative;
  z-index: 1;
  width: min(340px, 92vw);
  padding: 32px 28px 24px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 18%, var(--color-border));
  box-shadow:
    var(--shadow-3),
    0 0 0 1px color-mix(in srgb, #fff 40%, transparent) inset,
    0 0 80px color-mix(in srgb, var(--color-primary) 20%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: center;
  transform: translateY(10px) scale(0.96);
  transition: transform 0.38s var(--transition-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
}
.app-progress.is-active .app-progress__card {
  transform: translateY(0) scale(1);
}
.app-progress__orb {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 18px;
}
.app-progress__glow {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-primary) 28%, transparent);
  filter: blur(14px);
  animation: app-progress-pulse 1.8s ease-in-out infinite;
}
.app-progress__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--color-primary) 18%, transparent);
  border-top-color: var(--color-primary);
  border-right-color: color-mix(in srgb, var(--color-primary) 55%, transparent);
  animation: app-progress-orbit 1.15s linear infinite;
}
.app-progress__ring--mid {
  inset: 12px;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: var(--color-primary);
  border-left-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
  animation-duration: 1.7s;
  animation-direction: reverse;
}
.app-progress__core {
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: var(--gradient-primary);
  box-shadow: 0 0 22px color-mix(in srgb, var(--color-primary) 50%, transparent);
  animation: app-progress-pulse 1.6s ease-in-out infinite;
}
.app-progress__action {
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.app-progress__track {
  height: 6px;
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-border-subtle, var(--color-border)));
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}
.app-progress__bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gradient-primary);
  box-shadow: 0 0 12px color-mix(in srgb, var(--color-primary) 45%, transparent);
  transition: width 0.2s ease;
}
.app-progress__pct {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.12em;
}
.app-progress__spinner { display: none; }
body.app-progress-open {
  overflow: hidden;
}
@keyframes app-progress-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .app-progress__bar { transition: none; }
  .app-progress__ring,
  .app-progress__glow,
  .app-progress__core { animation: none; }
  .app-progress__card { transition: none; }
  .skeleton,
  .skeleton-line,
  .skeleton-cell,
  .skeleton-avatar { animation: none; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid rgba(31, 95, 178, 0.18);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.chip:hover { background: var(--color-info-soft); box-shadow: 0 2px 8px rgba(31,95,178,0.12); }
.chip--green  { background: var(--color-success-soft); color: var(--color-success-text); border-color: var(--color-success-border); }
.chip--orange { background: var(--color-warning-soft); color: var(--color-warning-text); border-color: var(--color-warning-border); }
.chip--red    { background: var(--color-danger-soft); color: var(--color-danger-text); border-color: var(--color-danger-border); }
.chip--gray   { background: var(--color-btn-bg); color: var(--color-text-secondary); border-color: var(--color-border); }
.chip__close {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity var(--transition-fast);
  background: rgba(0,0,0,0.12);
}
.chip__close:hover { opacity: 0.85; }

.btn-group {
  display: inline-flex;
  border-radius: var(--btn-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}
.btn-group .btn {
  border-radius: 0;
  border-right-width: 0;
  box-shadow: none;
  margin: 0;
}
.btn-group .btn:first-child { border-radius: var(--btn-radius) 0 0 var(--btn-radius); }
.btn-group .btn:last-child  { border-radius: 0 var(--btn-radius) var(--btn-radius) 0; border-right-width: 1px; }

.req-decline {
  position: relative;
  display: inline-flex;
}
.req-decline__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.req-decline__caret {
  flex-shrink: 0;
  transition: transform var(--transition-fast, 0.15s ease);
}
.req-decline.is-open .req-decline__caret {
  transform: rotate(180deg);
}
.req-decline__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 15.5rem;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 10px);
  background: var(--color-surface);
  box-shadow: var(--shadow-2, 0 4px 16px rgba(15, 23, 42, 0.13));
}
.req-decline__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.req-decline__item strong {
  font-weight: 700;
}
.req-decline__item span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-muted);
}
.req-decline__item:hover,
.req-decline__item:focus-visible {
  background: var(--color-surface-active, var(--color-surface-raised));
  outline: none;
}

.form-field {
  position: relative;
}
.form-field__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-muted);
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
}
.form-field__icon svg { width: 16px; height: 16px; }
.form-field .form__input,
.form-field .form__select { padding-left: 38px; }
.form-field__suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: none;
}

.form__helper {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 4px;
  line-height: 1.4;
}
.form__helper--error { color: var(--color-danger); }
.form__helper--success { color: var(--color-success); }

.status-pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
}
.status-pipeline::-webkit-scrollbar { display: none; }

.sp-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
  flex-shrink: 0;
}
.sp-bubble {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  transition: all var(--transition-base);
  position: relative;
}
.sp-bubble svg { width: 16px; height: 16px; }

.sp-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  text-align: center;
  white-space: nowrap;
}

.sp-step--done .sp-bubble  { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.sp-step--done .sp-label   { color: var(--color-success); }
.sp-step--rejected .sp-bubble { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.sp-step--rejected .sp-label  { color: var(--color-danger); }

.sp-bubble--done::after,
.stepper__step--done .stepper__circle::after,
.auth-hero__list-icon::after,
.workflow-step.is-done .workflow-step__dot::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin: -1px auto 0;
}
.sp-bubble--rejected::after {
  content: '';
  display: block;
  width: 12px;
  height: 2px;
  background: var(--color-surface);
  transform: rotate(-45deg);
  position: relative;
}
.sp-bubble--rejected::before {
  content: '';
  display: block;
  width: 12px;
  height: 2px;
  background: var(--color-surface);
  transform: rotate(45deg);
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -1px 0 0 -6px;
}
.sp-bubble--done,
.sp-bubble--rejected { font-size: 0; color: transparent; }

.sp-step--active .sp-bubble {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(31,95,178,0.18), 0 4px 12px rgba(31,95,178,0.3);
  animation: sp-pulse 2.5s ease-in-out infinite;
}
.sp-step--active .sp-label { color: var(--color-primary); font-weight: 800; }
.sp-step--pending .sp-bubble { opacity: 0.5; }

@keyframes sp-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(31,95,178,0.18), 0 4px 12px rgba(31,95,178,0.3); }
  50%       { box-shadow: 0 0 0 7px rgba(31,95,178,0.1), 0 4px 16px rgba(31,95,178,0.4); }
}

.sp-connector {
  flex: 1;
  min-width: 24px;
  height: 2px;
  position: relative;
  margin-bottom: 24px;
}
.sp-connector::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 2px;
}
.sp-connector--done::before { background: linear-gradient(90deg, var(--color-success), #22a061); }
.sp-connector--active::before { background: linear-gradient(90deg, var(--color-success), var(--color-primary)); }

.sp-step--dept   .sp-bubble.sp-bubble--active-colour { background: #1d4ed8; border-color: #1d4ed8; }
.sp-step--proc   .sp-bubble.sp-bubble--active-colour { background: #065f46; border-color: #065f46; }
.sp-step--exec   .sp-bubble.sp-bubble--active-colour { background: #5b21b6; border-color: #5b21b6; }
.sp-step--stores .sp-bubble.sp-bubble--active-colour { background: #b45309; border-color: #b45309; }
.sp-step--finance .sp-bubble.sp-bubble--active-colour { background: #9d174d; border-color: #9d174d; }

.card--accent-primary { border-left: 4px solid var(--color-primary); }
.card--accent-success { border-left: 4px solid var(--color-success); }
.card--accent-warning { border-left: 4px solid var(--color-warning); }
.card--accent-danger  { border-left: 4px solid var(--color-danger); }

.card--header {
  padding: 0;
  overflow: hidden;
}
.card--header__head {
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, var(--color-primary), #2563c4);
  color: #fff;
}
.card--header__head h3 { margin: 0; color: #fff; }
.card--header__body { padding: var(--space-3) var(--space-4); }

.card--glass {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.55);
}

.card--flat { box-shadow: none; }

.info-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.info-panel__cell {
  background: var(--color-surface);
  padding: var(--space-3) var(--space-4);
}
.info-panel__label { font-size: 0.73rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); margin-bottom: 4px; }
.info-panel__value { font-size: 1.05rem; font-weight: 700; color: var(--color-text); }
.info-panel__sub   { font-size: 0.8rem; color: var(--color-muted); margin-top: 2px; }

.stat-card--icon {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.stat-card__icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.3rem;
}
.stat-card__icon-wrap--primary { background: var(--color-primary-light); color: var(--color-primary); }
.stat-card__icon-wrap--green   { background: var(--color-success-soft); color: var(--color-success-text); }
.stat-card__icon-wrap--orange  { background: var(--color-warning-soft); color: var(--color-warning-text); }
.stat-card__icon-wrap--purple  { background: var(--color-purple-soft); color: var(--color-purple-text); }
.stat-card__icon-wrap--red     { background: var(--color-danger-soft); color: var(--color-danger-text); }
.stat-card__content { flex: 1; min-width: 0; }
.stat-card__delta {
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 2px;
}
.stat-card__delta--up   { color: var(--color-success); }
.stat-card__delta--down { color: var(--color-danger); }

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  counter-reset: stepper;
  overflow-x: auto;
  scrollbar-width: none;
}
.stepper::-webkit-scrollbar { display: none; }
.stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 80px;
  counter-increment: stepper;
}
.stepper__circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  transition: all var(--transition-base);
}
.stepper__circle::before { content: counter(stepper); }
.stepper__label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  text-align: center;
  white-space: nowrap;
}
.stepper__connector {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  min-width: 20px;
  margin-bottom: 22px;
  transition: background var(--transition-base);
}
.stepper__step--done .stepper__circle {
  background: var(--color-success);
  border-color: var(--color-success);
  color: transparent;
  font-size: 0;
}
.stepper__step--done .stepper__circle::before { content: none; }
.stepper__step--done .stepper__circle::after {
  margin-top: -2px;
}
.stepper__step--done + .stepper__connector { background: var(--color-success); }
.stepper__step--done .stepper__label { color: var(--color-success); }
.stepper__step--active .stepper__circle {
  background: var(--color-surface);
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: 0 0 0 5px var(--color-accent-soft);
  animation: seal-pulse 2.4s ease-in-out infinite;
}
.stepper__step--active .stepper__label { color: var(--color-accent); font-weight: 700; }
@keyframes seal-pulse {
  0%, 100% { box-shadow: 0 0 0 5px var(--color-accent-soft); }
  50%      { box-shadow: 0 0 0 9px transparent; }
}

.stepper__step--rejected .stepper__circle {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}
.stepper__step--rejected .stepper__circle::before { content: '\00d7'; font-size: 1rem; line-height: 1; }
.stepper__step--rejected .stepper__label { color: var(--color-danger-text); font-weight: 700; }

/* Saved-view filter chips (requisition lookup and other list screens) */
.view-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.view-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast),
              background var(--transition-fast), box-shadow var(--transition-fast);
}
.view-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.view-chip.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--on-primary, #fff);
  box-shadow: var(--shadow-1);
}
.view-chip__count {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.view-chip.is-active .view-chip__count { background: rgba(255, 255, 255, 0.22); }

/* Requisition list table — Keystone-style title + metadata rows */
.req-table__ref strong {
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.88rem;
}
.req-table__title { min-width: 220px; max-width: 360px; }
.req-table__title-main {
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
  margin-bottom: 2px;
}
.req-line-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 10rem;
}
.req-line-title__gl {
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.req-line-title__item,
.req-line-title__desc {
  font-size: 0.85rem;
  line-height: 1.35;
}
.req-line-title__item-main {
  font-weight: 650;
}
.req-table__title-sub {
  font-size: 0.8rem;
  color: var(--color-muted);
  line-height: 1.3;
}
.req-table__stage {
  white-space: nowrap;
  font-size: 0.78rem;
}
.req-table__amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.req-table__duration {
  font-size: 0.82rem;
  color: var(--color-text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.req-table__duration-elapsed {
  font-size: 0.75rem;
  margin-top: 0.1rem;
}
.req-table__duration--overdue {
  color: var(--color-danger-text);
  font-weight: 600;
}
.req-table__updated {
  font-size: 0.82rem;
  color: var(--color-text);
  white-space: nowrap;
}
.table-wrap table.req-table thead th {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Full-width lifecycle variant used on the requisition viewer */
.stepper--lifecycle {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-3) var(--space-3) var(--space-2);
  margin-bottom: var(--space-3);
}

.kv-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.kv-item {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}
.kv-item__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 3px;
}
.kv-item__value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
}

.user-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.user-row:hover { background: var(--color-surface-hover); }
.user-row__info { flex: 1; min-width: 0; }
.user-row__name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-row__sub {
  font-size: 0.78rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-row__actions { flex-shrink: 0; display: flex; gap: var(--space-1); }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--color-surface);
  flex-shrink: 0;
}
.status-dot--online  { background: var(--color-success); }
.status-dot--away    { background: var(--color-warning); }
.status-dot--offline { background: var(--color-border); }

.page-header {
  background: var(--color-primary-light);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4) var(--space-3);
  margin-bottom: var(--space-4);
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-primary);
}
.page-header__title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--color-text);
  margin: 0 0 4px;
}
.page-header__subtitle {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 0;
}
.page-header__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

/* ============================================================
   Command palette — global search & quick actions (Ctrl+K).
   Markup is injected by core.js; styles are token-driven so the
   palette follows the light/dark theme automatically.
   ============================================================ */
.topbar__search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-raised);
  color: var(--color-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
              color var(--transition-fast);
  white-space: nowrap;
}
.topbar__search-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-text-secondary);
  box-shadow: 0 2px 10px rgba(31, 95, 178, 0.15);
}
.topbar__search-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.topbar__search-btn kbd {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--color-muted);
}
@media (max-width: 720px) {
  .topbar__search-btn .topbar__search-label,
  .topbar__search-btn kbd { display: none; }
  .topbar__search-btn { padding: 0 11px; }
}

.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 3200;
  background: rgba(13, 19, 34, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  animation: ui-fade-in-fast 0.16s ease both;
}
.cmdk-overlay[hidden] { display: none; }

.cmdk {
  width: 600px;
  max-width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: cmdk-in 0.2s ease both;
}
@keyframes cmdk-in {
  from { opacity: 0; transform: scale(0.97) translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

.cmdk__inputwrap { position: relative; }
.cmdk__inputwrap svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--color-muted);
  pointer-events: none;
}
.cmdk__input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  color: var(--color-text);
  padding: 15px 16px 15px 44px;
  border-bottom: 1px solid var(--color-border-subtle);
}
.cmdk__input::placeholder { color: var(--color-muted); }

.cmdk__list {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar) transparent;
}
.cmdk__group {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  padding: 8px 12px 3px;
}
.cmdk__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--btn-radius);
  border: none;
  background: none;
  font: inherit;
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.cmdk__item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.75; }
.cmdk__item.is-sel {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.cmdk__item-main {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk__item-main strong { font-weight: 650; color: var(--color-text); }
.cmdk__item.is-sel .cmdk__item-main strong { color: var(--color-primary); }
.cmdk__item-sub {
  font-size: 0.78rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk__item-meta {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}
.cmdk__empty {
  padding: 22px 16px;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.88rem;
}
.cmdk__foot {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--color-border-subtle);
  color: var(--color-muted);
  font-size: 0.72rem;
}
.cmdk__foot kbd {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0 5px;
}

/* Supplier quotations — flat register panels (SX / B2B document style) */
.supplier-quote-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: var(--space-3) 0 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}
.supplier-quote-list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: var(--space-2);
  border: none;
  background: transparent;
  overflow: visible;
}
.supplier-quote-list--grid .supplier-quote {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  border-bottom: 1px solid var(--color-border);
  min-width: 0;
  overflow: hidden;
}

.supplier-quote {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
}
.supplier-quote:last-child { border-bottom: none; }
.supplier-quote--lead {
  box-shadow: inset 3px 0 0 var(--color-border);
}
.supplier-quote--rec {
  box-shadow: inset 3px 0 0 var(--color-success);
  background: var(--color-success-soft);
  outline: 1px solid var(--color-success-border);
}
.supplier-quote__tick {
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--color-success);
  color: #fff;
  flex-shrink: 0;
}
.supplier-quote--rec .supplier-quote__tick {
  display: inline-flex;
}
.supplier-quote--rec .badge--system-rec {
  display: none;
}
.supplier-quote--expandable {
  cursor: pointer;
}
.supplier-quote--expandable:hover {
  border-color: var(--color-success-border);
}
.supplier-quote--expandable:focus-visible {
  outline: 2px solid var(--color-success);
  outline-offset: 1px;
}
.supplier-quote--expandable > .supplier-quote__more {
  display: none;
  margin-top: 0.65rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--color-border-subtle);
}
.supplier-quote--expandable.is-open > .supplier-quote__more {
  display: block;
}
.supplier-quote__details {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--color-text-muted);
}
.supplier-quote__details-closed::after,
.supplier-quote__details-open::after {
  content: '';
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -0.2rem;
}
.supplier-quote__details-open::after {
  transform: rotate(-135deg);
  margin-top: 0.15rem;
}
.supplier-quote__details-open { display: none; }
.supplier-quote--expandable.is-open .supplier-quote__details-closed { display: none; }
.supplier-quote--expandable.is-open .supplier-quote__details-open { display: inline; }
.supplier-quote--partial {
  box-shadow: inset 3px 0 0 var(--color-warning);
}
.supplier-quote--incomplete {
  box-shadow: inset 3px 0 0 var(--color-danger);
}

.supplier-quote__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.25rem;
}
.supplier-quote__who {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-width: 0;
}
.supplier-quote__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.supplier-quote--lead .supplier-quote__rank {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong, var(--color-border));
  color: var(--color-text);
}
.supplier-quote__names {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.45rem;
  min-width: 0;
}
.supplier-quote__name {
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--color-text);
  word-break: break-word;
}
.supplier-quote__name a { color: inherit; text-decoration: none; }
.supplier-quote__name a:hover { color: var(--color-primary); text-decoration: underline; }
.supplier-quote__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  text-align: right;
}
.supplier-quote__total {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}
.supplier-quote__tax-note {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.25;
}
.supplier-quote__fx {
  font-size: 0.8rem;
  line-height: 1.25;
}
.supplier-quote__tax-breakdown {
  font-size: 0.8rem;
  line-height: 1.25;
  max-width: 100%;
}
.supplier-quote__flag {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
  font-size: 0.7rem;
  font-weight: 600;
}

/* Compact / grid cards: stack name above price tightly (never leave a tall gap) */
.supplier-quote--compact .supplier-quote__head,
.supplier-quote-list--grid .supplier-quote__head {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.45rem;
}
.supplier-quote--compact .supplier-quote__who,
.supplier-quote-list--grid .supplier-quote__who {
  flex: 0 0 auto;
}
.supplier-quote--compact .supplier-quote__aside,
.supplier-quote-list--grid .supplier-quote__aside {
  align-items: flex-start;
  text-align: left;
  width: 100%;
  gap: 0.2rem;
}
.supplier-quote--compact .supplier-quote__pick,
.supplier-quote-list--grid .supplier-quote__pick {
  align-self: stretch;
  margin-top: 0.15rem;
}

/* Evaluation: supplier comparison cards */
.supplier-quote-list--eval {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
  gap: 0.9rem;
  margin: var(--space-3) 0 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.supplier-quote-list--eval .supplier-quote {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  border-bottom: 1px solid var(--color-border);
  padding: 0.95rem 1.05rem 0.9rem;
  min-width: 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.supplier-quote-list--eval .supplier-quote:last-child {
  border-bottom: 1px solid var(--color-border);
}
.supplier-quote-list--eval .supplier-quote:hover {
  border-color: var(--color-success-border);
  box-shadow: var(--shadow-2);
}
.supplier-quote-list--eval .supplier-quote--lead {
  box-shadow: var(--shadow-1);
}
.supplier-quote-list--eval .supplier-quote--rec {
  background: var(--color-success-soft);
  border-color: var(--color-success);
  box-shadow: inset 4px 0 0 var(--color-success), var(--shadow-2);
  outline: none;
}
.supplier-quote-list--eval .supplier-quote--lead .supplier-quote__rank {
  background: var(--color-surface-raised);
  border-color: var(--color-border);
  color: var(--color-text);
}
.supplier-quote-list--eval .supplier-quote--rec .supplier-quote__rank {
  background: var(--color-success);
  border-color: var(--color-success);
  color: var(--color-text-inverse, #fff);
}
.supplier-quote-list--eval .supplier-quote__head {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 0;
}
.supplier-quote-list--eval .supplier-quote__who {
  flex: 0 0 auto;
  align-items: center;
}
.supplier-quote-list--eval .supplier-quote__aside {
  align-items: flex-start;
  text-align: left;
  width: 100%;
  max-width: none;
  flex: 0 0 auto;
  gap: 0.35rem;
}
.supplier-quote-list--eval .supplier-quote__total {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.supplier-quote-list--eval .supplier-quote__meta {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  line-height: 1.4;
}
.supplier-quote-list--eval .supplier-quote__docs {
  padding-top: 0.35rem;
  gap: 0.25rem 0.45rem;
  grid-template-columns: 1fr;
}
.supplier-quote-list--eval .supplier-quote__certs {
  margin-top: 0.35rem;
}
.supplier-quote-list--eval .supplier-quote__comment {
  display: block;
  margin-top: 0.55rem;
}
.supplier-quote-list--eval .supplier-quote__comment .form__textarea {
  min-height: 4.25rem;
}
.supplier-quote-list--eval .supplier-quote--expandable.is-open {
  grid-column: 1 / -1;
}
.supplier-quote-list--eval .supplier-quote__pick {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.38rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  white-space: nowrap;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--color-text);
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
  appearance: none;
  -webkit-appearance: none;
}
.supplier-quote-list--eval .supplier-quote__pick[aria-pressed="true"],
.supplier-quote-list--eval .supplier-quote--rec .supplier-quote__pick {
  border-color: var(--color-success);
  background: var(--color-success);
  color: var(--color-text-inverse, #fff);
}
.supplier-quote-list--eval .supplier-quote__pick:disabled {
  cursor: default;
  opacity: 0.85;
}
.eval-pick-summary {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
}
.eval-pick-summary strong {
  color: var(--color-success-text);
}
.supplier-quote__fold {
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--color-border-subtle);
}
.supplier-quote__fold > summary {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--color-muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.supplier-quote__fold > summary::-webkit-details-marker { display: none; }
.supplier-quote__fold > summary::after {
  content: '▸';
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--color-muted);
}
.supplier-quote__fold[open] > summary::after { content: '▾'; }
.supplier-quote__comment {
  display: block;
  width: 100%;
}
.supplier-quote__comment .form__textarea {
  margin-top: var(--space-2);
  width: 100%;
  min-height: 2.5rem;
}
.eval-compare__hint {
  margin: 0 0 var(--space-3);
}
.eval-fx {
  margin-top: var(--space-3);
}
.eval-fx__hint {
  margin: 0 0 var(--space-3);
}
.eval-fx__row {
  margin-bottom: var(--space-3);
}
.eval-fx__official {
  margin: 0.25rem 0 0;
}
.eval-fx__effect {
  margin-top: var(--space-3);
}
.eval-fx-effect table tbody tr.eval-fx-effect__lead td {
  background: var(--color-success-soft);
}
.eval-fx__save {
  margin-top: var(--space-3);
}

.supplier-quote__meta {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--color-muted);
  line-height: 1.45;
}
.supplier-quote__dot {
  margin: 0 0.4rem;
  opacity: 0.55;
}
.supplier-quote__note {
  margin: 0 0 0.65rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--color-text-secondary, var(--color-text));
}

.supplier-quote .supplier-quote-lines {
  margin: 0 0 0.75rem;
}
.supplier-quote-qty--short {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
  font-weight: 600;
}
.supplier-quote-qty-warn {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-warning-text);
}

.supplier-quote__docs {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem 0.75rem;
  align-items: start;
  padding-top: 0.65rem;
  border-top: 1px solid var(--color-border-subtle);
  font-size: 0.84rem;
}
.supplier-quote__docs-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding-top: 0.15rem;
}
.supplier-quote-docs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.supplier-quote-docs__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}
.supplier-quote-docs__cat {
  min-width: 5.5rem;
  color: var(--color-muted);
  font-size: 0.8rem;
}
.supplier-quote-docs__files a { word-break: break-word; }
.supplier-quote-docs__sep {
  margin: 0 0.25rem;
  color: var(--color-muted);
}
.supplier-quote-docs__empty {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.84rem;
}

.supplier-quote-card__upload,
.supplier-quote__upload {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--color-border);
}
.supplier-quote-card__upload .form__label,
.supplier-quote__upload .form__label {
  flex: 1 1 220px;
  margin: 0;
  font-size: 0.82rem;
}
.supplier-quote-card__pick,
.supplier-quote__pick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.supplier-quote-card__certs,
.supplier-quote__certs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 0.55rem;
}

.eval-qty--short { background: var(--color-warning-soft); color: var(--color-warning-text); font-weight: 600; }
.eval-qty-warn { color: var(--color-warning-text); font-weight: 600; font-size: 0.72rem; }

/* Compact document registry — stage groups + file rows */
.doc-registry-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
}
.doc-registry-toolbar__hint {
  margin: 0;
  font-size: 0.82rem;
}
.doc-registry-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.doc-registry-section {
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
}
.doc-registry-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface-raised);
}
.doc-registry-section__title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--color-text);
}
.doc-registry-section__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  white-space: nowrap;
}
.doc-registry-section--rq {
  border-color: var(--color-info-border, var(--color-border));
  box-shadow: inset 3px 0 0 var(--color-primary);
}
.doc-registry-section--rq .doc-registry-section__head {
  background: var(--color-info-soft);
}
.doc-registry-section--rfq {
  border-color: var(--color-warning-border, var(--color-border));
  box-shadow: inset 3px 0 0 var(--color-warning);
}
.doc-registry-section--rfq .doc-registry-section__head {
  background: var(--color-warning-soft);
}
.doc-registry-section--awarded {
  border-color: var(--color-success-border, var(--color-border));
  box-shadow: inset 3px 0 0 var(--color-success);
}
.doc-registry-section--awarded .doc-registry-section__head {
  background: var(--color-success-soft);
}
.doc-registry-section--fulfilment {
  border-color: var(--color-border);
  box-shadow: inset 3px 0 0 var(--color-info, var(--color-primary));
}
.doc-registry-section--rejected {
  border-color: var(--color-border);
  box-shadow: inset 3px 0 0 var(--color-muted);
}
.doc-registry-section--collapsible > summary {
  list-style: none;
  cursor: pointer;
}
.doc-registry-section--collapsible > summary::-webkit-details-marker {
  display: none;
}
.doc-registry-section--collapsible > summary::after {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.35rem;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.doc-registry-section--collapsible[open] > summary::after {
  transform: rotate(-135deg);
}
.doc-registry-section--collapsible:not([open]) > .doc-registry-section__head {
  border-bottom: none;
}
.doc-registry-section__body {
  padding: 0 0 0.35rem;
}
.doc-registry__files {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0;
}
.doc-registry__file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.55rem 0.7rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--color-border-subtle);
}
.doc-registry__file:first-child {
  border-top: none;
}
.doc-registry__ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.28rem 0.35rem;
  border-radius: var(--radius-sm, 4px);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  background: var(--color-primary-soft, var(--color-info-soft));
  border: 1px solid var(--color-border-subtle);
}
.doc-registry__main {
  min-width: 0;
}
.doc-registry__title-row {
  min-width: 0;
}
.doc-registry__name,
.doc-registry__name-btn {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
  color: var(--color-text);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.doc-registry__name:hover,
.doc-registry__name-btn:hover {
  color: var(--color-primary);
  text-decoration: underline;
}
.doc-registry__meta {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--color-muted);
  line-height: 1.35;
}
.doc-registry__aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}
.doc-registry__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}
.doc-registry__when {
  font-size: 0.75rem;
  white-space: nowrap;
}
.doc-registry-supplier {
  padding: 0.55rem 0.75rem 0.25rem;
  border-top: 1px dashed var(--color-border-subtle);
}
.doc-registry-supplier:first-child {
  border-top: none;
}
.doc-registry-supplier__name {
  font-size: 0.82rem;
  font-weight: 650;
  margin: 0 0 0.2rem;
  color: var(--color-text-secondary, var(--color-muted));
}
.doc-registry-supplier .doc-registry__files {
  padding-bottom: 0.35rem;
}
.doc-registry__badge--awarded {
  background: var(--color-success-soft);
  color: var(--color-success-text);
  font-size: 0.68rem;
  vertical-align: middle;
}
.doc-registry__badge--rejected {
  background: var(--color-surface-raised);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  font-size: 0.68rem;
  vertical-align: middle;
}
.ref-chip--rq  { background: var(--color-info-soft); color: var(--color-primary); border-color: var(--color-info-border, var(--color-border)); }
.ref-chip--rfq { background: var(--color-warning-soft); color: var(--color-warning-text); border-color: var(--color-warning-border, var(--color-border)); }
.ref-chip--po  { background: var(--color-success-soft); color: var(--color-success-text); border-color: var(--color-success-border, var(--color-border)); }
.ref-chip--awarded {
  background: var(--color-success-soft);
  color: var(--color-success-text);
  border-color: var(--color-success-border, var(--color-border));
}
.ref-chip--rejected {
  background: var(--color-surface-raised);
  color: var(--color-muted);
  border-color: var(--color-border);
}

@media (max-width: 640px) {
  .doc-registry__file {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .doc-registry__aside {
    grid-column: 2;
    justify-content: flex-start;
  }
  .supplier-quote__head { flex-direction: column; align-items: stretch; }
  .supplier-quote__aside { align-items: flex-start; text-align: left; }
  .supplier-quote__docs { grid-template-columns: 1fr; }
}

/* Requisition branch reply modal (requisition-branch.js) */
.branch-doc-list,
.branch-thread__docs {
  margin: 0;
  padding-left: 1.1rem;
}
.branch-thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.branch-thread__post {
  padding: var(--space-3);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.branch-thread__meta {
  margin-bottom: var(--space-2);
  font-size: 0.9rem;
}
.branch-thread__body {
  white-space: pre-wrap;
  line-height: 1.5;
}
.branch-reply__body {
  white-space: pre-wrap;
  line-height: 1.5;
}
.branch-reply-audit {
  margin: var(--space-4) 0;
}

.branch-recipient-reply {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-primary-border, var(--color-border));
  border-radius: var(--radius-md);
  background: var(--color-primary-soft, var(--color-surface-hover));
}
.branch-recipient-reply__title {
  margin: 0 0 var(--space-2);
  font-size: 1.05rem;
}
.branch-recipient-reply__body {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 1rem;
}
.branch-thread__post--reply {
  border-color: var(--color-primary-border, var(--color-border));
  background: var(--color-primary-soft, var(--color-surface-hover));
}

@media print {
  .sidebar, .topbar, .toast-stack, .ai-fab, .ai-panel, .cmdk-overlay { display: none !important; }
  .app-main { display: block; margin-left: 0; }
  .content { padding: 0; }
  body { background: #fff; }
}

/* =========================================================================
   Responsive · HCI · polish layer (appended 2026-07). Loaded on every page
   via core.css. Adds a mobile off-canvas nav drawer, phone-size responsive
   overrides, accessible focus rings, form-validation feedback and comfortable
   tap targets. Colours use existing --color-* tokens only; nothing here
   changes desktop layout above 900px except the shared focus/selection styles.
   ========================================================================= */

/* ---- Accessible keyboard focus (0-specificity, never overrides components) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
::selection { background: var(--color-primary-soft); color: var(--color-primary-dark); }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---- Form validation feedback (driven by core.js initFormFeedback) ------ */
input.is-invalid, select.is-invalid, textarea.is-invalid, .form__input.is-invalid {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 3px var(--color-danger-soft) !important;
}
.form__error {
  display: block;
  color: var(--color-danger-text);
  font-size: 0.78rem;
  line-height: 1.35;
  margin-top: 4px;
}
.form__label--required::after, label.is-required::after {
  content: " *";
  color: var(--color-danger-text);
  font-weight: 700;
}

/* ---- Mobile navigation drawer (hamburger + backdrop injected by core.js) - */
.nav-hamburger { display: none; }
.app-nav-backdrop { display: none; }

@media (max-width: 900px) {
  /* content reclaims full width — the fixed sidebar becomes a drawer */
  .app-main {
    margin-left: 0 !important;
    width: 100%;
    max-width: 100vw;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  /* contain the off-canvas drawer + any wide content without a scrollbar.
     `clip` (not `hidden`) so descendant position:sticky keeps working. */
  body { overflow-x: clip; }
  .content { max-width: 100vw; }
  .topbar { max-width: 100vw; }
  /* Let grid/flex cards shrink below their content so wide tables scroll inside
     their .table-wrap instead of stretching the card past the screen. */
  .table-wrap,
  .tbl-scroll,
  .req-table__wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .card, .dash-card, .dash-layout, .dash-layout__main, .dash-layout__side, .dash-grid, .stat-row, .dash-hero,
  .content > *, .dash-layout > *, .dash-layout__main > *, .dash-layout__side > *, .dash-grid > * {
    min-width: 0;
    max-width: 100%;
  }
  /* Hard stop: tables must not force the page wider than the screen
     (overrides module floors like workflow.css 680px). */
  .table-wrap table,
  .workflow-page .table-wrap table,
  .admin-layout .table-wrap table {
    min-width: 0 !important;
  }

  .sidebar {
    top: 0;
    bottom: auto;
    left: 0;
    right: auto;
    width: min(86vw, 300px);
    height: 100dvh;
    max-height: 100dvh;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--color-sidebar-border);
    border-top: none;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    will-change: transform;
    z-index: 150;
  }
  .sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-2) 0;
  }
  .sidebar__nav ul {
    display: block;
    flex-direction: column;
    padding: 0 var(--space-2);
  }
  .sidebar__link {
    flex-direction: row;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    min-height: 44px;
    align-items: center;
  }
  .sidebar__label {
    display: inline;
    font-size: inherit;
    text-align: left;
    max-width: none;
    overflow: visible;
    white-space: normal;
  }
  .sidebar__footer {
    display: block;
    padding: var(--space-3);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  }
  .sidebar__footer .sidebar__link {
    justify-content: flex-start;
    min-height: 44px;
  }
  /* Desktop collapse control is irrelevant in the drawer */
  .sidebar__toggle,
  #sidebarToggle {
    display: none !important;
  }

  html[data-mobile-nav="open"] .sidebar {
    transform: translateX(0);
    box-shadow: 0 24px 60px rgba(4, 12, 26, 0.5);
  }
  html[data-sidebar="collapsed"] .sidebar { width: min(86vw, 300px); } /* ignore desktop collapse on phones */

  .nav-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    padding: 0;
    transition: background var(--transition-fast);
  }
  .nav-hamburger:hover { background: var(--color-surface-hover); }
  .nav-hamburger:active { transform: scale(0.96); }
  .nav-hamburger svg { width: 22px; height: 22px; display: block; }

  html[data-mobile-nav="open"] .app-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 140;                 /* under sidebar (150), over content */
    background: rgba(4, 12, 26, 0.5);
    animation: navFade var(--transition-fast) ease;
  }
  html[data-mobile-nav="open"], html[data-mobile-nav="open"] body { overflow: hidden; }

  /* Impersonation banner spans full width when sidebar is a drawer */
  .impersonation-banner {
    left: 0;
    padding-left: max(var(--space-3), env(safe-area-inset-left, 0px));
    padding-right: max(var(--space-3), env(safe-area-inset-right, 0px));
  }
}
@keyframes navFade { from { opacity: 0; } to { opacity: 1; } }

/* ---- Phone-size comfort (≤640px) --------------------------------------- */
@media (max-width: 640px) {
  .content { padding: var(--space-3); }
  .topbar { padding: 0 var(--space-3); gap: var(--space-2); }
  .topbar__clock { display: none; }                 /* reclaim width */
  .topbar--branded .topbar-brand { display: none; } /* brand lives in the drawer */
  .topbar__user { display: none; }                  /* keep the avatar, drop the long name */
  .topbar__title { font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar__title, .topbar-brand { flex: 0 1 auto; min-width: 0; }
  .topbar__tools { gap: var(--space-2); }

  /* wide tables scroll inside their wrapper instead of forcing the page wider */
  .table-wrap, .tbl-scroll, .req-table__wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* stack common multi-column grids */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }

  /* larger tap targets + no iOS zoom-on-focus (needs ≥16px) */
  input, select, textarea, .form__input, .form__select, .form__textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn--sm,
  .row-actions .btn,
  .users-action-btn,
  .modal__close {
    min-height: 44px;
    min-width: 44px;
  }

  /* full-width action buttons read better on phones */
  .form__actions .btn,
  .modal__footer .btn,
  .stock-adj-form__actions .btn {
    flex: 1 1 auto;
  }

  /* Toolbars: stack cleanly instead of cramped wrap */
  .filters,
  .filters-bar,
  .ready-issue-toolbar,
  .section-head__tools,
  .users-list-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .filters .form__input,
  .filters .form__select,
  .filters-bar .form__input,
  .filters-bar .form__select,
  .ready-issue-search,
  .ready-issue-search .form__input,
  .users-search,
  .users-search .form__input,
  .users-filter {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .ready-issue-seg {
    width: 100%;
  }
  .ready-issue-seg__btn {
    flex: 1 1 0;
    min-height: 40px;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .section-head__tools {
    width: 100%;
    margin-left: 0;
  }

  /* Modals: sheet + safe area */
  .modal {
    align-items: flex-end;
    padding: 0;
  }
  .modal__dialog,
  .modal__dialog--sm,
  .modal__dialog--md,
  .modal__dialog--lg,
  .modal__dialog--xl,
  .modal__dialog--wide,
  .modal__dialog--full {
    width: 100%;
    max-width: 100%;
    max-height: min(92vh, 100dvh);
    margin: 0;
    border-radius: 16px 16px 0 0;
  }
  .modal__dialog .table-wrap {
    max-width: 100%;
  }

  .app-confirm__dialog {
    width: min(100%, 400px);
    margin: var(--space-3);
  }
  .app-confirm__actions {
    flex-direction: column-reverse;
  }
  .app-confirm__actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .impersonation-banner {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.8125rem;
  }
  .impersonation-banner__exit {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  /* Tab strips scroll horizontally instead of wrapping into a tall stack */
  .tabbar,
  .users-top-nav,
  .subtabbar,
  .admin-section-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabbar::-webkit-scrollbar,
  .users-top-nav::-webkit-scrollbar,
  .subtabbar::-webkit-scrollbar {
    display: none;
  }
  .tabbar__tab,
  .subtab {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 40px;
  }
}


/* ==========================================================================
   DESIGN REFINEMENT LAYER                                    (2026-07-28)
   ==========================================================================
   Appended deliberately rather than edited in place: everything above works,
   and this layer only tightens what a designer would flag walking through the
   product. Grouped by what it fixes so it stays reviewable.

     R1  Topbar — brand could overlap the clock (real bug)
     R2  Segmented tab bars — two tabs should not become two giant slabs
     R3  Stat cards — one accent, not a rainbow
     R4  Tables — quieter chrome, numeric alignment
     R5  Toolbars and filters — one row, aligned baselines
     R6  Buttons and inputs — a single control height
     R7  Badges and pills — stop shouting
     R8  Typography and rhythm
     R9  Sidebar polish
     R10 Responsive corrections
   ========================================================================== */

/* --------------------------------------------------------------------------
   R1 - Topbar

   The brand block sat at left:50% with max-width:7rem, but its child was an
   inline <span>, and overflow / text-overflow do not apply to inline boxes.
   A long company name therefore escaped the 7rem box and ran underneath the
   clock. A three-column grid centres the brand in the layout itself, so it
   cannot collide with either side at any name length.
   -------------------------------------------------------------------------- */
.topbar--branded {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
}

/* grid-row is pinned on all three. The brand comes first in the DOM but sits
   in column 2, and sparse auto-placement will not step backwards to fill
   column 1 — without an explicit row the title wrapped onto a second line. */
.topbar--branded .topbar__title {
  grid-column: 1;
  grid-row: 1;
  max-width: none;
  justify-self: start;
}

.topbar--branded .topbar-brand {
  grid-column: 2;
  grid-row: 1;
  position: static;
  transform: none;
  max-width: min(38vw, 26rem);
  line-height: 1.2;
  overflow: hidden;
}

.topbar--branded .topbar__tools {
  grid-column: 3;
  grid-row: 1;
  max-width: none;
  justify-self: end;
}

/* Block, so truncation actually applies. */
.topbar-brand__logo__text {
  display: block;
  max-width: 100%;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 1;
  color: var(--color-text-secondary);
}

@media (max-width: 1100px) {
  .topbar--branded .topbar-brand { max-width: 30vw; }
  .topbar-brand__logo__text { font-size: 0.74rem; letter-spacing: 0.06em; }
}

/* At 900px core.js injects the mobile-drawer hamburger as the topbar's first
   child. It has no grid-column of its own, so with the three columns above
   already pinned to row 1 it was auto-placed onto row 2 and clipped by the
   bar's fixed height — leaving no way to open the nav on a phone. The bar
   becomes [burger] [title] [tools] at exactly the breakpoint where the
   drawer takes over, and the brand steps aside. */
@media (max-width: 900px) {
  .topbar--branded {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .topbar--branded .nav-hamburger { grid-column: 1; grid-row: 1; }
  .topbar--branded .topbar__title { grid-column: 2; grid-row: 1; }
  .topbar--branded .topbar-brand  { display: none; }
  .topbar--branded .topbar__tools { grid-column: 3; grid-row: 1; }
}

/* --------------------------------------------------------------------------
   R2 - Segmented tab bars

   grid-auto-columns: 1fr splits the full width between however many tabs
   exist. With five that reads as a segmented control; with two it produced
   half a page of solid primary colour. Sizing to content with a cap keeps the
   control proportionate at any tab count.
   -------------------------------------------------------------------------- */
.tabbar:not(.tabbar--inner):not(.tabbar--scrollable) {
  grid-auto-columns: minmax(max-content, 15rem);
  justify-content: start;
  gap: 2px;
  padding: 8px 20px;
  background: var(--color-surface);
}

.tabbar:not(.tabbar--inner):not(.tabbar--scrollable) .tabbar__tab {
  padding-left: 18px;
  padding-right: 18px;
}

/* A quieter active state. The old one was a saturated fill plus a coloured
   drop shadow, which competed with every real action on the page. */
.tabbar__tab {
  border-radius: 999px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.tabbar__tab.is-active {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-weight: 650;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--color-primary) 40%, transparent);
}

.tabbar__tab:not(.is-active):hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

[data-theme="dark"] .tabbar__tab.is-active {
  background: color-mix(in srgb, var(--color-primary) 22%, transparent);
  color: #dce9fb;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--color-primary) 55%, transparent);
}

/* --------------------------------------------------------------------------
   R3 - Stat cards

   Four cards carrying four unrelated accent colours reads as decoration
   rather than information. One accent on the icon; the number carries the
   emphasis.
   -------------------------------------------------------------------------- */
.stat-card {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.stat-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-1);
}

.stat-card__label {
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0;
}

.stat-card__icon-wrap { border-radius: var(--radius); }

/* --------------------------------------------------------------------------
   R4 - Tables
   -------------------------------------------------------------------------- */
.data-table thead th {
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-muted);
  background: var(--color-thead-bg);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table tbody td { border-bottom: 1px solid var(--color-border-subtle); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--color-surface-hover); }

/* Money and counts line up like a ledger. */
.data-table td.num,
.data-table th.num,
.data-table td[data-num],
.data-table .cell-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table td:last-child,
.data-table th:last-child { border-right: 0; }

/* --------------------------------------------------------------------------
   R5 - Toolbars and filters

   Filters, search and actions were three stacked blocks. One toolbar row that
   wraps gracefully reads as a single control surface.
   -------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.filters > * { min-width: 0; }

.filters .filters__actions,
.filters > .btn-group:last-child {
  margin-left: auto;
  display: flex;
  gap: var(--space-2);
}

.filters label,
.filters .form__label {
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* --------------------------------------------------------------------------
   R6 - Buttons and inputs: one control height, so rows align
   -------------------------------------------------------------------------- */
:root { --control-h: 38px; }

.btn,
.form__input,
.form__select,
select.form__input,
input[type="text"].form__input,
input[type="search"].form__input,
input[type="date"].form__input,
input[type="number"].form__input {
  min-height: var(--control-h);
}

.btn,
a.btn,
label.btn,
button.btn,
input[type="submit"].btn,
input[type="button"].btn {
  border-radius: var(--btn-radius);
  font-weight: 600;
  letter-spacing: 0;
}

.btn--sm { min-height: 30px; }

.form__input:focus,
.form__select:focus,
textarea.form__input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

input[type="date"].form__input,
input[type="datetime-local"].form__input { padding-right: 8px; }

/* --------------------------------------------------------------------------
   R7 - Badges and pills
   -------------------------------------------------------------------------- */
.sidebar__badge,
.nav-badge {
  background: var(--color-danger);
  color: #fff;
  font-weight: 700;
  font-size: 0.68rem;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.sidebar__badge--urgent,
.nav-badge--urgent,
.sidebar__badge.is-overdue {
  background: var(--color-danger);
  color: #fff;
}

[data-theme="dark"] .sidebar__badge,
[data-theme="dark"] .nav-badge {
  background: var(--color-danger);
  color: #fff;
}

.tab-count:not(:empty) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--color-danger);
  color: #fff;
  line-height: 1;
}

.status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   R8 - Typography and vertical rhythm
   -------------------------------------------------------------------------- */
.topbar__title { font-size: 1.05rem; font-weight: 650; }

.section-head h2,
.panel__title {
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.card { border-radius: var(--radius-lg); }

/* Cards nested directly inside cards doubled every border and pad. */
.card .card {
  border: 0;
  box-shadow: none;
  padding-inline: 0;
  background: none;
}

/* --------------------------------------------------------------------------
   R9 - Sidebar
   -------------------------------------------------------------------------- */
.sidebar__toggle {
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  opacity: 0.75;
}
.sidebar__toggle:hover { opacity: 1; }

.sidebar__link { border-radius: var(--radius-sm); }

/* --------------------------------------------------------------------------
   R10 - Responsive corrections
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .filters { padding: var(--space-3); }
  .filters .filters__actions { margin-left: 0; width: 100%; }
  .stat-row { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { padding: var(--space-3); }
  .stat-card__value { font-size: 1.5rem; }
  .filters > * { flex: 1 1 100%; }
  .data-table thead th,
  .data-table tbody td { padding-inline: 10px; }
}

/* --------------------------------------------------------------------------
   Shared attachment dropzone (auto-upload, save-as without extension)
   -------------------------------------------------------------------------- */
.attach-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-surface) 42%);
  padding: var(--space-4);
}
.attach-dropzone-host { min-width: 0; }
.attach-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: 132px;
  padding: var(--space-4);
  border: 2px dashed var(--color-info-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.attach-dropzone:hover,
.attach-dropzone:focus-visible,
.attach-dropzone.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  outline: none;
}
.attach-dropzone.is-dragover { transform: scale(1.01); }
.attach-dropzone__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-info-soft);
  color: var(--color-info-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: var(--space-1);
}
.attach-dropzone__icon::before { content: '+'; }
.attach-dropzone__title {
  font-weight: 700;
  color: var(--color-text);
}
.attach-dropzone__sub {
  font-size: 0.875rem;
  max-width: 36ch;
}
.attach-dropzone--compact {
  min-height: 88px;
  padding: var(--space-3);
}
.attach-dropzone--compact .attach-dropzone__icon {
  width: 32px;
  height: 32px;
  font-size: 0.95rem;
  margin-bottom: 0;
}

.attach-queue {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.attach-queue__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.attach-queue__title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.attach-queue__list { display: grid; gap: var(--space-2); }
.attach-queue__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt, var(--color-bg));
}
.attach-queue__file {
  width: 38px;
  height: 46px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--color-info-soft), var(--color-surface));
  border: 1px solid var(--color-info-border);
  position: relative;
}
.attach-queue__file::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-info-border);
  border-bottom: 1px solid var(--color-info-border);
  border-bottom-left-radius: 4px;
}
.attach-queue__fields { display: grid; gap: var(--space-2); min-width: 0; }
.attach-queue__label { margin: 0; font-size: 0.82rem; }
.attach-queue__name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.attach-queue__name .form__input {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}
.attach-queue__ext {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--color-muted);
}
.attach-queue__remove { align-self: center; }

.attach-saved { margin-top: var(--space-3); }
.attach-saved__empty {
  margin: 0;
  padding: var(--space-3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  background: var(--color-surface);
}
.attach-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}
.attach-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.attach-list__icon {
  width: 34px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 7px;
  background: var(--color-info-soft);
  border: 1px solid var(--color-info-border);
}
.attach-list__body { min-width: 0; display: grid; gap: 2px; }
.attach-list__name {
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  word-break: break-word;
}
.attach-list__name:hover { text-decoration: underline; }
.attach-list__meta { font-size: 0.82rem; }

.req-line-row__files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-top: 0.4rem;
}
.req-line-row__file {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-info-soft);
  color: var(--color-info-text);
  font-size: 0.78rem;
  line-height: 1.3;
  text-decoration: none;
  word-break: break-word;
}
.req-line-row__file:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .attach-queue__item { grid-template-columns: 1fr; }
  .attach-queue__file { display: none; }
  .attach-queue__remove { justify-self: end; }
}

/* ==========================================================================
   ui-uniformity.css
   --------------------------------------------------------------------------
   The cross-module alignment layer is NOT imported here, for two reasons:

     1. Per the CSS spec an @import must precede every other rule in a
        stylesheet, so `@import url('ui-uniformity.css')` written at the
        bottom of this file is dropped by the browser and would do nothing.
     2. Even a valid @import at the top would load it BEFORE workflow.css and
        the per-module stylesheets, which is the wrong end of the cascade —
        the uniformity layer only works if it is the last sheet on the page.

   It is therefore linked from each page shell as the final <link>, after
   core.css / workflow.css / the module stylesheet. See any shell head, e.g.
   modules/users/department/department.html.
   ========================================================================== */
