/* ===================================================================== */
/*  Journal & Calendar — design tokens                                   */
/* ===================================================================== */
:root {
  --bg:        #f4f1ea;
  --bg-tint:   #efebe1;
  --surface:   #fffefb;
  --surface-2: #f8f5ee;
  --line:      #e2dccf;
  --line-soft: #ece7dc;
  --ink:       #24211c;
  --ink-2:     #5f594e;
  --ink-3:     #8f8778;
  --accent:    #5b53d6;
  --accent-2:  #7c6ff0;
  --accent-ink:#ffffff;
  --accent-wash:#ecebfd;
  --danger:    #c0453c;
  --shadow-sm: 0 1px 2px rgba(41,35,22,.06), 0 1px 3px rgba(41,35,22,.05);
  --shadow-md: 0 2px 6px rgba(41,35,22,.06), 0 8px 24px rgba(41,35,22,.08);
  --shadow-lg: 0 8px 20px rgba(41,35,22,.10), 0 24px 60px rgba(41,35,22,.14);
  --radius:    14px;
  --radius-sm: 10px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;

  --c-indigo:  #5b53d6;  --c-indigo-w:  #e9e8fc;
  --c-rose:    #c2426a;  --c-rose-w:    #fbe6ec;
  --c-amber:   #a9711a;  --c-amber-w:   #fbeed6;
  --c-emerald: #257a5a;  --c-emerald-w: #d9f2e7;
  --c-sky:     #1f6f95;  --c-sky-w:     #dceff8;
  --c-violet:  #7b3fbf;  --c-violet-w:  #f0e6fb;
  --c-slate:   #55606e;  --c-slate-w:   #e6eaef;
}
html[data-theme="dark"] {
  --bg:        #131218;
  --bg-tint:   #17161e;
  --surface:   #1c1b24;
  --surface-2: #232230;
  --line:      #2e2c3a;
  --line-soft: #262533;
  --ink:       #ece9f3;
  --ink-2:     #a6a1b6;
  --ink-3:     #736e84;
  --accent:    #8b83ff;
  --accent-2:  #a79fff;
  --accent-ink:#16141f;
  --accent-wash:#252140;
  --danger:    #f2726a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.55);

  --c-indigo:  #9b93ff;  --c-indigo-w:  #2a2650;
  --c-rose:    #ff8ba8;  --c-rose-w:    #462432;
  --c-amber:   #e9b25a;  --c-amber-w:   #453318;
  --c-emerald: #63d3a8;  --c-emerald-w: #17392e;
  --c-sky:     #6cc0e6;  --c-sky-w:     #14313f;
  --c-violet:  #c092f5;  --c-violet-w:  #33224a;
  --c-slate:   #9fb0c2;  --c-slate-w:   #262f3a;
}

/* ===================================================================== */
/*  base                                                                 */
/* ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1,h2,h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-wash); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ===================================================================== */
/*  buttons                                                              */
/* ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: 10px; font-size: 14px; font-weight: 550;
  transition: background .15s, color .15s, border-color .15s, transform .06s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 9px; color: var(--ink-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
#theme-btn .ico-sun { display: none; }
#theme-btn .ico-moon { display: block; }
html[data-theme="dark"] #theme-btn .ico-sun { display: block; }
html[data-theme="dark"] #theme-btn .ico-moon { display: none; }

/* ===================================================================== */
/*  lock screen                                                          */
/* ===================================================================== */
.lock {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 700px at 15% -10%, var(--accent-wash), transparent 60%),
    radial-gradient(900px 600px at 100% 110%, color-mix(in srgb, var(--c-rose) 14%, transparent), transparent 62%),
    var(--bg);
}
.lock-card {
  width: min(380px, 100%); padding: 40px 32px 32px; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-lg);
  animation: rise .5s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.lock-mark { width: 54px; height: 54px; margin: 0 auto 18px; color: var(--accent); }
