/* Reset and base styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  background: #1e1e1e;
  color: #e0e0e0;
}

/* App layout: toolbar on top, canvas fills middle, controls at bottom */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Toolbar */
#toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 12px;
  background: #2d2d2d;
  border-bottom: 1px solid #444;
  align-items: center;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-group + .toolbar-group {
  padding-left: 12px;
  border-left: 1px solid #444;
}

/* Buttons */
button {
  padding: 6px 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

button:hover {
  background: #4a4a4a;
  border-color: #777;
}

button:active {
  background: #555;
}

/* Category selector */
#category-select {
  padding: 5px 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 13px;
  min-width: 140px;
}

label {
  font-size: 13px;
  color: #bbb;
}

/* Canvas container */
#main-content-row {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#image-browser-container {
  display: flex;
  flex-shrink: 0;
}

#canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #111;
}

#annotation-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Loading overlay (shown while dataset/image fetches from S3) */

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(17, 17, 17, 0.85);
  z-index: 100;
  transition: opacity 0.2s ease;
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #4fc3f7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  margin-top: 12px;
  color: #ccc;
  font-size: 14px;
}

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

/* Bottom controls */
#controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #2d2d2d;
  border-top: 1px solid #444;
  flex-shrink: 0;
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Zoom controls */
.zoom-controls #zoom-level {
  min-width: 48px;
  text-align: center;
  font-size: 13px;
  color: #bbb;
}

.zoom-controls #btn-zoom-in,
.zoom-controls #btn-zoom-out {
  min-width: 32px;
  font-size: 16px;
  line-height: 1;
}

/* Navigation controls */
.navigation-controls #frame-input {
  width: 60px;
  padding: 5px 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 13px;
  text-align: center;
}

#image-counter {
  font-size: 13px;
  color: #bbb;
  margin-left: 8px;
}

/* Clipboard status */
#clipboard-display {
  font-size: 13px;
  color: #999;
}

/* ============================================
   Auth UI Styles
   ============================================ */

/* --- Focus indicators for all interactive elements --- */
.login-form input:focus,
.login-submit:focus,
.profile-display__btn:focus,
.akp-close-btn:focus,
.akp-copy-btn:focus,
.akp-revoke-btn:focus,
.akp-create-btn:focus,
.akp-input-row input:focus,
.member-panel-close-btn:focus,
.member-panel-email-input:focus,
.member-panel-role-select:focus,
.member-panel-assign-btn:focus,
.member-panel-remove-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- Loading indicator --- */
#auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #1e1e1e;
  color: #bbb;
  font-size: 16px;
}

/* --- Login Page --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #1e1e1e;
}

.login-form-wrapper {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
}

.login-title {
  margin-bottom: 8px;
  font-size: 22px;
  font-weight: 600;
  color: #e0e0e0;
  text-align: center;
}

.login-message {
  margin-bottom: 16px;
  font-size: 13px;
  color: #bbb;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-field label {
  font-size: 13px;
  color: #bbb;
}

.login-field input {
  padding: 8px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 14px;
}

.login-field input::placeholder {
  color: #888;
}

.login-error {
  padding: 8px 10px;
  border-radius: 4px;
  background: #4a2020;
  border: 1px solid #7a3030;
  color: #f0a0a0;
  font-size: 13px;
}

.login-error:empty {
  display: none;
}

.login-submit {
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.login-submit:hover {
  background: #3a8eef;
}

.login-submit:active {
  background: #2a7edf;
}

.login-forgot-link,
.login-back-link {
  display: block;
  text-align: center;
  font-size: 13px;
  color: #4a9eff;
  text-decoration: none;
  cursor: pointer;
}

.login-forgot-link:hover,
.login-back-link:hover {
  color: #3a8eef;
  text-decoration: underline;
}

.login-success {
  padding: 8px 10px;
  border-radius: 4px;
  background: #1a3a2a;
  border: 1px solid #2a7a4a;
  color: #80d0a0;
  font-size: 13px;
}

.login-success:empty {
  display: none;
}

/* --- Profile Display --- */
.profile-display {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.profile-display__user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.profile-display__email {
  font-size: 13px;
  color: #e0e0e0;
}

.profile-display__role {
  font-size: 11px;
  color: #999;
}

.profile-display__actions {
  display: flex;
  gap: 6px;
}

.profile-display__btn {
  padding: 5px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.profile-display__btn:hover {
  background: #4a4a4a;
  border-color: #777;
}

.profile-display__btn--logout {
  border-color: #7a3030;
  color: #f0a0a0;
}

.profile-display__btn--logout:hover {
  background: #4a2020;
  border-color: #a04040;
}

.profile-display__btn--api-keys,
.profile-display__btn--members {
  /* inherits base .profile-display__btn styles */
}

/* --- API Key Panel --- */
.akp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.akp-panel {
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
}

.akp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.akp-title {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

.akp-close-btn {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 16px;
}

.akp-close-btn:hover {
  background: #4a4a4a;
}

.akp-error {
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: #4a2020;
  border: 1px solid #7a3030;
  color: #f0a0a0;
  font-size: 13px;
}

.akp-error:empty {
  display: none;
}

/* New key display */
.akp-new-key-display {
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 4px;
  background: #1a3a1a;
  border: 1px solid #2a6a2a;
}

.akp-new-key-warning {
  font-size: 12px;
  color: #f0c040;
  margin-bottom: 8px;
  font-weight: 500;
}

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

.akp-new-key-text {
  flex: 1;
  padding: 6px 8px;
  border-radius: 4px;
  background: #2d2d2d;
  border: 1px solid #444;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
}

.akp-copy-btn {
  padding: 5px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.akp-copy-btn:hover {
  background: #4a4a4a;
}

/* Key list */
.akp-key-list-container {
  margin-bottom: 16px;
}

.akp-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.akp-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #3a3a3a;
  border: 1px solid #444;
  border-radius: 4px;
}

.akp-key-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.akp-key-label {
  font-size: 13px;
  color: #e0e0e0;
  font-weight: 500;
}

.akp-key-prefix {
  font-size: 12px;
  color: #999;
  font-family: monospace;
}

.akp-key-date {
  font-size: 11px;
  color: #777;
}

.akp-revoke-btn {
  padding: 4px 10px;
  border: 1px solid #7a3030;
  border-radius: 4px;
  background: transparent;
  color: #f0a0a0;
  cursor: pointer;
  font-size: 12px;
}

.akp-revoke-btn:hover {
  background: #4a2020;
  border-color: #a04040;
}

/* Create key form */
.akp-create-form {
  border-top: 1px solid #444;
  padding-top: 16px;
}

.akp-input-row {
  display: flex;
  gap: 8px;
}

.akp-input-row input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 13px;
}

.akp-input-row input::placeholder {
  color: #888;
}

.akp-create-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.akp-create-btn:hover {
  background: #3a8eef;
}

/* --- Member Panel --- */
.member-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.member-panel {
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
}

.member-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

.member-panel-close-btn {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 16px;
}

.member-panel-close-btn:hover {
  background: #4a4a4a;
}

/* Member form */
.member-panel-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.member-panel-form-row {
  display: flex;
  gap: 8px;
  flex: 1;
}

.member-panel-email-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 13px;
}

.member-panel-email-input::placeholder {
  color: #888;
}

.member-panel-role-select {
  padding: 7px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 13px;
  min-width: 100px;
}

.member-panel-assign-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.member-panel-assign-btn:hover {
  background: #3a8eef;
}

.member-panel-error {
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: #4a2020;
  border: 1px solid #7a3030;
  color: #f0a0a0;
  font-size: 13px;
}

.member-panel-error:empty {
  display: none;
}

/* Member list */
.member-panel-list {
  border-top: 1px solid #444;
  padding-top: 16px;
}

.member-panel-table {
  width: 100%;
  border-collapse: collapse;
}

.member-panel-table th,
.member-panel-table td {
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid #3a3a3a;
}

.member-panel-table th {
  color: #999;
  font-weight: 500;
  font-size: 12px;
}

.member-panel-table td {
  color: #e0e0e0;
}

.member-panel-remove-btn {
  padding: 3px 8px;
  border: 1px solid #7a3030;
  border-radius: 4px;
  background: transparent;
  color: #f0a0a0;
  cursor: pointer;
  font-size: 12px;
}

.member-panel-remove-btn:hover {
  background: #4a2020;
  border-color: #a04040;
}

.member-panel-empty {
  padding: 16px;
  text-align: center;
  color: #777;
  font-size: 13px;
}


/* ============================================
   Project Browser Styles
   ============================================ */

/* --- Project Browser Page --- */
.pb-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #1e1e1e;
  padding: 24px 32px;
  overflow-y: auto;
}

