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

:root {
  /* Primary palette */
  --color-primary: #163E64;
  --color-primary-hover: #0f2847;
  --color-on-primary: #fff;
  --focus-ring: 0 0 0 3px rgba(22, 62, 100, 0.2);

  /* Neutrals: background */
  --color-bg: #fff;
  --color-bg-subtle: #f8fafc;
  --color-bg-muted: #f1f5f9;
  --color-bg-sidebar: #F7F7F4;
  --color-bg-sidebar-hover: #EBEBE6;
  --color-bg-header: #F7F7F4;
  --color-bg-input-readonly: #f1f5f9;

  /* Neutrals: text */
  --color-text: #1a1a1a;
  --color-text-strong: #1e293b;
  --color-text-muted: #64748b;
  --color-text-muted-alt: #5a6c7d;
  --color-text-placeholder: #94a3b8;
  --color-text-muted-2: #475569;
  --color-bg-subtle-alt: #fafbfc;
  --color-bg-row-hover: #eef1f4;

  /* Neutrals: borders */
  --color-border: #dee2e6;
  --color-border-light: #e2e8f0;
  --color-border-lighter: #e5e7eb;
  --color-border-input: #cbd5e1;
  --color-border-divider: #f1f5f9;

  /* Semantic */
  --color-danger: #b91c1c;
  --color-danger-hover: #991b1b;
  --color-danger-border: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-success-bg: #d4edda;
  --color-success-text: #155724;

  /* Radius & shadow */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-dropdown: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --transition: 0.15s ease;

  /* Font scale: change --font-size-base-px to scale the UI. 1rem = this many px. */
  --font-size-base-px: 14;
  --font-size-input: calc(0.9 * var(--font-size-base-px) * 1px);
  --font-size-input-sm: calc(0.9 * var(--font-size-base-px) * 1px);
  --font-size-label: calc(0.9 * var(--font-size-base-px) * 1px);
}

html {
  font-size: calc(1px * var(--font-size-base-px));
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  margin: 0;
  height: 100vh;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

/* Login page */
body.login-page {
  height: auto;
  min-height: 100vh;
  overflow: auto;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-container { width: 100%; max-width: 24rem; }

.login-card {
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
}

.login-logo {
  display: block;
  text-align: center;
  margin-bottom: 2rem;
  line-height: 0;
}

.login-logo-img {
  max-width: 100%;
  max-height: 14rem;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form .form-actions {
  margin-top: 1.5rem;
  margin-bottom: 0;
}

.login-error {
  margin-bottom: 1rem;
}

.btn-block { width: 100%; justify-content: center; }

a {
  color: var(--color-primary);
}

a:hover {
  color: var(--color-primary-hover);
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 5.25rem;
  background: var(--color-bg-header) !important;
  color: var(--color-text);
  flex-shrink: 0;
  border-bottom: 1px solid var(--color-border);
}
.site-header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1600px;
  padding-right: 13.5rem;
}
@media (max-width: 75rem) {
  .site-header-inner {
    padding-right: 1.5rem;
  }
}

.header-customer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 12rem;
}
.header-customer-logo-img {
  height: 2.5rem;
  width: auto;
  max-width: 10rem;
  object-fit: contain;
  display: block;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.brand-logo {
  max-height: 4.75rem;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.header-version {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.header-version-tag {
  font-weight: 400;
  font-size: 0.6875rem;
  opacity: 0.65;
  margin-left: 0.25rem;
}

.header-spacer {
  flex: 1;
  min-width: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  flex-shrink: 0;
}

.header-logo .header-logo-img {
  height: 3rem;
  width: auto;
  object-fit: contain;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-header {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-header:hover {
  color: var(--color-text);
  background: var(--color-bg-sidebar-hover);
}

.user-menu-trigger.user-avatar {
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-initials {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--color-text);
}

/* Shared icon size (buttons, dropdowns) */
.btn .icon, .btn-header .icon, .btn-icon .icon, .user-dropdown-item .icon {
  width: 1.125rem;
  height: 1.125rem;
}
.user-dropdown-item .icon { color: var(--color-primary); }

.user-menu {
  position: relative;
}

.user-menu-trigger .icon-chevron {
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 11rem;
  padding: 0 0 0.375rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.user-dropdown-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 1rem;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  line-height: 0;
  transition: background var(--transition);
}

.user-dropdown-logo:hover {
  background: var(--color-bg-sidebar);
}

.user-dropdown-logo-img {
  height: 4rem;
  width: auto;
  object-fit: contain;
  display: block;
  padding: 15px;
  background: #fff;
  border-radius: var(--radius-sm);
}

.user-dropdown-role {
  text-align: center;
  padding: 0.375rem 1rem;
  font-size: 0.75rem;
  color: var(--color-text-muted, #6b7280);
  border-bottom: 1px solid var(--color-border);
}

.user-dropdown-logo + .user-dropdown-item,
.user-dropdown-role + .user-dropdown-item {
  margin-top: 0.375rem;
}

.user-menu:hover .user-dropdown {
  display: block;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background var(--transition);
}

.user-dropdown-item:hover {
  background: var(--color-bg-sidebar);
  color: var(--color-primary);
}

.user-dropdown-about {
  border-top: 1px solid var(--color-border);
  margin-top: 0.375rem;
  padding-top: 0.5rem;
}

/* App layout */
.app-layout-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  background: var(--color-bg-header);
}

.app-layout {
  display: flex;
  width: 100%;
  max-width: 1600px;
  min-height: 0;
}

/* Sidebar */
.sidebar {
  width: 12rem;
  flex-shrink: 0;
  min-height: 0;
  background: var(--color-bg-sidebar);
  padding: 4rem 0 1rem;
  display: flex;
  flex-direction: column;
}

/* Right sidebar: shrinks first when viewport narrows, then hides so main content keeps space */
.sidebar-right {
  flex: 0 1 12rem;
  min-width: 0;
  width: 12rem;
}

@media (max-width: 75rem) {
  .sidebar-right {
    display: none;
  }
  .main-content {
    flex: 1 1 0%;
  }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-top: 1.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.sidebar-nav-heading {
  display: block;
  font-size: 0;
  line-height: 0;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
}

.sidebar-admin .sidebar-nav-heading {
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
  height: auto;
  padding: 0;
  margin: 1.25rem 1.25rem 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-top: none;
  overflow: visible;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  margin: 0 0.5rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--color-bg-sidebar-hover);
  color: var(--color-primary);
}

.nav-link.is-active {
  background: var(--color-bg-sidebar-hover);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-link .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-primary);
}

.sidebar-company-wrap {
  flex-shrink: 0;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
}

.sidebar-company-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-company-label {
  font-size: 0.6875rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.sidebar-company-select {
  width: 100%;
  padding: 0.5rem 0.625rem;
  font-size: var(--font-size-input-sm);
  font-weight: 400;
  color: var(--color-primary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.75rem;
}

.sidebar-company-select:hover {
  border-color: var(--color-primary);
}

.sidebar-company-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(22, 62, 100, 0.25);
}

/* Sidebar collapsed (company detail page) */
.app-layout.sidebar-collapsed .sidebar {
  width: 4.5rem;
  padding: 1rem 0;
}

.app-layout.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
  padding: 0.625rem;
  margin: 0 0.375rem;
}

.app-layout.sidebar-collapsed .sidebar .nav-link-text {
  display: none;
}

.app-layout.sidebar-collapsed .sidebar-nav-heading {
  margin: 0;
}

.app-layout.sidebar-collapsed .sidebar-company-wrap {
  display: none;
}

/* Main content: grows to fill space, does not shrink until right sidebar is gone */
.main-content {
  flex: 1 0 0%;
  min-width: 0;
  min-height: 0;
  padding: 1.5rem;
  background: var(--color-bg-header);
  overflow: auto;
  border-radius: var(--radius-lg);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.main-content::-webkit-scrollbar {
  display: none;
}

.super-admin-page .main-content {
  padding-top: 4rem;
}

.main-content table,
.main-content table th,
.main-content table td {
  background: var(--color-bg);
}

.main-content table thead th {
  background: var(--color-bg-header);
  border: none;
  border-bottom: none;
}

.main-content table tbody tr:hover td {
  background: var(--color-bg-header);
}

/* Site footer */
.site-footer {
  flex-shrink: 0;
  background: var(--color-bg-header);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  padding: 0.75rem 2rem;
}

.main-content h1 {
  display: none;
}

/* Profile page */
.profile-page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.profile-page-col {
  display: flex;
  flex-direction: column;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.profile-avatar {
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: 50%;
  flex-shrink: 0;
}

.profile-avatar .avatar-icon {
  width: 1.75rem;
  height: 1.75rem;
}

.profile-full-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.15rem 0;
}

.profile-email {
  margin: 0;
  color: var(--color-text-muted-alt);
  font-size: 0.875rem;
}

.profile-status--active {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
}

.profile-recontact-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--color-danger, #dc2626);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.profile-recontact-overdue td {
  background: #fef2f2;
}
.profile-recontact-overdue td:first-child {
  font-weight: 600;
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Tighter top spacing on company detail page so Identification & AI assessment start higher */
.main-content:has(.company-form-layout-detail) .page-header,
.main-content:has(.company-page-wrapper--detail) .page-header {
  margin-bottom: 0.75rem;
}

.page-header h1 {
  margin: 0;
}

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

/* About Deal Atlas page */
.about-deal-atlas {
  max-width: 42rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--color-text);
}

.about-deal-atlas-logo {
  margin-bottom: 1.5rem;
  line-height: 0;
}

.about-deal-atlas-logo img {
  max-width: 18rem;
  height: auto;
  display: block;
}

.about-deal-atlas p {
  margin: 0 0 1.25rem;
}

.about-deal-atlas p:last-child {
  margin-bottom: 0;
}

.main-content:has(.about-deal-atlas) .page-header h1 {
  display: block;
}

/* Dashboard blocks (index) */
.dashboard-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr));
  gap: 1.5rem;
}

.dashboard-block {
  background: var(--color-bg);
  border: 1px solid var(--color-border-lighter);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dashboard-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border-lighter);
  flex-wrap: nowrap;
}

.dashboard-block-header .btn {
  flex-shrink: 0;
}

.dashboard-block-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-block-title .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-text-muted);
}

.dashboard-block-content {
  padding: 1rem 1.25rem;
  flex: 1;
}

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

.dashboard-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border-divider);
}

.dashboard-list li:last-child {
  border-bottom: 0;
}

