/* SWI Portal — SAT-style shell (dark chrome + red accent) + light/dark content */
@import "./ptw.css";

:root {
  color-scheme: light;
}

:root[data-theme="light"] {
  color-scheme: light;
  --portal-chrome: #000000;
  --portal-chrome-border: rgba(196, 30, 45, 0.22);
  --portal-sidebar: rgba(0, 0, 0, 0.95);
  --portal-sidebar-header: #910404e0;
  --portal-sidebar-text: #ffffff;
  --portal-sidebar-menu-hover-bg: #e5e5e5;
  --portal-sidebar-menu-hover-text: #f21b23;
  --portal-sidebar-menu-active-bg: #e5e5e5;
  --portal-sidebar-menu-active-text: #f21b23;
  --portal-sidebar-submenu-bg: #fafafa;
  --portal-sidebar-submenu-text: #4d4d4f;
  --portal-sidebar-hover: rgba(196, 30, 45, 0.14);
  --portal-sidebar-active: rgba(196, 30, 45, 0.24);
  --portal-sidebar-section-bg: #070707;
  --portal-sidebar-section-border: rgba(196, 30, 45, 0.38);
  --portal-sidebar-section-head: rgba(196, 30, 45, 0.1);
  --portal-sidebar-red-text: #f0b8be;
  --portal-sidebar-red-muted: rgba(240, 184, 190, 0.72);
  --portal-sidebar-red-border: rgba(232, 93, 107, 0.32);
  --portal-sidebar-red-glow: rgba(196, 30, 45, 0.18);
  --portal-nav-band: #c41e2d;
  --portal-nav-band-text: #ffffff;
  --portal-accent: #c41e2d;
  --portal-accent-hover: #a01825;
  --portal-accent-contrast: #ffffff;
  --portal-topbar-text: rgba(255, 255, 255, 0.92);
  --portal-topbar-muted: rgba(255, 255, 255, 0.65);

  --swi-bg: #e9ebf0;
  --swi-bg-subtle: #e0e3ea;
  --swi-surface: #ffffff;
  --swi-surface-muted: #f5f6f9;
  --swi-text: #1c2430;
  --swi-text-secondary: #5a6575;
  --swi-text-tertiary: #7a8494;
  --swi-border: #d5dae3;
  --swi-border-strong: #b8c0cd;
  --swi-accent: var(--portal-accent);
  --swi-accent-hover: var(--portal-accent-hover);
  --swi-accent-contrast: var(--portal-accent-contrast);
  --swi-accent-soft: rgba(196, 30, 45, 0.12);
  --swi-shadow-sm: 0 1px 3px rgba(28, 36, 48, 0.06);
  --swi-shadow-md: 0 8px 24px rgba(28, 36, 48, 0.1);
  --swi-shadow-drawer: -12px 0 40px rgba(28, 36, 48, 0.12);
  --swi-row-hover: #f0f2f7;
  --swi-row-selected: #fdecef;
  --swi-focus-ring: 0 0 0 2px var(--swi-surface), 0 0 0 4px var(--swi-accent);
  --swi-backdrop: rgba(20, 24, 32, 0.45);
  --swi-error-bg: #fcefee;
  --swi-error-text: #9c1c1c;
  --swi-error-border: #e8cacd;
  --badge-draft-bg: #f5f0e6;
  --badge-draft-text: #6b5a30;
  --badge-review-bg: #ebeff8;
  --badge-review-text: #2d4a80;
  --badge-approved-bg: #e7f4eb;
  --badge-approved-text: #1a6b38;
  --badge-published-bg: #e3f4f7;
  --badge-published-text: #0d6572;
  --badge-archived-bg: #f0eaf5;
  --badge-archived-text: #5c4670;
  --swi-warn: #b45309;
  --swi-danger-text: #b42318;
  --swi-danger-bg: #fcefee;
  --swi-danger-border: #e0b0ad;
  --swi-chart-bar: linear-gradient(180deg, #e85d6b 0%, var(--portal-accent) 100%);
  --swi-field-bg: transparent;
  --swi-field-underline: #222326;
  --swi-glass-fill: rgba(255, 255, 255, 0.58);
  --swi-glass-fill-hover: rgba(255, 255, 255, 0.74);
  --swi-glass-menu: rgba(255, 255, 255, 0.82);
  --swi-glass-border: rgba(255, 255, 255, 0.72);
  --swi-glass-edge: rgba(196, 30, 45, 0.22);
  --swi-glass-blur: 14px;
  --swi-glass-shadow:
    0 10px 36px rgba(28, 36, 48, 0.12),
    0 2px 8px rgba(28, 36, 48, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --swi-glass-menu-shadow:
    0 18px 52px rgba(28, 36, 48, 0.16),
    0 6px 16px rgba(28, 36, 48, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --portal-chrome: #000000;
  --portal-chrome-border: rgba(232, 93, 107, 0.2);
  --portal-sidebar: #1a1a1a;
  --portal-sidebar-header: #910404e0;
  --portal-sidebar-text: rgba(255, 255, 255, 0.9);
  --portal-sidebar-menu-hover-bg: rgba(255, 255, 255, 0.08);
  --portal-sidebar-menu-hover-text: #f87171;
  --portal-sidebar-menu-active-bg: rgba(255, 255, 255, 0.08);
  --portal-sidebar-menu-active-text: #f87171;
  --portal-sidebar-submenu-bg: rgba(255, 255, 255, 0.03);
  --portal-sidebar-submenu-text: rgba(255, 255, 255, 0.85);
  --portal-sidebar-hover: rgba(232, 93, 107, 0.16);
  --portal-sidebar-active: rgba(232, 93, 107, 0.26);
  --portal-sidebar-section-bg: #060606;
  --portal-sidebar-section-border: rgba(196, 30, 45, 0.35);
  --portal-sidebar-section-head: #c41e2d;
  --portal-sidebar-red-text: #ffffff;
  --portal-sidebar-red-muted: rgba(255, 255, 255, 0.9);
  --portal-sidebar-red-border: rgba(196, 30, 45, 0.45);
  --portal-sidebar-red-glow: rgba(196, 30, 45, 0.22);
  --portal-nav-band: #c41e2d;
  --portal-nav-band-text: #ffffff;
  --portal-accent: #c41e2d;
  --portal-accent-hover: #a01825;
  --portal-accent-contrast: #ffffff;
  --portal-topbar-text: rgba(255, 255, 255, 0.92);
  --portal-topbar-muted: rgba(255, 255, 255, 0.6);

  --swi-bg: #15181d;
  --swi-bg-subtle: #1c2128;
  --swi-surface: #1f242d;
  --swi-surface-muted: #191e26;
  --swi-text: #e8ebf0;
  --swi-text-secondary: #9aa3b2;
  --swi-text-tertiary: #7d8695;
  --swi-border: #343c48;
  --swi-border-strong: #485364;
  --swi-accent: var(--portal-accent);
  --swi-accent-hover: var(--portal-accent-hover);
  --swi-accent-contrast: #ffffff;
  --swi-accent-soft: rgba(232, 93, 107, 0.2);
  --swi-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --swi-shadow-md: 0 10px 36px rgba(0, 0, 0, 0.45);
  --swi-shadow-drawer: -12px 0 48px rgba(0, 0, 0, 0.5);
  --swi-row-hover: #282f3a;
  --swi-row-selected: #3a282c;
  --swi-focus-ring: 0 0 0 2px var(--swi-surface), 0 0 0 4px var(--swi-accent);
  --swi-backdrop: rgba(0, 0, 0, 0.6);
  --swi-error-bg: #2c2020;
  --swi-error-text: #f5a8a3;
  --swi-error-border: #5c3a3a;
  --badge-draft-bg: #3a3428;
  --badge-draft-text: #e8d49a;
  --badge-review-bg: #2a3348;
  --badge-review-text: #a8c4f5;
  --badge-approved-bg: #24392e;
  --badge-approved-text: #8fd9ae;
  --badge-published-bg: #1e3a44;
  --badge-published-text: #7dd8e8;
  --badge-archived-bg: #342e3c;
  --badge-archived-text: #d4bee8;
  --swi-warn: #f0b429;
  --swi-danger-text: #ffb4ae;
  --swi-danger-bg: #2f2222;
  --swi-danger-border: #6b4545;
  --swi-chart-bar: linear-gradient(180deg, #ff7a87 0%, #c41e2d 100%);
  --swi-field-bg: transparent;
  --swi-field-underline: #6b7585;
  --swi-glass-fill: rgba(38, 44, 54, 0.62);
  --swi-glass-fill-hover: rgba(48, 55, 68, 0.78);
  --swi-glass-menu: rgba(32, 38, 48, 0.88);
  --swi-glass-border: rgba(255, 255, 255, 0.12);
  --swi-glass-edge: rgba(232, 93, 107, 0.35);
  --swi-glass-blur: 16px;
  --swi-glass-shadow:
    0 12px 40px rgba(0, 0, 0, 0.42),
    0 2px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --swi-glass-menu-shadow:
    0 20px 56px rgba(0, 0, 0, 0.5),
    0 6px 18px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  background: var(--swi-bg);
  color: var(--swi-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#root {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

/* ----- Portal shell ----- */

.portal-root {
  --portal-topbar-height: 56px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 0.75rem 0 0.5rem;
  background: var(--portal-chrome);
  border-bottom: 1px solid var(--portal-chrome-border);
  flex-shrink: 0;
}

.portal-topbar__left,
.portal-topbar__right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.portal-topbar__left {
  flex: 1;
  justify-content: flex-start;
}

.portal-topbar__right {
  flex-shrink: 0;
  justify-content: flex-end;
}

.portal-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--portal-topbar-text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.portal-icon-btn:hover {
  background: var(--portal-sidebar-hover);
}

.portal-icon-btn:focus-visible {
  outline: 2px solid var(--portal-accent);
  outline-offset: 2px;
}

.portal-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--portal-topbar-muted);
  cursor: pointer;
}

.portal-theme-toggle:hover {
  background: var(--portal-sidebar-hover);
  color: var(--portal-topbar-text);
}

.portal-theme-toggle:focus-visible {
  outline: 2px solid var(--portal-accent);
  outline-offset: 2px;
}

.portal-theme-toggle__icon {
  display: flex;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: 0;
  padding-left: 0.85rem;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.portal-brand__mark {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.portal-brand__square {
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--portal-accent);
  border-radius: 3px;
  opacity: 0.85;
  left: 0;
  top: 6px;
}

.portal-brand__square--front {
  left: 8px;
  top: 2px;
  opacity: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.portal-brand__text {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--portal-topbar-text);
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.portal-user__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--portal-accent);
  color: var(--portal-accent-contrast);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.portal-user__role {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--portal-topbar-text);
}

.portal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.portal-sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: 260px;
  flex-shrink: 0;
  height: calc(100vh - var(--portal-topbar-height));
  max-height: calc(100vh - var(--portal-topbar-height));
  background: var(--portal-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
  overflow: hidden;
  color: var(--portal-sidebar-text);
}

.portal-sidebar--collapsed {
  width: 72px;
}

.portal-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  background: var(--portal-sidebar-header);
  flex-shrink: 0;
}

.portal-sidebar__header h3 {
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.portal-sidebar__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.portal-sidebar__menu {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}

.portal-sidebar__menu--collapsed {
  padding: 0.65rem 0.45rem;
}

.portal-sidebar__dropdown {
  margin-bottom: 0.35rem;
}

.portal-sidebar__menu-link {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.62rem 1.1rem;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--portal-sidebar-text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.portal-sidebar__menu-link:hover,
.portal-sidebar__dropdown.is-open > .portal-sidebar__menu-link {
  background: var(--portal-sidebar-menu-hover-bg);
  color: var(--portal-sidebar-menu-hover-text);
}

.portal-sidebar__dropdown.is-active-section > .portal-sidebar__menu-link {
  background: var(--portal-sidebar-menu-active-bg);
  color: var(--portal-sidebar-menu-active-text);
  border-left-color: var(--portal-sidebar-menu-active-text);
  font-weight: 600;
}

.portal-sidebar__menu-text {
  flex: 1;
  min-width: 0;
}

.portal-sidebar__chevron {
  flex-shrink: 0;
  margin-left: auto;
  transition: transform 0.2s ease;
}

.portal-sidebar__chevron--open {
  transform: rotate(180deg);
}

.portal-sidebar__submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  background: var(--portal-sidebar-submenu-bg);
}

.portal-sidebar__dropdown.is-open > .portal-sidebar__submenu {
  max-height: 520px;
}

.portal-sidebar__submenu-link {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1.1rem 0.55rem 2.35rem;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--portal-sidebar-submenu-text);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.portal-sidebar__submenu-link:hover {
  background: var(--portal-sidebar-menu-hover-bg);
  color: var(--portal-sidebar-menu-hover-text);
}

.portal-sidebar__submenu-link.is-active,
.portal-sidebar__dropdown .is-active > .portal-sidebar__submenu-link {
  background: var(--portal-sidebar-menu-active-bg);
  color: var(--portal-sidebar-menu-active-text);
  border-left-color: var(--portal-sidebar-menu-active-text);
  font-weight: 600;
}

.portal-sidebar__submenu-link.is-external .portal-sidebar__menu-text::after {
  content: " ↗";
  font-size: 0.85em;
  opacity: 0.7;
}

.portal-sidebar__menu-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.portal-sidebar__menu-icon svg {
  width: 18px;
  height: 18px;
}

.portal-sidebar__submenu-link .portal-sidebar__menu-icon svg {
  width: 16px;
  height: 16px;
}

.portal-sidebar__icon-link {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  margin-bottom: 0.25rem;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--portal-sidebar-text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.portal-sidebar__icon-link:hover,
.portal-sidebar__icon-link.is-active {
  background: var(--portal-sidebar-menu-hover-bg);
  color: var(--portal-sidebar-menu-hover-text);
}

.portal-sidebar__icon-link.is-active {
  border-left-color: var(--portal-sidebar-menu-active-text);
}

.portal-sidebar__footer {
  padding: 0.65rem 1rem;
  border-top: 2px solid rgba(255, 255, 255, 0.12);
  background: var(--portal-sidebar);
  flex-shrink: 0;
}

.portal-logout {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  min-height: 36px;
  border: none;
  border-radius: 0.35rem;
  background: #f21b23;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.portal-logout:hover {
  background: #d91820;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.portal-sidebar--collapsed .portal-logout {
  padding: 0.65rem;
}

.portal-sidebar--collapsed .portal-logout span {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .portal-sidebar__submenu,
  .portal-sidebar__chevron,
  .portal-logout {
    transition: none;
  }
}

.portal-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--swi-bg);
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Route transition wrapper — must stretch like the page shell. */
.portal-main .page-content-enter {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

@keyframes page-content-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-content-enter {
  animation: page-content-enter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .page-content-enter {
    animation: none;
  }
}

.portal-page {
  box-sizing: border-box;
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 1.5rem clamp(1rem, 2vw, 2rem) 2.5rem;
}

.portal-page--document-full {
  width: 100%;
  max-width: none;
  padding-left: clamp(0.75rem, 1.5vw, 1.25rem);
  padding-right: clamp(0.75rem, 1.5vw, 1.25rem);
}

/* PTW admin pages share one full-width column (sidebar expanded or collapsed). */
.portal-main .portal-page,
.portal-main .ptw-mgmt-page,
.portal-main .ptw-form-management-page,
.portal-main .ptw-mgmt-subpage,
.portal-main .ptw-overview-page,
.portal-main .ptw-permits-page,
.portal-main .ptw-form-fill-page,
.portal-main .ptw-lifecycle-page,
.portal-main .ptw-permit-preview-page {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.portal-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.portal-page-header__main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 16rem;
}

.portal-page-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem 0.35rem 0.45rem;
  margin: 0;
  border: 1px solid var(--swi-border);
  border-radius: 999px;
  background: var(--swi-surface);
  color: var(--swi-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.portal-page-back:hover {
  background: var(--swi-row-hover);
  border-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
  color: var(--swi-text);
}

.portal-page-back:focus-visible {
  outline: 2px solid var(--swi-accent);
  outline-offset: 2px;
}

.portal-page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--swi-text);
  line-height: 1.2;
}

.portal-page-subtitle {
  margin: 0.4rem 0 0;
  max-width: 42rem;
  font-size: 0.9375rem;
  color: var(--swi-text-secondary);
  line-height: 1.55;
}

.portal-page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.portal-page-header--solo {
  margin-bottom: 1rem;
}

.portal-page-header--solo .portal-page-header__text {
  width: 100%;
}

.portal-dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.65rem;
  padding: 0.85rem 1rem;
  background: var(--swi-surface);
  border: 1px solid var(--swi-border);
  border-radius: 10px;
  box-shadow: var(--swi-shadow-sm);
}

.portal-inline-filter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
}

.portal-inline-filter__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--swi-text-tertiary);
  white-space: nowrap;
}

