:root {
  --bg:       #f7f7f6;
  --surface:  #ffffff;
  --surface2: #f2f2f0;
  --border:   #e8e8e5;
  --border2:  #efefed;
  --text:     #0d0d0d;
  --text2:    #5c5c5a;
  --text3:    #9b9b98;
  --text4:    #c8c8c4;
  --green:    #16a34a;
  --green-bg: #f0fdf4;
  --red:      #dc2626;
  --red-bg:   #fef2f2;
  --blue:     #2563eb;
  --blue-bg:  #eff6ff;
  --font:     'Geist', system-ui, sans-serif;
  --mono:     'Geist Mono', monospace;
  --ease:     cubic-bezier(0.4,0,0.2,1);
  --radius:   8px;
}

.dark {
  --bg:       #111110;
  --surface:  #1c1c1a;
  --surface2: #242422;
  --border:   #2e2e2b;
  --border2:  #272724;
  --text:     #f0efe9;
  --text2:    #8c8c87;
  --text3:    #555550;
  --text4:    #333330;
  --green-bg: rgba(22,163,74,.1);
  --red-bg:   rgba(220,38,38,.1);
  --blue-bg:  rgba(37,99,235,.1);
}

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

html {
  background: var(--bg);
  height: 100%;
  overscroll-behavior: none;
}

body {
  height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: var(--font); }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.hidden { display: none !important; }

/* ── AUTH ── */

#auth-screen {
  min-height: 100dvh;
  width: 100%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-wrap {
  width: 100%;
  max-width: 340px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 8px;
}

.auth-logo h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.02em;
}

.auth-logo p {
  font-size: .75rem;
  color: var(--text3);
  margin-top: 3px;
}

/* ── FORM FIELDS ── */

.field { margin-bottom: 10px; }

.field-label {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 5px;
  display: block;
}

.field-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text);
  font-size: .82rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .12s;
}

.field-input:focus { border-color: var(--text); }
.field-input::placeholder { color: var(--text4); }

/* ── BUTTONS ── */

.btn-cta {
  width: 100%;
  padding: 9px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .12s;
  margin-top: 4px;
}
.btn-cta:hover { opacity: .88; }
.btn-cta:disabled { opacity: .4; cursor: not-allowed; }

.btn-ghost {
  width: 100%;
  padding: 8px;
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  margin-top: 6px;
  transition: background .12s;
}
.btn-ghost:hover { background: var(--surface2); }

.btn-sm {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  transition: all .12s;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-family: var(--font);
}
.btn-sm:hover { background: var(--surface2); color: var(--text); }

/* ── AUTH MESSAGE ── */

#auth-message {
  margin-top: 10px;
  font-size: .75rem;
  min-height: 1rem;
  text-align: center;
}
#auth-message.error {
  padding: 6px 10px;
  background: var(--red-bg);
  color: var(--red);
  border-radius: 6px;
}
#auth-message.success {
  padding: 6px 10px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 6px;
}
#auth-message.info { color: var(--text3); }

/* ── CONFIRM DIALOG ── */

#confirm-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 300px;
}

#confirm-msg {
  font-size: .88rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 8px;
}

.confirm-actions .btn-ghost {
  margin-top: 0;
  flex: 1;
}

.btn-danger {
  flex: 1;
  padding: 8px;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .12s;
}
.btn-danger:hover { opacity: .8; }

/* ── TOAST ── */

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: var(--bg);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all .22s var(--ease);
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── APP LAYOUT ── */

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

#app {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── PAGE HEADER ── */

.page-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--surface);
}

.page-title {
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: -.02em;
}

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

.demo-badge {
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.6;
}

/* ── About panel ── */

.about-panel {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 24px 20px;
}

.about-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: .85rem;
  color: var(--text3);
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}
.about-close:hover { color: var(--text); }

.about-content { max-width: 560px; }

.about-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px;
}

.about-content p {
  font-size: .78rem;
  line-height: 1.7;
  color: var(--text2);
  margin: 0 0 8px;
}

.about-links {
  display: flex;
  gap: 12px;
  margin: 12px 0 10px;
}

.about-link {
  font-size: .75rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
.about-link:hover { border-color: var(--text); }

.about-note {
  font-size: .70rem !important;
  color: var(--text4) !important;
  margin: 0 !important;
}

/* ── FAB ── */

#fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(249,115,22,.4);
  border: none;
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
  z-index: 100;
}
#fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(249,115,22,.5); }
#fab:active { transform: scale(0.95); }

/* ── COMPOSE OVERLAY ── */

