/* ═══════════════════════════════════════════════
   CAL CARD — Mobile/All/Following tab cards
   ═══════════════════════════════════════════════ */

/* ── Following Tab Grid Layout ────────────────── */
#tab-following {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

/* ── All Tab Layout ────────────────────────────── */
/* #tab-all is a plain block — centering is handled by .all-tab-container inside it */
#tab-all {
  display: block;
}

#tab-all .empty-state,
#tab-following .empty-state {
  grid-column: 1 / -1;
}

.all-search-row {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.all-search-input {
  flex: 1;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg-surface);
  backdrop-filter: blur(6px);
}

.all-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.all-search-input::placeholder {
  color: var(--text-faint);
}


[data-theme="side-b"] .all-search-input::-webkit-search-cancel-button {
  filter: invert(75%);
}

/* Mine tab — single centered card */
#tab-mylog .cal-card {
  max-width: 480px;
  margin: 0 auto;
}

/* ── Card ────────────────────────────────────── */
.cal-card {
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  width: 100%;
  min-width: 0;
}

.cal-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── Badge / Card Header ─────────────────────── */
.cal-card-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  min-height: 44px;
}

.cal-card-avatar-wrap { flex-shrink: 0; }

.cal-card-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.4);
  display: block;
}

.cal-card-avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  border: 2px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
}

.cal-card-name-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.cal-card-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-card-sticker {
  font-size: 0.95rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

/* "you" pill */
.cal-you-pill {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.25);
  color: inherit;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* ── Follow Button ─────────────────────────────── */
.cal-follow-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  font-family: var(--font-base);
  letter-spacing: 0.01em;
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--red);
}

.cal-follow-btn:hover:not(:disabled) {
  background: var(--red-wash);
  border-color: var(--red-hover);
  color: var(--red-hover);
}

.cal-follow-btn.following {
  background: var(--red);
  color: var(--paper);
  border-color: var(--red);
}

.cal-follow-btn.following:hover:not(:disabled) {
  background: var(--red-hover);
  border-color: var(--red-hover);
}

.cal-follow-btn.loading { opacity: 0.65; cursor: wait; }
.cal-follow-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.follow-btn-plus,
.follow-btn-check { font-size: 0.75rem; line-height: 1; }

/* ── Filter Bar ──────────────────────────────── */
.cal-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
}

.filter-label { color: var(--text-muted); }

.filter-pill {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-hint {
  color: var(--text-faint);
  font-size: 0.6rem;
  margin-left: auto;
}

/* ── Calendar Body ───────────────────────────── */
.cal-card-body { padding: 8px 10px; }

.cal-grid-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 3px;
}

.cal-grid-header {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-faint);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-grid-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

/* ── Day Cell ────────────────────────────────── */
.cal-grid-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 4px 3px 4px;
  transition: background var(--transition);
}

.cal-day-num {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
  align-self: flex-end;
  margin-right: 2px;
}

.cal-day-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  align-items: center;
  width: 100%;
  margin-top: 3px;
}

.cal-day-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Diary entry dot */
.cal-diary-dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--yellow);
  margin: 1px auto 0;
  flex-shrink: 0;
}

/* Overflow indicator */
.cal-day-dot--more {
  width: auto;
  height: auto;
  border-radius: 99px;
  font-size: 0.38rem;
  font-weight: 700;
  padding: 0 2px;
  background: var(--text-faint) !important;
  color: white;
  line-height: 1.4;
}

.cal-day-partial { background: var(--bg-subtle); }
.cal-day-full { background: var(--bg-subtle); border-radius: var(--radius-md); }

.cal-day-today {
  outline: 1.5px solid var(--color-primary);
  outline-offset: 1px;
  border-radius: var(--radius-md);
}

.cal-day-today .cal-day-num {
  color: var(--color-primary);
  font-weight: 700;
}

.cal-day-future .cal-day-num { opacity: 0.35; }

/* Overflow popover */
.cal-overflow-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
  white-space: nowrap;
  min-width: 110px;
  pointer-events: none;
}

.cal-overflow-item {
  font-size: 0.65rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}

.cal-overflow-item i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Activity Legend Footer ───────────────────── */
.cal-card-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 8px 12px;
}