.portal-select--toolbar {
  min-width: 148px;
  min-height: 36px;
}

.portal-toolbar-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
  margin-left: auto;
}

.portal-metric-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.05rem;
  padding: 0.35rem 0.85rem;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
}

.portal-metric-chip__value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.portal-metric-chip__label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--swi-text-secondary);
  line-height: 1.2;
  max-width: 11rem;
}

.portal-metric-chip--action {
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.portal-metric-chip--action:hover {
  border-color: var(--swi-accent);
  background: var(--swi-accent-soft);
}

.portal-metric-chip--action:focus-visible {
  outline: none;
  box-shadow: var(--swi-focus-ring);
}

.portal-metric-chip--warn .portal-metric-chip__value {
  color: var(--swi-warn);
}

.portal-toolbar-cta {
  flex-shrink: 0;
  min-height: 36px;
}

@media (max-width: 900px) {
  .portal-toolbar-metrics {
    margin-left: 0;
    width: 100%;
    order: 3;
  }

  .portal-toolbar-cta {
    width: 100%;
    order: 4;
  }

  .portal-inline-filter {
    width: 100%;
    justify-content: space-between;
  }
}

.portal-dashboard-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.portal-panel__toolbar--align-end {
  align-items: flex-end;
}

.portal-mini-field--row {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
}

.portal-mini-field--row .portal-mini-field__static {
  margin: 0;
  white-space: nowrap;
}

.portal-kpi-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 640px;
}