.dashboard-empty {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.dashboard-block-footer {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}

.dashboard-block-footer:hover {
  text-decoration: underline;
}

/* Personal dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 4.0rem;
  align-items: start;
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: calc(0.5rem - 3px) 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted-alt);
  background: var(--color-bg-header);
  border-bottom: 1px solid var(--color-border);
}

.dashboard-card .admin-table {
  background: #fff;
}

.dashboard-card .admin-table thead th {
  background: var(--color-bg-header);
  border: none;
  border-bottom: 1px solid var(--color-border);
  padding: calc(0.5rem - 3px) 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted-alt);
}

.dashboard-card .admin-table tbody td {
  background: #fff;
  padding: calc(0.35rem - 2px) 0.75rem;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: 1px solid var(--color-border);
}

.dashboard-card .admin-table tbody tr:last-child td {
  border-bottom: none;
}

.dashboard-card .admin-table tbody tr:hover td {
  background: var(--color-bg-header);
}

/* Admin section */
.admin-section {
  margin-bottom: 2rem;
}

.admin-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.admin-link-list li {
  margin-bottom: 0.5rem;
}
.admin-link-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
}
.admin-link-list .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.form-inline .search-input,
.form-inline input[type="text"] {
  min-width: 12rem;
}
.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.inline-form select {
  font-family: inherit;
  font-size: 0.8125rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  height: 1.75rem;
  cursor: pointer;
}

.inline-form select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.inline-form .btn-sm {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  height: 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-sidebar);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.12s;
}

.inline-form .btn-sm:hover {
  background: var(--color-bg-sidebar-hover);
}
.text-muted { color: var(--color-text-muted); font-size: 0.875rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: calc(0.5rem - 1px) calc(1rem - 1px);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font: inherit;
  transition: background var(--transition), color var(--transition);
}

.btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-primary-hover); color: var(--color-on-primary); }
.btn-secondary { background: var(--color-bg-sidebar); color: var(--color-text); }
.btn-secondary:hover { background: var(--color-bg-sidebar-hover); color: var(--color-text); }
.btn-outline { background: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-outline:hover { background: var(--color-bg-sidebar); color: var(--color-text); }
.btn-danger { background: var(--color-danger); color: var(--color-on-primary); }
.btn-danger:hover { background: var(--color-danger-hover); color: var(--color-on-primary); }
.btn-outline-danger { background: transparent; color: var(--color-danger); border: 1px solid var(--color-danger); }
.btn-outline-danger:hover { background: var(--color-danger); color: var(--color-on-primary); }
.btn-small { padding: calc(0.35rem - 1px) calc(0.6rem - 1px); font-size: 0.75rem; }

.btn-small .icon {
  width: 0.9375rem;
  height: 0.9375rem;
}

.btn-outline {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-outline:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.search-action-btns {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.excluded-row {
  opacity: 0.5;
}

.excluded-label {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.excluded-label--confirmed {
  background: var(--color-success-bg, #d1fae5);
  color: var(--color-success, #059669);
}
.excluded-label--irrelevant {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}

.toggle-excluded-link {
  display: inline-block;
  margin-top: 0.5rem;
  cursor: pointer;
  text-decoration: underline;
}

/* Forms */
.form-error {
  padding: 0.875rem 1rem;
  margin-bottom: 1.25rem;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  border-left: 4px solid var(--color-danger-border);
}

.form-group { margin-bottom: 1.25rem; position: relative; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-strong);
  line-height: 1.35;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-input);
  line-height: 1.4;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:hover,
.form-group select:hover {
  border-color: var(--color-text-placeholder);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.form-group textarea {
  min-height: 4rem;
  font-family: inherit;
  resize: vertical;
}

.form-group textarea:hover {
  border-color: var(--color-text-placeholder);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
}

.form-group-inline .checkbox-label {
  margin-right: 1rem;
}

.form-group-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.autocomplete-input { width: 100%; max-width: 28rem; }

.autocomplete-results {
  position: absolute;
  z-index: 100;
  margin-top: 2px;
  max-height: 12rem;
  overflow-y: auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  min-width: 16rem;
}

.company-autocomplete-wrap {
  position: relative;
  max-width: 28rem;
}
.company-autocomplete-wrap .company-search-input {
  width: 100%;
}

/* Create transaction: grey out Deal status and other fields until company selected */
.deal-overview-after-company.is-locked {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.deal-overview-after-company.is-locked .deal-company-row {
  opacity: 1;
  pointer-events: auto;
}
.deal-overview-after-company.is-locked input:not([type="hidden"]),
.deal-overview-after-company.is-locked select,
.deal-overview-after-company.is-locked textarea {
  cursor: not-allowed;
}
.deal-overview-after-company.is-locked .deal-company-row input {
  cursor: text;
}
.company-select-hint {
  margin-top: 0.35rem;
  margin-bottom: 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}
.autocomplete-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border: none;
  background: none;
  font-size: var(--font-size-input);
  cursor: pointer;
  color: var(--color-text-strong);
}

.autocomplete-item:hover {
  background: var(--color-bg-muted);
}
.autocomplete-empty {
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-input);
  color: var(--color-text-muted);
}

.form-input-readonly {
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-light);
}

.form-actions .btn {
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
}

.admin-form {
  max-width: 42rem;
}

.form-section-title {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  padding: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-strong);
  border-bottom: 1px solid var(--color-border-light);
}

.form-section-title:first-of-type {
  margin-top: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1rem;
}

.form-row-2 { grid-template-columns: repeat(2, 1fr); }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 52rem) {
  .form-row-2,
  .form-row-3,
  .form-row-4 {
    grid-template-columns: 1fr;
  }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-box {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 28rem;
  width: 100%;
  padding: 1.5rem;
}

.modal-box h2 { margin: 0 0 0.75rem; font-size: 1.25rem; }

.modal-box .form-group {
  margin-bottom: 1rem;
}

.modal-box .form-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal-box--wide {
  max-width: 56rem;
}

/* Company picker modal */
.company-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.company-picker-header h2 { margin: 0; font-size: 1.25rem; }
.company-picker-header .btn-icon { color: var(--color-text-muted); }
.company-picker-table-wrap {
  max-height: 24rem;
  overflow-y: auto;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}
.company-picker-table-wrap .admin-table { background: var(--color-bg); }
.company-picker-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-bg);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted-alt);
  border-bottom: 1px solid var(--color-border);
}
.company-picker-row { cursor: pointer; }
.company-picker-row td {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border-light);
}
.company-picker-row:hover td { background: var(--color-bg-row-hover); }

/* Admin section (status blocks, etc.) */
.admin-section-title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.admin-section-desc {
  margin: 0 0 1rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.admin-table-status .admin-table-customer {
  font-weight: 500;
  white-space: nowrap;
  width: 1%;
}

.admin-table-status-cell {
  padding: 0.5rem 0.75rem !important;
}

.status-blocks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.status-block {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 2rem 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-on-primary);
  min-height: 2rem;
}

.status-block--0 { background: #2563eb; }
.status-block--1 { background: #059669; }
.status-block--2 { background: #7c3aed; }
.status-block--3 { background: #dc2626; }
.status-block--4 { background: #ea580c; }
.status-block--5 { background: #0891b2; }
.status-block--6 { background: #4f46e5; }
.status-block--7 { background: #0d9488; }

.status-block-label {
  margin-right: 0.25rem;
}

.status-block-delete {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  color: var(--color-on-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.status-block-delete:hover {
  background: rgba(0, 0, 0, 0.45);
}

.status-block-delete .icon {
  width: 0.75rem;
  height: 0.75rem;
}

.status-block-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px dashed var(--color-border-input);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.status-block-add:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.status-block-add .icon {
  width: 1rem;
  height: 1rem;
}

.modal-customer-name,
.delete-confirm-name {
  margin: 0 0 1rem;
  font-weight: 500;
  color: var(--color-text-muted-2);
}

/* Admin table */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

.main-content .admin-table-wrap {
  background: var(--color-bg-header);
}

.main-content .admin-table-wrap .admin-table {
  background: transparent;
}

.main-content .admin-table-wrap thead th {
  background: var(--color-bg-header);
  border: none;
  border-bottom: none;
}

.main-content .admin-table-wrap thead tr:last-child th {
  padding-bottom: 0.75rem;
}

.main-content .admin-table-wrap tbody tr:nth-child(3) td {
  border-top: 1px solid var(--color-border);
}

.main-content .admin-table-wrap tbody tr:nth-child(n+3) td:first-child {
  border-left: 1px solid var(--color-border);
}

.main-content .admin-table-wrap tbody tr:nth-child(n+3) td:last-child {
  border-right: 1px solid var(--color-border);
}

.main-content .admin-table-wrap tbody tr:last-child td {
  border-bottom: 1px solid var(--color-border);
}

.main-content .admin-table-wrap tbody tr:nth-child(3) td:first-child {
  border-top-left-radius: var(--radius-lg);
}

.main-content .admin-table-wrap tbody tr:nth-child(3) td:last-child {
  border-top-right-radius: var(--radius-lg);
}

.main-content .admin-table-wrap tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius-lg);
}

.main-content .admin-table-wrap tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-lg);
}

.toggle-col-overview,
.toggle-col-detail {
  width: 2.4rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--color-primary);
}

/* List card: shared table-in-card style for companies / pipeline / persons */
.main-content .list-card {
  background: #fff;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.main-content .list-card .admin-table {
  background: #fff;
}

.main-content .list-card thead th {
  background: var(--color-bg-header);
  border: none;
  border-bottom: 1px solid var(--color-border);
}

.main-content .list-card thead tr:last-child th {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: calc(0.5rem - 3px);
}

/* List pages: shared toolbar + wrapper layout */
.list-wrapper {
  display: flex;
  flex-direction: column;
}

/* Align table top with sidebar nav: sidebar starts at 2.5rem, main padding is 1.5rem → 1rem offset */
.list-wrapper .admin-table-wrap {
  margin-top: 1rem;
}

.list-toolbar {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: nowrap;
  min-height: 2.25rem;
}

.list-toolbar .btn-small,
.list-toolbar .search-input {
  height: 2.25rem;
  min-height: 2.25rem;
  max-height: 2.25rem;
  box-sizing: border-box;
  margin: 0;
  vertical-align: middle;
}

.list-toolbar .btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.6rem;
  flex-shrink: 0;
}

.list-toolbar .search-input {
  width: 20rem;
  min-width: 14rem;
  max-width: none;
  min-height: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem;
  font-size: 0.875rem;
  line-height: 1.25;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  flex-shrink: 0;
}

.list-toolbar .search-input::placeholder {
  color: var(--color-text-muted);
}

/* Pipeline card: overrides for no box-shadow, rounded corners, no inner th border */
.main-content .admin-table-wrap--pipeline.list-card {
  box-shadow: none;
  border-radius: var(--radius-md);
}

.main-content .admin-table-wrap--pipeline thead th {
  border-bottom: none;
}

.main-content .admin-table-wrap--pipeline .admin-table-column-headers th {
  padding: calc(0.5rem - 3px) 0.75rem;
  font-size: 0.875rem;
}
.main-content .admin-table-wrap--pipeline .admin-table-column-headers th.pipeline-week-th {
  font-size: 0.625rem;
}

.main-content .admin-table-wrap--pipeline tbody td {
  background: #fff;
  padding: calc(0.35rem - 2px) 0.75rem;
}

.main-content .admin-table-wrap--pipeline tbody tr:hover td {
  background: var(--color-bg-header);
}

.companies-card-header {
  display: flex;
  align-items: center;
  padding: calc(0.5rem - 3px) 0.75rem;
  background: var(--color-bg-header);
  border-bottom: 1px solid var(--color-border);
}

.companies-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.companies-toolbar-actions .search-input {
  width: 20rem;
  min-width: 14rem;
  max-width: none;
  height: 2rem;
  min-height: 2rem;
  padding: 0 0.6rem;
  font-size: 0.875rem;
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.companies-toolbar-actions .search-input::placeholder {
  color: var(--color-text-muted);
}

.admin-table-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted-alt);
}

.main-content .admin-table-wrap--companies .admin-table-column-headers th {
  padding: calc(0.5rem - 3px) 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted-alt);
  background: var(--color-bg-header);
}

.main-content .admin-table-wrap--companies tbody td {
  background: #fff;
  padding: calc(0.35rem - 2px) 0.75rem;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: 1px solid var(--color-border);
}

.main-content .admin-table-wrap--companies tbody tr:last-child td {
  border-bottom: none;
}

.main-content .admin-table-wrap--companies tbody tr:first-child td {
  border-top: none;
}

.main-content .admin-table-wrap--companies tbody tr td:first-child,
.main-content .admin-table-wrap--companies tbody tr td:last-child {
  border-left: none;
  border-right: none;
}

.main-content .admin-table-wrap--companies tbody tr:hover td {
  background: var(--color-bg-header);
}

/* Companies list: fixed layout for single-line rows & resizable columns */
.admin-table-wrap--companies .admin-table {
  table-layout: fixed;
}

.admin-table-wrap--companies .th-filterable {
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1.8rem;
}

.admin-table-wrap--companies .col-filter-btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-bg-header);
}

