/* ==========================================================================
   AGROKOOL CAMPO PWA — BITÁCORA ERP DESIGN SYSTEM (V5: Full-Width Canvas)
   Utilizes full screen width, anti-collision table, notes preview, mobile feed.
   ========================================================================== */

.journal {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

/* ==========================================================================
   1. Compact Summary Stats at the TOP (Full Width)
   ========================================================================== */
.journal-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 16px 22px;
  box-shadow: var(--shadow-xs);
  width: 100%;
  box-sizing: border-box;
}

.journal-stats .stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 14px;
  border-left: 3px solid var(--brand-lime);
}

.journal-stats .stat:first-child {
  border-left-color: var(--brand-primary);
}

.journal-stats .stat:nth-child(2) {
  border-left-color: var(--brand-gold);
}

.journal-stats .stat:nth-child(3) {
  border-left-color: var(--brand-lime);
}

.journal-stats .stat:nth-child(4) {
  border-left-color: #3b82f6;
}

.journal-stats .stat-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.journal-stats .stat strong {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.journal-stats .stat small {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   2. Projects Slider for ERP Journal (Full Width)
   ========================================================================== */
.journal-project-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  width: 100%;
}

.journal-slider-wrapper {
  position: relative;
  margin-bottom: 2px;
  width: 100%;
}

.journal-slider-track {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 6px 2px 12px 2px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.journal-slider-track::-webkit-scrollbar {
  display: none;
}

.journal-slider-track .project-card {
  flex: 0 0 calc(50% - 9px);
  min-width: calc(50% - 9px);
  max-width: calc(50% - 9px);
  scroll-snap-align: start;
  scroll-snap-stop: normal;
  margin: 0;
  box-sizing: border-box;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 14px;
  padding: 20px 24px;
  text-align: left;
  color: inherit;
  position: relative;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.journal-slider-track .project-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.journal-slider-track .project-card.selected {
  border: 2px solid var(--brand-gold);
  background: linear-gradient(to bottom, #ffffff, #fdfbf7);
  box-shadow: var(--shadow-gold);
}

.journal-slider-track .project-card.selected::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-gold), var(--brand-lime));
  border-radius: 12px 12px 0 0;
}

.chip-inactive {
  background: var(--bg-subtle) !important;
  color: var(--text-secondary) !important;
}

.project-journal-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-refresh-journal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
}

.btn-refresh-journal:disabled .refresh-icon {
  animation: spin 1s linear infinite;
}

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

.journal-status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 0 4px;
  min-height: 18px;
  width: 100%;
}

.journal-message {
  margin: 0;
  font-weight: 600;
  color: var(--brand-primary);
}

.journal-time {
  margin: 0;
  color: var(--text-muted);
}

/* ==========================================================================
   3. Panel & Table: Identical to "Tareas del proyecto"
   ========================================================================== */
.journal .task-panel {
  width: 100%;
}

#journal .task-panel-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 20px 26px;
}

#journal .task-panel-head .filters {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(150px, 1fr) minmax(170px, 1.3fr) minmax(135px, 0.9fr) auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
}

#journal .task-panel-head .filters select,
#journal .task-panel-head .filters input {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 38px;
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  box-sizing: border-box;
}

#journal .task-panel-head .filters .btn {
  height: 38px;
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.journal .task-panel th:first-child,
.journal .task-panel td.task-name {
  width: 34%;
  min-width: 220px;
}

.journal .task-panel .person-column {
  width: 20%;
  min-width: 160px;
}

.journal .task-panel th:nth-child(3),
.journal .task-panel td.task-progress {
  width: 16%;
  min-width: 130px;
}

.journal .task-panel td.task-progress progress {
  width: 100%;
  max-width: 140px;
}

.journal .task-panel .task-name strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--brand-primary);
  line-height: 1.35;
  word-break: break-word;
}

.journal .task-panel .task-name small {
  font-size: 12px;
  color: var(--text-secondary);
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}

.journal .task-panel .task-name .task-code {
  color: var(--brand-gold);
  font-weight: 700;
  margin-right: 6px;
}

.journal .task-panel .status-column {
  white-space: nowrap;
  width: 13%;
  min-width: 120px;
}

.journal .task-panel .photos-column {
  text-align: center;
  width: 8%;
  min-width: 70px;
  white-space: nowrap;
}

.journal .task-panel th.task-action,
.journal .task-panel td.task-action {
  text-align: right;
  width: 9%;
  min-width: 96px;
  white-space: nowrap;
}

