/* Blueprint AI · Workshop Management System Extensions (P1-P4) */

/* Narrow collapsible navigation sidebar */
.nav-sidebar {
  width: 224px;
  min-width: 224px;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-sidebar);
  transition: width 0.18s ease, min-width 0.18s ease;
  flex-shrink: 0;
  z-index: 30;
}
.nav-sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}
.nav-sidebar.collapsed .nav-text,
.nav-sidebar.collapsed .brand-text-wrap,
.nav-sidebar.collapsed .user-text-wrap,
.nav-sidebar.collapsed .nav-badge {
  display: none;
}
.nav-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}
.nav-sidebar.collapsed .nav-brand-bar {
  flex-direction: column;
  justify-content: center;
  padding: 12px 8px;
  gap: 8px;
}
.nav-sidebar.collapsed .nav-brand-link {
  justify-content: center;
}
.nav-sidebar.collapsed .nav-user-box {
  justify-content: center;
  padding: 10px 6px;
}
.nav-brand-bar {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nav-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nav-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}
.nav-menu {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.14s, color 0.14s;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}
.nav-item.active {
  background: var(--bg-sidebar-active);
  color: #fff;
}
.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}
.nav-divider {
  height: 1px;
  background: #1e293b;
  margin: 8px 6px;
}
.nav-user-box {
  padding: 12px;
  border-top: 1px solid var(--border-sidebar);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.55);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #334155;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-text-wrap {
  min-width: 0;
  flex: 1;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role-line {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}
.logout-link {
  color: #94a3b8;
  font-size: 11px;
}
.logout-link:hover {
  color: #f87171;
}

/* Scrollable page workspace */
.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px 40px;
  background: var(--bg-app);
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  color: var(--text-primary);
}
.page-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Cards & Grid */
.ws-card {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.ws-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.ws-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
}
.kpi-card.kpi-alert {
  border-color: #fca5a5;
  background: #fff5f5;
}
.kpi-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}
.kpi-value {
  font-size: 27px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}
.kpi-card.kpi-alert .kpi-value {
  color: #dc2626;
}
.kpi-meta {
  font-size: 11.5px;
  color: #64748b;
}

.dash-grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 1080px) {
  .dash-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Status bar */
.status-bar-track {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
  margin-bottom: 10px;
}
.status-bar-seg {
  height: 100%;
  transition: width 0.25s;
}
.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}

/* Bar chart rows */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
}
.bar-label {
  width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #334155;
  font-weight: 500;
}
.bar-track {
  flex: 1;
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 999px;
}
.bar-fill.amber {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}
.bar-val {
  width: 42px;
  text-align: right;
  font-weight: 700;
  color: #0f172a;
}

/* Color Tag Pills */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag-pill.clickable {
  cursor: pointer;
}
.tag-pill.color-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.tag-pill.color-indigo { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.tag-pill.color-emerald { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag-pill.color-amber { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.tag-pill.color-rose { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.tag-pill.color-slate,
.tag-pill.color-muted { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.tag-pill.selected {
  background: #1d4ed8 !important;
  color: #fff !important;
  border-color: #1d4ed8 !important;
}
.tag-remove-x {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  opacity: 0.7;
}
.tag-remove-x:hover { opacity: 1; }

/* Tables */
.ws-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ws-table th {
  text-align: left;
  padding: 9px 10px;
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  white-space: nowrap;
}
.ws-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.ws-table tbody tr:hover {
  background: #f8fafc;
}

/* Forms & Modals */
.ws-input,
.ws-select,
.ws-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  font-family: inherit;
}
.ws-input:focus,
.ws-select:focus,
.ws-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
input[type="number"].ws-input::-webkit-outer-spin-button,
input[type="number"].ws-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"].ws-input {
  -moz-appearance: textfield;
  appearance: textfield;
}
.ws-input-num-compact {
  padding: 7px 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.step-time-pair {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 132px;
}
.step-time-pair .ws-input {
  flex: 1;
  min-width: 56px;
}
.step-time-sep {
  color: #94a3b8;
  font-size: 12px;
  flex-shrink: 0;
  user-select: none;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}
.ws-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 20px;
}
.ws-modal-backdrop.hidden {
  display: none;
}
.ws-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}
.ws-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ws-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ws-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f8fafc;
}

/* Dropzone */
.dropzone {
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

/* Sub-tabs */
.subtabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.subtab {
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subtab:hover { color: #0f172a; }
.subtab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* Part Viewer Header & File Strip */
.part-context-strip {
  background: #0f172a;
  color: #e2e8f0;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid #1e293b;
}
.part-context-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.part-file-tabs {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
}
.part-file-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
}
.part-file-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}
.part-file-tab.old-rev {
  opacity: 0.72;
  border-style: dashed;
}

/* AI Report Section Toggle Pills & Cards */
.ai-section-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.sec-toggle-pill {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  cursor: pointer;
}
.sec-toggle-pill.on {
  background: #eff6ff;
  border-color: #60a5fa;
  color: #1d4ed8;
  font-weight: 600;
}
.ai-sec-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fff;
  overflow: hidden;
}
.ai-sec-card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}
.ai-sec-card-body {
  padding: 10px 12px;
}
.ai-sec-card.collapsed .ai-sec-card-body {
  display: none;
}
.ai-precheck-banner {
  margin: 8px 12px 0;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 12px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
}
.ai-precheck-banner.danger {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}
.ai-attr-card {
  margin: 8px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  font-size: 12px;
}
.ai-attr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 10px;
  margin: 6px 0 8px;
}

