:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, Arial, sans-serif;
  --bg: #e7e7e7;
  --surface: #ffffff;
  --surface-soft: #e7e7e7;
  --border: #303635;
  --text: #0e1010;
  --muted: #303635;
  --primary: #303635;
  --primary-dark: #0e1010;
  --sidebar: #0e1010;
  --sidebar-muted: #e7e7e7;
  --sev-critical: #5c1c1c;
  --sev-high: #b83737;
  --sev-medium: #c65f5f;
  --sev-low: #dc9b9b;
  --status-new: #d4e0d6;
  --status-assigned: #a8c2af;
  --status-in-progress: #7ea687;
  --status-fixed: #4a6f54;
  --status-retest: #365e3f;
  --status-closed: #23402a;
  --status-reopened: #8b0000;
  --shadow: none;
  --chart-canvas-height: 250px;
  --control-height: 38px;
  --control-compact-height: 34px;
  --control-radius: 6px;
  --control-x-padding: 12px;
  --control-border: var(--border);
  --control-focus-ring: color-mix(in srgb, var(--status-assigned) 62%, transparent);
  --table-header-height: 44px;
  --table-row-height: 54px;
  --management-row-height: 64px;
}

* {
  box-sizing: border-box;
}

::selection {
  background: var(--status-assigned);
  color: var(--text);
}

::-moz-selection {
  background: var(--status-assigned);
  color: var(--text);
}

html,
body {
  min-height: 100%;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: 0;
}

.dt-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.dt-loader.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.dt-loader-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: 210px;
  padding: 22px 24px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--text) 16%, transparent);
}

.dt-loader-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--primary);
  color: var(--surface);
  font-size: 19px;
  font-weight: 800;
}

.dt-loader-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--surface) 24%, transparent) 48%, transparent 100%);
  transform: translateX(-100%);
  animation: dt-scan 1.35s ease-in-out infinite;
}

.dt-loader-mark::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-in-progress);
  box-shadow: -12px 0 0 var(--sev-medium);
}

.dt-loader-text {
  margin: 0;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}

.dt-loader-bar {
  width: 130px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg);
}

.dt-loader-bar::before {
  content: "";
  display: block;
  width: 44%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  animation: dt-progress 1.2s ease-in-out infinite;
}

@keyframes dt-scan {
  0% { transform: translateX(-100%); }
  52%, 100% { transform: translateX(100%); }
}

@keyframes dt-progress {
  0% { transform: translateX(-110%); }
  55%, 100% { transform: translateX(240%); }
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.button,
input,
select,
textarea {
  border-radius: var(--control-radius);
}

button,
.button,
input[type="submit"],
input[type="button"] {
  height: auto;
  min-height: var(--control-height);
  padding: 0 16px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: var(--control-height);
}

button:focus,
button:active,
.button:focus,
.button:active,
input[type="submit"]:focus,
input[type="submit"]:active,
input[type="button"]:focus,
input[type="button"]:active {
  border-color: var(--primary);
  color: var(--primary);
  outline: none;
}

button:focus-visible,
.button:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-assigned) 75%, transparent);
}

.button-primary,
button.button-primary,
input[type="submit"].button-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--surface);
}

.button-primary:hover,
button.button-primary:hover,
.button-primary:focus,
button.button-primary:focus,
.button-primary:active,
button.button-primary:active,
input[type="submit"].button-primary:hover,
input[type="submit"].button-primary:focus,
input[type="submit"].button-primary:active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--surface);
}

.button.button-primary.create-defect-cta {
  background-color: var(--sev-medium);
  border-color: var(--sev-medium);
  color: var(--surface);
}

.button.button-primary.create-defect-cta:hover {
  background-color: var(--sev-critical);
  border-color: var(--sev-critical);
  color: var(--surface);
}

.button.button-primary.create-defect-cta:focus,
.button.button-primary.create-defect-cta:active {
  background-color: var(--sev-critical);
  border-color: var(--sev-critical);
  color: var(--surface);
}

input,
input[type="email"],
input[type="number"],
input[type="search"],
input[type="text"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--control-border);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  box-shadow: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

input:not([type="file"]):not([type="hidden"]),
select {
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 var(--control-x-padding);
  line-height: var(--control-height);
}

input[type="date"] {
  color-scheme: light;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--text);
}

input:focus,
select:focus,
textarea:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
textarea:focus {
  border-color: var(--text);
  outline: none;
  box-shadow: 0 0 0 3px var(--control-focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--primary);
  opacity: 0.7;
}

input[type="file"] {
  padding: 8px;
  line-height: 1.4;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 1px solid var(--primary);
  border-radius: 5px;
  background: var(--surface);
  color: var(--primary);
  font-family: var(--font-sans);
  font-weight: 600;
}

input[type="file"]::file-selector-button:hover {
  background: var(--bg);
  color: var(--text);
}

input[readonly],
textarea[readonly],
input[disabled],
select[disabled],
textarea[disabled] {
  background: var(--bg);
  border-color: var(--bg);
  color: var(--primary);
  cursor: not-allowed;
}

input[readonly]:focus,
textarea[readonly]:focus,
input[disabled]:focus,
select[disabled]:focus,
textarea[disabled]:focus {
  border-color: var(--primary);
  box-shadow: none;
}

input.is-invalid,
select.is-invalid,
textarea.is-invalid,
.tiptap-editor.is-invalid {
  border-color: var(--sev-high) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sev-low) 48%, transparent);
}

.field-error {
  margin: 6px 0 0;
  color: var(--sev-high);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

[data-form-message].is-error,
.muted.is-error {
  color: var(--sev-high);
  font-weight: 600;
}

[data-form-message].is-success,
.muted.is-success {
  color: var(--status-retest);
  font-weight: 600;
}

.record-table input.is-invalid,
.record-table select.is-invalid {
  box-shadow: inset 0 0 0 1px var(--sev-high);
}

.validation-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1100;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 14px;
  border: 1px solid var(--sev-high);
  border-radius: 8px;
  background: var(--surface);
  color: var(--sev-high);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 14px 34px color-mix(in srgb, var(--primary) 18%, transparent);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.validation-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.validation-toast.is-error {
  border-color: var(--sev-high);
  color: var(--sev-high);
}

label {
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

textarea {
  min-height: 110px;
  padding: 10px var(--control-x-padding);
  line-height: 1.45;
  resize: vertical;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface) 54%, var(--bg) 100%);
}

.login-parent-brand {
  position: fixed;
  left: 50%;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.78;
  white-space: nowrap;
}

.login-parent-brand img {
  width: 18px;
  height: 18px;
  display: block;
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--bg);
  border-radius: 8px;
  box-shadow: 0 18px 46px color-mix(in srgb, var(--text) 14%, transparent);
}

.login-card-mark {
  position: absolute;
  top: 24px;
  right: 24px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: var(--primary);
  color: var(--surface);
  font-weight: 800;
}

.login-title {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
}

.login-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
}

.login-card .button-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--surface);
}

.login-card .button-primary:hover,
.login-card .button-primary:focus,
.login-card .button-primary:active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.login-context-field {
  margin: 16px 0 18px;
}

