/* ==========================================================================
   DESIGN SYSTEM & CSS VARIABLES
   ========================================================================== */
:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Color Palette - Minimal Dark */
  --bg-color: #100e18;
  --panel-bg: #16131f;
  --glass-bg: rgba(255, 255, 255, 0.02);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.2);

  --text-primary: #ececf1;
  --text-secondary: #a49bc4;
  --text-muted: #6d6489;

  --accent-purple: #8b5cf6;
  --accent-purple-glow: transparent;
  --accent-teal: #2dd4bf;
  --accent-teal-glow: transparent;

  --danger: #ef4444;
  --success: #10b981;

  /* Transitions */
  --transition-speed: 0.15s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --glow-shadow: none;
  --accent-shadow: none;
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

body.modal-open {
  overflow: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 12px;
  gap: 12px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  z-index: 10;
}

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

.logo {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-mark {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.logo-sub {
  color: var(--text-muted);
  font-weight: 400;
}

.aspect-selector-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.aspect-selector-container label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

select {
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 8px 12px;
  font-family: var(--font-family);
  font-size: 0.88rem;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  min-width: 240px;
  transition: border-color var(--transition-speed) var(--ease);
}

select:focus {
  border-color: var(--accent-purple);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Progress Tracker */
.progress-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 400;
}

#progress-counts {
  color: var(--text-primary);
  font-weight: 500;
}

.progress-bar-bg {
  width: 150px;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-purple);
  border-radius: 2px;
  transition: width 0.3s var(--ease);
}

/* Navigation Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.avatar-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-purple);
  color: white;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  border: none;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

.avatar-button:hover {
  background: #7c4ee8;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  min-width: 210px;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  z-index: 60;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-speed) var(--ease),
              border-color var(--transition-speed) var(--ease);
  border: none;
  outline: none;
  text-decoration: none;
}

.btn-primary {
  justify-content: center;
  background: var(--accent-purple);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #7c4ee8;
}

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

.btn-secondary {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Main Workspace Panels */
.app-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 12px;
  overflow: hidden;
}

.panel-left {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-right {
  flex: 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 20px;
  overflow: hidden;
}

/* ==========================================================================
   LEFT PANEL - TARGET IMAGE
   ========================================================================== */
.target-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 20px;
}

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

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filename-badge {
  color: var(--text-muted);
  font-family: monospace;
  font-size: 0.72rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-image-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  position: relative;
  overflow: auto;
  min-height: 0;
}

.target-image-wrapper img {
  display: block;
  width: auto;
  height: auto;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain;
  transition: opacity 0.2s var(--ease), width 0.1s var(--ease), height 0.1s var(--ease);
}

/* Zoom Control Slider */
.zoom-control-container {
  margin-top: 10px;
  padding: 4px 2px;
}

.zoom-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zoom-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  min-width: 84px;
}

#zoom-value {
  color: var(--text-secondary);
  font-weight: 500;
}

.zoom-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  cursor: pointer;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: background 0.1s var(--ease);
}

.zoom-slider::-webkit-slider-thumb:hover {
  background: var(--text-primary);
}

.btn-reset-zoom {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-speed) var(--ease);
  padding: 4px 8px;
}

.btn-reset-zoom:hover {
  color: var(--text-primary);
}

.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.shortcut-tip {
  margin-top: 12px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.key-badge {
  border: 1px solid var(--glass-border);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--text-muted);
}

/* ==========================================================================
   RIGHT PANEL - CATEGORIES GRID
   ========================================================================== */
.panel-header {
  margin-bottom: 16px;
}

.panel-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.panel-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.categories-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: minmax(104px, 1fr);
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

.categories-grid:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: 4px;
}

/* Category Card Item */
.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: border-color var(--transition-speed) var(--ease),
              background var(--transition-speed) var(--ease);
  overflow: hidden;
  min-height: 0;
}

/* Number Badge on Card */
.shortcut-number {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--text-muted);
  font-family: monospace;
  font-size: 0.72rem;
}

.category-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--glass-border-hover);
}

.category-card:active {
  background: rgba(255, 255, 255, 0.05);
}

