/*
 * OmniMEP Dark Engineering SaaS theme.
 * Visual overrides only: markup, IDs, data attributes, content and scripts
 * remain unchanged.
 */

:root {
  color-scheme: dark;
  --navy-950: #171d23;
  --navy-900: #1c232a;
  --navy-800: #252e36;
  --blue-700: #2468da;
  --blue-600: #2f7afb;
  --blue-100: rgba(47, 122, 251, 0.22);
  --blue-50: rgba(47, 122, 251, 0.12);
  --ink: #dce3e9;
  --muted: #a5b0ba;
  --subtle: #778590;
  --line: #33404b;
  --line-strong: #465562;
  --surface: #1c232a;
  --surface-alt: #222b33;
  --canvas: #11161b;
  --green: #45c985;
  --green-bg: rgba(69, 201, 133, 0.13);
  --amber: #ecaa36;
  --amber-bg: rgba(236, 170, 54, 0.13);
  --red: #ef5b5b;
  --red-bg: rgba(239, 91, 91, 0.13);
  --purple: #9470ed;
  --purple-bg: rgba(148, 112, 237, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.24);
  --radius-sm: 3px;
  --radius: 3px;
  --radius-lg: 4px;
  font-family: var(--workspace-font-family);
}

html,
body {
  color: var(--ink);
  background: var(--canvas);
}

body {
  letter-spacing: -0.005em;
}