.login-context-label {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.login-context-toggle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
}

.login-context-toggle button {
  display: grid;
  gap: 2px;
  min-height: 54px;
  height: auto;
  margin: 0;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  line-height: 1.1;
  text-transform: none;
  letter-spacing: 0;
}

.login-context-toggle button strong {
  color: inherit;
  font-size: 16px;
  line-height: 1.1;
}

.login-context-toggle button span {
  color: inherit;
  opacity: 0.82;
}

.login-context-toggle button:hover,
.login-context-toggle button:focus {
  border-color: var(--bg);
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.login-context-toggle button.active,
.login-context-toggle button.active:hover,
.login-context-toggle button.active:focus {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--surface);
}

.login-context-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 250px minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.app-shell:not(.is-sidebar-ready) {
  opacity: 0;
  transition: none;
}

.app-shell:not(.is-sidebar-ready) .sidebar,
.app-shell:not(.is-sidebar-ready) .nav a {
  transition: none;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 74px minmax(0, 1fr);
}

.app-shell.sidebar-hidden {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  overflow: visible;
  background: var(--sidebar);
  color: var(--surface);
  z-index: 5;
  transition: padding 180ms ease, transform 180ms ease;
}

.sidebar-toggle,
.sidebar-restore-tab {
  display: grid;
  width: 28px;
  height: 46px;
  min-height: 46px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0;
  line-height: 0;
}

.sidebar-toggle svg,
.sidebar-restore-tab svg,
.chart-drag-handle svg,
.chart-remove-button svg,
.chart-resize-handle svg,
.workflow-zoom-controls button svg,
.export-split-caret svg,
.profile-icon-button svg {
  display: block;
  pointer-events: none;
}

.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -14px;
  z-index: 6;
  transform: translateY(-50%);
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible,
.sidebar-restore-tab:hover,
.sidebar-restore-tab:focus-visible {
  background: var(--bg);
  border-color: var(--text);
  color: var(--text);
}

.sidebar-hide-action {
  position: absolute;
  right: 16px;
  bottom: 18px;
  left: 16px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.sidebar-hide-action:hover,
.sidebar-hide-action:focus {
  color: var(--surface);
  text-decoration-color: var(--surface);
}

.sidebar-restore-tab {
  position: fixed;
  top: 50%;
  left: 0;
  z-index: 30;
  display: none;
  border-left: 0;
  border-radius: 0 999px 999px 0;
  transform: translateY(-50%);
}

.sidebar-restore-tab.is-visible {
  display: grid;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 22px;
  border-radius: 7px;
  font-size: 19px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.brand:hover,
.brand:focus {
  color: var(--surface);
  outline: none;
}

.brand:focus .brand-mark {
  box-shadow: 0 0 0 2px var(--bg);
}

.brand:hover .brand-mark {
  background: var(--primary);
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: var(--primary);
  color: var(--surface);
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  min-height: 43px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--sidebar-muted);
  font-weight: 600;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}

.nav a:hover,
.nav a.active {
  background: var(--primary);
  color: var(--surface);
}

.nav-icon {
  width: 18px;
  min-width: 18px;
  text-align: center;
  color: var(--bg);
  flex: 0 0 18px;
  font-size: 15px;
}

.sidebar-profile {
  position: absolute;
  right: 16px;
  bottom: 76px;
  left: 16px;
  margin: 0;
}

.sidebar-profile-trigger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  width: 100%;
  min-height: 36px;
  height: auto;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--text);
  color: var(--surface);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.15;
}

.sidebar-profile-trigger:hover,
.sidebar-profile-trigger:focus {
  background: var(--primary);
  border-color: var(--bg);
  color: var(--surface);
}

.sidebar-profile-user {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-profile-separator {
  color: var(--bg);
  font-size: 12px;
  line-height: 1;
}

.sidebar-profile-context {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bg);
  font-size: 12px;
  font-weight: 600;
}

.sidebar-profile-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 34px color-mix(in srgb, var(--text) 18%, transparent);
  overflow: hidden;
}

.sidebar-profile-menu[hidden] {
  display: none;
}

.profile-menu-label {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.profile-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-bottom: 1px solid var(--bg);
}

.profile-menu-head strong {
  display: block;
  line-height: 1.2;
}

.profile-menu-head strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.profile-icon-button {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--bg);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
  line-height: 1;
}

.profile-icon-button:hover,
.profile-icon-button:focus,
.profile-icon-button:active {
  border-color: var(--primary);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.profile-menu-action {
  display: block;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--primary);
  text-align: left;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  transition: background 120ms ease, color 120ms ease;
}

.profile-menu-action:hover,
.profile-menu-action:focus {
  background: var(--surface);
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
  outline: none;
}

.profile-context-block {
  display: grid;
  gap: 7px;
  padding: 9px 12px 11px;
  border-bottom: 1px solid var(--bg);
}

.profile-context-label {
  width: max-content;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
}