.pb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.pb-title {
  font-size: 22px;
  font-weight: 600;
  color: #e0e0e0;
}

.pb-btn-create {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.pb-btn-create:hover {
  background: #3a8eef;
}

.pb-btn-create:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.pb-btn-refresh {
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 4px;
  background: transparent;
  color: #ccc;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-left: 8px;
}

.pb-btn-refresh:hover {
  background: #333;
  border-color: #777;
  color: #fff;
}

.pb-btn-refresh:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Project List --- */
.pb-list {
  flex: 1;
}

.pb-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* --- Project Card --- */
.pb-project-card {
  position: relative;
  padding: 16px;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.pb-project-card:hover {
  border-color: #4a9eff;
  background: #333;
}

.pb-project-card:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.pb-project-name {
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 6px;
}

.pb-project-desc {
  font-size: 13px;
  color: #bbb;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.pb-project-date {
  font-size: 12px;
  color: #777;
}

.pb-btn-card-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border: 1px solid #7a3030;
  border-radius: 4px;
  background: transparent;
  color: #f0a0a0;
  cursor: pointer;
  font-size: 12px;
}

.pb-btn-card-delete:hover {
  background: #4a2020;
  border-color: #a04040;
}

/* --- Loading State --- */
.pb-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #bbb;
  font-size: 15px;
}

/* --- Empty State --- */
.pb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #777;
  font-size: 15px;
  text-align: center;
}

/* --- Error State --- */
.pb-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 12px;
}

.pb-error-message {
  color: #f0a0a0;
  font-size: 14px;
  text-align: center;
}

.pb-btn-retry {
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
}

.pb-btn-retry:hover {
  background: #4a4a4a;
  border-color: #777;
}

/* --- Modal Overlay --- */
.pb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.pb-modal {
  width: 100%;
  max-width: 460px;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
}

.pb-modal--confirm {
  max-width: 400px;
}

.pb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pb-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

.pb-modal-close-btn {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 16px;
}

.pb-modal-close-btn:hover {
  background: #4a4a4a;
}

/* --- Create Form --- */
.pb-create-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.pb-form-field label {
  font-size: 13px;
  color: #bbb;
}

.pb-form-field input,
.pb-form-field textarea {
  padding: 8px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.pb-form-field input::placeholder,
.pb-form-field textarea::placeholder {
  color: #888;
}

.pb-form-field input:focus,
.pb-form-field textarea:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.pb-form-error {
  padding: 8px 10px;
  border-radius: 4px;
  background: #4a2020;
  border: 1px solid #7a3030;
  color: #f0a0a0;
  font-size: 13px;
}

.pb-form-error:empty {
  display: none;
}

/* --- Modal Actions --- */
.pb-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.pb-btn-cancel {
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
}

.pb-btn-cancel:hover {
  background: #4a4a4a;
  border-color: #777;
}

.pb-btn-submit {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.pb-btn-submit:hover {
  background: #3a8eef;
}

.pb-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pb-btn-delete {
  padding: 8px 16px;
  border: 1px solid #7a3030;
  border-radius: 4px;
  background: #4a2020;
  color: #f0a0a0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.pb-btn-delete:hover {
  background: #5a2a2a;
  border-color: #a04040;
}

.pb-btn-delete:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Confirmation Message --- */
.pb-confirm-message {
  font-size: 14px;
  color: #ccc;
  line-height: 1.5;
}

.pb-confirm-message strong {
  color: #e0e0e0;
}

/* ============================================
   Image Browser Panel Styles
   ============================================ */

.ib-panel {
  display: flex;
  flex-direction: column;
  width: 260px;
  min-width: 180px;
  max-width: 500px;
  height: 100%;
  background: #2d2d2d;
  border-right: 1px solid #444;
  overflow: hidden;
  position: relative;
}

/* Resize handle on the right edge of the panel */
.ib-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 10;
}

.ib-resize-handle:hover,
.ib-resize-handle.ib-resizing {
  background: #4a9eff;
}

/* --- Search Bar --- */
.ib-search-container {
  padding: 8px 12px;
  border-bottom: 1px solid #444;
  flex-shrink: 0;
}

.ib-search-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #1e1e1e;
  color: #e0e0e0;
  outline: none;
  box-sizing: border-box;
}

.ib-search-input:focus {
  border-color: #4a9eff;
}

.ib-search-input::placeholder {
  color: #888;
}

/* --- Folder Grouping --- */
.ib-folder-header {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  background: #353535;
  border-bottom: 1px solid #3a3a3a;
  user-select: none;
}

.ib-folder-header:hover {
  background: #3e3e3e;
}

.ib-folder-header:focus {
  outline: 2px solid #4a9eff;
  outline-offset: -2px;
}

.ib-folder-arrow {
  font-size: 10px;
  color: #999;
  margin-right: 6px;
  width: 12px;
}

.ib-folder-name {
  font-size: 13px;
  font-weight: 500;
  color: #e0e0e0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ib-folder-count {
  font-size: 11px;
  color: #888;
  background: #444;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
}

.ib-folder-content {
  /* Indent folder contents slightly */
}

.ib-folder-content .ib-image-item {
  padding-left: 24px;
}