@media (max-width: 600px) {
  .portal-kpi-grid--two {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

.swi-chart-pro {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0.35rem 0.65rem;
  margin-top: 0.75rem;
  align-items: stretch;
}

.swi-chart-pro__y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 1.85rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--swi-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.swi-chart-pro__y-tick {
  line-height: 1;
}

.swi-chart-pro__plot {
  position: relative;
  height: 208px;
  background: var(--swi-surface-muted);
  border-left: 1px solid var(--swi-border-strong);
  border-bottom: 2px solid var(--swi-border-strong);
  border-radius: 0 8px 0 0;
  overflow: hidden;
}

.swi-chart-pro__grid {
  position: absolute;
  inset: 0;
  bottom: 0;
  pointer-events: none;
}

.swi-chart-pro__grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--swi-border);
  opacity: 0.9;
}

.swi-chart-pro__bars {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 1.75rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(1.25rem, 8vw, 3rem);
  padding: 0.35rem 1.25rem 0;
}

.swi-chart-pro__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  width: 52px;
  flex-shrink: 0;
}

.swi-chart-pro__bar {
  width: 100%;
  max-width: 44px;
  margin: 0 auto;
  border-radius: 6px 6px 3px 3px;
  min-height: 2px;
  background: var(--swi-chart-bar);
  box-shadow: 0 2px 8px rgba(196, 30, 45, 0.22);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.swi-chart-pro__bar:hover {
  opacity: 0.92;
  transform: translateY(-2px);
}

.swi-chart-pro__x-label {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
  font-variant-numeric: tabular-nums;
}

.swi-chart-pro__unit {
  margin: 0.45rem 0 0;
  font-size: 0.6875rem;
  color: var(--swi-text-tertiary);
}

.portal-filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.portal-filter__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--swi-text-tertiary);
}

.portal-select {
  font-family: inherit;
  font-size: 0.8125rem;
  padding: 0.45rem 2rem 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
  color: var(--swi-text);
  cursor: pointer;
}

.portal-select--filter {
  min-width: 150px;
}

.portal-page-lead {
  margin: -0.75rem 0 1.1rem;
  max-width: 48rem;
}

.portal-panel__title,
.portal-panel__desc {
  font-family: inherit;
}

.portal-panel__title {
  font-size: 1rem;
  font-weight: 700;
}

.portal-panel__desc {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.portal-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.portal-panel__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.portal-mini-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.portal-mini-field__static {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--swi-text-tertiary);
}

.portal-chart-panel .swi-chart-pro {
  margin-top: 0.25rem;
}

.portal-side-card .swi-panel__title {
  font-family: inherit;
}

.portal-panels {
  margin-top: 0.25rem;
}

.portal-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--swi-border);
  font-size: 0.8125rem;
}

.portal-status-row:last-child {
  border-bottom: none;
}

.portal-status-row__name {
  text-transform: capitalize;
  color: var(--swi-text);
  font-weight: 500;
}

.portal-status-row__count {
  font-weight: 700;
  color: var(--swi-accent);
}

/* KPI cards (SAT style) */
.portal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.portal-kpi {
  position: relative;
  background: var(--swi-surface);
  border: 1px solid var(--swi-border);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--swi-shadow-sm);
}

.portal-kpi--warn .portal-kpi__value {
  color: var(--swi-warn);
}

.portal-kpi__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.portal-kpi__icon {
  display: flex;
  color: var(--swi-accent);
  opacity: 0.95;
}

.portal-kpi__add {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--swi-border);
  border-radius: 6px;
  background: var(--swi-surface-muted);
  color: var(--swi-text-secondary);
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.portal-kpi__add:hover {
  background: var(--swi-accent-soft);
  border-color: var(--swi-accent);
  color: var(--swi-accent);
}

.portal-kpi__label {
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--swi-text-tertiary);
}

.portal-kpi__value {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--swi-accent);
}

.portal-kpi__hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--swi-text-secondary);
  line-height: 1.4;
}

/* ----- Legacy / shared SWI components ----- */

.swi-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
  color: var(--swi-text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.swi-theme-toggle:hover {
  background: var(--swi-row-hover);
  color: var(--swi-text);
  border-color: var(--swi-border-strong);
}

.swi-theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--swi-focus-ring);
}

.swi-theme-toggle__icon {
  display: flex;
  color: var(--swi-accent);
}

.swi-panels {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 300px);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 600px) {
  .portal-kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .swi-panels {
    grid-template-columns: 1fr;
  }

  .portal-user__role {
    display: none;
  }
}

.swi-panel {
  background: var(--swi-surface);
  border: 1px solid var(--swi-border);
  border-radius: 10px;
  padding: 1.2rem 1.25rem;
  box-shadow: var(--swi-shadow-sm);
}

.swi-panel__title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--swi-text);
}

.swi-panel__subtitle {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
  line-height: 1.45;
}

.swi-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.swi-btn {
  appearance: none;
  border: 1px solid var(--swi-border-strong);
  background: var(--swi-surface);
  color: var(--swi-text);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.swi-btn:hover {
  background: var(--swi-row-hover);
  border-color: var(--swi-border-strong);
}

.swi-btn:focus-visible {
  outline: none;
  box-shadow: var(--swi-focus-ring);
}

.swi-btn--primary {
  background: var(--swi-accent);
  border-color: var(--swi-accent);
  color: var(--swi-accent-contrast);
}

.swi-btn--primary:hover {
  background: var(--swi-accent-hover);
  border-color: var(--swi-accent-hover);
}

.swi-btn--ghost {
  background: transparent;
  border-color: transparent;
}

.swi-btn--ghost:hover {
  background: var(--swi-accent-soft);
  border-color: transparent;
}

.swi-btn--danger {
  border-color: var(--swi-danger-border);
  background: var(--swi-danger-bg);
  color: var(--swi-danger-text);
}

.swi-btn--danger:hover {
  filter: brightness(1.05);
}

.swi-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.swi-input,
.swi-select,
.swi-textarea {
  width: 100%;
  background-color: var(--swi-field-bg);
  border: 1px solid var(--swi-field-underline);
  border-top: none;
  border-left: none;
  border-right: none;
  color: var(--swi-text);
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.swi-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23222326' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.65rem auto;
}

:root[data-theme="dark"] .swi-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7585' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.swi-input:focus,
.swi-select:focus,
.swi-textarea:focus {
  outline: none;
  border-bottom-color: var(--swi-accent);
  box-shadow: none;
}

.swi-input::placeholder,
.swi-textarea::placeholder {
  color: var(--swi-text-tertiary);
}

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

/* Custom dropdown (underline by default) */

.swi-glass-select-root {
  position: relative;
  width: 100%;
}

.swi-glass-select {
  position: relative;
  width: 100%;
}

.swi-glass-select__trigger {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: auto;
  padding: 0.5rem 0.75rem;
  padding-right: 2rem;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--swi-field-underline);
  background: var(--swi-field-bg);
  color: var(--swi-text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.swi-glass-select__trigger:hover:not(:disabled) {
  border-bottom-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-field-underline));
}

.swi-glass-select__trigger:focus-visible {
  outline: none;
  border-bottom-color: var(--swi-accent);
}

.swi-glass-select.is-open .swi-glass-select__trigger {
  border-bottom-color: var(--swi-accent);
}

.swi-glass-select.is-disabled .swi-glass-select__trigger {
  opacity: 0.55;
  cursor: not-allowed;
}

.swi-glass-select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swi-glass-select__value.is-placeholder {
  color: var(--swi-text-tertiary);
}

.swi-glass-select__chevron {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  margin-top: -0.15rem;
  border-right: 2px solid var(--swi-field-underline);
  border-bottom: 2px solid var(--swi-field-underline);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease, border-color 0.15s ease;
  pointer-events: none;
}

.swi-glass-select.is-open .swi-glass-select__chevron {
  margin-top: 0.1rem;
  transform: rotate(-135deg) translateY(1px);
  border-color: var(--swi-accent);
}

.swi-glass-select__menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 1px);
  left: 0;
  right: 0;
  max-height: min(260px, 50vh);
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--swi-field-underline);
  background: var(--swi-surface);
  box-shadow: var(--swi-shadow-md);
  animation: swi-glass-menu-in 0.14s ease-out;
}

.swi-glass-select__menu > li + li {
  border-top: 1px solid var(--swi-border);
}

