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

body {
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #FBF5EC;
  color: #3A3531;
  min-height: 100dvh;
  text-transform: lowercase;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

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

.login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 2rem;
  gap: 1.5rem;
  background: #fff;
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 300px;
}

#login-form input {
  padding: 0.75rem 1rem;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  text-transform: lowercase;
  width: 100%;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
}

#login-form input:focus { border-color: #888; }

#login-btn {
  padding: 0.75rem;
  background: #3A3531;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.25rem;
  -webkit-tap-highlight-color: transparent;
}

#login-btn:active   { opacity: 0.8; }
#login-btn:disabled { opacity: 0.45; cursor: default; }

.error {
  color: #d63;
  font-size: 0.82rem;
  text-align: center;
}

/* ── App shell ──────────────────────────────────────────────── */

.screen { min-height: 100dvh; }

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-dots {
  font-size: 2rem;
  letter-spacing: 0.15em;
  color: #bbb;
}

#app-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.app-header {
  display: flex;
  align-items: center;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid #ede7de;
  gap: 0.25rem;
  min-height: 52px;
  flex-shrink: 0;
  background: #fff;
}

.cal-nav {
  flex: 1;
  display: flex;
  align-items: center;
}

.month-label {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
}

.screen-title {
  flex: 1;
  font-weight: 600;
  font-size: 1.025rem;
  padding-left: 0.5rem;
}

.app-logo {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #3A3531;
  flex-shrink: 0;
  padding: 0 0.25rem 0 0.5rem;
  text-transform: uppercase;
}

.nav-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  color: #3A3531;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:active { background: #f0f0f0; }

.header-name {
  font-size: 0.75rem;
  color: #bbb;
  flex-shrink: 0;
}

.signout-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  font-family: inherit;
  color: #bbb;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.signout-btn:active { color: #666; }

/* ── Views ──────────────────────────────────────────────────── */

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

/* ── Calendar grid ──────────────────────────────────────────── */

#view-calendar {
  background: #FBF5EC;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #ede7de;
  gap: 1px;
  border-top: 1px solid #ede7de;
}