.ib-header {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #444;
  flex-shrink: 0;
}

.ib-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
}

.ib-btn-import {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #4a9eff;
  border-radius: 4px;
  background: transparent;
  color: #4a9eff;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ib-btn-import:hover {
  background: #4a9eff;
  color: #fff;
}

.ib-btn-import:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.ib-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0;
}

/* --- Image Item --- */
.ib-image-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.ib-image-item:hover {
  background: #3a3a3a;
}

.ib-image-item:focus {
  outline: 2px solid #4a9eff;
  outline-offset: -2px;
}

.ib-image-name {
  font-size: 13px;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Load More Button --- */
.ib-btn-load-more {
  display: block;
  width: calc(100% - 24px);
  margin: 8px 12px;
  padding: 8px 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
}

.ib-btn-load-more:hover {
  background: #4a4a4a;
  border-color: #777;
}

.ib-btn-load-more:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Loading State --- */
.ib-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  color: #bbb;
  font-size: 13px;
}

/* --- Empty State --- */
.ib-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  color: #777;
  font-size: 13px;
  text-align: center;
}

/* --- Error State --- */
.ib-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 12px;
  gap: 8px;
}

.ib-error-message {
  color: #f0a0a0;
  font-size: 13px;
  text-align: center;
}

.ib-btn-retry {
  padding: 6px 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 12px;
}

.ib-btn-retry:hover {
  background: #4a4a4a;
  border-color: #777;
}

/* ===========================
   Import Panel Styles
   =========================== */

.ip-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.ip-panel {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #e0e0e0;
}

.ip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #444;
}

.ip-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.ip-close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.ip-close-btn:hover {
  background: #3a3a3a;
  color: #fff;
}

/* Tabs */
.ip-tabs {
  display: flex;
  border-bottom: 1px solid #444;
  padding: 0 12px;
}

.ip-tab {
  padding: 10px 16px;
  border: none;
  background: none;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.ip-tab:hover {
  color: #e0e0e0;
}

.ip-tab-active {
  color: #4a9eff;
  border-bottom-color: #4a9eff;
}

.ip-tab-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.ip-close-btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Content area */
.ip-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 200px;
}

/* Error display */
.ip-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: #3a2020;
  border-bottom: 1px solid #5a3030;
}

.ip-error-message {
  flex: 1;
  color: #f0a0a0;
  font-size: 13px;
}

/* Buttons */
.ip-btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #555;
  transition: background 0.2s;
}

.ip-btn-primary {
  background: #4a9eff;
  color: #fff;
  border-color: #4a9eff;
}

.ip-btn-primary:hover {
  background: #3a8eef;
}

.ip-btn-secondary {
  background: #3a3a3a;
  color: #e0e0e0;
}

.ip-btn-secondary:hover {
  background: #4a4a4a;
}

.ip-btn-retry {
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 12px;
  padding: 4px 10px;
}

.ip-btn-retry:hover {
  background: #4a4a4a;
}

/* Description text */
.ip-description {
  color: #bbb;
  font-size: 13px;
  margin: 0 0 16px 0;
}

/* Loading */
.ip-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
}

.ip-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #444;
  border-top-color: #4a9eff;
  border-radius: 50%;
  animation: ip-spin 0.8s linear infinite;
}

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

.ip-loading-message {
  color: #bbb;
  font-size: 13px;
  margin: 0;
}

/* Batch Progress */
.ip-batch-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
}

.ip-batch-progress-message {
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  text-align: center;
}

.ip-batch-progress-bar {
  width: 80%;
  max-width: 300px;
  height: 6px;
  background: #444;
  border-radius: 3px;
  overflow: hidden;
}

.ip-batch-progress-fill {
  height: 100%;
  background: #4a9eff;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* S3 Browser */
.ip-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0 0 12px 0;
}

.ip-bucket-list,
.ip-folder-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ip-bucket-item,
.ip-folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #e0e0e0;
  transition: background 0.15s;
}

.ip-bucket-item:hover,
.ip-folder-item:hover {
  background: #3a3a3a;
}

.ip-bucket-item:focus,
.ip-folder-item:focus {
  outline: 2px solid #4a9eff;
  outline-offset: -2px;
}

.ip-folder-icon {
  font-size: 16px;
}

/* Folder navigation */
.ip-folder-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ip-current-path {
  font-size: 12px;
  color: #aaa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ip-image-count {
  font-size: 13px;
  color: #4a9eff;
  margin-bottom: 12px;
  padding: 6px 10px;
  background: #1a3050;
  border-radius: 4px;
}

.ip-empty-folder {
  color: #777;
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

.ip-btn-confirm {
  margin-top: 16px;
  width: 100%;
}

.ip-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
  background: #1e293b;
  border-radius: 6px;
  border: 1px solid #334155;
}

.ip-selection-count {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.ip-btn-batch-import {
  flex-shrink: 0;
  margin-left: 12px;
}

.ip-folder-checkbox {
  margin-right: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.ip-select-all-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.ip-btn-link {
  background: none;
  border: none;
  color: #4a9eff;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.ip-btn-link:hover {
  background: #2a2a2a;
  text-decoration: underline;
}

.ip-btn-link:focus {
  outline: 2px solid #4a9eff;
  outline-offset: -2px;
}

/* Upload */
.ip-upload-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ip-file-input {
  display: none;
}

.ip-file-label {
  display: inline-block;
  padding: 8px 16px;
  background: #3a3a3a;
  border: 1px dashed #666;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}

.ip-file-label:hover {
  background: #4a4a4a;
  border-color: #4a9eff;
}

.ip-file-info {
  font-size: 12px;
  color: #777;
}

.ip-selected-files {
  font-size: 13px;
  color: #bbb;
}

/* Results */
.ip-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ip-result-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.ip-result-status {
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
}

.ip-result-success {
  background: #1a3a1a;
  color: #80e080;
}

.ip-result-partial {
  background: #3a3a1a;
  color: #e0c060;
}

.ip-result-counts,
.ip-result-move-counts {
  display: flex;
  gap: 16px;
}

.ip-count-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  background: #333;
  border-radius: 4px;
  min-width: 70px;
}

.ip-count-number {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.ip-count-label {
  font-size: 11px;
  color: #aaa;
  margin-top: 2px;
}

.ip-count-success .ip-count-number {
  color: #80e080;
}

.ip-count-skipped .ip-count-number {
  color: #e0c060;
}

.ip-count-failed .ip-count-number {
  color: #f08080;
}

/* Result details (expandable) */
.ip-result-details {
  border: 1px solid #444;
  border-radius: 4px;
  padding: 8px 12px;
}

.ip-result-details summary {
  cursor: pointer;
  font-size: 13px;
  color: #bbb;
}

.ip-result-details summary:hover {
  color: #e0e0e0;
}

.ip-conflict-list,
.ip-failure-list {
  list-style: none;
  padding: 8px 0 0 0;
  margin: 0;
  max-height: 120px;
  overflow-y: auto;
}

.ip-conflict-list li,
.ip-failure-list li {
  font-size: 12px;
  color: #aaa;
  padding: 2px 0;
}

/* Verification Summary */
.ip-verification-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ip-verification-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #aaa;
}

.ip-verification-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #555;
  border-top-color: #80b0ff;
  border-radius: 50%;
  animation: ip-spin 0.8s linear infinite;
}

.ip-verification-split {
  font-size: 13px;
  color: #80e080;
  padding: 6px 10px;
  background: #1a3a1a;
  border-radius: 4px;
}

.ip-verification-no-split {
  font-size: 13px;
  color: #bbb;
  padding: 6px 10px;
  background: #2a2a2a;
  border-radius: 4px;
}

.ip-verification-warning {
  font-size: 13px;
  color: #e0a040;
  padding: 6px 10px;
  background: #3a3018;
  border-radius: 4px;
}


.ip-upload-btn-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}