* {
  scrollbar-color: #52616d var(--surface);
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-track {
  background: var(--surface);
}

*::-webkit-scrollbar-thumb {
  background: #52616d;
  border: 2px solid var(--surface);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #687985;
}

:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

::placeholder {
  color: var(--subtle);
  opacity: 1;
}

.app-header {
  min-height: 48px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--navy-950);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.brand {
  gap: 9px;
}

.brand-mark {
  width: 29px;
  height: 29px;
  color: #fff;
  background: var(--blue-600);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
}

.brand-copy strong {
  color: var(--ink);
  font-size: 14px;
}

.brand-copy small {
  color: var(--subtle);
  font-size: 9px;
}

.header-context {
  gap: 8px;
  color: var(--muted);
}

.connection-state,
.collab-header-button {
  min-height: 29px;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.connection-state::before {
  background: var(--subtle);
}

.connection-state[data-tone="good"]::before {
  background: var(--green);
}

.connection-state[data-tone="danger"]::before {
  background: var(--red);
}

.collab-header-button:hover {
  color: var(--ink);
  background: var(--navy-800);
  border-color: var(--line-strong);
}

.collab-avatar {
  color: #fff;
  background: #23466d;
}

.page-frame,
.project-shell {
  width: min(1560px, calc(100% - 40px));
  padding: 18px 0 38px;
}

.page-heading,
.project-heading,
.panel-heading,
.content-card-heading,
.dialog-heading {
  gap: 18px;
}

.page-heading h1,
.project-heading h1,
.panel-heading h2,
.dialog-heading h2,
.content-card-heading h3,
.project-card h2,
.building-card h3 {
  color: var(--ink);
}

.page-heading h1 {
  font-size: clamp(22px, 2.2vw, 27px);
}

.page-heading > div > p:last-child,
.panel-heading > div > p:last-child,
.project-description {
  margin-top: 5px;
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 4px;
  color: #6fa4ff;
  font-size: 10px;
  letter-spacing: 0.1em;
}

.button {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 3px;
  font-size: 12px;
  box-shadow: none;
}

.button:hover:not(:disabled) {
  box-shadow: none;
  transform: none;
}

.button-primary {
  color: #fff;
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.button-primary:hover:not(:disabled) {
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.button-primary:active:not(:disabled) {
  background: #1f5cbd;
}

.button-secondary,
.icon-button,
.entity-action,
.collab-mini-button,
.collab-link-button {
  color: var(--ink);
  background: var(--navy-800);
  border-color: var(--line-strong);
}

.button-secondary:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.entity-action:hover:not(:disabled) {
  color: #fff;
  background: #162838;
  border-color: #425970;
}

.button-danger {
  background: #a73939;
  border-color: #bd4848;
}

.button-quiet-danger,
.entity-action-danger {
  color: #ff8b8b;
  background: transparent;
  border-color: #67383d;
}

.portfolio-tools,
.table-tools {
  gap: 8px;
}

.portfolio-tools {
  margin: 16px 0 11px;
  padding: 7px;
  background: var(--surface);
  border-color: var(--line);
  border-radius: 3px;
  box-shadow: none;
}

.search-field input,
.select-field select,
.form-field input,
.form-field select,
.form-field textarea,
.registration-mode,
.collab-field input,
.collab-field select,
.collab-field textarea,
.collab-company-composer textarea,
.collab-company-todo-fields input,
.collab-company-todo-fields select {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  border-radius: 5px;
}

.search-field input,
.select-field select {
  height: 32px;
}

.search-field input:focus,
.select-field select:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.collab-field input:focus,
.collab-field select:focus,
.collab-field textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 2px rgba(47, 122, 251, 0.14);
}

.search-field kbd {
  color: var(--subtle);
  background: var(--navy-800);
  border-color: var(--line);
}

.segmented-control,
.collab-auth-tabs,
.collab-admin-tabs {
  padding: 2px;
  background: var(--surface-alt);
  border-color: var(--line);
  border-radius: 3px;
}

.segmented-control button {
  min-height: 27px;
  color: var(--muted);
  border-radius: 2px;
}

.segmented-control button[aria-pressed="true"],
.collab-auth-tabs button[aria-selected="true"],
.collab-admin-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: var(--navy-800);
  box-shadow: inset 0 -2px 0 var(--blue-600);
}

.icon-button {
  flex-basis: 32px;
  width: 32px;
  height: 32px;
  border-radius: 3px;
}

.project-grid,
.project-skeleton-grid {
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 8px;
}

.project-card {
  min-height: 176px;
  padding: 14px;
  color: inherit;
  background: var(--surface);
  border-color: var(--line);
  border-radius: 3px;
  box-shadow: none;
}

.project-card::before {
  right: auto;
  width: 3px;
  height: 100%;
  background: var(--blue-600);
}

.project-card:hover {
  background: var(--surface-alt);
  border-color: var(--line-strong);
  box-shadow: none;
  transform: none;
}

.project-card h2 {
  font-size: 16px;
}

.project-card-description {
  min-height: 34px;
  margin: 7px 0 12px;
  color: var(--muted);
}

.project-card-metric,
.metric-card {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.project-card-metric {
  padding: 7px 8px;
}

.project-card-metric span,
.metric-card span {
  color: var(--muted);
}

.project-card-metric strong,
.metric-card strong {
  color: var(--ink);
}

.project-card-footer {
  margin-top: 11px;
  padding-top: 10px;
  color: var(--muted);
  border-color: var(--line);
}

.project-open-button,
.text-button,
.breadcrumb button {
  color: #6fa4ff;
}

.status-badge,
.table-status,
.nav-count,
.collab-pill,
.immutable-badge,
.latest-badge {
  min-height: 20px;
  padding: 2px 7px;
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid rgba(69, 201, 133, 0.24);
  border-radius: 3px;
}

[data-status-tone="archived"] {
  color: var(--muted);
  background: rgba(127, 142, 156, 0.12);
  border-color: rgba(127, 142, 156, 0.22);
}

[data-status-tone="review"] {
  color: var(--amber);
  background: var(--amber-bg);
  border-color: rgba(236, 170, 54, 0.26);
}

[data-status-tone="danger"] {
  color: var(--red);
  background: var(--red-bg);
  border-color: rgba(239, 91, 91, 0.26);
}

.project-skeleton,
.detail-skeleton > div {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface) 50%, var(--surface-alt) 75%);
}

.empty-state,
.compact-empty,
.hierarchy-empty,
.collab-empty,
.collab-loading,
.collab-error-state {
  color: var(--muted);
  background: var(--surface);
  border-color: var(--line-strong);
  border-radius: 3px;
}

.empty-state {
  min-height: 310px;
}

.empty-state.compact {
  min-height: 220px;
}

.empty-icon {
  width: 54px;
  height: 54px;
  color: #6fa4ff;
  background: var(--blue-50);
  border-radius: 3px;
}

.empty-state h2 {
  color: var(--ink);
}

.inline-alert,
.handoff-notice,
.immutable-notice {
  color: var(--ink);
  background: var(--blue-50);
  border-color: rgba(47, 122, 251, 0.28);
  border-left-color: var(--blue-600);
  border-radius: 3px;
}

.inline-alert[data-tone="danger"] {
  color: #ffb0b0;
  background: var(--red-bg);
  border-color: rgba(239, 91, 91, 0.3);
  border-left-color: var(--red);
}

.inline-alert[data-tone="warning"] {
  color: #f2c978;
  background: var(--amber-bg);
  border-color: rgba(236, 170, 54, 0.3);
  border-left-color: var(--amber);
}

.breadcrumb {
  margin-bottom: 12px;
  color: var(--muted);
}

.project-heading {
  margin-bottom: 12px;
  padding: 13px 15px;
  background: var(--surface);
  border-color: var(--line);
  border-radius: 3px;
  box-shadow: none;
}

.project-title-line h1 {
  font-size: clamp(19px, 2.1vw, 24px);
}

.project-metadata {
  margin-top: 9px;
  color: var(--muted);
}

.project-layout,
.detail-skeleton {
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 6px;
}

.project-sidebar {
  top: 68px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: none;
}

.project-sidebar-label,
.sidebar-project-id {
  color: var(--subtle);
}

.project-sidebar-label {
  padding: 14px 13px 7px;
}

.project-tabs {
  padding: 0 6px 8px;
}

.project-tabs button {
  min-height: 34px;
  padding: 7px 9px;
  color: var(--muted);
  border-radius: 4px;
  font-size: 12px;
}

.project-tabs button:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.project-tabs button[aria-current="page"] {
  color: var(--blue-700);
  background: var(--blue-50);
  box-shadow: inset 3px 0 0 var(--blue-600);
}

.sidebar-project-id {
  padding: 11px 13px 13px;
  border-color: var(--line);
}

.sidebar-project-id code {
  color: var(--muted);
}

.project-panel {
  min-height: 510px;
  padding: 15px;
  background: var(--surface);
  border-color: var(--line);
  border-radius: 3px;
  box-shadow: none;
}

.panel-heading {
  padding-bottom: 13px;
  border-color: var(--line);
}

.panel-heading h2 {
  font-size: 16px;
}

.metric-grid {
  gap: 7px;
  margin: 13px 0;
}

.metric-card {
  min-height: 70px;
  padding: 9px;
}

.metric-card strong {
  margin-top: 7px;
  font-size: 20px;
}

.hierarchy-toolbar {
  background: var(--surface-alt);
  border-color: var(--line);
  border-radius: 3px;
}

.overview-columns {
  gap: 6px;
}

.content-card,
.building-card,
.collection-card,
.hierarchy-drawing,
.version-item,
.conflict-panel {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  border-radius: 2px;
}

.content-card-heading {
  padding: 9px 11px;
  border-color: var(--line);
}

.compact-list li {
  padding: 8px 10px;
  border-color: var(--line);
}

.compact-list strong,
.hierarchy-toolbar strong,
.data-table .primary-cell strong,
.collection-card > summary,
.version-history > summary,
.hierarchy-drawing strong {
  color: var(--ink);
}

.compact-list small,
.filter-summary,
.hierarchy-description,
.building-card .building-description,
.building-card .building-address {
  color: var(--muted);
}

.table-tools {
  margin: 13px 0 9px;
}

.hierarchy-toolbar {
  margin-top: 13px;
  padding: 8px 9px;
}

.data-table-wrap {
  background: var(--surface);
  border-color: var(--line);
  border-radius: 2px;
}

.data-table {
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  height: 31px;
  padding: 6px 8px;
  color: var(--muted);
  background: var(--surface-alt);
  border-color: var(--line);
}

.data-table td {
  height: 35px;
  padding: 7px 8px;
  color: var(--ink);
  border-color: var(--line);
}

.data-table tbody tr:hover {
  background: var(--surface-alt);
}

.data-table th + th,
.data-table td + td {
  border-left: 1px solid rgba(70, 85, 98, 0.55);
}

.data-table .version-detail-row > td,
.data-table tbody .version-detail-row:hover {
  background: var(--surface-alt);
}

.data-table .primary-cell small,
.hierarchy-count,
.version-count {
  color: var(--muted);
}

.building-card {
  padding: 12px;
}

.building-card.entity-archived,
.collection-card.entity-archived,
.hierarchy-drawing.entity-archived,
.data-table tr.entity-archived {
  background: var(--surface-alt);
}

.building-card-metadata,
.version-history {
  border-color: var(--line);
}

.collection-card > summary {
  background: var(--surface-alt);
}

.collection-body,
.hierarchy-drawing,
.version-item {
  padding: 8px;
}

.entity-action:disabled {
  color: var(--subtle);
  background: var(--surface-alt);
}

.dialog-content,
.collab-dialog,
.confirm-dialog {
  color: var(--ink);
  background: var(--navy-800);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: var(--shadow-md);
}

.dialog-actions,
.collab-dialog-footer {
  background: var(--surface-alt);
  border-color: var(--line);
}

dialog::backdrop,
.collab-dialog::backdrop {
  background: rgba(0, 0, 0, 0.52);
}

.toast,
.collab-live-message {
  color: var(--ink);
  background: var(--navy-800);
  border-color: var(--line-strong);
  border-radius: 3px;
  box-shadow: var(--shadow-md);
}

/* Collaboration views outside authentication inherit the workspace theme. */
.collab-section,
.collab-company-card,
.collab-company-summary-card,
.collab-company-work-panel,
.collab-list-item,
.collab-member-row,
.collab-company-message,
.collab-company-todo,
.collab-company-note-editor {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  border-radius: 3px;
  box-shadow: none;
}

.collab-field > span,
.collab-field > label,
.collab-fieldset legend,
.collab-section-heading h2,
.collab-company-heading h1,
.collab-detail-copy strong,
.collab-item-copy strong {
  color: var(--ink);
}

.collab-form-help,
.collab-dialog-subtitle,
.collab-detail-copy small,
.collab-item-copy small {
  color: var(--muted);
}

.collab-toolbar,
.collab-company-tabs,
.collab-company-scope,
.collab-company-frame {
  color: var(--ink);
  background: var(--surface-alt);
  border-color: var(--line);
}

.collab-company-tabs button[aria-selected="true"],
.collab-admin-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--blue-600);
}