/* Checkbox Header Area */
.card-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
  padding-right: 20px; /* leave room for shortcut number */
}

/* Custom Checkbox Design */
.checkbox-container {
  display: block;
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.custom-checkbox {
  position: absolute;
  top: 0;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: transparent;
  border: 1.5px solid var(--glass-border);
  border-radius: 5px;
  transition: all var(--transition-speed) var(--ease);
}

/* On card hover, light up checkbox border */
.category-card:hover .custom-checkbox {
  border-color: var(--text-muted);
}

/* Checkbox Checked state */
.checkbox-container input:checked ~ .custom-checkbox {
  background-color: var(--accent-teal);
  border-color: var(--accent-teal);
}

/* Checkmark indicator icon */
.custom-checkbox:after {
  content: "";
  position: absolute;
  display: none;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--bg-color);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-container input:checked ~ .custom-checkbox:after {
  display: block;
}

/* Category Text Content */
.category-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.category-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.category-rep {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 4px;
}

/* Guide Image Preview */
.guide-image-wrapper {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: center;
  width: 100%;
}

.guide-image-preview {
  width: 100%;
  height: clamp(54px, 7vh, 76px);
  object-fit: contain;
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  cursor: zoom-in;
  transition: border-color var(--transition-speed) var(--ease);
}

.guide-image-preview:hover {
  border-color: var(--glass-border-hover);
}

/* Special styling for "Other" card which has no image */
.category-card.other-card {
  border-style: dashed;
}

/* ==========================================================================
   IMAGE MODAL OVERLAY
   ========================================================================== */
.modal {
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(10, 8, 16, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.2s var(--ease);
}

.modal-content {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 28px;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-content img {
  width: min(860px, 82vw);
  max-height: 72vh;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: var(--bg-color);
}

.close-modal {
  position: absolute;
  top: 8px;
  right: 16px;
  color: var(--text-muted);
  font-size: 1.6rem;
  font-weight: 400;
  cursor: pointer;
  transition: color var(--transition-speed) var(--ease);
}

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

.modal-caption {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Admin S3 sync modal */
.sync-modal-content {
  width: min(560px, 92vw);
  max-height: 85vh;
  align-items: stretch;
  overflow-y: auto;
}

.sync-title {
  font-size: 1rem;
  font-weight: 600;
}

/* Admin label-correction modal */
.correct-modal-content {
  width: min(1040px, 94vw);
  height: min(836px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  align-items: stretch;
  overflow: hidden;
}

.correct-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.7fr);
  flex: 1;
  gap: 20px;
  min-height: 0;
  overflow: hidden;
}

.correct-image-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.correct-modal-content .correct-image-pane > img {
  width: 100%;
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
}

.correct-categories {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.correct-category-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: rgba(45, 212, 191, 0.7) rgba(255, 255, 255, 0.05);
  padding-right: 8px;
}

.correct-category-list::-webkit-scrollbar {
  width: 10px;
}

.correct-category-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

.correct-category-list::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.7);
  border: 2px solid var(--panel-bg);
  border-radius: 999px;
}

.correct-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-speed) var(--ease),
              background var(--transition-speed) var(--ease);
}

.correct-category:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--glass-border-hover);
}

.correct-category.current {
  border-color: var(--accent-teal);
}

.correct-modal-content .correct-guide-thumb {
  width: 84px;
  height: 52px;
  max-height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: 5px;
}

#correct-error {
  margin-top: 14px;
}

@media (max-width: 900px) {
  .correct-modal-content {
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
    padding: 22px 16px 16px;
  }

  .correct-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 38%) minmax(0, 62%);
  }

  .correct-image-pane {
    min-height: 0;
  }

  .correct-modal-content .correct-image-pane > img {
    max-height: 30vh;
  }
}

/* Helper Utilities */
.hidden {
  display: none !important;
  opacity: 0;
}

/* Authentication */
.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 420px);
  padding: 36px;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
}

.auth-card h1 {
  margin-top: 6px;
  font-size: 1.5rem;
  font-weight: 600;
}