.cal-legend {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px 14px;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-legend-name {
  font-size: 0.72rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}

.cal-legend-item--clickable {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.15s;
}
.cal-legend-item--clickable:hover { background: rgba(0,0,0,0.06); }
.cal-legend-item--active { background: rgba(0,0,0,0.06); }
.cal-legend-item--active .cal-legend-name { font-weight: 700; color: var(--text); }

/* ── Placeholder Card ── */
.cal-card-placeholder { opacity: 0.75; }

.cal-card-placeholder-body {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
}

.cal-card-placeholder-text {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-style: italic;
  text-align: center;
}

/* ── Following tab ───────────────────────────── */
.following-card-slot { position: relative; min-width: 0; }

.following-pin-wrap {
  position: absolute;
  top: -12px;
  right: -10px;
  z-index: 10;
  margin: 0;
}

.following-pin-btn {
  border: none;
  background: none;
  font-size: 1.3rem;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  opacity: 0.25;
  transition: opacity 0.15s, transform 0.15s;
  filter: grayscale(1);
  display: block;
  transform: rotate(45deg);
}

.following-pin-btn:hover { opacity: 0.65; filter: none; }

.following-pin-btn.active {
  border: none;
  background: none;
  opacity: 1;
  filter: none;
  transform: rotate(0deg);
}

.following-board { display: grid; gap: 16px; }

.following-board.has-pinned {
  grid-template-columns: minmax(0, 1.9fr) minmax(320px, 1fr);
  align-items: start;
}

.following-side-col { display: grid; gap: 12px; align-content: start; }

.following-no-pinned-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
}

.following-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: 12px;
}

.following-section-header h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.following-section-empty {
  margin: 8px 0 0;
  color: var(--text-faint);
  font-size: 0.76rem;
}

.following-calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.following-compact-list { display: grid; gap: 8px; margin-top: 10px; }

.following-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 9px 10px;
}

.following-compact-user { display: flex; align-items: center; gap: 8px; min-width: 0; }

.following-compact-avatar,
.following-compact-avatar-initials {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.following-compact-avatar { object-fit: cover; }

.following-compact-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--bg-surface);
}

.following-compact-copy { min-width: 0; }

.following-compact-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.following-compact-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.following-compact-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.following-status-chip {
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid var(--border);
}

.following-status-chip.has-tracker { color: #1B7D5A; background: #EAF8F2; border-color: #B9E4D2; }
.following-status-chip.no-tracker { color: #8A6A1F; background: #FFF6E6; border-color: #F3D69A; }

.following-pin-btn-small { font-size: 1rem; padding: 4px 6px; opacity: 0.5; filter: grayscale(0.4); }
.following-pin-btn-small:hover { opacity: 0.8; }
.following-pin-btn-small.active { opacity: 1; }

.following-nudge-section { display: flex; }
.following-nudge-slot { min-width: 0; align-self: stretch; display: flex; }

.following-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.following-lottie-icon { width: 80px; height: 80px; margin: 0 auto 4px; display: block; }
.following-empty-title { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; color: var(--text); margin: 0; }
.following-empty-sub { font-size: 0.8rem; color: var(--text-muted); margin: 0; max-width: 260px; line-height: 1.5; }

.following-nudge-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  gap: 8px;
  box-sizing: border-box;
  transition: border-color var(--transition), background var(--transition);
}

@media (max-width: 1100px) { .following-board.has-pinned { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .following-no-pinned-grid { grid-template-columns: 1fr; } }

.following-nudge-card:hover { border-color: var(--color-primary); background: var(--bg-subtle); }
.following-nudge-title { font-family: var(--font-heading); font-size: 0.95rem; font-weight: 700; color: var(--text); margin: 0; }
.following-nudge-sub { font-size: 0.72rem; color: var(--text-muted); margin: 0; max-width: 200px; line-height: 1.5; }

.following-browse-btn {
  margin-top: 4px;
  padding: 7px 18px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-base);
  transition: all var(--transition);
}

.following-browse-btn:hover { background: var(--color-primary); color: white; }

/* ── Day Sheet (Bottom Sheet) ──────────────────── */
.day-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 46, 69, 0.25);
  z-index: 9996;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(1px);
}

.day-sheet {
  background: var(--bg-surface);
  width: 100%;
  border-radius: 18px 18px 0 0;
  padding: 12px 20px 32px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.day-sheet-handle { width: 32px; height: 4px; background: var(--border); border-radius: 99px; margin: 0 auto 12px; }

.day-sheet-date {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.day-sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-faint);
}

.day-sheet-row:last-of-type { border-bottom: none; }

.day-sheet-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.day-sheet-name { font-size: 0.85rem; color: var(--text); flex: 1; font-weight: 500; }
.day-sheet-arrow { font-size: 0.75rem; color: var(--text-faint); cursor: pointer; }

.day-sheet-hint {
  font-size: 0.65rem;
  color: var(--text-faint);
  text-align: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-faint);
}

/* ── Diary section in day sheet ──────────────── */
.day-sheet-diary-divider { margin: 12px 0 0; height: 1px; background: var(--border-faint); }

.day-sheet-diary-section { padding: 12px 20px 4px; }