@keyframes swi-glass-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.swi-glass-select__option {
  width: 100%;
  display: block;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--swi-text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.swi-glass-select__option:hover,
.swi-glass-select__option:focus-visible {
  outline: none;
  background: var(--swi-row-hover);
  color: var(--swi-text);
}

.swi-glass-select__option.is-selected {
  background: var(--swi-accent-soft);
  color: var(--swi-accent);
  font-weight: 600;
}

/* Optional glass variant for emphasis contexts */
.swi-glass-select--glass .swi-glass-select__trigger {
  min-height: 42px;
  padding: 0.58rem 0.85rem;
  padding-right: 2rem;
  border-radius: 12px;
  border: 1px solid var(--swi-glass-border);
  background: var(--swi-glass-fill);
  backdrop-filter: blur(var(--swi-glass-blur));
  -webkit-backdrop-filter: blur(var(--swi-glass-blur));
  box-shadow: var(--swi-glass-shadow);
  font-weight: 500;
}

.swi-glass-select--glass .swi-glass-select__trigger:hover:not(:disabled) {
  background: var(--swi-glass-fill-hover);
  border-color: color-mix(in srgb, var(--swi-accent) 28%, var(--swi-glass-border));
}

.swi-glass-select--glass .swi-glass-select__trigger:focus-visible,
.swi-glass-select--glass.is-open .swi-glass-select__trigger {
  border-color: color-mix(in srgb, var(--swi-accent) 45%, var(--swi-glass-border));
  box-shadow: var(--swi-glass-shadow), 0 0 0 3px var(--swi-accent-soft);
}

.swi-glass-select--glass .swi-glass-select__chevron {
  border-color: var(--swi-text-secondary);
}

.swi-glass-select--glass .swi-glass-select__menu {
  top: calc(100% + 0.45rem);
  padding: 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--swi-glass-border);
  border-bottom: 1px solid var(--swi-glass-border);
  background: var(--swi-glass-menu);
  backdrop-filter: blur(calc(var(--swi-glass-blur) + 6px));
  -webkit-backdrop-filter: blur(calc(var(--swi-glass-blur) + 6px));
  box-shadow: var(--swi-glass-menu-shadow);
}

.swi-glass-select--glass .swi-glass-select__menu > li + li {
  border-top: none;
}

.swi-glass-select--glass .swi-glass-select__option {
  border-radius: 8px;
  padding: 0.58rem 0.7rem;
}

.swi-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
  box-shadow: var(--swi-shadow-sm);
}

.swi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.swi-table th,
.swi-table td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--swi-border);
}

.swi-table th {
  background: var(--swi-bg-subtle);
  color: var(--swi-text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.swi-table tbody tr {
  cursor: pointer;
  transition: background 0.1s ease;
}

.swi-table tbody tr:hover td {
  background: var(--swi-row-hover);
}

.swi-table tbody tr.swi-table-row--selected td {
  background: var(--swi-row-selected);
  box-shadow: inset 3px 0 0 var(--swi-accent);
}

.swi-table tr:last-child td {
  border-bottom: none;
}

.swi-table-wrap--empty {
  overflow-x: hidden;
}

.swi-table__empty-row td {
  text-align: center;
  color: var(--swi-text-secondary);
  font-size: 0.85rem;
  padding: 1.25rem 1rem;
  cursor: default;
}

.swi-table__empty-row:hover td {
  background: transparent;
}

.swi-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.swi-badge--draft {
  background: var(--badge-draft-bg);
  color: var(--badge-draft-text);
}
.swi-badge--in_review {
  background: var(--badge-review-bg);
  color: var(--badge-review-text);
}
.swi-badge--approved {
  background: var(--badge-approved-bg);
  color: var(--badge-approved-text);
}
.swi-badge--published {
  background: var(--badge-published-bg);
  color: var(--badge-published-text);
}
.swi-badge--archived {
  background: var(--badge-archived-bg);
  color: var(--badge-archived-text);
}

.swi-type-pill {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--swi-text-secondary);
}

.swi-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  height: 148px;
  padding-top: 0.5rem;
}

.swi-chart__bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  height: 100%;
}

.swi-chart__bar {
  flex: 1;
  width: 100%;
  max-width: 44px;
  background: var(--swi-chart-bar);
  border-radius: 6px 6px 3px 3px;
  min-height: 4px;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.swi-chart__bar:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.swi-chart__label {
  font-size: 0.65rem;
  color: var(--swi-text-tertiary);
  white-space: nowrap;
}

.swi-list-approval {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.swi-approval-row {
  padding: 1rem;
  border-radius: 10px;
  background: var(--swi-surface-muted);
  border: 1px solid var(--swi-border);
}

.swi-approval-row__title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
  color: var(--swi-text);
}

.swi-approval-row__meta {
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
  line-height: 1.4;
}

.swi-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--swi-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.swi-modal {
  background: var(--swi-surface);
  border: 1px solid var(--swi-border);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
  box-shadow: var(--swi-shadow-md);
}

.swi-modal h3 {
  margin: 0 0 1.15rem;
  font-size: 1.2rem;
  font-family: inherit;
  font-weight: 700;
}

.swi-form-row {
  margin-bottom: 0.85rem;
}

.swi-form-row label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
  margin-bottom: 0.35rem;
}

.swi-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.swi-copy-page-modal {
  max-width: 520px;
}

.swi-assign-user-modal {
  max-width: 520px;
}

.swi-assign-user-modal__doc {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--swi-border);
}

.swi-assign-user-modal__doc-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--swi-text-tertiary);
}

.swi-assign-user-modal__list-wrap {
  max-height: min(320px, 45vh);
  overflow-y: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
}

.swi-assign-user-modal__empty {
  margin: 0;
  padding: 1.5rem 1rem;
  text-align: center;
}

.swi-assign-user-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.swi-assign-user-list__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 1px solid var(--swi-border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}

.swi-assign-user-list__item:last-child {
  border-bottom: none;
}

.swi-assign-user-list__item:hover:not(:disabled),
.swi-assign-user-list__item:focus-visible {
  outline: none;
  background: var(--swi-row-hover);
}

.swi-assign-user-list__item.is-selected {
  background: var(--swi-accent-soft);
}

.swi-assign-user-list__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--swi-accent-soft);
  color: var(--swi-accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.swi-assign-user-list__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.swi-assign-user-list__text strong {
  font-size: 0.875rem;
  color: var(--swi-text);
}

.swi-assign-user-list__role {
  font-size: 0.75rem;
  color: var(--swi-text-secondary);
}

.swi-copy-page-modal__intro,
.swi-submit-doc-modal__intro,
.swi-remove-page-modal__intro {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.45;
}

.swi-submit-doc-modal__note,
.swi-remove-page-modal__note {
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--swi-text-secondary);
}

.swi-remove-page-modal__agree {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0 0 1.25rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--swi-border);
  border-radius: 8px;
  background: var(--swi-surface-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
  cursor: pointer;
  user-select: none;
}

.swi-remove-page-modal__agree input {
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--swi-accent);
}

.swi-remove-page-modal__agree span {
  color: var(--swi-text);
}

.swi-doc-created-modal__intro {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.swi-doc-created-modal__note {
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--swi-text-secondary);
}

.swi-admin-assign-table__row.is-highlighted {
  background: color-mix(in srgb, var(--swi-accent) 10%, var(--swi-surface));
  box-shadow: inset 3px 0 0 var(--swi-accent);
}

.swi-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.swi-modal__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.swi-modal__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--swi-text-secondary);
  padding: 0 0.25rem;
}

.doc-scroll-page-add {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.doc-page-duplicate-btn {
  margin-left: auto;
}

.swi-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vh, 1.5rem) clamp(0.75rem, 3vw, 1.5rem);
  overflow-y: auto;
  background: var(--swi-backdrop);
}

.swi-drawer {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(90vh, 880px);
  margin: auto;
  flex-shrink: 0;
  background: var(--swi-surface);
  border: 1px solid var(--swi-border);
  border-radius: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.35rem 3.25rem 1.5rem 1.35rem;
  box-shadow: var(--swi-shadow-md);
}

.swi-drawer h2 {
  margin: 0 2.5rem 0.5rem 0;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
}

.swi-drawer__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1;
}

.swi-muted {
  color: var(--swi-text-secondary);
  font-size: 0.875rem;
}

.swi-error {
  color: var(--swi-error-text);
  font-size: 0.875rem;
  padding: 0.85rem 1rem;
  background: var(--swi-error-bg);
  border: 1px solid var(--swi-error-border);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.swi-dropzone {
  border: 1px dashed var(--swi-border-strong);
  border-radius: 10px;
  padding: 1.1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
  background: var(--swi-surface-muted);
  margin-top: 0.5rem;
}

.swi-dropzone input[type="file"] {
  margin-top: 0.6rem;
  max-width: 100%;
  font-size: 0.75rem;
}

.swi-subsection {
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--swi-border);
}

.swi-subsection h4 {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--swi-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: inherit;
}

.swi-version-list,
.swi-media-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
}

.swi-version-list li,
.swi-media-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--swi-border);
  color: var(--swi-text);
}

.swi-inline-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.swi-sign-note {
  width: 100%;
  margin-top: 0.4rem;
}

/* —— Admin login & forms —— */
.swi-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--swi-bg);
}

.swi-login-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  background: var(--swi-surface);
  border-radius: 12px;
  box-shadow: var(--swi-shadow-md);
  border: 1px solid var(--swi-border);
}

.swi-login-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--swi-text);
}

.swi-login-subtitle {
  margin: 0 0 1.5rem;
  color: var(--swi-text-secondary);
  font-size: 0.9375rem;
}

.swi-login-form .swi-form-row {
  margin-bottom: 1rem;
}

.swi-login-submit {
  width: 100%;
  margin-top: 0.5rem;
}

.swi-success {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  background: var(--badge-approved-bg);
  color: var(--badge-approved-text);
  border: 1px solid var(--badge-approved-text);
}

.swi-admin-form {
  padding: 1.5rem;
}

/* ----- Admin create document ----- */

.swi-admin-create-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.swi-admin-create-loading {
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.swi-admin-create-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 1.25rem;
  align-items: start;
}

.swi-admin-create-form {
  padding: 0;
  overflow: hidden;
}

