:root {
  --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --brand-purple-950: #2a0052;
  --brand-purple-900: #36006b;
  --brand-purple-800: #4b148c;
  --brand-purple-700: #5f1bb5;
  --brand-purple-soft: #f0e6ff;
  --brand-purple-tint: #e4d1ff;
  --page-bg: #f3f5f8;
  --sidebar-bg: #eef1f6;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --table-header-bg: #f4f6fa;
  --table-row-hover: #fafbfe;
  --empty-bg: #fcfdff;
  --border: #dfe5ee;
  --border-strong: #cbd5e1;
  --text-primary: #111827;
  --text-secondary: #4b4663;
  --text-muted: #6b6680;
  --text-disabled: #9ca3af;
  --success: #13795b;
  --success-soft: #e7f4ee;
  --warning: #a15c00;
  --warning-soft: #fff3d8;
  --danger: #b42318;
  --danger-soft: #fde8e5;
  --info: #4b5563;
  --info-soft: #f3f4f6;
  --focus: #8b5cf6;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-pill: 999px;
  --shadow-floating: 0 16px 38px rgba(17, 24, 39, 0.18);
  --app-visible-height: 100dvh;
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
}

.auth-body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: clip;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(244, 244, 246, 0.96)),
    var(--page-bg);
}

.auth-body *,
.auth-body *::before,
.auth-body *::after {
  box-sizing: border-box;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 56px;
  width: min(1040px, 100%);
  max-width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 32px;
}

@supports (min-height: 100dvh) {
  .auth-body,
  .auth-shell {
    min-height: 100dvh;
  }
}

.auth-shell > * {
  min-width: 0;
  max-width: 100%;
}

.auth-identity-panel {
  display: grid;
  gap: 22px;
  width: 100%;
  min-width: 0;
  justify-items: center;
  align-content: center;
  text-align: center;
}

.auth-panel {
  width: min(420px, 100%);
  min-width: 0;
  max-width: 100%;
  justify-self: center;
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(17, 24, 39, 0.1);
}

.auth-brand {
  color: var(--text-primary);
}

.auth-identity-title,
.customer-login-lockup h1 {
  max-width: min(100%, 14ch);
  margin: 0;
  color: var(--text-primary);
  font-size: 42px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.auth-panel h2 {
  margin: 6px 0 0;
  font-size: 30px;
  line-height: 1.1;
}

.customer-login-lockup {
  display: grid;
  gap: 20px;
  width: min(360px, 100%);
  margin: 0 auto;
  align-items: center;
  justify-items: center;
  text-align: center;
}

.customer-login-logo {
  display: block;
  width: min(260px, 100%);
  max-height: 110px;
  object-fit: contain;
  object-position: center;
}

.auth-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

#clerk-auth {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

#clerk-embedded-mount {
  width: min(400px, 100%);
  min-width: 0;
  max-width: 100%;
  justify-self: center;
  overflow-x: clip;
  overflow-y: visible;
}

#clerk-embedded-mount > * {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
}

#clerk-embedded-mount iframe,
#clerk-embedded-mount form,
#clerk-embedded-mount section {
  max-width: 100%;
}

.auth-panel[data-clerk-presentation="embedded"] {
  width: min(400px, 100%);
  padding: 0;
  gap: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.auth-panel[data-clerk-presentation="embedded"] > #auth-title,
.auth-panel[data-clerk-presentation="embedded"] > .auth-copy,
.auth-panel[data-clerk-presentation="embedded"] > .auth-message:empty {
  display: none;
}

#clerk-embedded-mount:empty,
#clerk-fallback-mount:empty {
  display: none;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}

.auth-message {
  min-height: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-continue {
  width: 100%;
  margin-top: 12px;
}

#clerk-fallback-mount {
  margin-top: 16px;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--brand-purple-800);
  border-radius: var(--radius-md);
  background: var(--brand-purple-800);
  color: #ffffff;
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

button:hover,
.link-button:hover {
  background: #3a0f70;
  border-color: #3a0f70;
}

button:disabled,
button:disabled:hover {
  background: var(--surface-subtle);
  border-color: var(--border);
  color: var(--text-disabled);
  cursor: not-allowed;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-subtle);
  border-color: var(--border);
  color: var(--text-disabled);
  cursor: not-allowed;
}

button:focus-visible,
.link-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(139, 92, 246, 0.35);
  outline-offset: 2px;
}

button.secondary,
.link-button.secondary {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-primary);
}

button.secondary:hover,
.link-button.secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

button.secondary:disabled,
button.secondary:disabled:hover,
.link-button.secondary[aria-disabled="true"] {
  background: var(--surface-subtle);
  border-color: var(--border);
  color: var(--text-disabled);
  cursor: not-allowed;
}

