/* Admin page styles */

/* ── Login Gate ──────────────────────────────────────────── */

.login-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--cream);
}

.login-box {
  text-align: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 48px 40px 40px;
  width: 360px;
  animation: fadeUp 0.3s ease;
}

.login-logo {
  width: 48px;
  height: 48px;
  background: var(--navy);
  color: var(--white);
  border-radius: 2px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.login-box h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#login-form input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

#login-form input:focus {
  border-color: var(--navy);
}

#login-form button {
  padding: 10px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

#login-form button:hover {
  opacity: 0.9;
}

.login-error {
  font-size: 13px;
  color: #c0392b;
  min-height: 18px;
}

/* ── Admin Panel ─────────────────────────────────────────── */

.admin-panel {
  min-height: 100vh;
  background: var(--cream);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.admin-header .header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--navy);
}

.back-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 2px;
  transition: background 0.2s;
}

.back-arrow:hover {
  background: var(--cream);
}

.back-arrow svg {
  stroke: var(--navy);
  stroke-width: 2;
  fill: none;
}

.logout-btn {
  padding: 6px 16px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  color: var(--navy);
  border-color: var(--navy);
}

/* ── Admin Body ──────────────────────────────────────────── */

.admin-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.admin-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px 28px 24px;
  margin-bottom: 24px;
  animation: fadeUp 0.3s ease;
}

.admin-section h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cream-dark);
}

/* ── Form Grid ───────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--navy);
}

.color-input {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-input input[type="color"] {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  padding: 2px;
}

.color-input input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
}

.save-btn {
  padding: 8px 24px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.save-btn:hover {
  opacity: 0.9;
}

.save-status {
  font-size: 13px;
  color: var(--green);
  margin-left: 12px;
}

/* ── Employee List ───────────────────────────────────────── */

.employee-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.emp-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: border-color 0.2s;
}

.emp-card:hover {
  border-color: var(--navy);
}

.emp-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.emp-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
}

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

.emp-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
}

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

.emp-status {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  flex-shrink: 0;
}

.emp-status.active {
  background: #ecfdf5;
  color: #059669;
}

.emp-status.inactive {
  background: #fef2f2;
  color: #dc2626;
}

.emp-status.disconnected {
  background: #fef2f2;
  color: #dc2626;
}

.emp-status.available {
  background: #f3f4f6;
  color: #6b7280;
}

.emp-card.available {
  opacity: 0.55;
  border-style: dashed;
}

.emp-card.available:hover {
  opacity: 0.8;
}

.emp-card.available .emp-avatar {
  background: #9ca3af;
}

.emp-enable-btn {
  font-size: 11px;
  color: var(--navy);
  background: none;
  border: 1px solid var(--navy);
  padding: 4px 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.emp-enable-btn:hover {
  background: var(--navy);
  color: var(--white);
}

.emp-chat-link {
  font-size: 11px;
  color: var(--navy);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 2px;
  transition: all 0.2s;
  white-space: nowrap;
}

.emp-chat-link:hover {
  background: var(--navy);
  color: var(--white);
}

/* ── Token Status Indicator ─────────────────────────────── */

.emp-token-status {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.token-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}

.token-dot.healthy {
  background: #059669;
}

.token-dot.broken {
  background: #dc2626;
}

.token-label {
  display: none;
}

.token-label.healthy {
  color: #059669;
}

.token-label.broken {
  color: #dc2626;
}

.token-label.info {
  color: #2563eb;
}

/* ── Authorize Button ──────────────────────────────────── */

.emp-auth-btn {
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  color: var(--navy);
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.emp-auth-btn:hover {
  background: var(--navy);
  color: var(--white);
}

.emp-auth-btn.urgent {
  border-color: #dc2626;
  color: #dc2626;
}

.emp-auth-btn.urgent:hover {
  background: #dc2626;
  color: var(--white);
}

.emp-auth-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.emp-auth-btn.authorized {
  border-color: #059669;
  color: #059669;
  cursor: default;
}

.emp-auth-btn.authorized:hover {
  background: #ecfdf5;
  color: #059669;
}

.emp-auth-btn.disconnected {
  border-color: #dc2626;
  color: #dc2626;
}

.emp-auth-btn.disconnected:hover {
  background: #dc2626;
  color: var(--white);
}

.emp-auth-btn.setup {
  border-color: var(--navy);
  color: var(--navy);
  background: var(--cream);
}

.emp-auth-btn.setup:hover {
  background: var(--navy);
  color: var(--white);
}

/* ── Edit Button ─────────────────────────────────────────── */

.emp-edit-btn {
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  color: var(--navy);
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.emp-edit-btn:hover {
  background: var(--navy);
  color: var(--white);
}

.emp-disable-btn {
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  color: var(--mid-gray, #888);
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.emp-disable-btn:hover {
  background: #dc3545;
  color: var(--white);
  border-color: #dc3545;
}

/* ── Drag-handle reorder ────────────────────────────────── */

.emp-card .emp-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 28px;
  margin-right: 4px;
  color: #94a3b8;
  cursor: grab;
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.emp-card .emp-drag-handle:hover {
  color: var(--navy);
  background: var(--cream);
}
.emp-card .emp-drag-handle:active { cursor: grabbing; }

/* Drop indicators during drag */
.emp-card.drag-source { opacity: 0.4; }
.emp-card.drag-over-top    { box-shadow: 0 -2px 0 0 var(--navy) inset; }
.emp-card.drag-over-bottom { box-shadow: 0  2px 0 0 var(--navy) inset; }

/* ── Modal Overlay ───────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 39, 68, 0.45);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
  overflow-y: auto;
  padding: 24px 0;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: modalUp 0.2s ease;
}

@keyframes modalUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--navy);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
}

.cancel-btn {
  padding: 8px 20px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.cancel-btn:hover {
  color: var(--navy);
  border-color: var(--navy);
}

/* ── Photo Gallery ───────────────────────────────────────── */

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.photo-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}

.photo-option:hover {
  border-color: var(--border);
  transform: scale(1.05);
}

.photo-option.selected {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px var(--navy);
}

.photo-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  border-radius: 50%;
}

.photo-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.upload-btn {
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--navy);
  background: none;
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-btn:hover {
  background: var(--cream);
}

.upload-hint {
  font-size: 12px;
  color: var(--green);
}

/* ── Modal Form Grid ─────────────────────────────────────── */

.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.modal-form-grid .form-group.full-width {
  grid-column: 1 / -1;
}

.modal-form-grid input[type="text"],
.modal-form-grid input[type="email"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.modal-form-grid input:focus {
  border-color: var(--navy);
}

/* ── Style Customization ────────────────────────────────── */

.style-subsection {
  margin-bottom: 20px;
}

.style-subsection-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 10px 0;
  border-bottom: 1px solid var(--cream-dark, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.style-subsection-title::after {
  content: '\25BE';
  font-size: 12px;
  transition: transform 0.2s;
}

.style-subsection-title.collapsed::after {
  transform: rotate(-90deg);
}

.style-subsection-body {
  padding-top: 12px;
}

.style-subsection-body.collapsed {
  display: none;
}

.style-control-group {
  margin-bottom: 14px;
  padding: 12px;
  background: var(--cream, #f5f7fa);
  border-radius: 3px;
}

.style-control-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 8px;
}

.style-control-row {
  display: grid;
  grid-template-columns: 1fr 1fr 80px;
  gap: 12px;
  align-items: end;
}

.style-control-row.single {
  grid-template-columns: 120px;
}

.style-font-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--white);
  outline: none;
  cursor: pointer;
  width: 100%;
}

.style-font-select:focus {
  border-color: var(--navy);
}

.style-control-row input[type="number"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.style-control-row input[type="number"]:focus {
  border-color: var(--navy);
}

.style-control-row .color-input input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
}

.style-control-row .color-input input[type="text"]:focus {
  border-color: var(--navy);
}

/* Logo Upload */
.logo-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.logo-preview {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--cream, #f5f7fa);
  flex-shrink: 0;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#logo-preview-placeholder {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
}

.remove-btn {
  color: #c0392b !important;
  border-color: #c0392b !important;
}

.remove-btn:hover {
  background: #fef2f2 !important;
}

/* ── Employees Section Container ─────────────────────────── */

.admin-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 48px 64px;
}

.emp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cream-dark, #e5e7eb);
}

.emp-section-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
  margin: 0;
  padding: 0;
  border: none;
}