/* The existing assistant stays distinct with a restrained violet accent. */
.opa-root {
  --opa-bg: #0a1119;
  --opa-surface: #0d1821;
  --opa-surface-raised: #14212c;
  --opa-hover: #162838;
  --opa-ink: #e7eef7;
  --opa-muted: #a7b4c1;
  --opa-subtle: #7f8e9c;
  --opa-line: #22313f;
  --opa-line-strong: #314354;
  --opa-accent: var(--purple);
}

.opa-panel {
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.2);
}

.opa-panel-toggle,
.opa-send-button,
.opa-new-chat {
  color: #fff;
  background: #6f4fc2;
  border-color: #8667d5;
}

.opa-brand-mark,
.opa-message-tool,
.opa-response-kind,
.opa-load-job-badge {
  color: #d8c9ff;
  background: var(--purple-bg);
  border-color: rgba(148, 112, 237, 0.3);
}

@media (max-width: 1180px) {
  .project-grid,
  .project-skeleton-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }

  .project-layout,
  .detail-skeleton {
    grid-template-columns: 196px minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .app-header {
    padding: 0 14px;
  }

  .page-frame,
  .project-shell {
    width: min(100% - 24px, 1560px);
    padding-top: 16px;
  }

  .project-grid,
  .project-skeleton-grid,
  .project-layout,
  .detail-skeleton {
    grid-template-columns: 1fr;
  }

  .project-sidebar {
    position: static;
  }
}

@media (max-width: 620px) {
  .project-panel {
    padding: 14px;
  }
}

/* Unified light workspace theme shared with the AI home. */
:root {
  color-scheme: light;
  --navy-950: var(--workspace-action, #25292c);
  --navy-900: #2d3236;
  --navy-800: #f1f2f1;
  --blue-700: #1d5fbd;
  --blue-600: #256ed7;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --ink: var(--workspace-ink, #202326);
  --muted: #656b70;
  --subtle: #8b9196;
  --line: var(--workspace-border, #e5e5e2);
  --line-strong: var(--workspace-border-strong, #d3d5d2);
  --surface: var(--workspace-bg, #fff);
  --surface-alt: var(--workspace-surface-muted, #f5f5f3);
  --canvas: var(--workspace-bg, #fff);
  --green: #21865f;
  --green-bg: #e9f7f0;
  --amber: #a46512;
  --amber-bg: #fff6e6;
  --red: #b34242;
  --red-bg: #fff0f0;
  --purple: #7357b3;
  --purple-bg: #f3efff;
  --shadow-sm: 0 1px 2px rgba(20, 28, 34, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 28, 34, 0.08);
  --radius-sm: 7px;
  --radius: 9px;
  --radius-lg: 11px;
}

html,
body {
  color: var(--ink);
  background: var(--canvas);
}

dialog {
  box-shadow: 0 24px 64px rgba(20, 28, 34, 0.18);
}

* {
  scrollbar-color: #c5c9c7 transparent;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #c5c9c7;
  border-color: transparent;
}

.app-header {
  min-height: 52px;
  padding: 0 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand {
  min-width: 0;
  padding: 2px 5px;
  border-radius: 7px;
}

.brand:hover {
  background: #f0f0ee;
}

.app-header .mepos-brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  width: 96px;
}

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

.connection-state,
.collab-header-button {
  color: var(--muted);
  background: #f7f7f5;
  border-color: var(--line);
}

.collab-header-button:hover {
  color: var(--ink);
  background: #ececea;
  border-color: var(--line-strong);
}

.collab-avatar {
  color: #fff;
  background: #3976c7;
}

.page-frame,
.project-shell {
  width: min(1500px, calc(100% - 40px));
}

.button-secondary,
.icon-button,
.entity-action,
.collab-mini-button,
.collab-link-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line-strong);
}

.button-secondary:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.entity-action:hover:not(:disabled) {
  color: var(--ink);
  background: #f2f2f0;
  border-color: #b9bfbc;
}

.portfolio-tools,
.table-tools,
.registration-mode,
.segmented-control,
.collab-auth-tabs,
.collab-admin-tabs,
.project-sidebar,
.project-panel,
.content-card,
.building-card,
.collection-card,
.hierarchy-drawing,
.version-item,
.conflict-panel,
.dialog-content,
.collab-dialog,
.confirm-dialog,
.collab-section,
.collab-company-card,
.collab-company-summary-card,
.collab-company-work-panel,
.collab-list-item,
.collab-member-row,
.collab-company-message,
.collab-company-todo,
.collab-company-note-editor {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

/* The workspace is permanently light. Keep every native project and
 * collaboration form control on the same neutral surface even when an older
 * engineering-theme rule appears earlier in the cascade. */
.search-field input,
.select-field select,
.form-field input,
.form-field select,
.form-field textarea,
.collab-field input,
.collab-field select,
.collab-field textarea,
.collab-company-composer textarea,
.collab-company-todo-fields input,
.collab-company-todo-fields select {
  color: var(--ink);
  caret-color: var(--ink);
  color-scheme: light;
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: none;
}

.search-field input:hover:not(:disabled),
.select-field select:hover:not(:disabled),
.form-field input:hover:not(:disabled),
.form-field select:hover:not(:disabled),
.form-field textarea:hover:not(:disabled),
.collab-field input:hover:not(:disabled),
.collab-field select:hover:not(:disabled),
.collab-field textarea:hover:not(:disabled),
.collab-company-composer textarea:hover:not(:disabled),
.collab-company-todo-fields input:hover:not(:disabled),
.collab-company-todo-fields select:hover:not(:disabled) {
  border-color: #b9bfbc;
}

.search-field input:focus,
.select-field select:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.collab-field input:focus,
.collab-field select:focus,
.collab-field textarea:focus,
.collab-company-composer textarea:focus,
.collab-company-todo-fields input:focus,
.collab-company-todo-fields select:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 110, 215, 0.1);
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled,
.form-field input[readonly],
.collab-field input:disabled,
.collab-field select:disabled,
.collab-field textarea:disabled,
.collab-company-todo-fields input:disabled,
.collab-company-todo-fields select:disabled {
  color: var(--muted);
  background: var(--surface-alt);
  border-color: var(--line);
  opacity: 1;
}

.form-field input::placeholder,
.form-field textarea::placeholder,
.collab-field input::placeholder,
.collab-field textarea::placeholder,
.collab-company-composer textarea::placeholder,
.collab-company-todo-fields input::placeholder {
  color: var(--subtle);
  opacity: 1;
}

.project-card,
.metric-card,
.empty-state,
.compact-empty,
.hierarchy-empty,
.collab-empty,
.collab-loading,
.collab-error-state {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.project-card:hover {
  border-color: #b9c9dd;
  box-shadow: 0 6px 18px rgba(20, 28, 34, 0.08);
}

.project-tabs button,
.segmented-control button,
.collab-auth-tabs button,
.collab-admin-tabs button {
  color: var(--muted);
  background: transparent;
}

.project-tabs button:hover,
.segmented-control button:hover,
.collab-auth-tabs button:hover,
.collab-admin-tabs button:hover {
  color: var(--ink);
  background: #f2f2f0;
}

.project-tabs button[aria-selected="true"],
.segmented-control button[aria-pressed="true"],
.collab-auth-tabs button[aria-selected="true"],
.collab-admin-tabs button[aria-selected="true"] {
  color: #174f9d;
  background: #edf4ff;
}

.data-table-wrap {
  background: #fff;
  border-color: var(--line);
}

.data-table th {
  color: var(--muted);
  background: #f7f7f5;
  border-color: var(--line);
}

.data-table td {
  color: var(--ink);
  border-color: var(--line);
}

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

.toast,
.collab-live-message {
  color: var(--ink);
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.opa-root {
  --opa-bg: #ffffff;
  --opa-surface: #f7f7f5;
  --opa-surface-raised: #ffffff;
  --opa-hover: #f0f0ee;
  --opa-ink: #202326;
  --opa-muted: #6d7479;
  --opa-subtle: #8b9196;
  --opa-line: #e2e4e3;
  --opa-line-strong: #cfd3d1;
  --opa-accent: #7357b3;
}

.opa-panel {
  box-shadow: -8px 0 24px rgba(20, 28, 34, 0.09);
}

.opa-panel-toggle,
.opa-send-button,
.opa-new-chat {
  color: #fff;
  background: #7357b3;
  border-color: #7357b3;
}

.opa-brand-mark,
.opa-message-tool,
.opa-response-kind,
.opa-load-job-badge {
  color: #5e468f;
  background: #f3efff;
  border-color: #d8cdf0;
}

@media (max-width: 820px) {
  .app-header {
    padding-inline: 10px;
  }

  .app-header .mepos-brand-logo {
    width: 88px;
  }
}

/* Quiet project index: compact controls and one scannable row per real project. */
body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .app-header {
  display: none;
}

body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) #mainContent,
body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) #portfolioView {
  min-height: 100dvh;
  background: #fff;
}

#portfolioView .portfolio-page-frame {
  width: min(780px, calc(100% - 48px));
  padding: 76px 0 64px;
}

#portfolioView .portfolio-heading {
  align-items: center;
  gap: 24px;
}

#portfolioView .portfolio-heading-copy {
  flex: 1 1 auto;
}

