/*
  G-Log - modernist stylesheet.

  Rebuilt on the design-system tokens (docs/design/design-tokens.css, Claude
  Design project 340e7274) per docs/design/design-spec.md. Hard edges, one
  display face (Archivo) plus mono for every label/timestamp/button-as-label,
  a 2px/1px rule system instead of borders-with-radius, and a single light
  theme - Greg's build diary, not a themeable SaaS shell.
*/

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;600;800&display=swap');

:root {
  /* Colour (docs/design/design-tokens.css) */
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-accent-2: #e15b47;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);
  --color-divider-row: color-mix(in srgb, #201e1d 22%, transparent);

  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;

  --color-accent-100: #fff2ef;
  --color-accent-200: #ffe0d9;
  --color-accent-300: #ffc4b8;
  --color-accent-400: #ff9783;
  --color-accent-500: #ff563c;
  --color-accent-600: #dd2b0f;
  --color-accent-700: #ae1800;
  --color-accent-800: #7c1405;
  --color-accent-900: #4d170e;

  /* Muted ink, per spec: rgba(32,30,29, .35 - .7) */
  --color-ink-70: rgba(32, 30, 29, 0.7);
  --color-ink-55: rgba(32, 30, 29, 0.55);
  --color-ink-45: rgba(32, 30, 29, 0.45);
  --color-ink-40: rgba(32, 30, 29, 0.4);
  --color-ink-35: rgba(32, 30, 29, 0.35);
  --color-ink-25: rgba(32, 30, 29, 0.25);

  --font-heading: "Archivo", system-ui, sans-serif;
  --font-heading-weight: 800;
  --font-body: "Archivo", system-ui, sans-serif;
  --font-mono: ui-monospace, Menlo, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Hard edges everywhere - this system has no rounded corners. */
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;

  --touch-target-min: 44px;
  --content-max-width: 640px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --z-sticky: 10;
  --z-dock: 20;
  --z-overlay: 30;
  --z-sheet: 40;
}

/* Pulse used for every "AI is still working on this" affordance:
   CAPTIONING lines, the entry poster's pending-photo overlay, and the
   documents PROCESSING line. */
@keyframes glogpulse {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input,
textarea {
  background: none;
  border: none;
  outline: none;
}

a {
  color: var(--color-accent);
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* ---- Shared type ---- */
.mono {
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  background: var(--color-accent);
  animation: glogpulse 1.1s ease-in-out infinite;
}

/* ---- App shell ---- */
.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--color-ink-55);
  font-size: 13.5px;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-divider-row);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.banner--error {
  margin: 0 var(--space-4) var(--space-3);
  padding: var(--space-3);
  border-left: 2px solid var(--color-accent);
  background: var(--color-accent-100);
  color: var(--color-accent-700);
  font-size: 13px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--color-accent);
  color: var(--color-bg);
}

.btn:active:not(:disabled) {
  background: var(--color-accent-600);
}

.btn--block {
  width: 100%;
  justify-content: flex-start;
  padding-left: var(--space-4);
}

.btn--ghost {
  background: none;
  color: var(--color-ink-55);
  min-width: auto;
  padding: var(--space-2) var(--space-3);
}

/* ---- Auth ---- */
.auth {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-8) var(--space-4) calc(var(--space-8) + var(--safe-bottom));
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

.auth__wordmark {
  display: block;
  width: 220px;
  max-width: 62%;
  height: auto;
  margin-bottom: var(--space-4);
}

.auth__wordmark-dot {
  color: var(--color-accent);
}

.auth__subtitle {
  color: var(--color-ink-55);
  font-size: 14px;
  margin-bottom: var(--space-6);
}

.auth__form {
  display: flex;
  flex-direction: column;
}

.auth__field {
  margin-bottom: var(--space-6);
}

.auth__label {
  display: block;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-45);
  margin-bottom: var(--space-2);
}

.auth__input {
  display: block;
  width: 100%;
  min-height: var(--touch-target-min);
  border-bottom: 2px solid var(--color-divider);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 19px;
  padding: 0 0 var(--space-2);
}

.auth__input:focus {
  border-bottom-color: var(--color-accent);
}

.auth__code-input {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.auth__error {
  color: var(--color-accent-700);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-4);
}