.journal .task-panel .photo-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  border: 1px solid rgba(44, 64, 1, 0.12);
}

.journal .task-panel .table-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  flex-wrap: wrap;
  gap: 10px;
}

.journal-pagination-btns {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Empty State */
.journal-empty {
  text-align: center;
  padding: 40px 24px;
  width: 100%;
}

.empty-icon-bubble {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.journal-alert {
  padding: 14px 18px;
  margin: 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
}

.journal-alert.error {
  background: var(--status-red-bg);
  color: var(--status-red-text);
  border: 1px solid rgba(158, 42, 27, 0.25);
}

/* ==========================================================================
   7. Detail Modal Sheet Dialog
   ========================================================================== */
.journal-modal-sheet {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-primary);
  width: min(880px, calc(100% - 32px));
  max-width: 880px;
  max-height: min(90vh, 900px);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 1000;
  animation: journalModalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes journalModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Oscuro con blur profundo */
.journal-modal-sheet::backdrop {
  background: rgba(12, 18, 6, 0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: journalBackdropFadeIn 0.2s ease;
}

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

.journal-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.journal-modal-header-main {
  flex: 1;
  min-width: 0;
}

.journal-modal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--brand-primary);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.eyebrow-icon-bubble {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.journal-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 0 0 6px 0;
  word-break: break-word;
}

.journal-modal-subtitle-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.journal-task-code-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  font-weight: 750;
  font-size: 11.5px;
  border: 1px solid rgba(44, 64, 1, 0.12);
}

.journal-modal-activity {
  font-weight: 500;
}

.journal-modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
  margin-top: -2px;
}

.journal-modal-close-btn:hover {
  background: #f1f5e9;
  color: var(--brand-primary);
  border-color: var(--border-strong);
  transform: scale(1.08);
}

.journal-modal-sheet .modal-scroll-body {
  padding: 22px 28px 28px 28px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.journal-detail-highlight {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 14px 18px;
}

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

.highlight-item .hl-head {
  display: flex;
  align-items: center;
  gap: 7px;
}

.highlight-item .hl-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(44, 64, 1, 0.08);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.highlight-item .hl-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.highlight-item .hl-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-primary);
}

.highlight-item .hl-pct {
  color: var(--brand-gold);
  font-size: 16px;
  font-weight: 800;
}

.journal-detail-progress-wrap {
  margin: 0;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}

.journal-detail-progress-wrap .progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.journal-detail-progress-wrap .progress-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-primary);
}

.journal-detail-progress-wrap .progress-val-text {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--brand-gold);
}

.journal-detail-progress-wrap progress {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  border: none;
  background: #edf0e6;
  display: block;
}

.journal-detail-progress-wrap progress::-webkit-progress-bar {
  background: #edf0e6;
  border-radius: 999px;
}

.journal-detail-progress-wrap progress::-webkit-progress-value {
  background: var(--brand-gold);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.journal-detail-progress-wrap progress::-moz-progress-bar {
  background: var(--brand-gold);
  border-radius: 999px;
}

.journal-modal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.journal-section-subtitle {
  font-size: 12px;
  font-weight: 800;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-section-subtitle .section-icon-bubble {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.journal-section-subtitle .photo-count-badge {
  font-size: 11px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 750;
  margin-left: auto;
}

.journal-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
  margin: 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}

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

.meta-field dt {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-field dt svg {
  color: var(--brand-primary);
  opacity: 0.75;
  flex-shrink: 0;
}

.meta-field dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-word;
}

.meta-field dd.user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Badges de Estado Modernos y Estéticos */
.journal-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.2;
  border: 1px solid transparent;
  width: fit-content;
  user-select: none;
  white-space: nowrap;
}

.journal-status-badge .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.journal-status-badge.in_progress {
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.22);
  color: #b45309;
}

.journal-status-badge.in_progress .status-dot {
  background: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
  animation: statusPulse 2s infinite ease-in-out;
}

.journal-status-badge.finished {
  background: rgba(22, 101, 52, 0.08);
  border-color: rgba(22, 101, 52, 0.22);
  color: #15803d;
}

.journal-status-badge.finished .status-dot {
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.journal-status-badge.created {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.22);
  color: #1d4ed8;
}

.journal-status-badge.created .status-dot {
  background: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.journal-status-badge.cancelled {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.22);
  color: #b91c1c;
}

.journal-status-badge.cancelled .status-dot {
  background: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

@keyframes statusPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.22);
    opacity: 0.75;
  }
}

