/* ─── COMBINATION METADATA CARD ──────────────── */
.meta-card { }
.meta-field { margin-bottom: 10px; }
.meta-field:last-child { margin-bottom: 0; }
.meta-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.meta-input {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: #fafbfc;
  outline: none;
  resize: vertical;
}
.meta-input:focus {
  border-color: var(--primary);
  background: #fff;
}

.use-existing-btn {
  padding: 4px 9px;
  border: 1px solid #bae6fd;
  border-radius: 5px;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.use-existing-btn:hover { background: #e0f2fe; }

.doc-approve-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.doc-approve-btn:hover { background: var(--primary); color: #fff; }

/* ─── DETAIL VIEW ─────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.breadcrumb button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.breadcrumb button:hover { color: var(--primary); text-decoration: underline; }
.breadcrumb .sep { color: #cbd5e1; }
.breadcrumb .crumb-current { color: var(--text); font-weight: 600; }

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

.detail-badges { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }

.id-pill {
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.detail-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.detail-subtitle { font-size: 12px; color: var(--text-muted); }

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

/* Two-column detail layout */
.detail-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: start;
}

.detail-sidebar-col { display: flex; flex-direction: column; gap: 12px; }

.img-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 12px;
  padding: 16px;
}

.material-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.material-card h4 { font-size: 13px; font-weight: 700; margin-bottom: 12px; }

.mat-row { margin-bottom: 10px; }

.mat-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.mat-label span:last-child { font-weight: 700; color: var(--primary-dark); }

.mat-bar { height: 5px; background: var(--primary-light); border-radius: 999px; overflow: hidden; }
.mat-fill { height: 100%; background: var(--primary); border-radius: 999px; }

/* Main panel: role tabs + docs */
.detail-main-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Role selector bar */
.role-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  flex-wrap: wrap;
}

.role-bar-label { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

.role-dropdown { position: relative; }

.role-toggle-btn {
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}

.role-menu-popup {
  position: absolute;
  left: 0;
  top: 38px;
  z-index: 50;
  min-width: 240px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: var(--shadow-md);
}

.role-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.role-check-label:hover { background: #f8fafc; }
.role-check-label input { accent-color: var(--primary); }

.role-menu-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.role-menu-actions button {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  font-family: inherit;
}

.role-menu-save {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

/* Role tabs */
.role-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  overflow-x: auto;
  gap: 0;
}

.role-tab {
  padding: 11px 13px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  font-family: inherit;
  transition: color 0.12s;
}

.role-tab:hover { color: var(--text); }

.role-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* Docs section */
.docs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.docs-header h3 { font-size: 13px; font-weight: 700; }

.add-doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

/* Document items */
.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.doc-item:last-child { border-bottom: none; }

.doc-icon-wrap {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.doc-icon-wrap.ic-ok { background: var(--primary-light); color: var(--primary-dark); }
.doc-icon-wrap.ic-warn { background: var(--warn-bg); color: var(--warn-text); }
.doc-icon-wrap.ic-danger { background: var(--danger-bg); color: var(--danger-text); }
.doc-icon-wrap.ic-neutral { background: var(--neutral-bg); color: var(--neutral-text); }

.doc-info { flex: 1; min-width: 0; }

.doc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.doc-meta { font-size: 11px; color: var(--text-muted); }
.doc-meta a { color: var(--primary); text-decoration: none; }
.doc-meta a:hover { text-decoration: underline; }

.doc-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.doc-menu-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-light);
  font-size: 15px;
  font-family: inherit;
}

.doc-menu-btn:hover { background: #f8fafc; border-color: var(--border); }

/* N.V.T. button for role documents */
.role-na-btn {
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-light);
  white-space: nowrap;
}
.role-na-btn:hover { border-color: var(--text-muted); color: var(--text-muted); }
.role-na-btn.active { background: var(--neutral-bg); color: var(--neutral-text); border-color: var(--neutral-text); }

/* Dimmed row when marked n.v.t. */
.doc-item.na { opacity: 0.65; }

/* Three-dot dropdown popup */
.doc-menu-popup {
  position: fixed;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  z-index: 9999;
  min-width: 168px;
  padding: 4px;
}
.dmp-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13px;
  font-family: inherit;
  color: #374151;
  cursor: pointer;
  border-radius: 5px;
}
.dmp-item:hover { background: #f8fafc; }
.dmp-delete { color: #ef4444; }
.dmp-delete:hover { background: #fef2f2; color: #dc2626; }

/* Inline note editor */
.note-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--primary-light);
  border-top: 1px solid #dde8c4;
  border-bottom: 1px solid #dde8c4;
}
.note-edit-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  background: #fff;
}
.note-edit-input:focus { border-color: var(--primary); }
.note-edit-save {
  padding: 6px 13px;
  background: var(--primary);
  color: #2D3132;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.note-edit-cancel {
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

/* Upload row per document */
.upload-row {
  padding: 8px 16px 10px 58px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.upload-form-inner {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.upload-form-inner input[type="file"] {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 7px;
  background: white;
  cursor: pointer;
  font-family: inherit;
}

.upload-form-inner input[type="text"] {
  flex: 1;
  min-width: 120px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 9px;
  background: white;
  outline: none;
  font-family: inherit;
}

.upload-submit-btn {
  padding: 5px 12px;
  border-radius: 5px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* Extra docs section */
.extra-section {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.extra-section h4 { font-size: 13px; font-weight: 700; margin-bottom: 10px; }

.extra-upload-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.extra-upload-row input[type="file"] {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  background: white;
  cursor: pointer;
  font-family: inherit;
}

.extra-upload-row input[type="text"] {
  flex: 1;
  min-width: 120px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 9px;
  background: white;
  outline: none;
  font-family: inherit;
}

/* ─── DOC SUBGROUP HEADERS ───────────────────────── */
.doc-subgroup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 18px 7px 14px;
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 2px;
}
.doc-subgroup-count {
  font-weight: 600;
  font-size: 10px;
  opacity: .75;
}

.td-compile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #f0f9ff;
  border-top: 1px solid #bae6fd;
  border-bottom: 1px solid #bae6fd;
  font-size: 12px;
  color: #0369a1;
}

.td-compile-btn {
  background: #0369a1;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 13px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.td-compile-btn:hover { background: #0284c7; }
.td-compile-btn:disabled { opacity: .6; cursor: default; }