#portfolioView .portfolio-heading h1 {
  color: #202326;
  font-size: 26px;
  font-weight: var(--workspace-font-weight-medium, 500);
  letter-spacing: -0.035em;
}

#portfolioView .portfolio-heading-actions,
#portfolioView .portfolio-secondary-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

#portfolioView .portfolio-search {
  flex: 0 1 230px;
  width: 230px;
}

#portfolioView .portfolio-search input {
  height: 34px;
  padding: 6px 12px 6px 35px;
  color: #202326;
  background: #fff;
  border-color: #dedfdd;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: none;
}

#portfolioView .portfolio-search input:focus {
  border-color: #aeb3b0;
  box-shadow: 0 0 0 2px rgba(37, 110, 215, 0.1);
}

#portfolioView .portfolio-search svg {
  left: 12px;
  width: 15px;
  height: 15px;
  color: #858b88;
}

#portfolioView #createProjectButton {
  min-height: 34px;
  padding: 6px 14px;
  color: #fff;
  background: #202326;
  border-color: #202326;
  border-radius: 999px;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
  white-space: nowrap;
}

#portfolioView #createProjectButton:hover:not(:disabled) {
  background: #050606;
  border-color: #050606;
}

#portfolioView #createProjectButton svg {
  width: 14px;
  height: 14px;
  margin-right: 5px;
}

#portfolioView .portfolio-tools {
  justify-content: space-between;
  margin: 42px 0 22px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#portfolioView .segmented-control {
  gap: 4px;
  padding: 0;
  background: transparent;
  border: 0;
}

#portfolioView .segmented-control button {
  min-height: 32px;
  padding: 6px 12px;
  color: #707571;
  border-radius: 999px;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

#portfolioView .segmented-control button:hover {
  color: #202326;
  background: #f3f3f1;
}

#portfolioView .segmented-control button[aria-pressed="true"] {
  color: #202326;
  background: #f0f0ee;
  box-shadow: none;
  font-weight: var(--workspace-font-weight-regular, 400);
}

#portfolioView .select-field select {
  min-width: 112px;
  height: 32px;
  padding: 5px 30px 5px 10px;
  color: #606662;
  background: #fff;
  border-color: #e0e2df;
  border-radius: 7px;
  font-size: 11px;
}

#portfolioView .icon-button {
  flex-basis: 32px;
  width: 32px;
  height: 32px;
  color: #646a66;
  background: #fff;
  border-color: #e0e2df;
  border-radius: 7px;
}

#portfolioView .portfolio-summary {
  min-height: 16px;
  margin: 0 0 10px;
  padding-inline: 2px;
  color: #8a908c;
  font-size: 11px;
}

#portfolioView .project-list-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px 132px 22px;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  color: #8a908c;
  border-bottom: 1px solid #e7e8e6;
  font-size: 11px;
}

#portfolioView .project-grid,
#portfolioView .project-skeleton-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

#portfolioView .project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px 132px 22px;
  align-items: center;
  min-height: 62px;
  padding: 9px 12px;
  overflow: visible;
  color: #202326;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #eceeeb;
  border-radius: 0;
  box-shadow: none;
  transition: background-color 0.14s ease;
}

#portfolioView .project-card::before {
  content: none;
}

#portfolioView .project-card:hover {
  color: #202326;
  background: #f7f7f5;
  border-color: #eceeeb;
  box-shadow: none;
  transform: none;
}

#portfolioView .project-card:focus-visible {
  border-color: #d9e1ec;
  border-radius: 8px;
  outline: 2px solid rgba(37, 110, 215, 0.28);
  outline-offset: -2px;
  box-shadow: none;
}

#portfolioView .project-card-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

#portfolioView .project-card-icon {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #4f5652;
  background: #fff;
  border: 1px solid #dfe2df;
  border-radius: 8px;
}

#portfolioView .project-card-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.65;
}

#portfolioView .project-card-copy {
  min-width: 0;
}

#portfolioView .project-card h2 {
  overflow: hidden;
  margin: 0;
  color: #202326;
  font-size: 13px;
  font-weight: var(--workspace-font-weight-medium, 500);
  letter-spacing: -0.015em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#portfolioView .project-card-details {
  overflow: hidden;
  margin: 3px 0 0;
  color: #8a908c;
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#portfolioView .project-card-status {
  display: flex;
  align-items: center;
}

#portfolioView .project-card .status-badge {
  min-height: 20px;
  padding: 2px 7px;
  border: 0;
  border-radius: 999px;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

#portfolioView .project-card-updated {
  color: #707671;
  font-size: 11px;
  white-space: nowrap;
}

#portfolioView .project-card-chevron {
  display: grid;
  place-items: center;
  color: #a1a6a2;
}

#portfolioView .project-card-chevron svg {
  width: 15px;
  height: 15px;
}

#portfolioView .project-skeleton {
  min-height: 62px;
  margin: 0;
  background: linear-gradient(90deg, #f2f3f1 25%, #fafafa 50%, #f2f3f1 75%);
  background-size: 200% 100%;
  border-bottom: 1px solid #eceeeb;
  border-radius: 0;
}

#portfolioView .empty-state {
  min-height: 300px;
  padding: 32px;
  color: #717773;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#portfolioView .empty-state.compact {
  min-height: 220px;
}

#portfolioView .empty-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  color: #626864;
  background: #f1f2f0;
  border-radius: 10px;
}