.day-sheet-diary-label {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.day-sheet-diary-body { display: flex; flex-direction: column; gap: 8px; }

.day-sheet-diary-note { font-family: 'Caveat', cursive; font-size: 1rem; color: var(--text); line-height: 1.5; }

.day-sheet-diary-thumb {
  max-width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.day-sheet-diary-btn {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--yellow);
  background: transparent;
  border: 1px solid rgba(248, 192, 138, 0.35);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
}

/* ── Diary Crop UI ───────────────────────────── */
.diary-crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: rgba(0,0,0,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.diary-crop-frame {
  width: min(90vw, 400px);
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: 4px;
  cursor: grab;
  touch-action: none;
}

.diary-crop-frame:active { cursor: grabbing; }

.diary-crop-img {
  position: absolute;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  z-index: 1;
}

.diary-crop-bg-img {
  position: absolute;
  inset: -20px;
  width: calc(100% + 40px);
  height: calc(100% + 40px);
  object-fit: cover;
  transform: scale(1.2);
  -webkit-filter: blur(12px);
  filter: blur(12px);
  opacity: 0.7;
  display: none;
}

.diary-crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.2) 1px, transparent 1px);
  background-size: 33.33% 33.33%;
}

.diary-crop-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.diary-crop-cancel {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.diary-crop-confirm {
  background: var(--color-primary);
  border: none;
  color: white;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
}

.diary-crop-fit-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  color: white;
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.diary-crop-fit-btn.active {
  background: var(--color-primary);
  border-color: transparent;
}

/* ── Diary Page Overlay ──────────────────────── */
@keyframes diaryPageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.diary-page-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: #F5EDE0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 26px,
    rgba(139,100,60,0.15) 26px,
    rgba(139,100,60,0.15) 27px
  );
  background-position: 0 80px;
  animation: diaryPageFadeIn 0.35s ease forwards;
}

.diary-page-backdrop {
  position: fixed;
  inset: 0;
  z-index: 599;
  background: rgba(8,10,24,0.75);
  backdrop-filter: blur(8px);
  animation: diaryPageFadeIn 0.35s ease forwards;
}

@media (min-width: 769px) {
  .diary-page-overlay {
    inset: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(900px, 94vw);
    height: min(580px, 90vh);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
    overflow: hidden;
  }
  .diary-page-save-btn {
    display: none;
  }
}