.swi-admin-create-form__intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 1.35rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--swi-border);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--swi-accent) 4%, var(--swi-surface)) 0%,
    var(--swi-surface) 100%
  );
}

.swi-admin-create-form__heading {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-admin-create-form__lead {
  margin: 0;
  max-width: 36rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--swi-text-secondary);
}

.swi-admin-create-form__ids {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.swi-admin-create-id-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 7rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
}

.swi-admin-create-id-chip__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--swi-text-tertiary);
}

.swi-admin-create-id-chip strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--swi-text);
}

.swi-form-section {
  padding: 1.25rem 1.5rem 0.35rem;
  border-bottom: 1px solid var(--swi-border);
}

.swi-form-section:last-of-type {
  border-bottom: none;
}

.swi-form-section__head {
  margin-bottom: 1rem;
}

.swi-form-section__title {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-form-section__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
  line-height: 1.45;
}

.swi-required {
  color: var(--swi-accent);
}

.swi-field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--swi-text-tertiary);
}

.swi-admin-create-form__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin: 0;
  padding: 1.15rem 1.5rem 1.35rem;
  border-top: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
}

.swi-admin-create-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.swi-admin-create-summary,
.swi-admin-create-steps {
  padding: 1.15rem 1.25rem;
}

.swi-admin-create-summary__title,
.swi-admin-create-steps__title {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-admin-create-summary__lead {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
  line-height: 1.45;
}

.swi-admin-create-summary__list {
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.swi-admin-create-summary__list div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  align-items: start;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--swi-border);
}

.swi-admin-create-summary__list div:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.swi-admin-create-summary__list dt {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--swi-text-tertiary);
}

.swi-admin-create-summary__list dd {
  margin: 0;
  font-size: 0.875rem;
  color: var(--swi-text);
  line-height: 1.4;
  word-break: break-word;
}

.swi-admin-create-steps__list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.swi-admin-create-steps__list li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.65rem;
  align-items: start;
}

.swi-admin-create-steps__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--swi-text-secondary);
}

.swi-admin-create-steps__list li strong {
  display: block;
  font-size: 0.8125rem;
  color: var(--swi-text);
  margin-bottom: 0.15rem;
}

.swi-admin-create-steps__list li p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--swi-text-secondary);
}

.swi-admin-create-steps__list li.is-current .swi-admin-create-steps__num {
  border-color: color-mix(in srgb, var(--swi-accent) 45%, var(--swi-border));
  background: var(--swi-accent-soft);
  color: var(--swi-accent);
}

.swi-admin-create-steps__list li.is-current strong {
  color: var(--swi-accent);
}

@media (max-width: 960px) {
  .swi-admin-create-layout {
    grid-template-columns: 1fr;
  }

  .swi-admin-create-aside {
    order: -1;
  }

  .swi-admin-create-summary__list div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

.swi-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.swi-form-row--full {
  grid-column: 1 / -1;
}

.swi-form-actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--swi-border);
}

.swi-form-actions--stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border-top: none;
  padding-top: 0;
  margin-top: 1.25rem;
}

.swi-assign-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(280px, 420px);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .swi-assign-layout {
    grid-template-columns: 1fr;
  }
  .swi-form-grid {
    grid-template-columns: 1fr;
  }
}

.swi-assign-list__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--swi-border);
}

.swi-assign-list__count {
  font-size: 0.8rem;
  color: var(--swi-muted);
}

.swi-assign-list__empty {
  padding: 1.5rem 0;
  text-align: center;
}

.swi-assign-doc-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  max-height: min(560px, calc(100vh - 220px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.swi-assign-doc-item {
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border: 1px solid var(--swi-border);
  border-radius: 10px;
  background: var(--swi-surface, #fff);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}

.swi-assign-doc-item:hover {
  border-color: var(--swi-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  background: var(--swi-row-hover);
}

.swi-assign-doc-item--active {
  border-color: var(--swi-accent);
  background: var(--swi-row-selected);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--swi-accent) 25%, transparent);
}

.swi-assign-doc-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.swi-assign-doc-item__title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--swi-text);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.swi-assign-doc-item__badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.swi-assign-doc-item__badge--assigned {
  background: color-mix(in srgb, var(--swi-accent) 18%, transparent);
  color: var(--swi-accent);
}

.swi-assign-doc-item__badge--open {
  background: var(--swi-row-hover);
  color: var(--swi-muted);
}

.swi-status-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.swi-status-badge--opened {
  background: var(--swi-row-hover);
  color: var(--swi-muted);
  border-color: var(--swi-border);
}

.swi-status-badge--assigned {
  background: color-mix(in srgb, var(--swi-accent) 15%, transparent);
  color: var(--swi-accent);
  border-color: color-mix(in srgb, var(--swi-accent) 35%, transparent);
}

.swi-status-badge--in-progress {
  background: rgba(212, 160, 23, 0.14);
  color: #9a7200;
  border-color: rgba(212, 160, 23, 0.35);
}

.swi-status-badge--completed {
  background: rgba(34, 139, 34, 0.12);
  color: #228b22;
  border-color: rgba(34, 139, 34, 0.28);
}

.swi-status-badge--unknown {
  background: var(--swi-row-hover);
  color: var(--swi-muted);
}

.swi-assign-doc-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.swi-assign-doc-item__pill {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--swi-row-hover);
  color: var(--swi-muted);
}

.swi-assign-doc-item__assignee {
  font-size: 0.8rem;
  color: var(--swi-text);
}

.swi-assign-doc-item__assignee--none {
  color: var(--swi-muted);
  font-style: italic;
}

.swi-assign-form-panel {
  min-height: 200px;
}

.swi-assign-form__summary {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--swi-border);
}

.swi-assign-form__summary .portal-panel__title {
  margin-bottom: 0.35rem;
}

.swi-assign-form__field {
  max-width: 100%;
}

.swi-assign-form__select {
  width: 100%;
  max-width: 360px;
}

.swi-assign-form__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: 2rem 1rem;
  text-align: center;
}

/* ----- Admin assign document (full-width list / card) ----- */

.swi-admin-assign-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.swi-admin-assign-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 1rem;
}

.swi-admin-assign-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
}

.swi-admin-assign-stat {
  font-size: 0.875rem;
  color: var(--swi-text-secondary);
}

.swi-admin-assign-stat strong {
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
}

.swi-admin-assign-search {
  flex: 1 1 220px;
  max-width: 360px;
  margin-left: auto;
}

.swi-admin-assign-search .swi-input {
  width: 100%;
}

.swi-admin-assign-hint {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: var(--swi-text-secondary);
  border-left: 3px solid var(--swi-border);
}

.swi-admin-assign-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  padding: 1rem 1.15rem;
  border-left: 3px solid var(--swi-accent);
}

.swi-admin-assign-strip__doc {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 10rem;
  flex: 1 1 180px;
}

.swi-admin-assign-strip__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--swi-text-tertiary);
}

.swi-admin-assign-strip__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 220px;
  max-width: 320px;
}

.swi-admin-assign-strip__field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--swi-text-secondary);
}

.swi-admin-assign-strip__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.swi-admin-assign-content {
  padding: 0;
  overflow: hidden;
}

.swi-admin-assign-empty {
  padding: 2rem 1rem;
  text-align: center;
}

.swi-admin-assign-table-wrap {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.swi-admin-assign-table tbody tr {
  cursor: default;
}

.swi-admin-assign-table__row.is-selected {
  background: var(--swi-row-selected);
}

.swi-admin-assign-table__name {
  display: block;
  font-weight: 600;
  color: var(--swi-text);
}

.swi-admin-assign-card-grid {
  list-style: none;
  margin: 0;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.swi-admin-assign-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--swi-border);
  border-radius: 10px;
  background: var(--swi-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.swi-admin-assign-card.is-selected {
  border-color: var(--swi-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--swi-accent) 22%, transparent);
}

.swi-admin-assign-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.swi-admin-assign-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.swi-admin-assign-card__meta {
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.swi-admin-assign-card__meta div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.35rem;
  align-items: baseline;
}

.swi-admin-assign-card__meta dt {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--swi-text-tertiary);
}

.swi-admin-assign-card__meta dd {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text);
}

@media (max-width: 720px) {
  .swi-admin-assign-strip__actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .swi-admin-assign-search {
    max-width: none;
    width: 100%;
    margin-left: 0;
  }
}

/* ----- Assignment list (list / card views) ----- */

.swi-view-toggle {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--swi-border);
  border-radius: 8px;
  background: var(--swi-bg-subtle);
}

.swi-view-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--swi-text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.swi-view-toggle__btn:hover {
  color: var(--swi-text);
  background: var(--swi-row-hover);
}

.swi-view-toggle__btn.is-active {
  background: var(--swi-surface);
  color: var(--swi-text);
  box-shadow: var(--swi-shadow-sm);
}

.swi-assignment-list-panel {
  padding: 0;
  overflow: hidden;
}

.swi-assignment-table-wrap {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.swi-assignment-table tbody tr {
  cursor: default;
}

.swi-assignment-table__doc {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 10rem;
}

.swi-assignment-table__doc-name {
  font-weight: 600;
  color: var(--swi-text);
}

.swi-assignment-table__user {
  font-weight: 500;
}

.swi-assignment-table__dates {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  white-space: nowrap;
}

.swi-assignment-table__status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  min-width: 8.5rem;
}