#portfolioView .empty-state h2 {
  color: #303431;
  font-size: 15px;
}

#portfolioView .empty-state p {
  font-size: 12px;
}

@media (max-width: 760px) {
  #portfolioView .portfolio-page-frame {
    width: min(100% - 28px, 780px);
    padding-top: 32px;
  }

  #portfolioView .portfolio-heading {
    display: grid;
    gap: 18px;
  }

  #portfolioView .portfolio-heading-actions {
    width: 100%;
  }

  #portfolioView .portfolio-search {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
  }

  #portfolioView #createProjectButton {
    width: auto;
  }

  #portfolioView .portfolio-tools {
    align-items: flex-start;
    margin-top: 28px;
  }

  #portfolioView .segmented-control {
    width: auto;
    grid-template-columns: none;
  }

  #portfolioView .project-list-header,
  #portfolioView .project-card {
    grid-template-columns: minmax(0, 1fr) 22px;
  }

  #portfolioView .project-list-header span:nth-child(2),
  #portfolioView .project-list-header span:nth-child(3),
  #portfolioView .project-card-status,
  #portfolioView .project-card-updated {
    display: none;
  }
}

@media (max-width: 520px) {
  #portfolioView .portfolio-heading-actions,
  #portfolioView .portfolio-tools {
    align-items: stretch;
    flex-direction: column;
  }

  #portfolioView #createProjectButton {
    width: 100%;
  }

  #portfolioView .segmented-control {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #portfolioView .portfolio-secondary-tools,
  #portfolioView .select-field,
  #portfolioView .select-field select {
    width: 100%;
  }
}

/* GPT-style project detail: one quiet reading column with information and sources. */
body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) #projectView {
  min-height: 100dvh;
  color: #202326;
  background: #fff;
}

#projectView .project-shell {
  width: min(780px, calc(100% - 48px));
  padding: 76px 0 64px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

#projectView .detail-skeleton,
#projectView .project-simple-layout {
  display: block;
}

/* Keep the async project hand-off visually continuous with the white project
 * index.  The legacy engineering theme used full-height navy placeholders,
 * which read as a black page flash while the project requests were pending. */
#projectView .detail-skeleton {
  display: grid;
  width: min(100%, 780px);
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 2px 0;
}

#projectView .detail-skeleton > div {
  min-height: 0;
  background: linear-gradient(90deg, #f1f2f0 25%, #f7f7f5 50%, #f1f2f0 75%);
  background-size: 180% 100%;
  border-radius: 6px;
  animation: project-detail-placeholder 1.8s ease-in-out infinite;
}

#projectView .detail-skeleton > div:first-child {
  grid-row: auto;
  width: min(44%, 310px);
  min-height: 28px;
}

#projectView .detail-skeleton > div:nth-child(2) {
  width: min(24%, 168px);
  min-height: 30px;
  margin-top: 12px;
  border-radius: 999px;
}

#projectView .detail-skeleton > div:nth-child(3) {
  width: 100%;
  min-height: 92px;
}

@keyframes project-detail-placeholder {
  from { background-position: 100% 0; }
  to { background-position: -80% 0; }
}

@media (prefers-reduced-motion: reduce) {
  #projectView .detail-skeleton > div {
    animation: none;
    background: #f1f2f0;
  }
}

#projectView .project-simple-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin: 0 0 28px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#projectView .project-back-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 5px;
  margin: 0 0 18px;
  padding: 4px 5px 4px 1px;
  color: #747b78;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: var(--workspace-font-weight-regular, 400);
  letter-spacing: -0.015em;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

#projectView .project-back-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

#projectView .project-back-button:hover {
  color: #202326;
  background: #f3f3f1;
}

#projectView .project-back-button:focus-visible {
  outline: 2px solid rgba(53, 105, 212, 0.28);
  outline-offset: 2px;
}

#projectView .project-simple-title-icon {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #3f4541;
}

#projectView .project-simple-title-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.55;
}

#projectView #projectTitle {
  overflow: hidden;
  margin: 0;
  color: #202326;
  font-size: 26px;
  font-weight: var(--workspace-font-weight-medium, 500);
  letter-spacing: -0.035em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#projectView .project-layout,
#projectView .project-simple-body {
  display: block;
}

#projectView .project-sidebar {
  display: flex;
  position: static;
  top: auto;
  width: auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 0;
  overflow: visible;
  color: #202326;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#projectView .project-simple-tabs {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 3px;
  margin: 0;
  padding: 3px;
  background: #f3f3f1;
  border: 0;
  border-radius: 999px;
}

#projectView .project-simple-tabs button {
  display: inline-flex;
  min-width: 62px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  color: #727773;
  background: transparent;
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
  line-height: 1.25;
}

#projectView .project-simple-tabs button:hover {
  color: #202326;
  background: rgba(255, 255, 255, 0.66);
}

#projectView .project-simple-tabs button[aria-selected="true"],
#projectView .project-simple-tabs button[aria-current="page"] {
  color: #202326;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 28, 34, 0.1);
  font-weight: var(--workspace-font-weight-medium, 500);
}

#projectView .project-main {
  min-width: 0;
}

#projectView .project-simple-panel {
  min-height: 0;
  margin: 0;
  padding: 0;
  color: #202326;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#projectView .project-info-lead {
  padding: 23px 0 22px;
  border-bottom: 1px solid #e7e8e6;
}

#projectView .project-info-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#projectView .project-info-edit-hint {
  margin: 8px 0 0;
  color: #555b57;
  font-size: 0.82rem;
}

#projectView .project-info-lead .status-badge {
  min-height: 21px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

#projectView .project-info-description {
  max-width: 680px;
  margin: 13px 0 0;
  color: #555b57;
  font-size: 13px;
  font-weight: var(--workspace-font-weight-regular, 400);
  line-height: 1.65;
  white-space: pre-wrap;
}

#projectView .project-info-list {
  margin: 0;
  padding: 0;
}

#projectView .project-info-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 24px;
  margin: 0;
  padding: 16px 2px;
  border-bottom: 1px solid #eceeeb;
}

#projectView .project-info-row dt,
#projectView .project-info-row dd {
  margin: 0;
  line-height: 1.5;
}

#projectView .project-info-row dt {
  color: #858b87;
  font-size: 11px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

#projectView .project-info-row dd {
  min-width: 0;
  color: #303431;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
  overflow-wrap: anywhere;
}

#projectView .project-source-group + .project-source-group {
  margin-top: 38px;
}

#projectView .project-source-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 10px;
  padding: 0 2px;
}

#projectView .project-source-heading h2 {
  margin: 0;
  color: #303431;
  font-size: 13px;
  font-weight: var(--workspace-font-weight-medium, 500);
  letter-spacing: -0.015em;
}

#projectView .project-source-heading-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

#projectView .project-source-count {
  color: #8a908c;
  font-size: 11px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

#projectView .project-source-add-control {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
}

#projectView .project-source-add-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  color: #fff;
  background: #25292d;
  border: 1px solid #25292d;
  border-radius: 9px;
  box-shadow: none;
  font: inherit;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
  letter-spacing: -0.015em;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

#projectView .project-source-add-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

#projectView .project-source-add-button:hover:not(:disabled),
#projectView .project-source-add-button[aria-expanded="true"] {
  background: #15181b;
  border-color: #15181b;
}