.admin-table-wrap--companies .admin-table tbody td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-table-wrap--companies .admin-table tbody td > a,
.admin-table-wrap--companies .admin-table tbody td > .company-cell-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-table-wrap--companies .admin-table tbody td.company-add-actions-cell {
  overflow: visible;
  white-space: normal;
}

/* Column resize handle */
.col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 10;
  user-select: none;
}

.col-resize-handle:hover {
  background: var(--color-primary);
  opacity: 0.3;
}

body.col-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

body.col-resizing .col-resize-handle {
  background: var(--color-primary);
  opacity: 0.3;
}

/* Persons table */

.main-content .admin-table-wrap--persons .admin-table-column-headers th {
  padding: calc(0.5rem - 3px) 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted-alt);
  background: var(--color-bg-header);
}

.main-content .admin-table-wrap--persons tbody td {
  background: #fff;
  padding: calc(0.35rem - 2px) 0.75rem;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: 1px solid var(--color-border);
}

.main-content .admin-table-wrap--persons tbody tr:last-child td {
  border-bottom: none;
}

.main-content .admin-table-wrap--persons tbody tr:first-child td {
  border-top: none;
}

.main-content .admin-table-wrap--persons tbody tr td:first-child,
.main-content .admin-table-wrap--persons tbody tr td:last-child {
  border-left: none;
  border-right: none;
}

.main-content .admin-table-wrap--persons tbody tr:hover td {
  background: var(--color-bg-header);
}

.sessions-chart-wrap {
  margin-bottom: 1.5rem;
  padding: 1rem;
  min-height: 200px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
  padding: calc(0.5rem - 3px) 0.75rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
}

.admin-table th {
  background: var(--color-bg-header);
  font-weight: 600;
  color: var(--color-text-muted-alt);
}

.th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.th-sortable:hover {
  color: var(--color-text-strong);
}

.th-sort-icon {
  width: 0.875rem;
  height: 0.875rem;
  margin-left: 0.25rem;
  opacity: 0.7;
  vertical-align: middle;
}

/* Column filter dropdowns */
.th-filterable {
  position: relative;
  white-space: nowrap;
}

.col-filter-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 0.2rem;
  padding: 0.1rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: color 0.15s;
}
.col-filter-btn:hover {
  color: var(--color-primary);
}
.col-filter-btn .th-filter-icon {
  width: 0.8rem;
  height: 0.8rem;
}
.col-filter-btn.col-filter-active {
  color: var(--color-primary);
}
.col-filter-btn.col-filter-active .th-filter-icon {
  fill: var(--color-primary);
  opacity: 0.3;
}

.admin-table-wrap--companies {
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;          /* Firefox */
}
.admin-table-wrap--companies::-webkit-scrollbar {
  display: none;                  /* Chrome / Safari / Edge */
}
.main-content .list-card.admin-table-wrap--companies {
  overflow-x: auto;
  overflow-y: visible;
}

/* Persons list: mirror companies table styling */
.main-content .admin-table-wrap--persons .admin-table-column-headers th {
  padding: calc(0.5rem - 3px) 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--color-bg-header);
}
.main-content .admin-table-wrap--persons tbody td {
  background: #fff;
  padding: calc(0.35rem - 2px) 0.75rem;
  border-top: none;
  border-bottom: 1px solid var(--color-border);
}
.main-content .admin-table-wrap--persons tbody tr:last-child td { border-bottom: none; }
.main-content .admin-table-wrap--persons tbody tr:first-child td { border-top: none; }
.main-content .admin-table-wrap--persons tbody tr td:first-child,
.main-content .admin-table-wrap--persons tbody tr td:last-child { border-left: none; border-right: none; }
.main-content .admin-table-wrap--persons tbody tr:hover td { background: var(--color-bg-header); }
.admin-table-wrap--persons .admin-table { table-layout: fixed; }
.admin-table-wrap--persons .th-filterable { overflow: hidden; text-overflow: ellipsis; padding-right: 1.8rem; }
.admin-table-wrap--persons .col-filter-btn { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); background: var(--color-bg-header); }
.admin-table-wrap--persons .admin-table tbody td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-table-wrap--persons .admin-table tbody td > a,
.admin-table-wrap--persons .admin-table tbody td > .person-cell-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table-wrap--persons { overflow-x: auto; overflow-y: visible; scrollbar-width: none; }
.admin-table-wrap--persons::-webkit-scrollbar { display: none; }
.main-content .list-card.admin-table-wrap--persons { overflow-x: auto; overflow-y: visible; }

/* Sticky horizontal scrollbar proxy for wide company tables */
.companies-scroll-proxy {
  position: sticky;
  bottom: 0;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 2;
  background: var(--color-bg);
}
.companies-scroll-proxy-inner {
  height: 1px;
}

.col-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 13rem;
  max-width: 22rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem 0;
  margin-top: 0.25rem;
}

.col-filter-select-all {
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: 0.15rem;
  margin-bottom: 0.15rem;
}

.col-filter-search-wrap {
  padding: 0.35rem 0.5rem;
}
.col-filter-search {
  width: 100%;
  padding: 0.3rem 0.5rem;
  font-size: 0.8125rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
}
.col-filter-search:focus {
  border-color: var(--color-primary);
}

.col-filter-list {
  max-height: 14rem;
  overflow-y: auto;
  padding: 0 0.25rem;
}

.col-filter-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.8125rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  line-height: 1.3;
}
.col-filter-option:hover {
  background: var(--color-bg-hover);
}
.col-filter-option input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0;
}
.col-filter-option-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
  font-weight: 400;
}
.col-filter-option-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.col-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.4rem 0.5rem 0.25rem;
  border-top: 1px solid var(--color-border-light);
  margin-top: 0.25rem;
}
.col-filter-apply {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
}

.col-filter-sort-section {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--color-border-light);
  gap: 0.125rem;
}
.col-filter-sort-btn {
  all: unset;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.col-filter-sort-btn:hover {
  background: var(--color-bg-row-hover);
}
.col-filter-sort-btn--active {
  color: var(--color-primary);
  font-weight: 600;
  background: rgba(22, 62, 100, 0.06);
}
.col-filter-sort-btn .sort-arrow {
  font-size: 0.625rem;
  width: 0.75rem;
  text-align: center;
}
.sort-indicator {
  font-size: 0.625rem;
  color: var(--color-primary);
  margin-left: 0.15rem;
}

.admin-table-toolbar th {
  padding: 0.75rem 1rem 1.25rem;
  background: var(--color-bg-header);
  font-weight: 400;
  vertical-align: middle;
}

.admin-table-toolbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-table-toolbar-content .search-input {
  flex: 1;
  min-width: 12rem;
  max-width: 24rem;
}

.admin-table-toolbar-content--left {
  justify-content: flex-start;
  gap: 0.75rem;
  align-items: center;
}

.admin-table-toolbar-content--left .btn-small,
.admin-table-toolbar-content--left .search-input {
  height: 2rem;
  min-height: 2rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}

.admin-table-toolbar-content--left .btn-small {
  padding: 0 0.6rem;
}

.admin-table-toolbar-content--left .search-input {
  flex: none;
  width: 20rem;
  min-width: 14rem;
  max-width: none;
  height: 2.25rem;
  min-height: 2.25rem;
  padding: 0 0.6rem;
  font-size: 0.75rem;
  line-height: 1;
  margin-bottom: 0;
  background-color: #EBEBE6;
  border-color: var(--color-border-divider);
}

.admin-table-toolbar-content--left .search-input::placeholder {
  color: var(--color-text-muted);
}

.admin-table-toolbar-content .form-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-table-toolbar-content .form-inline .search-input {
  min-width: 10rem;
  flex: none;
}

.admin-table tbody tr:hover {
  background: var(--color-bg-header);
}

.admin-table tbody tr:hover td {
  background: var(--color-bg-header);
}

.admin-table-actions, .admin-table-colors { white-space: nowrap; }

/* Pipeline list: week columns (status-at-week blocks) */
.pipeline-row-clickable {
  cursor: pointer;
}
.pipeline-row-clickable:hover {
  background: var(--color-bg-header);
}
.pipeline-deal-name-link,
.company-cell-link,
.person-cell-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
.company-cell-link:hover,
.person-cell-link:hover {
  color: inherit;
  text-decoration: none;
}

.pipeline-deal-name-link:hover {
  text-decoration: underline;
}
.pipeline-next-action-td {
  white-space: nowrap;
}
.pipeline-week-th {
  width: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  padding: 0.2rem 1px;
  text-align: center;
  font-weight: 600;
  font-size: 0.5rem;
  color: var(--color-text-muted);
}
.pipeline-week-th--current {
  color: var(--color-text, #111);
  font-weight: 700;
}
#pipeline-table td.pipeline-week-td--current .pipeline-week-cell {
  outline: 2px solid var(--color-text-muted, #64748b);
  outline-offset: -2px;
}
/* Override admin-table td padding so week bars fill the cell */
#pipeline-table td.pipeline-week-td {
  padding: 0;
  width: 16px;
  min-width: 16px;
  max-width: 16px;
  text-align: center;
  vertical-align: middle;
}
#pipeline-table .pipeline-week-cell {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 1.25rem;
  border-radius: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
}
.pipeline-week-cell--before-creation,
.pipeline-week-cell--before-first-status {
  background: transparent !important;
}