.profile-context-links {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.profile-context-links span {
  color: var(--muted);
}

.context-menu-option {
  position: relative;
  width: auto;
  min-height: 0;
  height: auto;
  margin: -3px -5px;
  padding: 3px 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: color 120ms ease;
}

.context-menu-option:hover,
.context-menu-option:focus,
.context-menu-option.active {
  color: var(--text);
}

.context-menu-option:hover,
.context-menu-option:focus {
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
  outline: none;
}

.context-menu-option.active {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.profile-logout-link {
  border-top: 0;
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 22px 10px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  gap: 0;
  padding: 0 0 22px;
}

.app-shell.sidebar-collapsed .brand span:not(.brand-mark) {
  display: none;
}

.app-shell.sidebar-collapsed .nav a {
  justify-content: center;
  gap: 0;
  padding: 12px 0;
  font-size: 0;
}

.app-shell.sidebar-collapsed .nav-icon {
  width: 22px;
  flex-basis: 22px;
  font-size: 16px;
}

.app-shell.sidebar-collapsed .sidebar-profile {
  right: 10px;
  bottom: 76px;
  left: 10px;
}

.app-shell.sidebar-collapsed .sidebar-profile-trigger {
  place-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0;
}

.app-shell.sidebar-collapsed .sidebar-profile-user {
  font-size: 0;
}

.app-shell.sidebar-collapsed .sidebar-profile-user::before {
  content: "qa";
  font-size: 13px;
}

.app-shell.sidebar-collapsed .sidebar-profile-context {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-profile-separator {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-profile-menu {
  right: auto;
  bottom: 0;
  left: calc(100% + 12px);
  width: 164px;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  right: -14px;
}

.app-shell.sidebar-collapsed .sidebar-hide-action {
  right: 10px;
  left: 10px;
  overflow: hidden;
  color: transparent;
  font-size: 0;
  text-align: center;
}

.app-shell.sidebar-collapsed .sidebar-hide-action::before {
  content: "\00d7";
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 18px;
}

.app-shell.sidebar-hidden .sidebar {
  width: 250px;
  min-width: 250px;
  pointer-events: none;
  transform: translateX(-100%);
}

.app-shell.sidebar-hidden .sidebar-toggle {
  display: none;
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.topbar-meta {
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions .button,
.topbar-actions button {
  margin: 0;
}

.topbar-actions.header-action-links > .header-action:not(:last-child) {
  margin-right: 0;
  padding-right: 0;
}

.topbar-actions.header-action-links > .header-action:not(:last-child)::after {
  content: none;
}

.content {
  padding: 26px 28px 42px;
}

.page-intro {
  max-width: 850px;
  margin: 0 0 20px;
  color: var(--muted);
}

.dashboard-intro {
  max-width: none;
}

.users-layout {
  grid-template-columns: minmax(360px, 1fr) minmax(560px, 1fr);
  grid-auto-rows: 1fr;
  align-items: stretch;
}

.users-layout > .card {
  height: 100%;
  min-width: 0;
}

.users-list-card .table-wrap {
  overflow-x: auto;
}

.users-table {
  table-layout: fixed;
  width: 100%;
}

.users-table th,
.users-table td {
  overflow: hidden;
  padding: 10px 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.users-table th:first-child,
.users-table td:first-child {
  padding-left: 20px;
}

.users-table th:last-child,
.users-table td:last-child {
  padding-right: 20px;
}

.users-table button {
  min-height: 30px;
  height: 30px;
  margin: 0;
  padding: 0 10px;
  line-height: 30px;
}

.users-table .row-actions {
  gap: 8px;
  flex-wrap: nowrap;
}

.users-table .row-actions button {
  flex: 0 0 86px;
  width: 86px;
  padding: 0;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.grid-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-pad {
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.card-header h2,
.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.management-card {
  overflow: hidden;
}

.management-header {
  align-items: center;
}

.management-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.add-project-button,
.add-record-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 42px;
  height: 42px;
  margin: 0;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--primary);
  border-color: var(--primary);
  color: var(--surface);
  font-size: 14px;
  line-height: 42px;
}

.add-project-button span,
.add-record-button span {
  font-size: 22px;
  line-height: 0;
}

.add-project-button:hover,
.add-record-button:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.summary-card {
  padding: 14px;
}

.summary-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.summary-value {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.summary-value-baseline {
  margin-left: 4px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

.summary-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-section {
  margin-top: 18px;
}

.dashboard-kpi-grid {
  align-items: stretch;
}

.dashboard-kpi {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.dashboard-kpi:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--text) 10%, transparent);
}

.dashboard-kpi.is-active {
  background: var(--surface-soft);
  border-color: var(--primary);
}

.dashboard-kpi.is-active::before {
  width: 8px;
}

.dashboard-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary) 100%);
  transition: width 140ms ease;
}

.dashboard-kpi:has([data-kpi-value="total"])::before {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary) 100%);
}

.dashboard-kpi:has([data-kpi-value="open"])::before {
  background: linear-gradient(180deg, var(--sev-low) 0%, var(--sev-high) 100%);
}

.dashboard-kpi:has([data-kpi-value="fixed"])::before {
  background: linear-gradient(180deg, var(--status-assigned) 0%, var(--status-in-progress) 100%);
}

.dashboard-kpi:has([data-kpi-value="closed"])::before {
  background: linear-gradient(180deg, var(--status-in-progress) 0%, var(--status-closed) 100%);
}

.dashboard-kpi:has([data-kpi-value="highOpen"])::before {
  background: linear-gradient(180deg, var(--sev-high) 0%, var(--sev-critical) 100%);
}

.dashboard-filter-panel .card-header,
.defect-filter-panel .card-header {
  align-items: center;
}

.dashboard-filter-panel .card-header > div,
.defect-filter-panel .card-header > div {
  display: flex;
  align-items: center;
  min-height: 34px;
}

.dashboard-filter-panel .filter-actions,
.defect-filter-panel .filter-actions {
  align-self: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0;
  row-gap: 0;
  column-gap: 0;
  height: 34px;
  min-height: 34px;
  padding: 0;
  margin: 0;
}

.dashboard-filter-panel .filter-actions > *,
.defect-filter-panel .filter-actions > * {
  align-self: center;
  height: 34px;
  margin-top: 0;
  margin-bottom: 0;
  vertical-align: middle;
}

.dashboard-filter-panel .filter-actions .header-action,
.defect-filter-panel .filter-actions .header-action {
  margin-top: 0;
  margin-bottom: 0;
  height: 34px;
  min-height: 34px;
}

.dashboard-filter-panel,
.defect-filter-panel {
  overflow: visible;
}

.dashboard-filter-panel.is-collapsed .card-pad {
  display: none;
}

.dashboard-filter-actions {
  gap: 0;
}

.dashboard-chart-drilldown {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid color-mix(in srgb, var(--border) 14%, transparent);
  background: color-mix(in srgb, var(--surface-soft) 58%, var(--surface));
  color: var(--text);
  font-size: 13px;
}

.dashboard-chart-drilldown[hidden] {
  display: none;
}

.dashboard-chart-drilldown-label {
  font-weight: 700;
}

.dashboard-chart-drilldown button {
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dashboard-chart-drilldown button:hover,
.dashboard-chart-drilldown button:focus {
  color: var(--text);
}

.dashboard-section.is-table-focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-assigned) 34%, transparent);
  transition: box-shadow 180ms ease;
}

.header-action-links {
  gap: 0;
}

.header-action-links .header-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.header-action-links .header-action span {
  line-height: 18px;
}

.header-action-links > .header-action:not(:last-child),
.header-action-links > .export-split:not(:last-child) {
  margin-right: 13px;
  padding-right: 13px;
}

.header-action-links > .header-action:not(:last-child)::after,
.header-action-links > .export-split:not(:last-child)::after {
  content: "|";
  position: absolute;
  right: 0;
  top: 50%;
  color: var(--primary);
  font-weight: 400;
  transform: translate(50%, -50%);
  text-decoration: none;
}

.header-action-links .header-action:hover,
.header-action-links .header-action:focus {
  color: var(--text);
  text-decoration-color: var(--text);
}

/* Export split-button: a primary "Current view" action + caret that opens a small mode menu.
   The split itself is one item in the .filter-actions row (so it gets the leading "|" separator
   from its left sibling), but inside the split there is NO separator between main and caret —
   they read as one bonded control. */
.export-split {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.header-action-links .export-split-main,
.header-action-links .export-split-caret {
  margin-right: 0;
  padding-right: 0;
}

.header-action-links .export-split-main::after,
.header-action-links .export-split-caret::after {
  content: none;
}

.header-action-links .export-split-caret {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  padding: 0 2px;
  font-size: 0;
  line-height: 0;
  text-decoration: none;
}

.header-action-links .export-split-caret:hover,
.header-action-links .export-split-caret:focus,
.header-action-links .export-split-caret:focus-visible {
  text-decoration: none;
}

.export-split:hover .export-split-main,
.export-split:focus-within .export-split-main {
  color: var(--text);
  text-decoration-color: var(--text);
}

.export-split:hover .export-split-caret,
.export-split:focus-within .export-split-caret {
  color: var(--text);
}

.export-split-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 240px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-soft);
  border-radius: 8px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 12%, transparent);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-split-menu[hidden] {
  display: none;
}