#projectView .project-source-add-button:focus-visible {
  outline: 2px solid rgba(40, 100, 220, 0.3);
  outline-offset: 2px;
}

#projectView .project-source-add-button:disabled {
  color: #9ca19e;
  background: #eff0ee;
  border-color: #e2e4e1;
  cursor: not-allowed;
}

#projectView .project-source-add-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 238px;
  padding: 6px;
  background: #fff;
  border: 1px solid #e1e3e0;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(22, 28, 25, 0.12);
}

#projectView .project-source-add-menu button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  color: #292d2a;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#projectView .project-source-add-menu button:hover:not(:disabled),
#projectView .project-source-add-menu button:focus-visible {
  background: #f3f3f1;
  outline: none;
}

#projectView .project-source-add-menu button:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(40, 100, 220, 0.24);
}

#projectView .project-source-add-menu button:disabled {
  color: #a2a7a3;
  cursor: not-allowed;
}

#projectView .project-source-add-menu-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #59605b;
  background: #f5f5f3;
  border: 1px solid #e1e3e0;
  border-radius: 8px;
}

#projectView .project-source-add-menu button:disabled .project-source-add-menu-icon {
  color: #a5aaa6;
  background: #f8f8f7;
}

#projectView .project-source-add-menu-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

#projectView .project-source-add-menu-copy {
  display: block;
  min-width: 0;
}

#projectView .project-source-add-menu-copy strong,
#projectView .project-source-add-menu-copy small {
  display: block;
}

#projectView .project-source-add-menu-copy strong {
  color: inherit;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-medium, 500);
  line-height: 1.35;
}

#projectView .project-source-add-menu-copy small {
  margin-top: 2px;
  color: #858b87;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
  line-height: 1.4;
}

#projectView .project-source-add-menu button:disabled .project-source-add-menu-copy small {
  color: #a2a7a3;
}

#projectView .project-source-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid #e7e8e6;
}

#projectView .project-source-building {
  margin: 0;
  border-bottom: 1px solid #eceeeb;
}

#projectView .project-source-building-group { position: relative; min-width: 0; }
#projectView .project-source-building-group.has-management > details > .project-source-building-summary { padding-right: 46px; }
#projectView .project-source-building-group > .entity-management-menu { position: absolute; top: 14px; right: 4px; }
#projectView .project-source-building-group > .entity-management-menu[open] { z-index: 31; }
#projectView .project-source-building-group > .entity-management-menu > summary {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
}
#projectView .project-source-building-group .entity-management-options {
  min-width: 190px;
  max-width: calc(100vw - 48px);
  border-radius: 8px;
}

#projectView .project-source-building-group .entity-management-options .entity-action {
  background: transparent;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
}

#projectView .project-source-building-group .entity-management-options .entity-action:hover,
#projectView .project-source-building-group .entity-management-options .entity-action:focus-visible {
  background: #f0f3f1;
}

#projectView .project-source-building-group .entity-management-options .entity-action-danger {
  color: #a43930;
}

#projectView .project-source-building-summary {
  display: flex;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  gap: 12px;
  padding: 12px 4px 12px 2px;
  color: inherit;
  cursor: pointer;
  list-style: none;
}

#projectView .project-source-building-summary::-webkit-details-marker {
  display: none;
}

#projectView .project-source-building-summary:hover {
  background: #f8f8f6;
}

#projectView .project-source-building-summary:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid rgba(40, 100, 220, 0.34);
  outline-offset: 2px;
}

#projectView .project-source-building-count {
  flex: 0 0 auto;
  color: #7f8681;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
  white-space: nowrap;
}

#projectView .project-source-toggle-mark {
  display: grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #767d78;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 140ms ease;
}

#projectView .project-source-building[open] > .project-source-building-summary {
  background: #fafaf8;
  border-bottom: 1px solid #eceeeb;
}

#projectView .project-source-building[open] > .project-source-building-summary .project-source-toggle-mark {
  transform: rotate(90deg);
}

#projectView .project-source-building-drawings {
  padding: 0 0 4px 46px;
  background: #fcfcfb;
}

#projectView .building-management-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
}

#projectView .building-action {
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  color: #68716b;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

#projectView .building-action:hover:not(:disabled) {
  color: #293f32;
  background: #edf1ed;
}

#projectView .building-action-danger { color: #9c6863; }
#projectView .building-action-danger:hover:not(:disabled) { color: #a43930; background: #fbefed; }
#projectView .building-action:disabled { opacity: .5; cursor: wait; }
#projectView .building-action:focus-visible { outline: 2px solid #567765; outline-offset: 2px; }

#projectView .project-source-building-drawings .project-source-row {
  min-height: 56px;
  padding-right: 10px;
  padding-left: 8px;
}

#projectView .project-source-building-drawings .project-source-row:last-child {
  border-bottom: 0;
}

#projectView .project-source-row {
  display: flex;
  min-width: 0;
  min-height: 60px;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 11px 2px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #eceeeb;
  border-radius: 0;
  box-shadow: none;
  text-decoration: none;
}

#projectView button.project-source-row,
#projectView a.project-source-row {
  cursor: pointer;
}

#projectView a.project-source-row:hover,
#projectView button.project-source-row:hover {
  background: #f8f8f6;
}

#projectView a.project-source-row:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid rgba(40, 100, 220, 0.34);
  outline-offset: -2px;
}

#projectView .project-source-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #565d58;
  background: #f6f6f4;
  border: 1px solid #e0e2df;
  border-radius: 8px;
}

#projectView .project-source-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.55;
}

#projectView .project-source-copy {
  min-width: 0;
  flex: 1 1 auto;
}

#projectView .project-source-title {
  display: block;
  overflow: hidden;
  margin: 0;
  color: #292d2a;
  font-size: 13px;
  font-weight: var(--workspace-font-weight-medium, 500);
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#projectView .project-source-meta {
  display: block;
  overflow: hidden;
  margin: 3px 0 0;
  color: #898f8b;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#projectView .project-source-row[data-archived="true"] {
  opacity: 0.68;
}

#projectView .project-source-state {
  flex: 0 0 auto;
  color: #8a908c;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
}

#projectView .project-source-viewer-state {
  flex: 0 0 auto;
  color: #4f6fae;
  font-size: 10px;
  font-weight: var(--workspace-font-weight-regular, 400);
  white-space: nowrap;
}

#projectView .project-source-drawing-row {
  gap: 8px;
  padding: 0 2px;
}