/* Image item delete button */
.ib-btn-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: #777;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.ib-image-item:hover .ib-btn-delete {
  opacity: 1;
}

.ib-btn-delete:hover {
  color: #f08080;
  background: rgba(240, 128, 128, 0.15);
}


/* Image browser header buttons */
.ib-header-btns {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.ib-btn-select-mode {
  padding: 3px 8px;
  border: 1px solid #555;
  border-radius: 3px;
  background: #333;
  color: #ccc;
  font-size: 11px;
  cursor: pointer;
}

.ib-btn-select-mode:hover {
  background: #444;
  color: #fff;
}

/* Actions bar (multi-select mode) */
.ib-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #333;
  border-bottom: 1px solid #444;
}

.ib-action-btn {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 3px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 12px;
  cursor: pointer;
}

.ib-action-btn:hover {
  background: #4a4a4a;
}

.ib-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ib-action-btn-unlink {
  border-color: #555;
  color: #e0e0e0;
  background: #3a3a3a;
}

.ib-action-btn-unlink:hover {
  background: #4a4a4a;
  border-color: #777;
}

.ib-action-btn-danger {
  border-color: #a04040;
  color: #f08080;
  background: #3a2020;
}

.ib-action-btn-danger:hover {
  background: #4a2020;
  border-color: #c05050;
}

.ib-action-btn-danger:disabled,
.ib-action-btn-danger[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  background: #2d2d2d;
  border-color: #555;
  color: #888;
}

/* Styled confirmation dialog (replaces native confirm()) */
.ib-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.ib-confirm-dialog {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
  min-width: 320px;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.ib-confirm-title {
  margin: 0 0 12px;
  font-size: 16px;
  color: #e0e0e0;
}

.ib-confirm-message {
  margin: 0 0 20px;
  font-size: 14px;
  color: #aaa;
  line-height: 1.4;
}

.ib-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ib-confirm-btn {
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #333;
  color: #ddd;
  font-size: 13px;
  cursor: pointer;
}

.ib-confirm-btn:hover {
  background: #444;
}

.ib-confirm-btn-danger {
  background: #8b2020;
  border-color: #a04040;
  color: #fff;
}

.ib-confirm-btn-danger:hover {
  background: #a52b2b;
}

.ib-confirm-btn-cancel {
  background: #333;
}

.ib-confirm-btn-unlink {
  background: #2a4a6a;
  border-color: #3a6a9a;
  color: #ddd;
}

.ib-confirm-btn-unlink:hover {
  background: #3a5a7a;
}

.ib-selection-count {
  font-size: 12px;
  color: #aaa;
  margin-left: auto;
}

/* Checkbox in select mode */
.ib-checkbox {
  margin-right: 8px;
  cursor: pointer;
}

.ib-image-item-selected {
  background: #2a3a4a;
}

/* Footer with Dataset actions */
.ib-footer {
  padding: 8px 12px;
  border-top: 1px solid #444;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.ib-footer-label {
  font-size: 11px;
  color: #888;
  margin-right: 4px;
}

.ib-footer-btn {
  padding: 5px 10px;
  border: 1px solid #555;
  border-radius: 3px;
  background: #333;
  color: #ccc;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ib-footer-btn:hover {
  background: #444;
  border-color: #4a9eff;
  color: #fff;
}


/* ===========================
   Split Panel Styles
   =========================== */

.sp-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.sp-panel {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #444;
}

.sp-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

.sp-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.sp-close-btn:hover {
  background: #3a3a3a;
  color: #fff;
}

.sp-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Error display */
.sp-error {
  padding: 10px 20px;
  background: #3a1a1a;
  color: #f0a0a0;
  font-size: 13px;
  border-bottom: 1px solid #5a2a2a;
}

/* Loading */
.sp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 0;
  gap: 12px;
}

.sp-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #444;
  border-top-color: #4a9eff;
  border-radius: 50%;
  animation: sp-spin 0.8s linear infinite;
}

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

.sp-loading-message {
  color: #bbb;
  font-size: 13px;
}

/* Sections */
.sp-section {
  margin-bottom: 20px;
}

.sp-section-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
  margin-bottom: 8px;
}

.sp-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 8px;
}

.sp-description {
  color: #bbb;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Radio groups */
.sp-radio-group {
  display: flex;
  gap: 16px;
}

.sp-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #e0e0e0;
  cursor: pointer;
}

.sp-radio {
  accent-color: #4a9eff;
}

/* Ratio inputs */
.sp-ratio-inputs {
  display: flex;
  gap: 12px;
}

.sp-ratio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sp-ratio-label {
  font-size: 11px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sp-ratio-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #333;
  color: #e0e0e0;
  font-size: 14px;
  text-align: center;
}

.sp-ratio-input:focus {
  outline: none;
  border-color: #4a9eff;
}

.sp-ratio-percent {
  font-size: 12px;
  color: #888;
  text-align: center;
}

.sp-ratio-sum {
  margin-top: 8px;
  font-size: 12px;
  color: #aaa;
}

.sp-ratio-sum-valid {
  color: #80e080;
}

.sp-ratio-sum-invalid {
  color: #f0a0a0;
}

.sp-validation-error {
  color: #f0a0a0;
  font-size: 12px;
  margin-top: 4px;
}

/* Info and warning messages */
.sp-info-message {
  margin-top: 8px;
  padding: 8px 12px;
  background: #1a2a3a;
  border: 1px solid #2a4a6a;
  border-radius: 4px;
  color: #8ac4ff;
  font-size: 12px;
}

.sp-warning-message {
  margin-top: 8px;
  padding: 8px 12px;
  background: #3a3a1a;
  border: 1px solid #5a5a2a;
  border-radius: 4px;
  color: #e0c060;
  font-size: 12px;
}

