:root {
  --purple-50: #f5f2ff;
  --purple-100: #ece6ff;
  --purple-200: #d9ceff;
  --purple-500: #7b5cf3;
  --purple-600: #6f4ef6;
  --purple-700: #5b3dd2;
  --ink-950: #171624;
  --ink-900: #232132;
  --ink-700: #4b485e;
  --ink-600: #625f72;
  --ink-500: #7a7789;
  --line: #e7e7ee;
  --line-strong: #d9d9e3;
  --workspace: #f5f6f9;
  --surface: #ffffff;
  --success: #14804a;
  --success-bg: #eaf8f0;
  --danger: #c33d4a;
  --danger-bg: #fff0f2;
  --warning: #9a6500;
  --warning-bg: #fff8e5;
  --info: #2365b7;
  --info-bg: #edf5ff;
  --sidebar-width: 248px;
  --shadow-sm: 0 1px 2px rgba(23, 22, 36, 0.05);
  --shadow-md: 0 12px 35px rgba(27, 25, 45, 0.12);
  --shadow-lg: 0 28px 80px rgba(27, 25, 45, 0.2);
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 15px;
  --ease: 160ms ease;
}

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

html {
  color-scheme: light;
  min-width: 320px;
  background: var(--workspace);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink-900);
  background: var(--workspace);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: var(--purple-700);
}

svg {
  display: block;
}

.skip-link {
  position: fixed;
  z-index: 500;
  top: 8px;
  left: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--purple-700);
  transform: translateY(-150%);
  transition: transform var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid rgba(111, 78, 246, 0.28);
  outline-offset: 2px;
}

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

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