.color-swatch {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.12);
  vertical-align: middle;
  margin-right: 0.35rem;
}

.color-swatch:last-child { margin-right: 0; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-icon:hover {
  background: var(--color-bg-muted);
  color: var(--color-primary);
}
.btn-icon--danger {
  color: var(--color-danger, #dc2626);
}
.btn-icon--danger:hover {
  background: var(--color-danger-bg, #fee2e2);
  color: var(--color-danger, #dc2626);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--color-border-light);
  color: var(--color-text-muted-2);
}

.test-log-message { font-size: 0.8125rem; word-break: break-word; }

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
}

.role-badge::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.role-badge--super-admin { background: #fef3c7; color: #92400e; }
.role-badge--admin { background: #dbeafe; color: #1e40af; }
.role-badge--contributor { background: #d1fae5; color: #065f46; }
.role-badge--viewer { background: var(--color-border-light); color: var(--color-text-muted-2); }
.role-badge--deleted { background: #fee2e2; color: #991b1b; }

/* Deleted-users toggle */
.deleted-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.deleted-toggle-label input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Soft-deleted user row */
.user-row--deleted {
  background: #fef2f2;
}
.user-row--deleted td {
  color: var(--color-text-muted) !important;
  opacity: 0.75;
}
.user-row--deleted .user-deleted-actions {
  opacity: 1;
}

/* Action button sizes */
.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  border: none;
  font-weight: 500;
  line-height: 1.4;
}
.btn-xs .icon { width: 0.75rem; height: 0.75rem; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }

.user-deleted-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.user-deleted-actions .inline-form { display: inline; }

/* Customer/company tags on edit user */
.customer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.customer-tag-wrap {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
}

.customer-tag-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  margin: 0;
  padding: 0;
  line-height: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-text-muted);
  color: var(--color-on-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.customer-tag-remove:hover {
  background: var(--color-danger-border);
}

.customer-tag-remove .icon {
  width: 0.75rem;
  height: 0.75rem;
}

.customer-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  margin: 0.1rem 0.2rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  background: #dbeafe;
  color: #1e40af;
  white-space: nowrap;
}

.customer-multi-select {
  min-height: 8rem;
  padding: 0.35rem;
}

.form-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Tag picker (autocomplete multi-select) */
.tag-picker {
  position: relative;
  width: 100%;
}

.tag-picker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.tag-picker-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--color-primary);
  color: #fff;
  line-height: 1.3;
}

.tag-picker-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0 -0.15rem 0 0.1rem;
  transition: color 0.15s;
}

.tag-picker-remove:hover {
  color: #fff;
}

.tag-picker-input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.tag-picker-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb, 37, 99, 235), 0.12);
}

.tag-picker-dropdown {
  position: absolute;
  z-index: 100;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.1));
  margin-top: 2px;
}

.company-detail-section.tag-picker-open {
  overflow: visible;
}

.tag-picker-option {
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.12s;
}

.tag-picker-option:hover {
  background: var(--color-bg-hover, #f3f4f6);
}

.tag-picker-code {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.admin-table-empty {
  color: var(--color-text-muted-alt);
  font-style: italic;
}

.admin-table-empty a {
  font-style: normal;
}

/* Admin tables inside card sections: softer borders, consistent fonts */
.company-detail-section .admin-table {
  border-collapse: collapse;
  font-size: 0.875rem;
}

.company-detail-section .admin-table th,
.company-detail-section .admin-table td {
  border-bottom: 1px solid var(--color-border-light, #e5e7eb);
  padding: calc(0.45rem - 1px) 0.75rem;
}

.company-detail-section .admin-table th {
  background: var(--color-bg-header);
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.company-detail-section .admin-table tr:last-child td {
  border-bottom: none;
}

.company-detail-section .admin-table tbody tr:hover td {
  background: var(--color-bg-hover, #f9fafb);
}

.company-detail-section .admin-table .admin-table-actions {
  text-align: right;
}

.drag-handle {
  color: var(--color-text-muted);
  opacity: 0.4;
  cursor: grab;
  transition: opacity 0.12s;
}

.drag-handle:hover {
  opacity: 0.8;
}

tr.drag-over {
  opacity: 0.5;
}

/* Companies list: inline add row */
.company-add-row td {
  vertical-align: middle;
}

.company-inline-input {
  width: 100%;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.company-add-actions-cell {
  white-space: nowrap;
}

.company-add-actions-cell .company-inline-input {
  max-width: 12rem;
  display: inline-block;
  margin-right: 0.5rem;
}

.company-add-actions-cell .company-inline-error {
  display: block;
  font-size: 0.75rem;
  color: var(--color-danger);
  margin-top: 0.25rem;
}

.company-add-actions-cell .btn {
  margin-left: 0.25rem;
}

.search-input {
  width: 100%;
  max-width: 20rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-input);
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

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

/* AI assessment (company edit) */
.form-actions .ai-assess-spinner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.form-actions .ai-assess-spinner .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.icon-spin {
  animation: ai-spin 1s linear infinite;
}

@keyframes ai-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Company form layout */
.company-form-layout {
  width: 100%;
}

.company-form-layout-two-col {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  align-items: stretch;
}

.company-form-layout-two-col .company-form-col {
  min-width: 0;
  align-self: start;
}

.company-form-layout-two-col .ai-assessment-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.company-form-layout-two-col .admin-form {
  max-width: none;
}

.company-page-wrapper--detail {
  background: var(--color-bg-header);
  padding: 0.5rem 1rem 1rem;
  border-radius: var(--radius-lg);
}

.company-overview-grid--three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
}

.company-overview-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.company-overview-col .company-detail-section-activities,
.company-overview-col .company-detail-section-ai {
  flex: 1;
}

.company-page-wrapper #panel-contact-address .company-detail-section-contact {
  max-width: 500px;
}

.company-form-layout .form-actions,
.company-page-wrapper .form-actions {
  margin-top: 1rem;
  padding-top: 0;
  border-top: none;
}

/* Company detail section card (Identification / AI assessment) – white rounded box, same as companies table */
.company-detail-section {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.company-detail-section-next-action .company-detail-section-body {
  padding: 0;
}
.company-detail-next-action-input {
  width: 100%;
  min-height: 4rem;
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-size: 0.875rem;
  border: 1px solid var(--color-border-light, #e5e7eb);
  border-radius: var(--radius-sm, 4px);
  resize: vertical;
  line-height: 1.5;
}
.company-detail-next-action-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.company-detail-section-header {
  background: var(--color-bg-header);
  padding: calc(0.5rem - 3px) 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted-alt);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input--section {
  margin-left: auto;
  width: 16rem;
  min-width: 10rem;
  height: 1.75rem;
  min-height: 1.75rem;
  max-height: 1.75rem;
  font-size: 0.8125rem;
  padding: 0 0.5rem;
  box-sizing: border-box;
}

.company-detail-section-header--with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: calc(0.5rem - 3px) 0.75rem;
}

.company-detail-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted-alt);
}

.company-detail-section-body {
  background: #fff;
  padding: 0;
}

/* Identification table: 2 columns (Field name | Field input), same font/padding as companies table */
.company-detail-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.company-detail-table td {
  padding: calc(0.35rem - 2px) 0.75rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}

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

.company-detail-table-label {
  font-weight: 400;
  color: var(--color-text);
  width: 12rem;
  max-width: 40%;
}
.deal-company-value-wrap {
  display: flex;
  align-items: center;
  min-height: 1.625rem;
  padding: 2px 0.5rem;
  font-size: 0.875rem;
  font-weight: 400;
}
.deal-company-name-value {
  flex: 1 1 auto;
}
.deal-company-link {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-text-muted);
}
.deal-company-link .icon {
  width: 0.75rem;
  height: 0.75rem;
}
.deal-company-link:hover {
  color: var(--color-primary);
}


.company-detail-table-input input,
.company-detail-table-input select,
.company-detail-table-input textarea {
  width: 100%;
  max-width: 100%;
  min-height: 1.625rem;
  padding: 2px 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4;
  border: none;
  border-radius: var(--radius-sm);
  background: #fff;
  box-sizing: border-box;
}

.company-detail-table-input textarea {
  min-height: 4rem;
  resize: vertical;
}

.company-detail-table-input input:focus,
.company-detail-table-input select:focus,
.company-detail-table-input textarea:focus {
  outline: none;
  border: none;
  box-shadow: 0 0 0 1px var(--color-primary);
}

.company-detail-table-input input.form-input-readonly {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  cursor: default;
}

.company-detail-table-input .checkbox-label {
  font-weight: 400;
  font-size: 0.875rem;
}

.company-detail-table--readonly .company-detail-table-value {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-text);
  vertical-align: top;
}

.company-detail-table--readonly .company-detail-table-value a {
  color: var(--color-primary);
}

.company-detail-table--compact td {
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

/* Sources & Uses summary on Deal Overview */
.su-summary-table .su-summary-group-header td {
  padding-top: 0.5rem;
  padding-bottom: 0.15rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted, #64748b);
  border-bottom: none;
}
.su-summary-table .su-summary-delta td {
  font-style: italic;
  color: #dc2626;
}
.su-summary-table .su-summary-subtotal td {
  border-top: 1px solid var(--color-border-light, #e2e8f0);
  font-weight: 600;
  padding-top: 0.3rem;
}

.company-detail-section--readonly .company-detail-section-header .btn-small {
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
}

.company-detail-website-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.company-detail-website-wrap input {
  flex: 1;
  min-width: 0;
}

.company-detail-website-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
  line-height: 0;
}

.company-detail-website-link:hover {
  color: var(--color-primary);
  opacity: 0.85;
}

.company-detail-website-link .icon {
  width: 0.75rem;
  height: 0.75rem;
}

.company-detail-section-body--ai {
  background: #fff;
  padding: 0.75rem 1rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.company-detail-section-body--ai::-webkit-scrollbar {
  display: none;
}

.company-detail-section-body--ai .ai-assessment-empty,
.company-detail-section-body--ai .ai-assessment-content {
  margin: 0;
}

.company-detail-section-body--ai .ai-assessment-content {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.company-detail-section-body--ai .ai-assessment-meta,
.company-detail-section-body--ai .ai-assessment-body {
  font-size: 0.875rem;
  margin: 0;
}

.company-detail-section-body--ai .ai-assessment-body {
  white-space: pre-wrap;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-strong);
}

.company-detail-section-activities .admin-table { margin: 0; }
.company-detail-section-activities .admin-table th,
.company-detail-section-activities .admin-table td { font-size: 0.82rem; padding: 0.3rem 0.6rem; }
.company-detail-section-activities .admin-table-actions { width: 4rem; text-align: center; white-space: nowrap; }
.company-detail-section-activities .admin-table-empty { text-align: center; color: var(--text-muted); padding: 1rem !important; }

.activity-view-table {
  width: 100%;
  border-collapse: collapse;
}
.activity-view-table th {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 1rem 0.4rem 0;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  width: 10rem;
  font-size: 0.875rem;
}
.activity-view-table td {
  padding: 0.4rem 0;
  font-size: 0.875rem;
}
.activity-view-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-assessment-col .company-detail-section-ai,
.company-overview-col-3 .company-detail-section-ai {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ai-assessment-col .company-detail-section-ai .company-detail-section-header,
.company-overview-col-3 .company-detail-section-ai .company-detail-section-header {
  flex-shrink: 0;
}

.ai-assessment-col .company-detail-section-ai .company-detail-section-body--ai,
.company-overview-col-3 .company-detail-section-ai .company-detail-section-body--ai {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.ai-assessment-col .ai-assessment-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  position: sticky;
  top: 1.5rem;
}

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

.ai-assessment-header .ai-assessment-heading {
  margin: 0;
}

.ai-assessment-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-assessment-actions .ai-assess-spinner {
  margin-left: 0;
}

.ai-assessment-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-light);
}

.ai-assessment-heading {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--color-text-strong);
}

.ai-assessment-empty-text {
  margin: 0;
  color: var(--color-text-muted);
  font-style: italic;
}

.ai-assessment-content {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.ai-assessment-meta {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.ai-assessment-body {
  white-space: pre-wrap;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-strong);
  margin: 0;
}

/* AI assessment tables */
.ai-assessment-tables {
  margin: 0;
}

.ai-assessment-tables .ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.ai-assessment-tables .ai-table:last-child {
  margin-bottom: 0;
}

.ai-assessment-tables .ai-table-header {
  margin-bottom: 1rem;
}

.ai-assessment-tables .ai-table th,
.ai-assessment-tables .ai-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border-light);
}