/* Buttons */
.sp-btn {
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.sp-btn-primary {
  background: #4a9eff;
  color: #fff;
  border-color: #4a9eff;
}

.sp-btn-primary:hover {
  background: #3a8eef;
}

.sp-btn-secondary {
  background: #3a3a3a;
  color: #e0e0e0;
  border-color: #555;
}

.sp-btn-secondary:hover {
  background: #4a4a4a;
}

.sp-btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sp-btn-submit {
  width: 100%;
  margin-top: 8px;
  padding: 10px 16px;
  font-size: 14px;
}

/* Existing split detection */
.sp-existing-split {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sp-detected-counts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: #333;
  border-radius: 4px;
}

.sp-detected-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.sp-detected-name {
  color: #e0e0e0;
  font-weight: 500;
  text-transform: capitalize;
}

.sp-detected-count {
  color: #4a9eff;
}

.sp-existing-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* Progress */
.sp-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 0;
  gap: 12px;
}

.sp-progress-message {
  color: #e0e0e0;
  font-size: 14px;
}

.sp-progress-count {
  color: #bbb;
  font-size: 13px;
}

.sp-progress-bar {
  width: 100%;
  height: 6px;
  background: #444;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.sp-progress-fill {
  height: 100%;
  background: #4a9eff;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Result */
.sp-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sp-result-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
}

.sp-result-status {
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
}

.sp-result-success {
  background: #1a3a1a;
  color: #80e080;
}

.sp-result-partial {
  background: #3a3a1a;
  color: #e0c060;
}

.sp-result-counts {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.sp-count-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  background: #333;
  border-radius: 4px;
  min-width: 80px;
}

.sp-count-number {
  font-size: 20px;
  font-weight: 700;
  color: #4a9eff;
}

.sp-count-label {
  font-size: 11px;
  color: #aaa;
  text-transform: capitalize;
  margin-top: 4px;
}

.sp-count-failed .sp-count-number {
  color: #f08080;
}

/* ============================================
   File-Level Import Progress & Cancel Styles
   ============================================ */

/* Container for the entire file progress section */
.ip-file-progress-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  width: 100%;
}

/* Progress bar container - matches .ip-batch-progress-bar pattern */
.ip-file-progress-bar {
  width: 80%;
  max-width: 300px;
  height: 6px;
  background: #444;
  border-radius: 3px;
  overflow: hidden;
}

/* Filled portion of the progress bar with smooth transition */
.ip-file-progress-fill {
  height: 100%;
  background: #4a9eff;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Label showing "X of Y files copied" */
.ip-file-progress-label {
  font-size: 13px;
  color: #bbb;
  text-align: center;
  margin: 0;
}

/* Current file name being processed */
.ip-current-file {
  font-size: 12px;
  color: #999;
  text-align: center;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cancel button */
.ip-cancel-btn {
  padding: 8px 16px;
  border: 1px solid #7a3030;
  border-radius: 4px;
  background: transparent;
  color: #f0a0a0;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.ip-cancel-btn:hover {
  background: #4a2020;
  border-color: #a04040;
}

.ip-cancel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: transparent;
  border-color: #555;
  color: #777;
}


/* ============================================
   Section Selector Styles (Dataset Selector)
   ============================================ */

/* Container: horizontal flex row with wrapping for narrow panels */
.ds-section-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid #444;
  flex-shrink: 0;
}

/* Section buttons */
.ds-section-btn {
  padding: 5px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ds-section-btn:hover {
  background: #4a4a4a;
  border-color: #777;
  color: #fff;
}

.ds-section-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* Active section button — highlighted background */
.ds-section-active {
  background: #4a9eff;
  border-color: #4a9eff;
  color: #fff;
  font-weight: 500;
}

.ds-section-active:hover {
  background: #3a8eef;
  border-color: #3a8eef;
}


/* ============================================
   Dataset Panel Styles
   ============================================ */

.dp-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.dp-panel {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #e0e0e0;
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #444;
}

.dp-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.dp-close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.dp-close-btn:hover {
  background: #3a3a3a;
  color: #fff;
}

/* Tabs */
.dp-tabs {
  display: flex;
  border-bottom: 1px solid #444;
  padding: 0 12px;
}

.dp-tab {
  padding: 10px 16px;
  border: none;
  background: none;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.dp-tab:hover {
  color: #e0e0e0;
}

.dp-tab-active {
  color: #4a9eff;
  border-bottom-color: #4a9eff;
}

/* Content area */
.dp-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 200px;
}

/* Error display */
.dp-error {
  padding: 10px 20px;
  background: #3a2020;
  border-bottom: 1px solid #5a3030;
  color: #f0a0a0;
  font-size: 13px;
}

/* Description text */
.dp-description {
  color: #bbb;
  font-size: 13px;
  margin: 0 0 16px 0;
}

/* Action button */
.dp-action-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.dp-action-btn:hover {
  background: #3a8eef;
}

.dp-action-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* Loading */
.dp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
  color: #bbb;
  font-size: 13px;
}

/* Navigation bar (for S3 browsing) */
.dp-nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dp-back-btn {
  padding: 5px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 12px;
}

.dp-back-btn:hover {
  background: #4a4a4a;
  border-color: #777;
}

.dp-path-label {
  font-size: 12px;
  color: #aaa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Item list (buckets, folders, json files) */
.dp-item-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.dp-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  border-radius: 4px;
  background: none;
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s;
}

.dp-list-item:hover {
  background: #3a3a3a;
}

.dp-list-item:focus {
  outline: 2px solid #4a9eff;
  outline-offset: -2px;
}

.dp-list-item-folder {
  color: #e0e0e0;
}

.dp-list-item-json {
  color: #4a9eff;
}

/* Empty state */
.dp-empty {
  color: #777;
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

/* Result display */
.dp-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 0;
}

.dp-result-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1a3a1a;
  color: #80e080;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
}

.dp-result-message {
  font-size: 14px;
  color: #e0e0e0;
  text-align: center;
  margin: 0;
}

/* Footer button styling for Dataset button */
.ib-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #444;
  flex-shrink: 0;
}

.ib-footer-btn {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #ccc;
  cursor: pointer;
}

.ib-footer-btn:hover {
  background: #4a4a4a;
  border-color: #777;
  color: #fff;
}

/* Header buttons container */
.ib-header-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.ib-btn-select-mode {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #ccc;
  cursor: pointer;
}

.ib-btn-select-mode:hover {
  background: #4a4a4a;
  border-color: #777;
  color: #fff;
}


/* Sync button */
.ib-btn-sync {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #ccc;
  cursor: pointer;
  line-height: 1;
}

.ib-btn-sync:hover {
  background: #4a4a4a;
  border-color: #777;
  color: #fff;
}

.ib-btn-sync:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.ib-btn-sync:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #333;
  border-color: #444;
  color: #888;
}


/* Dataset Panel - Loading with progress bar */
.dp-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 20px;
}

.dp-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #444;
  border-top-color: #4a9eff;
  border-radius: 50%;
  animation: dp-spin 0.8s linear infinite;
}

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

.dp-loading-message {
  color: #bbb;
  font-size: 13px;
  margin: 0;
}