.subtle {
  color: var(--ink-600);
  font-size: 13px;
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.nowrap {
  white-space: nowrap;
}

.boot-screen,
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.boot-screen {
  align-content: center;
  gap: 16px;
  color: var(--ink-600);
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--purple-100);
  border-top-color: var(--purple-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--small {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #8a6af8, #6544e7);
  box-shadow: 0 7px 20px rgba(111, 78, 246, 0.28);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark--large {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  font-size: 21px;
}

.auth-page {
  position: relative;
  overflow: hidden;
  padding: 36px 20px;
  background:
    radial-gradient(circle at 12% 10%, rgba(123, 92, 243, 0.13), transparent 28%),
    radial-gradient(circle at 92% 82%, rgba(92, 176, 255, 0.12), transparent 31%),
    #f7f7fb;
}

.auth-page::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  top: -280px;
  right: -160px;
  border: 1px solid rgba(111, 78, 246, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(111, 78, 246, 0.025), 0 0 0 110px rgba(111, 78, 246, 0.018);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
}

.auth-brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 11px;
  margin-bottom: 24px;
  color: var(--ink-950);
  font-size: 18px;
  font-weight: 750;
}

.auth-card {
  padding: 32px;
  border: 1px solid rgba(224, 224, 234, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 22px 65px rgba(41, 37, 73, 0.1);
}

.auth-card h1 {
  margin: 0 0 7px;
  color: var(--ink-950);
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.auth-intro {
  margin: 0 0 25px;
  color: var(--ink-600);
}

.auth-meta {
  margin: 20px 0 0;
  color: var(--ink-500);
  text-align: center;
  font-size: 12px;
}

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

.sidebar {
  position: fixed;
  z-index: 100;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
  transition: transform 220ms ease;
}

.sidebar-brand {
  height: 82px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 22px;
  border-bottom: 1px solid #f0f0f4;
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  display: block;
  color: var(--ink-950);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-edition {
  display: block;
  margin-top: 1px;
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 20px 13px;
  overflow-y: auto;
}

.nav-label {
  margin: 4px 10px 7px;
  color: #9996a4;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-label--section {
  margin-top: 15px;
}

.nav-section-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  color: var(--ink-900);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .025em;
  padding: 8px 0;
  text-align: left;
  width: calc(100% - 20px);
}

.nav-section-items + .nav-section-toggle {
  margin-top: 15px;
}

.nav-section-toggle:hover,
.nav-section-toggle:focus-visible {
  color: var(--purple-700);
}

.nav-section-toggle:focus-visible {
  outline: 2px solid rgba(111, 78, 246, .3);
  outline-offset: 2px;
}

.nav-section-toggle > svg {
  height: 15px;
  transition: transform var(--ease);
  width: 15px;
}

.nav-section-toggle:not(.is-expanded) > svg {
  transform: rotate(-90deg);
}

.nav-section-title {
  align-items: center;
  display: inline-flex;
  gap: 9px;
}

.nav-section-title svg {
  color: var(--purple-600);
  height: 19px;
  width: 19px;
}

.nav-section-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-items[hidden] {
  display: none;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--ink-600);
  background: transparent;
  cursor: pointer;
  font-weight: 650;
  text-align: left;
  transition: color var(--ease), background var(--ease);
}

.nav-item svg {
  width: 19px;
  height: 19px;
  color: #858293;
}

.nav-item:hover {
  color: var(--ink-900);
  background: #f7f6fb;
}

.nav-item.is-active {
  color: var(--purple-700);
  background: var(--purple-50);
}

.nav-item.is-active svg {
  color: var(--purple-600);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -13px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--purple-600);
}

.sidebar-footer {
  padding: 13px;
  border-top: 1px solid var(--line);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--purple-700);
  background: var(--purple-100);
  font-size: 12px;
  font-weight: 800;
}

.avatar--small {
  width: 29px;
  height: 29px;
  font-size: 10px;
}

.sidebar-user-copy {
  min-width: 0;
}

.sidebar-user-name,
.sidebar-user-login {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-name {
  color: var(--ink-900);
  font-size: 12px;
  font-weight: 700;
}

.sidebar-user-login {
  color: var(--ink-500);
  font-size: 11px;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  height: 82px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 30px;
  border-bottom: 1px solid rgba(224, 224, 232, 0.92);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.topbar-title {
  min-width: 130px;
}

.topbar-title h1 {
  margin: 0;
  color: var(--ink-950);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.topbar-title p {
  margin: 3px 0 0;
  color: var(--ink-500);
  font-size: 11px;
}

.topbar-center {
  display: flex;
  flex: 1;
  justify-content: center;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
}

.mobile-menu-button {
  display: none;
}

.search-box {
  position: relative;
  width: min(100%, 460px);
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  color: #918e9c;
  pointer-events: none;
  transform: translateY(-50%);
}

.search-box input {
  width: 100%;
  height: 41px;
  padding: 0 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  color: var(--ink-900);
  background: #f8f8fb;
  transition: border var(--ease), background var(--ease), box-shadow var(--ease);
}

.search-box input::placeholder {
  color: #9996a4;
}

.search-box input:focus {
  border-color: var(--purple-300, #c7b9ff);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(111, 78, 246, 0.09);
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-500);
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.search-clear:hover {
  color: var(--ink-900);
  background: #ececf2;
}

.account-button {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 0 5px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.account-name {
  white-space: nowrap;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  border-color: var(--line);
  background: #fafafd;
}

.account-chevron {
  width: 15px;
  height: 15px;
  color: var(--ink-500);
}

.account-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 9px);
  right: 0;
  width: 235px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.account-popover-head {
  padding: 10px 11px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.account-popover-head strong,
.account-popover-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover-head span {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 12px;
}

.menu-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  color: var(--ink-700);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.menu-action svg {
  width: 17px;
  height: 17px;
}

.menu-action:hover {
  color: var(--ink-900);
  background: #f6f6fa;
}

.menu-action--danger:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.main-content {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 28px 30px 48px;
}

.page-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-heading {
  margin-bottom: 20px;
}

.page-heading h2,
.section-heading h2,
.section-heading h3 {
  margin: 0;
  color: var(--ink-950);
  letter-spacing: -0.02em;
}

.page-heading h2 {
  font-size: 22px;
}

.section-heading h3 {
  font-size: 16px;
}

.page-heading p,
.section-heading p {
  margin: 5px 0 0;
  color: var(--ink-500);
}

.button {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--ease), border var(--ease), background var(--ease), color var(--ease), box-shadow var(--ease);
}

.button svg {
  width: 17px;
  height: 17px;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.button--primary {
  color: #fff;
  background: var(--purple-600);
  box-shadow: 0 5px 14px rgba(111, 78, 246, 0.19);
}

.button--primary:hover:not(:disabled) {
  background: var(--purple-700);
  box-shadow: 0 7px 18px rgba(111, 78, 246, 0.24);
}

.button--secondary {
  border-color: var(--line-strong);
  color: var(--ink-700);
  background: #fff;
}

.button--secondary:hover:not(:disabled) {
  border-color: #c9c7d3;
  color: var(--ink-900);
  background: #fafafd;
}

.button--ghost {
  color: var(--ink-600);
  background: transparent;
}

.button--ghost:hover:not(:disabled) {
  color: var(--ink-900);
  background: #f1f1f6;
}

.button--danger {
  color: #fff;
  background: var(--danger);
}

.button--danger-soft {
  color: var(--danger);
  background: var(--danger-bg);
}

.button--sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.button--block {
  width: 100%;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-600);
  background: transparent;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border var(--ease);
}

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

.icon-button:hover {
  border-color: var(--line);
  color: var(--ink-900);
  background: #f7f7fa;
}

.icon-button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
}

.icon-button--danger:hover {
  border-color: #ffd9de;
  color: var(--danger);
  background: var(--danger-bg);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.toolbar-card {
  margin-bottom: 16px;
  overflow: hidden;
}

.status-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.status-tab {
  position: relative;
  min-height: 41px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 0 11px 9px;
  color: var(--ink-600);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.status-tab::after {
  content: "";
  position: absolute;
  right: 9px;
  bottom: -1px;
  left: 9px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
}

.status-tab:hover {
  color: var(--ink-900);
}

.status-tab.is-active {
  color: var(--purple-700);
}

.status-tab.is-active::after {
  background: var(--purple-600);
}

.tab-count {
  min-width: 22px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--ink-600);
  background: #efeff4;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.status-tab.is-active .tab-count {
  color: var(--purple-700);
  background: var(--purple-100);
}

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 13px;
}

.filter-field {
  min-width: 145px;
  flex: 1 1 170px;
}

.filter-field label {
  display: block;
  margin: 0 0 5px 2px;
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.filter-field select,
.filter-field input {
  height: 37px;
  font-size: 12px;
}

.filter-reset {
  flex: 0 0 auto;
  margin-bottom: 1px;
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 12px;
}

.data-table th {
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: #777485;
  background: #fbfbfd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  min-height: 58px;
  padding: 11px 14px;
  border-bottom: 1px solid #eeeeF3;
  color: var(--ink-700);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background var(--ease);
}

.data-table tbody tr[data-action="open-project"] {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: #faf9fe;
}

.data-table tbody tr:focus-visible {
  position: relative;
  outline: 2px solid var(--purple-500);
  outline-offset: -2px;
}

.cell-primary {
  display: block;
  color: var(--ink-900);
  font-weight: 720;
}

.cell-secondary {
  display: block;
  max-width: 240px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-500);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-link {
  color: var(--purple-700);
  background: transparent;
  cursor: pointer;
  font-weight: 780;
}

.reference-link:hover {
  text-decoration: underline;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.chip {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--chip-border, #dedbe9);
  border-radius: 999px;
  color: var(--chip-text, #4d4861);
  background: var(--chip-bg, #f3f1f8);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--chip-dot, var(--purple-500));
}

.chip--plain::before {
  display: none;
}

.chip--inactive {
  filter: grayscale(0.65);
  opacity: 0.68;
}

.tag-overflow {
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 700;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-button svg {
  width: 12px;
  height: 12px;
}

.table-footer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-button {
  min-width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-600);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.page-button:hover:not(:disabled),
.page-button.is-active {
  border-color: var(--purple-200);
  color: var(--purple-700);
  background: var(--purple-50);
}

.page-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.empty-state,
.error-state,
.loading-state {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 42px 24px;
  color: var(--ink-500);
  text-align: center;
}

.empty-icon,
.error-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
}

.empty-icon {
  color: var(--purple-600);
  background: var(--purple-50);
}

.error-icon {
  color: var(--danger);
  background: var(--danger-bg);
}

.empty-icon svg,
.error-icon svg {
  width: 23px;
  height: 23px;
}

.empty-state h3,
.error-state h3 {
  margin: 0;
  color: var(--ink-900);
  font-size: 15px;
}

.empty-state p,
.error-state p {
  max-width: 430px;
  margin: 6px 0 18px;
}

.skeleton-row td {
  height: 62px;
}

.skeleton {
  height: 11px;
  border-radius: 5px;
  background: linear-gradient(90deg, #efeff4 25%, #f8f8fb 50%, #efeff4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

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

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

.field {
  min-width: 0;
}

.field--full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 720;
}

.required-mark {
  color: var(--danger);
}

.field-help {
  margin: 5px 0 0;
  color: var(--ink-500);
  font-size: 11px;
}

.field-error {
  min-height: 0;
  margin: 5px 0 0;
  color: var(--danger);
  font-size: 11px;
}

.field-error:empty {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  color: var(--ink-900);
  background: #fff;
  transition: border var(--ease), box-shadow var(--ease), background var(--ease);
}

input,
select {
  height: 41px;
  padding: 0 11px;
}

textarea {
  min-height: 112px;
  padding: 10px 11px;
  line-height: 1.5;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #aaa7b3;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #b5a4fa;
  box-shadow: 0 0 0 3px rgba(111, 78, 246, 0.09);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #e6858f;
  background: #fffafa;
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
  color: var(--ink-600);
  background: #f5f5f8;
  cursor: not-allowed;
}

.input-with-action {
  position: relative;
}

.input-with-action input {
  padding-right: 44px;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--ink-500);
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.input-action:hover {
  color: var(--ink-900);
  background: #f0f0f4;
}

.input-action svg {
  width: 17px;
  height: 17px;
}

.form-message {
  display: none;
  margin: 0 0 17px;
  padding: 10px 12px;
  border: 1px solid #ffd7dc;
  border-radius: 8px;
  color: var(--danger);
  background: var(--danger-bg);
  font-size: 12px;
}

.form-message:not(:empty) {
  display: block;
}

.form-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.form-section:first-child {
  padding-top: 0;
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section-heading {
  margin: 0 0 15px;
  color: var(--ink-900);
  font-size: 13px;
  font-weight: 780;
}

.generated-preview {
  padding: 13px 14px;
  border: 1px dashed #d7d1ef;
  border-radius: 9px;
  background: var(--purple-50);
}

.generated-preview-label {
  display: block;
  margin-bottom: 3px;
  color: var(--purple-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.generated-preview strong {
  color: var(--ink-900);
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-chip {
  position: relative;
}

.check-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-chip label {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink-600);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.check-chip label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tag-color, var(--purple-500));
}

.check-chip input:checked + label {
  border-color: var(--purple-300, #c7b9ff);
  color: var(--purple-700);
  background: var(--purple-50);
}

.check-chip input:focus-visible + label {
  outline: 3px solid rgba(111, 78, 246, 0.22);
  outline-offset: 2px;
}

.drawer-backdrop,
.modal-backdrop,
.sidebar-backdrop {
  position: fixed;
  z-index: 190;
  inset: 0;
  background: rgba(24, 22, 37, 0.38);
  animation: fade-in 160ms ease;
}

.drawer-backdrop,
.modal-backdrop {
  width: 100%;
  height: 100%;
  padding: 0;
  cursor: default;
}

.drawer {
  position: fixed;
  z-index: 200;
  inset: 0 0 0 auto;
  width: min(760px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: slide-in 220ms ease;
}

.drawer-form {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.drawer-form .drawer-body {
  min-height: 0;
  flex: 1;
}

.drawer--detail {
  inset: 0 0 0 var(--sidebar-width);
  width: auto;
  box-shadow: -12px 0 35px rgba(27, 25, 45, 0.08);
  animation: detail-in 180ms ease;
}

@keyframes detail-in {
  from { opacity: 0; transform: translateX(12px); }
}

.project-detail-body {
  padding: 28px 34px 52px;
}

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

.project-detail-body .detail-section,
.project-detail-body .detail-hero {
  max-width: 1280px;
  margin-right: auto;
  margin-left: auto;
}

@keyframes slide-in {
  from { transform: translateX(35px); opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
}

.drawer-header {
  min-height: 79px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-header-copy {
  min-width: 0;
}

.drawer-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--purple-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer-header h2 {
  margin: 0;
  overflow: hidden;
  color: var(--ink-950);
  font-size: 18px;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 23px;
  overscroll-behavior: contain;
}

.drawer-footer {
  min-height: 66px;
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 9px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfbfd;
}

.detail-reference {
  margin: 0 0 5px;
  color: var(--purple-700);
  font-size: 12px;
  font-weight: 800;
}

.detail-hero h3 {
  margin: 0;
  color: var(--ink-950);
  font-size: 18px;
  line-height: 1.3;
}

.detail-updated {
  margin: 7px 0 0;
  color: var(--ink-500);
  font-size: 11px;
}

.detail-section {
  padding: 23px 0;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.detail-section h3 {
  margin: 0 0 14px;
  color: var(--ink-900);
  font-size: 13px;
}

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

.detail-item dt {
  margin: 0 0 3px;
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.detail-item dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink-900);
}

.detail-item dd a {
  color: var(--purple-700);
  text-decoration: none;
}

.detail-item dd a:hover {
  text-decoration: underline;
}

.notes-box {
  min-height: 72px;
  padding: 13px;
  border-radius: 9px;
  color: var(--ink-700);
  background: #f7f7fa;
  white-space: pre-wrap;
}

.timeline {
  position: relative;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 11px;
  padding-bottom: 19px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 31px;
  bottom: 0;
  left: 14px;
  width: 1px;
  background: var(--line);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-content {
  min-width: 0;
  padding-top: 1px;
}

.timeline-title {
  margin: 0;
  color: var(--ink-900);
  font-size: 12px;
  line-height: 1.45;
}

.timeline-title strong {
  font-weight: 780;
}

.timeline-time {
  display: block;
  margin-top: 3px;
  color: var(--ink-500);
  font-size: 10px;
}

.change-list {
  display: grid;
  gap: 4px;
  margin-top: 7px;
}

.change-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--ink-500);
  font-size: 10px;
}

.change-row strong {
  color: var(--ink-600);
}

.activity-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
}

.activity-filters {
  align-self: start;
  padding: 17px;
}

.activity-filters h3 {
  margin: 0 0 14px;
  font-size: 13px;
}

.activity-filters .field + .field {
  margin-top: 14px;
}

.activity-stream {
  min-width: 0;
  padding: 21px;
}

.activity-stream .timeline-item {
  padding-bottom: 24px;
}

.activity-stream-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.segmented-tabs {
  display: inline-flex;
  gap: 3px;
  margin-bottom: 17px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.segmented-tab {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 7px;
  color: var(--ink-600);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.segmented-tab:hover {
  color: var(--ink-900);
}

.segmented-tab.is-active {
  color: var(--purple-700);
  background: var(--purple-50);
}

.management-card {
  overflow: hidden;
}

.management-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.management-head h3 {
  margin: 0;
  font-size: 15px;
}

.management-head p {
  margin: 4px 0 0;
  color: var(--ink-500);
  font-size: 12px;
}

.management-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.management-flow-help {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-bottom: 1px solid #e8e3ff;
  color: var(--purple-700);
  background: #f7f4ff;
  font-size: 12px;
}

.management-flow-help strong {
  flex: 0 0 auto;
}

.management-row {
  min-height: 61px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px 105px;
  align-items: center;
  gap: 16px;
  padding: 10px 17px;
  border-bottom: 1px solid #efeff3;
}

.management-row.has-order-controls {
  grid-template-columns: minmax(180px, 1fr) 120px 185px;
}

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

.management-row.is-inactive {
  background: #fafafa;
  opacity: 0.7;
}

.management-name {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.color-swatch {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: var(--swatch, var(--purple-500));
  box-shadow: 0 0 0 1px rgba(30, 28, 45, 0.12);
}

.management-name strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.management-name span {
  display: block;
  margin-top: 1px;
  color: var(--ink-500);
  font-size: 10px;
}

.management-name .management-flow-step {
  width: 25px;
  height: 25px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  margin: 0;
  border: 1px solid #ddd5ff;
  border-radius: 999px;
  color: var(--purple-700);
  background: #f4f0ff;
  font-size: 11px;
  font-weight: 800;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
}

.usage-count {
  color: var(--ink-500);
  font-size: 11px;
}

.color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.color-option {
  position: relative;
}

.color-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.color-option label {
  width: 29px;
  height: 29px;
  display: block;
  border: 3px solid #fff;
  border-radius: 8px;
  background: var(--color);
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: pointer;
}

.color-option input:checked + label {
  box-shadow: 0 0 0 2px var(--purple-600);
}

.color-option input:focus-visible + label {
  outline: 3px solid rgba(111, 78, 246, 0.25);
  outline-offset: 2px;
}

.user-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.status-indicator::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-indicator--active {
  color: var(--success);
}

.status-indicator--inactive {
  color: var(--ink-500);
}

.modal-backdrop {
  z-index: 290;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  position: relative;
  z-index: 300;
  width: min(100%, 465px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid rgba(226, 225, 234, 0.9);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modal-in 180ms ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  padding: 20px 20px 15px;
}

.modal-header h2 {
  margin: 0;
  color: var(--ink-950);
  font-size: 17px;
  letter-spacing: -0.02em;
}

.modal-header p {
  margin: 5px 0 0;
  color: var(--ink-500);
  font-size: 12px;
}

.modal-body {
  padding: 4px 20px 21px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: #fbfbfd;
}

.confirm-symbol {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 13px;
  color: var(--warning);
  background: var(--warning-bg);
}

.confirm-symbol--danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.confirm-symbol svg {
  width: 22px;
  height: 22px;
}

.modal-confirm h2 {
  margin: 0;
  color: var(--ink-950);
  font-size: 18px;
}

.modal-confirm p {
  margin: 8px 0 0;
  color: var(--ink-600);
}

.toast-region {
  position: fixed;
  z-index: 500;
  top: 17px;
  right: 17px;
  width: min(370px, calc(100vw - 34px));
  display: grid;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr) 25px;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: 10px;
  color: var(--ink-800, #353243);
  background: #fff;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in 180ms ease;
}

.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }

.toast-icon {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--info);
  background: var(--info-bg);
}

.toast--success .toast-icon {
  color: var(--success);
  background: var(--success-bg);
}

.toast--error .toast-icon {
  color: var(--danger);
  background: var(--danger-bg);
}

.toast-icon svg {
  width: 14px;
  height: 14px;
}

.toast-message {
  font-size: 12px;
  font-weight: 650;
}

.toast-close {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--ink-500);
  background: transparent;
  cursor: pointer;
}

.toast-close:hover {
  color: var(--ink-900);
  background: #f1f1f4;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
}

.mobile-cards {
  display: none;
}

.mobile-project-card {
  padding: 15px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.mobile-project-card:last-child {
  border-bottom: 0;
}

.mobile-project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mobile-project-card h3 {
  margin: 3px 0 0;
  color: var(--ink-900);
  font-size: 13px;
}

.mobile-project-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  color: var(--ink-500);
  font-size: 11px;
}

.noscript {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  color: var(--ink-900);
  background: #fff;
  text-align: center;
}

.modal--wide {
  width: min(100%, 860px);
}

.google-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 19px 20px;
}

.google-card-icon,
.template-symbol {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: var(--purple-700);
  background: var(--purple-50);
}

.google-card-icon svg,
.template-symbol svg {
  width: 20px;
  height: 20px;
}

.google-card-copy h3,
.template-card h3 {
  margin: 0;
  color: var(--ink-950);
  font-size: 14px;
}

.google-card-copy p {
  margin: 4px 0 0;
  color: var(--ink-600);
  font-size: 12px;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  color: #4f36b8;
  background: var(--purple-50);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}

.template-help {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #ddd7f8;
  border-radius: 9px;
  color: var(--ink-600);
  background: #faf9ff;
  font-size: 12px;
  line-height: 1.8;
}

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

.template-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px;
}

.template-card-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 12px;
}

.template-card-head > div {
  min-width: 0;
}

.template-card-head p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--ink-600);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card-meta {
  margin: 18px 0 12px;
  color: var(--ink-500);
  font-size: 11px;
}

.template-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.code-textarea {
  min-height: 230px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
}

.template-preview-shell {
  padding-top: 8px;
}

.template-preview-frame {
  width: 100%;
  height: min(58vh, 560px);
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.template-preview-frame--email {
  height: min(43vh, 390px);
  margin-top: 14px;
}

.inline-callout {
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.inline-callout--warning {
  border-color: #f0dda6;
  color: var(--warning);
  background: var(--warning-bg);
}

.inline-callout--success { border-color:#b9e5cf; color:#087548; background:#eefaf4; }

.email-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 14px;
  margin-top: 15px;
  padding: 12px 14px;
  border-radius: 9px;
  background: #f8f8fb;
  font-size: 12px;
}

.email-summary span {
  color: var(--ink-500);
}

.email-summary strong {
  overflow-wrap: anywhere;
}

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

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

  .topbar {
    padding: 0 22px;
  }

  .main-content {
    padding-right: 22px;
    padding-left: 22px;
  }

  .topbar-title p,
  .account-name {
    display: none;
  }

  .activity-layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .drawer--detail {
    left: 0;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-backdrop {
    z-index: 90;
  }

  .workspace {
    margin-left: 0;
  }

  .mobile-menu-button {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .topbar-title {
    min-width: auto;
  }

  .activity-layout {
    grid-template-columns: 1fr;
  }

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

  .activity-filters h3,
  .activity-filters .field + .field {
    margin: 0;
  }

  .activity-filters h3 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 68px;
    gap: 10px;
    padding: 0 14px;
  }

  .topbar-title h1 {
    font-size: 17px;
  }

  .topbar-center {
    justify-content: flex-end;
  }

  .topbar .search-box {
    width: 42px;
  }

  .topbar .search-box input {
    padding: 0;
    color: transparent;
    cursor: pointer;
  }

  .topbar .search-box:not(:focus-within) input::placeholder {
    color: transparent;
  }

  .topbar .search-box svg {
    left: 12px;
  }

  .topbar .search-box:focus-within {
    position: absolute;
    z-index: 4;
    right: 62px;
    left: 60px;
    width: auto;
  }

  .topbar .search-box:focus-within input {
    padding: 0 38px;
    color: var(--ink-900);
  }

  .topbar .search-box:not(:focus-within) .search-clear {
    display: none;
  }

  .main-content {
    padding: 20px 14px 34px;
  }

  .page-heading {
    align-items: center;
  }

  .page-heading h2 {
    font-size: 19px;
  }

  .page-heading p {
    display: none;
  }

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

  .filter-field {
    min-width: 0;
  }

  .filter-reset {
    grid-column: 1 / -1;
  }

  .desktop-table {
    display: none;
  }

  .mobile-cards {
    display: block;
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination {
    width: 100%;
    justify-content: flex-end;
  }

  .drawer {
    width: 100%;
  }

  .drawer--detail {
    inset: 0;
  }

  .drawer--detail .drawer-header {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .drawer--detail .drawer-header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .drawer--detail .drawer-header-actions .button {
    flex: 1 1 auto;
  }

  .drawer-body {
    padding: 18px;
  }

  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .project-detail-body .detail-grid {
    grid-template-columns: 1fr;
  }

  .project-detail-body {
    padding: 18px 14px 38px;
  }

  .google-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .google-card-action {
    grid-column: 1 / -1;
  }

  .google-card-action .button,
  .template-grid {
    width: 100%;
  }

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

  .field--full {
    grid-column: auto;
  }

  .detail-hero {
    flex-direction: column;
  }

  .management-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .management-row.has-order-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .usage-count {
    display: none;
  }

  .data-table--users th:nth-child(3),
  .data-table--users td:nth-child(3),
  .data-table--users th:nth-child(4),
  .data-table--users td:nth-child(4) {
    display: none;
  }
}

.fill-question-card--recovery {
  border-color: #e5d8ec;
}

.recovery-context {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.recovery-rejection {
  align-items: flex-start;
  background: #fff1f2;
  border: 1px solid #f4c8cd;
  border-radius: 12px;
  color: #9e2635;
  display: flex;
  gap: 11px;
  padding: 14px 16px;
}

.recovery-rejection > span svg {
  height: 20px;
  width: 20px;
}

.recovery-rejection p {
  color: #7f3540;
  margin: 4px 0 0;
}

.recovery-original-answer {
  background: #f7f7fa;
  border: 1px solid #e1e3e9;
  border-radius: 12px;
  padding: 16px;
}

.recovery-original-answer > p {
  color: var(--ink-600);
  margin: 8px 0 12px;
}

.recovery-original-answer .submission-value {
  margin-top: 10px;
}

.recovery-new-answer-label {
  display: block;
  margin-bottom: 10px;
}

.recovery-note-field {
  border-top: 1px solid #e6e7ec;
  margin-top: 18px;
  padding-top: 18px;
}

/* Opleveringscontrole */
.completion-review-table-card {
  overflow: hidden;
}

.completion-review-table {
  min-width: 1080px;
}

.completion-review-table td {
  vertical-align: middle;
}

.completion-document-type,
.completion-review-project-link,
.project-link-button {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.completion-document-type svg,
.completion-review-project-link svg,
.project-link-button svg {
  height: 17px;
  width: 17px;
}

.project-link-button,
.completion-review-project-link {
  background: none;
  border: 0;
  color: var(--primary, #6f3b91);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
}

.project-link-button:hover,
.completion-review-project-link:hover {
  text-decoration: underline;
}

.review-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  white-space: nowrap;
}

.review-status--pending {
  background: #f1f2f6;
  color: #5e6674;
}

.review-status--approved {
  background: #e4f7ec;
  color: #147a43;
}

.review-status--rejected {
  background: #fde9eb;
  color: #b52838;
}

.reviewed-by {
  color: var(--muted, #697386);
  display: block;
  margin-top: 6px;
  white-space: nowrap;
}

.completion-behavior-row {
  align-items: center;
  display: flex;
  font-size: 12px;
  gap: 6px;
  margin-top: 6px;
}

.completion-review-panel > form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.completion-review-panel .workspace-panel-header > div {
  max-width: 900px;
}

.completion-review-project-link {
  font-size: 16px;
  margin: 5px 0 2px;
}

.completion-review-body {
  background: #f6f7fa;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0 auto;
  max-width: 1120px;
  padding-bottom: 44px;
  width: 100%;
}

.completion-review-question {
  background: #fff;
  border: 1px solid #e2e5eb;
  border-radius: 16px;
  box-shadow: 0 5px 18px rgba(35, 33, 50, .04);
  padding: 24px;
}

.completion-review-question > header > div {
  align-items: center;
  color: #72798a;
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
}

.completion-review-question h3 {
  font-size: 18px;
  margin: 7px 0 0;
}

.completion-review-question .submission-value {
  border-bottom: 1px solid #e8eaf0;
  margin: 18px 0 20px;
  padding-bottom: 22px;
}

.review-decision {
  border: 0;
  margin: 0;
  padding: 0;
}

.review-decision legend {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 10px;
}

.review-decision-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-decision-options label {
  cursor: pointer;
  display: block;
}

.review-decision-options input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.review-decision-options span {
  align-items: center;
  background: #fafbfc;
  border: 1px solid #dfe3e9;
  border-radius: 10px;
  display: flex;
  font-weight: 750;
  gap: 8px;
  justify-content: center;
  min-height: 46px;
  padding: 10px 14px;
}

.review-decision-options svg {
  height: 18px;
  width: 18px;
}

.review-decision-options input[value="approved"]:checked + span {
  background: #e8f8ef;
  border-color: #39a76d;
  color: #167944;
}

.review-decision-options input[value="rejected"]:checked + span {
  background: #fff0f1;
  border-color: #dd5966;
  color: #b52838;
}

.review-decision-options input:focus-visible + span {
  outline: 3px solid rgba(111, 78, 246, .22);
  outline-offset: 2px;
}

.review-reason {
  margin-top: 14px;
}

.completion-review-groups {
  display: grid;
  gap: 18px;
}

.completion-review-group {
  overflow: hidden;
  padding: 0;
}

.completion-review-group > header {
  align-items: center;
  background: linear-gradient(90deg, #faf8fd, #fff);
  border-bottom: 1px solid #e3e2e9;
  display: flex;
  justify-content: space-between;
  padding: 18px 20px;
}

.completion-review-group > header .project-link-button {
  font-size: 16px;
}

.completion-review-group > header p {
  color: var(--muted, #697386);
  font-size: 12px;
  margin: 5px 0 0;
}

.completion-review-documents {
  display: grid;
}

.completion-review-document-row {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(190px, 1fr) minmax(150px, .7fr) minmax(260px, auto);
  padding: 17px 20px;
}

.completion-review-document-row + .completion-review-document-row {
  border-top: 1px solid #ecebf1;
}

.completion-document-type > span,
.completion-document-type small {
  display: block;
}

.completion-document-type small {
  color: var(--muted, #697386);
  font-size: 11px;
  margin-top: 3px;
}

.review-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.recovery-plan-button {
  background: #b83d4b;
  border-color: #b83d4b;
}

.recovery-planning-status {
  align-items: center;
  background: #fff8e8;
  border: 1px solid #efd48d;
  border-radius: 10px;
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  padding: 10px 12px;
}

.recovery-planning-status > svg {
  color: #a66b00;
  height: 20px;
  width: 20px;
}

.recovery-planning-status > span {
  flex: 1;
}

.recovery-planning-status strong,
.recovery-planning-status small {
  display: block;
}

.recovery-planning-status small {
  color: #76633c;
  margin-top: 2px;
}

.recovery-planning-status.is-submitted {
  background: #edf9f1;
  border-color: #b8e2c7;
}

.recovery-planning-status.is-submitted > svg {
  color: #17864b;
}

.recovery-planning-status.is-submitted small {
  color: #47745a;
}

.recovery-planning-banner {
  align-items: center;
  background: #fff8e8;
  border-color: #efd48d;
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  padding: 15px 18px;
}

/* BOM, prijsconfiguratie en lokale facturatie */
.product-icon {
  align-items: center;
  background: #f1eafb;
  border-radius: 9px;
  color: var(--purple-700);
  display: inline-flex;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.product-icon svg { height: 19px; width: 19px; }

.invoice-config-card { padding: 22px; }

.invoice-config-selectors {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 280px));
  margin: 20px 0;
}

.invoice-product-rule-list {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.invoice-product-rule {
  align-items: end;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 1fr) 220px 110px 190px;
  padding: 15px 17px;
}

.invoice-product-rule:last-child { border-bottom: 0; }
.invoice-product-rule.is-enabled { background: #fbf9ff; }
.invoice-product-rule-check { align-items: center; display: flex; gap: 11px; min-height: 42px; }
.invoice-product-rule-check input { height: 18px; width: 18px; }
.invoice-product-rule-name { align-self: center; }
.invoice-part-checks { display: grid; gap: 6px; }
.invoice-part-checks > span:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
.invoice-part-checks label { align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; display: inline-flex; font-size: 12px; font-weight: 700; gap: 7px; padding: 9px 11px; }
.invoice-part-checks input { height: 17px; width: 17px; }
.invoice-product-rule .field { margin: 0; }
.invoice-product-rule .field-label { font-size: 11px; margin-bottom: 5px; }

.money-input { align-items: center; display: flex; position: relative; }
.money-input > span { color: var(--ink-500); left: 12px; position: absolute; }
.money-input input { padding-left: 28px; width: 100%; }

.invoice-config-footer {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
}

.invoice-project-list { display: grid; gap: 18px; margin-top: 20px; }
.invoice-parts-preview { display: grid; gap: 18px; }
.invoice-part-preview { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.invoice-part-preview > header { align-items: center; background: #f8f6fc; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 12px 15px; }
.invoice-part-preview > header > div { display: grid; gap: 2px; }
.invoice-part-preview > header span { color: var(--purple-700); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.invoice-part-preview .invoice-lines, .invoice-part-preview .invoice-totals { margin-left: 14px; margin-right: 14px; }
.invoice-project-card { overflow: hidden; padding: 0; }
.invoice-project-card > header,
.invoice-project-card > footer { align-items: center; display: flex; justify-content: space-between; padding: 18px 20px; }
.invoice-project-card > header { border-bottom: 1px solid var(--line); }
.invoice-project-card > header p { color: var(--ink-500); font-size: 12px; margin: 5px 0 0; }
.invoice-project-card > footer { background: #fbfcfe; border-top: 1px solid var(--line); color: var(--ink-500); font-size: 12px; }
.invoice-project-card > .inline-callout { margin: 18px 20px; }
.invoice-project-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.invoice-lines { margin: 0 20px; }
.invoice-line { align-items: center; border-bottom: 1px solid var(--line); display: grid; gap: 16px; grid-template-columns: minmax(260px, 1fr) 80px 130px 130px; padding: 13px 4px; }
.invoice-line > :last-child { text-align: right; }
.invoice-line--head { color: var(--ink-500); font-size: 11px; font-weight: 700; text-transform: uppercase; }

.invoice-totals { margin: 16px 20px 20px auto; max-width: 390px; padding: 0; }
.invoice-totals > div { display: flex; justify-content: space-between; padding: 7px 4px; }
.invoice-totals dt, .invoice-totals dd { margin: 0; }
.invoice-total-final { border-top: 1px solid var(--line-strong); font-size: 17px; font-weight: 800; margin-top: 5px; padding-top: 12px !important; }

.invoice-history { margin-top: 30px; }
.invoice-history .table-wrap { overflow-x: auto; }

.invoice-summary-card {
  align-items: center;
  background: linear-gradient(135deg, #6f4ef6, #5534cf);
  border-radius: var(--radius-lg);
  color: #fff;
  display: grid;
  gap: 3px;
  margin-bottom: 18px;
  padding: 20px 24px;
  width: min(360px, 100%);
}
.invoice-summary-card span, .invoice-summary-card small { color: rgba(255,255,255,.78); }
.invoice-summary-card strong { font-size: 25px; }
.administration-table { overflow-x: auto; }
.administration-table table { min-width: 980px; width: 100%; }
.administration-table td small { color: var(--ink-500); display: block; margin-top: 5px; }
.administration-table .table-link { align-items: center; display: inline-flex; gap: 5px; }
.administration-table .table-link svg { height: 13px; width: 13px; }
.invoice-payment-status { border-radius: 999px; display: inline-flex; font-size: 11px; font-weight: 800; padding: 5px 9px; white-space: nowrap; }
.invoice-payment-status.is-open { background: #fff1f2; color: #b42332; }
.invoice-payment-status.is-partial { background: #fff7df; color: #9b6710; }
.invoice-payment-status.is-paid { background: #e9f9ef; color: #137a48; }
.invoice-payment-summary { background: #f7f5ff; border: 1px solid #e5ddff; border-radius: 12px; display: grid; gap: 7px 16px; grid-template-columns: 110px 1fr; margin-bottom: 20px; padding: 16px; }
.invoice-payment-summary span { color: var(--ink-500); font-size: 12px; }
.project-invoice-list { display: grid; gap: 10px; }
.project-invoice-row { align-items: center; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 12px; grid-template-columns: auto minmax(0,1fr) auto auto; padding: 13px; }
.project-invoice-row > span:nth-child(2) { display: grid; gap: 4px; }
.project-invoice-row small { color: var(--ink-500); }
.table-link { background: none; border: 0; color: var(--purple-700); cursor: pointer; font: inherit; padding: 0; }

@media (max-width: 760px) {
  .invoice-config-selectors { grid-template-columns: 1fr; }
  .invoice-product-rule { align-items: stretch; grid-template-columns: 1fr 1fr; }
  .invoice-product-rule-check, .invoice-product-rule-name, .invoice-part-checks { grid-column: 1 / -1; }
  .invoice-config-footer, .invoice-project-card > header, .invoice-project-card > footer { align-items: stretch; flex-direction: column; gap: 12px; }
  .invoice-line { grid-template-columns: 1fr 60px 100px; }
  .invoice-line > :nth-child(3) { display: none; }
  .project-invoice-row { align-items: start; grid-template-columns: auto 1fr; }
  .project-invoice-row .invoice-payment-status, .project-invoice-row .button { grid-column: 2; justify-self: start; }
}

.recovery-planning-banner-icon {
  color: #a66b00;
  flex: 0 0 auto;
}

.recovery-planning-banner-icon svg {
  height: 24px;
  width: 24px;
}

.recovery-planning-banner > div {
  flex: 1;
}

.recovery-planning-banner p {
  color: #6d5c39;
  margin: 4px 0 0;
}

@media (max-width: 720px) {
  .review-decision-options {
    grid-template-columns: 1fr;
  }

  .completion-review-question {
    border-radius: 12px;
    padding: 18px;
  }

  .completion-review-document-row {
    grid-template-columns: 1fr;
  }

  .review-row-actions {
    justify-content: flex-start;
  }

  .recovery-planning-banner {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

/* Formuliersjablonen en ingevulde projectformulieren */
.planning-email-section { margin: 24px 0 30px; }
.planning-email-section > .section-heading { margin-bottom: 14px; }
.template-card-head small { display:block; margin-top:5px; color:var(--ink-500); font-size:11px; }
.planning-installation-card { padding:22px; }
.planning-installation-card > .section-heading { margin-bottom:18px; }
.installation-text-list { display:grid; gap:13px; }
.installation-text-list label { display:grid; grid-template-columns:150px minmax(0,1fr); align-items:start; gap:14px; }
.installation-text-list .chip { justify-self:start; margin-top:8px; }
.installation-text-list textarea { width:100%; resize:vertical; }
.planning-installation-card .card-actions { display:flex; justify-content:flex-end; margin-top:18px; }

.form-template-grid {
  display: grid;
  gap: 14px;
}

.form-template-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 20px;
}

.form-template-card-icon,
.linked-icon {
  display: grid;
  place-items: center;
  color: var(--purple-700);
  background: var(--purple-50);
  border-radius: 12px;
}

.form-template-card-icon { width: 48px; height: 48px; }
.form-template-card-icon svg,
.linked-icon svg { width: 23px; height: 23px; }
.form-template-card-copy { min-width: 0; }
.form-template-card-copy h3 { margin: 0 0 3px; font-size: 16px; }
.form-template-card-copy p { margin: 0 0 8px; color: var(--ink-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-template-card-copy > span { color: var(--ink-500); font-size: 12px; }
.form-template-kind { margin-bottom: 5px; }
.form-template-kind span { display: inline-flex; padding: 3px 8px; border-radius: 999px; color: var(--purple-700); background: var(--purple-50); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

.form-kind-options {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.form-kind-options label {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.form-kind-options label:has(input:checked) {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(111, 78, 246, .1);
}

.form-kind-options input { position: absolute; opacity: 0; pointer-events: none; }
.form-kind-option-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--purple-700); background: var(--purple-50); }
.form-kind-options strong,
.form-kind-options small { display: block; }
.form-kind-options small { margin-top: 3px; color: var(--ink-500); line-height: 1.45; }

.workspace-overlay {
  position: fixed;
  z-index: 260;
  inset: 0 0 0 var(--sidebar-width);
  padding: 18px;
  background: rgba(245, 246, 249, .98);
  animation: fade-in 160ms ease;
}

.workspace-panel {
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.workspace-panel > form,
.workspace-panel-form {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.workspace-panel-header,
.workspace-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
}

.workspace-panel-header h2 { margin: 2px 0 3px; font-size: 23px; }
.workspace-panel-header p { margin: 0; color: var(--ink-600); }
.workspace-panel-footer { border-top: 1px solid var(--line); border-bottom: 0; justify-content: flex-end; background: #fff; }
.workspace-panel-body { min-height: 0; flex: 1; overflow-y: auto; padding: 26px; background: #fafafd; }

.wizard-steps {
  display: flex;
  justify-content: center;
  gap: 62px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.wizard-step { display: flex; align-items: center; gap: 8px; color: var(--ink-500); font-weight: 700; }
.wizard-step b { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: #eeeef4; }
.wizard-step.is-current { color: var(--purple-700); }
.wizard-step.is-current b { color: #fff; background: var(--purple-600); }
.wizard-step.is-complete b { color: var(--success); background: var(--success-bg); }
.form-builder-base { width: min(760px, 100%); margin: 20px auto; }

.form-email-settings {
  display: grid;
  gap: 17px;
  margin-top: 8px;
  padding: 22px;
  border: 1px solid var(--purple-100);
  border-radius: 14px;
  background: #fff;
}

.form-email-settings h3 { margin: 4px 0; font-size: 18px; }
.form-email-settings > div:first-child > p { margin: 0; color: var(--ink-600); line-height: 1.5; }

.form-builder-summary,
.question-builder-toolbar {
  width: min(1080px, 100%);
  margin: 0 auto 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.form-builder-summary { padding: 14px 17px; background: var(--purple-50); border: 1px solid var(--purple-100); border-radius: 12px; }
.form-builder-summary span { display: block; color: var(--ink-500); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.question-builder-toolbar h3 { margin: 0 0 2px; font-size: 19px; }
.question-builder-toolbar p { margin: 0; color: var(--ink-500); }
.question-builder-list { width: min(1080px, 100%); margin: 0 auto; display: grid; gap: 12px; }

.question-builder-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
.question-builder-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--purple-700); background: var(--purple-50); font-weight: 800; }
.question-builder-copy h4 { margin: 5px 0 4px; font-size: 15px; }
.question-builder-copy p { margin: 0; color: var(--ink-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.question-builder-meta { display: flex; gap: 8px; align-items: center; color: var(--ink-500); font-size: 11px; }
.question-builder-meta > span { padding: 2px 7px; border-radius: 999px; background: #f2f2f6; }
.question-builder-meta .required-badge,
.required-badge { color: var(--purple-700); background: var(--purple-100); }
.question-builder-actions { display: flex; gap: 3px; }
.question-builder-actions .icon-button:nth-child(1) svg { transform: rotate(90deg); }
.question-builder-actions .icon-button:nth-child(2) svg { transform: rotate(90deg); }
.choice-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.choice-preview span { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-600); font-size: 11px; }
.question-empty { min-height: 310px; }

[data-question-options][hidden] { display: none; }
.question-required-toggle { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.question-required-toggle small { display: block; color: var(--ink-500); font-weight: 400; }
.question-image-preview { margin-top: 12px; padding: 10px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; }
.question-image-preview img { width: 120px; height: 82px; object-fit: contain; border-radius: 7px; background: #f1f2f6; }
.question-image-preview div { display: grid; justify-items: start; gap: 6px; }

.form-fill-panel { max-width: 1180px; }
.form-fill-body { padding: 30px; }
.fill-question-card,
.submission-answer { margin: 0 auto 18px; padding: 24px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.fill-question-card > header > div,
.submission-answer > header > div { display: flex; align-items: center; gap: 8px; color: var(--ink-500); font-size: 12px; font-weight: 750; }
.fill-question-card h3,
.submission-answer h3 { margin: 7px 0 0; font-size: 18px; }
.required-badge,
.optional-badge { display: inline-flex; padding: 2px 7px; border-radius: 999px; font-size: 11px; }
.optional-badge { background: #f0f1f5; }
.fill-question-introduction,
.submission-introduction { margin: 16px 0; color: var(--ink-700); line-height: 1.65; }
.fill-question-image { margin: 16px 0; padding: 16px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; background: #f5f6f8; }
.fill-question-image img { max-width: 100%; max-height: 430px; object-fit: contain; border-radius: 8px; }
.fill-html-component { margin: 0 auto 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.fill-html-component iframe { width: 100%; min-height: 220px; display: block; border: 0; }
.fill-answer { margin-top: 17px; }
.fill-answer textarea { width: 100%; }
.answer-choices { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.answer-choices label { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.answer-choices input[type="radio"],
.answer-choices input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--purple-600); }
.answer-choices > .field-help { margin: 2px 0 0; }
.amount-answer { display: flex; align-items: center; max-width: 340px; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.amount-answer span { align-self: stretch; display: grid; place-items: center; width: 45px; background: #f4f4f8; font-weight: 800; }
.amount-answer input { flex: 1; border: 0; border-radius: 0; }
.photo-answer-upload > input { position: absolute; opacity: 0; pointer-events: none; }
.photo-answer-upload > label { min-height: 86px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 2px dashed var(--purple-200); border-radius: 12px; color: var(--purple-700); background: var(--purple-50); font-weight: 800; cursor: pointer; }
.photo-answer-upload > label svg { width: 20px; }
.selected-file-list { display: grid; gap: 6px; margin-top: 9px; }
.selected-file-list > span { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.selected-file-list svg { width: 18px; color: var(--purple-600); }

.detail-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 15px; }
.detail-section-heading h3 { margin: 0 0 2px; }
.detail-section-heading p { margin: 0; color: var(--ink-500); font-size: 12px; }
.detail-section-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.linked-list { display: grid; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.linked-list-row { width: 100%; display: grid; grid-template-columns: 38px minmax(0,1fr) auto 20px; gap: 12px; align-items: center; padding: 12px; text-align: left; background: #fff; cursor: pointer; }
.linked-list-row + .linked-list-row { border-top: 1px solid var(--line); }
.linked-list-row:hover { background: #faf9ff; }
.linked-list-row > svg { width: 18px; color: var(--ink-500); }
.linked-icon { width: 36px; height: 36px; }
.linked-list-row strong,
.linked-list-row small { display: block; }
.linked-list-row small { margin-top: 2px; color: var(--ink-500); font-weight: 400; }
.document-count { display: grid; place-items: center; min-width: 28px; height: 25px; padding: 0 8px; color: var(--purple-700); background: var(--purple-100); border-radius: 999px; font-weight: 800; }
.document-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.document-card { min-width: 0; display: grid; grid-template-columns: 58px minmax(0,1fr) 22px; gap: 10px; align-items: center; padding: 8px; color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; }
.document-card:hover { border-color: var(--purple-200); background: var(--purple-50); }
.document-card img { width: 58px; height: 48px; object-fit: cover; border-radius: 7px; background: #eee; }
.document-card strong,
.document-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-card small { color: var(--ink-500); font-weight: 400; }
.document-download svg { width: 18px; color: var(--purple-700); }

.submission-detail-modal { width: min(100%, 1040px); }
.submission-answers { background: #f8f8fb; }
.submission-answer { max-width: 900px; }
.submission-value { margin-top: 16px; }
.answer-text { padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #fafafa; }
.submission-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 11px; }
.submission-photo-grid button { min-width: 0; padding: 0; color: inherit; text-align: left; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; cursor: zoom-in; }
.submission-photo-grid button:hover { border-color: var(--purple-300); box-shadow: 0 4px 14px rgba(30, 27, 48, .12); }
.submission-photo-grid button:focus-visible { outline: 3px solid rgba(111, 78, 246, .22); outline-offset: 2px; }
.submission-photo-grid img { width: 100%; height: 150px; display: block; object-fit: cover; background: #eee; }
.submission-photo-grid span { display: block; padding: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }

.image-viewer-backdrop {
  z-index: 500;
  padding: 0;
  background: rgba(12, 12, 18, .94);
}

.image-viewer {
  width: 100vw;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: #111118;
}

.image-viewer-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px 10px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
  background: rgba(22, 21, 30, .98);
}

.image-viewer-header span,
.image-viewer-header strong { display: block; }
.image-viewer-header span { margin-bottom: 2px; color: #aaa8b5; font-size: 11px; }
.image-viewer-header strong { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }

.image-viewer-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.image-viewer-controls button,
.image-viewer-controls output {
  min-width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font: inherit;
}

.image-viewer-controls button { cursor: pointer; }
.image-viewer-controls button:hover { background: rgba(255, 255, 255, .16); }
.image-viewer-controls output { min-width: 62px; color: #d9d7e1; font-size: 12px; }
.image-viewer-controls .image-viewer-close { margin-left: 7px; border-color: rgba(255, 255, 255, .28); }
.image-viewer-close svg { width: 20px; height: 20px; }

.image-viewer-stage {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
}

.image-viewer-canvas {
  width: var(--image-size, 100%);
  height: var(--image-size, 100%);
  min-width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-viewer-canvas img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  box-shadow: 0 10px 45px rgba(0, 0, 0, .42);
}

@media (max-width: 700px) {
  .image-viewer-header { flex-wrap: wrap; padding: 10px 12px; }
  .image-viewer-header > div:first-child { min-width: 0; flex: 1; }
  .image-viewer-header strong { max-width: 100%; }
  .image-viewer-controls { width: 100%; justify-content: center; }
  .image-viewer-controls button { padding: 0 9px; }
  .image-viewer-canvas { padding: 10px; }
  .installation-text-list label { grid-template-columns:1fr; gap:6px; }
}

.customer-link-recipient { display: grid; grid-template-columns: 58px 1fr; gap: 2px 10px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fafafd; }
.customer-link-recipient span { grid-row: 1 / 3; align-self: center; color: var(--ink-500); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.customer-link-recipient small { color: var(--ink-500); }
.customer-link-result { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding: 16px; border: 1px solid #cce9d9; border-radius: 11px; background: var(--success-bg); }
.customer-link-result-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; color: var(--success); border-radius: 10px; background: #fff; }
.customer-link-result-icon svg { width: 22px; }
.customer-link-result strong, .customer-link-result p { display: block; margin: 0; }
.customer-link-result p { color: var(--ink-600); }
.copy-link-field { display: flex; gap: 8px; }
.copy-link-field input { min-width: 0; flex: 1; }

@media (max-width: 900px) {
  .workspace-overlay { inset-left: 0; left: 0; padding: 0; }
  .workspace-panel { border-radius: 0; border: 0; }
  .form-template-card { grid-template-columns: 42px minmax(0, 1fr); }
  .form-template-card > .button { grid-column: 2; justify-self: start; }
  .question-builder-card { grid-template-columns: 34px minmax(0,1fr); }
  .question-builder-actions { grid-column: 2; }
}

@media (max-width: 620px) {
  .workspace-panel-header,
  .workspace-panel-body,
  .workspace-panel-footer { padding: 16px; }
  .workspace-panel-footer { flex-wrap: wrap; }
  .wizard-steps { gap: 22px; }
  .question-builder-toolbar { align-items: stretch; flex-direction: column; }
  .fill-question-card,
  .submission-answer { padding: 17px; }
  .linked-list-row { grid-template-columns: 34px minmax(0,1fr) 18px; }
  .linked-list-row .status-indicator { display: none; }
}

@media (max-width: 520px) {
  .auth-page {
    padding: 20px 13px;
  }

  .auth-card {
    padding: 25px 20px;
  }

  .sidebar {
    width: min(86vw, 290px);
  }

  .page-heading .button-label-optional {
    display: none;
  }

  .filter-row,
  .activity-filters {
    grid-template-columns: 1fr;
  }

  .status-tabs {
    padding-left: 8px;
  }

  .drawer-header {
    min-height: 68px;
    padding: 12px 14px;
  }

  .drawer-header h2 {
    max-width: 205px;
    font-size: 16px;
  }

  .drawer-footer {
    padding: 10px 14px;
  }

  .drawer-footer .button {
    flex: 1;
  }

  .mobile-project-meta {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }

  .management-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .management-head .button {
    width: 100%;
  }

  .segmented-tabs {
    width: 100%;
  }

  .segmented-tab {
    flex: 1;
    padding: 0 7px;
  }
}

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

/* Planning */
.planning-page {
  display: grid;
  gap: 14px;
}

.planning-toolbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
}

.planning-view-switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8f8fb;
}

.planning-view-switch .segmented-tab {
  min-width: 62px;
}

.planning-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.planning-date-nav strong {
  min-width: 255px;
  color: var(--ink-900);
  text-align: center;
  text-transform: capitalize;
}

.planning-user-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
}

.planning-user-filter select {
  min-width: 180px;
}

.planning-colleague-filter {
  position: relative;
}

.planning-colleague-filter > .button svg:last-child {
  width: 14px;
  height: 14px;
}

.planning-colleague-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  width: 270px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.planning-colleague-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 3px 5px 8px;
  border-bottom: 1px solid var(--line);
}

.planning-colleague-actions button {
  color: var(--purple-700);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.planning-colleague-popover > label {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 9px;
  padding: 8px 6px;
  border-radius: 7px;
  cursor: pointer;
}

.planning-colleague-popover > label:hover {
  background: var(--purple-50);
}

.planning-colleague-popover label strong,
.planning-colleague-popover label small {
  display: block;
}

.planning-colleague-popover label small {
  color: var(--ink-500);
  font-size: 10px;
}

.planning-layout {
  min-height: calc(100vh - 200px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.planning-layout--technician {
  grid-template-columns: minmax(0, 1fr);
}

.project-pool,
.planning-board {
  min-width: 0;
  overflow: hidden;
}

.project-pool {
  display: flex;
  flex-direction: column;
  padding: 15px;
}

.project-pool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.project-pool h2 {
  margin: 0;
  font-size: 16px;
}

.project-pool p {
  margin: 3px 0 0;
  color: var(--ink-500);
  font-size: 12px;
}

.planning-status-filter {
  margin-top: 14px;
}

.planning-selection,
.planning-hint {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.planning-selection {
  color: var(--purple-700);
  background: var(--purple-50);
}

.planning-selection svg {
  width: 16px;
  height: 16px;
}

.planning-hint {
  color: var(--ink-500);
  background: #f6f6f9;
}

.project-pool-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
}

.planning-project-card {
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 3px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.planning-project-card:hover {
  border-color: var(--purple-200);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.planning-project-card.is-selected {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 2px rgba(111, 78, 246, 0.12);
}

.planning-project-card > strong {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-project-card > span:not(.chip) {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink-500);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-project-ref {
  color: var(--purple-700) !important;
  font-weight: 800;
}

.planning-board {
  position: relative;
  background: #fff;
}

.planner-scroll,
.month-calendar {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.planner-time-grid {
  position: relative;
  min-width: max-content;
  display: grid;
  isolation: isolate;
}

.planner-corner,
.planner-user-head,
.planner-day-head {
  position: sticky;
  z-index: 8;
  top: 0;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  background: #fff;
}

.planner-corner {
  left: 0;
  z-index: 10;
  justify-content: center;
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 800;
}

.planner-user-head {
  gap: 9px;
  padding: 9px 12px;
}

.planner-user-head span:last-child,
.planner-user-head strong,
.planner-user-head small {
  min-width: 0;
  display: block;
}

.planner-user-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planner-user-head small {
  color: var(--ink-500);
  font-size: 10px;
}

.planner-day-head {
  justify-content: center;
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.planner-day-head.is-today {
  color: var(--purple-700);
  background: var(--purple-50);
}

.planner-day-head.is-weekend,
.planner-period-hours.is-weekend,
.planner-slot.is-weekend {
  background: #e8e9ed;
}

.planner-slot.is-weekend:nth-of-type(even) {
  background: #e3e4e8;
}

.planner-slot.is-weekend:not(:disabled):hover {
  background: #ddd8ee;
}

.planner-time-grid--week,
.planner-time-grid--month-wide {
  min-height: 100%;
}

.planner-time-grid--period-horizontal {
  min-height: 100%;
}

.planner-period-day {
  letter-spacing: 0.01em;
  border-left: 1px solid var(--line-strong);
}

.planner-period-hours {
  position: sticky;
  z-index: 8;
  top: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  color: var(--ink-500);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.planner-period-hours:not(.is-weekend) {
  background: linear-gradient(to right, #e5e6ea 0 9.09%, #fff 9.09% 90.91%, #e5e6ea 90.91% 100%);
}

.planner-period-hours span.is-off-hours {
  color: #55596a;
  font-weight: 800;
}

.planner-week-band {
  position: sticky;
  z-index: 8;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line-strong);
  background: #f7f7fa;
  color: var(--ink-900);
  font-size: 13px;
  font-weight: 800;
}

.planner-time-grid--week-horizontal .planner-period-day {
  top: 38px;
}

.planner-time-grid--week-horizontal .planner-period-hours {
  top: 80px;
}

.planner-period-corner {
  align-self: stretch;
}

.planner-time-grid--week .planning-event,
.planner-time-grid--month-wide .planning-event {
  min-height: 31px;
}

.modal-footer-spacer {
  flex: 1;
}

.planner-time {
  position: sticky;
  z-index: 5;
  left: 0;
  padding: 5px 8px 0 0;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid #efeff4;
  color: var(--ink-500);
  background: #fff;
  font-size: 10px;
  text-align: right;
}

.planner-time-head {
  position: sticky;
  z-index: 8;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-500);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

.planner-time-head.is-off-hours,
.planner-slot.is-off-hours,
.planner-slot.is-off-hours:nth-of-type(even) {
  background: #e5e6ea;
}

.planner-slot.is-off-hours {
  cursor: not-allowed;
}

.planner-user-head--row {
  z-index: 7;
  top: auto;
  left: 0;
  border-bottom: 1px solid var(--line);
}

.planner-slot {
  z-index: 1;
  border-right: 1px solid #efeff4;
  border-bottom: 1px solid #efeff4;
  background: #fff;
  cursor: crosshair;
}

.planner-slot:nth-of-type(even) {
  background: #fcfcfd;
}

.planner-slot:not(:disabled):hover {
  background: var(--purple-50);
  box-shadow: inset 0 0 0 1px var(--purple-200);
}

.planner-slot.is-drag-selected {
  background: rgba(111, 78, 246, 0.18);
  box-shadow: inset 0 2px 0 var(--purple-500), inset 0 -2px 0 var(--purple-500);
}

.planner-slot:disabled {
  cursor: default;
}

.planning-event {
  position: relative;
  z-index: 4;
  min-width: 0;
  margin: 2px 3px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  padding: 4px 7px;
  border-left: 4px solid var(--event-color);
  border-radius: 6px;
  color: var(--ink-900);
  background: color-mix(in srgb, var(--event-color) 13%, white);
  box-shadow: 0 1px 3px rgba(30, 27, 48, 0.12);
  cursor: pointer;
  text-align: left;
}

.planning-confirmation-dot {
  position: absolute;
  z-index: 2;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(30,27,48,.15);
}

.planning-confirmation-dot.is-pending { background:#d9505e; }
.planning-confirmation-dot.is-accepted { background:#169b62; }

.planning-event-indicators { position:absolute; z-index:3; top:5px; right:5px; display:flex; align-items:center; gap:4px; }
.planning-event-indicators .planning-confirmation-dot { position:static; }
.planning-delivery-icon { width:17px; height:17px; display:grid; place-items:center; border-radius:50%; background:#fff; color:#db7629; box-shadow:0 0 0 1px rgba(30,27,48,.15); }
.planning-delivery-icon.is-delivered { color:#169b62; }
.planning-delivery-icon svg { width:12px; height:12px; }

.signature-answer { display:grid; gap:10px; }
.signature-answer canvas { width:100%; height:220px; border:1px solid #cbc8d7; border-radius:10px; background:#fff; cursor:crosshair; touch-action:none; }
.signature-answer > div { display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--ink-500); font-size:12px; }
.submitted-signature { padding:12px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.submitted-signature img { display:block; width:100%; max-height:260px; object-fit:contain; }
.planning-completion-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:12px; }

.completion-template-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:18px; }
.completion-template-card { display:grid; grid-template-columns:54px minmax(0,1fr) auto; align-items:center; gap:15px; }
.completion-template-card h3 { margin:3px 0 5px; }
.completion-template-card p { margin:0 0 7px; color:var(--ink-500); }
.completion-template-card small { color:var(--ink-500); }
.completion-template-icon { width:52px; height:52px; display:grid; place-items:center; border-radius:13px; color:var(--purple-700); background:var(--purple-50); }
.completion-template-icon svg { width:25px; height:25px; }
.completion-type-list { display:grid; gap:22px; margin-top:20px; }
.completion-type-section { padding:20px; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
.completion-type-section .section-heading h3 { margin:8px 0 3px; }
.completion-type-section .completion-template-grid { margin-top:14px; }
.completion-template-behavior { margin-top:9px; }
.planning-project-link { display:inline-flex; align-items:center; gap:8px; padding:2px 0; border:0; background:transparent; color:var(--purple-700); font:inherit; font-weight:800; text-align:left; cursor:pointer; text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:4px; }
.planning-project-link:hover { color:var(--purple-900); }
.planning-project-link:focus-visible { outline:3px solid rgba(111,78,246,.25); outline-offset:4px; border-radius:5px; }
.planning-project-link svg { width:20px; height:20px; flex:0 0 auto; }
.template-card-head small { display:block; margin-top:3px; color:var(--ink-500); }

.project-substatus { display:inline-flex; padding:4px 10px; border-radius:999px; background:#eef0f5; color:#4c4a59; font-size:12px; font-weight:750; }
.project-substatus--opgeleverd { background:#e8f8f0; color:#087548; }
.project-substatus--gefactureerd { background:#ece9ff; color:#5134bd; }

@media (max-width: 800px) { .completion-template-grid { grid-template-columns:1fr; } .completion-template-card { grid-template-columns:46px minmax(0,1fr); } .completion-template-card > .button { grid-column:1/-1; } }

.planning-confirmation-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fff0f1;
  color: #a52d3a;
  font-size: 11px;
  font-weight: 700;
}

.planning-confirmation-label.is-accepted {
  background: #e9f8f1;
  color: #087548;
}

.project-planning-list,
.project-planning-card {
  display: grid;
  gap: 10px;
}

.project-planning-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.project-planning-card > button {
  width: 100%;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 18px;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  border: 0;
  background: transparent;
  color: var(--ink-900);
  text-align: left;
  cursor: pointer;
}

.project-planning-card > button:hover { background: #faf9fd; }
.project-planning-card > button .planning-confirmation-dot { position: static; }
.project-planning-card > button span:nth-child(2) { display: grid; gap: 3px; }
.project-planning-card > button small { color: var(--ink-500); }

.planning-decline-summary,
.planning-history-callout > div {
  display: grid;
  gap: 4px;
  padding: 11px 14px;
  border-top: 1px solid #f1d9dc;
  background: #fff7f8;
  color: #71323a;
  font-size: 12px;
}

.planning-history-callout {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #efcbd0;
  border-radius: 9px;
  background: #fff9f9;
  color: #71323a;
}

.planning-history-callout > div {
  padding: 8px 0 0;
  background: transparent;
}

.planning-event:hover {
  filter: brightness(0.98);
  box-shadow: 0 4px 12px rgba(30, 27, 48, 0.15);
}

.planning-event span,
.planning-event small {
  max-width: 100%;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-event strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planner-time-grid--day-horizontal .planning-event {
  min-height: 46px;
  margin: 10px 2px;
  justify-content: center;
  border-top: 4px solid var(--event-color);
  border-left: 0;
}

.planner-time-grid--period-horizontal .planning-event {
  min-height: 46px;
  margin: 10px 2px;
  justify-content: center;
  border-top: 4px solid var(--event-color);
  border-left: 0;
}

.planner-time-grid--day-horizontal .planning-event span,
.planner-time-grid--day-horizontal .planning-event strong,
.planner-time-grid--day-horizontal .planning-event small {
  white-space: nowrap;
}

.planner-time-grid--period-horizontal .planning-event span,
.planner-time-grid--period-horizontal .planning-event strong,
.planner-time-grid--period-horizontal .planning-event small {
  white-space: nowrap;
}

.month-calendar {
  min-width: 840px;
}

.month-weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.month-weekdays {
  position: sticky;
  z-index: 7;
  top: 0;
  background: #fff;
}

.month-weekdays span {
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.month-day {
  min-height: 132px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.month-day.is-outside {
  background: #fafafd;
  opacity: 0.62;
}

.month-day.is-today {
  box-shadow: inset 0 0 0 2px var(--purple-500);
}

.month-day-number {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  cursor: crosshair;
  font-size: 11px;
  font-weight: 800;
}

.month-day-number:not(:disabled):hover {
  color: #fff;
  background: var(--purple-600);
}

.month-events {
  display: grid;
  gap: 3px;
}

.month-events .planning-event {
  width: 100%;
  min-height: 25px;
  margin: 0;
  display: block;
  padding: 4px 5px;
}

.month-events .planning-event span,
.month-events .planning-event small {
  display: none;
}

.month-more {
  color: var(--ink-500);
  font-size: 10px;
}

.planning-time-fields > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.planning-time-fields input {
  min-width: 0;
}

.planning-detail-body {
  display: grid;
  gap: 22px;
}

.planning-detail-body section > h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.user-type-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.user-type-badge--office {
  color: var(--purple-700);
  background: var(--purple-50);
}

.user-type-badge--technician {
  color: #176443;
  background: #eaf8f0;
}

.user-type-badge--admin {
  color: #fff;
  background: var(--purple-700);
}

.user-access-copy { display: block; margin-top: 4px; }

.user-admin-option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--purple-200);
  border-radius: 11px;
  background: var(--purple-50);
  cursor: pointer;
}

.user-admin-option input,
.user-permission-option input,
.user-permission-row input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--purple-700);
}

.user-admin-option span { display: grid; gap: 3px; }
.user-admin-option strong { color: var(--purple-900); font-size: 12px; }
.user-admin-option small { color: var(--ink-500); line-height: 1.45; }

.user-permissions {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafd;
}

.user-permissions[hidden],
[data-user-access-note][hidden] { display: none; }

.user-permissions-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.user-permissions-head p { margin: 4px 0 0; color: var(--ink-500); }
.user-permission-section { margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.user-permission-section legend { padding: 0 6px; color: var(--ink-700); font-weight: 800; }
.user-permission-option { display: flex; align-items: flex-start; gap: 8px; min-width: 0; color: var(--ink-700); cursor: pointer; }
.user-permission-option span { line-height: 1.35; }
.user-permission-grid { display: grid; gap: 2px; }
.user-permission-grid-head,
.user-permission-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 86px; align-items: center; gap: 8px; }
.user-permission-grid-head { padding: 0 4px 6px; color: var(--ink-500); font-size: 11px; font-weight: 800; }
.user-permission-grid-head span:not(:first-child) { text-align: center; }
.user-permission-row { min-height: 34px; padding: 5px 4px; border-top: 1px solid var(--line-soft, #ececf4); color: var(--ink-700); }
.user-permission-row > label { display: grid; place-items: center; cursor: pointer; }
.user-permission-row input:disabled { cursor: not-allowed; opacity: .4; }
.read-only-notice { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.read-only-notice strong { color: var(--purple-900); }

@media (max-width: 560px) {
  .user-permissions-head { align-items: stretch; flex-direction: column; }
  .user-permission-grid-head,
  .user-permission-row { grid-template-columns: minmax(0, 1fr) 66px 76px; }
}

.automation-list {
  display: grid;
  gap: 12px;
}

.automation-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.automation-card.is-paused {
  opacity: 0.72;
}

.automation-card-main {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.automation-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--purple-700);
  background: var(--purple-50);
}

.automation-icon svg {
  width: 20px;
  height: 20px;
}

.automation-title,
.automation-actions,
.automation-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.automation-title h3 {
  margin: 0;
  font-size: 15px;
}

.automation-card-main p {
  margin: 6px 0;
  color: var(--ink-700);
  font-size: 12px;
}

.automation-meta {
  flex-wrap: wrap;
  color: var(--ink-500);
  font-size: 10px;
}

.automation-meta span + span::before {
  margin-right: 10px;
  content: "•";
}

.automation-time-grid {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafafd;
}

[data-automation-time-fields][hidden] {
  display: none;
}

/* Tickets en klantcommunicatie */
.tickets-page {
  min-width: 0;
}

.ticket-toolbar {
  margin-bottom: 16px;
  overflow: hidden;
}

.ticket-filter-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px) auto;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.ticket-filter-form .search-box {
  width: 100%;
}

.ticket-toolbar .status-tabs {
  padding: 10px 14px 0;
  overflow-x: auto;
}

.ticket-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 16px;
  min-height: 620px;
}

.ticket-list-panel,
.ticket-detail-panel {
  min-width: 0;
  overflow: hidden;
}

.ticket-list {
  max-height: calc(100vh - 310px);
  overflow-y: auto;
}

.ticket-list-item {
  width: 100%;
  padding: 15px 16px;
  display: grid;
  gap: 7px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  text-align: left;
  color: var(--ink-900);
  background: #fff;
  cursor: pointer;
}

.ticket-list-item:hover,
.ticket-list-item.is-active {
  background: var(--purple-50);
  border-left-color: var(--purple-700);
}

.ticket-list-item.is-overdue {
  border-left-color: #c33a3a;
}

.ticket-list-top,
.ticket-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-list-top strong,
.ticket-project-ref,
.ticket-list-meta {
  font-size: 11px;
}

.ticket-list-meta,
.ticket-project-ref {
  color: var(--ink-500);
}

.ticket-list-subject {
  overflow: hidden;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ticket-project-ref.is-unlinked {
  color: #946000;
}

.ticket-priority {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--ink-600);
  background: #f1f1f5;
  font-size: 10px;
  font-weight: 700;
}

.ticket-priority--high { color: #8a4c00; background: #fff2cf; }
.ticket-priority--urgent { color: #a12626; background: #ffe4e4; }

.ticket-detail {
  padding: 20px;
}

.ticket-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.ticket-detail-header h3 {
  margin: 3px 0 5px;
  font-size: 21px;
}

.ticket-detail-header p {
  margin: 0;
  color: var(--ink-500);
}

.ticket-properties {
  margin: 18px 0;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafafd;
}

.ticket-properties label,
.ticket-compose label {
  display: grid;
  gap: 6px;
  color: var(--ink-600);
  font-size: 11px;
  font-weight: 700;
}

.ticket-properties-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-conversation h4,
.ticket-notes h4 {
  margin: 0 0 12px;
}

.ticket-message {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.ticket-message--outbound {
  margin-left: 7%;
  border-color: #d9d2f2;
  background: #faf8ff;
}

.ticket-message--inbound {
  margin-right: 7%;
}

.ticket-message.is-draft {
  border-style: dashed;
  background: #fffaf0;
}

.ticket-message header,
.ticket-message header > div,
.project-communication-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-message header > div {
  justify-content: flex-start;
}

.ticket-message header span,
.ticket-message time,
.internal-note time {
  color: var(--ink-500);
  font-size: 10px;
}

.ticket-message-body {
  margin-top: 10px;
  overflow-wrap: anywhere;
  color: var(--ink-700);
  line-height: 1.55;
  white-space: pre-wrap;
}

.ticket-attachments {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ticket-attachments a,
.ticket-attachments > span {
  padding: 7px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 11px;
}

.ticket-attachments svg { width: 14px; height: 14px; }

.ticket-compose,
.ticket-notes {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.ticket-compose textarea,
.ticket-notes textarea {
  width: 100%;
  margin: 7px 0 10px;
  resize: vertical;
}

.internal-note {
  margin-bottom: 9px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fff7db;
}

.internal-note time { margin-left: 8px; }
.internal-note p { margin: 6px 0 0; white-space: pre-wrap; }

.inbox-preview {
  margin-bottom: 16px;
  padding: 18px;
}

.inbox-preview-counts {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.inbox-preview-counts span {
  padding: 10px;
  display: grid;
  gap: 2px;
  border-radius: 9px;
  background: #f5f4f8;
  color: var(--ink-500);
  font-size: 10px;
}

.inbox-preview-counts strong {
  color: var(--ink-900);
  font-size: 18px;
}

.inbox-preview-list {
  max-height: 390px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.inbox-preview-row {
  padding: 11px 12px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(140px, 220px) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.inbox-preview-row:last-child { border-bottom: 0; }
.inbox-preview-row:hover { background: #fafafd; }
.inbox-preview-row small { margin-top: 3px; display: block; color: var(--ink-500); }

.inbox-preview-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.inbox-preview-footer p { margin: 0; color: var(--ink-500); font-size: 11px; }

.project-communication-list {
  display: grid;
  gap: 9px;
}

.project-communication-item {
  padding: 11px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.project-communication-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--purple-700);
  background: var(--purple-50);
}

.project-communication-icon svg { width: 16px; height: 16px; }
.project-communication-heading strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.project-communication-heading time,
.project-communication-item small { color: var(--ink-500); font-size: 10px; }
.project-communication-item p { margin: 5px 0; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; white-space: pre-wrap; }

/* Project bewerken blijft boven het geopende project liggen. */
.project-edit-backdrop {
  position: fixed;
  z-index: 250;
  inset: 0 0 0 var(--sidebar-width);
  background: rgba(24, 22, 37, 0.34);
  animation: fade-in 160ms ease;
}

.project-edit-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: slide-in 220ms ease;
}

.project-edit-panel .drawer-form {
  height: 100%;
}

@media (max-width: 1180px) {
  .ticket-properties {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inbox-preview-counts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .planning-toolbar {
    grid-template-columns: auto 1fr auto;
  }

  .planning-user-filter {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .planning-layout {
    grid-template-columns: 1fr;
  }

  .project-pool {
    max-height: 290px;
  }

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

@media (max-width: 900px) {
  .ticket-workspace {
    grid-template-columns: 1fr;
  }

  .ticket-list {
    max-height: 380px;
  }

  .inbox-preview-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .inbox-preview-row > span:nth-child(3) {
    display: none;
  }

  .project-edit-backdrop {
    left: 0;
  }
}

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

  .ticket-properties-actions {
    grid-column: auto;
  }

  .ticket-detail-header,
  .inbox-preview-footer {
    align-items: stretch;
    flex-direction: column;
  }

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

  .inbox-preview-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .inbox-preview-row > span:last-child {
    grid-column: 2;
    justify-self: start;
  }

  .ticket-message--inbound,
  .ticket-message--outbound {
    margin-right: 0;
    margin-left: 0;
  }

  .planning-toolbar {
    grid-template-columns: 1fr;
  }

  .planning-view-switch,
  .planning-user-filter {
    width: 100%;
    justify-self: stretch;
  }

  .planning-view-switch .segmented-tab {
    flex: 1;
  }

  .planning-date-nav {
    flex-wrap: wrap;
  }

  .planning-date-nav strong {
    min-width: 180px;
  }

  .project-pool-list {
    grid-template-columns: 1fr;
  }

  .project-pool {
    max-height: 360px;
  }

  .planning-time-fields > div {
    align-items: stretch;
    flex-direction: column;
  }

  .automation-card {
    align-items: stretch;
    flex-direction: column;
  }

  .automation-actions {
    justify-content: flex-end;
  }
}