.eyebrow {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-copy {
  margin: 12px 0 24px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form label,
.history-filters label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
}

input {
  width: 100%;
  padding: 10px 12px;
  color: var(--text-primary);
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  outline: none;
  font: inherit;
  font-size: 0.9rem;
}

input:focus {
  border-color: var(--accent-purple);
}

.auth-form input {
  margin-bottom: 8px;
}

.auth-form .btn {
  width: 100%;
  margin-top: 8px;
}

.field-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.form-error {
  padding: 10px 12px;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  font-size: 0.83rem;
}

/* Personal history */
.history-page {
  min-height: 100vh;
  padding: 12px;
}

.history-header {
  margin-bottom: 12px;
}

.history-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.history-panel {
  padding: 20px;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
}

.history-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.history-filters > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-filters input,
.history-filters select {
  min-width: 200px;
}

.history-summary {
  margin: 16px 0 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.daily-totals {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.daily-total-card {
  min-width: max-content;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.daily-total-card strong {
  color: var(--text-primary);
  font-size: 0.82rem;
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
}

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

.history-table th,
.history-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--glass-border);
  text-align: left;
  font-size: 0.83rem;
}

.history-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.history-thumb {
  display: block;
  width: 64px;
  height: 42px;
  object-fit: contain;
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  cursor: zoom-in;
  transition: border-color var(--transition-speed) var(--ease);
}

.history-thumb:hover {
  border-color: var(--glass-border-hover);
}

.history-edit-button {
  padding: 5px 9px;
  white-space: nowrap;
  font-size: 0.76rem;
}

.history-correction-status {
  color: #86efac;
  font-weight: 600;
  white-space: nowrap;
}

.history-correction-detail {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

/* Admin: review cards */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.review-card {
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color var(--transition-speed) var(--ease);
}

.review-card:hover {
  border-color: var(--glass-border-hover);
}

.review-card-img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: var(--bg-color);
  border-bottom: 1px solid var(--glass-border);
  cursor: zoom-in;
}

.review-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 14px;
  flex: 1;
}

.review-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.review-card-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.review-card-label.skipped {
  color: var(--text-muted);
}

.review-card-aspect {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 2px 8px;
}

.review-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.review-card-corrected {
  margin-top: 2px;
  padding: 6px 8px;
  font-size: 0.74rem;
  color: var(--accent-teal);
  background: rgba(45, 212, 191, 0.06);
  border: 1px solid rgba(45, 212, 191, 0.25);
  border-radius: 6px;
}

.review-card .btn-correct {
  margin-top: auto;
  width: 100%;
}

/* Admin: user management */
.credentials-box {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 10px;
  background: rgba(45, 212, 191, 0.05);
}

.credentials-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-teal);
  margin-bottom: 6px;
}

.credentials-line {
  font-family: monospace;
  font-size: 0.95rem;
  color: var(--text-primary);
  word-break: break-all;
}

.credentials-note {
  margin: 6px 0 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

/* Admin: character visibility configuration */
.configuration-copy {
  max-width: 780px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.character-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}

.character-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  cursor: pointer;
}

.visibility-toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent-teal);
}

.character-table td:nth-child(2) {
  color: var(--text-primary);
  font-weight: 600;
}

.empty-history {
  padding: 48px 16px;
  color: var(--text-muted);
  text-align: center;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .app-header,
  .header-left,
  .header-right {
    align-items: flex-start;
  }

  .app-header,
  .header-right {
    flex-direction: column;
  }

  .nav-actions {
    flex-wrap: wrap;
  }

  .app-container {
    height: auto;
    min-height: 100vh;
  }

  .app-workspace {
    flex-direction: column;
    overflow: visible;
  }

  .panel-right,
  .categories-grid {
    min-height: auto;
    overflow: visible;
  }

  .target-image-wrapper {
    min-height: 320px;
  }
}

@media (max-width: 700px) {
  .app-container,
  .history-page {
    padding: 10px;
  }

  .app-header,
  .header-left,
  .history-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .aspect-selector-container {
    flex-direction: column;
    align-items: stretch;
  }

  select,
  .history-filters input,
  .history-filters select {
    width: 100%;
    min-width: 0;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .character-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}