/* Píldora de Origen del Asiento */
.journal-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  width: fit-content;
  user-select: none;
  white-space: nowrap;
}

.journal-source-pill .source-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.journal-source-pill.source-app {
  background: rgba(44, 64, 1, 0.06);
  border: 1px solid rgba(44, 64, 1, 0.16);
  color: var(--brand-primary, #2c4001);
}

.journal-source-pill.source-telegram {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.22);
  color: #0284c7;
}

.journal-source-pill.source-erp {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.22);
  color: #4f46e5;
}

/* Identificadores ERP Interactivos y Copiables */
.ref-badge-interactive {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 6px 3px 10px;
  background: #ffffff;
  border: 1px solid var(--border-light, #d7dec6);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  width: fit-content;
  user-select: none;
  max-width: 100%;
}

.ref-badge-interactive:hover {
  background: var(--bg-subtle, #f7f9f2);
  border-color: var(--border-strong, #b5c299);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ref-badge-interactive svg {
  color: var(--brand-primary, #2c4001);
  flex-shrink: 0;
  opacity: 0.85;
}

.ref-badge-interactive .ref-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-secondary, #526038);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ref-badge-interactive .ref-mono-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-primary, #1a2405);
  letter-spacing: 0.02em;
}

.ref-badge-interactive .btn-copy-tag {
  border: none;
  background: rgba(44, 64, 1, 0.07);
  color: var(--brand-primary, #2c4001);
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  pointer-events: none;
}

.ref-badge-interactive:hover .btn-copy-tag {
  background: rgba(44, 64, 1, 0.14);
}

.ref-badge-interactive .icon-copied {
  display: none;
}

.ref-badge-interactive.copied {
  border-color: #16a34a !important;
  background: rgba(22, 163, 74, 0.06) !important;
}

.ref-badge-interactive.copied .icon-copy {
  display: none;
}

.ref-badge-interactive.copied .icon-copied {
  display: inline-block;
  color: #16a34a;
}

.ref-badge-interactive.copied .copy-feedback {
  color: #16a34a;
}

.ref-badge-interactive.copied .btn-copy-tag {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
}

.ref-badge-interactive.footer-ref-badge {
  background: var(--bg-subtle, #f4f6ee);
  border-color: var(--border-light, #e2e8d0);
}

/* Compatibilidad / Fallbacks */
.ref-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--brand-primary);
  font-weight: 600;
}

.ref-code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(44, 64, 1, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--brand-primary);
  font-weight: 600;
}

.origin-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 750;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(44, 64, 1, 0.12);
}

.journal-detail-notes-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fbfcf8;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--brand-gold);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.notes-quote-icon {
  color: var(--brand-gold);
  flex-shrink: 0;
  margin-top: 2px;
}

.journal-notes {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.journal-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gallery-slider-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-slider-counter {
  font-size: 11.5px;
  font-weight: 750;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 3px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.gallery-nav-btns {
  display: flex;
  align-items: center;
  gap: 5px;
}

.gallery-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-xs);
  padding: 0;
}

.gallery-nav-btn:hover:not(:disabled) {
  background: var(--brand-primary-soft);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.gallery-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.journal-gallery-slider-wrap {
  position: relative;
  width: 100%;
}

.gallery-float-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  padding: 0;
}

.gallery-float-arrow.prev {
  left: -10px;
}

.gallery-float-arrow.next {
  right: -10px;
}

.gallery-float-arrow:hover:not(:disabled) {
  background: #ffffff;
  border-color: var(--brand-primary);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.gallery-float-arrow:disabled {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.9);
}

.journal-gallery {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 2px 8px 2px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
}

.journal-gallery::-webkit-scrollbar {
  display: none;
}

.gallery-empty {
  width: 100%;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-light);
  border-radius: 12px;
}