.swi-assignment-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 7rem;
}

.swi-assignment-table__start-btn {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.swi-assignment-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: 22rem;
}

.swi-assignment-tags--card {
  margin-top: 0.65rem;
}

.swi-assignment-tags__item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: var(--swi-row-hover);
  font-size: 0.75rem;
  line-height: 1.3;
}

.swi-assignment-tags__label {
  color: var(--swi-text-secondary);
  font-weight: 600;
}

.swi-assignment-tags__value {
  color: var(--swi-text);
}

.swi-assignment-card__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
  margin: 0.65rem 0 0;
  padding: 0;
}

.swi-assignment-card__facts div {
  min-width: 0;
}

.swi-assignment-card__facts dt {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--swi-text-secondary);
}

.swi-assignment-card__facts dd {
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
  color: var(--swi-text);
}

.swi-assignment-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.swi-btn--compact {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
}

@media (max-width: 960px) {
  .swi-assignment-table thead {
    display: none;
  }

  .swi-assignment-table tbody tr {
    display: block;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--swi-border);
  }

  .swi-assignment-table tbody tr:last-child {
    border-bottom: none;
  }

  .swi-assignment-table td {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    padding: 0.35rem 0;
    border-bottom: none;
  }

  .swi-assignment-table td::before {
    content: attr(data-label);
    flex: 0 0 100%;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--swi-text-secondary);
  }
}

/* ----- Admin overview & general modules ----- */

.swi-admin-overview,
.swi-admin-tickets,
.swi-admin-ticket-logs,
.swi-admin-users,
.swi-admin-hub-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.swi-admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.swi-admin-stat-grid--status {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .swi-admin-stat-grid--status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .swi-admin-stat-grid--status {
    grid-template-columns: 1fr;
  }
}

.swi-admin-stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.3rem 1.4rem;
  min-height: 118px;
  border-radius: 12px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
  box-shadow: var(--swi-shadow-sm);
}

.swi-admin-stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.swi-admin-stat-card--opened .swi-admin-stat-card__value {
  color: var(--swi-text-secondary);
}

.swi-admin-stat-card--assigned .swi-admin-stat-card__value {
  color: var(--swi-accent);
}

.swi-admin-stat-card--in-progress .swi-admin-stat-card__value {
  color: #9a7200;
}

.swi-admin-stat-card--completed .swi-admin-stat-card__value {
  color: #228b22;
}

.swi-admin-stat-card--opened {
  border-top: 3px solid var(--swi-border-strong);
}

.swi-admin-stat-card--assigned {
  border-top: 3px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
}

.swi-admin-stat-card--in-progress {
  border-top: 3px solid rgba(212, 160, 23, 0.65);
}

.swi-admin-stat-card--completed {
  border-top: 3px solid rgba(34, 139, 34, 0.55);
}

.swi-admin-radar {
  padding: 1.35rem 1.5rem;
}

.swi-admin-radar__head {
  margin-bottom: 1rem;
}

.swi-admin-radar__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-admin-radar__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.swi-admin-radar__body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 1.25rem;
  align-items: center;
}

@media (max-width: 820px) {
  .swi-admin-radar__body {
    grid-template-columns: 1fr;
  }
}

.swi-admin-radar__chart-wrap {
  display: flex;
  justify-content: center;
  padding: 0.5rem;
}

.swi-admin-radar__chart {
  width: min(100%, 360px);
  height: auto;
}

.swi-admin-radar__grid-ring {
  fill: none;
  stroke: var(--swi-border);
  stroke-width: 1;
}

.swi-admin-radar__axis {
  stroke: var(--swi-border);
  stroke-width: 1;
}

.swi-admin-radar__data-outline {
  fill: none;
  stroke: var(--swi-accent);
  stroke-width: 2;
}

.swi-admin-radar__dot {
  fill: var(--swi-accent);
  stroke: var(--swi-surface);
  stroke-width: 2;
}

.swi-admin-radar__axis-label {
  fill: var(--swi-text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.swi-admin-radar__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.swi-admin-radar__legend-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
}

.swi-admin-radar__legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.swi-admin-radar__legend-swatch--opened {
  background: var(--swi-border-strong);
}

.swi-admin-radar__legend-swatch--assigned {
  background: var(--swi-accent);
}

.swi-admin-radar__legend-swatch--in-progress {
  background: #d4a017;
}

.swi-admin-radar__legend-swatch--completed {
  background: #228b22;
}

.swi-admin-radar__legend-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--swi-text);
}

.swi-admin-radar__legend-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
}

.swi-admin-overview-charts {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(380px, 1.25fr);
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .swi-admin-overview-charts {
    grid-template-columns: 1fr;
  }
}

.swi-admin-trend {
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.swi-admin-trend__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.swi-admin-trend__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-admin-trend__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.swi-admin-trend__metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--swi-accent) 25%, var(--swi-border));
  background: color-mix(in srgb, var(--swi-accent) 6%, var(--swi-surface-muted));
  min-width: 7rem;
}

.swi-admin-trend__metric strong {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.swi-admin-trend__metric span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
}

.swi-admin-trend__canvas-wrap {
  flex: 1;
  min-height: 260px;
  padding: 0.35rem 0.15rem 0;
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    var(--swi-surface-muted) 0%,
    color-mix(in srgb, var(--swi-surface-muted) 55%, var(--swi-surface)) 100%
  );
  border: 1px solid var(--swi-border);
}

.swi-admin-trend__svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 260px;
}

.swi-admin-trend__grid-line {
  stroke: var(--swi-border);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.swi-admin-trend__axis-line {
  stroke: var(--swi-border-strong);
  stroke-width: 1.5;
}

.swi-admin-trend__y-label {
  fill: var(--swi-text-tertiary);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}

.swi-admin-trend__x-label {
  fill: var(--swi-text-secondary);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}

.swi-admin-trend__area {
  fill: url(#swi-trend-area);
}

.swi-admin-trend__line {
  fill: none;
  stroke: var(--swi-accent);
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swi-admin-trend__dot {
  fill: var(--swi-surface);
  stroke: var(--swi-accent);
  stroke-width: 2.5;
  cursor: pointer;
  transition: r 0.12s ease, fill 0.12s ease;
}

.swi-admin-trend__dot.is-active,
.swi-admin-trend__dot:hover,
.swi-admin-trend__dot:focus {
  fill: var(--swi-accent);
  stroke: var(--swi-surface);
  outline: none;
}

.swi-admin-activity {
  padding: 1.35rem 1.5rem;
}

.swi-admin-activity__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.swi-admin-activity__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-admin-activity__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.swi-admin-activity__view-all {
  flex-shrink: 0;
}

.swi-admin-activity__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.swi-admin-activity__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.85rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--swi-border);
}

.swi-admin-activity__item:first-child {
  padding-top: 0.15rem;
}

.swi-admin-activity__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.swi-admin-activity__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  flex-shrink: 0;
}

.swi-admin-activity__icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.swi-admin-activity__icon--opened {
  color: #2563eb;
  background: color-mix(in srgb, #2563eb 12%, var(--swi-surface));
}

.swi-admin-activity__icon--assigned {
  color: #d97706;
  background: color-mix(in srgb, #d97706 12%, var(--swi-surface));
}

.swi-admin-activity__icon--in-progress {
  color: #7c3aed;
  background: color-mix(in srgb, #7c3aed 12%, var(--swi-surface));
}

.swi-admin-activity__icon--completed {
  color: #059669;
  background: color-mix(in srgb, #059669 12%, var(--swi-surface));
}

.swi-admin-activity__body {
  min-width: 0;
}

.swi-admin-activity__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  margin: 0 0 0.2rem;
}

.swi-admin-activity__title-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--swi-text);
  line-height: 1.35;
}

.swi-admin-activity__badge {
  font-size: 0.6875rem;
  padding: 0.15rem 0.45rem;
}

.swi-admin-activity__meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swi-admin-activity__time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text-tertiary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}

@media (max-width: 640px) {
  .swi-admin-activity__item {
    grid-template-columns: auto 1fr;
  }

  .swi-admin-activity__time {
    grid-column: 2;
    padding-top: 0;
  }
}

.swi-admin-stat-card__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--swi-text);
}

.swi-admin-stat-card__hint {
  font-size: 0.75rem;
  color: var(--swi-text-secondary);
  line-height: 1.35;
}

.swi-admin-module-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.swi-admin-module-section__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-admin-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}

.swi-admin-module-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
  box-shadow: var(--swi-shadow-sm);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.swi-admin-module-card:hover {
  border-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
  box-shadow: var(--swi-shadow-md);
  transform: translateY(-1px);
}

.swi-admin-module-card__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-admin-module-card__desc {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--swi-text-secondary);
}

.swi-admin-module-card__action {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-accent);
}

.swi-admin-tickets__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.swi-admin-tickets__status {
  min-width: 150px;
  width: auto;
}

.swi-admin-tickets__search {
  min-width: 200px;
  width: min(280px, 100%);
}

.swi-admin-ticket-logs__ticket-id {
  width: 7rem;
  min-width: 7rem;
}

.swi-admin-ticket-logs-table__desc {
  max-width: 280px;
  white-space: pre-wrap;
  word-break: break-word;
}