/* ── Employee Detail View ───────────────────────────────── */

.emp-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.emp-back-btn {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.emp-back-btn:hover {
  color: var(--navy);
  border-color: var(--navy);
}

.emp-detail-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--navy);
  margin: 0;
}

/* ── Detail Tabs ────────────────────────────────────────── */

.emp-detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.emp-tab {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.emp-tab:hover {
  color: var(--navy);
}

.emp-tab.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

/* ── Tab Panes ──────────────────────────────────────────── */

.emp-tab-content {
  min-height: 300px;
}

.emp-tab-pane {
  display: none;
}

.emp-tab-pane.active {
  display: block;
}

/* ── Code Editor (textarea) ─────────────────────────────── */

.code-editor {
  width: 100%;
  min-height: 400px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 16px;
  resize: vertical;
  outline: none;
  tab-size: 2;
  box-sizing: border-box;
  margin-bottom: 12px;
}

.code-editor:focus {
  border-color: var(--navy);
  background: var(--white);
}

.code-editor:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Workflow Layout ────────────────────────────────────── */

.wf-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  min-height: 400px;
}

.wf-sidebar {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--cream, #f5f7fa);
  overflow: hidden;
}

.wf-sidebar-header {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 12px 14px 8px;
}

.wf-file-list {
  display: flex;
  flex-direction: column;
}

.wf-file-item {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.wf-file-item:hover {
  background: rgba(26, 39, 68, 0.04);
}

.wf-file-item.active {
  background: var(--white);
  border-left-color: var(--navy);
  font-weight: 500;
  color: var(--navy);
}

.wf-editor {
  display: flex;
  flex-direction: column;
}

.wf-editor-header {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ── Knowledge Tree ─────────────────────────────────────── */

.knowledge-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kn-folder {
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.kn-folder-header {
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--navy);
  padding: 10px 14px;
  background: var(--cream, #f5f7fa);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}

.kn-folder-header:hover {
  background: #eef0f4;
}

.kn-folder-header::after {
  content: '\25B6';
  font-size: 10px;
  transition: transform 0.2s;
}

.kn-folder.expanded .kn-folder-header::after {
  transform: rotate(90deg);
}

.kn-file {
  display: none;
  border-top: 1px solid var(--border);
}

.kn-folder.expanded .kn-file {
  display: block;
}

.kn-file-name {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  padding: 8px 14px 8px 28px;
  cursor: pointer;
  transition: background 0.15s;
}

.kn-file-name:hover {
  background: var(--cream, #f5f7fa);
}

.kn-file-content {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  background: #fafbfc;
  padding: 12px 14px 12px 28px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
}

/* ── Member Knowledge ───────────────────────────────────── */

.kn-member-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.kn-member-select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--white);
}

.kn-entries-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kn-entry-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.kn-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--cream, #f5f7fa);
}

.kn-entry-label {
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--navy);
}

.kn-entry-actions {
  display: flex;
  gap: 6px;
}

.kn-entry-detail > summary {
  font-size: 12px;
  color: var(--muted, #666);
  cursor: pointer;
  padding: 6px 14px;
  user-select: none;
  list-style: none;
  border-top: 1px solid var(--border);
}

.kn-entry-detail > summary::before {
  content: '▶ ';
  font-size: 9px;
  transition: transform 0.2s;
  display: inline-block;
}

.kn-entry-detail[open] > summary::before {
  transform: rotate(90deg);
}

.kn-entry-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--text);
  background: #fafbfc;
  padding: 12px 14px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid var(--border);
  max-height: 360px;
  overflow-y: auto;
  line-height: 1.6;
}

/* Wizard overlay */