.drawing-pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid #e9e9e5;
  font-size: 13px;
}
.drawing-pdf-toolbar[hidden] { display: none; }
.drawing-pdf-toolbar label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.drawing-selection-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.drawing-selection-actions .button { white-space: normal; }
.drawing-pdf-checkbox, #drawingPdfSelectAll { width: 16px; height: 16px; flex-shrink: 0; accent-color: #365747; }
#drawingPdfDialog { width: min(640px, calc(100vw - 32px)); }
.drawing-pdf-body { padding: 0 24px; }
.drawing-pdf-body .field { display: grid; gap: 8px; font-size: 13px; }
.drawing-pdf-body select { width: 100%; padding: 10px 12px; border: 1px solid #dcded9; border-radius: 6px; background: white; font: inherit; }
#drawingPdfHelp, #drawingPdfMessage { color: #646861; font-size: 13px; line-height: 1.6; }
.drawing-pdf-progress { max-height: 35vh; overflow: auto; padding-left: 26px; }
.drawing-pdf-progress li { padding: 8px 0; }
.drawing-pdf-progress strong, .drawing-pdf-progress span { display: block; overflow-wrap: anywhere; }
.drawing-pdf-progress span { color: #646861; font-size: 12px; margin-top: 4px; }

/* Size the form body from the dialog's available space, including wrapped
 * headers/footers. Viewport-based body heights can exceed the outer 860px cap. */
body > dialog[open]:has(> .dialog-heading),
body > dialog[open]:has(> form > .dialog-heading) {
  display: flex;
  flex-direction: column;
  max-height: min(860px, calc(100vh - 32px));
  max-height: min(860px, calc(100dvh - 32px));
  overflow: hidden;
}

body > dialog > form:has(> .dialog-content) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
  overflow: hidden;
}

body > dialog[open] > :is(.dialog-content, .collab-dialog-body, .drawing-pdf-body),
body > dialog[open] > form > .dialog-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body > dialog[open] > :is(.dialog-heading, .dialog-actions, .collab-dialog-footer),
body > dialog[open] > form > :is(.dialog-heading, .dialog-actions) {
  flex: 0 0 auto;
}

#projectView .project-source-drawing-link {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 60px;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  color: inherit;
  text-decoration: none;
}

#projectView a.project-source-drawing-link:hover {
  background: #f8f8f6;
}

#projectView .project-source-delete {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  margin-right: 2px;
  padding: 0;
  color: #858b87;
  background: transparent;
  border: 0;
  border-radius: 7px;
  box-shadow: none;
  cursor: pointer;
}

#projectView .project-source-delete:hover:not(:disabled) {
  color: #b04343;
  background: #fbefef;
}

#projectView a.project-source-drawing-link:focus-visible,
#projectView .project-source-delete:focus-visible {
  outline: 2px solid rgba(40, 100, 220, 0.34);
  outline-offset: -2px;
}

#projectView .project-source-delete:disabled {
  opacity: 0.45;
  cursor: wait;
}

#projectView .project-source-drawing-row[data-viewer-ready="false"] {
  color: #949a96;
  cursor: default;
}

#projectView .project-source-drawing-row[data-viewer-ready="false"] .project-source-viewer-state {
  color: #9ca19e;
  font-weight: var(--workspace-font-weight-regular, 400);
}

@media (prefers-reduced-motion: reduce) {
  #projectView .project-source-toggle-mark {
    transition: none;
  }
}

#projectView .project-source-empty {
  margin: 0;
  padding: 30px 4px;
  color: #969c98;
  border-bottom: 1px solid #eceeeb;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
  text-align: center;
}

/* Project-list actions live beside the navigation link so the whole row stays valid. */
#portfolioView .project-list-header,
#portfolioView .project-card {
  grid-template-columns: minmax(0, 1fr) 104px 132px 36px;
}

#portfolioView .project-card-row {
  position: relative;
  min-width: 0;
}

#portfolioView .project-card-row > .project-card-link {
  width: 100%;
}

#portfolioView .project-card-actions {
  position: absolute;
  z-index: 4;
  top: 50%;
  right: 9px;
  margin: 0;
  transform: translateY(-50%);
}

#portfolioView .project-card-actions[open] {
  z-index: 20;
}

#portfolioView .project-card-menu-trigger {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  color: #777d79;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  list-style: none;
}

#portfolioView .project-card-menu-trigger::-webkit-details-marker {
  display: none;
}

#portfolioView .project-card-menu-trigger:hover,
#portfolioView .project-card-actions[open] .project-card-menu-trigger {
  color: #202326;
  background: #eceeeb;
}

#portfolioView .project-card-menu-trigger:focus-visible {
  outline: 2px solid rgba(37, 110, 215, 0.3);
  outline-offset: 1px;
}

#portfolioView .project-card-menu-trigger svg {
  width: 16px;
  height: 16px;
}

#portfolioView .project-card-menu-trigger circle {
  fill: currentColor;
  stroke: none;
}

#portfolioView .project-card-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  width: max-content;
  min-width: 126px;
  padding: 5px;
  background: #fff;
  border: 1px solid #dedfdd;
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(20, 28, 34, 0.12);
}

#portfolioView .project-card-menu-item {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  padding: 6px 9px;
  color: #3f4541;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: var(--workspace-font-weight-regular, 400);
  text-align: left;
  white-space: nowrap;
}

#portfolioView .project-card-menu-item:hover:not(:disabled) {
  color: #202326;
  background: #f2f2f0;
}

#portfolioView .project-card-menu-item.is-danger {
  color: #9b4747;
}

#portfolioView .project-card-menu-item.is-danger:hover:not(:disabled) {
  color: #813737;
  background: #fff3f3;
}

#portfolioView .project-card-menu-item:disabled {
  color: #a4a9a6;
  cursor: default;
}

/* Keep the quieter type hierarchy consistent between the index and detail. */
#portfolioView .portfolio-heading h1 {
  font-weight: var(--workspace-font-weight-medium, 500);
}

#portfolioView #createProjectButton {
  font-weight: var(--workspace-font-weight-regular, 400);
}

#portfolioView .segmented-control button,
#portfolioView .project-card h2,
#portfolioView .project-card .status-badge {
  font-weight: var(--workspace-font-weight-medium, 500);
}

#portfolioView .project-card-details,
#portfolioView .project-card-updated {
  font-weight: var(--workspace-font-weight-regular, 400);
}

@media (max-width: 760px) {
  #projectView .project-shell {
    width: min(100% - 28px, 780px);
    padding-top: 34px;
  }

  #projectView #projectTitle {
    font-size: 22px;
  }

  #portfolioView .project-list-header,
  #portfolioView .project-card {
    grid-template-columns: minmax(0, 1fr) 36px;
  }
}

@media (max-width: 520px) {
  #projectView .project-info-row {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
  }

  #projectView .project-sidebar {
    flex-wrap: wrap;
  }

  #projectView .project-simple-tabs,
  #projectView .project-simple-tabs button {
    width: 100%;
  }

  #projectView .project-simple-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #projectView .project-source-building-drawings {
    padding-left: 14px;
  }

  #projectView .project-source-building-count {
    display: none;
  }

  #projectView .project-source-heading {
    align-items: flex-start;
  }

  #projectView .project-source-heading-copy {
    flex-wrap: wrap;
    padding-top: 8px;
  }

  #projectView .building-action,
  #projectView .project-info-toolbar .button,
  #projectView .project-source-building-group .entity-action {
    min-height: 44px;
  }

  #projectView .project-source-building-group > .entity-management-menu { top: 10px; right: 2px; }
  #projectView .project-source-building-group > .entity-management-menu > summary { width: 44px; height: 44px; }
  #projectView .project-source-building-group.has-management > details > .project-source-building-summary { padding-right: 50px; }
  #projectView .project-source-row:has(> .building-management-actions) { flex-wrap: wrap; }

  #projectView .project-source-add-menu {
    width: min(238px, calc(100vw - 40px));
  }

}

/* Persistent shell outlet: Viewer and Load remain mounted while the shared
 * navigation rail switches between them. */
#workspaceView[hidden],
.workspace-surface[hidden] {
  display: none !important;
}