.auth__hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-ink-45);
  margin-top: var(--space-2);
}

.auth__resend {
  min-height: var(--touch-target-min);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  align-self: flex-start;
}

.auth__resend:disabled {
  color: var(--color-ink-35);
}

.auth__back {
  min-height: var(--touch-target-min);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-55);
  align-self: flex-start;
  margin-top: var(--space-2);
}

/* ---- Ledger (feed) ---- */
.ledger {
  position: relative;
}

.ledger__header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: calc(var(--space-3) + var(--safe-top)) var(--space-4) var(--space-3);
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-divider);
}

.ledger__heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ledger__kicker {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--color-accent);
}

.ledger__title-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
}

.ledger__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger__title--switch::after {
  content: "\25BE"; /* small triangle marks the name as a project switcher */
  margin-left: var(--space-1);
  font-size: 11px;
  color: var(--color-ink-45);
}

.ledger__day {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-ink-45);
  white-space: nowrap;
  flex: none;
}

/* Header controls: search toggle + documents */
.ledger__controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
}

.ledger__icon-btn {
  position: relative;
  min-height: 52px;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}

.ledger__icon-btn--active {
  background: var(--color-text);
  color: var(--color-bg);
}

.ledger__icon-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* Project switcher dropdown (only when >1 project) */
.ledger__switcher {
  position: absolute;
  top: 100%;
  right: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-overlay);
  background: var(--color-surface);
  border: 2px solid var(--color-text);
}

.ledger__switcher-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-divider-row);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.ledger__switcher-item:active {
  background: var(--color-neutral-300);
}

/* Search panel (revealed by the header search toggle) */
.ledger__search-wrap {
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--color-divider);
}

.ledger__search {
  display: block;
  width: 100%;
  min-height: var(--touch-target-min);
  border-bottom: 2px solid var(--color-divider);
  font-size: 15px;
  padding: 0 0 var(--space-2);
}

.ledger__search::placeholder {
  color: var(--color-ink-40);
}

.ledger__search:focus {
  border-bottom-color: var(--color-accent);
}

.ledger__ask {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 48px;
  margin-top: var(--space-3);
  background: #ffe0d9;
  color: var(--color-accent);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.1em;
}

.ledger__ask:active {
  background: #ffd0c5;
}

/* Day-jump chips */
.day-chips {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
}

.day-chips::-webkit-scrollbar {
  display: none;
}

.day-chip {
  flex: none;
  min-height: 32px;
  min-width: 32px;
  padding: 0 var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-ink-40);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
}

.day-chip--active {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-bg);
}

/* Day sections */
.day-section {
  display: block;
}

.ledger__list {
  flex: 1;
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  padding-bottom: calc(76px + var(--safe-bottom) + var(--space-6));
}

.ledger__sentinel {
  height: 1px;
}

.day-section__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.day-section__numeral {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 40px;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.day-section__meta {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-ink-45);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-section__rows {
  border-top: 2px solid var(--color-divider);
}

/* Boot splash: logo + spinner shown until the app has loaded (removed by
   app.js once boot resolves). Lives outside #app so the first render doesn't
   wipe it prematurely. */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  background: var(--color-bg);
  transition: opacity 0.25s ease;
}
.splash--hiding {
  opacity: 0;
}
.splash__logo {
  width: 220px;
  max-width: 62%;
  height: auto;
}
.splash__spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--color-accent-200);
  border-top-color: var(--color-accent);
  animation: splash-spin 0.7s linear infinite;
}
@keyframes splash-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Entry row */
.entry-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: var(--space-3);
  width: 100%;
  padding: 14px var(--space-4);
  border-bottom: 1px solid var(--color-divider-row);
}

.entry-row__time-col {
  display: flex;
  flex-direction: column;
}

.entry-row__time {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 12px;
}

.entry-row__author {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-45);
  margin-top: var(--space-1);
}

.entry-row__main {
  min-width: 0;
}

.entry-row__title-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.entry-row__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 15.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-row__chevron {
  flex: none;
  color: var(--color-ink-35);
}