.kn-wizard-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.kn-wizard {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 32px;
  max-width: 560px;
  width: calc(100% - 48px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.kn-wizard-header {
  margin-bottom: 20px;
}

.kn-wizard-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin: 6px 0 6px;
}

.kn-wizard-header p {
  font-size: 13px;
  color: var(--muted, #666);
  margin: 0;
  line-height: 1.5;
}

.kn-wizard-success {
  text-align: center;
  padding: 20px 0;
}

.kn-wizard-success svg {
  color: #2d8a4e;
  margin-bottom: 12px;
}

.kn-step-badge {
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  color: var(--muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kn-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 4px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--muted, #888);
  font-size: 13px;
  line-height: 1.6;
}

.kn-drop-zone.drag-over {
  border-color: var(--navy);
  background: rgba(0, 0, 80, 0.03);
}

.kn-drop-zone svg {
  display: block;
  margin: 0 auto 10px;
  opacity: 0.5;
}

.kn-file-label {
  color: var(--navy);
  cursor: pointer;
  text-decoration: underline;
}

.kn-drop-hint {
  font-size: 11px;
  color: var(--muted, #aaa);
  margin-top: 4px;
}

.kn-file-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kn-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: var(--cream, #f5f7fa);
  border-radius: 3px;
  padding: 6px 10px;
}

.kn-file-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kn-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted, #888);
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}

.kn-file-remove:hover { color: var(--danger, #c0392b); }

.kn-analyzing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
  font-size: 13px;
  color: var(--muted, #888);
}

.kn-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.kn-label-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--white);
  box-sizing: border-box;
}

.kn-draft-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--white);
  resize: vertical;
  line-height: 1.6;
  box-sizing: border-box;
}

.kn-wizard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ── Quick Prompts ──────────────────────────────────────── */

.quick-prompts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.qp-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.qp-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
}

.qp-input:focus {
  border-color: var(--navy);
}

.qp-remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.qp-remove:hover {
  color: #dc2626;
  border-color: #dc2626;
  background: #fef2f2;
}

/* ── Select inputs ──────────────────────────────────────── */

.form-group select,
.modal-form-grid select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--white);
  outline: none;
  cursor: pointer;
}

.form-group select:focus,
.modal-form-grid select:focus {
  border-color: var(--navy);
}

/* ── Number & textarea inputs ───────────────────────────── */

.form-group input[type="number"],
.modal-form-grid input[type="number"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
}

.form-group input[type="number"]:focus,
.modal-form-grid input[type="number"]:focus {
  border-color: var(--navy);
}

.form-group textarea,
.modal-form-grid textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}

.form-group textarea:focus,
.modal-form-grid textarea:focus {
  border-color: var(--navy);
}

/* ── Capability Checkboxes ──────────────────────────────── */

.cap-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.cap-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.cap-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── Photo Picker (3-option layout) ─────────────────────── */

.photo-picker {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.photo-picker-current {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--navy);
  box-shadow: 0 0 0 2px var(--navy);
  flex-shrink: 0;
}