.ai-assessment-tables .ai-table tr:last-child th,
.ai-assessment-tables .ai-table tr:last-child td {
  border-bottom: none;
}

.ai-assessment-tables .ai-table-th {
  font-weight: 600;
  color: var(--color-text-muted-2);
  width: 12rem;
  max-width: 12rem;
}

.ai-assessment-tables .ai-table-td {
  color: var(--color-text-strong);
  line-height: 1.5;
}

.ai-assessment-tables .ai-table-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-strong);
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
}

.ai-assessment-tables .ai-table-section-title:first-of-type {
  margin-top: 0;
}

.ai-assessment-tables .ai-table-nested {
  margin: 0;
}

.ai-assessment-tables .ai-table-nested .ai-table {
  margin-bottom: 0;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
}

.ai-assessment-tables .ai-table-nested .ai-table th,
.ai-assessment-tables .ai-table-nested .ai-table td {
  padding: 0.35rem 0.5rem;
  border-bottom-color: var(--color-border-divider);
}

.ai-assessment-tables .ai-table-list {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.ai-assessment-tables .ai-table-null {
  color: var(--color-text-placeholder);
  font-style: italic;
}

.ai-assessment-tables .ai-table-plain {
  margin: 0;
}

/* Transaction cockpit */
.transaction-cockpit {
  width: 100%;
  max-width: none;
}

/* Match edit company page: same page header margin and layout */
.main-content:has(.transaction-cockpit) .page-header {
  margin-bottom: 0.75rem;
}

.transaction-cockpit .page-header h1 {
  font-size: 1.25rem;
}

/* Cockpit: 1/3 form | 2/3 sections */
.cockpit-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem 1.5rem;
  align-items: start;
}

@media (max-width: 52rem) {
  .cockpit-layout {
    grid-template-columns: 1fr;
  }
}

.cockpit-form-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.cockpit-sections-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 1rem;
}

/* Transaction page tabs (below title, full width) */
.transaction-page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  padding: 0 0.25rem 0 0.5rem;
  margin: 0 0 1rem 0;
  border-bottom: 1px solid var(--color-border-light);
  min-height: 2.75rem;
}

.transaction-page-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.25rem 0.65rem;
  margin: 0;
  margin-bottom: -1px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.transaction-page-tab:hover {
  color: var(--color-text-strong);
}

.transaction-page-tab.is-active {
  color: var(--color-primary);
  font-weight: 600;
  border-bottom-color: var(--color-primary);
}

.transaction-page-tabs .cockpit-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-bg-muted);
  border-radius: 999px;
}

.transaction-page-tab.is-active .cockpit-tab-count {
  color: var(--color-primary);
  background: rgba(22, 62, 100, 0.1);
}

/* Tab-bar actions: save / delete buttons aligned right on same row as tabs */
.tab-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding-bottom: 0.35rem;
}

.tab-bar-actions .btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  min-height: 0;
  white-space: nowrap;
}

/* Save button: ghost style until form is dirty */
.btn-save-top {
  background: transparent !important;
  color: var(--color-text-muted) !important;
  border: 1px solid var(--color-border) !important;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-save-top.is-dirty {
  background: var(--color-primary) !important;
  color: var(--color-on-primary) !important;
  border-color: var(--color-primary) !important;
}

.btn-save-top.is-dirty:hover {
  background: var(--color-primary-hover) !important;
  border-color: var(--color-primary-hover) !important;
}

.transaction-tab-panels {
  min-height: 0;
}

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

.transaction-tab-panel .cockpit-section--full {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
}

/* Transaction tab: company-detail-section variants (full-width, placeholder) */
.transaction-tab-panel .company-detail-section--enterprise-valuation .company-detail-section-header,
.transaction-tab-panel .company-detail-section--ev-bridge .company-detail-section-header {
  margin-bottom: 0;
}

.transaction-tab-panel .company-detail-section--enterprise-valuation .company-detail-section-body,
.transaction-tab-panel .company-detail-section--ev-bridge .company-detail-section-body {
  padding: 0.75rem 1rem;
}

.transaction-tab-panel .company-detail-section-body--no-padding,
.transaction-tab-panel .company-detail-section--enterprise-valuation .company-detail-section-body--no-padding,
.transaction-tab-panel .company-detail-section--ev-bridge .company-detail-section-body--no-padding {
  padding: 0;
}

.transaction-tab-panel .company-detail-section--enterprise-valuation .admin-section-desc,
.transaction-tab-panel .company-detail-section--ev-bridge .admin-section-desc {
  margin-bottom: 1rem;
}

.transaction-tab-panel .company-detail-section--placeholder {
  border-style: dashed;
  border-color: #cbd5e1;
}

.transaction-tab-panel .company-detail-section--placeholder .company-detail-section-body {
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}

.transaction-tab-panel .company-detail-section--placeholder .company-detail-placeholder-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.cockpit-layout--single {
  display: block;
  max-width: 36rem;
}

/* Deal overview: 3 columns */
.cockpit-layout--three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem 1.5rem;
  align-items: stretch;
}

.transaction-cockpit .cockpit-layout--three .cockpit-form-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.transaction-cockpit .cockpit-layout--three .cockpit-form-column > .company-detail-section,
.transaction-cockpit .cockpit-layout--three .cockpit-form-column > .cockpit-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.transaction-cockpit .cockpit-layout--three .cockpit-form-column > .company-detail-section-remarks .company-detail-section-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Investment thesis: 3-column boxes with simple editors */
.transaction-cockpit .cockpit-layout--thesis .cockpit-form-column {
  min-height: 0;
}

.cockpit-box--single {
  grid-column: 1 / -1;
}

.transaction-cockpit .cockpit-layout--valuation-charts {
  margin-bottom: 1rem;
}

.transaction-cockpit .cockpit-layout--valuation-charts .company-detail-section-body {
  padding: 1rem 1.25rem;
}

.transaction-cockpit .cockpit-layout--valuation-charts .enterprise-valuation-chart-wrap {
  padding: 0.5rem 0;
  min-height: 180px;
}

/* Customer admin dashboard charts */
.dashboard-chart-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.dashboard-chart-toggle {
  display: flex;
  gap: 0.25rem;
}
.dashboard-period-btn {
  background: var(--color-bg-sidebar);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.dashboard-period-btn:hover {
  background: var(--color-bg-sidebar-hover);
  color: var(--color-text);
}
.dashboard-period-btn.is-active {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}
.dashboard-chart-filter select {
  padding: 0.3rem 0.5rem;
  font-size: 0.8125rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  min-width: 10rem;
}
.dashboard-charts {
  margin-bottom: 1.5rem;
}
.dashboard-charts .company-detail-section-body {
  padding: 1rem 1.25rem;
}
.dashboard-chart-wrap {
  padding: 0.5rem 0;
  min-height: 180px;
  min-width: 0;
  width: 100%;
  position: relative;
}
.dashboard-chart-wrap canvas {
  width: 100% !important;
  max-width: 100%;
}
.transaction-cockpit .form-actions--thesis {
  margin-top: 1rem;
}

/* Equity value summary: don't stretch, let S&U fill the space */
.company-detail-section--equity-summary {
  flex: 0 0 auto !important;
}
.company-detail-section--su-summary {
  flex: 1 1 auto !important;
  display: flex;
  flex-direction: column;
}
.company-detail-section--su-summary .company-detail-section-body {
  flex: 1 1 auto;
}

.company-detail-section--equity-summary .equity-summary-rows {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.equity-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.875rem;
}
.equity-summary-label {
  color: var(--color-text);
}
.equity-summary-value {
  font-weight: 500;
}
.equity-summary-row--result .equity-summary-value {
  font-weight: 600;
}

.transaction-cockpit .form-actions--deal-overview {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border-light);
  justify-content: flex-start;
}

@media (max-width: 64rem) {
  .cockpit-layout--three {
    grid-template-columns: 1fr;
  }

.transaction-cockpit .cockpit-layout--three .cockpit-form-column > .company-detail-section,
.transaction-cockpit .cockpit-layout--three .cockpit-form-column > .cockpit-section {
  flex: none;
  }
}