/* Alert Banner */
.ws-alert {
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 14px;
}
.ws-alert.ok { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; }
.ws-alert.err { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.ws-alert.warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }

/* Part Studio Layout (P4) */
.studio-layout {
  display: grid;
  grid-template-columns: 270px 1fr 330px;
  height: calc(100vh - 54px);
  overflow: hidden;
}
@media (max-width: 1180px) {
  .studio-layout {
    grid-template-columns: 220px 1fr 290px;
  }
}
.studio-panel {
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.studio-panel-right {
  border-right: none;
  border-left: 1px solid #e2e8f0;
}
.studio-canvas-area {
  background: #0b1220;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cad-entity.selected-entity,
.cad-edge-vis.selected-entity {
  stroke: #f43f5e !important;
  filter: drop-shadow(0 0 4px rgba(244, 63, 94, 0.85));
}
.cad-corner.selected-entity {
  fill: #f43f5e !important;
  stroke: #fff !important;
}
.cad-hole.selected-entity {
  stroke: #f43f5e !important;
  fill: rgba(244, 63, 94, 0.18) !important;
}
.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fee2e2;
}
.btn-success {
  background: #10b981;
  color: #fff;
  border-color: #059669;
}
.btn-success:hover {
  background: #059669;
}

/* ============================================================
   Chrome-style Settings Layout (Left Category Rail + Right Canvas)
   ============================================================ */
.settings-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #f8fafc;
}
.settings-topbar {
  height: 58px;
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
}
.settings-topbar-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 196px;
  flex-shrink: 0;
}
.settings-topbar-icon {
  font-size: 18px;
}
.settings-topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.settings-search-wrap {
  position: relative;
  flex: 1;
  max-width: 560px;
}
.settings-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.65;
  pointer-events: none;
}
.settings-search-input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 13px;
  outline: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.settings-search-input:hover {
  background: #e9eff6;
}
.settings-search-input:focus {
  background: #ffffff;
  border-color: #93c5fd;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1);
}
.settings-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  z-index: 40;
}
.settings-search-hit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s;
}
.settings-search-hit:last-child {
  border-bottom: none;
}
.settings-search-hit:hover {
  background: #f8fafc;
}
.settings-hit-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.settings-hit-desc {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}
.settings-hit-cat {
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.settings-search-none {
  padding: 14px;
  font-size: 12.5px;
  color: #64748b;
  text-align: center;
}
.settings-topbar-right {
  min-width: 120px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.settings-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.settings-rail {
  width: 244px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  padding: 14px 0 12px;
}
.settings-rail-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.settings-rail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 22px;
  margin-right: 14px;
  border-radius: 0 999px 999px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  transition: background 0.14s, color 0.14s;
}
.settings-rail-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.settings-rail-item.active {
  background: #e8f0fe;
  color: #1d4ed8;
  font-weight: 600;
}
.settings-rail-ico {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.settings-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 14px 8px 34px;
  padding-left: 12px;
  border-left: 2px solid #e2e8f0;
}
.settings-subitem {
  font-size: 12.5px;
  color: #64748b;
  padding: 6px 10px;
  border-radius: 7px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.settings-subitem:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.settings-subitem.active {
  color: #1d4ed8;
  background: #eff6ff;
  font-weight: 600;
}
.settings-rail-footer {
  padding: 12px 18px 4px;
  border-top: 1px solid #f1f5f9;
  margin-top: 16px;
}
.settings-security-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #64748b;
}

.settings-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 32px 48px;
}
.settings-container {
  max-width: 920px;
  margin: 0 auto;
}
.settings-page-intro {
  margin-bottom: 20px;
}
.settings-heading {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.settings-sub {
  margin: 5px 0 0;
  font-size: 13px;
  color: #64748b;
}
.settings-section {
  margin-bottom: 24px;
  scroll-margin-top: 16px;
}
.settings-section-title {
  margin: 0 0 10px 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}
.settings-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.settings-row:last-child {
  border-bottom: none;
}
.settings-row-info {
  flex: 1;
  min-width: 0;
}
.settings-row-label {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
}
.settings-row-desc {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.45;
}
.settings-row-control {
  flex: 0 0 320px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.settings-hidden-by-search {
  display: none !important;
}
.settings-search-empty {
  text-align: center;
  padding: 36px 20px;
  color: #64748b;
  font-size: 13.5px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}

@media (max-width: 960px) {
  .settings-topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 14px;
  }
  .settings-topbar-left {
    min-width: auto;
  }
  .settings-topbar-right {
    min-width: auto;
  }
  .settings-body {
    flex-direction: column;
  }
  .settings-rail {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 12px;
    overflow-x: auto;
  }
  .settings-rail-list {
    flex-direction: row;
    gap: 6px;
  }
  .settings-rail-item {
    margin-right: 0;
    border-radius: 999px;
    padding: 7px 14px;
    white-space: nowrap;
  }
  .settings-subnav,
  .settings-rail-footer {
    display: none;
  }
  .settings-main {
    padding: 16px;
  }
  .settings-row {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-row-control {
    flex: none;
    width: 100%;
    justify-content: flex-start;
  }
}

/* ============================================================
   Redesigned Layered AI Assistant Drawer (v2)
   ============================================================ */
.pai-drawer-v2 {
  position: relative;
  background: #ffffff;
}
.pai-header {
  height: 46px;
  padding: 0 12px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
}
.pai-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pai-brand {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}
.pai-model-chip {
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 1px 8px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pai-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.pai-icon-btn {
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.pai-icon-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.pai-icon-btn.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

/* Floating Options Popover */
.pai-popover {
  position: absolute;
  top: 50px;
  right: 12px;
  width: 296px;
  max-width: calc(100% - 24px);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
  z-index: 60;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pai-pop-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}
.pai-pop-group:last-child {
  padding-bottom: 0;
  border-bottom: none;
}
.pai-pop-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
}
.pai-pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #1e293b;
}
.pai-pop-select {
  width: auto !important;
  padding: 3px 8px !important;
  font-size: 11.5px !important;
}
.pai-pop-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #1e293b;
  cursor: pointer;
  margin: 0;
}
.pai-pop-check.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.pai-pop-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pai-pop-link {
  font-size: 11.5px;
  color: #2563eb;
  text-decoration: none;
  margin-top: 2px;
}
.pai-pop-link:hover {
  text-decoration: underline;
}

/* Clean Top Tabs */
.pai-tabs {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 6px 10px 0 !important;
  gap: 2px !important;
}
.pai-tabs .ai-tab {
  font-size: 12px;
  padding: 6px 10px 7px;
  border-radius: 8px 8px 0 0;
}

/* Single Slim Toolbar */
.pai-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.pai-toolbar-left,
.pai-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Subtle Voice Toast (only visible when status text is non-empty) */
.pai-voice-toast {
  font-size: 11.5px;
  color: #475569;
  background: #f8fafc;
  padding: 4px 12px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.pai-voice-toast:has(#pai-voice-status:empty) {
  display: none;
}

/* Single-line scrollable chips strip so sections/evidence don't bloat vertically */
.pai-strip {
  display: flex;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 6px 12px !important;
  gap: 5px !important;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.pai-strip > * {
  flex-shrink: 0;
}

/* Unified Composer Footer */
.pai-composer {
  padding: 10px 12px 12px !important;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
}
.pai-composer-modes {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 8px;
  gap: 2px;
}
.pai-mode-btn {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.pai-mode-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Keep dynamic banners (AI extracted attributes / precheck / process card CTA) inside scroll flow */
#pai-report-scroll #pai-dynamic-banners:not(:empty) {
  margin-bottom: 12px;
}
#pai-report-scroll #pai-dynamic-banners .ai-attr-card,
#pai-report-scroll #pai-dynamic-banners .ai-precheck-banner {
  margin-left: 0;
  margin-right: 0;
}
.pai-report-meta {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
  font-size: 11.5px;
  color: #94a3b8;
}
.pai-report-meta summary {
  cursor: pointer;
  user-select: none;
}
.pai-report-meta summary:hover {
  color: #64748b;
}
.pai-report-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

/* Focus Fullscreen Mode: hide nav sidebar + top 2 header rows, maximize drawing + wide AI */
body.pai-focus-fullscreen #nav-sidebar,
body.pai-focus-fullscreen .part-context-strip,
body.pai-focus-fullscreen .part-file-tabs {
  display: none !important;
}
body.pai-focus-fullscreen .main-area {
  width: 100vw;
  height: 100vh;
}