.photo-picker-current img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.photo-picker-btn {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--navy);
  background: none;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.photo-picker-btn:hover {
  background: var(--cream, #f5f7fa);
  border-color: var(--navy);
}

.photo-gallery-overlay {
  margin-top: 12px;
  padding: 16px;
  background: var(--cream, #f5f7fa);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ── Profile Status & Toggle Row ─────────────────────────── */

.profile-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--cream, #f5f7fa);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.profile-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}

.profile-status-dot.healthy {
  background: #059669;
}

.profile-status-dot.broken {
  background: #dc2626;
}

.profile-status-label {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
}

.profile-status-label.healthy {
  color: #059669;
}

.profile-status-label.broken {
  color: #dc2626;
}

.profile-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-label {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: all 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: all 0.25s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: #059669;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ── Field-Level Edit Icon ──────────────────────────────── */

.field-edit-icon {
  background: none;
  border: none;
  padding: 0 0 0 6px;
  cursor: pointer;
  color: rgba(26,39,68,0.35);
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.field-edit-icon svg {
  width: 13px;
  height: 13px;
}

.field-edit-icon:hover {
  color: var(--navy);
}

input[readonly] {
  background: #f0f0f0;
  color: #888;
  cursor: default;
}

.email-warning-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--navy);
  margin: 0;
}

/* ── Email Edit Modal Status ──────────────────────────── */

.email-modal-status {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
}

.email-modal-status.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.email-modal-status.success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.email-modal-status.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.email-modal-status-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.email-modal-status.info .email-modal-status-icon {
  animation: spin 1.5s linear infinite;
}

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

.email-modal-status-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.email-modal-status-detail {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.85;
}

/* ── OAuth Inline Status ───────────────────────────────── */

.oauth-inline-status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}

.oauth-inline-status.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.oauth-inline-status.healthy {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.oauth-inline-status.broken {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* ── Integrations Section ──────────────────────────────── */

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy);
  margin-bottom: 16px;
}

.api-keys-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.api-key-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.api-key-row > label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.api-key-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-key-masked {
  font-family: 'DM Sans', monospace;
  font-size: 14px;
  color: var(--navy);
  letter-spacing: 0.02em;
}

.api-key-masked.not-set {
  color: var(--text-muted);
  font-style: italic;
}

.api-key-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.api-key-edit-row .api-key-input {
  flex: 1;
  font-family: 'DM Sans', monospace;
  font-size: 13px;
}

.api-key-edit-row .save-btn,
.api-key-edit-row .cancel-btn {
  padding: 6px 14px;
  font-size: 12px;
}

/* ── Wizard Styles ──────────────────────────────────────── */

.wizard-step-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cream-dark, #e5e7eb);
}

.id-preview {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  color: var(--navy);
  background: var(--cream, #f5f7fa);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.wizard-review {
  font-size: 14px;
  line-height: 1.8;
}

.review-row {
  padding: 4px 0;
}

.review-row strong {
  color: var(--navy);
  font-weight: 500;
}

.review-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.review-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .admin-header {
    padding: 12px 16px;
  }
  .admin-body {
    padding: 16px 12px;
  }
  .admin-section {
    padding: 20px 16px;
  }
  .modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .photo-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
  .modal-form-grid {
    grid-template-columns: 1fr;
  }
  .style-control-row {
    grid-template-columns: 1fr;
  }
  .wf-layout {
    grid-template-columns: 1fr;
  }
  .emp-detail-tabs {
    gap: 0;
  }
  .emp-tab {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ── Corrections ────────────────────────────────────────── */

.section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.corrections-list {
  display: flex;
  flex-direction: column;
}

.corrections-empty {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  padding: 16px 0;
}

.correction-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.correction-card.inactive {
  opacity: 0.6;
}

.correction-display {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.correction-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.correction-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--navy);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 3px;
}

.correction-date {
  font-size: 11px;
  color: var(--text-muted);
}

.correction-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
}

.correction-summary {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.correction-detail {
  margin-bottom: 4px;
}

.correction-detail > summary {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.correction-detail > summary::-webkit-details-marker { display: none; }

.correction-detail > summary::before {
  content: '▶';
  font-size: 8px;
  transition: transform 0.15s;
}

.correction-detail[open] > summary::before {
  transform: rotate(90deg);
}

.correction-detail-text {
  margin-top: 8px;
  padding: 10px 12px;
  background: #f8f8f8;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.correction-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.correction-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: all 0.15s;
}

.correction-action-btn:hover {
  color: var(--navy);
  border-color: var(--navy);
}

.correction-action-btn.delete-btn:hover {
  color: #dc2626;
  border-color: #dc2626;
}

.correction-action-btn.promote-btn:hover {
  color: #16a34a;
  border-color: #16a34a;
}

.correction-edit-area {
  margin-top: 8px;
}

.correction-edit-input {
  width: 100%;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  resize: vertical;
  box-sizing: border-box;
}

.correction-edit-input:focus {
  outline: none;
  border-color: var(--navy);
}

.correction-edit-btns {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.correction-edit-btns .save-btn,
.correction-edit-btns .cancel-btn {
  padding: 6px 14px;
  font-size: 12px;
}

/* ── Employee Access Summary (Integrations Tab) ─────────── */

.access-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 12px;
}

@media (max-width: 760px) {
  .access-summary-grid {
    grid-template-columns: 1fr;
  }
}

.access-summary-card {
  background: var(--cream, #f7f5f0);
  border: 1px solid var(--border, #e3e2de);
  border-radius: 8px;
  padding: 16px;
}

.access-summary-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--navy, #2f3b52);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #e3e2de);
}

.access-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.access-summary-item {
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border, #e3e2de);
  border-radius: 6px;
}

.access-summary-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.access-summary-item-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--navy, #2f3b52);
  overflow: hidden;
  text-overflow: ellipsis;
}

.access-summary-item-count {
  font-size: 11px;
  color: var(--muted, #6b6b6b);
  background: var(--cream, #f7f5f0);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.access-summary-empty {
  font-size: 13px;
  color: var(--muted, #6b6b6b);
  font-style: italic;
  padding: 8px 0;
}

/* ── Employee Integrations Tab ─────────────────────────── */

.emp-integrations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integration-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.integration-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}

.integration-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.integration-icon {
  font-size: 22px;
  line-height: 1;
}

.integration-card-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.integration-card-desc {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.integration-card-body {
  padding: 0 18px 16px;
  border-top: 1px solid #f1f5f9;
}

.integration-card.collapsed .integration-card-body {
  display: none;
}

.integration-card.collapsed .integration-card-header {
  opacity: 0.6;
}

/* Calendar list */
.calendar-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.calendar-list-empty {
  padding: 16px 0 8px;
  color: #94a3b8;
  font-size: 13px;
}

.calendar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

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

.calendar-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.calendar-item-label {
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
}

.calendar-item-id {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
}

.toggle-switch.small {
  width: 36px;
  height: 20px;
}
.toggle-switch.small .toggle-slider:before {
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
}
.toggle-switch.small input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.icon-btn:hover {
  color: #ef4444;
  background: #fef2f2;
}

.add-calendar-btn {
  margin-top: 10px;
}

.calendar-add-form {
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
  margin-top: 8px;
}

/* Calendar access status dots */
.calendar-access-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.calendar-access-dot.checking {
  background: #cbd5e1;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.calendar-access-dot.connected {
  background: #22c55e;
}
.calendar-access-dot.disconnected {
  background: #ef4444;
}
.calendar-access-dot.unknown {
  background: #f59e0b;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ── Firm Credential Status ──────────────────────────── */

.credential-status-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.credential-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--cream, #f5f7fa);
  border-radius: 6px;
}
.credential-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--navy, #1a2744);
}
.credential-status {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 12px;
}
.credential-status.status-ok {
  color: #16a34a;
  background: rgba(22,163,74,0.1);
}
.credential-status.status-missing {
  color: #dc2626;
  background: rgba(220,38,38,0.1);
}
.section-desc {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  margin-bottom: 12px;
  line-height: 1.5;
}
.cred-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
  margin-bottom: 8px;
}
.cred-unconfigured-details {
  margin-top: 16px;
}
.cred-unconfigured-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
  user-select: none;
  list-style: none;
  padding: 4px 0;
}
.cred-unconfigured-summary::-webkit-details-marker { display: none; }
.cred-unconfigured-summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--text-muted, #6b7280);
  transition: transform 0.15s;
}
.cred-unconfigured-details[open] > .cred-unconfigured-summary::before {
  transform: rotate(90deg);
}
.cred-unconfigured-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: rgba(107,114,128,0.15);
  color: var(--text-muted, #6b7280);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
}
.cred-unconfigured-details .credential-status-grid {
  margin-top: 8px;
}

/* ── Billing Section ──────────────────────────────────────── */

.billing-plan-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.plan-info .plan-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--navy);
}
.plan-info .plan-price {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}
.plan-info .plan-status {
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
}
.plan-limits {
  display: flex;
  gap: 24px;
}
.plan-limit-item {
  text-align: center;
}
.plan-limit-item .limit-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.plan-limit-item .limit-value {
  display: block;
  font-size: 18px;
  font-weight: 500;
  color: var(--navy);
  margin-top: 2px;
}
.trial-banner {
  margin-top: 12px;
  padding: 10px 16px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 4px;
  font-size: 13px;
  color: #92400e;
}

/* Usage bar */
.usage-bar-container {
  margin-top: 8px;
}
.usage-bar {
  height: 12px;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
}
.usage-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}
.usage-warning {
  margin-top: 8px;
  padding: 8px 14px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 4px;
  font-size: 13px;
  color: #92400e;
}