.gallery-card {
  flex: 0 0 calc((100% - 24px) / 3);
  min-width: calc((100% - 24px) / 3);
  max-width: calc((100% - 24px) / 3);
  scroll-snap-align: start;
  scroll-snap-stop: normal;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

@media (max-width: 768px) {
  .gallery-card {
    flex: 0 0 calc((100% - 12px) / 2);
    min-width: calc((100% - 12px) / 2);
    max-width: calc((100% - 12px) / 2);
  }
}

@media (max-width: 520px) {
  .gallery-card {
    flex: 0 0 100%;
    min-width: 100%;
    max-width: 100%;
  }
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.gallery-img-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  background: #f2f4ec;
  overflow: hidden;
  cursor: zoom-in;
}

.gallery-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.gallery-card:hover .gallery-img-wrapper img {
  transform: scale(1.05);
}

.gallery-zoom-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 28, 2, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.gallery-card:hover .gallery-zoom-overlay {
  opacity: 1;
}

.zoom-btn {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 750;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.gallery-card figcaption {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gallery-file-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.gallery-file-info .file-name {
  font-size: 12px;
  color: var(--brand-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-file-info .file-size {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.gallery-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-view-photo {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  border: 1px solid rgba(44, 64, 1, 0.15);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-view-photo:hover {
  background: rgba(44, 64, 1, 0.16);
  border-color: var(--brand-primary);
}

.journal-image-error {
  color: var(--status-red-text);
  font-size: 11px;
  margin: 0;
}

.btn-download-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  text-decoration: none;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  transition: all 0.15s ease;
}

.btn-download-file:hover {
  color: var(--brand-primary);
  border-color: var(--border-strong);
  background: #ffffff;
}

/* ==========================================================================
   Photo Lightbox / Fullscreen Carousel Viewer
   ========================================================================== */
.journal-photo-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  background: rgba(6, 12, 4, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
  animation: lightboxFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px 20px 20px 20px;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.lightbox-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #ffffff;
  padding: 4px 8px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.lightbox-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lightbox-counter-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.lightbox-filename {
  font-size: 13.5px;
  font-weight: 600;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-filesize {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.lightbox-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lightbox-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}

.lightbox-btn-download:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.lightbox-btn-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lightbox-btn-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.lightbox-stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  padding: 10px 0;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-img-container {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 16px;
}

.lightbox-img-container img {
  max-width: 100%;
  max-height: calc(88vh - 170px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  transition: opacity 0.2s ease, transform 0.2s ease;
  user-select: none;
}

.lightbox-arrow-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.lightbox-arrow-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.32);
  transform: scale(1.1);
}

.lightbox-arrow-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.lightbox-bottombar {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 6px;
}

.lightbox-thumbs-track {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 90vw;
  overflow-x: auto;
  padding: 4px;
}

.lightbox-thumb-item {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #111;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s ease;
  opacity: 0.6;
}

.lightbox-thumb-item:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.lightbox-thumb-item.active {
  border-color: var(--brand-gold);
  opacity: 1;
  box-shadow: 0 0 10px rgba(184, 134, 11, 0.6);
}

.lightbox-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lightbox-hint {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  text-align: center;
}

@media (max-width: 640px) {
  .lightbox-arrow-btn {
    width: 38px;
    height: 38px;
  }

  .lightbox-topbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .lightbox-filename {
    max-width: 150px;
  }
}

.gallery-empty {
  grid-column: 1 / -1;
  padding: 20px;
  text-align: center;
  background: var(--bg-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.journal-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 16px 28px;
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.journal-notes-raw-details {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
}

.journal-notes-raw-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-secondary);
}

.journal-notes-raw-details summary:hover {
  color: var(--brand-primary);
}

.journal-raw-pre {
  margin: 10px 0 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--text-secondary);
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

/* ==========================================================================
   8. Responsive Adjustments
   ========================================================================== */
@media (max-width: 900px) {
  .journal-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .journal-slider-track {
    gap: 12px;
    padding: 2px 2px 8px 2px;
  }

  .journal-slider-track .project-card {
    flex: 0 0 100%;
    min-width: 100%;
    max-width: 100%;
    padding: 16px;
  }

  .journal-filter-main {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .journal-search-wrap {
    width: 100%;
    flex: none;
  }

  .journal-quick-pills {
    width: 100%;
  }

  .btn-filter-toggle {
    justify-content: center;
    width: 100%;
  }

  .drawer-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .journal-modal-sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    min-height: 85vh;
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
  }

  .journal-detail-highlight {
    grid-template-columns: repeat(2, 1fr);
  }

  .journal-meta-grid {
    grid-template-columns: 1fr;
  }

  .journal .task-panel .table-caption {
    padding: 14px 16px;
  }
}

@media (max-width: 480px) {
  .journal-stats {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 1150px) {
  #journal .task-panel-head .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #journal .task-panel-head {
    padding: 16px;
    gap: 12px;
  }

  #journal .task-panel-head .filters {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  #journal .task-panel-head .filters #journal-search {
    grid-column: 1 / -1;
  }

  .journal .task-panel td.person-column,
  .journal .task-panel td.task-progress,
  .journal .task-panel td.status-column,
  .journal .task-panel td.photos-column,
  .journal .task-panel td.task-action {
    width: auto;
    min-width: 0;
  }
}