.export-split-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  text-decoration: none;
}

.export-split-menu-item:hover,
.export-split-menu-item:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.export-split-menu-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.export-split-menu-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
}


.dashboard-report-filters {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.section-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 20px;
}

.chart-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.chart-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.chart-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 30px;
}

.chart-actions .chart-drag-handle,
.chart-actions .chart-remove-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  font-size: 0;
  line-height: 0;
}

.chart-title-row h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.chart-title-row > div:first-child {
  min-width: 0;
}

.chart-title-row > div:first-child:has(.chart-help-trigger) {
  display: grid;
  grid-template-columns: minmax(0, max-content) auto;
  align-items: center;
  column-gap: 7px;
}

.chart-title-row > div:first-child:has(.chart-help-trigger) .chart-meta {
  grid-column: 1 / -1;
}

.chart-meta {
  color: var(--muted);
  font-size: 12px;
}

.chart-bars {
  display: grid;
  gap: 10px;
}

.chart-row {
  display: grid;
  grid-template-columns: 140px minmax(120px, 1fr) 36px;
  gap: 10px;
  align-items: center;
}

.chart-label,
.chart-value {
  font-size: 13px;
  font-weight: 600;
}

.chart-track {
  height: 16px;
  overflow: hidden;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--bg);
}

.chart-fill {
  height: 100%;
  min-width: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--status-assigned) 0%, var(--status-closed) 100%);
}

.chart-horizontal .chart-row {
  grid-template-columns: 160px minmax(140px, 1fr) 36px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donut-visual {
  display: grid;
  width: 150px;
  height: 150px;
  place-items: center;
  border: 18px solid var(--status-in-progress);
  border-right-color: var(--sev-medium);
  border-bottom-color: var(--status-assigned);
  border-radius: 50%;
  color: var(--text);
  font-size: 28px;
  font-weight: 600;
}

.chart-empty {
  padding: 18px;
  border: 1px dashed var(--primary);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
}

.chart-modal-card {
  max-width: 760px;
  max-height: 86vh;
  overflow-y: auto;
}

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  padding: 20px;
  align-items: stretch;
}

.report-chart-card {
  position: relative;
  align-self: start;
  grid-column: span 4;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.report-chart-card[data-chart-help] {
  overflow: visible;
}

.chart-help-trigger {
  display: inline-grid;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: color-mix(in srgb, var(--primary) 62%, var(--muted));
  opacity: 0.72;
  transform: translateY(1px);
}

.chart-help-trigger:hover,
.chart-help-trigger:focus {
  border-color: color-mix(in srgb, var(--primary) 36%, transparent);
  background: color-mix(in srgb, var(--surface-soft) 58%, transparent);
  color: var(--text);
  opacity: 1;
}

.report-chart-card.is-chart-help-open .chart-help-trigger {
  border-color: color-mix(in srgb, var(--primary) 42%, transparent);
  background: color-mix(in srgb, var(--surface-soft) 70%, transparent);
  color: var(--text);
  opacity: 1;
}

.chart-help-panel {
  position: absolute;
  top: 52px;
  right: 14px;
  z-index: 16;
  width: min(330px, calc(100% - 28px));
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 38%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(7px);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--primary) 12%, transparent);
}

.chart-help-panel[hidden] {
  display: none;
}

.chart-help-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.chart-help-panel-head strong {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.chart-help-close {
  display: inline-grid;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0;
  line-height: 0;
}

.chart-help-close:hover,
.chart-help-close:focus {
  color: var(--text);
}

.chart-help-panel-copy {
  margin: 0;
}

.report-chart-card.wide-chart {
  grid-column: span 8;
}

.report-chart-card.half-chart {
  grid-column: span 6;
}

.report-chart-card.is-dragging {
  opacity: 0.45;
}

.report-chart-card.is-moving {
  z-index: 30;
  opacity: 0.94;
  pointer-events: none;
}

.report-chart-card.is-drop-target {
  border-style: dashed;
  background: var(--bg);
}

.chart-drop-placeholder {
  align-self: start;
  min-height: calc(var(--chart-canvas-height) + 116px);
  border: 2px dashed var(--status-in-progress);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--status-assigned) 35%, transparent), color-mix(in srgb, var(--bg) 65%, transparent));
}

.chart-drag-handle {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
  cursor: grab;
  font-size: 0;
  line-height: 0;
}

.chart-drag-handle:active {
  cursor: grabbing;
}

.chart-remove-button {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
  font-size: 0;
  line-height: 0;
}

.chart-remove-button:hover {
  background: var(--sev-critical);
  border-color: var(--sev-critical);
  color: var(--surface);
}

.chart-resize-handle {
  position: absolute;
  right: -13px;
  bottom: -22px;
  z-index: 2;
  display: grid;
  width: 24px;
  height: 24px;
  min-height: 24px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  cursor: nwse-resize;
  font-size: 0;
  line-height: 0;
}

.chart-resize-handle::before,
.chart-resize-handle::after {
  content: none;
}

.chart-resize-handle:hover {
  background: var(--bg);
}

.canvas-wrap {
  position: relative;
  height: var(--chart-canvas-height);
}

.canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.restore-chart-select {
  width: auto;
  min-width: 200px;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0 36px 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  vertical-align: middle;
}

.card-header:has(.charts-section-title) > div:first-child {
  display: contents;
}

.charts-section-title {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  margin: 0;
}

.card-header:has(.charts-section-title) .filter-actions {
  display: flex;
  align-items: center;
  height: 34px;
}

.card-header:has(.charts-section-title) .restore-chart-select,
.card-header:has(.charts-section-title) .add-project-button {
  height: 34px;
  min-height: 34px;
}

.card-header:has(.charts-section-title) .add-project-button {
  padding: 0 14px;
}

.card-header:has(.charts-section-title) .add-project-button span {
  font-size: 18px;
}

.chart-values-icon-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.chart-values-icon-toggle:hover {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  color: var(--primary);
}

.chart-values-icon-toggle .chart-values-icon-on {
  display: none;
}

.chart-values-icon-toggle[aria-pressed="true"] {
  background: var(--primary);
  color: var(--surface);
}

.chart-values-icon-toggle[aria-pressed="true"]:hover {
  background: var(--text);
}

.chart-values-icon-toggle[aria-pressed="true"] .chart-values-icon-off {
  display: none;
}

.chart-values-icon-toggle[aria-pressed="true"] .chart-values-icon-on {
  display: inline-block;
}

.canvas-wrap.tall {
  height: var(--chart-canvas-height);
}

.report-table th {
  cursor: pointer;
  user-select: none;
}

.report-table th::after {
  content: "↕";
  margin-left: 8px;
  color: color-mix(in srgb, var(--surface) 55%, transparent);
  font-size: 11px;
}

.report-table th.sorted-asc::after,
.report-table th.sorted-desc::after {
  color: var(--surface);
}

.report-table th.sorted-asc::after {
  content: "↑";
}

.report-table th.sorted-desc::after {
  content: "↓";
}