/* Plan cards */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.plan-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  text-align: center;
}
.plan-card.plan-current {
  border-color: var(--navy);
  box-shadow: 0 0 0 1px var(--navy);
}
.plan-card-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
}
.plan-card-price {
  font-size: 24px;
  font-weight: 500;
  color: var(--navy);
  margin: 8px 0;
}
.plan-card-features {
  list-style: none;
  padding: 0;
  margin: 12px 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.plan-card-features li {
  padding: 4px 0;
}
.plan-btn {
  display: inline-block;
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--white);
  color: var(--navy);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.plan-btn:hover { background: #f9fafb; }
.plan-btn-current { opacity: 0.5; cursor: default; }
.plan-btn-upgrade {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.plan-btn-upgrade:hover { opacity: 0.9; background: var(--navy); }
.plan-btn-contact {
  background: #6366f1;
  color: var(--white);
  border-color: #6366f1;
}
.plan-btn-contact:hover { opacity: 0.9; }

/* ── Audit Log Section ────────────────────────────────────── */

.audit-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.audit-search {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}
.audit-search:focus { border-color: var(--navy); }
.audit-filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  background: var(--white);
  cursor: pointer;
}
.audit-table-container {
  overflow-x: auto;
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.audit-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  color: var(--navy);
  white-space: nowrap;
}
.audit-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
.audit-table tr:hover td { background: #fafbfc; }
.audit-ts {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}
.audit-action-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
}
.audit-details {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
}
.audit-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 12px !important;
}

/* ── Employee Actions ─────────────────────────────────────── */

.ea-badge-create  { background: #dcfce7; color: #166534; }
.ea-badge-update  { background: #eff6ff; color: #1d4ed8; }
.ea-badge-delete  { background: #fee2e2; color: #991b1b; }

.ea-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
}
.ea-status-pending  { background: #fef9c3; color: #854d0e; }
.ea-status-accepted { background: #dcfce7; color: #166534; }
.ea-status-undone   { background: #f3f4f6; color: #6b7280; }

.ea-review-cell { white-space: nowrap; }
.ea-reviewer    { font-size: 12px; color: var(--text-muted); }

.ea-btn {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  margin-right: 4px;
}
.ea-btn-accept {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.ea-btn-accept:hover { background: #bbf7d0; }
.ea-btn-undo {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.ea-btn-undo:hover { background: #fecaca; }

/* ── Team Management ──────────────────────────────────────── */

.team-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 24px;
}
.team-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.team-panel-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--navy);
  margin: 0;
}
.team-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.team-table th {
  text-align: left;
  padding: 10px 16px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  color: var(--navy);
  white-space: nowrap;
}
.team-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.team-table tr:hover td { background: #fafbfc; }
.team-name { font-weight: 500; }
.team-date {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}
.team-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px !important;
}
.team-role-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  background: var(--white);
  cursor: pointer;
}
.team-role-select:focus { border-color: var(--navy); }

.team-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
  text-transform: capitalize;
}
.team-status-pending { background: #fef3c7; color: #92400e; }
.team-status-accepted { background: #d1fae5; color: #065f46; }
.team-status-expired { background: #f3f4f6; color: #6b7280; }

.team-btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  border-radius: 2px;
  transition: color 0.15s, background 0.15s;
}
.team-btn-icon:hover { color: #dc2626; background: #fef2f2; }
.team-copy-invite-btn:hover { color: #1d4ed8; background: #eff6ff; }
.team-actions-cell { display: flex; gap: 4px; align-items: center; }

/* Invite form */
.team-invite-form { padding: 16px 20px; }
.team-invite-fields {
  display: flex;
  gap: 10px;
  align-items: center;
}
.team-invite-fields input[type="email"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}
.team-invite-fields input[type="email"]:focus { border-color: var(--navy); }
.team-invite-fields select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  background: var(--white);
}
.team-btn-primary {
  padding: 8px 16px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 2px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.team-btn-primary:hover { background: #0f1a30; }

.team-invite-result {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 2px;
  font-size: 13px;
}
.team-invite-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.team-invite-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.team-invite-link-label {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}
.team-invite-link {
  width: 100%;
  margin-top: 4px;
  padding: 6px 10px;
  border: 1px solid #a7f3d0;
  border-radius: 2px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  background: #f0fdf4;
  color: #065f46;
  outline: none;
  cursor: text;
}

/* ── Employee Access Picker ──────────────────────────── */
.team-employee-access {
  margin-top: 12px;
}
.team-access-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.team-access-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.team-access-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--navy);
  cursor: pointer;
}
.team-access-check input[type="checkbox"] {
  accent-color: var(--navy);
}
.team-access-cell {
  position: relative;
}
.team-access-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--navy);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.team-access-edit-btn:hover {
  background: #f0f4ff;
  border-color: var(--navy);
}
.team-access-edit-icon {
  opacity: 0.45;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.team-access-edit-btn:hover .team-access-edit-icon {
  opacity: 0.85;
}
.team-access-popup {
  position: fixed;
  z-index: 1000;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 200px;
}
.team-access-popup-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  margin-bottom: 8px;
}
.team-access-popup .team-access-check {
  display: flex;
  padding: 3px 0;
}
.team-access-popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.team-btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}
.team-btn-ghost {
  background: none;
  color: #6b7280;
  border: 1px solid var(--border);
}
.team-btn-ghost:hover {
  background: #f9fafb;
}
.team-hint {
  font-size: 12px;
  color: #9ca3af;
  margin: 0 0 6px;
}

/* Inline access display under member name */
.team-name-cell {
  vertical-align: top;
  padding-top: 10px !important;
}
.team-access-inline {
  margin-top: 6px;
}
.team-access-inline-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  margin-bottom: 2px;
}
.team-access-inline-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #9ca3af;
}
.team-access-inline-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none !important;
  padding: 2px;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  /* Override the badge-style .team-access-edit-btn defaults */
  gap: 0;
  white-space: normal;
}
.team-access-inline-edit:hover {
  color: var(--navy);
  background: #f0f4ff !important;
  border-color: transparent !important;
}
.team-access-inline-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 2px;
}
.team-access-inline-item {
  font-size: 12px;
  color: var(--navy);
  line-height: 1.6;
}
.team-access-inline-item.team-access-all,
.team-access-inline-item.team-access-none {
  color: #9ca3af;
  font-style: italic;
}

/* ── 3-row-per-member layout ───────────────────────────── */
.team-member-main-row td {
  border-bottom: none;
  border-top: 1px solid #e2e8f0;
  padding-bottom: 6px;
  padding-top: 14px;
}
.team-member-access-row td,
.team-member-dash-row td {
  border-bottom: none;
  padding-top: 0;
  padding-bottom: 4px;
  background: #f8fafc;
}
.team-member-group-end td {
  border-bottom: none;
  padding-bottom: 14px;
  background: #f8fafc;
}
.team-member-main-row:hover td { background: transparent; }
.team-member-access-row:hover td,
.team-member-dash-row:hover td { background: #f8fafc; }
.team-access-subrow-td { vertical-align: top; }
.team-access-subrow {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
}
.team-access-subrow .team-access-label {
  display: inline;
  margin-bottom: 0;
  white-space: nowrap;
}
.team-access-subrow .team-access-checkboxes {
  margin: 0;
}

/* Read-only checkbox display inside member rows */
.team-access-checkboxes-readonly {
  pointer-events: none;
  margin-top: 3px;
  flex-wrap: nowrap;
}

.team-password-popup {
  position: fixed;
  z-index: 1000;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 240px;
}
.team-actions-cell {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ── Danger Zone ─────────────────────────────────────── */
.danger-zone {
  border-color: #fca5a5;
  background: #fff5f5;
}
.danger-zone h2 { color: #b91c1c; }

.btn-danger {
  padding: 9px 20px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Signature Block Editor ───────────────────────────── */
.sig-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--cream-dark);
}

.sig-section-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.sig-editor-wrap {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}

/* Toolbar */
.sig-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #f9f9f7;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  row-gap: 4px;
}

.sig-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}

.sig-tool:hover {
  background: var(--cream-dark);
  border-color: var(--border);
}

.sig-tool.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.sig-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}

.sig-select {
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  outline: none;
}

.sig-select:focus { border-color: var(--navy); }

.sig-size-select { width: 60px; }

/* Color picker button */
.sig-color-wrap {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sig-color-wrap:hover {
  background: var(--cream-dark);
  border-color: var(--border);
}

.sig-color-icon {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  border-bottom: 3px solid currentColor;
  padding-bottom: 1px;
}

.sig-hilite-icon {
  background: #FFFF00;
  padding: 0 2px 1px;
  border-bottom-color: #FFFF00;
}

.sig-color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: none;
}

/* Visual editor area */
.sig-editor {
  min-height: 110px;
  max-height: 280px;
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  line-height: 1.55;
  color: var(--text);
  outline: none;
  white-space: pre-wrap;
}

.sig-editor:empty::before {
  content: 'Type your signature here…';
  color: #aaa;
  pointer-events: none;
}

.sig-editor a { color: var(--navy); }

/* HTML source textarea */
.sig-source {
  display: block;
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  line-height: 1.55;
  color: var(--text);
  background: #f8f7f4;
  border: none;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
}

/* Live preview */

/* ── Members section — team module embedding fixes ───────────── */

/* Strip the card box from the Members section; team-panels are the visual cards */
#admin-section-members {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  animation: none;
  margin-bottom: 0;
}
#admin-section-members > h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 6px;
}
#admin-section-members > p.section-hint {
  margin-bottom: 20px;
}
/* Reset the portal section-content padding that team.html applies */
#admin-members-host .section-content {
  padding: 0;
}
/* Ensure team panels don't overflow — table scrolls horizontally if needed */
#admin-members-host .team-panel {
  overflow: hidden;
}
#admin-members-host .team-panel .team-table {
  display: block;
  overflow-x: auto;
  width: 100%;
}