.lock-mark svg { width: 100%; height: 100%; }
.lock-card h1 { font-family: var(--serif); font-size: 27px; font-weight: 500; letter-spacing: -.02em; }
.lock-sub { margin: 8px 0 24px; color: var(--ink-3); font-size: 14px; }
.lock-card input {
  width: 100%; padding: 13px 15px; margin-bottom: 12px; text-align: center;
  letter-spacing: .1em; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.lock-card input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.lock-error { margin: 14px 0 0; font-size: 13px; color: var(--danger); }
.lock.shake .lock-card { animation: shake .38s; }
@keyframes shake { 20%{transform:translateX(-7px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(3px)} }

/* ===================================================================== */
/*  shell                                                                */
/* ===================================================================== */
.app { display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 18px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  position: sticky; top: 0; z-index: 30; flex: none;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 24px; height: 24px; color: var(--accent); flex: none; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font-family: var(--serif); font-size: 18px; font-weight: 500; letter-spacing: -.01em; }

.tabs { display: flex; gap: 2px; padding: 3px; margin-left: 8px; background: var(--surface-2); border-radius: 11px; border: 1px solid var(--line-soft); }
.tab { padding: 6px 13px; border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); transition: background .18s, color .18s; }
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.search-wrap { position: relative; }
.search-icon { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
#search {
  width: 210px; padding: 8px 12px 8px 32px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); font-size: 14px;
  transition: width .2s, border-color .15s;
}
#search:focus { outline: none; border-color: var(--accent); width: 260px; }
#search::-webkit-search-cancel-button { -webkit-appearance: none; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 200px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
  box-shadow: var(--shadow-lg); z-index: 40;
  animation: pop .14s ease-out both;
}
@keyframes pop { from { opacity: 0; transform: translateY(-5px) scale(.97); } }
.menu-item {
  display: block; width: 100%; padding: 9px 11px; text-align: left; font-size: 14px;
  border-radius: 9px; color: var(--ink-2); text-decoration: none;
}
.menu-item:hover { background: var(--surface-2); color: var(--ink); }
.menu-item.danger { color: var(--danger); }

.main { flex: 1; min-height: 0; position: relative; }
.view { display: none; height: 100%; }
.view.is-active { display: block; }
.view-calendar.is-active { display: grid; grid-template-columns: minmax(0,1fr) 400px; }
.narrow { max-width: 760px; margin: 0 auto; padding: 26px 22px 90px; height: 100%; overflow-y: auto; }
.view-title { font-family: var(--serif); font-size: 26px; font-weight: 500; margin-bottom: 18px; }