#compose-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#compose {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 680px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 85dvh;
  transform: translateY(100%);
  transition: transform .25s var(--ease);
}

#compose-bg:not(.hidden) #compose {
  transform: translateY(0);
}

.compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.compose-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text2);
}

#compose-close {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: .75rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s;
}
#compose-close:hover { background: var(--surface2); color: var(--text); }

#note-input {
  flex: 1;
  min-height: 140px;
  max-height: 50dvh;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  line-height: 1.7;
  resize: none;
  outline: none;
  overflow-y: auto;
  transition: border-color .12s;
}
#note-input:focus { border-color: var(--text); }
#note-input::placeholder { color: var(--text4); }

/* ── LOG ── */

.log-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: 100px;
}

/* ── SECTION ── */

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── NOTE ROWS ── */

.note-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border2);
  transition: background .1s;
}
.note-row:last-child { border-bottom: none; }
.note-row:hover { background: var(--surface2); }
.note-row.is-draft { opacity: 0.45; }

.note-body { flex: 1; min-width: 0; }

.note-content {
  font-size: .88rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

body.blur-mode .note-row[data-label-name~="journal"] .note-content {
  filter: blur(6px);
  transition: filter .2s;
  cursor: pointer;
  user-select: none;
}
body.blur-mode .note-row[data-label-name~="journal"]:hover .note-content {
  filter: none;
}

body.blur-mode .note-row[data-label-name="squiggle"] .note-content {
  filter: blur(6px);
  transition: filter .2s;
  cursor: pointer;
  user-select: none;
}
body.blur-mode .note-row[data-label-name="squiggle"]:hover .note-content {
  filter: none;
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  gap: 8px;
}

.note-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.note-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.note-time {
  font-size: .68rem;
  color: var(--text3);
  font-family: var(--mono);
}

.note-actionable {
  font-size: .72rem;
  color: var(--text4);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 2px 5px;
  border-radius: 4px;
  transition: all .1s;
}
.note-actionable:hover { color: var(--green); background: var(--green-bg); }
.note-actionable.is-actionable { color: var(--green); background: var(--green-bg); }

.actionable-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: .65rem;
  font-weight: 600;
  color: var(--green);
  border: 1px solid var(--green);
  white-space: nowrap;
  opacity: .75;
}

.in-build-chip {
  color: var(--blue);
  border-color: var(--blue);
}

.note-actionable:disabled { cursor: default; opacity: .6; }
.note-actionable.is-done-os { opacity: .35; }

.note-done {
  font-size: .72rem;
  color: var(--text4);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 2px 5px;
  border-radius: 4px;
  transition: all .1s;
}
.note-done:hover { color: var(--text2); background: var(--surface2); }
.note-done.is-done { color: var(--green); background: var(--green-bg); }
.note-done.is-done:hover { opacity: .7; }
.note-done:disabled { cursor: default; opacity: .6; }

.note-del, .note-edit {
  font-size: .72rem;
  color: var(--text4);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 2px 5px;
  border-radius: 4px;
  transition: all .1s;
}
.note-del:hover { color: var(--red); background: var(--red-bg); }
.note-edit:hover { color: var(--text2); background: var(--surface2); }

/* ── LABEL CHIP (on note rows) ── */

.draft-chip {
  --lc: transparent;
  background: var(--text3);
  border-color: var(--text3);
  color: var(--bg) !important;
  font-style: italic;
  opacity: 1;
}

.label-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--lc);
  border: 1px solid var(--lc);
  white-space: nowrap;
  opacity: .85;
}

/* ── EMPTY / LOADING ── */

.log-empty, .log-loading, .log-error {
  padding: 40px 20px;
  text-align: center;
}
.log-empty p, .log-loading p, .log-error p {
  font-size: .78rem;
  color: var(--text3);
  line-height: 1.7;
}
.log-empty-icon { font-size: 1.5rem; opacity: .2; margin-bottom: 8px; }
.log-error p { color: var(--red); }

/* ── FILTER BAR ── */

.filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.filter-bar:empty { display: none; }
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
}
.filter-chip:hover { background: var(--surface2); color: var(--text); }
.filter-chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.filter-chip.active .filter-dot { background: var(--bg); }

.filter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lc, var(--text3));
  flex-shrink: 0;
}

/* ── DONE FILTER TOGGLE ── */

.done-filter-bar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 6px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: border-color .15s;
}
.done-toggle:hover { border-color: var(--text3); }