/* ── Settings layout ──────────────────────────────────────────── */

.settings-layout {
  display: flex;
  gap: 32px;
}

.settings-nav-col {
  min-width: 180px;
  position: sticky;
  top: 24px;
  align-self: flex-start;
}

.settings-main-col {
  flex: 1;
  min-width: 0;
}

.admin-settings-nav a {
  display: block;
  padding: 8px 12px 8px 6px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}

.admin-settings-nav a:hover {
  color: var(--navy);
  background: var(--cream);
}

.admin-settings-nav a.active {
  color: var(--navy);
  border-left-color: var(--navy);
  font-weight: 500;
}

/* ── Toggle inline row (toggle switch + status label) ─────────── */

.toggle-inline-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.toggle-status-label {
  font-size: 14px;
  color: #6b7280;
}

/* ── Feature toggle rows (email triage allowed features, etc.) ── */

.feature-group-label {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}

.feature-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.feature-toggle-row:last-of-type {
  border-bottom: none;
}

.feature-toggle-info {
  flex: 1;
}

.feature-toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

.feature-toggle-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Shared input / textarea classes ──────────────────────────── */

.settings-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.settings-input:focus {
  border-color: var(--navy);
}

.rules-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.rules-editor {
  width: 100%;
  min-height: 200px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: var(--white);
  resize: vertical;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.rules-editor:focus {
  border-color: var(--navy);
}

.rules-editor[readonly] {
  background: #f9fafb;
  color: var(--text-muted);
  cursor: default;
}

/* ── Form layout utilities ────────────────────────────────────── */

.form-row {
  display: flex;
  gap: 16px;
}

.form-col {
  flex: 1;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

/* ── Training / Corrections shared form panel ─────────────────── */

.training-form-panel {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.training-form-panel h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--navy);
}

.training-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.cancel-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
}

.cancel-btn:hover {
  background: var(--cream);
}

/* ── Training toolbar ─────────────────────────────────────────── */

.training-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.training-toolbar .rules-desc {
  margin-bottom: 0;
  flex: 1;
}

/* ── Firm corrections toolbar ─────────────────────────────────── */

.firm-corrections-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

/* ── Training cards ───────────────────────────────────────────── */

.training-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.training-card.inactive {
  opacity: 0.6;
}

.training-card-body {
  flex: 1;
  min-width: 0;
}

.training-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.training-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.training-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--navy);
  color: #fff;
  white-space: nowrap;
}

