/* ═══════════════════════════════════════════════════════════════════════════
   HARBINGER — Terminal Journal
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Courier New', Courier, monospace;
  background: #0d0d0d;
  color: #c8c4b8;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── App Shell ──────────────────────────────────────────────────────────── */

.harbinger {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.masthead-bar {
  flex-shrink: 0;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #222;
  z-index: 10;
}

.masthead-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.masthead-row-title {
  height: 50px;
  padding: 0 24px;
  flex-shrink: 0;
}

.masthead-row-nav {
  border-top: 1px solid #181818;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.masthead-row-nav::-webkit-scrollbar { height: 2px; }
.masthead-row-nav::-webkit-scrollbar-track { background: transparent; }
.masthead-row-nav::-webkit-scrollbar-thumb { background: #222; }

.title-mark {
  font-size: 18px;
  letter-spacing: 8px;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}

.title-description {
  font-size: 12px;
  letter-spacing: 2px;
  font-weight: normal;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-tabs {
  display: flex;
  align-items: stretch;
  height: 42px;
  width: 100%;
}

/* Desktop: collapse the two rows into one for the classic terminal masthead */
@media (min-width: 901px) {
  .masthead-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 24px;
    gap: 16px;
  }
  .masthead-row { width: auto; }
  .masthead-row-title { height: auto; padding: 0; }
  .masthead-row-nav { border-top: none; overflow: visible; }
  .nav-tabs { height: 50px; width: auto; }
}

.tab {
  display: flex;
  align-items: center;
  background: transparent;
  color: #aaa;
  border: none;
  border-left: 1px solid #2a2a2a;
  padding: 0 18px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  text-transform: uppercase;
}

.tab:hover {
  background: #1a1a1a;
  color: #fff;
}

.tab.active {
  background: #fff;
  color: #000;
}

.tab.logout {
  color: #888;
  margin-left: 12px;
  border-left: 1px solid #2a2a2a;
}

.tab.logout:hover {
  color: #fff;
  background: #1a1a1a;
}

/* ─── Workspace ──────────────────────────────────────────────────────────── */

.workspace {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.view-wrapper {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.loading-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  letter-spacing: 5px;
  color: #333;
}

/* ─── Archive: Full-list view (no entry selected) ────────────────────────── */

.archive-full-view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  background: #0d0d0d;
}

.archive-full-view .archive-list-pane {
  width: 100%;
  max-width: 760px;
  border-right: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ─── Archive: Split view (entry selected) ───────────────────────────────── */

.archive-split-view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  background: #0d0d0d;
}

.archive-split-view .archive-list-pane {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid #1e1e1e;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ─── Archive List Pane ──────────────────────────────────────────────────── */

.archive-list-header {
  flex-shrink: 0;
  padding: 14px 20px;
  border-bottom: 1px solid #1e1e1e;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.archive-list-header h2 {
  font-size: 10px;
  letter-spacing: 4px;
  color: #444;
  font-weight: normal;
}

.record-count {
  font-size: 9px;
  letter-spacing: 2px;
  color: #333;
}

.archive-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.archive-list-scroll::-webkit-scrollbar { width: 3px; }
.archive-list-scroll::-webkit-scrollbar-track { background: transparent; }
.archive-list-scroll::-webkit-scrollbar-thumb { background: #222; }

/* ─── Archive List Items ─────────────────────────────────────────────────── */

.archive-list-item {
  padding: 14px 20px;
  border-bottom: 1px solid #141414;
  cursor: pointer;
  transition: background 0.1s;
}

.archive-list-item:hover {
  background: #131313;
}

.archive-list-item.selected {
  background: #161616;
  border-left: 2px solid #fff;
  padding-left: 18px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.item-title {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #c8c4b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.item-date {
  font-size: 9px;
  letter-spacing: 1px;
  color: #3a3a3a;
  white-space: nowrap;
  flex-shrink: 0;
}

.item-preview {
  font-size: 10px;
  line-height: 1.4;
  color: #444;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Empty State ────────────────────────────────────────────────────────── */

.empty-archive {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
}

.empty-archive-label {
  font-size: 11px;
  letter-spacing: 4px;
  color: #2e2e2e;
}

/* ─── Reading Pane ───────────────────────────────────────────────────────── */

.reading-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 48px 64px;
  background: #f4f1e8;
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
}

.reading-pane::-webkit-scrollbar { width: 5px; }
.reading-pane::-webkit-scrollbar-track { background: #ece9de; }
.reading-pane::-webkit-scrollbar-thumb { background: #bbb; }

.reading-header {
  flex-shrink: 0;
  margin-bottom: 28px;
}

.reading-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.reading-title {
  font-size: 20px;
  letter-spacing: 3px;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  word-break: break-word;
  color: #000;
}

.close-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid #bbb;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Courier New', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

.reading-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.reading-date {
  font-size: 10px;
  letter-spacing: 2px;
  color: #888;
}

.delete-btn {
  background: transparent;
  border: 1px solid #ccc;
  color: #aaa;
  padding: 4px 12px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}

.delete-btn:hover {
  background: #b00;
  border-color: #b00;
  color: #fff;
}

.reading-divider {
  height: 1px;
  background: #ddd;
  margin: 0 0 28px;
  flex-shrink: 0;
}

.reading-content {
  font-size: 14px;
  line-height: 1.95;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #222;
  flex: 1;
}

/* ─── Editor View ────────────────────────────────────────────────────────── */

.editor-sheet {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #f4f1e8;
  color: #1a1a1a;
  padding: 48px 64px 64px;
  display: flex;
  flex-direction: column;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.editor-sheet::-webkit-scrollbar { width: 5px; }
.editor-sheet::-webkit-scrollbar-thumb { background: #bbb; }

.sheet-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid #d8d5cc;
  padding-bottom: 12px;
  margin-bottom: 28px;
}

.date-stamp {
  font-size: 10px;
  letter-spacing: 3px;
  color: #999;
}

.typewriter-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.headline-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid #000;
  padding: 10px 0;
  font-family: 'Courier New', monospace;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  outline: none;
  width: 100%;
  color: #000;
  margin-bottom: 8px;
}

.headline-input::placeholder { color: #ccc; font-weight: normal; }

.body-text {
  flex: 1;
  background: transparent;
  border: none;
  padding: 20px 0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.9;
  resize: none;
  outline: none;
  min-height: 280px;
  color: #1a1a1a;
  width: 100%;
}

.body-text::placeholder { color: #bbb; }

.editor-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid #ddd;
  margin-top: 8px;
}

.publish-btn {
  background: #000;
  color: #f4f1e8;
  border: 2px solid #000;
  padding: 10px 32px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.publish-btn:hover {
  background: transparent;
  color: #000;
}

/* ─── Admin Login Overlay ────────────────────────────────────────────────── */

.admin-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
}

.admin-panel {
  position: relative;
  background: #f4f1e8;
  color: #000;
  padding: 44px 40px 40px;
  border: 1px solid #000;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.8);
}

.admin-panel .close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #bbb;
  width: auto;
  height: auto;
}

.admin-panel .close-btn:hover {
  background: none;
  border: none;
  color: #000;
}

/* ─── Login Form ─────────────────────────────────────────────────────────── */

.typewriter-login { width: 100%; }

.login-heading {
  font-size: 14px;
  letter-spacing: 5px;
  margin-bottom: 4px;
  color: #000;
}

.login-subhead {
  font-size: 9px;
  letter-spacing: 3px;
  color: #999;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.login-rule {
  border: none;
  border-top: 1px solid #ccc;
  margin-bottom: 24px;
}

.credentials {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.typewriter-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid #bbb;
  padding: 8px 0;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  outline: none;
  width: 100%;
  color: #000;
  transition: border-color 0.2s;
}

.typewriter-input::placeholder {
  color: #bbb;
  font-size: 10px;
  letter-spacing: 3px;
}

.typewriter-input:focus { border-bottom-color: #000; }

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.typewriter-btn {
  flex: 1;
  background: #000;
  color: #f4f1e8;
  border: 1px solid #000;
  padding: 11px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.typewriter-btn:hover {
  background: transparent;
  color: #000;
}

/* ─── Audio Player ───────────────────────────────────────────────────────── */

.audio-reading-pane {
  background: #f4f1e8;
}

.audio-player-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 8px;
}

.ap-transport {
  display: flex;
  align-items: center;
  gap: 20px;
}

.ap-play-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: #000;
  color: #f4f1e8;
  border: none;
  font-size: 16px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.ap-play-btn:hover { background: #222; }

.ap-timeline {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ap-progress-bar {
  height: 3px;
  background: #d8d5cc;
  cursor: pointer;
  position: relative;
}

.ap-progress-fill {
  height: 100%;
  background: #000;
  width: 0%;
  transition: width 0.25s linear;
  pointer-events: none;
}

.ap-time-row {
  display: flex;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: #888;
  font-family: 'Courier New', monospace;
}

.ap-time-divider { color: #ccc; }

.ap-meta-row {
  display: flex;
  gap: 16px;
  font-size: 9px;
  letter-spacing: 2px;
  color: #aaa;
  border-top: 1px solid #ddd;
  padding-top: 12px;
}

.ap-format-tag {
  background: #000;
  color: #f4f1e8;
  padding: 2px 6px;
  font-size: 8px;
  letter-spacing: 1px;
}

/* ─── Audio Recorder ─────────────────────────────────────────────────────── */

.audio-recorder-sheet {
  gap: 0;
}

.ar-error {
  font-size: 10px;
  letter-spacing: 1px;
  color: #900;
  padding: 8px 0;
  border-bottom: 1px solid #e8d8d8;
  margin-bottom: 16px;
}

.ar-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 32px 0;
}

.ar-action-btn {
  background: transparent;
  border: 1px solid #000;
  color: #000;
  padding: 10px 24px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ar-action-btn:hover {
  background: #000;
  color: #f4f1e8;
}

.ar-stop {
  border-color: #900;
  color: #900;
}

.ar-stop:hover {
  background: #900;
  color: #fff;
  border-color: #900;
}

.ar-countdown {
  font-size: 28px;
  letter-spacing: 4px;
  font-family: 'Courier New', monospace;
  color: #900;
  font-weight: bold;
}

.ar-divider-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: #bbb;
  padding: 4px 0;
}

.ar-format-hint {
  font-size: 9px;
  letter-spacing: 1px;
  color: #aaa;
}

.ar-status {
  font-size: 9px;
  letter-spacing: 3px;
  color: #aaa;
  min-height: 16px;
}

.ar-preview-section {
  border-top: 1px solid #ddd;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ar-preview-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: #555;
}

.ar-transmit-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ar-drop-btn {
  background: transparent;
  border: 1px solid #ccc;
  color: #999;
  padding: 10px 20px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.ar-drop-btn:hover {
  border-color: #900;
  color: #900;
}

.recording-preview {
  color: #666;
  letter-spacing: 1px;
}

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

/* Subtle slide-in for any pane that takes over the screen modally on phones.
   Used by the archive reading-pane, recordings audio-reading-pane, and the
   meal calendar's day editor. */
@keyframes harbinger-modal-in {
  from { transform: translateX(16px); opacity: 0.55; }
  to   { transform: translateX(0);    opacity: 1;    }
}

@media (max-width: 640px) {
  .masthead-row-title {
    height: 42px;
    padding: 0 14px;
  }

  .title-mark {
    font-size: 14px;
    letter-spacing: 4px;
  }

  .title-description {
    font-size: 10px;
    letter-spacing: 2px;
  }

  .nav-tabs {
    height: 38px;
  }

  .tab {
    padding: 0 14px;
    font-size: 9px;
    letter-spacing: 1.5px;
  }

  /* Modal-on-mobile: when an entry is selected the list pane gives way to
     the reading pane, which fills the entire workspace. The X close button
     in the reading-pane header takes you back to the list. */
  .archive-split-view .archive-list-pane { display: none; }
  .archive-split-view .reading-pane,
  .archive-split-view .audio-reading-pane {
    animation: harbinger-modal-in 0.18s ease-out;
  }

  .reading-pane {
    padding: 24px 20px 40px;
  }

  .reading-title { font-size: 16px; letter-spacing: 2px; }

  .editor-sheet {
    padding: 24px 20px 48px;
    max-width: 100%;
  }

  .headline-input { font-size: 16px; }

  .admin-panel {
    padding: 36px 24px 28px;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .archive-split-view .archive-list-pane {
    width: 240px;
  }

  .reading-pane {
    padding: 36px 40px;
  }

  .editor-sheet {
    padding: 36px 48px 56px;
  }
}

/* ─── Settings View ───────────────────────────────────────────────────────── */

.settings-sheet {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #f4f1e8;
  color: #1a1a1a;
  padding: 48px 64px 64px;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 8px;
}

.settings-blurb {
  font-size: 12px;
  letter-spacing: 1px;
  color: #777;
  line-height: 1.7;
  max-width: 56ch;
}

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

.feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  background: #fffaf0;
  border: 1px solid #e2dccb;
  border-radius: 4px;
}

.feature-text {
  flex: 1;
  min-width: 0;
}

.feature-name {
  font-size: 11px;
  letter-spacing: 3px;
  font-weight: bold;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.feature-desc {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #888;
  line-height: 1.6;
}

.feature-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ddd;
  border: 1px solid #ccc;
  padding: 6px 12px 6px 8px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border-radius: 999px;
}

.feature-toggle-knob {
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.feature-toggle.on {
  background: #3d6b48;
  border-color: #2f5238;
  color: #f7efe2;
}

.feature-toggle.on .feature-toggle-knob {
  background: #f7efe2;
  transform: translateX(2px);
}

.feature-toggle:disabled { opacity: 0.6; cursor: not-allowed; }

/* Enum picker — segmented control. Same row layout as ToggleRow. */
.feature-enum {
  flex-shrink: 0;
  display: inline-flex;
  border: 1px solid #c8b896;
  border-radius: 6px;
  overflow: hidden;
  background: #f7efe2;
}

.feature-enum-btn {
  background: transparent;
  border: none;
  border-right: 1px solid #d8cdb0;
  color: #6f6450;
  padding: 6px 14px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.feature-enum-btn:last-child { border-right: none; }
.feature-enum-btn:hover:not(:disabled):not(.active) { background: #f0e6d0; }

.feature-enum-btn.active {
  background: #1a1816;
  color: #f7efe2;
}

.feature-enum-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* String input — display name etc. */
.feature-string-input {
  flex-shrink: 0;
  width: 200px;
  background: #fffaf0;
  border: 1px solid #d8cdb0;
  border-radius: 4px;
  padding: 8px 12px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: #1a1816;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.feature-string-input::placeholder { color: #b8a888; letter-spacing: 1px; }
.feature-string-input:focus { border-color: #3d6b48; background: #fff; }
.feature-string-input:disabled { opacity: 0.6; cursor: not-allowed; }

/* Swatch picker — color circles */
.feature-swatches {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.feature-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background-clip: padding-box;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  /* The author-* classes set the actual fill color via background. */
}

.feature-swatch:hover:not(:disabled) { transform: scale(1.08); }

.feature-swatch.active {
  border-color: #1a1816;
  box-shadow: 0 0 0 2px #fffaf0, 0 0 0 3px #1a1816;
}

.feature-swatch:disabled { opacity: 0.5; cursor: not-allowed; }

/* Re-use the cal-author-dot color variables for swatches. */
.feature-swatch.author-green      { background: #3d6b48; }
.feature-swatch.author-indigo     { background: #3a3a7d; }
.feature-swatch.author-terracotta { background: #c87053; }
.feature-swatch.author-ochre      { background: #d4a04a; }
.feature-swatch.author-sand       { background: #b39271; }
.feature-swatch.author-plum       { background: #6b3a5e; }

/* ─── Calendar View ───────────────────────────────────────────────────────── */
/* African earth-tone palette + Nintendo-soft chrome. Breathable spacing — */
/* this is a sensitive surface, no harsh borders, no shouting. */

.view-wrapper-calendar { background: #f7efe2; }

.calendar-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  background: #f7efe2;
  color: #1a1816;
  overflow: hidden;
}

.calendar-board {
  flex: 1.4;
  min-width: 0;
  overflow-y: auto;
  padding: 32px 40px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cal-header-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cal-month-title {
  font-size: 16px;
  letter-spacing: 6px;
  font-weight: bold;
  color: #1a1816;
}

.cal-today-btn {
  background: transparent;
  border: 1px solid #c8b896;
  color: #6f6450;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

.cal-today-btn:hover {
  background: #c87053;
  border-color: #c87053;
  color: #f7efe2;
}

.cal-nav-btn {
  background: #fffaf0;
  border: 1px solid #c8b896;
  color: #6f6450;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 0 #c8b896;
}

.cal-nav-btn:hover {
  background: #d4a04a;
  border-color: #b88736;
  color: #1a1816;
  transform: translateY(-1px);
  box-shadow: 0 2px 0 #b88736;
}

.cal-nav-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 #b88736;
}

.cal-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.cal-weekday {
  font-size: 9px;
  letter-spacing: 3px;
  text-align: center;
  color: #a89876;
  padding: 6px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.cal-cell {
  aspect-ratio: 1 / 1;
  background: #fffaf0;
  border: 1px solid #ece1c9;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 0 #ece1c9;
  text-align: left;
  color: #1a1816;
}

.cal-cell:hover {
  border-color: #d4a04a;
  background: #fff5dd;
  transform: translateY(-1px);
  box-shadow: 0 2px 0 #d4a04a;
}

.cal-cell-blank {
  background: transparent;
  border: 1px dashed #e6dcc1;
  cursor: default;
  box-shadow: none;
}

.cal-cell-blank:hover {
  background: transparent;
  border-color: #e6dcc1;
  transform: none;
  box-shadow: none;
}

.cal-cell-today {
  border-color: #c87053;
  box-shadow: 0 1px 0 #c87053;
}

.cal-cell-today .cal-day-num { color: #c87053; font-weight: bold; }

.cal-cell-selected {
  background: #d4a04a;
  border-color: #b88736;
  color: #1a1816;
  box-shadow: 0 2px 0 #b88736;
}

.cal-cell-selected .cal-day-num { color: #1a1816; }

.cal-cell-has-entry {
  background: #fff5dd;
}

.cal-day-num {
  font-size: 14px;
  letter-spacing: 1px;
  color: #4a4030;
}

.cal-dot-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cal-author-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.cal-author-dot.author-green      { background: #3d6b48; }
.cal-author-dot.author-indigo     { background: #3a3a7d; }
.cal-author-dot.author-terracotta { background: #c87053; }
.cal-author-dot.author-ochre      { background: #d4a04a; }
.cal-author-dot.author-sand       { background: #b39271; }
.cal-author-dot.author-plum       { background: #6b3a5e; }

.cal-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 9px;
  letter-spacing: 2px;
  color: #a89876;
  padding-top: 8px;
}

.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-legend-email {
  margin-left: auto;
  color: #a89876;
  font-size: 9px;
  letter-spacing: 1px;
}

/* ─── Meal Editor Pane ─────────────────────────────────────────────────────── */

.meal-editor-pane {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: #fffaf0;
  border-left: 1px solid #ece1c9;
  padding: 32px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.meal-editor-empty {
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  color: #a89876;
}

.meal-editor-empty-label {
  font-size: 12px;
  letter-spacing: 4px;
  color: #6f6450;
}

.meal-editor-empty-blurb {
  font-size: 11px;
  letter-spacing: 0.5px;
  line-height: 1.7;
  max-width: 36ch;
  color: #a89876;
}

.meal-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid #ece1c9;
  padding-bottom: 14px;
}

.meal-editor-date {
  font-size: 11px;
  letter-spacing: 4px;
  color: #1a1816;
  font-weight: bold;
}

.meal-close-btn {
  background: transparent;
  border: 1px solid #d8cdb0;
  color: #a89876;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.meal-close-btn:hover { background: #c87053; border-color: #c87053; color: #f7efe2; }

.meal-editor-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meal-editor-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: #a89876;
  margin-bottom: 6px;
}

/* One row per logged item. Looks like a flat list, not a form, until focus. */
.meal-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.12s;
}

.meal-item-row:hover { background: #f7efe2; }
.meal-item-row:focus-within { background: #fffaf0; }

.meal-item-bullet {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: #c8b896;
  user-select: none;
}

.meal-item-bullet-add { color: #3d6b48; font-weight: bold; }

.meal-item-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 4px 0;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #1a1816;
  outline: none;
  transition: border-color 0.12s;
}

/* iOS Safari auto-zooms when an input has font-size < 16px. Bumping the
   meal-item-input on mobile prevents the zoom-and-scroll-out dance after
   each entry — the price is slightly larger text on phones, which actually
   reads better one-handed anyway. */
@media (max-width: 640px) {
  .meal-item-input { font-size: 16px; }
}

.meal-item-input::placeholder { color: #b8a888; font-style: italic; }
.meal-item-input:focus       { border-bottom-color: #3d6b48; }
.meal-item-row-add .meal-item-input::placeholder { color: #8c8366; font-style: normal; }

/* Delete is reachable on touch but doesn't shout — fades up on hover, always
   visible on mobile where there's no hover state. */
.meal-item-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: #c8b896;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
}

.meal-item-row:hover .meal-item-delete,
.meal-item-row:focus-within .meal-item-delete { opacity: 1; }
.meal-item-delete:hover { color: #c87053; background: rgba(200, 112, 83, 0.1); }
.meal-item-row-add .meal-item-delete { display: none; }

/* Visible add button on the right of the add row. Removes the "is Enter
   the only way?" doubt. Tappable target sized for thumbs. */
.meal-add-btn {
  flex-shrink: 0;
  background: #3d6b48;
  color: #f7efe2;
  border: 1px solid #2f5238;
  padding: 7px 14px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 2px 0 #2f5238;
  transition: transform 0.1s, background 0.15s, box-shadow 0.1s;
  min-height: 32px;
}

.meal-add-btn:hover  { background: #2f5238; }
.meal-add-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #2f5238; }

/* The add row has the green button to keep it discoverable; the empty add
   row should never look like a deleteable item. */
.meal-item-row-add { background: transparent; }
.meal-item-row-add:hover,
.meal-item-row-add:focus-within { background: #fffaf0; }

/* Make the add row a bit taller on mobile so the ADD button is easy to hit
   without the keyboard covering it. */
@media (max-width: 640px) {
  .meal-add-btn { padding: 9px 16px; font-size: 11px; min-height: 38px; }
  .meal-item-row-add { padding: 6px; }
}

@media (max-width: 900px) {
  .meal-item-delete { opacity: 0.45; }   /* always visible on touch */
}

/* ─── In-app Lightbox ─────────────────────────────────────────────────────
   Full-screen image viewer mounted at the App root. The URL never gets
   pushed into a new tab or browser history — clicks open the modal in place
   and the close action just clears AppState.lightboxImage. */

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 6, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  cursor: zoom-out;
  animation: lightbox-fade-in 0.18s ease-out;
}

@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  /* Subtle frame that keeps very-light photos legible against the backdrop. */
  box-shadow: 0 0 0 1px rgba(247, 239, 226, 0.08), 0 16px 40px rgba(0, 0, 0, 0.45);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  background: rgba(247, 239, 226, 0.12);
  color: #f7efe2;
  border: 1px solid rgba(247, 239, 226, 0.18);
  border-radius: 50%;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.lightbox-close:hover {
  background: #c87053;
  border-color: #c87053;
}

@media (max-width: 640px) {
  .lightbox-backdrop { padding: 12px; }
  .lightbox-img      { max-width: 96vw; max-height: 88vh; }
  .lightbox-close    { top: 10px; right: 10px; width: 36px; height: 36px; }
}

/* ─── Meal photos ──────────────────────────────────────────────────────── */

.meal-photos {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 0 4px;
  border-top: 1px dashed #ece1c9;
  margin-top: 12px;
}

.meal-photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meal-photo {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #ece1c9;
}

.meal-photo-link {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: zoom-in;
  text-decoration: none;
}

.meal-photo-link:focus-visible {
  outline: 2px solid #d4a04a;
  outline-offset: 2px;
}

.meal-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.meal-photo:hover .meal-photo-img { transform: scale(1.04); }

.meal-photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(26, 24, 22, 0.78);
  color: #f7efe2;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.12s, background 0.15s;
}

.meal-photo:hover .meal-photo-delete,
.meal-photo:focus-within .meal-photo-delete { opacity: 1; }
.meal-photo-delete:hover { background: #c87053; }

/* On touch the hover-to-reveal trick doesn't work — keep delete visible. */
@media (max-width: 900px) {
  .meal-photo-delete { opacity: 0.85; }
}

.meal-photo-actions {
  display: flex;
  align-items: center;
}

.meal-photo-add-btn {
  background: transparent;
  color: #6f6450;
  border: 1px dashed #c8b896;
  padding: 8px 16px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}

.meal-photo-add-btn:hover:not(:disabled) {
  color: #1a1816;
  border-color: #3d6b48;
  background: #fffaf0;
}

.meal-photo-add-btn:disabled,
.meal-photo-add-btn.busy {
  opacity: 0.6;
  cursor: not-allowed;
  border-style: solid;
  color: #1a1816;
  background: #f7efe2;
}

.meal-photo-file {
  /* visually hidden but still focusable for accessibility */
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

@media (max-width: 640px) {
  .meal-photo { width: 84px; height: 84px; }
  .meal-photo-add-btn { padding: 10px 16px; font-size: 11px; }
}

/* Read-only photo grid in someone-else's section: tighter, no border-top
   since it's already inside the meal-other-entry card. */
.meal-other-entry .meal-photos {
  border-top: none;
  padding: 0;
  margin-top: 4px;
}
.meal-other-entry .meal-photo { width: 72px; height: 72px; }

/* Others' entries — read-only bulleted list. */
.meal-others {
  border-top: 1px solid #ece1c9;
  padding-top: 18px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meal-others-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: #a89876;
}

.meal-other-entry {
  background: #f7efe2;
  border-left: 3px solid #3a3a7d;
  padding: 10px 14px;
  border-radius: 0 4px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meal-other-author-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meal-other-author {
  font-size: 10px;
  letter-spacing: 2px;
  color: #6f6450;
  font-weight: bold;
}

.meal-other-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meal-other-item {
  position: relative;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.6;
  color: #2a2620;
}

.meal-other-item::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: #c8b896;
}

.meal-other-empty {
  font-size: 11px;
  color: #b8a888;
  font-style: italic;
}

/* Tablet: stack the calendar editor under the board so both fit on screen. */
@media (max-width: 900px) {
  .calendar-shell {
    flex-direction: column;
    overflow-y: auto;
  }
  .calendar-board {
    padding: 24px 18px 8px;
    flex: none;
  }
  .meal-editor-pane {
    border-left: none;
    border-top: 1px solid #ece1c9;
    padding: 24px 20px 40px;
    flex: none;
  }
  .cal-month-title { font-size: 13px; letter-spacing: 4px; }
  .cal-day-num     { font-size: 12px; }
  .cal-cell        { padding: 6px 8px; border-radius: 4px; }
  .cal-grid        { gap: 5px; }
  .cal-weekday-row { gap: 5px; }
  .settings-sheet  { padding: 28px 22px 48px; }
  .feature-row     { padding: 14px 14px; gap: 14px; }
}

/* Phone: modal-on-mobile. The calendar grid and the day editor never share
   the screen — picking a day takes you into a full-screen editor with the X
   close button serving as the back gesture. */
@media (max-width: 640px) {
  /* Empty-state placeholder is wasted space on a phone. */
  .calendar-shell:not(.calendar-shell-detail) .meal-editor-empty {
    display: none;
  }
  /* Day-editor open: hide the grid, fill the workspace with the editor. */
  .calendar-shell-detail .calendar-board { display: none; }
  .calendar-shell-detail .meal-editor-pane {
    flex: 1;
    border-top: none;
    padding: 24px 20px 40px;
    animation: harbinger-modal-in 0.18s ease-out;
  }
}

/* ─── Featured (most recent) entry — pinned to top of archive ─────────────── */

.featured-entry {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  background: #161616;
  color: #e8e3d4;
  border: 1px solid #2a2a2a;
  border-left: 3px solid #c87053;
  padding: 22px 24px;
  margin: 14px 14px 8px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.featured-entry:hover  { background: #1c1c1c; border-left-color: #d4a04a; }
.featured-entry:active { transform: translateY(1px); }
.featured-entry:focus-visible {
  outline: 2px solid #d4a04a;
  outline-offset: 2px;
}

.featured-tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 9px;
  letter-spacing: 2px;
  color: #888;
}

.featured-tag {
  background: #c87053;
  color: #1a1816;
  padding: 3px 8px;
  letter-spacing: 3px;
  font-weight: bold;
}

.featured-meta {
  color: #888;
  letter-spacing: 1px;
}

/* The visibility chip lives on a dark surface here — boost contrast. */
.featured-entry .vis-tag-public { color: #aaa; border-color: #555; }
.featured-entry .vis-tag-admins { color: #d99a82; border-color: #d99a82; background: rgba(200, 112, 83, 0.18); }

.featured-title {
  font-size: 18px;
  letter-spacing: 3px;
  font-weight: bold;
  color: #fff;
  line-height: 1.3;
  word-break: break-word;
}

.featured-preview {
  font-size: 12px;
  letter-spacing: 0.5px;
  line-height: 1.7;
  color: #b0a99a;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-cta {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 4px;
  color: #d4a04a;
  align-self: flex-start;
}

@media (max-width: 640px) {
  .featured-entry {
    padding: 18px 16px;
    margin: 10px 10px 6px;
    gap: 10px;
  }
  .featured-title { font-size: 15px; letter-spacing: 2px; }
}

/* ─── Visibility Tags + Toggle ─────────────────────────────────────────────── */

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

.item-meta .item-preview { flex: 1; min-width: 0; }

.vis-tag {
  flex-shrink: 0;
  font-size: 8px;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  padding: 2px 6px;
  border: 1px solid currentColor;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Public tag: muted, blends in. Admins tag: marked, stands out as restricted. */
.vis-tag-public { color: #4a4a4a; border-color: #2a2a2a; }
.vis-tag-admins { color: #c87053; border-color: #c87053; background: rgba(200, 112, 83, 0.08); }

.reading-meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.reading-author {
  font-size: 10px;
  letter-spacing: 1px;
  color: #888;
}

.visibility-flip-btn {
  background: transparent;
  border: 1px solid #ccc;
  color: #666;
  padding: 4px 12px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}

.visibility-flip-btn:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

/* Reading-pane: light surface — keep the public tag readable */
.reading-pane .vis-tag-public { color: #5a5a5a; border-color: #b8b8b8; }
.reading-pane .vis-tag-admins { color: #b85a3d; border-color: #b85a3d; background: rgba(200, 112, 83, 0.10); }

/* ─── Editor: visibility selector ──────────────────────────────────────────── */

.visibility-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 0 4px;
  border-top: 1px dashed #d8d5cc;
  margin-top: 12px;
}

.visibility-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: #999;
}

.visibility-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: #444;
  cursor: pointer;
  user-select: none;
}

.visibility-option input[type="radio"] {
  accent-color: #000;
  cursor: pointer;
  margin: 0;
}

/* ─── Inspiration board ─────────────────────────────────────────────────────── */

.view-wrapper-inspo {
  padding: 0;
}

.inspo-layout {
  display: flex;
  gap: 0;
  align-items: stretch;
  /* Fill the (overflow-hidden) view-wrapper and let each column scroll on its
     own, so tall content — the lower outfit slots, long collection lists —
     stays reachable instead of being clipped at ~60vh. */
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Board rail */
.inspo-rail {
  flex: 0 0 168px;
  border-right: 1px solid #222;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}
.inspo-rail-head {
  font-size: 9px;
  letter-spacing: 3px;
  color: #888;
  padding: 0 4px;
}
/* Subheading that separates the BOARDS group from the OUTFITS group. */
.inspo-rail-group {
  font-size: 8px;
  letter-spacing: 2px;
  color: #57544c;
  padding: 9px 4px 3px;
  margin-top: 4px;
  border-top: 1px solid #181818;
}
.inspo-board-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.inspo-board-row {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
}
.inspo-board-row.active {
  background: #1a1a1a;
  border-color: #333;
}
.inspo-board-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: none;
  border: none;
  color: #c8c4b8;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 7px 8px;
  cursor: pointer;
  text-align: left;
}
.inspo-board-row:hover { background: #131313; }
.inspo-board-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inspo-board-count {
  font-size: 9px;
  color: #666;
}
.inspo-board-del {
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  font-size: 11px;
  padding: 4px 6px;
}
.inspo-board-del:hover { color: #b06b6b; }
.inspo-new-board {
  margin-top: auto;
  background: none;
  border: 1px dashed #333;
  color: #888;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 8px;
  cursor: pointer;
}
.inspo-new-board:hover { color: #fff; border-color: #555; }

/* Main column — owns the vertical scroll for both the image grid and the
   outfit body map, so nothing gets clipped below the fold. */
.inspo-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inspo-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
/* Name of the collection currently shown in the main pane. */
.inspo-collection-title {
  font-size: 13px;
  letter-spacing: 2px;
  color: #d8d4c6;
  font-weight: bold;
}
.inspo-count {
  font-size: 10px;
  letter-spacing: 2px;
  color: #999;
}
.inspo-clear {
  background: none;
  border: 1px solid #333;
  color: #888;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 2px;
  padding: 5px 9px;
  cursor: pointer;
}
.inspo-clear:hover { color: #fff; border-color: #555; }
.inspo-add {
  margin-left: auto;
  background: #1a1a1a;
  border: 1px solid #333;
  color: #fff;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 7px 12px;
  cursor: pointer;
}
.inspo-add:hover { background: #fff; color: #000; }
.inspo-add.busy { opacity: 0.6; cursor: default; }
.inspo-file { display: none; }

/* Filter bar */
.inspo-filterbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #1c1c1c;
  border-bottom: 1px solid #1c1c1c;
  padding: 10px 0;
}
.inspo-search {
  background: #111;
  border: 1px solid #2a2a2a;
  color: #c8c4b8;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 7px 9px;
  width: 100%;
  max-width: 320px;
}
.inspo-search::placeholder { color: #555; }
.inspo-facet-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.inspo-facet-label {
  flex: 0 0 64px;
  font-size: 9px;
  letter-spacing: 2px;
  color: #777;
}
.inspo-facet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.inspo-chip {
  background: none;
  border: 1px solid #2e2e2e;
  color: #9a968b;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 8px;
  cursor: pointer;
  text-transform: lowercase;
}
.inspo-chip:hover { border-color: #555; color: #ddd; }
.inspo-chip.active {
  background: #f4f1e8;
  border-color: #f4f1e8;
  color: #1a1a1a;
}

/* Grid */
.inspo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.inspo-card {
  border: 1px solid #1c1c1c;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
}
.inspo-card-img-btn {
  border: none;
  padding: 0;
  margin: 0;
  background: #111;
  cursor: zoom-in;
  display: block;
  line-height: 0;
}
.inspo-card-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}
.inspo-card-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 6px;
  border-top: 1px solid #161616;
}
.inspo-card-edit {
  background: none;
  border: none;
  color: #888;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 2px;
  cursor: pointer;
  padding: 2px 2px;
}
.inspo-card-edit:hover { color: #fff; }
.inspo-card-del {
  background: none;
  border: none;
  color: #444;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
}
.inspo-card-del:hover { color: #b06b6b; }
.inspo-card-title {
  font-size: 10px;
  letter-spacing: 1px;
  color: #c8c4b8;
  padding: 0 6px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inspo-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0 6px 7px;
}
.inspo-card-tag {
  font-size: 8px;
  letter-spacing: 1px;
  color: #6f6b60;
  border: 1px solid #222;
  padding: 1px 4px;
}
.inspo-empty {
  color: #555;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 40px 10px;
  text-align: center;
}

/* Tag editor overlay */
.inspo-editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.inspo-editor {
  background: #0d0d0d;
  border: 1px solid #333;
  max-width: 620px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}
.inspo-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #222;
  font-size: 10px;
  letter-spacing: 3px;
  color: #999;
}
.inspo-close {
  background: none;
  border: none;
  color: #888;
  font-size: 14px;
  cursor: pointer;
}
.inspo-close:hover { color: #fff; }
.inspo-editor-body {
  display: flex;
  gap: 14px;
  padding: 14px;
}
.inspo-editor-img {
  flex: 0 0 180px;
  width: 180px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid #222;
  align-self: flex-start;
}
.inspo-editor-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inspo-edit-input {
  background: #111;
  border: 1px solid #2a2a2a;
  color: #c8c4b8;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 7px 9px;
  width: 100%;
}
.inspo-edit-input::placeholder { color: #555; letter-spacing: 2px; font-size: 9px; }
.inspo-edit-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inspo-edit-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: #777;
}
.inspo-empty-hint {
  font-size: 9px;
  color: #555;
  letter-spacing: 1px;
}

@media (max-width: 720px) {
  /* Stack rail over the main pane; both scroll on their own so the rail can't
     swallow the screen and the body map / grid stays fully scrollable. */
  .inspo-layout { flex-direction: column; }
  .inspo-rail {
    flex: 0 0 auto;
    max-height: 34vh;
    border-right: none;
    border-bottom: 1px solid #222;
  }
  .inspo-editor-body { flex-direction: column; }
  .inspo-editor-img { width: 100%; flex-basis: auto; max-height: 240px; }
}

/* Inspo board — gallery visibility controls */
.inspo-board-row {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}
.inspo-board-ctl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 8px 6px;
}
.vis-tag-btn {
  cursor: pointer;
  font-family: inherit;
  background: none;
}
.vis-tag-btn:hover {
  filter: brightness(1.35);
}
.inspo-board-row .inspo-board-del {
  padding: 0 4px;
}

/* ─── Outfit builder ────────────────────────────────────────────────────────── */

.view-wrapper-outfits { padding: 0; }
.outfit-view { padding: 12px 14px; }

.outfit-mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.outfit-mode {
  background: none;
  border: 1px solid #2a2a2a;
  color: #888;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 7px 14px;
  cursor: pointer;
}
.outfit-mode.active { background: #1a1a1a; color: #fff; border-color: #444; }

/* Build layout: body stage + palette */
.outfit-build {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.outfit-stage { flex: 1; min-width: 0; }

.outfit-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.outfit-name-input {
  flex: 1;
  min-width: 140px;
  background: #111;
  border: 1px solid #2a2a2a;
  color: #c8c4b8;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 2px;
  padding: 8px 10px;
}
.outfit-name-input::placeholder { color: #555; }
.outfit-piece-count { font-size: 10px; letter-spacing: 1px; color: #777; }
.outfit-clear-all, .outfit-save, .outfit-delete {
  background: none;
  border: 1px solid #333;
  color: #888;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 8px 12px;
  cursor: pointer;
}
.outfit-save { background: #1a1a1a; color: #fff; }
.outfit-save:hover { background: #fff; color: #000; }
.outfit-clear-all:hover { color: #fff; border-color: #555; }
.outfit-save:disabled, .outfit-clear-all:disabled { opacity: 0.4; cursor: default; }
.outfit-delete { border-color: #5a2f2f; color: #c87053; }
.outfit-delete:hover { background: #c87053; color: #120c0a; }

/* Body map — head→shoe spine, outerwear to the side, accessories column */
.outfit-body {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  grid-template-areas:
    ".      head     ."
    ".      eyewear  ."
    "outer  top      acc"
    "outer  belt     acc"
    ".      bottom   acc"
    ".      sock     acc"
    ".      shoe     acc";
  gap: 8px;
  max-width: 680px;
  margin: 0 auto;
}
.outfit-slot-head      { grid-area: head; }
.outfit-slot-eyewear   { grid-area: eyewear; }
.outfit-slot-outerwear { grid-area: outer; align-self: stretch; }
.outfit-slot-top       { grid-area: top; }
.outfit-slot-belt      { grid-area: belt; }
.outfit-slot-bottom    { grid-area: bottom; }
.outfit-slot-sock      { grid-area: sock; }
.outfit-slot-shoe      { grid-area: shoe; }
.outfit-slot-acc       { grid-area: acc; align-self: stretch; }

.outfit-slot {
  border: 1px dashed #2e2e2e;
  background: #0a0a0a;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  position: relative;
}
.outfit-slot.filled { border-style: solid; border-color: #333; }
.outfit-slot.assigning { border-color: #f4f1e8; background: #15140f; }
.outfit-slot-label {
  font-size: 8px;
  letter-spacing: 2px;
  color: #6f6b60;
  margin-bottom: 3px;
}
.outfit-slot.assigning .outfit-slot-label { color: #f4f1e8; }
.outfit-slot-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3f3f3f;
  font-size: 9px;
  letter-spacing: 1px;
  cursor: pointer;
}
.outfit-slot-content { flex: 1; position: relative; min-height: 56px; }
.outfit-slot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.outfit-slot-clear, .outfit-acc-clear {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #ddd;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
}
.outfit-slot-clear:hover, .outfit-acc-clear:hover { color: #fff; background: rgba(176,107,107,0.85); }

/* Accessories column */
.outfit-acc-list { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.outfit-acc-item { position: relative; height: 64px; }
.outfit-acc-img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.outfit-acc-add {
  border: 1px dashed #2e2e2e;
  color: #555;
  font-size: 9px;
  letter-spacing: 1px;
  text-align: center;
  padding: 10px 4px;
  cursor: pointer;
}
.outfit-acc-add:hover { color: #ccc; border-color: #555; }
.outfit-acc-add.assigning { border-color: #f4f1e8; color: #f4f1e8; }

/* Palette */
.outfit-palette {
  flex: 0 0 248px;
  border-left: 1px solid #1c1c1c;
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.outfit-palette-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 2px;
  color: #888;
}
.outfit-cancel-assign {
  background: none; border: none; color: #c87053;
  font-family: inherit; font-size: 9px; letter-spacing: 1px; cursor: pointer;
}
.outfit-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
}
.outfit-palette-cell {
  border: 1px solid #1c1c1c;
  background: #111;
  cursor: grab;
  line-height: 0;
}
.outfit-palette-cell:active { cursor: grabbing; }
.outfit-palette-cell:hover { border-color: #444; }
.outfit-palette-img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }

/* Saved outfits grid */
.outfit-saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.outfit-card {
  border: 1px solid #1c1c1c;
  background: #0a0a0a;
  cursor: pointer;
}
.outfit-card:hover { border-color: #3a3a3a; }
.outfit-card-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #1c1c1c;
  aspect-ratio: 1;
}
.outfit-card-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.outfit-card-empty {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center;
  color: #444; font-size: 10px; letter-spacing: 2px;
}
.outfit-card-meta { padding: 6px 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.outfit-card-name {
  font-size: 11px; letter-spacing: 1px; color: #c8c4b8;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.outfit-card-count { font-size: 8px; color: #666; letter-spacing: 1px; flex: 0 0 auto; }

/* Saved outfit detail */
.outfit-detail-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.outfit-detail {
  background: #0d0d0d;
  border: 1px solid #333;
  max-width: 640px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  padding: 14px;
}
.outfit-detail-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.outfit-detail-name { font-size: 12px; letter-spacing: 2px; color: #ddd; }
.outfit-detail-hint { font-size: 9px; color: #666; letter-spacing: 1px; margin: 0 0 12px; }
.outfit-detail-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }

@media (max-width: 760px) {
  .outfit-build { flex-direction: column; }
  .outfit-palette {
    flex-basis: auto; width: 100%;
    border-left: none; padding-left: 0;
    border-top: 1px solid #1c1c1c; padding-top: 10px;
  }
  .outfit-palette-grid { max-height: 40vh; }
}

/* Inspo rail — outfit kind badge + dual new-collection actions */
.inspo-row-badge {
  font-size: 7px;
  letter-spacing: 1px;
  color: #120c0a;
  background: #9a968b;
  padding: 1px 3px;
  margin-right: 5px;
  border-radius: 2px;
  flex: 0 0 auto;
}
.inspo-board-row.active .inspo-row-badge { background: #f4f1e8; }
.inspo-rail-actions {
  margin-top: auto;
  display: flex;
  gap: 6px;
}
.inspo-rail-actions .inspo-new-board { flex: 1; }