.entry-row__note {
  font-size: 12.5px;
  color: var(--color-ink-55);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-row__photos {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  margin-top: var(--space-2);
  scrollbar-width: none;
}

.entry-row__photos::-webkit-scrollbar {
  display: none;
}

.entry-row__thumb {
  flex: none;
  width: 60px;
  height: 60px;
  object-fit: cover;
  background: var(--color-neutral-300);
}

.entry-row__captioning {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-accent-700);
}

.entry-row__caption {
  margin-top: var(--space-2);
  padding-left: 8px;
  border-left: 2px solid var(--color-accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-ink-55);
}

/* Expanded feed view (Instagram-style cards): compact styling above is
   untouched, this only applies once the list carries data-view="expanded". */
.ledger__list[data-view="expanded"] .day-section__rows {
  border-top: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: 0 var(--space-4);
}

.entry-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 2px solid var(--color-text);
}

.entry-card__photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--color-neutral-300);
}

.entry-card__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entry-card__badge {
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  min-width: 24px;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.entry-card__body {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.entry-card__title-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.entry-card__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-card__chevron {
  flex: none;
  color: var(--color-ink-35);
}

.entry-card__note {
  font-size: 13px;
  color: var(--color-ink-55);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-card__meta {
  margin-top: var(--space-2);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-ink-45);
  text-transform: uppercase;
}

@media (min-width: 640px) {
  .ledger__list[data-view="expanded"] .day-section__rows {
    max-width: 560px;
    margin-inline: auto;
  }
}

/* ---- Compose dock ---- */
.compose-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-dock);
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.compose-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 60px;
  padding: 0 var(--space-4) var(--safe-bottom);
  padding-top: 0;
  background: var(--color-accent);
  color: var(--color-bg);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.compose-trigger__plus {
  font-size: 20px;
  line-height: 1;
}

/* Compose panel */
.compose-panel {
  background: var(--color-surface);
  border-top: 2px solid var(--color-text);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.compose-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider-row);
}

.compose-panel__logging {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-ink-45);
}

.compose-panel__close {
  min-height: var(--touch-target-min);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-ink-55);
}

.compose-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
}

.compose-panel__title-input {
  display: block;
  width: 100%;
  min-height: 40px;
  border-bottom: 2px solid var(--color-divider);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 17px;
  padding: 0 0 var(--space-2);
  background: transparent;
}

.compose-panel__title-input::placeholder {
  color: var(--color-ink-35);
  font-weight: 800;
}

.compose-panel__title-input:focus {
  border-bottom-color: var(--color-accent);
}

.compose-panel__note-input {
  display: block;
  width: 100%;
  min-height: calc(3 * 1.4em);
  font-size: 13.5px;
  padding: var(--space-2) 0;
  resize: none;
}

.compose-panel__note-input::placeholder {
  color: var(--color-ink-35);
}

.compose-panel__date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch-target-min);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider-row);
}

.compose-panel__date-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-ink-45);
}

.compose-panel__date-value {
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--color-text);
}

.compose-panel__date-suggestion {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border-left: 2px solid var(--color-accent);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--color-ink-55);
}

.compose-panel__date-suggestion-text {
  flex: 1;
}

.compose-panel__date-suggestion-accept,
.compose-panel__date-suggestion-dismiss {
  flex: none;
  min-height: var(--touch-target-min);
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.compose-panel__date-suggestion-accept {
  color: var(--color-accent);
}

.compose-panel__date-suggestion-dismiss {
  color: var(--color-ink-45);
}

.compose-panel__photos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.compose-panel__photo-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}

.compose-panel__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compose-panel__photo-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 14px;
  line-height: 1;
}

.compose-panel__hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--color-ink-45);
  margin-top: var(--space-2);
}

.compose-panel__hint--error {
  color: var(--color-accent-700);
}

.compose-panel__actions {
  display: flex;
  border-top: 2px solid var(--color-divider);
}

.compose-panel__action {
  flex: 1;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-right: 1px solid var(--color-divider-row);
  color: var(--color-text);
}

.compose-panel__action:last-child {
  border-right: none;
}

.compose-panel__action--photo {
  color: var(--color-text);
}

.compose-panel__action--dictate {
  color: var(--color-accent);
}

.compose-panel__action--dictate.is-recording {
  background: var(--color-accent);
  color: var(--color-bg);
}