.done-toggle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .2s;
}
.done-toggle[data-val="active"] .done-toggle-dot { background: #ef4444; }
.done-toggle[data-val="done"]   .done-toggle-dot { background: #22c55e; }
.done-toggle[data-val="both"]   .done-toggle-dot { background: #eab308; }

.done-toggle-label {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  transition: color .15s;
}

/* ── COMPOSE LABEL PICKER ── */

.compose-label-row {
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.compose-label-row::-webkit-scrollbar { display: none; }

.compose-label-picker {
  display: flex;
  gap: 6px;
}

.clabel-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
}
.clabel-chip:hover { border-color: var(--text3); color: var(--text2); }
.clabel-chip.active {
  border-color: var(--lc, var(--text));
  color: var(--lc, var(--text));
}
.clabel-none { font-size: .72rem; color: var(--text3); }

/* ── LABELS MODAL ── */

#labels-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#labels-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 80dvh;
  overflow-y: auto;
}

.labels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.labels-title {
  font-size: .88rem;
  font-weight: 600;
}

#labels-close {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: .75rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s;
}
#labels-close:hover { background: var(--surface2); color: var(--text); }

#labels-list { display: flex; flex-direction: column; }

.label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border2);
}
.label-row:last-child { border-bottom: none; }

.label-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.label-name {
  flex: 1;
  font-size: .82rem;
  color: var(--text);
}

.labels-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 6px;
  border-bottom: 1px solid var(--border);
}
.label-col-hdr {
  font-size: .65rem;
  font-weight: 600;
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: .04em;
  width: 36px;
  text-align: center;
}

.label-task-check {
  width: 36px;
  text-align: center;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--text);
}

.le-task-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  color: var(--text3);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.le-task-label input { cursor: pointer; accent-color: var(--text); }

.label-edit-btn {
  font-size: .68rem;
  color: var(--text4);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font);
  transition: all .1s;
}
.label-edit-btn:hover { color: var(--text2); background: var(--surface2); }

.label-del-btn {
  font-size: .72rem;
  color: var(--text4);
  background: none;
  border: none;
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all .1s;
}
.label-del-btn:hover { color: var(--red); background: var(--red-bg); }

/* ── LABEL INLINE EDIT ── */

.label-edit-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.label-edit-form .color-picker-row { gap: 6px; }
.label-edit-form .color-dot { width: 18px; height: 18px; }
.label-edit-form .label-input-row .btn-cta { width: auto; padding: 0 12px; margin-top: 0; }

.le-cancel {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .1s;
}
.le-cancel:hover { background: var(--surface2); color: var(--text); }

.labels-empty {
  font-size: .78rem;
  color: var(--text3);
  text-align: center;
  padding: 8px 0;
}

.label-add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.color-picker-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .12s;
  flex-shrink: 0;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.selected {
  border-color: var(--text);
  transform: scale(1.18);
}

.label-input-row {
  display: flex;
  gap: 8px;
}
.label-input-row .field-input { flex: 1; min-width: 0; }
.label-input-row .btn-cta { width: auto; padding: 0 14px; margin-top: 0; flex-shrink: 0; }

/* ── MOBILE FOOTER ── */

.mobile-footer { display: none; }

@media (max-width: 640px) {
  .desktop-only { display: none !important; }

  .mobile-footer {
    display: flex;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .footer-btn {
    flex: 1;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text2);
    transition: background .12s;
    font-family: var(--font);
  }
  .footer-btn:hover { background: var(--surface2); }
  .footer-btn:active { background: var(--surface2); }
}

/* ── MOBILE ── */

@media (max-width: 640px) {
  /* Prevent iOS from zooming on input focus */
  input, textarea, select { font-size: 16px !important; }

  #auth-screen { align-items: flex-start; padding-top: 15dvh; }

  #app-screen { height: 100dvh; }
  #app { max-width: 100%; }
  .page-header { padding: 12px 16px; }
  .log-body { padding: 12px; padding-bottom: 12px; }

  /* Hide floating FAB on mobile — replaced by footer button */
  #fab { display: none; }

  /* Full-screen compose on mobile */
  #compose-bg { align-items: stretch; }
  #compose {
    border-radius: 0;
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    padding: 20px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  #note-input { max-height: none; flex: 1; }
}

.footer-fab { display: none; }

@media (max-width: 640px) {
  .mobile-footer { overflow: visible; }

  .footer-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f97316;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 300;
    line-height: 1;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(249,115,22,.45);
    transform: translateY(-12px);
    transition: transform .15s, box-shadow .15s;
    align-self: center;
  }
  .footer-fab:active {
    transform: translateY(-12px) scale(0.94);
    box-shadow: 0 2px 8px rgba(249,115,22,.4);
  }
}