.training-badge.tone { background: #7c3aed; }
.training-badge.workflow_override { background: #d97706; }
.training-badge.knowledge { background: #1a7f64; }

.training-badge.employee-badge {
  background: #e5e7eb;
  color: var(--text);
}

.training-card-preview {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.training-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.training-card-actions button {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.training-card-actions button:hover {
  background: var(--cream);
}

.training-card-actions .delete-btn {
  color: #dc2626;
  border-color: #fecaca;
}

.training-card-actions .delete-btn:hover {
  background: #fef2f2;
}

.training-toggle-on { color: #16a34a; border-color: #bbf7d0 !important; }
.training-toggle-off { color: #6b7280; }

/* ── Member corrections member bar ───────────────────────────── */

.corrections-member-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.corrections-member-bar label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.corrections-member-bar .settings-input {
  width: auto;
  min-width: 220px;
}

/* ── Correction card sub-classes ──────────────────────────────── */

.correction-card-body {
  flex: 1;
  min-width: 0;
}

.correction-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.correction-employee-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.correction-source-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: #e5e7eb;
  color: var(--text);
  white-space: nowrap;
}

.correction-updated {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.correction-preview {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.correction-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.correction-card-actions button {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.correction-card-actions button:hover {
  background: var(--cream);
}

.correction-card-actions .delete-btn {
  color: #dc2626;
  border-color: #fecaca;
}

.correction-card-actions .delete-btn:hover {
  background: #fef2f2;
}

.correction-card-actions .promote-btn {
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.correction-card-actions .promote-btn:hover {
  background: #eff6ff;
}

.toggle-active-btn { color: #16a34a; border-color: #bbf7d0 !important; }
.toggle-inactive-btn { color: #6b7280; }

/* ── Rule proposals ───────────────────────────────────────────── */

.proposal-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.proposal-card.has-conflict {
  border-left: 3px solid #dc2626;
}

.proposal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.proposal-badge {
  background: var(--navy);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.proposal-badge.pending { background: #d97706; }
.proposal-badge.approved { background: #16a34a; }
.proposal-badge.rejected { background: #dc2626; }

.proposal-content {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 8px;
}

.proposal-conflict {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #991b1b;
  margin-bottom: 8px;
}

.proposal-conflict strong {
  color: #dc2626;
}

.proposal-actions {
  display: flex;
  gap: 8px;
}

.proposal-actions button {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
}

.proposal-approve-btn { background: #16a34a; color: #fff; }
.proposal-approve-btn:hover { opacity: 0.9; }
.proposal-reject-btn { background: #fff; color: #dc2626; border: 1px solid #dc2626 !important; }
.proposal-reject-btn:hover { background: #fef2f2; }
.proposal-escalate-btn { background: #fff; color: var(--navy); border: 1px solid var(--navy) !important; }
.proposal-escalate-btn:hover { background: var(--cream); }

/* ── Approved Rate Recipients (user picker) ─────────────── */

.rate-recipient-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border, #e3e2de);
  border-radius: 6px;
  margin-bottom: 6px;
}

.rate-recipient-chip-info {
  flex: 1;
  min-width: 0;
}

.rate-recipient-chip-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--navy, #2f3b52);
}

.rate-recipient-chip-sub {
  font-size: 11px;
  color: var(--text-muted, #6b6b6b);
  margin-top: 2px;
}

.rate-recipient-orphan {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 8px;
  background: #fef2f2;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.rate-recipient-delete {
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  flex-shrink: 0;
}

.rate-recipient-delete:hover {
  color: #8b1f17;
}

.rate-recipients-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border, #e3e2de);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  min-width: 280px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 20;
}

.rate-recipients-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--cream-dark, #eee);
  cursor: pointer;
  transition: background 0.15s;
}

.rate-recipients-dropdown-item:last-child {
  border-bottom: none;
}

.rate-recipients-dropdown-item:hover {
  background: var(--cream, #f7f5f0);
}

.rate-recipients-dropdown-empty {
  padding: 14px;
  font-size: 12px;
  color: var(--text-muted, #6b6b6b);
  font-style: italic;
}

/* ── Employee Corrections ────────────────────────────────────── */

.ec-employee-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.ec-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--cream);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.ec-tab:hover {
  background: #fff;
  color: var(--navy);
  border-color: var(--navy);
}

.ec-tab.active {
  background: var(--navy);
  color: var(--cream);
  border-color: var(--navy);
}

.ec-tier-section {
  margin-bottom: 24px;
}

.ec-tier-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.ec-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}

.ec-tier-badge--member { background: #dbeafe; color: #1d4ed8; }
.ec-tier-badge--firm   { background: #dcfce7; color: #166534; }
.ec-tier-badge--rules  { background: #fef9c3; color: #854d0e; }

.ec-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ec-empty-state {
  padding: 12px 0;
  font-style: italic;
}

.ec-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  background: #fff;
}

.ec-card--pending { border-left: 3px solid #3b82f6; }
.ec-card--firm    { border-left: 3px solid #16a34a; }

.ec-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 10px;
}

.ec-from-label,
.ec-source-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ec-card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.ec-card-preview {
  font-size: 13px;
  color: var(--navy);
  line-height: 1.5;
  margin-bottom: 8px;
  word-break: break-word;
}

.ec-card-detail summary {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 6px;
}

.ec-card-full {
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  margin: 0;
}

.ec-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ── Financial Dashboard ─────────────────────────────────────── */

.fin-dash-container {
  max-width: 960px;
  padding-left: 24px;
}

.fin-dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.fin-dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.fin-dash-row .fin-dash-widget {
  margin-bottom: 0;
}

.fin-dash-widget {
  background: var(--white, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}

.fin-dash-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--cream, #f9f7f4);
  border-bottom: 1px solid var(--border, #e5e7eb);
  cursor: pointer;
  user-select: none;
}
.fin-dash-widget-header:hover { background: #f0ede8; }
.fin-dash-widget-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fin-dash-chevron {
  stroke: var(--navy, #1a2e44);
  opacity: 0.5;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.fin-dash-widget--collapsed .fin-dash-chevron { transform: rotate(-90deg); }
.fin-dash-widget--collapsed .fin-dash-widget-body { display: none; }
.fin-dash-widget--collapsed .fin-dash-widget-header { border-bottom: none; }

.fin-dash-widget-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--navy, #1a2e44);
}

.fin-dash-widget-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal, #0d6e6e);
  background: #e6f4f4;
  border-radius: 12px;
  padding: 2px 9px;
  min-width: 40px;
  text-align: center;
  white-space: nowrap;
}
/* Multi-stat badge — used when a widget has several summary numbers */
.fin-dash-widget-badge.multi {
  background: transparent;
  padding: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.fin-dash-badge-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #e6f4f4;
  color: var(--teal, #0d6e6e);
  border-radius: 10px;
  padding: 1px 8px 2px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
}
.fin-dash-badge-stat-label {
  font-size: 9px;
  font-weight: 500;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* Variant: teal-highlighted "main" stat (e.g. Collectable) */
.fin-dash-badge-stat--main {
  background: var(--teal, #0d6e6e);
  color: #fff;
}
.fin-dash-badge-stat--main .fin-dash-badge-stat-label { opacity: 0.85; }
/* Positive / negative net income in P&L badge */
.fin-dash-badge-stat--pos { background: #d1fae5; color: #065f46; }
.fin-dash-badge-stat--neg { background: #fee2e2; color: #991b1b; }

.fin-dash-widget-body {
  padding: 0;
  overflow-x: auto;
}

.fin-dash-loading {
  padding: 16px;
}

.fin-dash-skeleton-row {
  height: 28px;
  background: linear-gradient(90deg, #f0ede8 25%, #e5e1db 50%, #f0ede8 75%);
  background-size: 200% 100%;
  animation: fin-dash-shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.fin-dash-skeleton-row:last-child { margin-bottom: 0; }

@keyframes fin-dash-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.fin-dash-empty {
  padding: 16px;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  margin: 0;
}

.fin-dash-error {
  padding: 12px 16px;
  color: #c0392b;
  font-size: 13px;
  margin: 0;
}

.fin-dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

/* AR aging: fixed layout so the client name doesn't dominate */
#fin-dash-ar-aging .fin-dash-table {
  table-layout: fixed;
}
#fin-dash-ar-aging .fin-dash-table th:first-child,
#fin-dash-ar-aging .fin-dash-table td:first-child {
  width: 34%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#fin-dash-ar-aging .fin-dash-table th:not(:first-child),
#fin-dash-ar-aging .fin-dash-table td:not(:first-child) {
  width: 16.5%;
}

.fin-dash-table thead th {
  padding: 7px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #6b7280);
  background: var(--cream, #f9f7f4);
  border-bottom: 1px solid var(--border, #e5e7eb);
  white-space: nowrap;
}

.fin-dash-table thead th.num { text-align: right; }

.fin-dash-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid #f0ede8;
  color: var(--navy, #1a2e44);
}

.fin-dash-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }

.fin-dash-table tbody tr:last-child td { border-bottom: none; }

.fin-dash-total-row td {
  background: var(--cream, #f9f7f4);
  border-top: 2px solid var(--border, #e5e7eb);
  font-weight: 600;
}

.fin-dash-pos { color: #059669; }
.fin-dash-neg { color: #c0392b; }
.fin-dash-over-budget { background-color: #fef2f2; }
.fin-dash-over-budget td { color: #c0392b; }

.fin-dash-section-heading {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 16px 0 6px;
}
.fin-dash-section-heading:first-child { margin-top: 0; }

.fin-dash-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fin-dash-pnl-table { min-width: 600px; }

/* ── Hourly Projects table: fixed layout so all 8 cols fit without scrolling ─── */
#fin-dash-hourly .fin-dash-table {
  table-layout: fixed;
  font-size: 12px;
}
#fin-dash-hourly .fin-dash-table thead th {
  white-space: normal;
  padding: 6px 8px;
  line-height: 1.25;
}
#fin-dash-hourly .fin-dash-table tbody td {
  padding: 6px 8px;
}
/* Column widths: client 13, matter 22, hours 7, accrued fees 12,
   discount 8, discounted fees 13, expenses 13, gp 12 = 100% */
#fin-dash-hourly .fin-dash-table th:nth-child(1),
#fin-dash-hourly .fin-dash-table td:nth-child(1) { width: 13%; }
#fin-dash-hourly .fin-dash-table th:nth-child(2),
#fin-dash-hourly .fin-dash-table td:nth-child(2) { width: 22%; white-space: normal; word-break: break-word; }
#fin-dash-hourly .fin-dash-table th:nth-child(3),
#fin-dash-hourly .fin-dash-table td:nth-child(3) { width: 7%; }
#fin-dash-hourly .fin-dash-table th:nth-child(4),
#fin-dash-hourly .fin-dash-table td:nth-child(4) { width: 12%; }
#fin-dash-hourly .fin-dash-table th:nth-child(5),
#fin-dash-hourly .fin-dash-table td:nth-child(5) { width: 8%; }
#fin-dash-hourly .fin-dash-table th:nth-child(6),
#fin-dash-hourly .fin-dash-table td:nth-child(6) { width: 13%; }
#fin-dash-hourly .fin-dash-table th:nth-child(7),
#fin-dash-hourly .fin-dash-table td:nth-child(7) { width: 13%; }
#fin-dash-hourly .fin-dash-table th:nth-child(8),
#fin-dash-hourly .fin-dash-table td:nth-child(8) { width: 12%; }

/* ── P&L Cash / Accrual toggle ─────────────────────────────────────── */
.fin-dash-pnl-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid #d1c8b8;
  border-radius: 6px;
  overflow: hidden;
  margin-right: 8px;
}
.fin-dash-toggle-btn {
  background: none;
  border: none;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #7a6f62;
  cursor: pointer;
  line-height: 1.6;
  transition: background 0.15s, color 0.15s;
}
.fin-dash-toggle-btn:first-child { border-right: 1px solid #d1c8b8; }
.fin-dash-toggle-btn:hover { background: #f0ede8; color: #3d2b1f; }
.fin-dash-toggle-btn.active {
  background: #3d2b1f;
  color: #fff;
}

/* ── AR Bad Debt ──────────────────────────────────────────────────────── */
.ar-bad-debt-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  flex-wrap: wrap;
}
.ar-summary-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ar-summary-label {
  font-size: 10px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.ar-summary-val {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}
.ar-summary-item--bad .ar-summary-val { color: #dc2626; }
.ar-summary-item--collectable .ar-summary-val { color: #059669; }
.ar-summary-sep {
  color: #9ca3af;
  font-size: 18px;
  font-weight: 300;
  align-self: center;
}
.ar-bad-debt-row { background-color: #fee2e2 !important; }
.ar-bad-debt-row td { color: #991b1b; }
.ar-bad-debt-cell { white-space: nowrap; padding: 4px 6px; }
.ar-bad-debt-btn {
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  cursor: pointer;
  background: #fff;
  color: #374151;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ar-bad-debt-btn:hover { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.ar-bad-debt-btn.active { background: #fee2e2; border-color: #fca5a5; color: #991b1b; font-weight: 600; }