.compose-panel__action--post {
  background: var(--color-accent);
  color: var(--color-bg);
}

/* ---- Entry poster (detail) ---- */
.entry-poster__topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--space-3) + var(--safe-top)) var(--space-4) var(--space-3);
  background: var(--color-bg);
}

.entry-poster__back {
  min-height: var(--touch-target-min);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.entry-poster__menu-btn {
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.entry-poster__actions-row {
  display: flex;
  border-top: 2px solid var(--color-text);
  border-bottom: 2px solid var(--color-text);
}

/* Respect the hidden attribute: display:flex above otherwise overrode it,
   leaving the EDIT/DELETE bar permanently visible instead of behind the menu. */
.entry-poster__actions-row[hidden] {
  display: none;
}

.entry-poster__action {
  flex: 1;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.entry-poster__action--edit {
  background: var(--color-surface);
}

.entry-poster__action--delete {
  background: var(--color-accent);
  color: var(--color-bg);
}

.entry-poster__rail-wrap {
  position: relative;
}

.entry-poster__rail {
  display: flex;
  width: 100%;
  /* Square by default (portrait phones), but never taller than the viewport
     below the topbar, so a landscape photo on a wide desktop window stays in
     view instead of running off the bottom. dvh tracks the mobile URL bar. */
  aspect-ratio: 1 / 1;
  /* svh is the stable "small" viewport height (Safari's toolbars in/out do not
     change it), so the photo never ends up taller than the visible window. 88px
     covers the top bar with a little breathing room. */
  max-height: calc(100svh - 88px - var(--safe-top));
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.entry-poster__rail::-webkit-scrollbar {
  display: none;
}

.entry-poster__slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.entry-poster__photo {
  width: 100%;
  height: 100%;
  /* Show the whole photo (no crop); the ink letterbox reads as intentional
     against the poster treatment. */
  object-fit: contain;
  background: var(--color-text);
}

.entry-poster__caption-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-2) var(--space-3);
  background: rgba(32, 30, 29, 0.86);
  color: var(--color-bg);
  font-size: 11.5px;
}

.entry-poster__pending-overlay {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-accent);
  color: var(--color-bg);
}

.entry-poster__pending-overlay .pulse-dot {
  background: var(--color-bg);
}

.entry-poster__pending-label {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.entry-poster__counter {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: 2px var(--space-2);
  background: var(--color-text);
  color: var(--color-bg);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
}

.entry-poster__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(32, 30, 29, 0.55);
  color: var(--color-bg);
  font-size: 20px;
}

.entry-poster__arrow--prev {
  left: 0;
}

.entry-poster__arrow--next {
  right: 0;
}

.entry-poster__dots {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
}

.entry-poster__dot {
  flex: 1;
  height: 6px;
  background: var(--color-ink-25);
}

.entry-poster__dot--active {
  background: var(--color-accent);
}

.entry-poster__banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-accent);
  color: var(--color-bg);
}

.entry-poster__banner-date {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
}

/* When the viewer can edit the date, the big banner date is the tap target;
   a dotted underline hints that it is editable. */
.entry-poster__banner-date--edit {
  text-decoration: underline dotted;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  cursor: pointer;
}

.entry-poster__banner-meta {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entry-poster__body {
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  padding: var(--space-4) var(--space-4) var(--space-8);
}

.entry-poster__meta {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ink-45);
  margin-bottom: var(--space-2);
}

.entry-poster__meta-date {
  color: var(--color-ink-45);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: pointer;
}

.entry-poster__date-audit {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-ink-35);
  margin-bottom: var(--space-3);
}

.entry-poster__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}

.entry-poster__note {
  font-size: 16.5px;
  line-height: 1.6;
  color: rgba(32, 30, 29, 0.8);
  white-space: pre-wrap;
  margin-bottom: var(--space-4);
}

.entry-poster__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.entry-poster__tag {
  padding: var(--space-1) var(--space-2);
  background: var(--color-accent-200);
  color: var(--color-accent-700);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
}

.entry-poster__foot {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-ink-45);
}

.entry-poster__attachment-block {
  margin: var(--space-4) 0;
}