button.text-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-purple-800);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.product-shell {
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--page-bg);
}

.brand-bar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  background: var(--brand-purple-950);
  color: #ffffff;
}

.brand-lockup {
  display: flex;
  align-items: center;
  font-size: 15px;
}

.brand-context {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.brand-context .customer-switcher {
  width: auto;
  min-width: 150px;
  max-width: 220px;
  min-height: 32px;
  margin-top: 0;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.brand-context .customer-switcher:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
}

.brand-context .customer-switcher option {
  color: var(--text-primary);
}

.header-profile-button {
  min-height: 32px;
  max-width: min(320px, 32vw);
  min-width: 0;
  justify-content: flex-start;
  gap: 9px;
  padding: 5px 10px 5px 6px;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-weight: 650;
}

.header-profile-button:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
}

.header-admin-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  text-decoration: none;
}

.header-admin-button:hover,
.header-admin-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
}

.header-profile-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--brand-purple-950);
  font-size: 11px;
  font-weight: 800;
}

.header-profile-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
  text-align: left;
  line-height: 1.1;
}

.header-profile-copy strong,
.header-profile-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-profile-copy strong {
  color: #ffffff;
  font-size: 12px;
}

.header-profile-copy small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 600;
}

.mobile-menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-button span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.mobile-profile-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.mobile-profile-button span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 60px);
  overflow: visible;
}

.sidebar {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 60px);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-strong);
  padding: 16px 12px;
  overflow-y: auto;
}

.workspace-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.workspace-logo {
  display: block;
  flex: 0 0 auto;
  width: 108px;
  height: 42px;
  border-radius: 6px;
  object-fit: contain;
  background: #ffffff;
}

.workspace-initials {
  display: inline-flex;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 14px;
  font-weight: 800;
}

.workspace-card strong {
  display: block;
  min-width: 0;
  color: var(--text-primary);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.workspace-card div > span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.customer-switcher {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-primary);
  font-weight: 650;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  justify-content: flex-start;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 650;
}

.nav-item:hover {
  background: #ffffff;
  border-color: var(--border);
  border-left-color: var(--brand-purple-tint);
  color: var(--text-primary);
}

.nav-item.is-active {
  background: #ffffff;
  border-color: var(--border);
  border-left-color: var(--brand-purple-700);
  color: var(--brand-purple-800);
}