.dp-progress-bar {
  width: 80%;
  max-width: 280px;
  height: 4px;
  background: #444;
  border-radius: 2px;
  overflow: hidden;
}

.dp-progress-container {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.dp-progress-container .dp-progress-bar {
  flex: 1;
  max-width: 280px;
}

.dp-progress-text {
  font-size: 13px;
  color: #ccc;
  min-width: 36px;
  text-align: right;
}

.dp-progress-fill {
  height: 100%;
  background: #4a9eff;
  border-radius: 2px;
}

.dp-progress-indeterminate {
  width: 40%;
  animation: dp-progress-slide 1.2s ease-in-out infinite;
}

@keyframes dp-progress-slide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(200%); }
  100% { transform: translateX(-100%); }
}

/* Dataset Panel - Validation Report */
.dp-validation-report {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1e1e1e;
}

.dp-validation-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.dp-validation-icon {
  font-size: 18px;
}

.dp-validation-success {
  color: #4caf50;
}

.dp-validation-warning {
  color: #ff9800;
}

.dp-validation-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.dp-validation-count {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #2a2a2a;
  color: #ccc;
}

.dp-validation-count-matched {
  color: #4caf50;
}

.dp-validation-count-missing {
  color: #f44336;
}

.dp-validation-count-untracked {
  color: #ff9800;
}

.dp-validation-count-duplicates {
  color: #ffeb3b;
}

.dp-validation-details {
  margin-top: 8px;
  border: 1px solid #333;
  border-radius: 4px;
  overflow: hidden;
}

.dp-validation-details summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #bbb;
  background: #252525;
  user-select: none;
}

.dp-validation-details summary:hover {
  background: #2e2e2e;
  color: #e0e0e0;
}

.dp-validation-details[open] summary {
  border-bottom: 1px solid #333;
}

.dp-validation-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  max-height: 200px;
  overflow-y: auto;
}

.dp-validation-list li {
  padding: 4px 0;
  font-size: 12px;
  color: #aaa;
  border-bottom: 1px solid #2a2a2a;
}

.dp-validation-list li:last-child {
  border-bottom: none;
}

/* ============================================
   Assignment Panel Styles
   ============================================ */

.assignment-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.assignment-panel {
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
}

.assignment-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.assignment-panel-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
}

.assignment-panel-close-btn {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 16px;
}

.assignment-panel-close-btn:hover {
  background: #4a4a4a;
}

.assignment-panel-form {
  margin-bottom: 16px;
}

.assignment-panel-form h3 {
  font-size: 14px;
  font-weight: 600;
  color: #ccc;
  margin: 0 0 10px 0;
}

.assignment-panel-form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.assignment-panel-total-images {
  font-size: 14px;
  font-weight: 600;
  color: #4a9eff;
  margin: 8px 0;
}

.assignment-panel-field {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.assignment-panel-label {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 4px;
}

.assignment-panel-select,
.assignment-panel-input {
  padding: 7px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 13px;
}

.assignment-panel-assign-btn {
  padding: 7px 16px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.assignment-panel-assign-btn:hover {
  background: #3a8eef;
}

.assignment-panel-success {
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: #1a3a1a;
  border: 1px solid #2a5a2a;
  color: #6fcf6f;
  font-size: 13px;
}

.assignment-panel-error {
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: #3a1a1a;
  border: 1px solid #5a2a2a;
  color: #ff6b6b;
  font-size: 13px;
}

.assignment-panel-list {
  margin-top: 16px;
}

.assignment-panel-empty {
  color: #888;
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

.assignment-panel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.assignment-panel-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #555;
  color: #aaa;
  font-weight: 600;
}

.assignment-panel-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #3a3a3a;
  color: #e0e0e0;
}

.assignment-panel-remove-btn {
  padding: 4px 10px;
  border: 1px solid #5a2a2a;
  border-radius: 4px;
  background: #3a1a1a;
  color: #ff6b6b;
  cursor: pointer;
  font-size: 12px;
}

.assignment-panel-remove-btn:hover {
  background: #4a2a2a;
}

/* ============================================
   Progress Dashboard Styles
   ============================================ */

.progress-dashboard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.progress-dashboard-panel {
  width: 100%;
  max-width: 900px;
  max-height: 80vh;
  overflow-y: auto;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
}

.progress-dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

.progress-dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-dashboard-refresh-btn {
  padding: 5px 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
}

.progress-dashboard-refresh-btn:hover {
  background: #4a4a4a;
  border-color: #777;
}

.progress-dashboard-refresh-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.progress-dashboard-close-btn {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 16px;
}

.progress-dashboard-close-btn:hover {
  background: #4a4a4a;
}

.progress-dashboard-close-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.progress-dashboard-error {
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: #4a2020;
  border: 1px solid #7a3030;
  color: #f0a0a0;
  font-size: 13px;
}

.progress-dashboard-error:empty {
  display: none;
}

.progress-dashboard-table-container {
  border-top: 1px solid #444;
  padding-top: 16px;
}

.progress-dashboard-table {
  width: 100%;
  border-collapse: collapse;
}

.progress-dashboard-table th,
.progress-dashboard-table td {
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid #3a3a3a;
}

.progress-dashboard-table th {
  color: #999;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}

.progress-dashboard-table td {
  color: #e0e0e0;
}

.progress-dashboard-empty {
  padding: 16px;
  text-align: center;
  color: #777;
  font-size: 13px;
}

/* Progress bar */
.progress-dashboard-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-dashboard-bar-container {
  width: 80px;
  height: 8px;
  background: #444;
  border-radius: 4px;
  overflow: hidden;
}

.progress-dashboard-bar-fill {
  height: 100%;
  background: #4a9eff;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-dashboard-bar-label {
  font-size: 12px;
  color: #bbb;
  white-space: nowrap;
}

/* ============================================
   User Panel Styles
   ============================================ */

/* --- User Panel Page --- */
.up-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #1e1e1e;
  padding: 24px 32px;
  overflow-y: auto;
}

.up-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.up-title {
  font-size: 22px;
  font-weight: 600;
  color: #e0e0e0;
}

.up-btn-create {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.up-btn-create:hover {
  background: #3a8eef;
}

.up-btn-create:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- User List --- */
.up-list {
  flex: 1;
}

/* --- Table --- */
.up-table {
  width: 100%;
  border-collapse: collapse;
}

.up-table th,
.up-table td {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid #3a3a3a;
}

.up-table th {
  color: #999;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.up-table td {
  color: #e0e0e0;
}

.up-table tbody tr:hover {
  background: #2d2d2d;
}

.up-actions-cell {
  display: flex;
  gap: 6px;
}

.up-btn-permissions {
  padding: 4px 10px;
  border: 1px solid #4a9eff;
  border-radius: 4px;
  background: transparent;
  color: #4a9eff;
  cursor: pointer;
  font-size: 12px;
}

.up-btn-permissions:hover {
  background: #4a9eff;
  color: #fff;
}

.up-btn-permissions:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.up-btn-edit {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 12px;
}

.up-btn-edit:hover {
  background: #4a4a4a;
  border-color: #777;
}

.up-btn-delete {
  padding: 4px 10px;
  border: 1px solid #7a3030;
  border-radius: 4px;
  background: transparent;
  color: #f0a0a0;
  cursor: pointer;
  font-size: 12px;
}

.up-btn-delete:hover {
  background: #4a2020;
  border-color: #a04040;
}

/* --- Loading State --- */
.up-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #bbb;
  font-size: 15px;
}

/* --- Empty State --- */
.up-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #777;
  font-size: 15px;
  text-align: center;
}