.report-title-cell {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.defect-id-link {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.defect-id-link:hover,
.defect-id-link:focus {
  text-decoration: underline;
  color: var(--text);
}

.defect-id-cell {
  white-space: nowrap;
}

.defect-id-cell-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.defect-edit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.defect-edit-icon:hover,
.defect-edit-icon:focus {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
  text-decoration: none;
  outline: none;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  height: var(--table-row-height);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  line-height: 1.25;
}

th:first-child,
td:first-child {
  padding-left: 20px;
}

th:last-child,
td:last-child {
  padding-right: 20px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: var(--table-header-height);
  padding-top: 8px;
  padding-bottom: 8px;
  background: var(--primary);
  color: var(--surface);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--primary-dark);
  border-right: 0;
  border-left: 0;
  box-shadow: inset 1px 0 0 var(--primary), inset -1px 0 0 var(--primary);
  white-space: nowrap;
}

thead th + th {
  box-shadow: inset 1px 0 0 var(--primary), inset -1px 0 0 var(--primary), -1px 0 0 var(--primary);
}

thead th:first-child {
  border-top-left-radius: 8px;
}

thead th:last-child {
  border-top-right-radius: 8px;
}

tbody tr:hover {
  background: var(--bg);
}

tbody tr:hover button:not(.button-primary):not([data-status-option]),
tbody tr:hover .button:not(.button-primary) {
  background: var(--surface);
  color: var(--primary);
}

.management-table td {
  height: var(--table-row-height);
  vertical-align: middle;
}

.record-table {
  table-layout: fixed;
}

.record-table tbody tr,
.record-table td {
  height: var(--table-row-height);
}

.record-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-table th:last-child,
.record-table td:last-child {
  text-align: right;
}

.record-table .row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  justify-content: flex-end;
  white-space: nowrap;
}

.record-table td:last-child > button,
.record-table .row-actions button {
  box-sizing: border-box;
  flex: 0 0 78px;
  width: 78px;
  min-height: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  line-height: 30px;
}

.users-table .row-actions button {
  flex-basis: 86px;
  width: 86px;
}

.project-table th:nth-child(1),
.project-table td:nth-child(1),
.environment-table th:nth-child(1),
.environment-table td:nth-child(1) {
  width: 24%;
}

.project-table th:nth-child(2),
.project-table td:nth-child(2),
.environment-table th:nth-child(2),
.environment-table td:nth-child(2) {
  width: 41%;
}

.project-table th:nth-child(3),
.project-table td:nth-child(3),
.environment-table th:nth-child(3),
.environment-table td:nth-child(3) {
  width: 18%;
}

.project-table th:nth-child(4),
.project-table td:nth-child(4),
.environment-table th:nth-child(4),
.environment-table td:nth-child(4) {
  width: 17%;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  width: 18%;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  width: 24%;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
  width: 17%;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
  width: 14%;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
  width: 27%;
}

.management-table input,
.management-table select {
  margin-bottom: 0;
  min-width: 180px;
}

.management-table select,
.management-table input:not([type="file"]):not([type="hidden"]) {
  height: var(--control-compact-height);
  min-height: var(--control-compact-height);
  padding: 0 10px;
  line-height: var(--control-compact-height);
}

.record-table .inline-add-row input,
.record-table .inline-add-row select {
  width: 100%;
  min-width: 0;
}

.management-table .table-edit-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  height: var(--control-compact-height);
  min-height: var(--control-compact-height);
  margin: 0;
  padding: 0 10px;
  border-color: var(--control-border);
  background: var(--surface);
  font-size: 15px;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.management-table .table-edit-cell {
  background: var(--surface);
  box-shadow: none;
}

.management-table .table-edit-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--status-assigned) 45%, transparent);
}

.inline-edit-row td {
  height: var(--table-row-height);
  padding-top: 9px;
  padding-bottom: 9px;
  overflow: visible;
}

.table-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  width: 168px;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 30px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.table-status-toggle button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 24px;
  height: 24px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  line-height: 24px;
  box-shadow: none;
  transition: none;
}

.table-status-toggle button:hover,
.table-status-toggle button:focus,
.table-status-toggle button:active {
  border-color: transparent;
  background: var(--bg);
  color: var(--text);
  outline: none;
  box-shadow: none;
}

.table-status-toggle button.active,
tbody tr:hover .table-status-toggle button.active {
  background: var(--status-retest);
  color: var(--surface);
}

.table-status-toggle button[data-status-option="Inactive"].active,
.table-status-toggle button[data-project-add-status-option="Inactive"].active,
.table-status-toggle button[data-add-status-option="Inactive"].active,
tbody tr:hover .table-status-toggle button[data-status-option="Inactive"].active,
tbody tr:hover .table-status-toggle button[data-project-add-status-option="Inactive"].active,
tbody tr:hover .table-status-toggle button[data-add-status-option="Inactive"].active {
  background: var(--bg);
  color: var(--primary);
}

tbody tr:hover .table-status-toggle button:not(.active) {
  background: transparent;
  color: var(--primary);
}

.inline-add-row .row-actions button,
.inline-edit-row .row-actions button {
  min-height: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  line-height: 30px;
}

.inline-edit-row:hover .button-primary,
.inline-edit-row .button-primary,
.inline-edit-row .button-primary:hover,
.inline-edit-row .button-primary:focus {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--surface);
}

.inline-edit-row .button-primary:hover,
.inline-edit-row .button-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.inline-add-row {
  background: var(--surface);
}

.inline-add-row td {
  height: var(--table-row-height);
  border-bottom: 2px solid var(--primary);
  overflow: visible;
}

.report-table tbody td {
  height: var(--table-row-height);
  padding-top: 9px;
  padding-bottom: 9px;
}