/* Transaction detail: section table overrides (status/type wrappers, textarea) */
.transaction-cockpit .company-detail-table-input .status-field-with-history {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.transaction-cockpit .company-detail-table-input .status-field-with-history select {
  flex: 1 1 auto;
  min-width: 0;
}

.transaction-cockpit .company-detail-table-input .transaction-type-other-wrap {
  margin-top: 0.35rem;
}

.transaction-cockpit .company-detail-table-input .transaction-type-other-wrap .transaction-type-other-input {
  width: 100%;
  min-height: 1.625rem;
  padding: 2px 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4;
  border: none;
  border-radius: var(--radius-sm);
  background: #fff;
  box-sizing: border-box;
}

/* Remarks and thesis: plain textareas (same as other form fields) */
.transaction-cockpit .company-detail-remarks-textarea {
  width: 100%;
  min-height: 10em;
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  box-sizing: border-box;
  resize: vertical;
}
.transaction-cockpit .company-detail-remarks-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.transaction-cockpit .company-detail-next-action-textarea {
  width: 100%;
  height: 100%;
  min-height: 4.5em;
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  border: none;
  border-radius: 0;
  background: #fff;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
}
.transaction-cockpit .company-detail-next-action-textarea:focus {
  outline: none;
}

.company-detail-next-action-readonly {
  margin: 0;
  padding: 0.5rem 0.6rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.company-detail-next-action-readonly--empty {
  color: var(--color-text-muted);
  font-style: italic;
}

.cockpit-section {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  min-height: 0;
}

/* Cockpit section outline */
.transaction-cockpit .cockpit-form-column .cockpit-section {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 0.5rem 1rem 0.5rem 1rem;
  background-color: var(--color-bg-subtle);
}

.transaction-cockpit .cockpit-form-column .cockpit-section:not(:first-child) {
  padding-top: 1.25rem;
}

.cockpit-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border-divider);
}

.cockpit-section-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}

.cockpit-section-action:hover {
  color: var(--color-primary);
  background: rgba(0, 0, 0, 0.04);
}

.cockpit-section-action .icon {
  width: 1rem;
  height: 1rem;
}

.cockpit-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border-divider);
}

.cockpit-section-header .cockpit-section-title {
  margin: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.cockpit-company-readonly .cockpit-readonly-row {
  display: grid;
  grid-template-columns: minmax(0, 8rem) 1fr;
  gap: 0 0.75rem;
  align-items: start;
  margin-bottom: 0.5rem;
  font-size: var(--font-size-input);
}

.cockpit-company-readonly .cockpit-readonly-row:last-child {
  margin-bottom: 0;
}

.cockpit-company-readonly .cockpit-readonly-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-strong);
  padding-top: 0.35rem;
}

.cockpit-company-readonly .cockpit-readonly-value {
  min-width: 0;
  font-size: var(--font-size-input);
  color: var(--color-text);
  line-height: 1.4;
}

.cockpit-company-readonly .cockpit-readonly-value a {
  color: var(--color-primary);
}

.transaction-cockpit .cockpit-section .form-section-title {
  display: none;
}