/* --- Error State --- */
.up-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 12px;
}

.up-error-message {
  color: #f0a0a0;
  font-size: 14px;
  text-align: center;
}

.up-btn-retry {
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
}

.up-btn-retry:hover {
  background: #4a4a4a;
  border-color: #777;
}

/* --- Modal Overlay --- */
.up-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.up-modal {
  width: 100%;
  max-width: 460px;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
}

.up-modal--confirm {
  max-width: 400px;
}

.up-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.up-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

.up-modal-close-btn {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 16px;
}

.up-modal-close-btn:hover {
  background: #4a4a4a;
}

/* --- Form --- */
.up-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.up-form-field label {
  font-size: 13px;
  color: #bbb;
}

.up-form-field input[type="email"],
.up-form-field input[type="password"],
.up-form-field input[type="text"] {
  padding: 8px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 14px;
}

.up-form-field input::placeholder {
  color: #888;
}

.up-form-field input:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* Checkbox field */
.up-form-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.up-form-field--checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #4a9eff;
  cursor: pointer;
}

.up-form-field--checkbox label {
  color: #e0e0e0;
  cursor: pointer;
}

/* Form error */
.up-form-error {
  padding: 8px 10px;
  border-radius: 4px;
  background: #4a2020;
  border: 1px solid #7a3030;
  color: #f0a0a0;
  font-size: 13px;
}

.up-form-error:empty {
  display: none;
}

/* --- Modal Actions --- */
.up-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.up-btn-cancel {
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
}

.up-btn-cancel:hover {
  background: #4a4a4a;
  border-color: #777;
}

.up-btn-submit {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.up-btn-submit:hover {
  background: #3a8eef;
}

.up-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Danger button (delete confirmation) */
.up-btn-danger {
  padding: 8px 16px;
  border: 1px solid #7a3030;
  border-radius: 4px;
  background: #4a2020;
  color: #f0a0a0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.up-btn-danger:hover {
  background: #5a2a2a;
  border-color: #a04040;
}

.up-btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Confirmation Message --- */
.up-confirm-message {
  font-size: 14px;
  color: #ccc;
  line-height: 1.5;
  margin-bottom: 8px;
}

.up-confirm-message strong {
  color: #e0e0e0;
}

/* --- Section Navigation Bar --- */
#section-nav-bar {
  display: flex;
  gap: 8px;
  padding: 12px 32px;
  background: #1e1e1e;
  border-bottom: 1px solid #333;
}

#section-nav-bar button {
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

#section-nav-bar button:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- Password Row with Generate Button --- */
.up-password-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.up-password-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 14px;
  font-family: monospace;
}

.up-password-row input::placeholder {
  color: #888;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.up-password-row input:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.up-btn-generate {
  padding: 8px 14px;
  border: 1px solid #4a9eff;
  border-radius: 4px;
  background: transparent;
  color: #4a9eff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.up-btn-generate:hover {
  background: #4a9eff;
  color: #fff;
}

/* --- Header Actions --- */
.up-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.up-btn-refresh {
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 4px;
  background: transparent;
  color: #ccc;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.up-btn-refresh:hover {
  background: #333;
  border-color: #777;
  color: #fff;
}

.up-btn-refresh:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- Reset Password Button --- */
.up-btn-reset-pw {
  padding: 4px 10px;
  border: 1px solid #4a9eff;
  border-radius: 4px;
  background: transparent;
  color: #4a9eff;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.up-btn-reset-pw:hover {
  background: #4a9eff;
  color: #fff;
}

.up-btn-reset-pw:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}


/* ============================================
   Profile Page Styles
   ============================================ */

/* --- Profile Page Layout (8.1) --- */
.pp-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  background: #1e1e1e;
  padding: 24px 32px;
  overflow-y: auto;
}

.pp-container {
  width: 100%;
  max-width: 560px;
}

.pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.pp-title {
  font-size: 22px;
  font-weight: 600;
  color: #e0e0e0;
}

.pp-btn-back {
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
}

.pp-btn-back:hover {
  background: #4a4a4a;
  border-color: #777;
}

.pp-btn-back:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- Account Info Section --- */
.pp-section {
  margin-bottom: 24px;
  padding: 20px;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
}

.pp-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 14px;
}

.pp-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.pp-info-label {
  color: #999;
  min-width: 100px;
}

.pp-info-value {
  color: #e0e0e0;
}

.pp-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
}

/* --- Password & Email Forms (8.2) --- */
.pp-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.pp-form-field label {
  font-size: 13px;
  color: #bbb;
}

.pp-form-field input {
  padding: 8px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 14px;
}

.pp-form-field input::placeholder {
  color: #888;
}

.pp-form-field input:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.pp-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.pp-btn-submit {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.pp-btn-submit:hover {
  background: #3a8eef;
}

.pp-btn-submit:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.pp-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Inline email edit row */
.pp-email-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pp-email-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 14px;
}

.pp-email-row input:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* Form messages */
.pp-form-error {
  padding: 8px 10px;
  border-radius: 4px;
  background: #4a2020;
  border: 1px solid #7a3030;
  color: #f0a0a0;
  font-size: 13px;
}

.pp-form-error:empty {
  display: none;
}

.pp-form-success {
  padding: 8px 10px;
  border-radius: 4px;
  background: #1a3a1a;
  border: 1px solid #2a5a2a;
  color: #80e080;
  font-size: 13px;
}

.pp-form-success:empty {
  display: none;
}

/* ============================================
   Permissions View Styles (8.3)
   ============================================ */

.pv-container {
  width: 100%;
}

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

.pv-title {
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
}

/* --- Permissions Table (matches UserPanel/MemberPanel table) --- */
.pv-table {
  width: 100%;
  border-collapse: collapse;
}

.pv-table th,
.pv-table td {
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid #3a3a3a;
}

.pv-table th {
  color: #999;
  font-weight: 500;
  font-size: 12px;
}

.pv-table td {
  color: #e0e0e0;
}

.pv-table tbody tr:hover {
  background: #333;
}

.pv-btn-remove {
  padding: 3px 8px;
  border: 1px solid #7a3030;
  border-radius: 4px;
  background: transparent;
  color: #f0a0a0;
  cursor: pointer;
  font-size: 12px;
}