/* ===================================================================== */
/*  calendar                                                             */
/* ===================================================================== */
.cal-pane { display: flex; flex-direction: column; min-width: 0; padding: 20px 22px 16px; overflow: hidden; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-title { display: flex; align-items: baseline; gap: 12px; }
.cal-title h2 { font-family: var(--serif); font-size: 26px; font-weight: 500; letter-spacing: -.02em; }
.cal-nav { display: flex; gap: 4px; }

.cal-dows { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; margin-bottom: 7px; }
.cal-dows span { text-align: center; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }

.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); grid-auto-rows: 1fr; gap: 6px; flex: 1; min-height: 0; }
.cell {
  display: flex; flex-direction: column; gap: 3px; padding: 6px 7px; min-height: 0; overflow: hidden;
  text-align: left; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); transition: border-color .15s, background .15s, transform .08s;
}
.cell:hover { border-color: var(--accent); }
.cell:active { transform: scale(.985); }
.cell.is-out { background: transparent; border-color: transparent; }
.cell.is-out .cell-num { color: var(--ink-3); opacity: .55; }
.cell.is-sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-wash); background: var(--surface); }
.cell-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; flex: none; }
.cell-num { font-size: 13px; font-weight: 550; color: var(--ink-2); line-height: 1.5; }
.cell.is-today .cell-num {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 650;
}
.cell-dots { display: flex; gap: 3px; align-items: center; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: none; }
.dot-entry { background: var(--accent); }
.dot-event { background: var(--c-amber); }
.cell-chips { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
.chip {
  display: block; padding: 2px 6px; border-radius: 5px; font-size: 11.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.45;
}
.chip.more { color: var(--ink-3); padding-left: 2px; font-size: 11px; }
.cell-note { font-size: 11.5px; color: var(--ink-3); font-family: var(--serif); font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cal-legend { display: flex; gap: 16px; padding-top: 12px; font-size: 12px; color: var(--ink-3); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* colour utility (chips, swatches, event rows) */
.c-indigo  { background: var(--c-indigo-w);  color: var(--c-indigo); }
.c-rose    { background: var(--c-rose-w);    color: var(--c-rose); }
.c-amber   { background: var(--c-amber-w);   color: var(--c-amber); }
.c-emerald { background: var(--c-emerald-w); color: var(--c-emerald); }
.c-sky     { background: var(--c-sky-w);     color: var(--c-sky); }
.c-violet  { background: var(--c-violet-w);  color: var(--c-violet); }
.c-slate   { background: var(--c-slate-w);   color: var(--c-slate); }

/* ===================================================================== */
/*  day pane                                                             */
/* ===================================================================== */
.day-pane { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg-tint); min-height: 0; }
.day-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 14px; flex: none; }
.day-dow { font-size: 11.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.day-date { font-family: var(--serif); font-size: 23px; font-weight: 500; margin-top: 3px; letter-spacing: -.02em; }
.day-close { display: none; }
.day-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 22px 28px; display: flex; flex-direction: column; gap: 18px; }

.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow-sm); }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.block-head h3 { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.block-journal { display: flex; flex-direction: column; flex: 1; min-height: 300px; }

.event-list { display: flex; flex-direction: column; gap: 6px; }
.event-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; width: 100%;
  border-radius: var(--radius-sm); text-align: left; transition: background .14s;
  border: 1px solid transparent;
}
.event-row:hover { background: var(--surface-2); border-color: var(--line-soft); }
.event-bar { width: 3px; align-self: stretch; border-radius: 99px; flex: none; min-height: 30px; }
.event-main { min-width: 0; flex: 1; text-align: left; }
.event-time { font-size: 11.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.event-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.event-notes { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-row.is-done .event-title { text-decoration: line-through; color: var(--ink-3); }
.ev-check {
  flex: none; width: 19px; height: 19px; margin-top: 1px; border-radius: 6px;
  border: 1.6px solid var(--line); display: grid; place-items: center; transition: all .14s;
}
.ev-check:hover { border-color: var(--accent); }
.ev-check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ev-check svg { width: 11px; height: 11px; opacity: 0; }
.ev-check.on svg { opacity: 1; }

.entry-title {
  width: 100%; padding: 4px 0 8px; border: 0; border-bottom: 1px solid var(--line-soft);
  background: none; font-family: var(--serif); font-size: 18px; font-weight: 500; letter-spacing: -.01em;
}
.entry-title:focus { outline: none; border-bottom-color: var(--accent); }
.entry-title::placeholder { color: var(--ink-3); font-style: italic; }
.entry-body {
  flex: 1; width: 100%; min-height: 180px; padding: 12px 0 8px; border: 0; background: none; resize: none;
  font-family: var(--serif); font-size: 15.5px; line-height: 1.75; color: var(--ink);
}
.entry-body:focus { outline: none; }
.entry-body::placeholder { color: var(--ink-3); font-style: italic; }

.entry-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.mood { display: flex; align-items: center; gap: 5px; }
.mood-label { font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-right: 3px; }
.mood-dot { width: 17px; height: 17px; border-radius: 50%; border: 1.6px solid var(--line); transition: all .15s; }
.mood-dot:hover { transform: scale(1.14); border-color: var(--accent); }
.mood-dot.on { border-color: transparent; }
.mood-dot[data-mood="1"].on { background: #d1544a; }
.mood-dot[data-mood="2"].on { background: #dd8b3f; }
.mood-dot[data-mood="3"].on { background: #d8b23c; }
.mood-dot[data-mood="4"].on { background: #6fae52; }
.mood-dot[data-mood="5"].on { background: #35997a; }
.wordcount { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.save-state { font-size: 11.5px; color: var(--ink-3); transition: opacity .3s; }
.save-state.saving { color: var(--accent); }

.tags-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; }
.tag-chips { display: contents; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px 3px 9px;
  background: var(--accent-wash); color: var(--accent); border-radius: 99px; font-size: 12px; font-weight: 550;
}
.tag button { color: inherit; opacity: .55; line-height: 1; font-size: 14px; padding: 0 1px; }
.tag button:hover { opacity: 1; }
.tag-input { flex: 1; min-width: 90px; padding: 4px 2px; border: 0; background: none; font-size: 12.5px; }
.tag-input:focus { outline: none; }

/* ===================================================================== */
/*  timeline / search                                                    */
/* ===================================================================== */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-card {
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); text-align: left; width: 100%;
  transition: border-color .15s, box-shadow .2s, transform .1s;
}
.tl-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.tl-top { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.tl-date { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.tl-mood { width: 9px; height: 9px; border-radius: 50%; }
.tl-title { font-family: var(--serif); font-size: 18px; font-weight: 500; margin-bottom: 5px; letter-spacing: -.01em; }
.tl-body { font-family: var(--serif); font-size: 14.5px; line-height: 1.65; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tl-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tl-tags .tag { padding: 2px 9px; }
.tl-kind { font-size: 10.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface-2); padding: 2px 7px; border-radius: 5px; }

.empty { text-align: center; padding: 56px 20px; color: var(--ink-3); }
.empty svg { width: 42px; height: 42px; margin-bottom: 12px; opacity: .5; }
.empty p { margin: 0; font-size: 14px; }
.empty .empty-title { font-family: var(--serif); font-size: 18px; color: var(--ink-2); margin-bottom: 5px; }

/* ===================================================================== */
/*  insights                                                             */
/* ===================================================================== */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-num { font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.stat-lab { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: 5px; }

.card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.card-title { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }

.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heatmap i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 11px; color: var(--ink-3); }
.heat-legend .hl { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid var(--line-soft); }
.l0, .heatmap i.l0 { background: var(--surface-2); }
.l1, .heatmap i.l1 { background: color-mix(in srgb, var(--accent) 26%, var(--surface)); border-color: transparent; }
.l2, .heatmap i.l2 { background: color-mix(in srgb, var(--accent) 48%, var(--surface)); border-color: transparent; }
.l3, .heatmap i.l3 { background: color-mix(in srgb, var(--accent) 72%, var(--surface)); border-color: transparent; }
.l4, .heatmap i.l4 { background: var(--accent); border-color: transparent; }

.moodchart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.moodchart { justify-content: flex-start; }
.moodchart i { flex: 1 1 0; max-width: 26px; border-radius: 4px 4px 2px 2px; min-width: 3px; transition: opacity .15s; }
.moodchart i:hover { opacity: .75; }

/* ===================================================================== */
/*  dialogs, toast, mobile bar                                           */
/* ===================================================================== */
.dialog {
  width: min(440px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line);
  border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(20,17,12,.42); backdrop-filter: blur(3px); }
.dialog[open] { animation: pop .18s cubic-bezier(.2,.8,.25,1) both; }
.dialog h3 { font-family: var(--serif); font-size: 20px; font-weight: 500; margin-bottom: 16px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.field input, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); font-size: 14px; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.field-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 9px; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; transition: transform .12s; }
.swatch:hover { transform: scale(1.1); }
.swatch.on { border-color: var(--ink); }
.dialog-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.spacer { flex: 1; }
.keys { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.keys li { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink-2); }
.keys span { margin-left: 4px; }
kbd {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px;
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
}

.toast {
  position: fixed; left: 50%; bottom: 26px; translate: -50% 0; z-index: 100;
  padding: 10px 18px; border-radius: 11px; font-size: 14px; font-weight: 500;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
  animation: toastIn .22s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

.mobilebar { display: none; }

/* ===================================================================== */
/*  responsive                                                           */
/* ===================================================================== */
@media (max-width: 1080px) {
  .view-calendar.is-active { grid-template-columns: minmax(0,1fr) 340px; }
  #search { width: 160px; }
  #search:focus { width: 200px; }
}

@media (max-width: 860px) {
  body { font-size: 15px; }
  .tabs { display: none; }
  .brand-name { display: none; }
  #search { width: 140px; }
  #search:focus { width: 170px; }
  .topbar { padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }

  .view-calendar.is-active { display: block; position: relative; }
  .cal-pane { height: 100%; padding: 14px 14px 10px; }
  .cal-grid { gap: 4px; }
  .cell { padding: 4px 5px; border-radius: 9px; }
  .cell-chips, .cell-note { display: none; }
  .cell-top { flex-direction: column; align-items: flex-start; gap: 4px; }
  .cal-legend { display: none; }

  .day-pane {
    position: absolute; inset: 0; z-index: 20; border-left: 0;
    transform: translateY(100%); transition: transform .3s cubic-bezier(.3,.9,.3,1);
    background: var(--bg); box-shadow: var(--shadow-lg);
  }
  .day-pane.is-open { transform: translateY(0); }
  .day-close { display: inline-grid; }
  .day-scroll { padding-bottom: 100px; }

  .narrow { padding: 20px 16px 110px; }
  .main { padding-bottom: 0; }

  .mobilebar {
    display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; flex: none;
    padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.6) blur(14px);
    position: relative; z-index: 25;
  }
  .mtab {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px;
    border-radius: 10px; font-size: 10.5px; font-weight: 600; color: var(--ink-3); transition: color .15s, background .15s;
  }
  .mtab svg { width: 21px; height: 21px; }
  .mtab.is-active { color: var(--accent); background: var(--accent-wash); }
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row .field:first-child { grid-column: 1 / -1; }
}

@media (max-width: 400px) {
  .cal-title h2 { font-size: 22px; }
  #search { width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