.attachment-table tbody td {
  height: var(--table-row-height);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 48px;
  padding: 10px 18px;
  border-top: 1px solid var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.table-pagination[hidden] {
  display: none;
}

.table-pagination button {
  min-height: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 30px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.table-pagination button:hover,
.table-pagination button:focus-visible {
  color: var(--text);
  text-decoration-color: var(--text);
  outline: none;
}

.table-pagination button:disabled {
  color: color-mix(in srgb, var(--muted) 45%, transparent);
  cursor: default;
  text-decoration: none;
}

.table-page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.table-page-size select {
  width: auto;
  min-width: 76px;
  height: 30px;
  min-height: 30px;
  margin: 0;
  padding: 0 24px 0 10px;
  border-color: var(--control-border);
  font-size: 13px;
  line-height: 30px;
}

.table-page-summary {
  color: var(--muted);
}

.inline-add-row:hover {
  background: var(--surface);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-add-row:hover .button-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--surface);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.defect-filter-submit {
  display: flex;
  justify-content: flex-end;
}

.filter-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.badge::selection {
  background: transparent;
  color: var(--text);
}

.badge::-moz-selection {
  background: transparent;
  color: var(--text);
}

.badge-new,
.badge-info {
  background: var(--status-new);
  color: var(--text);
}

.badge-assigned {
  background: var(--status-assigned);
  color: var(--text);
}

.badge-progress {
  background: var(--status-in-progress);
  color: var(--surface);
}

.badge-warning {
  background: var(--sev-medium);
  color: var(--surface);
}

.badge-retest {
  background: var(--status-retest);
  color: var(--surface);
}

.badge-fixed {
  background: var(--status-fixed);
  color: var(--surface);
}

.badge-active,
.badge-success {
  background: var(--status-closed);
  color: var(--surface);
}

.badge-closed {
  background: var(--status-closed);
  color: var(--surface);
}

.badge-reopened {
  background: var(--status-reopened);
  color: var(--surface);
}

.badge-danger {
  background: var(--sev-high);
  color: var(--surface);
}

.badge-critical {
  background: var(--sev-critical);
  color: var(--surface);
}

.badge-high {
  background: var(--sev-high);
  color: var(--surface);
}

.badge-medium {
  background: var(--sev-medium);
  color: var(--surface);
}

.badge-inactive,
.badge-neutral {
  background: var(--surface-soft);
  color: var(--muted);
}

.badge-low {
  background: var(--sev-low);
  color: var(--text);
}

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

.span-2 {
  grid-column: span 2;
}

.upload-box {
  display: grid;
  min-height: 132px;
  place-items: center;
  padding: 22px;
  border: 2px dashed var(--primary);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  text-align: center;
}

.upload-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.tiptap-shell {
  display: grid;
  gap: 10px;
}

.tiptap-editor {
  position: relative;
  z-index: 0;
  min-height: 190px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
  cursor: text;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.tiptap-editor.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 14px;
  left: 16px;
  color: var(--muted);
  pointer-events: none;
}

.tiptap-editor:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--control-focus-ring);
}

.tiptap-editor .ProseMirror {
  min-height: 160px;
  outline: none;
  cursor: text;
}

.tiptap-editor > *:first-child,
.tiptap-editor .ProseMirror > *:first-child {
  margin-top: 0;
}

.tiptap-editor > *:last-child,
.tiptap-editor .ProseMirror > *:last-child {
  margin-bottom: 0;
}

.tiptap-editor p,
.tiptap-editor .ProseMirror p {
  margin: 0 0 10px;
}

.tiptap-editor ul,
.tiptap-editor ol,
.tiptap-editor .ProseMirror ul,
.tiptap-editor .ProseMirror ol {
  margin: 0 0 12px 22px;
  padding-left: 22px;
}

.tiptap-editor li,
.tiptap-editor .ProseMirror li {
  padding-left: 4px;
}

.tiptap-editor li p,
.tiptap-editor .ProseMirror li p {
  margin: 0 0 8px;
}

.tiptap-editor img,
.tiptap-editor .ProseMirror img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0;
  border: 1px solid var(--primary);
  border-radius: 8px;
}

.resizable-image-node {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 12px 0;
  line-height: 0;
}

.resizable-image-node img {
  max-width: 100%;
}

.image-resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  display: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: var(--surface);
  cursor: nwse-resize;
}

.image-resize-handle::before {
  content: "";
  position: absolute;
  inset: 5px 3px;
  border-top: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(-45deg);
}

.image-preview-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  min-height: 28px;
  height: 28px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--primary);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 26px;
}

.image-preview-handle:hover,
.image-preview-handle:focus {
  background: var(--soft);
}

.resizable-image-node.is-selected {
  outline: 2px dashed var(--status-in-progress);
  outline-offset: 4px;
}

.resizable-image-node:hover .image-resize-handle,
.resizable-image-node.is-selected .image-resize-handle,
.resizable-image-node:hover .image-preview-handle,
.resizable-image-node.is-selected .image-preview-handle {
  display: block;
}

.tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  color: var(--muted);
  pointer-events: none;
}

.editor-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.file-list li,
.comment,
.timeline-item {
  padding: 14px;
  border: 1px solid var(--bg);
  border-radius: 7px;
  background: var(--surface);
}

.detail-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  padding: 24px 24px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.detail-summary-main {
  min-width: 0;
}

.detail-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.detail-title {
  margin: 14px 0 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.detail-title-row .detail-title {
  margin-top: 0;
}

.detail-title-edit {
  flex: 0 0 auto;
  margin-top: 3px;
}

.edit-form-actions .button,
.edit-form-actions button {
  margin: 0;
}

.edit-form-actions {
  justify-content: flex-start;
  margin-top: 14px;
  padding-top: 4px;
}

.secondary-action-button {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

.secondary-action-button:hover,
.secondary-action-button:focus,
.secondary-action-button:active {
  background: var(--bg);
  border-color: var(--text);
  color: var(--text);
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  color: var(--muted);
  font-size: 13px;
}

.meta-list > * {
  display: inline-flex;
  align-items: center;
}

.meta-list > *:not(:last-child)::after {
  content: "|";
  margin: 0 10px;
  color: var(--primary);
}

.detail-controls {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(220px, 300px) max-content;
  gap: 18px;
  align-items: end;
  padding-top: 4px;
}

.detail-save-button {
  align-self: end;
  justify-self: start;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0 22px;
  white-space: nowrap;
  line-height: 38px;
}

.detail-controls select {
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.edit-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.edit-field {
  display: grid;
  gap: 8px;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
  width: 100%;
  margin: 0;
}

.edit-field textarea {
  min-height: 112px;
}

.release-date-grid .edit-field {
  min-height: 96px;
  align-content: start;
}

.release-source-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.edit-description-field,
.edit-upload-box {
  margin-top: 18px;
}

.detail-tabs-card {
  margin-top: 18px;
}

.detail-card-header {
  align-items: center;
  flex-wrap: wrap;
  min-height: 66px;
  padding: 16px 24px 0;
}

.detail-card-header h2 {
  align-self: center;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  align-self: flex-end;
  align-items: flex-end;
  gap: 30px;
  margin-bottom: 0;
  padding: 0 0 10px;
}

.tab-button {
  position: relative;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.tab-button:hover,
.tab-button:focus {
  background: transparent;
  color: var(--text);
}

.tab-button.active {
  background: transparent;
  color: var(--primary);
}

.tab-button.active::before,
.tab-button.active::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  border-radius: 999px;
  background: var(--primary);
}

.tab-button.active::before {
  bottom: -9px;
  height: 2px;
}

.tab-button.active::after {
  bottom: -14px;
  height: 2px;
}

.tab-panels {
  padding: 20px 22px 22px;
}

.tab-panel {
  min-height: 160px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 26px;
}

.detail-tabs-card .info-row {
  border-bottom-color: var(--bg);
}

.detail-info-grid .info-row:nth-last-child(-n + 2) {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-tabs-card .table-wrap {
  border-top: 1px solid var(--primary);
  border-right: 1px solid var(--primary);
  border-left: 1px solid var(--primary);
}

.attachment-table th:last-child,
.attachment-table td:last-child {
  text-align: right;
}

.attachment-table button {
  min-height: 34px;
  padding: 0 12px;
  line-height: 34px;
}

.detail-description {
  margin-top: 18px;
  padding-top: 4px;
}

.detail-description h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.detail-description p {
  margin: 0;
  color: var(--primary);
}

.execution-list .info-row {
  grid-template-columns: 150px minmax(0, 1fr);
}

.execution-list [data-detail-field="steps"] {
  overflow: hidden;
}

.execution-list .resizable-image-node img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--primary);
  border-radius: 8px;
}

.comment-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.comment-entry textarea {
  min-height: 86px;
  margin: 0;
}

.comment-entry .button-primary {
  align-self: end;
  margin: 0;
}

.info-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.info-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.info-label {
  color: var(--muted);
  font-weight: 500;
}

.comments,
.timeline {
  display: grid;
  gap: 10px;
}

.comment-meta,
.timeline-meta {
  color: var(--muted);
  font-size: 12px;
}

.workflow-editor-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workflow-editor-header {
  align-items: center;
}

.workflow-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.workflow-toolbar button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 34px;
}

.workflow-canvas-shell {
  flex: 1;
  min-height: 0;
  padding: 14px;
  background: var(--surface);
}

.workflow-canvas {
  position: relative;
  height: 100%;
  min-height: 500px;
  overflow: hidden;
  border: 1px solid var(--primary);
  border-radius: 7px;
  background:
    linear-gradient(color-mix(in srgb, var(--primary) 3.5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--primary) 3.5%, transparent) 1px, transparent 1px),
    var(--surface);
  background-size: 28px 28px;
  cursor: grab;
  outline: none;
}