.pv-btn-remove:hover {
  background: #4a2020;
  border-color: #a04040;
}

.pv-btn-remove:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- Add Role Form --- */
.pv-add-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.pv-add-form select {
  padding: 7px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  font-size: 13px;
  min-width: 120px;
}

.pv-add-form select:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.pv-btn-add {
  padding: 7px 14px;
  border: none;
  border-radius: 4px;
  background: #4a9eff;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.pv-btn-add:hover {
  background: #3a8eef;
}

.pv-btn-add:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.pv-btn-add:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Loading, Empty, Error States (8.4) --- */
.pv-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: #bbb;
  font-size: 13px;
  gap: 10px;
}

.pv-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #444;
  border-top-color: #4a9eff;
  border-radius: 50%;
  animation: pv-spin 0.8s linear infinite;
}

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

.pv-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: #777;
  font-size: 13px;
  text-align: center;
}

.pv-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  gap: 10px;
}

.pv-error-message {
  color: #f0a0a0;
  font-size: 13px;
  text-align: center;
}

.pv-btn-retry {
  padding: 6px 12px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 12px;
}

.pv-btn-retry:hover {
  background: #4a4a4a;
  border-color: #777;
}

.pv-btn-retry:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* Permissions View error for add/remove operations */
.pv-action-error {
  padding: 8px 10px;
  margin-top: 8px;
  border-radius: 4px;
  background: #4a2020;
  border: 1px solid #7a3030;
  color: #f0a0a0;
  font-size: 13px;
}

.pv-action-error:empty {
  display: none;
}

/* ============================================
   Permissions Modal Overlay (8.5)
   ============================================ */

.pv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.pv-modal {
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
}

.pv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pv-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

.pv-modal-close-btn {
  padding: 4px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #3a3a3a;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 16px;
}

.pv-modal-close-btn:hover {
  background: #4a4a4a;
}

.pv-modal-close-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* ============================================
   Focus Indicators for Profile & Permissions (8.6)
   ============================================ */

.pp-btn-back:focus,
.pp-btn-submit:focus,
.pp-form-field input:focus,
.pp-email-row input:focus,
.pv-btn-remove:focus,
.pv-btn-add:focus,
.pv-btn-retry:focus,
.pv-add-form select:focus,
.pv-modal-close-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* ============================================
   Range Selector Styles
   ============================================ */

.range-selector {
  margin-top: 12px;
  margin-bottom: 12px;
}

/* --- Summary Line --- */
.range-selector-summary {
  font-size: 13px;
  color: #bbb;
  margin-bottom: 8px;
}

/* --- Segmented Bar --- */
.range-selector-bar {
  display: flex;
  width: 100%;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #444;
  background: #1e1e1e;
  margin-bottom: 12px;
}

.range-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 4px;
  cursor: default;
  position: relative;
  transition: opacity 0.15s;
}

.range-segment:hover {
  opacity: 0.85;
}

.range-segment-assigned {
  background: #4a6a8a;
  border-right: 1px solid #2d2d2d;
}

.range-segment-available {
  background: #2a6a2a;
  border-right: 1px solid #2d2d2d;
  cursor: pointer;
}

.range-segment-available:hover {
  background: #3a7a3a;
}

.range-segment:last-child {
  border-right: none;
}

/* --- Focus-visible for keyboard navigation (Req 5.5) --- */
.range-segment:focus-visible {
  outline: 2px solid #4a9eff;
  outline-offset: -2px;
  z-index: 1;
}

/* --- Available Ranges List --- */
.range-selector-available-list {
  margin-top: 8px;
}

.range-selector-available-heading {
  font-size: 12px;
  font-weight: 500;
  color: #999;
  margin-bottom: 6px;
}

.range-selector-available-items {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.range-selector-available-item {
  display: inline-flex;
}

.range-selector-available-btn {
  padding: 5px 10px;
  border: 1px solid #2a6a2a;
  border-radius: 4px;
  background: #1a3a1a;
  color: #80e080;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.range-selector-available-btn:hover {
  background: #2a4a2a;
  border-color: #3a8a3a;
}

.range-selector-available-btn:focus-visible {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.range-selector-no-assignments {
  font-size: 12px;
  color: #999;
  font-style: italic;
  margin-top: 6px;
}

/* ============================================
   Version History Panel Styles
   ============================================ */

/* --- Overlay --- */
.vh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* --- Panel --- */
.vh-panel {
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* --- Header --- */
.vh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #3d3d3d;
}

.vh-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
}

.vh-close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

.vh-close-btn:hover {
  color: #fff;
  background: #3a3a3a;
}

.vh-close-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- Content Area --- */
.vh-content {
  padding: 16px 20px;
  flex: 1;
  overflow-y: auto;
}

/* --- Loading State --- */
.vh-loading {
  padding: 20px;
  text-align: center;
  color: #aaa;
  font-size: 14px;
}

/* --- Error State --- */
.vh-error {
  padding: 20px;
  text-align: center;
  color: #ef5350;
  font-size: 14px;
}

/* --- Empty State --- */
.vh-empty {
  padding: 20px;
  text-align: center;
  color: #aaa;
  font-size: 14px;
}

/* --- Version List --- */
.vh-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Version Entry --- */
.vh-entry {
  background: #3d3d3d;
  border-radius: 6px;
  padding: 12px 16px;
}

.vh-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.vh-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vh-version-num {
  font-weight: bold;
  color: #64b5f6;
}

.vh-timestamp {
  color: #aaa;
  font-size: 13px;
}

.vh-author {
  color: #aaa;
  font-size: 13px;
}

.vh-summary {
  color: #e0e0e0;
  font-size: 13px;
  margin-top: 4px;
}

.vh-description {
  color: #bbb;
  font-size: 12px;
  font-style: italic;
  margin-top: 4px;
}

/* --- Restore Button --- */
.vh-restore-btn {
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.vh-restore-btn:hover {
  background: #1565c0;
}

.vh-restore-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.vh-restore-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Confirm Dialog --- */
.vh-confirm-dialog {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 8px;
}

.vh-confirm-content {
  background: #2d2d2d;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 20px 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.vh-confirm-content p {
  color: #e0e0e0;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.vh-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* --- Confirm Button --- */
.vh-confirm-btn {
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.vh-confirm-btn:hover {
  background: #1565c0;
}

.vh-confirm-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.vh-confirm-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Cancel Button --- */
.vh-cancel-btn {
  background: #666;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.vh-cancel-btn:hover {
  background: #555;
}

.vh-cancel-btn:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- Description Input --- */
.vh-desc-input {
  width: 100%;
  padding: 8px;
  background: #3d3d3d;
  border: 1px solid #555;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 14px;
  resize: none;
}

.vh-desc-input::placeholder {
  color: #888;
}

.vh-desc-input:focus {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

/* --- Character Counter --- */
.vh-char-counter {
  font-size: 12px;
  color: #aaa;
  text-align: right;
  margin-top: 4px;
}