.diary-page-nav {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(245, 237, 224, 0.95);
  border-bottom: 1px solid rgba(139,100,60,0.2);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.diary-page-nav-back { background: none; border: none; font-size: 0.85rem; font-weight: 600; color: var(--color-primary); cursor: pointer; }
.diary-page-nav-title { font-family: 'Fraunces', serif; font-style: italic; font-size: 0.95rem; font-weight: 700; color: #2A2218; }
.diary-page-nav-save { background: none; border: none; font-size: 0.78rem; font-weight: 700; color: var(--color-primary); cursor: pointer; }
.diary-page-nav-save:disabled { opacity: 0.3; pointer-events: none; }

.diary-page-content {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  padding: 20px 24px;
  gap: 24px;
  min-height: 0;
  position: relative;
  z-index: 2;
}

.diary-page-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.diary-page-right {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diary-page-left-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diary-page-right-spacer {
  flex-shrink: 0;
}

.diary-page-date-big {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 300;
  font-style: italic;
  color: #2A2218;
  line-height: 1;
}

.diary-page-date-big strong { font-weight: 700; font-style: normal; color: var(--color-primary); }
.diary-page-date-sub { font-size: 0.72rem; color: #7A6F55; }

.diary-habit-chips { display: flex; gap: 5px; flex-wrap: wrap; }

.diary-habit-chip {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  color: white;
  font-family: 'Sora', sans-serif;
}

.diary-habit-chip--undone { background: transparent; color: #7A6F55; border: 1px solid #D5C9A8; }

.diary-page-rule {
  border: none;
  border-top: 1px solid #D5C9A8;
  margin: 0;
}

.diary-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7A6F55;
  display: block;
}

.diary-note-textarea {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  width: 100%;
  min-height: 0;
  flex: 1;
  border: 1.5px solid #D5C9A8;
  border-radius: 10px;
  background: transparent;
  padding: 10px 12px;
  resize: none;
  outline: none;
  line-height: 1.6;
  color: #2A2218;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.diary-note-char { font-size: 0.6rem; color: #7A6F55; text-align: right; }

.diary-page-polaroid-wrap {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
}

.diary-page-polaroid {
  background: white;
  padding: 8px 8px 32px 8px;
  transform: rotate(-1.8deg);
  box-shadow: 2px 4px 14px rgba(0,0,0,0.18), 0 1px 3px rgba(0,0,0,0.1);
  width: 100%;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.diary-page-polaroid:hover {
  transform: rotate(-0.5deg) translateY(-2px);
  box-shadow: 3px 6px 18px rgba(0,0,0,0.22);
}

.diary-page-polaroid.has-photo {
  cursor: default;
}

.diary-page-polaroid.has-photo:hover {
  transform: rotate(-1.8deg);
  box-shadow: 2px 4px 14px rgba(0,0,0,0.18), 0 1px 3px rgba(0,0,0,0.1);
}

.diary-page-polaroid::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 18%;
  right: 18%;
  height: 9px;
  background: rgba(248,192,138,0.55);
  border-radius: 2px;
  z-index: 2;
}

.diary-page-polaroid-inner {
  width: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  background: #EAE4D0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.diary-page-polaroid-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.diary-page-polaroid-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.diary-page-save-btn {
  width: 100%;
  padding: 12px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: 'Sora', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: auto;
  flex-shrink: 0;
}

.diary-page-save-btn:disabled { opacity: 0.4; }

@media (max-width: 768px) {
  .diary-page-overlay {
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .diary-page-content {
    flex-direction: column;
    overflow: hidden;
    padding: 12px 16px;
    gap: 8px;
    flex: 1;
  }

  .diary-page-left {
    flex: 0 0 auto;
  }

  .diary-page-left-hero {
    gap: 6px;
  }

  .diary-page-right-spacer {
    display: none;
  }

  .diary-note-textarea {
    min-height: 140px;
    max-height: 160px;
    flex: none;
  }

  .diary-page-right {
    width: 100%;
    align-items: center;
  }

  .diary-page-polaroid-wrap {
    width: min(260px, 75vw);
    margin: 0 auto;
  }

  .diary-page-save-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
}

/* ── Dark mode: keep notebook paper aesthetic ──── */
[data-theme="side-b"] .diary-page-overlay {
  color: #2A2218;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  #tab-following {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #tab-mylog .cal-card { max-width: 100%; }
  .following-empty { padding: 36px 16px; max-width: 100%; }
  .following-nudge-slot { align-self: auto; }
  .following-nudge-card { min-height: 160px; padding: 24px 16px; }
}

@media (min-width: 769px) and (max-width: 1100px) {
  #tab-following {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Gear button on mobile badge ─────────────── */
.cal-badge-gear {
  background: none;
  border: none;
  font-size: 0.875rem;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  color: inherit;
  margin-left: auto;
}
.cal-badge-gear:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

/* ── All Tab container ──────────────────────── */
.all-tab-container {
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.all-card-grid {
  column-count: 3;
  column-gap: 24px;
}

.all-result-card-slot {
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: 24px;
}

.all-stat-line {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 12px;
  padding: 0 2px;
}

/* ── Per-card month nav ────────────────────── */
.cal-pmn {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.cal-pmn-btn {
  background: rgba(0, 0, 0, 0.15);
  border: none;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  font-size: 0.8rem;
  color: inherit;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  font-family: var(--font-base);
}

.cal-pmn-btn:hover { opacity: 1; }

.cal-pmn-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-base);
  color: inherit;
  opacity: 0.75;
  min-width: 26px;
  text-align: center;
}

/* ── Locked card (Followers tier) ─────────── */
.all-locked-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}

.all-locked-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.all-locked-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.85rem;
}

.all-locked-badge .cal-follow-btn {
  margin-left: auto;
}

.all-locked-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  opacity: 0.7;
}

.all-locked-body {
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
}

.all-locked-symbol {
  font-size: 1.6rem;
  opacity: 0.4;
}

.all-locked-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Low key card ────────────────────────── */
.all-lowkey-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}

.all-lowkey-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.all-lowkey-body {
  padding: 32px 20px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  text-align: center;
  border-top: 1px solid var(--border);
}

.all-lowkey-headline {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.4;
}

.all-lowkey-whisper {
  font-size: 0.52rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  opacity: 0.7;
}

/* ── Ghost card ──────────────────────────── */
.all-ghost-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  opacity: 0.58;
  border: 1.5px solid transparent;
  box-shadow: 0 0 18px rgba(245, 200, 66, 0.15), 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.all-ghost-card:hover {
  opacity: 0.75;
  box-shadow: 0 0 20px rgba(245, 200, 66, 0.28), 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.all-ghost-body {
  padding: 28px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  text-align: center;
}

.all-ghost-icon {
  font-size: 1.4rem;
  opacity: 0.5;
}

.all-ghost-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 1024px) {
  .all-card-grid { column-count: 2; }
}

@media (max-width: 768px) {
  .all-card-grid { column-count: 1; }
}