.workflow-canvas.is-selecting {
  cursor: crosshair;
}

.workflow-canvas.is-pan-mode {
  cursor: grab;
}

.workflow-zoom-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: auto;
}

.workflow-pan-mode-hint {
  display: none;
  padding: 4px 7px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.workflow-canvas.is-pan-mode .workflow-pan-mode-hint {
  display: inline-block;
}

.workflow-zoom-controls button {
  display: grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0;
  font-weight: 600;
  line-height: 0;
}

.workflow-zoom-controls button:hover,
.workflow-zoom-controls button:focus {
  background: var(--bg);
  color: var(--text);
}

.workflow-canvas.is-panning {
  cursor: grabbing;
}

.workflow-selection-box {
  position: absolute;
  z-index: 4;
  display: none;
  border: 1px solid var(--status-retest);
  background: color-mix(in srgb, var(--status-assigned) 28%, transparent);
  pointer-events: none;
}

.workflow-selection-box.is-visible {
  display: block;
}

.workflow-edge-layer,
.workflow-node-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 2600px;
  height: 1600px;
  transform-origin: 0 0;
}

.workflow-edge-layer {
  pointer-events: auto;
}

.workflow-node-layer {
  pointer-events: none;
}

.workflow-edge-layer .workflow-edge-path {
  fill: none;
  stroke: color-mix(in srgb, var(--primary) 70%, transparent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  marker-end: url(#workflowArrow);
  pointer-events: stroke;
}

.workflow-edge-layer .workflow-edge-hit {
  fill: none;
  stroke: color-mix(in srgb, var(--text) 0.1%, transparent);
  stroke-width: 16;
  marker-end: none;
}

.workflow-edge-layer .workflow-arrow-head {
  fill: var(--primary);
  stroke: none;
  marker-end: none;
}

.workflow-edge-layer .workflow-edge-path.is-selected {
  stroke: var(--text);
  stroke-width: 3.2;
}

.workflow-edge-preview {
  fill: none;
  stroke: color-mix(in srgb, var(--primary) 52%, transparent);
  stroke-dasharray: 8 6;
  opacity: 0.65;
  marker-end: none;
}

.workflow-node {
  position: absolute;
  display: grid;
  place-items: center;
  isolation: isolate;
  box-sizing: border-box;
  width: 150px;
  min-height: 54px;
  padding: 8px 14px;
  border: 2px solid var(--primary);
  background: var(--surface-soft);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
  cursor: grab;
  user-select: none;
  pointer-events: auto;
}

.workflow-node:active {
  cursor: grabbing;
}

.workflow-node.is-process {
  border-radius: 8px;
}

.workflow-node.is-selected {
  border-color: var(--text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-assigned) 90%, transparent), 0 16px 34px color-mix(in srgb, var(--text) 16%, transparent);
}

.workflow-node-label {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  text-align: center;
}

.workflow-label-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;
  margin: 0;
  border: 1px solid var(--primary);
  background: var(--surface);
  text-align: center;
  font: inherit;
  font-weight: 700;
}

.workflow-node-type {
  display: none;
}

.workflow-handle {
  position: absolute;
  z-index: 2;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  cursor: crosshair;
}

.workflow-handle.is-top {
  left: 50%;
  top: -7px;
  transform: translateX(-50%);
}

.workflow-handle.is-right {
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
}

.workflow-handle.is-bottom {
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
}

.workflow-handle.is-left {
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
}

.workflow-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
}

