/* Admin screen (full-viewport overlay) */
.admin-screen {
  position: fixed; inset: 0; background: #f5f5f5; z-index: 50;
  display: flex; flex-direction: column;
}
.admin-header {
  padding: 14px 24px; background: #1e1e2e; color: #cdd6f4;
  display: flex; align-items: center; gap: 16px;
}
.admin-header h2 { font-size: 17px; font-weight: 600; }
/* Breadcrumb trail: Chat / Context packs / <slug>. Every level but the
   current one is a link back up, so there is one consistent way out. */
.admin-crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-crumb {
  background: none; border: none; color: #a6adc8; cursor: pointer;
  font-size: 17px; font-family: inherit; padding: 2px 4px; border-radius: 4px;
}
.admin-crumb:hover { color: #cdd6f4; background: #313244; }
.admin-crumb-sep { color: #6c7086; font-size: 17px; }
.admin-crumb-current { font-size: 17px; font-weight: 600; color: #cdd6f4; }
.admin-content { flex: 1; overflow-y: auto; padding: 24px; }
.admin-intro { color: #6b7280; font-size: 13px; margin-bottom: 16px; }
.admin-table {
  width: 100%; border-collapse: collapse; background: #fff; font-size: 13px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.06), 0 0 0 1px rgba(16,24,40,0.05);
  border-radius: 8px; overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 11px 16px; text-align: left; vertical-align: middle;
}
/* Small caps on a tinted band: reads as a header at a glance without
   competing with the row content for attention. */
.admin-table th {
  background: #eef1f5; color: #64748b; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid #dde3ea;
}
.admin-table td {
  color: #475569; border-bottom: 1px solid #eef1f5;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: #f8fafc; }
/* First column is the identity of the row, so let it carry the weight. */
.admin-table tbody td:first-child { color: #1e293b; font-weight: 500; }
.role-label {
  display: inline-flex; align-items: center; gap: 4px; margin-right: 14px;
  font-size: 13px; color: #374151; cursor: pointer;
}
.role-label input[disabled] { cursor: not-allowed; }
.verified-yes { color: #16a34a; }
.verified-no { color: #9ca3af; }

/* Pack admin (reuses the .admin-* shell above) */
.pack-row-link { color: #4f46e5; cursor: pointer; text-decoration: none; }
.pack-row-link:hover { text-decoration: underline; }
.status-pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.status-draft { background: #e5e7eb; color: #4b5563; }
.status-in_review { background: #fef3c7; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
/* Publication state: whether the agent is serving this pack, separate from
   the workflow status of the working copy above. */
.pub-pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 600;
}
.pub-live { background: #dcfce7; color: #166534; }
.pub-none { background: #f3f4f6; color: #9ca3af; }
/* Live snapshot is behind the working copy: a newer draft exists unpublished. */
.pub-stale {
  display: block; margin-top: 3px; font-size: 11px;
  font-weight: 600; color: #b45309;
}
.pack-detail { display: flex; flex-direction: column; gap: 18px; }
.pack-card {
  background: #fff; border-radius: 6px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.pack-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.pack-field { display: block; margin-bottom: 10px; font-size: 13px; color: #374151; }
.pack-field input, .pack-field textarea {
  width: 100%; margin-top: 4px; padding: 8px 10px; font-size: 13px;
  border: 1px solid #d1d5db; border-radius: 6px; font-family: inherit;
}
.pack-field textarea {
  min-height: 360px; font-family: ui-monospace, monospace; line-height: 1.5;
  resize: vertical;  /* vertical only; horizontal drag breaks the grid */
}
/* A reader (admin, or anyone without editor) gets these fields disabled.
   Without a visible treatment they look editable, so a reader can type into
   a field that will never save. Buttons already carry this; fields need it
   just as much. */
.pack-field input:disabled,
.pack-field textarea:disabled,
.pack-field select:disabled {
  background: #f9fafb; color: #6b7280; cursor: not-allowed;
}
.pack-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pack-btn {
  padding: 7px 14px; font-size: 13px; border-radius: 6px; cursor: pointer;
  border: 1px solid #d1d5db; background: #fff; color: #374151;
}
.pack-btn:hover:not(:disabled) { background: #f3f4f6; }
.pack-btn:disabled { opacity: .5; cursor: not-allowed; }
.pack-btn-primary { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.pack-btn-primary:hover:not(:disabled) { background: #4338ca; }
.pack-note { color: #6b7280; font-size: 12px; margin-top: 8px; }
.pack-msg { font-size: 13px; margin-left: 4px; }
.pack-msg-ok { color: #166534; }
.pack-msg-err { color: #b91c1c; }
.pack-toolbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 14px;
}
/* Section heading + one line of orientation, used above each table. */
.section-head {
  font-size: 15px; font-weight: 600; color: #111827; margin-bottom: 3px;
}
.section-desc {
  color: #6b7280; font-size: 13px; line-height: 1.5; max-width: 70ch;
}
.section + .section { margin-top: 36px; }
.pack-btn-danger { border-color: #fca5a5; color: #b91c1c; }
.pack-btn-danger:hover:not(:disabled) { background: #fef2f2; }
.pack-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 14px;
}
.pack-field select {
  width: 100%; margin-top: 4px; padding: 8px 10px; font-size: 13px;
  border: 1px solid #d1d5db; border-radius: 6px; font-family: inherit;
  background: #fff;
}
/* Read-only panel showing which entry of a dataset payload a reference
   serves, and the exact slice the agent will receive. */
.pack-slice {
  margin-top: 10px; padding: 10px 12px; border: 1px solid #e5e7eb;
  border-radius: 6px; background: #f9fafb;
}
.pack-slice-preview {
  margin-top: 4px; padding: 8px 10px; background: #fff; border-radius: 4px;
  border: 1px solid #e5e7eb; font-family: ui-monospace, monospace;
  font-size: 12px; line-height: 1.5; overflow-x: auto; max-height: 220px;
}
.pack-field-hint {
  display: block; color: #9ca3af; font-weight: 400; font-size: 12px;
  line-height: 1.45; margin-top: 3px;
}
.pack-field-label { display: block; font-weight: 600; color: #6b7280; font-size: 12px; }
.pack-value { margin-top: 3px; color: #111827; overflow-wrap: anywhere; }
.pack-body {
  margin-top: 4px; padding: 10px 12px; background: #f9fafb; border-radius: 6px;
  border: 1px solid #e5e7eb; font-family: ui-monospace, monospace;
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-x: auto;
  max-height: 420px;
}
.field-group-head {
  font-size: 13px; font-weight: 600; color: #374151;
  margin: 18px 0 2px; padding-top: 14px; border-top: 1px solid #e5e7eb;
}
.field-group-note {
  color: #6b7280; font-size: 12px; line-height: 1.5; margin-bottom: 10px;
}
.field-group-note code, .pack-field-hint code {
  background: #f3f4f6; padding: 1px 4px; border-radius: 3px; font-size: 11px;
}
.pack-ref {
  border-top: 1px solid #e5e7eb; padding-top: 14px; margin-top: 14px;
}
.pack-ref-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  flex-wrap: wrap;
}
.pack-ref-title { font-weight: 600; font-size: 14px; }
.pack-ref-spacer { flex: 1; }
.pack-ref-order {
  background: none; border: 1px solid #d1d5db; border-radius: 4px;
  cursor: pointer; color: #6b7280; font-size: 12px; padding: 2px 7px;
}
.pack-ref-order:hover:not(:disabled) { background: #f3f4f6; color: #374151; }
.pack-ref-order:disabled { opacity: .35; cursor: not-allowed; }
.pack-kind-shared { background: #ede9fe; color: #5b21b6; }
.pack-kind-dataset { background: #e0f2fe; color: #075985; }
.pack-kind-file { background: #f3f4f6; color: #4b5563; }
/* Modal for create flows (new pack / new reference) */
.pack-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 60;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 40px 16px;
}
.pack-modal-box {
  background: #fff; border-radius: 8px; padding: 24px 26px; width: 100%;
  max-width: 780px; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.pack-modal-box h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.pack-modal-sub { color: #6b7280; font-size: 13px; margin-bottom: 16px; }

.hidden { display: none !important; }