.day-header {
  background: #FBF5EC;
  text-align: center;
  font-size: 0.75rem;
  color: #6E6860;
  padding: 0.5rem 0 0.3rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.day-cell {
  background: #fff;
  min-height: 58px;
  padding: 0.4rem 0.25rem 0.35rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.day-cell:active { background: #f9f5ef; }

.day-cell.empty {
  background: rgba(251, 245, 236, 0.55);
  cursor: default;
}

.day-cell.empty:active { background: rgba(251, 245, 236, 0.55); }

.day-num {
  font-size: 0.85rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.day-cell.today .day-num {
  background: #0C6978;
  color: #fff;
  font-weight: 600;
}

.event-dots {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #0C6978;
  flex-shrink: 0;
}

.event-dot:nth-child(2) { background: #8FC1E3; }

.event-badge {
  font-size: 0.75rem;
  color: #6E6860;
  font-weight: 600;
  line-height: 1;
}

.calendar-loading {
  grid-column: span 7;
  text-align: center;
  color: #ccc;
  font-size: 0.88rem;
  padding: 3rem 0;
  background: #FBF5EC;
}

/* ── Compose ────────────────────────────────────────────────── */

.compose-wrap {
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-input {
  width: 100%;
  min-height: 180px;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  text-transform: lowercase;
  resize: none;
  line-height: 1.55;
  outline: none;
  color: #3A3531;
  background: #fff;
  transition: border-color 0.15s;
}

.message-input:focus { border-color: #aaa; }
.message-input::placeholder { color: #ccc; }

.submit-btn {
  padding: 0.75rem;
  background: #3A3531;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.submit-btn:active   { opacity: 0.8; }
.submit-btn:disabled { opacity: 0.45; cursor: default; }

.compose-status {
  font-size: 0.82rem;
  text-align: center;
  color: #aaa;
  min-height: 1.2em;
}

/* ── Archive ────────────────────────────────────────────────── */

.archive-list {
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.archive-card {
  border-radius: 12px;
  background: #fff;
  border: 1px solid #ede7de;
  padding: 0.9rem 1rem;
}

.archive-card-date {
  font-size: 0.75rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0;
  margin-bottom: 0.4rem;
}

.archive-card-body {
  font-size: 0.9rem;
  line-height: 1.55;
  color: #3A3531;
}

.archive-state {
  text-align: center;
  color: #ccc;
  font-size: 0.88rem;
  padding: 3rem 1rem;
}

/* ── Bottom nav ─────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  background: #fff;
  border-top: 1px solid #ede7de;
  z-index: 50;
}

.nav-tab {
  flex: 1;
  background: none;
  border: none;
  font-size: 0.8rem;
  font-family: inherit;
  color: #ccc;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.1s;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-tab.active { color: #3A3531; font-weight: 600; border-top: 2px solid #0C6978; }
.nav-tab:active { opacity: 0.6; }

/* ── Day overlay (bottom sheet) ─────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
}

.overlay-panel {
  position: relative;
  background: #FBF5EC;
  width: 100%;
  border-radius: 18px 18px 0 0;
  padding: 1.25rem 1.1rem 2.5rem;
  max-height: 72dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay-header {
  display: flex;
  align-items: center;
  margin-bottom: 1.1rem;
}

.overlay-date {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.overlay-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.event-item {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #ede7de;
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.event-item-label {
  font-size: 0.75rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0;
}

.event-item-title { font-weight: 500; }

.event-item-note {
  color: #666;
  font-size: 0.83rem;
}

.event-item-locked {
  color: #aaa;
  font-style: italic;
}

.event-action-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: #888;
  cursor: pointer;
  padding: 0.5rem 0.25rem 0.25rem;
  font-family: inherit;
  text-decoration: underline;
  align-self: flex-start;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  display: inline-flex;
  align-items: flex-end;
}

.event-delete-btn {
  color: #ccc;
  margin-left: 0.75rem;
}

.event-delete-btn:active { color: #d63; }

.event-photo-section {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px solid #eee;
  padding-top: 0.5rem;
}

.event-photo-mini-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.event-photo-mini-grid a {
  display: block;
  width: 52px;
  height: 52px;
}

.event-photo-mini-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
  display: block;
}

.overlay-add-btn {
  background: none;
  border: 1px dashed #ddd;
  border-radius: 10px;
  padding: 0.65rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: #888;
  cursor: pointer;
  width: 100%;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.overlay-add-btn:active { background: #fafafa; }

.overlay-file-input {
  font-size: 0.8rem;
  color: #666;
}

.form-type-row {
  display: flex;
  gap: 0.5rem;
}

.type-btn {
  flex: 1;
  padding: 0.55rem;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  background: none;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  color: #6E6860;
  -webkit-tap-highlight-color: transparent;
}

.type-btn.active {
  border-color: #3A3531;
  color: #3A3531;
  font-weight: 600;
}

.form-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #666;
}

.form-toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.overlay-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  text-transform: lowercase;
  outline: none;
  color: #3A3531;
  background: #fff;
}

.overlay-input[type="date"] { text-transform: none; }
.overlay-input:focus { border-color: #aaa; }
.overlay-input::placeholder { color: #ccc; }

.overlay-textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  text-transform: lowercase;
  outline: none;
  resize: none;
  color: #3A3531;
  background: #fff;
  line-height: 1.4;
}

.overlay-textarea:focus { border-color: #aaa; }
.overlay-textarea::placeholder { color: #ccc; }

.form-btn-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}

.form-btn-row .widget-btn {
  align-self: center;
}

.overlay-cancel-btn {
  background: none;
  border: none;
  font-size: 0.85rem;
  font-family: inherit;
  color: #aaa;
  cursor: pointer;
  padding: 0.7rem 0.5rem;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.overlay-delete-btn { color: #c07060; }
.overlay-delete-btn:active { color: #a04030; }

.event-empty {
  color: #ccc;
  font-size: 0.88rem;
  text-align: center;
  padding: 1.25rem 0;
}

/* ── Widgets (home) ─────────────────────────────────────────── */

.widgets {
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.widget {
  padding: 1rem 0;
  border-bottom: 1px solid #ede7de;
}

.widget:last-child { border-bottom: none; }

.widget-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

.widget-content {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #3A3531;
  margin-bottom: 0.5rem;
}

.widget-state {
  color: #ccc;
  font-size: 0.88rem;
}

/* Photos */
.photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.photos-grid a,
.photos-grid .photo-thumb {
  display: block;
  width: calc(33.33% - 2px);
  aspect-ratio: 1;
}

.photo-thumb {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.photo-thumb:active { opacity: 0.85; }

.photo-caption {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.35;
  padding: 0.35rem;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.photo-thumb.open .photo-caption { opacity: 1; }

.photos-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.photo-title-preview {
  font-size: 0.75rem;
  color: #aaa;
  min-height: 1em;
}

/* ── Month headers (photos + thoughts) ──────────────────────── */

.month-header {
  font-size: 0.75rem;
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  color: #bbb;
  padding: 0.9rem 1rem 0.35rem;
}

#photos-display .month-header {
  padding-left: 0;
}

/* ── Thought entries ────────────────────────────────────────── */

.thought-list-card {
  background: #fff;
  border-radius: 14px;
  margin: 0 1rem 0.75rem;
  overflow: hidden;
}

.thought-entry {
  position: relative;
  padding: 0.6rem 1rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.thought-entry + .thought-entry {
  border-top: 1px solid #ede7de;
}

.thought-entry:active { background: #f9f5ef; }

.thought-entry-right {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.thought-entry-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0C6978;
  flex-shrink: 0;
  display: block;
}

.thought-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-right: 1.2rem;
}

.thought-meta {
  font-size: 0.75rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0;
  display: flex;
  align-items: center;
}


.thought-body {
  font-size: 0.88rem;
  color: #3A3531;
  line-height: 1.5;
}

/* ── Photo delete button ────────────────────────────────────── */

.photo-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.photo-delete-btn:active { background: rgba(180, 30, 30, 0.8); }

/* Bucket list */
.bucket-list {
  list-style: none;
  margin-bottom: 0.25rem;
}

.bucket-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #ede7de;
  font-size: 0.9rem;
}

.bucket-item:last-child { border-bottom: none; }

.bucket-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #ddd6cc;
  border-radius: 4px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bucket-item input[type="checkbox"]:checked {
  background: #3A3531;
  border-color: #3A3531;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3 8l3.5 3.5L13 5' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.bucket-item.done .bucket-title {
  text-decoration: line-through;
  color: #ccc;
}

.bucket-date {
  font-size: 0.75rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0;
  margin-left: auto;
  flex-shrink: 0;
}

.bucket-delete-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-right: -0.5rem;
}

.bucket-delete-btn:active { color: #d63; }

/* Widget forms */
.widget-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.widget-form input[type="text"],
.widget-form input[type="url"],
.widget-form input[type="date"],
.widget-form textarea,
.widget-field {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  text-transform: lowercase;
  outline: none;
  line-height: 1.4;
  color: #3A3531;
  background: #fff;
}

.widget-form input:focus,
.widget-form textarea:focus { border-color: #aaa; }

.widget-form input::placeholder,
.widget-form textarea::placeholder { color: #ccc; }

.widget-form textarea { resize: none; }


.widget-field {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: #ccc;
}

.widget-field.has-value {
  color: #3A3531;
}

.input-label {
  display: block;
  font-size: 0.78rem;
  color: #aaa;
  margin-bottom: -0.25rem;
}

.widget-form input[type="file"] {
  font-size: 0.8rem;
  color: #666;
  padding: 0.2rem 0;
}

.widget-form select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  color: #3A3531;
  background: #fff;
  outline: none;
}

.widget-form select:focus { border-color: #aaa; }

.widget-btn {
  padding: 0.55rem 1rem;
  background: #3A3531;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-start;
  -webkit-tap-highlight-color: transparent;
  margin-top: 0.1rem;
}

.widget-btn:active   { opacity: 0.8; }
.widget-btn:disabled { opacity: 0.45; cursor: default; }

.widget-status {
  font-size: 0.78rem;
  min-height: 1.1em;
  color: #aaa;
}

.status-ok  { color: #5a9; }
.status-err { color: #d63; }

/* Reading cards (i loved it, please read.) */
.reading-cards {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.reading-card {
  border-radius: 10px;
  background: #fff;
  border: 1px solid #ede7de;
  padding: 0.75rem 0.9rem;
}

.reading-meta {
  font-size: 0.75rem;
  color: #aaa;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.reading-body {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #3A3531;
  white-space: pre-wrap;
}

.reading-link {
  display: inline-block;
  font-size: 0.8rem;
  color: #0C6978;
  text-decoration: none;
  margin-top: 0.3rem;
}

.reading-link:active { opacity: 0.6; }

.thought-seen {
  font-size: 0.75rem;
  color: #ccc;
}

/* ── Home redesign ──────────────────────────────────────────── */

.back-btn {
  background: none;
  border: none;
  color: #6E6860;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.back-btn:active { color: #3A3531; }

.home-card {
  padding: 1.1rem 1rem;
  background: #fff;
  border-radius: 14px;
  margin: 0 1rem 0.85rem;
}

#view-home > .home-card:first-child { margin-top: 0.85rem; }

.countdown-card {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  border-left: 4px solid #8FC1E3;
  padding-left: 1.25rem;
  position: relative;
  border-radius: 14px;
}

.countdown-text {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: block;
  padding-right: 46px;
}

.countdown-sun {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.88;
}

.today-label {
  font-size: 0.75rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0;
  margin-bottom: 0.5rem;
}

.today-item {
  font-size: 0.9rem;
  color: #3A3531;
  padding: 0.15rem 0;
}

.today-empty {
  font-size: 0.88rem;
  color: #ccc;
  font-style: italic;
}

.text-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  font-family: inherit;
  color: #888;
  cursor: pointer;
  padding: 0;
  margin-top: 0.6rem;
  display: block;
  -webkit-tap-highlight-color: transparent;
}

.text-btn:active { color: #3A3531; }

.view-cal-btn {
  display: block;
  width: 100%;
  padding: 0.72rem;
  background: #3A3531;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.85rem;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.view-cal-btn:active { opacity: 0.8; }

.together-label {
  font-size: 0.75rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0;
  margin-bottom: 0.3rem;
}

.together-card #together-inline {
  font-size: 0.9rem;
  color: #3A3531;
}

.home-menu {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  margin: 0 1rem 0.85rem;
  overflow: hidden;
}

.menu-item {
  background: #fff;
  border: none;
  border-bottom: 1px solid #ede7de;
  font-size: 1rem;
  font-family: inherit;
  color: #3A3531;
  text-align: left;
  padding: 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #f5efe6; }

.menu-item-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.menu-arrow {
  color: #aaa;
  font-size: 1rem;
  line-height: 1;
}

.new-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3A3531;
  flex-shrink: 0;
}

#dot-photos { background: #8FC1E3; }
#dot-bucket { background: #A8B89F; }
#dot-thoughts { background: #0C6978; }

.bucket-item .new-dot { background: #A8B89F; }

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #fff;
  border-radius: 14px;
  margin: 0 1rem 0.85rem;
}

.notif-label {
  font-size: 1rem;
  color: #3A3531;
}

/* iOS-style toggle */
.ios-toggle {
  position: relative;
  display: inline-flex;
  width: 51px;
  height: 31px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.ios-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ios-toggle-track {
  position: absolute;
  inset: 0;
  background: #E5E5EA;
  border-radius: 31px;
  transition: background 0.2s;
}

.ios-toggle-track::before {
  content: '';
  position: absolute;
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.22s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
}

.ios-toggle input:checked + .ios-toggle-track {
  background: #34C759;
}

.ios-toggle input:checked + .ios-toggle-track::before {
  transform: translateX(20px);
}

.ios-toggle input:disabled + .ios-toggle-track {
  opacity: 0.45;
}

/* ── Full-screen sub-views ──────────────────────────────────── */

.view-content {
  padding: 1rem 1rem 0;
}

.view-form {
  padding: 0.75rem 1rem 1.5rem;
}

/* ── AMA ─────────────────────────────────────────────────────── */

.ama-form-section {
  padding: 0.75rem 1rem 0.9rem;
  border-bottom: 1px solid #ede7de;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ama-preset-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.1rem;
}

.ama-refresh-btn {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 44px;
  flex-shrink: 0;
  padding: 0 4px;
}

.ama-refresh-label {
  font-size: 0.78rem;
  font-family: inherit;
  color: inherit;
}

.ama-refresh-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.ama-refresh-btn:active { color: #6E6860; }

.ama-preset-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ama-preset-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  background: #fff;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: #3A3531;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

.ama-preset-card:active {
  background: #f5efe6;
  border-color: #c8bfb4;
}

.ama-preset-card.selected {
  background: #fff;
  border-color: #ddd6cc;
}

.ama-preset-tick {
  display: none;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}

.ama-preset-card.selected .ama-preset-tick {
  display: block;
}

.ama-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ama-custom-input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  text-transform: lowercase;
  outline: none;
  color: #3A3531;
  background: #fff;
}

.ama-custom-input:focus { border-color: #aaa; }
.ama-custom-input::placeholder { color: #ccc; }

.ama-list {
  display: flex;
  flex-direction: column;
}

.ama-list-card {
  background: #fff;
  border-radius: 14px;
  margin: 0.75rem 1rem;
  overflow: hidden;
}

.ama-question-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ama-question-card + .ama-question-card {
  border-top: 1px solid #ede7de;
}

.ama-meta {
  font-size: 0.75rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0;
}

.ama-question-text {
  font-size: 0.95rem;
  color: #3A3531;
  line-height: 1.45;
  font-weight: 600;
}

.ama-waiting {
  font-size: 0.88rem;
  color: #ccc;
}

.ama-answer-text {
  font-size: 0.88rem;
  color: #3A3531;
  line-height: 1.5;
}

.ama-answer-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.ama-answer-textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  text-transform: lowercase;
  outline: none;
  resize: none;
  color: #3A3531;
  background: #fff;
  line-height: 1.4;
}

.ama-answer-textarea:focus { border-color: #aaa; }
.ama-answer-textarea::placeholder { color: #ccc; }

.ama-empty {
  text-align: center;
  color: #ccc;
  font-size: 0.88rem;
  padding: 2.5rem 1rem;
}

/* AMA home cards */

.ama-home-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: #fff;
}

.ama-home-card:active { background: #f5efe6; }

.ama-home-question {
  font-size: 0.95rem;
  color: #3A3531;
  line-height: 1.45;
}

.ama-home-answer {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #ede7de;
}

/* ── Board ──────────────────────────────────────────────────────── */

.board-view {
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 0;
  position: relative;
}

.board-canvas {
  position: relative;
  width: 100%;
  height: 7200px;
  background-color: #f8f7f4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='1' cy='1' r='1.5' fill='%23ccc9c0'/%3E%3C%2Fsvg%3E");
  background-size: 26px 26px;
  background-repeat: repeat;
}

/* ── Board items (shared) ───────────────────────────────────────── */

.board-item {
  position: absolute;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.board-item:active { cursor: grabbing; }

.board-item-del {
  display: none;
  position: absolute;
  top: -20px;
  right: -20px;
  width: 44px;
  height: 44px;
  background: transparent;
  color: #fff;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.board-item-del::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #333;
  pointer-events: none;
  z-index: 0;
}

.board-item-del svg {
  position: relative;
  z-index: 1;
}

.board-item.selected .board-item-del { display: flex; }

/* ── Sticky note ────────────────────────────────────────────────── */

.board-item--sticky_note {
  /* width/height set by JS; no overflow or visual chrome here */
}

.board-sticky-clip {
  width: 100%;
  height: 100%;
  background: #fffde7;
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);
  padding: 12px 14px 14px;
  overflow: hidden;
  box-sizing: border-box;
}

.board-item--sticky_note.selected .board-sticky-clip {
  box-shadow: 0 6px 18px rgba(0,0,0,0.16), 0 2px 6px rgba(0,0,0,0.1);
  outline: 2px solid rgba(0,0,0,0.12);
  outline-offset: 1px;
}

.board-sticky-body {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
}

/* ── Sticker ────────────────────────────────────────────────────── */

.board-item--sticker {
  border-radius: 4px;
  /* width/height set by JS */
}

.board-sticker-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* resize handle */
.board-resize-handle {
  display: none;
  position: absolute;
  bottom: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #555;
  cursor: se-resize;
  z-index: 5;
  touch-action: none;
}

.board-item.selected .board-resize-handle { display: block; }

/* rotate handle */
.board-rotate-handle {
  display: none;
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #555;
  cursor: grab;
  z-index: 6;
  touch-action: none;
}

.board-rotate-handle::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  height: 16px;
  background: #aaa;
}

.board-item.selected .board-rotate-handle { display: block; }


/* ── Board photo ────────────────────────────────────────────────── */

.board-item--photo {
  /* width/height set by JS */
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.14), 0 1px 3px rgba(0,0,0,0.08);
}

.board-item--photo.selected {
  box-shadow: 0 6px 18px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
  outline: 2px solid rgba(0,0,0,0.15);
  outline-offset: 1px;
}

.board-photo-clip {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
}

.board-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* ── Board toolbar ──────────────────────────────────────────────── */

.board-toolbar {
  position: fixed;
  bottom: calc(60px + 10px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 5px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  padding: 5px 6px;
  gap: 1px;
  z-index: 99;
  white-space: nowrap;
}

.board-tool {
  background: none;
  border: none;
  padding: 7px 13px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #555;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

.board-tool:active { background: #f0f0f0; }

.board-tool-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.board-tool-label {
  font-size: 0.75rem;
  font-family: inherit;
  letter-spacing: 0.03em;
  color: #888;
}

.board-tool-sep {
  width: 1px;
  height: 26px;
  background: #e8e8e8;
  margin: 0 3px;
  flex-shrink: 0;
}

/* ── Board modals ───────────────────────────────────────────────── */

.board-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.board-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
}

.board-modal-panel {
  position: relative;
  background: #FBF5EC;
  border-radius: 16px;
  padding: 1.25rem 1.1rem 1.1rem;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.board-modal-label {
  font-size: 0.8rem;
  color: #888;
  font-weight: 500;
}

.board-sticky-textarea {
  width: 100%;
  border: 1px solid #ddd6cc;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  outline: none;
  color: #3A3531;
  line-height: 1.5;
  background: #fffde7;
}

.board-sticky-textarea:focus { border-color: #aaa; }
.board-sticky-textarea::placeholder { color: #ccc; }

.board-modal-btns {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.board-modal-footer-cancel {
  align-self: center;
  padding: 0.4rem;
}

.board-modal-error {
  font-size: 0.78rem;
  color: #d63;
  margin: 2px 0 0;
  text-align: center;
}

/* ── Sticker picker grid ────────────────────────────────────────── */

.board-sticker-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.board-sticker-pick-btn {
  background: #f5f5f5;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.1s, background 0.1s;
}

.board-sticker-pick-btn:active {
  background: #ebebeb;
  border-color: #ccc;
}

.board-sticker-pick-btn img {
  width: 52px;
  height: 52px;
  display: block;
  object-fit: contain;
  -webkit-user-drag: none;
}

/* ── Photo fullscreen viewer ────────────────────────────────── */

.photo-fs {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-x pan-y pinch-zoom;
  cursor: zoom-out;
}

.photo-fs-img {
  max-width: 100%;
  max-height: 100dvh;
  object-fit: contain;
  display: block;
  touch-action: pan-x pan-y pinch-zoom;
  pointer-events: none;
}

.photo-fs-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top, 16px));
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 601;
  -webkit-tap-highlight-color: transparent;
}

.photo-fs-close:active { background: rgba(255, 255, 255, 0.28); }