/* Cockpit form column */
.cockpit-form-column .form-group {
  display: grid;
  grid-template-columns: minmax(0, 8rem) 1fr;
  gap: 0 0.75rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

.cockpit-form-column .form-group:last-child {
  margin-bottom: 0;
}

.cockpit-form-column .form-group > label {
  font-size: var(--font-size-label);
  margin-bottom: 0;
  padding-top: 0.35rem;
}

.cockpit-form-column .form-group > input,
.cockpit-form-column .form-group > select,
.cockpit-form-column .form-group > textarea {
  min-width: 0;
}

.cockpit-form-column .form-group .form-group-checkboxes {
  grid-column: 2;
}

.cockpit-form-column .form-group > input[type="hidden"] {
  grid-column: 2;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cockpit-form-column .form-group > .autocomplete-results {
  grid-column: 2;
}

.transaction-type-other-wrap {
  grid-column: 2;
  margin-top: 0.35rem;
}

.transaction-type-other-wrap .transaction-type-other-input {
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0.5rem;
  font-size: var(--font-size-input);
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.transaction-cockpit .form-group input,
.transaction-cockpit .form-group select,
.transaction-cockpit .form-group textarea {
  min-height: 2rem;
  padding: 0.35rem 0.5rem;
  font-size: var(--font-size-input);
}

/* Cockpit rows */
.transaction-cockpit .cockpit-form-column .form-group {
  border-bottom: 1px solid var(--color-border-lighter);
  margin-bottom: 0;
  padding: 0.5rem 0;
  gap: 0 0.75rem;
}

.transaction-cockpit .cockpit-form-column .form-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.transaction-cockpit .cockpit-form-column .form-group > label {
  border: none;
  padding: 0.35rem 0 0.35rem 0;
  min-height: 2rem;
  box-sizing: border-box;
  background: transparent;
  display: flex;
  align-items: center;
  font-size: var(--font-size-label);
  font-weight: 600;
  color: var(--color-text-strong);
}

.transaction-cockpit .cockpit-form-column .form-group > input,
.transaction-cockpit .cockpit-form-column .form-group > select,
.transaction-cockpit .cockpit-form-column .form-group > textarea {
  border: none;
  border-radius: 0;
  background: var(--color-bg);
  box-shadow: none;
  padding: 0.35rem 0 0.35rem 0.5rem;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  font-size: var(--font-size-input);
  font-weight: 400;
  color: var(--color-text-strong);
}

.transaction-cockpit .cockpit-form-column .form-group > select {
  text-align: left;
  padding-left: 0.5rem;
}

.transaction-cockpit .cockpit-form-column .form-group > input:focus,
.transaction-cockpit .cockpit-form-column .form-group > select:focus,
.transaction-cockpit .cockpit-form-column .form-group > textarea:focus {
  outline: none;
  background: var(--color-bg-subtle);
  box-shadow: none;
}

.transaction-cockpit .form-group textarea {
  min-height: 2.5rem;
}

.transaction-cockpit .form-group-checkboxes {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.transaction-cockpit .form-group-inline .checkbox-label,
.transaction-cockpit .form-group-checkboxes .checkbox-label {
  font-size: 0.8125rem;
  margin-right: 0;
}

.transaction-cockpit .form-hint {
  font-size: 0.6875rem;
  margin-top: 0.15rem;
}

.cockpit-section--placeholder {
  min-height: 4rem;
  background: var(--color-bg-subtle);
  border-style: dashed;
  border-color: #cbd5e1;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.8125rem;
  padding: 1rem;
}

.cockpit-section--placeholder strong {
  display: block;
  color: var(--color-text-muted-2);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

/* EV section */
.company-detail-section--enterprise-valuation .enterprise-valuation-charts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-chart-wrap {
  min-height: 180px;
  min-width: 0;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-chart-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-strong);
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-chart-wrap canvas {
  width: 100% !important;
  max-width: 100%;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-table-wrap {
  overflow-x: auto;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-table {
  font-size: 0.8125rem;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-table th,
.company-detail-section--enterprise-valuation .enterprise-valuation-table td {
  padding: calc(0.35rem - 2px) 0.75rem;
  font-size: 0.8125rem;
}

/* EV table */
.company-detail-section--enterprise-valuation .enterprise-valuation-table--clean {
  border: none;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-table--clean th,
.company-detail-section--enterprise-valuation .enterprise-valuation-table--clean td {
  border: none;
  border-bottom: 1px solid var(--color-border-lighter);
  border-right: none;
  background: var(--color-bg);
}

.company-detail-section--enterprise-valuation .enterprise-valuation-table--clean th:last-child,
.company-detail-section--enterprise-valuation .enterprise-valuation-table--clean td:last-child {
  border-right: none;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-table--clean th {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}
.ev-bridge-flat-table th {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-table--clean tbody tr:hover td {
  background: var(--color-bg-header);
}
.enterprise-valuation-table .ev-cell-editable {
  cursor: pointer;
}
.enterprise-valuation-table .ev-cell-editable:hover {
  background: var(--color-bg-subtle, #f8fafc);
}
.enterprise-valuation-table .ev-inline-input {
  width: 100%;
  border: 1px solid var(--color-border-input, #94a3b8);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font-size: inherit;
  font-family: inherit;
  box-sizing: border-box;
}

.company-detail-section--enterprise-valuation .enterprise-valuation-table--clean .admin-table-actions-empty {
  color: var(--color-border-input);
  font-size: 0.875rem;
}

.ev-col-active {
  width: 3.5rem;
  text-align: center;
}
.ev-active-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--color-primary, #163E64);
  color: #fff;
}
.ev-active-badge .icon {
  width: 0.8rem;
  height: 0.8rem;
}
.ev-row--active td {
  font-weight: 600;
}

/* EV Bridge */
.ev-bridge-header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ev-bridge-date-select {
  min-width: 11rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}
.ev-bridge-toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.ev-bridge-date-select-wrap { margin-bottom: 1rem; }
.ev-bridge-content .admin-section-desc { margin-bottom: 1rem; }
.ev-bridge-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.ev-bridge-table .ev-bridge-col-value { text-align: right; white-space: nowrap; }
.ev-bridge-value--negative { color: var(--color-danger); }
.ev-bridge-value-in-parentheses { font-size: 0.875em; opacity: 0.9; }
.ev-bridge-footer { margin-top: 0.5rem; padding: 0.75rem 0; border-top: 1px solid var(--color-border-light); }
.ev-bridge-totals { max-width: 20rem; }
.ev-bridge-total-row--result { font-weight: 600; border-top: 1px solid var(--color-border-light); margin-top: 0.25rem; padding-top: 0.5rem; }
.ev-bridge-total-value { text-align: right; }
.ev-bridge-add-form { margin-top: 1rem; }
.ev-bridge-add-form .ev-bridge-add-type { min-width: 12rem; }
.ev-bridge-add-form .ev-bridge-add-name { min-width: 10rem; }
.ev-bridge-add-form .ev-bridge-add-value { width: 6rem; }
.ev-bridge-version-history { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--color-border-light); }
.ev-bridge-version-title { font-size: 0.9375rem; font-weight: 600; margin: 0 0 0.5rem 0; }
.ev-bridge-version-list { list-style: none; padding: 0; margin: 0; }
.ev-bridge-version-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; font-size: 0.9375rem; }
.ev-bridge-version-item--empty { color: var(--color-text-muted); }
.ev-bridge-version-date { min-width: 8rem; }
.ev-bridge-drag-handle { cursor: grab; color: var(--color-text-placeholder); }

/* Bridge date rows */
.ev-bridge-table--collapsible .ev-bridge-parent-row {
  background: var(--color-bg-subtle);
  font-weight: 600;
}
.ev-bridge-table--collapsible .ev-bridge-parent-row td {
  background: var(--color-bg-subtle);
  vertical-align: middle;
}
.ev-bridge-table--collapsible .ev-bridge-parent-row:hover td {
  background: var(--color-bg-header);
}
.ev-bridge-table--collapsible .ev-bridge-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
}
.ev-bridge-table--collapsible .ev-bridge-toggle:hover {
  color: var(--color-primary);
  background: rgba(0, 0, 0, 0.05);
}
.ev-bridge-table--collapsible .ev-bridge-toggle .icon {
  width: 1rem;
  height: 1rem;
}
.ev-bridge-expanded-cell {
  padding: 0 !important;
  background: #fff !important;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
}
.ev-bridge-expanded-content {
  padding: 1rem 1rem 1rem 2.5rem;
  background: var(--color-bg-subtle-alt);
}
.ev-bridge-items-inner {
  width: 100%;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}
.ev-bridge-items-inner th,
.ev-bridge-items-inner td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border-light);
  text-align: left;
}
.ev-bridge-items-inner th {
  background: var(--color-bg-subtle);
  font-weight: 600;
  color: var(--color-text-muted);
}
.ev-bridge-items-inner .ev-bridge-col-value {
  text-align: right;
}
.ev-bridge-add-form.ev-bridge-add-form {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}
.ev-bridge-empty-state td {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Cockpit tables */
.transaction-cockpit .admin-table {
  border: 1px solid var(--color-border-light);
}

.transaction-cockpit .admin-table th,
.transaction-cockpit .admin-table td {
  padding: calc(0.35rem - 2px) 0.75rem;
  border: none;
  border-bottom: 1px solid var(--color-border-light);
  border-right: 1px solid var(--color-border-light);
  background: var(--color-bg);
}
.transaction-cockpit .admin-table th:last-child,
.transaction-cockpit .admin-table td:last-child { border-right: none; }
.transaction-cockpit .admin-table th { background: var(--color-bg-subtle-alt); font-weight: 500; color: var(--color-text-muted); }
.transaction-cockpit .admin-table.ev-bridge-flat-table th,
.transaction-cockpit .admin-table.enterprise-valuation-table--clean th {
  background: var(--color-bg);
}

.transaction-cockpit .admin-table tbody tr:hover td {
  background: var(--color-bg-header);
}

.transaction-cockpit .admin-table-wrap {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}
.transaction-cockpit .admin-table-wrap thead th {
  padding: calc(0.35rem - 2px) 0.75rem;
  background: var(--color-bg);
  border: none;
  border-bottom: 1px solid var(--color-border-light);
}
.transaction-cockpit .admin-table-wrap thead tr:last-child th {
  padding-bottom: calc(0.35rem - 2px);
}
.transaction-cockpit .admin-table .btn-icon {
  width: 1.25rem;
  height: 1.25rem;
}
.transaction-cockpit .admin-table .btn-icon .icon {
  width: 0.75rem;
  height: 0.75rem;
}

/* Error pages */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 50vh;
  padding: 3rem 1.5rem;
}
.error-page-code {
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-border);
}
.error-page-title {
  margin-top: 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
}
.error-page-message {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  max-width: 28rem;
}
.error-page-actions {
  margin-top: 1.5rem;
}

/* Cockpit form actions */
.transaction-cockpit .form-actions {
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border-light);
}

/* Status field: History icon + hover popover */
.transaction-cockpit .status-field-with-history {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.transaction-cockpit .status-field-with-history select {
  flex: 1 1 auto;
  min-width: 0;
}

.transaction-cockpit .status-history-wrap {
  position: relative;
  flex-shrink: 0;
}

.transaction-cockpit .status-history-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
}

.transaction-cockpit .status-history-trigger:hover {
  color: var(--color-primary);
  background: rgba(0, 0, 0, 0.05);
}

.transaction-cockpit .status-history-trigger .icon {
  width: 1rem;
  height: 1rem;
}

.transaction-cockpit .company-detail-section--status-history .status-history-trigger {
  width: auto;
  padding: 0.25rem 0.5rem;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 400;
}
.transaction-cockpit .company-detail-section--status-history .status-history-trigger .icon {
  flex-shrink: 0;
}

/* Status history: modal (floats on top of screen) */
.modal-backdrop#status-history-modal {
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-box--status-history {
  max-width: 32rem;
  width: 100%;
}

.modal-box--status-history .company-detail-section-body {
  padding: 0;
}

.modal-box--status-history .company-detail-table thead th {
  padding: calc(0.35rem - 2px) 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}

.modal-box--status-history .status-history-row-deal-created td {
  font-size: 0.875rem;
}
.modal-box--status-history .status-history-row-deal-created .company-detail-table-value.status-history-deal-created-status {
  color: var(--color-text);
  vertical-align: middle;
  min-height: 1.625rem;
  line-height: 1.4;
}
.modal-box--status-history .status-history-col-actions {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}
.modal-box--status-history .status-history-delete-btn {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-text-muted);
}
.modal-box--status-history .status-history-delete-btn:hover {
  color: var(--color-danger, #dc2626);
}
.modal-box--status-history .status-history-delete-btn .icon {
  width: 0.75rem;
  height: 0.75rem;
}
.modal-box--status-history .status-history-empty {
  margin: 0.75rem 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Upload: import overlay (progress) and results with errors */
.import-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.import-overlay.import-overlay--visible {
  display: flex;
}

.import-overlay-content {
  background: var(--color-bg);
  padding: 2rem 3rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.import-overlay-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 1rem;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: import-spin 0.8s linear infinite;
}

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

.import-overlay-text {
  margin: 0;
  font-size: 1rem;
  color: var(--color-text);
}

.upload-results {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.upload-results--errors {
  border-color: #dc2626;
  background: #fef2f2;
}

.upload-results-title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.upload-results-title .icon {
  color: #dc2626;
}

.upload-results p {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

.text-error {
  color: #b91c1c;
  font-size: 0.875rem;
}

/* ── Upload: locked column mapping (guardian mapping step) ── */

.upload-locked-mapping {
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
}

.upload-locked-mapping-summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text-strong);
  user-select: none;
}

.upload-locked-mapping-summary .badge {
  font-weight: 400;
  font-size: 0.75rem;
}

.upload-locked-mapping .admin-table-wrap {
  padding: 0 1rem 0.75rem;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-strong);
  margin-bottom: 1rem;
}

.section-heading .icon {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--color-text-muted);
}

/* ── Upload: import preview ── */

.preview-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.preview-summary-stat {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  min-width: 9rem;
}

.preview-summary-number {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-strong);
}

.preview-summary-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.preview-summary-stat--ok .preview-summary-number { color: var(--color-success-text); }
.preview-summary-stat--error .preview-summary-number { color: var(--color-danger); }
.preview-summary-stat--skip .preview-summary-number { color: var(--color-text-muted); }

.preview-table-wrap {
  overflow-x: auto;
  max-height: 60vh;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.preview-table {
  font-size: 0.8125rem;
  white-space: nowrap;
}

.preview-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-bg-subtle);
}

.preview-table td,
.preview-table th {
  padding: 0.375rem 0.625rem;
  max-width: 20rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-col-row {
  width: 3.5rem;
  text-align: right;
}

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

/* ── Linked persons – tag style (company detail) ── */

.linked-persons-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.linked-person-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--color-primary, #163E64);
  color: #fff;
  border-radius: 4px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  max-width: 100%;
  transition: background 0.15s ease;
}
.linked-person-tag:hover {
  background: #1a4a78;
}

.linked-person-tag-link {
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.linked-person-tag-link:hover {
  text-decoration: underline;
}

.linked-person-tag-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  font-weight: 700;
  transition: color 0.15s ease;
  flex-shrink: 0;
}
.linked-person-tag-remove:hover {
  color: #fff;
}

.linked-persons-empty {
  padding: 0.5rem 0.75rem;
  color: var(--color-text-muted, #999);
  font-size: 0.8125rem;
  font-style: italic;
  margin: 0;
}

/* ── NDA modal: representative list ── */

.nda-rep-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid var(--color-border, #e5e5e0);
  font-size: 0.875rem;
}
.nda-rep-item:last-child { border-bottom: none; }

.nda-rep-name {
  font-weight: 400;
  color: var(--color-text);
}

.nda-rep-title {
  color: var(--color-text-muted, #777);
  font-size: 0.8125rem;
}
.nda-rep-title::before { content: "— "; }

.nda-rep-remove {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.125rem;
  color: var(--color-text-muted, #999);
  line-height: 1;
  border-radius: 3px;
}
.nda-rep-remove:hover { color: #b91c1c; background: #fef2f2; }
.nda-rep-remove .icon { width: 14px; height: 14px; }

.nda-rep-list .text-muted {
  display: block;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-style: italic;
}

/* ── Modal (add person) ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-dialog {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  overflow: hidden;
}
.modal-dialog--narrow { max-width: 400px; }
.modal-dialog--wide { max-width: 640px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border, #e5e5e0);
}

.modal-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-text-muted, #777);
  padding: 0 0.25rem;
  line-height: 1;
}
.modal-close:hover { color: #333; }

.modal-body { padding: 1rem; }

.person-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  font-size: 0.875rem;
  box-sizing: border-box;
}
.person-search-input:focus {
  outline: none;
  border-color: var(--color-primary, #163E64);
  box-shadow: 0 0 0 2px rgba(22,62,100,0.12);
}

.person-search-results {
  margin-top: 0.5rem;
  max-height: 260px;
  overflow-y: auto;
}

.person-search-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.875rem;
}
.person-search-item:hover { background: #f0f4f8; }

.person-search-item-name { font-weight: 500; }
.person-search-item-email { color: var(--color-text-muted, #777); font-size: 0.8125rem; }

.person-search-no-results {
  padding: 0.75rem;
  color: var(--color-text-muted, #999);
  font-size: 0.8125rem;
  font-style: italic;
  text-align: center;
}

.unlink-person-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.unlink-option-btn {
  display: flex !important;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem !important;
  text-align: left;
  min-height: 0 !important;
  width: 100%;
}

.unlink-option-btn .icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.unlink-option-btn span {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.unlink-option-btn strong {
  font-size: 0.8125rem;
  font-weight: 600;
}

.unlink-option-btn small {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.unlink-option-btn.btn-outline-danger small {
  color: var(--color-danger);
  opacity: 0.8;
}

.add-person-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-light);
}

.add-person-tab {
  padding: 0.5rem 0.75rem;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
}

.add-person-tab:hover { color: var(--color-text-strong); }

.add-person-tab.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.input-with-suffix input {
  flex: 1;
}
.input-suffix {
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
  flex-shrink: 0;
}

/* ── Sources & Uses ────────────────────────────────────────────────── */
.sources-uses-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .sources-uses-panels { grid-template-columns: 1fr; }
}
.sources-uses-panel {
  min-width: 0;
}
.su-table {
  width: 100%;
  font-size: 0.8125rem;
}
.su-table th,
.su-table td {
  padding: calc(0.35rem - 2px) 0.75rem;
  vertical-align: middle;
}
.su-col-amount {
  text-align: right;
  white-space: nowrap;
  min-width: 7rem;
}
.su-col-actions {
  width: 2.5rem;
  text-align: center;
}
.su-total-row td {
  border-top: 2px solid var(--color-primary, #163E64);
}
.su-row--computed td {
  background: var(--bg-muted, #f1f5f9);
  font-style: italic;
  color: var(--text-muted, #64748b);
}
.su-empty td {
  color: var(--text-muted, #64748b);
  font-style: italic;
  text-align: center;
  padding: 1rem 0.5rem;
}
.su-row--delta td {
  font-style: italic;
  color: #dc2626;
}
.su-cell-editable {
  cursor: pointer;
  position: relative;
}
.su-cell-editable:hover {
  background: var(--bg-muted, #f1f5f9);
}
.su-inline-input {
  width: 100%;
  font-size: inherit;
  font-family: inherit;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--color-primary, #163E64);
  border-radius: 3px;
  outline: none;
}
.su-add-modal .modal-box {
  max-width: 28rem;
}
.su-add-modal .form-row {
  margin-bottom: 0.75rem;
}
.su-add-modal .form-row label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: var(--text-muted, #475569);
}
.su-add-modal .form-row input,
.su-add-modal .form-row select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
.su-add-modal .form-row input:focus,
.su-add-modal .form-row select:focus {
  border-color: var(--color-primary, #163E64);
  outline: none;
  box-shadow: 0 0 0 2px rgba(22,62,100,0.12);
}

/* Admin: base table management */
.su-admin-input {
  font-size: 0.8125rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  width: 100%;
}
.su-admin-input--narrow {
  width: 4rem;
}
.su-base-add-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.su-base-add-form select,
.su-base-add-form input {
  font-size: 0.8125rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
.su-base-add-form input { flex: 1; min-width: 10rem; }

/* EV Bridge flat table */
.ev-bridge-flat-table {
  width: 100%;
  font-size: 0.8125rem;
  table-layout: fixed;
}
.ev-bridge-flat-table th,
.ev-bridge-flat-table td {
  padding: calc(0.35rem - 2px) 0.75rem;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev-bridge-flat-table th:nth-child(1),
.ev-bridge-flat-table td:nth-child(1) {
  width: 14%;
}
.ev-bridge-flat-table th:nth-child(2),
.ev-bridge-flat-table td:nth-child(2) {
  width: auto;
}
.ev-bridge-flat-table .ev-bridge-col-value {
  text-align: right;
  white-space: nowrap;
  width: 14%;
}
.ev-bridge-flat-table th:nth-child(4),
.ev-bridge-flat-table td:nth-child(4) {
  width: 30%;
}
.ev-bridge-flat-table .ev-bridge-col-actions {
  width: 2.5rem;
  text-align: center;
}
.ev-bridge-flat-table .ev-bridge-context-row td {
  border-bottom: 1px solid var(--color-border-light, #e2e8f0);
  color: var(--text-muted, #64748b);
}
.ev-bridge-flat-table .ev-bridge-total-row td {
  border-top: 1px solid var(--color-border-light, #e2e8f0);
  color: var(--text-muted, #64748b);
  font-size: 0.8125rem;
}
.ev-bridge-flat-table .ev-bridge-equity-row td {
  border-top: 2px solid var(--color-primary, #163E64);
  font-size: 0.8125rem;
}
.ev-bridge-empty-msg {
  color: var(--text-muted, #64748b);
  font-style: italic;
  text-align: center;
  padding: 1.5rem 0.5rem;
}
.evb-cell-editable {
  cursor: pointer;
}
.evb-cell-editable:hover {
  background: var(--bg-muted, #f1f5f9);
}
.ev-bridge-add-form-wrap {
  padding: 0.75rem;
  border-top: 1px solid var(--color-border-light, #e2e8f0);
}
.ev-bridge-delete-date-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Contract detail ─────────────────────────────────────── */
.contract-detail-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.contract-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.contract-detail-actions .inline-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.contract-ai-summary {
  background: var(--bg-muted, #f1f5f9);
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.contract-ai-summary h3 {
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}
.contract-ai-summary p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.contract-clause-card {
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  margin-bottom: 1rem;
  overflow: hidden;
}
.contract-clause-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-muted, #f8fafc);
  border-bottom: 1px solid var(--color-border-light, #e2e8f0);
}
.contract-clause-header h3 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}
.contract-clause-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-clause-check {
  opacity: 0.5;
  transition: opacity 0.15s;
}
.btn-clause-check:hover {
  opacity: 1;
}
.contract-clause-ai-comment {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted, #64748b);
  background: var(--bg-muted, #f8fafc);
  border-bottom: 1px solid var(--color-border-light, #e2e8f0);
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.contract-clause-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
}
@media (max-width: 768px) {
  .contract-clause-body {
    grid-template-columns: 1fr;
  }
}
.contract-standard-text {
  font-size: 0.8125rem;
  white-space: pre-wrap;
  background: var(--bg-muted, #f8fafc);
  padding: 0.75rem;
  border-radius: var(--radius-sm, 4px);
  max-height: 200px;
  overflow-y: auto;
}
.contract-negotiated-textarea {
  width: 100%;
  font-size: 0.8125rem;
  min-height: 120px;
  resize: vertical;
}
.contract-reference-block {
  margin-bottom: 0.75rem;
}
.contract-reference-text {
  font-size: 0.8125rem;
  white-space: pre-wrap;
  background: var(--bg-muted, #f8fafc);
  padding: 0.75rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--color-border-light, #e2e8f0);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 0.5rem;
}
.contract-lang-tab-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border-light, #e2e8f0);
}
.contract-lang-tab-section:last-of-type {
  border-bottom: none;
}
.contract-setup-matrix th.text-center,
.contract-setup-matrix td.text-center {
  text-align: center;
}
.select-small {
  padding: 0.3rem 0.5rem;
  font-size: 0.8125rem;
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: var(--radius-sm, 4px);
}
.badge--info {
  background: var(--color-info-bg, #dbeafe);
  color: var(--color-info-text, #1e40af);
}
.badge--warning {
  background: var(--color-warning-bg, #fef3c7);
  color: var(--color-warning-text, #92400e);
}
.badge--danger {
  background: var(--color-danger-bg, #fee2e2);
  color: var(--color-danger-text, #991b1b);
}
.ai-flag-badge.badge--success {
  background: #16a34a;
  color: #fff;
}
.ai-flag-badge.badge--warning {
  background: #ca8a04;
  color: #fff;
}
.ai-flag-badge.badge--danger {
  background: #dc2626;
  color: #fff;
}

/* Acquisition score badges */
.acq-score-badge {
  display: inline-block;
  padding: 0.2em 0.7em;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.acq-score-badge--high {
  background: #16a34a;
  color: #fff;
}
.acq-score-badge--medium {
  background: #ca8a04;
  color: #fff;
}
.acq-score-badge--low {
  background: #dc2626;
  color: #fff;
}
.acq-score-empty {
  color: var(--color-text-muted, #94a3b8);
}
.acq-score-select {
  appearance: auto;
  padding: 0.2em 0.5em;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--color-border, #e2e8f0);
  cursor: pointer;
  min-width: 5.5rem;
}
.acq-score-select[data-level="high"] {
  background: #16a34a; color: #fff; border-color: #16a34a;
}
.acq-score-select[data-level="medium"] {
  background: #ca8a04; color: #fff; border-color: #ca8a04;
}
.acq-score-select[data-level="low"] {
  background: #dc2626; color: #fff; border-color: #dc2626;
}
.acq-score-select[data-level=""] {
  background: #fff; color: var(--color-text, #1e293b);
}
.acq-score-select option {
  background: #fff;
  color: var(--color-text, #1e293b);
  font-weight: 400;
}

/* Acquisition scores confirmation modal */
.acq-confirm-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.acq-confirm-table th,
.acq-confirm-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.acq-confirm-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #94a3b8);
}
.acq-confirm-label {
  font-weight: 600;
}

/* Company ownership select + "Other" combo */
.ownership-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.ownership-select {
  flex: 1;
  min-width: 0;
}
.ownership-other-input {
  flex: 1;
  min-width: 0;
}

/* Field mapping — checkbox grid (customer admin) */
.field-mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.375rem 1rem;
}
.field-mapping-checkbox {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.field-mapping-checkbox input[type="checkbox"] {
  margin: 0;
}

/* Field mapping — preview table (customer admin test) */
.field-mapping-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.field-mapping-preview-table th,
.field-mapping-preview-table td {
  padding: 0.375rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.field-mapping-preview-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #94a3b8);
}

/* Field mapping — proposal table (company detail modal) */
.field-mapping-proposal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 0.75rem 0;
}
.field-mapping-proposal-table th,
.field-mapping-proposal-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.field-mapping-proposal-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #94a3b8);
}
.field-mapping-proposal-table .field-mapping-current {
  color: var(--color-text-muted, #94a3b8);
}
.field-mapping-proposal-table .field-mapping-proposed {
  font-weight: 600;
}

/* Person AI search — collapsible sections */
.person-ai-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.person-ai-section-title {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.person-ai-section-title::before {
  content: "▶";
  font-size: 0.6rem;
  transition: transform 0.15s;
}

.person-ai-section[open] > .person-ai-section-title::before {
  transform: rotate(90deg);
}

.person-ai-section-title::-webkit-details-marker {
  display: none;
}

.person-ai-no-data {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.person-ai-section-body {
  padding: 0.5rem 0.75rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.person-ai-section-body p {
  margin: 0;
}

.person-ai-press-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.person-ai-press-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
}

.person-ai-press-list li:last-child {
  border-bottom: none;
}

.person-ai-press-list a {
  font-size: 0.75rem;
  word-break: break-all;
}

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

.person-ai-field-table tr + tr {
  border-top: 1px solid var(--color-border);
}

.person-ai-field-label {
  padding: 0.3rem 0.5rem 0.3rem 0;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  vertical-align: top;
  width: 1%;
}

.person-ai-field-value {
  padding: 0.3rem 0;
  vertical-align: top;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s, transform 0.3s;
  min-width: 16rem;
  max-width: 28rem;
}

.toast--success {
  background: #ecfdf5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

.toast--error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-left: 4px solid var(--color-danger-border);
}

.toast--warning {
  background: #fffbeb;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.toast--info {
  background: #eff6ff;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

.toast-message {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  padding: 0 0.25rem;
  line-height: 1;
}

.toast-close:hover {
  opacity: 1;
}

/* Experimental company search form */
.search-form-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 8rem auto;
  gap: 1rem;
  align-items: end;
}

.search-form-fields .form-group {
  margin-bottom: 0;
}

.search-form-fields--no-customer {
  grid-template-columns: 1fr 8rem auto;
}

.search-form-fields .btn {
  min-height: 2.5rem;
  white-space: nowrap;
}

/* Enrichment field rows */
.enrichment-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border-lighter, #e2e8f0);
}

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

.enrichment-row-fields {
  display: grid;
  grid-template-columns: 10rem 1fr 12rem auto;
  gap: 0.75rem;
  align-items: end;
}

.enrichment-row-fields .form-group {
  margin-bottom: 0;
}

.enrichment-row-fields .form-group > label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.enrichment-row-fields .form-group > input,
.enrichment-row-fields .form-group > select {
  width: 100%;
  font-size: 0.875rem;
}