.swi-admin-ticket-logs-table__ticket {
  display: block;
  font-weight: 600;
}

.swi-admin-hub-panel {
  padding: 1.35rem 1.5rem;
}

.swi-admin-hub-panel__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-admin-hub-panel__text {
  margin: 0 0 1rem;
  max-width: 42rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--swi-text-secondary);
}

.swi-admin-hub-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--swi-text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.swi-raise-ticket-modal,
.swi-ticket-detail-modal {
  max-width: 560px;
}

.swi-ticket-detail__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--swi-border);
}

.swi-ticket-detail__subject {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.swi-ticket-detail__meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.swi-ticket-detail__meta dt {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--swi-text-tertiary);
}

.swi-ticket-detail__meta dd {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
}

.swi-ticket-detail__description {
  margin-bottom: 1rem;
}

.swi-ticket-detail__description h4,
.swi-ticket-detail__logs h4 {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
}

.swi-ticket-detail__description p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.swi-ticket-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.swi-ticket-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  max-height: 240px;
  overflow-y: auto;
}

.swi-ticket-log-list li {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--swi-border);
  border-radius: 8px;
  background: var(--swi-surface-muted);
}

.swi-ticket-log-list__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.swi-ticket-log-list p {
  margin: 0 0 0.2rem;
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* ----- User portal pages ----- */

.swi-user-home,
.swi-user-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.swi-user-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.swi-user-stat-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

@media (max-width: 960px) {
  .swi-user-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.swi-user-stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.15rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
  box-shadow: var(--swi-shadow-sm);
  border-top: 3px solid var(--swi-border-strong);
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}

button.swi-user-stat-card {
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

button.swi-user-stat-card:hover {
  border-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
  box-shadow: var(--swi-shadow-md);
  transform: translateY(-1px);
}

button.swi-user-stat-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 2px;
}

.swi-user-stat-card__value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--swi-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.swi-user-stat-card--opened {
  border-top-color: #2563eb;
}

.swi-user-stat-card--assigned {
  border-top-color: #d97706;
}

.swi-user-stat-card--in-progress {
  border-top-color: #7c3aed;
}

.swi-user-stat-card--completed {
  border-top-color: #059669;
}

.swi-user-stat-card--opened .swi-user-stat-card__value {
  color: #2563eb;
}

.swi-user-stat-card--assigned .swi-user-stat-card__value {
  color: #d97706;
}

.swi-user-stat-card--in-progress .swi-user-stat-card__value {
  color: #7c3aed;
}

.swi-user-stat-card--completed .swi-user-stat-card__value {
  color: #059669;
}

.swi-user-stat-card__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--swi-text);
}

.swi-user-stat-card__hint {
  font-size: 0.75rem;
  color: var(--swi-text-secondary);
  line-height: 1.35;
}

.swi-user-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-user-section-desc {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.swi-user-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.swi-user-home__quick {
  padding: 1.25rem 1.35rem;
}

.swi-user-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.swi-user-quick-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.95rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.swi-user-quick-link:hover {
  border-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
  box-shadow: var(--swi-shadow-sm);
  transform: translateY(-1px);
}

.swi-user-quick-link__label {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-user-quick-link__desc {
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
  line-height: 1.4;
}

.swi-user-status-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.swi-user-status-filter__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
  color: var(--swi-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
  transition:
    border-color 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}

.swi-user-status-filter__btn:hover {
  border-color: var(--swi-border-strong);
  color: var(--swi-text);
}

.swi-user-status-filter__btn.is-active {
  border-color: color-mix(in srgb, var(--swi-accent) 40%, var(--swi-border));
  background: color-mix(in srgb, var(--swi-accent) 10%, var(--swi-surface));
  color: var(--swi-text);
}

.swi-user-status-filter__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--swi-surface);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.swi-assign-doc-item__badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.swi-assign-doc-item__new-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.swi-assign-doc-item--new {
  border-color: color-mix(in srgb, #dc2626 35%, var(--swi-border));
  background: color-mix(in srgb, #dc2626 4%, var(--swi-surface));
}

.portal-notify {
  position: relative;
}

.portal-notify__bell {
  position: relative;
}

.portal-notify__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  pointer-events: none;
}

.portal-notify__panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 120;
  width: min(360px, calc(100vw - 1.5rem));
  border-radius: 12px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
  box-shadow: var(--swi-shadow-md);
  overflow: hidden;
}

.portal-notify__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--swi-border);
}

.portal-notify__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.portal-notify__mark-all {
  border: none;
  background: transparent;
  color: var(--swi-accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.portal-notify__mark-all:hover {
  text-decoration: underline;
}

.portal-notify__empty {
  margin: 0;
  padding: 1.25rem 1rem;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.portal-notify__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.portal-notify__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: none;
  border-bottom: 1px solid var(--swi-border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 0.12s ease;
}

.portal-notify__item:hover {
  background: var(--swi-surface-muted);
}

.portal-notify__item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--swi-text);
}

.portal-notify__item-body {
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.portal-notify__item-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text-tertiary);
}

.portal-notify__foot {
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
}

.portal-notify__view-all {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--swi-accent) 12%, var(--swi-surface));
  color: var(--swi-accent);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.portal-notify__view-all:hover {
  background: color-mix(in srgb, var(--swi-accent) 18%, var(--swi-surface));
}

.swi-user-dashboard-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

@media (min-width: 1100px) {
  .swi-user-dashboard-panels:has(> :nth-child(2):last-child) {
    grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  }
}

.swi-user-dashboard-charts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

@media (min-width: 1100px) {
  .swi-user-dashboard-charts:has(> :nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .swi-user-dashboard-panels {
    grid-template-columns: 1fr;
  }
}

.swi-user-chart {
  padding: 1.25rem 1.35rem;
  min-height: 100%;
}

.swi-user-chart--wide {
  grid-column: 1 / -1;
}

.swi-user-chart__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}

.swi-user-chart__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-user-chart__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.swi-user-chart__metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--swi-accent) 25%, var(--swi-border));
  background: color-mix(in srgb, var(--swi-accent) 6%, var(--swi-surface-muted));
}

.swi-user-chart__metric strong {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
}

.swi-user-chart__metric span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
}

.swi-user-chart__canvas-wrap {
  padding: 0.25rem 0;
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    var(--swi-surface-muted) 0%,
    color-mix(in srgb, var(--swi-surface-muted) 55%, var(--swi-surface)) 100%
  );
  border: 1px solid var(--swi-border);
  width: 100%;
}

.swi-user-chart__svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 240px;
  overflow: visible;
}

.swi-user-chart__grid-line {
  stroke: var(--swi-border);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.swi-user-chart__y-label,
.swi-user-chart__x-label,
.swi-user-chart__value-label {
  fill: var(--swi-text-secondary);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}

.swi-user-chart__value-label {
  fill: var(--swi-text);
}

.swi-user-chart__dot {
  cursor: pointer;
}

.swi-user-chart--clickable .swi-user-chart__head,
.swi-user-chart--clickable .swi-user-chart__canvas-wrap {
  cursor: pointer;
}

.swi-user-chart--clickable .swi-user-chart__head:focus-visible,
.swi-user-chart--clickable .swi-user-chart__canvas-wrap:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 3px;
  border-radius: 10px;
}

.swi-user-chart--clickable .swi-user-chart__canvas-wrap:hover {
  border-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
}

.swi-user-chart__bar-hit {
  cursor: pointer;
}

.swi-user-chart__bar-hit:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 2px;
}

.swi-user-chart__empty-action {
  display: block;
  width: 100%;
  padding: 0.75rem 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.swi-user-chart__empty-action:hover {
  color: var(--swi-accent);
}

.swi-assign-trend.swi-user-chart--clickable .swi-assign-trend__head,
.swi-assign-trend.swi-user-chart--clickable .swi-assign-trend__chart {
  cursor: pointer;
}

.swi-assign-trend.swi-user-chart--clickable .swi-assign-trend__head:focus-visible,
.swi-assign-trend.swi-user-chart--clickable .swi-assign-trend__chart:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 3px;
  border-radius: 10px;
}

.swi-user-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.swi-user-period-tabs__btn {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
  color: var(--swi-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.swi-user-period-tabs__btn.is-active {
  border-color: color-mix(in srgb, var(--swi-accent) 40%, var(--swi-border));
  background: color-mix(in srgb, var(--swi-accent) 10%, var(--swi-surface));
  color: var(--swi-text);
}

/* Interactive assignment trend chart */
.swi-assign-trend {
  padding: 1.35rem 1.5rem;
}

.swi-assign-trend--wide {
  grid-column: 1 / -1;
}

.swi-assign-trend__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.swi-assign-trend__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-assign-trend__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.swi-assign-trend__metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.12rem;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--swi-accent) 28%, var(--swi-border));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--swi-accent) 8%, var(--swi-surface)) 0%,
    var(--swi-surface-muted) 100%
  );
  min-width: 7.5rem;
}

.swi-assign-trend__metric strong {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.swi-assign-trend__metric span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
}

.swi-assign-trend__metric em {
  font-style: normal;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--swi-text-tertiary);
}

.swi-assign-trend__delta--up {
  color: #059669;
}

.swi-assign-trend__delta--down {
  color: #dc2626;
}