.workflow-message {
  flex: 0 0 280px;
  margin: -2px 0 0;
  padding: 5px 9px;
  border-left: 3px solid var(--status-in-progress);
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.workflow-message.is-error {
  color: var(--sev-critical);
}

.workflow-message.is-success {
  color: var(--status-closed);
}

.workflow-message.is-hint {
  color: var(--status-closed);
}

.workflow-derived {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  max-width: calc(100% - 300px);
  overflow: visible;
}

.workflow-derived-pill {
  padding: 4px 8px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.workflow-derived-label {
  padding: 4px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-workflow-page {
  min-height: 100vh;
  overflow: auto;
}

.status-workflow-page .app-shell {
  min-height: 100vh;
}

.status-workflow-page .main {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.status-workflow-page .content {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 10px 12px;
}

.status-workflow-page .workflow-editor-card {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.status-workflow-page .workflow-editor-header {
  flex: 0 0 auto;
  padding: 12px 18px;
}

.status-workflow-page .workflow-canvas-shell {
  flex: 0 0 auto;
}

.status-workflow-page .workflow-canvas {
  height: clamp(420px, calc(100vh - 280px), 620px);
  min-height: 420px;
}

.report-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--primary);
  z-index: 20;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(720px, 100%);
  padding: 20px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.account-confirmation-modal,
.session-expired-modal {
  padding: 20px;
  background: color-mix(in srgb, var(--primary-dark) 18%, transparent);
  backdrop-filter: blur(8px);
}

.account-confirmation-card,
.session-expired-card {
  width: min(460px, calc(100vw - 40px));
  padding: 24px;
  border: 1px solid var(--primary);
  box-shadow: 0 18px 42px color-mix(in srgb, var(--text) 14%, transparent);
}

.account-confirmation-card .modal-title-row,
.session-expired-card .modal-title-row {
  margin-bottom: 22px;
}

.account-confirmation-card .modal-actions,
.session-expired-card .modal-actions {
  margin-top: 8px;
}

.profile-modal {
  z-index: 30;
}

.user-modal-card,
.password-modal-card,
.profile-modal-card {
  width: min(540px, 100%);
  border: 1px solid var(--primary);
}

.user-modal-card {
  width: min(620px, 100%);
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-title-row h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.profile-modal-summary {
  display: block;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--bg);
  border-radius: 7px;
  background: var(--surface);
}

.profile-modal-summary strong {
  font-size: 15px;
  font-weight: 700;
}

.password-user-summary {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--bg);
  border-radius: 7px;
  background: var(--surface);
}

.password-user-summary span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.password-user-summary strong {
  color: var(--text);
  font-size: 16px;
}

.user-form-grid,
.password-form-grid,
.profile-form-grid {
  display: grid;
  gap: 12px;
}

.user-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-status-toggle {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 4px;
}

.modal-status-toggle button {
  height: calc(var(--control-height) - 10px);
  min-height: calc(var(--control-height) - 10px);
}

.modal-status-toggle button:not(.active):hover,
.modal-status-toggle button:not(.active):focus,
.modal-status-toggle button:not(.active):active {
  background: transparent;
  color: var(--primary);
}

.modal-status-toggle button[data-modal-user-status-option="Active"].active:hover,
.modal-status-toggle button[data-modal-user-status-option="Active"].active:focus,
.modal-status-toggle button[data-modal-user-status-option="Active"].active:active {
  background: var(--status-retest);
  color: var(--surface);
}

.modal-status-toggle button[data-modal-user-status-option="Inactive"].active:hover,
.modal-status-toggle button[data-modal-user-status-option="Inactive"].active:focus,
.modal-status-toggle button[data-modal-user-status-option="Inactive"].active:active {
  background: var(--bg);
  color: var(--primary);
}

.modal-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

.modal-message.is-error {
  color: var(--sev-high);
}

.modal-message.is-success {
  color: var(--status-retest);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

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

.modal-preview {
  display: grid;
  width: 100%;
  min-height: 280px;
  place-items: center;
  margin: 14px 0;
  border: 1px dashed var(--primary);
  border-radius: 7px;
  background: var(--bg);
  color: var(--muted);
}

.attachment-preview-card {
  display: flex;
  width: min(1180px, calc(100vw - 64px));
  max-height: calc(100vh - 64px);
  flex-direction: column;
  overflow: hidden;
}

.attachment-preview-card .section-title {
  flex: 0 0 auto;
}

.attachment-preview-card .modal-preview {
  min-height: 360px;
  height: min(70vh, 700px);
  overflow: hidden;
}

.attachment-preview-card .modal-preview.is-zoomable-preview {
  grid-template-rows: auto minmax(0, 1fr);
  place-items: stretch;
}

.attachment-preview-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.attachment-preview-toolbar button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.attachment-preview-toolbar button:hover,
.attachment-preview-toolbar button:focus {
  background: var(--soft);
}

.attachment-preview-scroll {
  display: grid;
  min-height: 0;
  overflow: auto;
  place-items: start center;
  background: var(--surface);
}

.attachment-preview-card [data-close-modal] {
  flex: 0 0 auto;
  align-self: flex-end;
  margin: 0;
}

.attachment-preview-image {
  display: block;
  max-width: 100%;
  max-height: min(58vh, 560px);
  justify-self: center;
  align-self: center;
  object-fit: contain;
}

.attachment-preview-image.is-zoomable {
  max-width: none;
  max-height: none;
  transform-origin: top center;
}

.attachment-preview-pdf {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface);
}

.attachment-preview-message {
  max-width: 420px;
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.detail-step-image {
  cursor: zoom-in;
}

.detail-step-image:focus {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.timeline-body {
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.u-full-width {
  width: 100%;
}

@media (max-width: 1080px) {
  .users-layout {
    grid-template-columns: 1fr;
  }

  .grid-6,
  .grid-5,
  .grid-4,
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-report-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-chart-card,
  .report-chart-card.wide-chart,
  .report-chart-card.half-chart {
    grid-column: span 6;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-hidden {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .sidebar-toggle {
    top: auto;
    right: 18px;
    bottom: -16px;
    width: 42px;
    height: 30px;
    min-height: 30px;
    font-size: 20px;
    transform: none;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 22px 16px;
  }

  .app-shell.sidebar-collapsed .brand {
    justify-content: flex-start;
    gap: 10px;
    padding: 0 10px 22px;
  }

  .app-shell.sidebar-collapsed .brand span:not(.brand-mark) {
    display: inline;
  }

  .app-shell.sidebar-collapsed .nav a {
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    font-size: 15px;
  }

  .app-shell.sidebar-collapsed .nav-icon {
    width: 18px;
    flex-basis: 18px;
    font-size: 15px;
  }

  .app-shell.sidebar-collapsed .sidebar-hide-action {
    right: 16px;
    left: 16px;
    color: var(--bg);
    font-size: 13px;
    text-align: left;
  }

  .app-shell.sidebar-collapsed .sidebar-hide-action::before {
    content: none;
  }

  .sidebar-profile,
  .app-shell.sidebar-collapsed .sidebar-profile {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    margin: 14px 6px 54px;
  }

  .app-shell.sidebar-collapsed .sidebar-profile-trigger {
    justify-content: space-between;
    min-height: 36px;
    padding: 6px 8px;
  }

  .app-shell.sidebar-collapsed .sidebar-profile-user {
    font-size: 14px;
  }

  .app-shell.sidebar-collapsed .sidebar-profile-user::before {
    content: none;
  }

  .app-shell.sidebar-collapsed .sidebar-profile-context {
    display: inline-block;
  }

  .app-shell.sidebar-collapsed .sidebar-profile-separator {
    display: inline;
  }

  .app-shell.sidebar-collapsed .sidebar-profile-menu {
    right: 0;
    bottom: calc(100% + 8px);
    left: 0;
    width: auto;
  }

  .app-shell.sidebar-hidden .sidebar {
    display: none;
  }

  .sidebar-restore-tab {
    top: auto;
    bottom: 16px;
    transform: none;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 18px;
  }

  .content {
    padding: 18px;
  }

  .grid-6,
  .grid-5,
  .grid-4,
  .grid-3,
  .grid-2,
  .filters,
  .dashboard-report-filters,
  .form-grid,
  .detail-controls {
    grid-template-columns: 1fr;
  }

  .detail-hero,
  .detail-info-grid,
  .comment-entry {
    grid-template-columns: 1fr;
  }

  .detail-badges {
    justify-content: flex-start;
  }

  .detail-kicker-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-card-header {
    align-items: flex-start;
  }

  .tab-list {
    gap: 22px;
  }

  .tab-button {
    font-size: 14px;
  }

  .tab-panels {
    padding: 16px;
  }

  .report-chart-grid {
    grid-template-columns: 1fr;
  }

  .report-chart-card,
  .report-chart-card.wide-chart,
  .report-chart-card.half-chart {
    grid-column: span 1;
  }

  .workflow-editor-header,
  .workflow-footer {
    flex-direction: column;
  }

  .workflow-toolbar {
    justify-content: flex-start;
  }

  .workflow-canvas {
    min-height: 560px;
  }

  .status-workflow-page .workflow-canvas {
    height: 420px;
    min-height: 420px;
  }

  .workflow-derived {
    justify-content: flex-start;
    max-width: none;
  }

  .chart-row,
  .chart-horizontal .chart-row,
  .donut-layout {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .info-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

}

@media (max-width: 460px) {
  .nav {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 24px;
  }
}