.main {
  min-width: 0;
  min-height: 0;
  padding: 26px 26px 32px;
  overflow-y: auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.page-header h1 {
  margin: 2px 0 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}

.page-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.compact-action {
  min-height: 36px;
  padding: 6px 12px;
}

.eyebrow {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.message {
  min-height: 0;
  margin-bottom: 12px;
}

.message:not(:empty) {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: 8px;
  background: var(--info-soft);
  color: var(--info);
}

.message.is-success:not(:empty) {
  border-color: #b9dfcf;
  border-left-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.message.is-error:not(:empty) {
  border-color: #f2b8b2;
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.view {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
}

.panel-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.panel h3 {
  margin: 14px 0 8px;
  font-size: 15px;
  font-weight: 650;
}

.note {
  max-width: 560px;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.form-grid.compact {
  grid-template-columns: 1fr 1fr 220px auto;
  margin-bottom: 14px;
}

.span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.optional-label {
  color: var(--text-disabled);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-primary);
}

textarea {
  resize: vertical;
}

.file-field {
  grid-column: span 2;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: end;
  gap: 10px;
}

.repository-grid {
  display: grid;
  gap: 18px;
}

.table-panel {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-color: var(--border-strong);
}

.table-panel .panel-header {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-strong);
  background: #ffffff;
  align-items: center;
}

.document-group-header {
  cursor: pointer;
  user-select: none;
}

.document-group-header:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.document-group-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.group-caret {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--text-muted);
  transition: transform 120ms ease;
}

.document-group-panel.is-open > .document-group-header .group-caret {
  transform: rotate(90deg);
}

.document-group-count {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.nested-records-panel {
  display: grid;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.nested-record-section {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.nested-record-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  background: #ffffff;
  cursor: pointer;
  user-select: none;
}

.nested-record-header:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.nested-record-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nested-record-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.nested-record-add-button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  min-height: 32px;
}

.nested-record-section.is-open .nested-record-caret {
  transform: rotate(90deg);
}

.nested-record-body {
  min-height: 48px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.capa-surface {
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.repository-grid,
.table-panel,
.document-group-panel,
.document-group-body,
.nested-records-panel,
.nested-record-section,
.nested-record-body,
.detail-panel {
  min-width: 0;
  max-width: 100%;
}

.nested-record-capa-create-button {
  margin-left: auto;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
}

table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
}

.document-table {
  min-width: 760px;
  table-layout: fixed;
}

.document-table .col-title {
  width: 30%;
}

.document-table .col-ref {
  width: 12%;
}

.document-table .col-owner {
  width: 15%;
}

.document-table .col-expiration {
  width: 15%;
}

.document-table .col-uploaded {
  width: 18%;
}

.document-table .col-actions {
  width: 10%;
}

.capa-table {
  min-width: 1280px;
  table-layout: fixed;
}

.resizable-table {
  user-select: auto;
}

.capa-table .col-id {
  width: 5%;
}

.capa-table .col-status {
  width: 7%;
}

.capa-table .col-document {
  width: 16%;
}

.capa-table .col-notes {
  width: 18%;
}

.capa-table .col-date {
  width: 9%;
}

.capa-table .col-owner {
  width: 11%;
}

.capa-table .col-submissions {
  width: 7%;
}

.capa-table .col-actions {
  width: 10%;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.document-table th,
.document-table td {
  padding-right: 14px;
  padding-left: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-header-bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.capa-header-button,
.capa-header-static {
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  min-width: 0;
  max-width: 100%;
  gap: 5px;
  color: inherit;
  font: inherit;
  letter-spacing: 0;
  text-align: inherit;
  white-space: inherit;
}

.capa-header-button {
  margin: -6px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.capa-header-button:hover,
.capa-header-button:focus-visible {
  background: rgba(75, 20, 140, 0.08);
  color: var(--text-primary);
}

.capa-header-button::after {
  width: 10px;
  color: var(--brand-purple-700);
  content: "";
  font-size: 10px;
  line-height: 1;
}

.capa-table th[data-sort-direction="asc"] .capa-header-button::after {
  content: "▲";
}

.capa-table th[data-sort-direction="desc"] .capa-header-button::after {
  content: "▼";
}

.capa-table th[data-reorderable-column="true"] {
  cursor: grab;
}

.capa-table th.is-column-dragging {
  opacity: 0.72;
}

.capa-table th.is-column-drop-target {
  box-shadow: inset 3px 0 0 var(--brand-purple-700);
}

body.is-column-reordering {
  cursor: grabbing;
  user-select: none;
}

td {
  color: var(--text-secondary);
  height: 54px;
}

tbody tr:hover {
  background: var(--table-row-hover);
}

td strong {
  color: var(--text-primary);
  font-weight: 650;
}

.doc-title {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.mobile-row-date,
.mobile-detail-action {
  display: none;
}

.document-table th:nth-child(n + 2),
.document-table td:nth-child(n + 2) {
  white-space: nowrap;
}

.document-table th:last-child,
.document-table td:last-child,
.capa-table th[data-column-id="id"],
.capa-table td[data-column-id="id"],
.capa-table th[data-column-id="status"],
.capa-table td[data-column-id="status"],
.capa-table th[data-column-id="due_date"],
.capa-table td[data-column-id="due_date"],
.capa-table th[data-column-id="created"],
.capa-table td[data-column-id="created"],
.capa-table th[data-column-id="actions"],
.capa-table th:last-child,
.capa-table td.actions {
  text-align: center;
}

.capa-table td.actions > * {
  margin-right: auto;
  margin-left: auto;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.capa-table th,
.capa-table td {
  white-space: nowrap;
}

.capa-table td[data-column-id="template"],
.capa-table td[data-column-id="document"],
.capa-table td[data-column-id="client_reference_number"],
.capa-table td[data-column-id="internal_reference_number"],
.capa-table td[data-column-id="last_action_by"],
.capa-table td[data-column-id="notes"] {
  white-space: normal;
  overflow-wrap: anywhere;
}

td.actions {
  white-space: nowrap;
}

td.actions > * + * {
  margin-left: 6px;
}

.capa-row.has-submissions {
  cursor: pointer;
}

.capa-row.has-submissions:hover td {
  background: var(--table-row-hover);
}

.capa-row.has-submissions:focus {
  outline: none;
}

.capa-row.has-submissions:focus-visible td {
  background: var(--table-row-hover);
}

.submission-count-text {
  min-height: 0;
  padding: 0;
  color: var(--text-primary);
  font-size: 13px;
}

.inline-date-button {
  min-height: 0;
  width: auto;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.inline-date-button:hover,
.inline-date-button:focus {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
  outline: none;
}

.document-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.document-cell a {
  color: var(--text-primary);
  text-decoration: none;
}

.document-cell a:hover {
  text-decoration: underline;
}

.submission-type-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--brand-purple-soft);
  color: var(--brand-purple-800);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.capa-notes-cell {
  overflow-wrap: anywhere;
  white-space: normal;
}

.capa-notes-button {
  display: grid;
  width: 100%;
  gap: 5px;
  margin: -6px -7px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.capa-notes-button:hover,
.capa-notes-button:focus-visible {
  border-color: var(--border);
  background: var(--surface-subtle);
  outline: none;
}

.capa-notes-preview-text {
  display: -webkit-box;
  max-height: calc(1.35em * 3);
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.capa-notes-affordance {
  color: var(--brand-purple);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 120ms ease;
}

.capa-notes-button:hover .capa-notes-affordance,
.capa-notes-button:focus-visible .capa-notes-affordance {
  opacity: 1;
}

@media (hover: none) {
  .capa-notes-affordance {
    opacity: 1;
  }
}

.capa-notes-card {
  border: 1px solid rgba(75, 20, 140, 0.16);
  background:
    radial-gradient(circle at top left, rgba(75, 20, 140, 0.08), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.22);
}

.capa-notes-dialog-body {
  padding: 6px 4px 2px 16px;
}

.capa-notes-timeline {
  gap: 16px;
  padding: 8px 0 4px 30px;
}

.capa-notes-timeline::before {
  left: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(75, 20, 140, 0.28), rgba(75, 20, 140, 0.08));
}

.capa-note-entry {
  padding: 14px 16px;
  border: 1px solid rgba(75, 20, 140, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
}

.capa-note-entry::before {
  left: -28px;
  width: 13px;
  height: 13px;
  border: 3px solid #ffffff;
  background: var(--brand-purple-800);
  box-shadow: 0 0 0 4px var(--brand-purple-soft);
}

.capa-note-entry-heading {
  align-items: flex-start;
  gap: 8px 10px;
  flex-wrap: wrap;
}

.capa-note-entry-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.capa-note-entry-note {
  margin-top: 10px;
  border-color: rgba(75, 20, 140, 0.12);
  background: rgba(255, 255, 255, 0.92);
}

.capa-table td[data-column-id="created_by"] {
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal.capa-files-modal {
  width: min(980px, calc(100vw - 32px));
  max-width: none;
}

.capa-files-card {
  max-height: min(760px, calc(100vh - 48px));
  gap: 0;
  overflow: hidden;
}

.capa-files-card .panel-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

#capa-files-title {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.capa-files-dialog-body {
  overflow: auto;
  padding-top: 14px;
}

.modal.capa-notes-modal {
  width: min(640px, calc(100vw - 32px));
  max-width: none;
}

.capa-notes-card {
  max-height: min(720px, calc(100vh - 48px));
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(75, 20, 140, 0.16);
  background:
    radial-gradient(circle at top left, rgba(75, 20, 140, 0.08), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.22);
}

.capa-notes-card .panel-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

#capa-notes-title {
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.capa-notes-dialog-body {
  overflow: auto;
  padding: 16px 4px 2px 18px;
}

.capa-notes-timeline {
  position: relative;
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 8px 0 4px 30px;
  list-style: none;
}

.capa-notes-timeline::before {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(75, 20, 140, 0.28), rgba(75, 20, 140, 0.08));
  content: "";
}

.capa-note-entry {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(75, 20, 140, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
}

.capa-note-entry:last-child {
  padding-bottom: 14px;
}

.capa-note-entry::before {
  position: absolute;
  top: 18px;
  left: -28px;
  width: 13px;
  height: 13px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--brand-purple-800);
  box-shadow: 0 0 0 4px var(--brand-purple-soft);
  content: "";
}

.capa-note-entry-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.capa-note-entry-title {
  min-width: 0;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.capa-note-entry-title:hover {
  text-decoration: underline;
}

.capa-note-entry-author,
.capa-note-entry-time {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.3;
}

.capa-note-entry-note {
  margin: 2px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(75, 20, 140, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-secondary);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.capa-note-entry-note.is-empty {
  color: var(--text-muted);
}

.capa-submission-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
}

.capa-submission-table {
  width: 100%;
  min-width: 780px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.capa-submission-table .col-title {
  width: 30%;
}

.capa-submission-table .col-notes {
  width: 30%;
}

.capa-submission-table .col-submitted-by {
  width: 22%;
}

.capa-submission-table .col-submitted {
  width: 15%;
}

.capa-submission-table .col-actions {
  width: 8%;
}

.capa-submission-table th,
.capa-submission-table td {
  height: auto;
  padding: 9px 12px;
  white-space: normal;
}

.capa-submission-table th {
  position: static;
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.capa-submission-table td {
  background: #ffffff;
  font-size: 13px;
}

.capa-submission-table tbody tr:last-child td {
  border-bottom: 0;
}

.capa-submission-table th:last-child,
.capa-submission-table td:last-child {
  text-align: right;
}

.capa-submission-notes-cell {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.capa-submission-table td[data-label="Date submitted"] {
  white-space: nowrap;
}

.capa-submission-table td[data-label="Submitted by"] {
  overflow-wrap: anywhere;
}

.table-action {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.table-icon-action {
  width: 38px;
  min-width: 38px;
  padding: 0;
  gap: 0;
}

.add-file-icon-action {
  width: 46px;
  min-width: 46px;
  gap: 1px;
}

.action-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.action-icon-small {
  width: 14px;
  height: 14px;
}

.row-primary-action {
  min-height: 38px;
  padding: 7px 13px;
  border-color: var(--brand-purple-800);
  background: var(--brand-purple-800);
  color: #ffffff;
  font-weight: 750;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(75, 20, 140, 0.12);
}

.row-primary-action:hover,
.row-primary-action:focus-visible {
  border-color: var(--brand-purple-700);
  background: var(--brand-purple-700);
  color: #ffffff;
}

.table-icon-action.row-primary-action {
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.icon-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: none;
  white-space: nowrap;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--info-soft);
  color: var(--info);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.status.current,
.status.closed {
  background: var(--success-soft);
  color: var(--success);
}

.status.open,
.status.due-soon {
  background: var(--warning-soft);
  color: var(--warning);
}

.status.new {
  background: var(--brand-purple-soft);
  color: var(--brand-purple-700);
}

.status.overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.detail-panel {
  display: grid;
  gap: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.2fr);
  gap: 16px;
}

.metadata {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.metadata dt,
.metadata dd {
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.metadata dt {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-weight: 650;
}

th.resizable-header {
  position: sticky;
  padding-right: 20px;
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  width: 14px;
  cursor: col-resize;
  touch-action: none;
}

.column-resize-handle::after {
  position: absolute;
  top: 12px;
  right: 6px;
  bottom: 12px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  content: "";
  transition: background 120ms ease, box-shadow 120ms ease;
}

.column-resize-handle:hover::after,
.column-resize-handle:focus-visible::after,
body.is-column-resizing .column-resize-handle::after {
  background: var(--brand-purple-700);
  box-shadow: 0 0 0 2px var(--brand-purple-soft);
}

body.is-column-resizing {
  cursor: col-resize;
  user-select: none;
}

.metadata dd {
  min-width: 0;
  color: var(--text-secondary);
}

.metadata dt:last-of-type,
.metadata dd:last-of-type {
  border-bottom: 0;
}

.pdf-frame {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.file-attachment-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 120px;
  padding: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.file-attachment-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.file-attachment-copy strong {
  overflow-wrap: anywhere;
}

.file-attachment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty {
  padding: 16px 18px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--empty-bg);
  font-size: 13px;
}

.small {
  color: var(--text-muted);
  font-size: 12px;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(var(--app-visible-height, 100dvh) - 24px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(17, 24, 39, 0.38);
}

.modal-card {
  display: grid;
  gap: 14px;
  max-height: calc(var(--app-visible-height, 100dvh) - 24px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.24);
}

.modal-card .panel-header {
  margin-bottom: 0;
}

body.is-uploading {
  cursor: progress;
}

.modal-card[aria-busy="true"],
.form-grid[aria-busy="true"] {
  opacity: 0.72;
}

.upload-overlay {
  width: min(420px, calc(100vw - 48px));
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
  cursor: progress;
}

.upload-overlay::backdrop {
  background: rgba(29, 18, 52, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.upload-status-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 22px 24px;
  border: 1px solid rgba(75, 20, 140, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 54px rgba(17, 24, 39, 0.26);
}

.upload-status-card strong {
  display: block;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 750;
}

.upload-status-card p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.upload-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--brand-purple-tint);
  border-top-color: var(--brand-purple-800);
  border-radius: 50%;
  animation: upload-spin 780ms linear infinite;
}

@keyframes upload-spin {
  to {
    transform: rotate(360deg);
  }
}

.upload-tray {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
}

body.has-upload-tray .main {
  padding-bottom: 170px;
}

.upload-tray-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(75, 20, 140, 0.16);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-floating);
}

.upload-tray-header,
.upload-tray-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.upload-tray-header div {
  min-width: 0;
}

.upload-tray-header strong,
.upload-tray-header span,
.upload-tray-footer > span:first-child {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-tray-header strong {
  color: var(--text-primary);
  font-size: 14px;
}

.upload-tray-header span,
.upload-tray-footer {
  color: var(--text-muted);
  font-size: 12px;
}

.upload-tray-status {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-weight: 650;
}

.upload-tray-item.is-ready .upload-tray-status {
  background: var(--success-soft);
  color: var(--success);
}

.upload-tray-item.is-failed .upload-tray-status,
.upload-tray-item.is-backup_failed .upload-tray-status,
.upload-tray-item.is-canceled .upload-tray-status {
  background: var(--danger-soft);
  color: var(--danger);
}

.upload-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--brand-purple-soft);
}

.upload-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-purple-800);
  transition: width 140ms ease;
}

.upload-tray-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.upload-tray-actions .table-action {
  min-height: 30px;
  padding: 4px 8px;
}

.mobile-nav-dialog,
.mobile-detail-dialog {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.mobile-nav-dialog::backdrop,
.mobile-detail-dialog::backdrop {
  background: rgba(17, 24, 39, 0.38);
}

.mobile-nav-dialog {
  width: min(320px, calc(100vw - 28px));
  max-width: none;
  max-height: none;
  height: 100dvh;
  margin: 0 0 0 auto;
}

.mobile-nav-card {
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -16px 0 40px rgba(17, 24, 39, 0.18);
}

.mobile-nav-header,
.mobile-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.mobile-nav-header h2,
.mobile-detail-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.mobile-workspace-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.mobile-workspace-card strong,
.mobile-workspace-card div > span {
  display: block;
}

.mobile-workspace-card strong {
  min-width: 0;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.mobile-workspace-card div > span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.mobile-nav-list {
  display: grid;
  gap: 8px;
}

.mobile-nav-item,
.mobile-profile-action {
  justify-content: flex-start;
  width: 100%;
}

.mobile-profile-action[href] {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  text-decoration: none;
}

.mobile-nav-item {
  border-color: var(--border);
  background: #ffffff;
  color: var(--text-primary);
}

.mobile-nav-item.is-active {
  border-color: var(--brand-purple-tint);
  background: var(--brand-purple-soft);
  color: var(--brand-purple-800);
}

.mobile-detail-dialog {
  width: min(100vw - 24px, 420px);
  max-width: none;
  max-height: 82dvh;
  margin: auto auto 0;
  overflow: hidden;
}

.mobile-detail-card {
  display: grid;
  gap: 14px;
  max-height: 82dvh;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 42px rgba(17, 24, 39, 0.24);
}

.mobile-detail-fields {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.mobile-detail-fields div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.mobile-detail-fields div:last-child {
  border-bottom: 0;
}

.mobile-detail-fields dt,
.mobile-detail-fields dd {
  margin: 0;
}

.mobile-detail-fields dt {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.mobile-detail-fields dd {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.modal-fields {
  display: grid;
  gap: 12px;
}

.contributor-field {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.contributor-field[hidden] {
  display: none;
}

.contributor-field legend {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.contributor-options {
  display: grid;
  gap: 8px;
}

.assignee-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.assignee-picker-title {
  display: grid;
  gap: 2px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 750;
}

.assignee-picker-title small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.assignee-add-button,
.assignee-remove-button {
  flex: 0 0 auto;
}

.selected-assignees {
  display: grid;
  gap: 8px;
}

.contributor-option {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, auto) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.selected-assignee-row {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.contributor-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.contributor-identity span,
.contributor-identity small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contributor-identity small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.permission-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.contributor-option input {
  width: 16px;
  min-height: 16px;
  padding: 0;
  flex: 0 0 auto;
}

.permission-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.assignee-picker {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.assignee-picker input[type="search"] {
  width: 100%;
}

.assignee-picker-results {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.assignee-picker-option {
  display: grid;
  justify-items: start;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-primary);
  text-align: left;
}

.assignee-picker-option small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 720px) {
  .contributor-option {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .permission-option {
    justify-content: flex-start;
  }
}

.profile-fields {
  display: grid;
  gap: 12px;
  margin: 0;
}

.profile-fields div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.profile-fields dt {
  color: var(--text-muted);
  font-size: 12px;
}

.profile-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-weight: 600;
}

.brand-link {
  color: #ffffff;
  text-decoration: none;
}

.admin-body {
  min-height: 100vh;
  background: var(--page-bg);
}

.admin-shell {
  min-height: 100vh;
}

.admin-brand-context {
  margin-left: auto;
}

.admin-back-link {
  min-height: 34px;
  padding: 7px 12px;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  text-decoration: none;
}

.admin-back-link:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
}

.admin-profile-chip {
  pointer-events: none;
}

.admin-main {
  display: grid;
  gap: 18px;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.admin-page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.admin-page-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.admin-message {
  min-width: min(420px, 100%);
  margin: 0;
}

.admin-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.admin-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(280px, 1.4fr);
  gap: 12px;
  align-items: stretch;
}

.admin-status-tile,
.admin-status-breakdown {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.admin-status-tile {
  display: grid;
  gap: 6px;
}

.admin-status-tile span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
}

.admin-status-tile strong {
  color: var(--text-primary);
  font-size: 30px;
  line-height: 1;
}

.admin-status-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.admin-status-breakdown-row {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-status-breakdown-row strong,
.admin-status-breakdown-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-status-breakdown-row strong {
  font-size: 13px;
}

.admin-status-breakdown-row small {
  color: var(--text-muted);
  font-size: 12px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-section-nav {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.admin-section-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 750;
  text-decoration: none;
}

.admin-section-link:hover {
  border-color: var(--border);
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.admin-section-link.is-active {
  border-color: rgba(75, 20, 140, 0.16);
  background: var(--brand-purple-soft);
  color: var(--brand-purple-800);
}

.admin-section-content {
  min-width: 0;
}

.admin-section-panel[hidden] {
  display: none;
}

.admin-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  align-content: start;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.admin-inline-form button {
  white-space: nowrap;
}

.admin-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.admin-scroll-list {
  max-height: min(55vh, 560px);
  overflow-y: auto;
  padding-right: 4px;
}

.admin-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-subtle);
}

#admin-customers-list .admin-list-row {
  min-height: 64px;
}

.admin-list-row-actions {
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
}

.admin-row-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-row-main strong,
.admin-row-main small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-main small,
.admin-table small {
  display: block;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--info-soft);
  color: var(--info);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill.is-open {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.is-closed {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill.is-pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.admin-role-static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 750;
  white-space: nowrap;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-scroll-table {
  max-height: min(55vh, 560px);
  overflow: auto;
}

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--surface);
}

.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-header-bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.admin-empty-state {
  margin: 0;
  padding: 14px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.file-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-upload-row .small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-status {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.file-preview-link {
  display: inline-block;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--brand-purple-800);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-preview-note {
  color: var(--warning);
  white-space: nowrap;
}

.file-preview-status.is-invalid .file-preview-link {
  color: var(--text-secondary);
}

@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 22px;
    width: 100%;
    padding: 20px;
  }

  .auth-identity-panel {
    justify-items: center;
    text-align: center;
  }

  .auth-shell[data-auth-mode="generic"] .auth-identity-panel {
    gap: 0;
  }

  .auth-shell[data-auth-mode="generic"] .auth-identity-title,
  .auth-shell[data-auth-mode="generic"] .auth-identity-panel > .auth-copy {
    display: none;
  }

  .auth-identity-title,
  .customer-login-lockup h1 {
    max-width: min(100%, 14ch);
    font-size: 30px;
  }

  .customer-login-logo {
    width: min(190px, 100%);
    max-height: 82px;
    object-position: center;
  }

  .auth-panel {
    width: min(420px, 100%);
    padding: 22px;
  }

  .brand-bar {
    height: 56px;
    min-height: 56px;
    align-items: center;
    padding: 12px 16px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .brand-lockup strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-context {
    flex-wrap: wrap;
    margin-left: auto;
  }

  .admin-main {
    padding: 18px 14px 28px;
  }

  .admin-page-header {
    align-items: start;
    flex-direction: column;
  }

  .admin-layout,
  .admin-inline-form {
    grid-template-columns: 1fr;
  }

  .admin-status-grid {
    grid-template-columns: 1fr;
  }

  .admin-status-breakdown {
    grid-template-columns: 1fr;
  }

  .admin-section-nav {
    position: static;
    grid-template-columns: 1fr;
  }

  .admin-list-row,
  .admin-list-row-actions {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }

  .admin-table {
    min-width: 640px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: auto;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border-strong);
    overflow: visible;
  }

  .workspace-card {
    margin: 0;
    min-width: 210px;
  }

  .nav {
    display: flex;
    gap: 8px;
  }

  .nav-item {
    width: auto;
  }

  .main {
    padding: 16px;
    overflow: visible;
  }

  .page-header {
    align-items: flex-end;
    gap: 12px;
  }

  .page-actions {
    align-items: center;
    justify-content: flex-end;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .table-panel .panel-header,
  .modal-card .panel-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .table-panel .panel-header {
    padding: 10px 12px;
  }

  table,
  .document-table,
  .capa-table {
    min-width: 0;
  }

  .panel-title-row {
    align-items: center;
  }

  .form-grid,
  .form-grid.compact,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .file-field {
    grid-column: auto;
  }

  .file-upload-row {
    align-items: stretch;
    flex-direction: column;
  }

}

@media (max-height: 480px) and (orientation: landscape) {
  .modal,
  .modal.capa-files-modal,
  .modal.capa-notes-modal {
    width: min(640px, calc(100% - 32px));
    max-width: calc(100% - 32px);
    height: auto;
    max-height: calc(var(--app-visible-height, 100dvh) - 24px);
    margin-left: 16px;
    margin-right: auto;
    margin-top: 12px;
    margin-bottom: auto;
  }

  .modal.capa-files-modal {
    width: min(760px, calc(100% - 32px));
  }

  .modal-card,
  .capa-files-card,
  .capa-notes-card {
    max-height: calc(var(--app-visible-height, 100dvh) - 24px);
  }
}

@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .resizable-table {
    width: 100% !important;
    min-width: 0 !important;
  }

  .column-resize-handle {
    display: none;
  }

  .table-panel .table-wrap {
    max-height: none;
    overflow: visible;
  }

  table,
  .document-table,
  .capa-table {
    min-width: 0;
  }

  .document-table colgroup,
  .document-table thead,
  .capa-table colgroup,
  .capa-table thead {
    display: none;
  }

  .document-table,
  .document-table tbody,
  .document-table tr,
  .document-table td,
  .capa-table,
  .capa-table tbody,
  .capa-table tr,
  .capa-table td {
    display: block;
    width: 100%;
  }

  .document-table tbody,
  .capa-table tbody {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .document-table tr,
  .capa-table tr {
    overflow: hidden;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #ffffff;
  }

  .document-table tr:last-child,
  .capa-table tr:last-child {
    border-bottom: 1px solid var(--border);
  }

  .document-table td,
  .capa-table td {
    display: grid;
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    gap: 8px;
    height: auto;
    min-height: 0;
    padding: 4px 0;
    border-bottom: 0;
    white-space: normal !important;
  }

  .document-table td > .status,
  .capa-table td > .status {
    justify-self: start;
  }

  .document-table td::before,
  .capa-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 650;
  }

  .document-table td[data-label="Title"],
  .capa-table td[data-label="ID"] {
    display: block;
    padding-bottom: 8px;
  }

  .mobile-row-date {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
  }

  .mobile-detail-action {
    display: inline-flex;
  }

  .document-table td[data-label="Owner"],
  .document-table td[data-label="Uploaded"],
  .document-table td[data-label="Expiration"],
  .capa-table td[data-label="Created"],
  .capa-table td[data-column-id="created_by"] {
    display: none;
  }

  .document-table td[data-label="Title"]::before,
  .capa-table td[data-label="ID"]::before,
  .document-table td.actions::before,
  .capa-table td.actions::before {
    display: none;
  }

  .document-table td[data-label="Expiration"]:empty {
    display: none;
  }

  .document-table td.actions,
  .capa-table td.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .document-table td.actions > *,
  .capa-table td.actions > * {
    margin-left: 0;
  }

  #admin-customer-users-list {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  #admin-customer-users-list .admin-table {
    min-width: 0;
  }

  #admin-customer-users-list .admin-table thead {
    display: none;
  }

  #admin-customer-users-list .admin-table,
  #admin-customer-users-list .admin-table tbody,
  #admin-customer-users-list .admin-table tr,
  #admin-customer-users-list .admin-table td {
    display: block;
    width: 100%;
  }

  #admin-customer-users-list .admin-table tbody {
    display: grid;
    gap: 10px;
  }

  #admin-customer-users-list .admin-table tr {
    overflow: hidden;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #ffffff;
  }

  #admin-customer-users-list .admin-table td {
    display: grid;
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    gap: 8px;
    height: auto;
    min-height: 0;
    padding: 4px 0;
    border-bottom: 0;
    white-space: normal;
  }

  #admin-customer-users-list .admin-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 650;
  }

  #admin-customer-users-list .admin-table td.actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  #admin-customer-users-list .admin-table td.actions::before {
    display: none;
  }

  .capa-submission-table-wrap {
    overflow: visible;
    border: 0;
  }

  .capa-submission-table,
  .capa-submission-table tbody,
  .capa-submission-table tr,
  .capa-submission-table td {
    display: block;
    width: 100%;
  }

  .capa-submission-table {
    min-width: 0;
  }

  .capa-submission-table tbody {
    display: grid;
    gap: 10px;
    padding: 0;
  }

  .capa-submission-table colgroup,
  .capa-submission-table thead {
    display: none;
  }

  .capa-submission-table .capa-submission-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
  }

  .capa-submission-table .capa-submission-item:last-child {
    border-bottom: 1px solid var(--border);
  }

  .capa-submission-table td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 8px;
    height: auto;
    min-height: 0;
    padding: 4px 0;
    border-bottom: 0;
    text-align: left !important;
    white-space: normal !important;
  }

  .capa-submission-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 650;
  }

  .capa-submission-table td[data-label="Date submitted"] {
    display: grid;
  }

  .capa-submission-table td.actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }

  .capa-submission-table td.actions::before {
    display: none;
  }
}

@media (max-width: 640px) {
  .brand-bar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 8px;
  }

  .brand-lockup {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    justify-self: center;
  }

  .brand-lockup strong {
    display: block;
    max-width: min(190px, calc(100vw - 156px));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-brand {
    grid-column: auto;
    grid-row: auto;
  }

  .brand-context {
    display: none;
  }

  .mobile-menu-button {
    display: inline-flex;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .mobile-profile-button {
    display: inline-flex;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .sidebar {
    display: none;
  }

  .page-header h1 {
    font-size: 26px;
  }
}