.swi-assign-trend__periods {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 720px) {
  .swi-assign-trend__periods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.swi-assign-trend__period {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.12s ease;
}

.swi-assign-trend__period:hover {
  border-color: color-mix(in srgb, var(--swi-accent) 30%, var(--swi-border));
  transform: translateY(-1px);
}

.swi-assign-trend__period.is-active {
  border-color: color-mix(in srgb, var(--swi-accent) 45%, var(--swi-border));
  background: color-mix(in srgb, var(--swi-accent) 10%, var(--swi-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--swi-accent) 15%, transparent);
}

.swi-assign-trend__period-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--swi-text);
}

.swi-assign-trend__period-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
}

.swi-assign-trend__insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.swi-assign-trend__insight {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--swi-surface-muted);
  border: 1px solid var(--swi-border);
}

.swi-assign-trend__insight span {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--swi-text-tertiary);
}

.swi-assign-trend__insight strong {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--swi-text);
  font-variant-numeric: tabular-nums;
}

.swi-assign-trend__insight small {
  font-size: 0.75rem;
  color: var(--swi-text-secondary);
}

.swi-assign-trend__chart-wrap {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.5rem;
  padding: 0.85rem 0.75rem 0.5rem;
  border-radius: 14px;
  border: 1px solid var(--swi-border);
  background:
    linear-gradient(180deg, var(--swi-surface-muted) 0%, var(--swi-surface) 100%);
}

.swi-assign-trend__y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 220px;
  padding: 0.25rem 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--swi-text-tertiary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.swi-assign-trend__chart {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 220px;
  min-width: 0;
  position: relative;
}

.swi-assign-trend__col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  height: 100%;
  padding: 0 0.15rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  position: relative;
  transition: opacity 0.15s ease;
}

.swi-assign-trend__col.is-dimmed {
  opacity: 0.45;
}

.swi-assign-trend__col.is-active {
  opacity: 1;
}

.swi-assign-trend__col:focus-visible {
  outline: 2px solid var(--swi-accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.swi-assign-trend__bar-track {
  position: relative;
  width: 100%;
  max-width: 42px;
  height: 170px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 10px 10px 4px 4px;
  background: color-mix(in srgb, var(--swi-border) 35%, transparent);
}

.swi-assign-trend__bar {
  width: 100%;
  min-height: 4px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--swi-accent) 92%, #fff) 0%,
    var(--swi-accent) 100%
  );
  box-shadow: 0 4px 14px color-mix(in srgb, var(--swi-accent) 28%, transparent);
  transform-origin: bottom center;
  transition:
    height 0.55s cubic-bezier(0.34, 1.2, 0.64, 1),
    filter 0.15s ease;
}

.swi-assign-trend__bar.is-animated {
  animation: swi-assign-bar-rise 0.55s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.swi-assign-trend__col.is-active .swi-assign-trend__bar {
  filter: brightness(1.05);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--swi-accent) 38%, transparent);
}

.swi-assign-trend__bar-glow {
  position: absolute;
  inset: auto 0 0;
  height: 100%;
  border-radius: inherit;
  background: radial-gradient(
    ellipse at center bottom,
    color-mix(in srgb, var(--swi-accent) 22%, transparent),
    transparent 70%
  );
  pointer-events: none;
}

.swi-assign-trend__tooltip {
  position: absolute;
  bottom: calc(100% - 0.25rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--swi-accent) 30%, var(--swi-border));
  background: var(--swi-surface);
  box-shadow: var(--swi-shadow-md);
  white-space: nowrap;
  pointer-events: none;
  animation: swi-assign-tooltip-in 0.18s ease;
}

.swi-assign-trend__tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--swi-surface);
}

.swi-assign-trend__tooltip strong {
  font-size: 1rem;
  font-weight: 700;
  color: var(--swi-accent);
}

.swi-assign-trend__tooltip span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text);
}

.swi-assign-trend__tooltip small {
  font-size: 0.6875rem;
  color: var(--swi-text-secondary);
}

.swi-assign-trend__x-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swi-assign-trend__count {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--swi-text-tertiary);
  min-height: 0.85rem;
}

.swi-assign-trend__hint {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--swi-text-tertiary);
}

@keyframes swi-assign-bar-rise {
  from {
    transform: scaleY(0.08);
    opacity: 0.5;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes swi-assign-tooltip-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.swi-user-remaining,
.swi-user-undone {
  padding: 1.25rem 1.35rem;
}

.swi-user-remaining__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.swi-user-remaining__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.swi-user-remaining__stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 0.9rem;
  border-radius: 10px;
  background: var(--swi-surface-muted);
  border: 1px solid var(--swi-border);
}

.swi-user-remaining__stat strong {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--swi-text);
  font-variant-numeric: tabular-nums;
}

.swi-user-remaining__stat span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
}

.swi-user-remaining__progress-wrap,
.swi-user-remaining-progress {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.swi-user-remaining-progress {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
}

button.swi-user-remaining-progress {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

button.swi-user-remaining-progress:hover {
  border-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
  box-shadow: var(--swi-shadow-md);
  transform: translateY(-1px);
}

button.swi-user-remaining-progress:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 2px;
}

.swi-user-remaining-progress__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.swi-user-remaining-progress__title {
  margin: 0 0 0.2rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.swi-user-remaining-progress__subtitle {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.swi-user-remaining-progress__badge {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 4.25rem;
  justify-content: center;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--swi-accent) 12%, var(--swi-surface));
  border: 1px solid color-mix(in srgb, var(--swi-accent) 28%, var(--swi-border));
}

.swi-user-remaining-progress__badge strong {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  color: var(--swi-accent);
  font-variant-numeric: tabular-nums;
}

.swi-user-remaining-progress__badge span {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--swi-text-secondary);
}

.swi-user-remaining-progress__track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: var(--swi-surface-muted);
  border: 1px solid var(--swi-border);
  overflow: hidden;
}

.swi-user-remaining-progress__fill {
  position: relative;
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--swi-accent);
  transition: width 0.35s ease;
}

.swi-user-remaining-progress__marker {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--swi-surface);
  border: 2px solid var(--swi-accent);
  transform: translateY(-50%);
  transition: left 0.35s ease;
}

.swi-user-remaining-progress__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.swi-user-remaining-progress__stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: var(--swi-surface-muted);
  border: 1px solid var(--swi-border);
}

.swi-user-remaining-progress__stat strong {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--swi-text);
  font-variant-numeric: tabular-nums;
}

.swi-user-remaining-progress__stat span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
}

.swi-user-remaining-progress__stat--completed strong {
  color: #059669;
}

.swi-user-remaining-progress__stat--remaining strong {
  color: #7c3aed;
}

.swi-user-remaining__progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.swi-user-remaining__progress-label strong {
  color: var(--swi-accent);
}

.swi-user-remaining__progress {
  height: 10px;
  border-radius: 999px;
  background: var(--swi-surface-muted);
  border: 1px solid var(--swi-border);
  overflow: hidden;
}

.swi-user-remaining__progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--swi-accent);
  transition: width 0.25s ease;
}

.swi-user-undone__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.swi-user-undone__item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.65rem 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
}

.swi-user-undone__body {
  min-width: 0;
}

.swi-user-undone__title {
  margin: 0 0 0.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--swi-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swi-user-undone__meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--swi-text-secondary);
}

.swi-btn--compact {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.swi-user-chart__head-actions,
.swi-assign-trend__head-actions,
.swi-user-remaining__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.swi-add-to-pd {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
  background: color-mix(in srgb, var(--swi-accent) 8%, var(--swi-surface));
  color: var(--swi-accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}

.swi-add-to-pd:hover {
  background: color-mix(in srgb, var(--swi-accent) 14%, var(--swi-surface));
  border-color: var(--swi-accent);
}

.swi-add-to-pd--compact {
  padding: 0.3rem 0.5rem;
}

.swi-add-to-pd--compact .swi-add-to-pd__text {
  display: none;
}

.swi-user-stat-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.swi-pd-catalog {
  padding: 1.25rem 1.35rem;
}

.swi-pd-catalog__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.swi-pd-catalog__sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.swi-pd-catalog__section-title {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--swi-text-tertiary);
}

.swi-pd-catalog__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.swi-pd-catalog__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
}

.swi-pd-catalog__item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.swi-pd-catalog__item-text strong {
  font-size: 0.875rem;
  color: var(--swi-text);
}

.swi-pd-catalog__item-text span {
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

@media (max-width: 720px) {
  .swi-user-undone__item {
    grid-template-columns: 1fr;
  }

  .swi-user-remaining__stats {
    grid-template-columns: 1fr;
  }
}

/* Full-document print: escape the admin shell scrollport (Ctrl+P fallback). */

@media print {
  html,
  body,
  #root,
  .portal-root,
  .portal-body,
  .portal-main,
  .portal-page,
  .portal-page--document-full,
  .ptw-permit-preview-page,
  .ptw-permit-preview-documents,
  .ptw-print-current-sheet,
  .ptw-doc-wrap,
  .ptw-doc-page {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    position: static !important;
  }

  .portal-root,
  .portal-body {
    display: block !important;
  }

  .portal-topbar,
  .portal-sidebar,
  .portal-sidebar__footer,
  .ptw-no-print {
    display: none !important;
  }
}