.workspace-view {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  overflow: hidden;
  background: var(--workspace-bg, #fff);
}

.workspace-surface {
  position: absolute;
  inset: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--workspace-bg, #fff);
}

.workspace-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  visibility: hidden;
  background: var(--workspace-bg, #fff);
  border: 0;
}

.workspace-frame.is-ready {
  visibility: visible;
}

.workspace-frame-loading {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #747b80;
  background: var(--workspace-bg, #fff);
  font-size: 12px;
}

.workspace-frame-loading[hidden] {
  display: none;
}

.workspace-frame-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #d7dadd;
  border-top-color: #4e5962;
  border-radius: 50%;
  animation: workspace-frame-spin .8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .workspace-frame-spinner {
    animation: none;
    border-top-color: #d7dadd;
  }
}

/* The portfolio doubles as the required first-login project picker. It is
 * intentionally card based so choosing the active project is the only primary
 * decision on this screen. */
body.project-selection-required #portfolioView .portfolio-page-frame {
  width: min(920px, calc(100% - 48px));
  padding-top: 84px;
}

body.project-selection-required #portfolioView .portfolio-heading {
  align-items: flex-start;
  margin-bottom: 34px;
}

body.project-selection-required #portfolioView .portfolio-heading h1 {
  font-size: 28px;
  font-weight: var(--workspace-font-weight-medium, 500);
}

#portfolioView .portfolio-intro {
  max-width: 520px;
  margin: 9px 0 0;
  color: #7b828d;
  font-size: 13px;
  font-weight: var(--workspace-font-weight-regular, 400);
  line-height: 1.6;
}

body.project-selection-required #portfolioView .portfolio-summary,
body.project-selection-required #portfolioView .project-list-header,
body.project-selection-required #portfolioView .project-card-actions {
  display: none !important;
}

body.project-selection-required #portfolioView .project-grid,
body.project-selection-required #portfolioView .project-skeleton-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

body.project-selection-required #portfolioView .project-card-row {
  min-height: 168px;
}

body.project-selection-required #portfolioView .project-card {
  display: flex;
  min-height: 168px;
  align-items: flex-start;
  flex-direction: column;
  padding: 20px;
  color: #202326;
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.035);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

body.project-selection-required #portfolioView .project-card:hover {
  background: #fff;
  border-color: #c9d2df;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.075);
  transform: translateY(-2px);
}

body.project-selection-required #portfolioView .project-card:focus-visible {
  border-color: #8ca8df;
  border-radius: 14px;
  outline: 3px solid rgba(40, 100, 220, 0.12);
  outline-offset: 2px;
}

body.project-selection-required #portfolioView .project-card-identity {
  width: 100%;
  align-items: flex-start;
  gap: 13px;
}

body.project-selection-required #portfolioView .project-card-icon {
  flex-basis: 40px;
  width: 40px;
  height: 40px;
  color: #3d4858;
  background: #f7f8fa;
  border-color: #e3e6eb;
  border-radius: 10px;
}

body.project-selection-required #portfolioView .project-card h2 {
  font-size: 15px;
  font-weight: var(--workspace-font-weight-medium, 500);
  line-height: 1.45;
  white-space: normal;
}

body.project-selection-required #portfolioView .project-card-details {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: #858c97;
  font-size: 11px;
  line-height: 1.5;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.project-selection-required #portfolioView .project-card-status {
  margin-top: auto;
  padding-top: 20px;
}

body.project-selection-required #portfolioView .project-card-updated {
  margin-top: 7px;
  color: #969ca5;
  font-size: 10px;
}

body.project-selection-required #portfolioView .project-skeleton {
  min-height: 168px;
  border: 1px solid #eceef1;
  border-radius: 14px;
}

@media (max-width: 760px) {
  body.project-selection-required #portfolioView .portfolio-page-frame {
    width: min(100% - 28px, 920px);
    padding-top: 36px;
  }

  body.project-selection-required #portfolioView .portfolio-heading {
    margin-bottom: 26px;
  }

  body.project-selection-required #portfolioView .project-grid,
  body.project-selection-required #portfolioView .project-skeleton-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep project tools reachable without squeezing their embedded workspace.
 * Full-screen mobile conversations keep their existing history layout. */
@media (max-width: 680px) {
  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) {
    --global-workspace-sidebar-width: 56px;
  }

  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-sidebar-header {
    flex-direction: column;
    gap: 0;
    justify-content: center;
    min-height: 72px;
    padding: 10px 5px;
  }

  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-sidebar-brand {
    display: block;
    flex: 0 0 44px;
    height: 44px;
    overflow: hidden;
    padding: 6px;
    width: 44px;
  }

  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-sidebar-brand .mepos-brand-logo {
    clip-path: inset(0 calc(100% - 29px) 0 0);
    height: 31px;
    max-width: none;
    object-fit: initial;
    transform: translateX(2px);
    width: auto;
  }

  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-sidebar-navigation {
    gap: 4px;
    padding: 0 5px 12px;
  }

  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-navigation-button,
  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-new-chat {
    gap: 0;
    justify-content: center;
    min-height: 44px;
    padding: 8px;
  }

  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-navigation-button span,
  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-new-chat span,
  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-view-heading,
  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-history-list,
  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-sidebar-account-copy,
  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-sidebar-account-disclosure {
    display: none;
  }

  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-sidebar-account {
    margin-top: auto;
    padding: 8px 5px;
  }

  body.hub-ai-primary.opa-sidebar-visible:not(.opa-panel-open) .opa-primary-sidebar-account-button {
    gap: 0;
    justify-content: center;
    min-height: 44px;
    padding: 7px;
  }
}
.drawing-file-list {
  display: grid;
  gap: 12px;
}

.drawing-file-entry {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.drawing-file-heading {
  display: grid;
  gap: 4px;
  overflow-wrap: anywhere;
}

.drawing-file-heading small,
#drawingFileListSection > p {
  color: var(--muted);
  font-size: 12px;
}

#drawingFormError {
  white-space: pre-line;
}

.project-source-drawing-row > .button { flex-shrink: 0; font-size: .75rem; padding: .35rem .5rem; }
.project-source-building-drawings > .button { margin: .5rem 1rem; }
@media (max-width: 600px) {
  .project-source-drawing-row { flex-wrap: wrap; }
}

/* Compact project and building lifecycle menus. */
.entity-management-menu { position: relative; flex: 0 0 auto; }
.entity-management-menu > summary { cursor: pointer; list-style: none; padding: 6px 12px; border-radius: 8px; font-size: 22px; line-height: 1; }
.entity-management-menu > summary::-webkit-details-marker { display: none; }
.entity-management-menu > summary:hover, .entity-management-menu > summary:focus-visible { background: var(--color-surface-hover, #f0f3f5); }
.entity-management-options { position: absolute; z-index: 30; right: 0; top: 100%; min-width: 170px; padding: 6px; background: var(--color-surface, white); border: 1px solid #dce2e6; border-radius: 10px; box-shadow: 0 8px 24px #17212b18; }
.entity-management-options .entity-action { display: block; width: 100%; text-align: left; white-space: nowrap; padding: 9px 12px; }
.project-card-row > .entity-management-menu { position: absolute; top: 50%; right: 9px; transform: translateY(-50%); z-index: 4; }
body.project-selection-required .project-card-row > .entity-management-menu { top: 14px; transform: none; }
#projectManageActions { margin-left: auto; }
#projectLifecycleHint { margin: 0 0 16px; }
[hidden] { display: none !important; }