.entry-poster__pdf {
  width: 100%;
  height: min(70svh, 800px);
  border: 2px solid var(--color-text);
  background: var(--color-surface);
  display: block;
  margin-bottom: var(--space-2);
}

.entry-poster__attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Solid ink button - was invisible when it shared the transparent .btn base. */
.entry-poster__attachment {
  min-height: 44px;
  padding: 0 var(--space-4);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--color-bg);
  background: var(--color-text);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.entry-poster__attachment:hover {
  background: var(--color-accent);
}

.entry-poster__attachment-source {
  min-height: 44px;
  padding: 0 var(--space-4);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--color-text);
  background: transparent;
  border: 2px solid var(--color-text);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.entry-poster__attachment-source:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.entry-poster__edit-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.entry-poster__edit-actions .btn {
  flex: 1;
}

/* ---- Ask sheet ---- */
.ask-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: var(--color-text);
  color: var(--color-bg);
  display: flex;
  flex-direction: column;
}

.ask-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--space-4) + var(--safe-top)) var(--space-4) var(--space-4);
}

.ask-sheet__label {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-accent-500);
}

.ask-sheet__close {
  min-height: var(--touch-target-min);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(243, 242, 242, 0.6);
}

.ask-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-4) var(--space-6);
}

.ask-sheet__input-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.ask-sheet__input {
  flex: 1;
  min-height: var(--touch-target-min);
  border-bottom: 2px solid rgba(243, 242, 242, 0.5);
  color: var(--color-bg);
  font-size: 15px;
  padding: 0 0 var(--space-2);
}

.ask-sheet__input::placeholder {
  color: rgba(243, 242, 242, 0.4);
}

.ask-sheet__submit {
  flex: none;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-bg);
  font-size: 20px;
}

.ask-sheet__skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
}

.ask-sheet__skeleton-bar {
  height: 14px;
  background: rgba(243, 242, 242, 0.18);
  animation: glogpulse 1.1s ease-in-out infinite;
}

.ask-sheet__answer {
  padding-top: var(--space-4);
  font-size: 17px;
  line-height: 1.55;
}

.ask-sheet__ref-label {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(243, 242, 242, 0.45);
}

.ask-sheet__refs {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ask-sheet__ref {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-3);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 12px;
  width: 100%;
}

.ask-sheet__ref-date {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--color-accent-700);
  flex: none;
}

.ask-sheet__error {
  padding-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-accent-400);
}

/* ---- Documents ---- */
.documents__topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: calc(var(--space-3) + var(--safe-top)) var(--space-4) var(--space-3);
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-divider);
}

.documents__back {
  min-height: var(--touch-target-min);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.documents__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 17px;
}

.documents__list {
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

.documents__row {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider-row);
}

.documents__row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.documents__date {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  color: var(--color-ink-45);
}

.documents__filename {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 15px;
  margin-top: 2px;
}

.documents__preview {
  width: 100%;
  aspect-ratio: 3 / 2;
  border: 2px solid var(--color-text);
  background: var(--color-surface);
  display: block;
  margin-top: var(--space-2);
}

.documents__summary {
  font-size: 12.5px;
  color: var(--color-ink-55);
  margin-top: var(--space-2);
}

/* Keep the AI summary short in the list; the toggle expands it. */
.documents__summary--clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.documents__summary-toggle {
  min-height: 32px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--color-accent-700);
  margin-top: var(--space-1);
}

.documents__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.documents__open {
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-4);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-bg);
  background: var(--color-text);
  text-decoration: none;
}

.documents__open:hover {
  background: var(--color-accent);
}

.documents__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-accent-700);
}

.documents__delete {
  min-height: var(--touch-target-min);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-ink-45);
}

.compose-panel__docs {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.compose-panel__doc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border-left: 2px solid var(--color-accent);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.compose-panel__doc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose-panel__doc-remove {
  flex: none;
  width: 28px;
  height: 28px;
  text-align: center;
  font-size: 16px;
  color: var(--color-text);
}

.documents__add-wrap {
  position: sticky;
  bottom: 0;
  padding-bottom: var(--safe-bottom);
}

.documents__add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
}

.documents__add-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .ledger__list,
  .entry-poster__body,
  .documents__list {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}
