/* =========================================================
   DAY — Journal quotidien
   Design system (dark-first, inspiré Mood Flow / Daylio)
   ========================================================= */

:root {
  /* Mood palette : du pire (1) au meilleur (5) — violet -> vert */
  --m1: #a45ce6;   /* terrible  */
  --m1b: #b878ee;
  --m2: #6f74f2;   /* mauvais   */
  --m2b: #8a8ef6;
  --m3: #37a5ea;   /* moyen     */
  --m3b: #5ab8f2;
  --m4: #1fc79a;   /* bien      */
  --m4b: #40d8b0;
  --m5: #86d62c;   /* génial    */
  --m5b: #a2e352;

  /* Surfaces (dark) */
  --bg: #0c0c0e;
  --bg-grad-1: #101014;
  --bg-grad-2: #0b0b0d;
  --surface: #16161a;
  --surface-2: #1f1f24;
  --surface-3: #2a2a30;
  --surface-hover: #303038;

  --text: #f4f4f6;
  --text-2: #b6b6c0;
  --text-3: #7d7d88;

  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);

  --accent: var(--m5);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 4px 16px -8px rgba(0, 0, 0, 0.5);

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;

  --ease: cubic-bezier(0.34, 1.2, 0.4, 1);
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);

  --tab-h: 74px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="light"] {
  --bg: #eef1f4;
  --bg-grad-1: #f4f6f9;
  --bg-grad-2: #e7ebf0;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --surface-3: #e8ecf1;
  --surface-hover: #eaeef3;
  --text: #14151a;
  --text-2: #4c4f5a;
  --text-3: #8b8f9c;
  --border: rgba(15, 18, 30, 0.08);
  --border-2: rgba(15, 18, 30, 0.14);
  --shadow-lg: 0 24px 60px -28px rgba(30, 40, 70, 0.28);
  --shadow-md: 0 12px 30px -16px rgba(30, 40, 70, 0.22);
  --shadow-sm: 0 4px 14px -8px rgba(30, 40, 70, 0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(134, 214, 44, 0.06), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(111, 116, 242, 0.07), transparent 55%),
    var(--bg);
  overscroll-behavior: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============ PHONE FRAME ============ */
.phone {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  max-height: 940px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  overflow: hidden;
}
@media (min-width: 480px) {
  .phone {
    border-radius: 40px;
    box-shadow: var(--shadow-lg), 0 0 0 10px #000, 0 0 0 11px rgba(255,255,255,.06);
    height: 92vh;
  }
}

/* ============ TOPBAR ============ */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
  padding-top: max(18px, env(safe-area-inset-top));
}
.topbar-title { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--text-2);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.9); }

/* ============ MAIN / VIEWS ============ */
.main {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 20px calc(var(--tab-h) + 24px);
  scrollbar-width: none;
}
.main::-webkit-scrollbar { display: none; }
.view { animation: viewIn 0.4s var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ HEADINGS / SECTIONS ============ */
.page-hero { margin: 6px 2px 20px; }
.page-hero .date-big { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.page-hero .title-xl { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.08; margin-top: 4px; }
.page-hero .title-xl em { font-style: normal; color: var(--accent); }

.section-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
  margin: 26px 2px 12px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ============ CARD ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 14px; }
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* ============ MOOD PICKER (home) ============ */
.mood-row { display: flex; gap: 10px; justify-content: space-between; }
.mood-pick {
  flex: 1;
  aspect-ratio: 1;
  border-radius: 20px;
  display: grid; place-items: center;
  position: relative;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
  background: var(--surface-2);
}
.mood-pick .face { width: 62%; height: 62%; opacity: 0.85; }
.mood-pick[data-m="1"] { background: linear-gradient(160deg, var(--m1b), var(--m1)); }
.mood-pick[data-m="2"] { background: linear-gradient(160deg, var(--m2b), var(--m2)); }
.mood-pick[data-m="3"] { background: linear-gradient(160deg, var(--m3b), var(--m3)); }
.mood-pick[data-m="4"] { background: linear-gradient(160deg, var(--m4b), var(--m4)); }
.mood-pick[data-m="5"] { background: linear-gradient(160deg, var(--m5b), var(--m5)); }
.mood-pick .face { stroke: #10121a; opacity: 0.9; }
.mood-pick.dim { filter: grayscale(0.55) brightness(0.7); opacity: 0.55; }
.mood-pick.sel { transform: translateY(-6px) scale(1.06); box-shadow: 0 14px 28px -10px rgba(0,0,0,.6); opacity: 1; filter: none; }
.mood-pick.sel::after {
  content: ""; position: absolute; inset: -3px; border-radius: 22px;
  border: 2.5px solid #fff; opacity: 0.9;
}
.mood-caption { text-align: center; font-weight: 700; font-size: 18px; margin-top: 16px; letter-spacing: -0.01em; min-height: 22px; }

/* ============ NOTE FIELD ============ */
.field { width: 100%; }
textarea.note, input.text {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  transition: border-color 0.2s, background 0.2s;
}
textarea.note { min-height: 110px; }
textarea.note::placeholder, input.text::placeholder { color: var(--text-3); }
textarea.note:focus, input.text:focus { outline: none; border-color: var(--border-2); background: var(--surface-3); }

/* ============ ACTION CHIPS ============ */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  transition: all 0.18s var(--ease-out);
}
.chip .ci { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); flex: 0 0 auto; font-size: 14px; }
.chip .ci svg { width: 15px; height: 15px; }
.chip:hover { border-color: var(--border-2); color: var(--text); }
.chip.on { background: var(--text); color: #0c0c0e; border-color: var(--text); }
.chip.on .ci { background: rgba(0,0,0,0.14); color: #0c0c0e; }
.chip.add { border-style: dashed; color: var(--text-3); }
.chip .chip-x { width: 16px; height: 16px; margin-left: 2px; opacity: 0.6; transform: rotate(45deg); }
.chip .chip-x svg { width: 14px; height: 14px; }

/* ---- Éditeur d'actions (ajout libre) ---- */
.acted-add {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 6px 6px 14px;
  transition: border-color 0.2s, background 0.2s;
}
.acted-add:focus-within { border-color: var(--border-2); background: var(--surface-3); }
.acted-add-ic { width: 18px; height: 18px; color: var(--text-3); flex: 0 0 auto; }
.acted-add-ic svg { width: 18px; height: 18px; }
.acted-input { flex: 1; min-width: 0; background: none; border: none; color: var(--text); font: inherit; font-size: 14.5px; padding: 8px 0; }
.acted-input:focus { outline: none; }
.acted-input::placeholder { color: var(--text-3); }
.acted-addbtn { flex: 0 0 auto; background: var(--text); color: #0c0c0e; font-weight: 700; font-size: 13.5px; padding: 9px 16px; border-radius: 999px; transition: transform 0.15s, filter 0.2s; }
.acted-addbtn:active { transform: scale(0.94); }
.acted-done { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.acted-sug { margin-top: 16px; }
.acted-sug-lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 22px;
  border-radius: var(--r-md);
  font-weight: 700; font-size: 15px;
  transition: transform 0.15s var(--ease), filter 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--m5b), var(--m4)); color: #08120a; box-shadow: 0 12px 26px -12px rgba(134,214,44,.5); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-block { width: 100%; }
.btn-danger { background: transparent; color: #ff6b6b; }
.btn svg { width: 18px; height: 18px; }

.save-bar { position: sticky; bottom: 0; padding: 14px 0 4px; margin-top: 20px; background: linear-gradient(180deg, transparent, var(--bg-grad-2) 40%); }

/* ============ CALENDAR ============ */
.year-switch { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 2px 0 10px; }
.year-switch b { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; min-width: 70px; text-align: center; }
.year-switch .icon-btn { width: 34px; height: 34px; background: var(--surface); border: 1px solid var(--border); }

.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 0 2px 8px; }
.weekdays span { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3); }

.month-block { margin-bottom: 22px; }
.month-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 12px; }
.month-head .mh-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.month-head .mh-avg { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.month-head .mh-dot { width: 12px; height: 12px; border-radius: 4px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1;
  border-radius: 11px;
  position: relative;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  transition: transform 0.15s var(--ease), box-shadow 0.2s;
}
.cal-cell.empty { visibility: hidden; }
.cal-cell.blank { background: var(--surface-2); border: none; color: var(--text-3); }
.cal-cell.future { background: var(--surface); border: none; color: var(--text-3); opacity: 0.55; }
.cal-cell .num {
  position: absolute; top: 4px; left: 5px;
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center; font-size: 9.5px; font-weight: 700;
  background: rgba(255,255,255,0.9); color: #111;
}
.cal-cell.blank .num, .cal-cell.future .num { background: transparent; color: var(--text-3); }
.cal-cell[data-m="1"] { background: linear-gradient(160deg, var(--m1b), var(--m1)); }
.cal-cell[data-m="2"] { background: linear-gradient(160deg, var(--m2b), var(--m2)); }
.cal-cell[data-m="3"] { background: linear-gradient(160deg, var(--m3b), var(--m3)); }
.cal-cell[data-m="4"] { background: linear-gradient(160deg, var(--m4b), var(--m4)); }
.cal-cell[data-m="5"] { background: linear-gradient(160deg, var(--m5b), var(--m5)); }
.cal-cell.today { box-shadow: 0 0 0 2px var(--text); }
.cal-cell:not(.empty):not(.future):hover { transform: scale(1.12); z-index: 2; box-shadow: var(--shadow-md); }
.cal-cell:active { transform: scale(0.95); }

/* ============ JOURNAL ============ */
.journal-month { font-size: 13px; font-weight: 700; color: var(--text-2); text-align: center; margin: 22px 0 14px; }
.journal-month span { background: var(--surface-2); border: 1px solid var(--border); padding: 6px 16px; border-radius: 999px; }
.j-entry { display: flex; gap: 14px; margin-bottom: 4px; }
.j-rail { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; }
.j-day {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #0c0c0e;
  flex: 0 0 auto;
}
.j-day[data-m="1"] { background: var(--m1); } .j-day[data-m="2"] { background: var(--m2); }
.j-day[data-m="3"] { background: var(--m3); } .j-day[data-m="4"] { background: var(--m4); }
.j-day[data-m="5"] { background: var(--m5); }
.j-line { width: 2px; flex: 1; background: var(--border); margin: 6px 0; border-radius: 2px; }
.j-body { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 16px; }
.j-body p { font-size: 14.5px; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.j-body .j-empty { color: var(--text-3); font-style: italic; }
.j-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.j-tag { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--surface-2); padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.j-tag svg { width: 12px; height: 12px; }
.j-time { font-size: 11px; color: var(--text-3); font-weight: 600; }

/* Gratitude */
.grat-item { display: flex; gap: 14px; }
.grat-rail { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; padding-top: 4px; }
.grat-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--m5); box-shadow: 0 0 0 4px rgba(134,214,44,.18); flex: 0 0 auto; }
.grat-body { flex: 1; padding-bottom: 22px; cursor: pointer; }
.grat-date { font-size: 12.5px; font-weight: 700; color: var(--text-3); margin-bottom: 8px; text-transform: capitalize; }
.grat-body p { font-size: 15px; line-height: 1.6; color: var(--text); white-space: pre-wrap; }
.grat-quote { margin: 4px 0 26px 26px; padding: 16px 18px; border-left: 3px solid var(--m5); background: var(--surface); border-radius: 0 var(--r-md) var(--r-md) 0; font-size: 14px; font-style: italic; color: var(--text-2); line-height: 1.55; }

/* ============ ACTIONS MANAGER ============ */
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.act-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 10px 13px; text-align: center;
  transition: transform 0.15s var(--ease), border-color 0.2s;
  position: relative;
}
.act-tile:hover { transform: translateY(-3px); border-color: var(--border-2); }
.act-tile .ti { width: 44px; height: 44px; border-radius: 14px; margin: 0 auto 9px; display: grid; place-items: center; font-size: 21px; }
.act-tile .ti svg { width: 22px; height: 22px; }
.act-tile .tl { font-size: 12.5px; font-weight: 700; }
.act-tile .tc { font-size: 10.5px; font-weight: 600; color: var(--text-3); margin-top: 3px; }
.act-tile.add { border-style: dashed; color: var(--text-3); display: grid; place-items: center; min-height: 118px; }
.act-tile.add .ti { background: var(--surface-2); }

/* ============ STATS ============ */
.segmented { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px; margin-bottom: 20px; }
.segmented button { flex: 1; padding: 10px 6px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text-3); transition: color 0.2s; }
.segmented button.on { color: var(--text); background: var(--surface-3); box-shadow: var(--shadow-sm); }

.range-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 700; margin: 0 auto 18px; }
.center { display: flex; justify-content: center; }

.stat-banner { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 16px; margin-bottom: 4px; }
.stat-banner .sb-ic { width: 26px; height: 26px; border-radius: 50%; background: rgba(134,214,44,.16); color: var(--m5); display: grid; place-items: center; flex: 0 0 auto; }
.stat-banner .sb-ic svg { width: 15px; height: 15px; }
.stat-banner b { font-size: 13.5px; }
.stat-banner span { font-size: 12px; color: var(--text-3); margin-left: auto; }

.stat-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; text-align: center; }
.stat-box .lbl { font-size: 12px; color: var(--text-3); font-weight: 600; }
.stat-box .val { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }

.chart-wrap { position: relative; }
.osc-toggle { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.legend { display: flex; flex-direction: column; gap: 9px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.legend-row .lg-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #0c0c0e; flex: 0 0 auto; }
.legend-row .lg-count { color: var(--text-3); }
.legend-row .lg-arrow { color: var(--text-3); margin-left: auto; }
.legend-row .lg-pct { font-weight: 800; min-width: 42px; text-align: right; }

.donut-row { display: grid; grid-template-columns: 130px 1fr; gap: 18px; align-items: center; }

.corr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 15px 16px; margin-bottom: 12px; }
.corr-head { display: flex; align-items: center; gap: 12px; }
.corr-head .ch-ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 19px; flex: 0 0 auto; }
.corr-head .ch-ic svg { width: 20px; height: 20px; }
.corr-head .ch-name { font-size: 15px; font-weight: 700; }
.corr-head .ch-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.corr-head .ch-delta { margin-left: auto; text-align: right; }
.corr-head .ch-delta b { font-size: 18px; font-weight: 800; }
.corr-head .ch-delta.pos b { color: var(--m5); }
.corr-head .ch-delta.neg b { color: var(--m1b); }
.corr-head .ch-delta small { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 600; }
.corr-bars { display: flex; gap: 16px; margin-top: 14px; }
.corr-bars .cb { flex: 1; }
.corr-bars .cb .cb-l { font-size: 11px; color: var(--text-3); font-weight: 600; margin-bottom: 6px; display: flex; justify-content: space-between; }
.corr-bars .cb .cb-l b { color: var(--text); }
.corr-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.corr-track i { display: block; height: 100%; border-radius: 999px; }

.prob-chart { display: grid; grid-template-columns: 26px 1fr; gap: 8px; }
.prob-y { display: flex; flex-direction: column; justify-content: space-between; height: 128px; font-size: 10px; font-weight: 700; color: var(--text-3); text-align: right; }
.dow-chart {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 128px;
  background-image: repeating-linear-gradient(to top, rgba(255,255,255,.07) 0 1px, transparent 1px 32px);
}
.dow-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 128px; gap: 5px; }
.dow-col .dow-bar { width: 62%; border-radius: 7px 7px 3px 3px; min-height: 4px; background: var(--text); transition: height 0.6s var(--ease-out); }
.dow-col .dow-pct { font-size: 10px; font-weight: 800; }
.dow-labels { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 8px; }
.dow-labels .dow-lbl { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3); }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state .es-emoji { font-size: 46px; margin-bottom: 14px; }
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; line-height: 1.5; max-width: 260px; margin: 0 auto 18px; }

/* ============ TABBAR ============ */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: center; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--border);
}
.tab {
  width: 48px; height: 48px; display: grid; place-items: center;
  color: var(--text-3); border-radius: 14px;
  transition: color 0.2s, transform 0.15s;
  position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab.is-active { color: var(--text); }
.tab.is-active::after { content: ""; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.tab:active { transform: scale(0.88); }

/* ============ SHEET (entry editor) ============ */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 40; animation: fade 0.25s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 440px; max-height: 92vh;
  background: var(--bg-grad-1);
  border-radius: 28px 28px 0 0;
  border-top: 1px solid var(--border-2);
  z-index: 50;
  overflow-y: auto; scrollbar-width: none;
  padding: 10px 20px calc(30px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: sheetUp 0.38s var(--ease-out);
}
.sheet::-webkit-scrollbar { display: none; }
@keyframes sheetUp { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.sheet-grip { width: 42px; height: 5px; border-radius: 999px; background: var(--surface-3); margin: 6px auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sheet-head .sh-date { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.sheet-head .sh-date small { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: capitalize; }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: calc(var(--tab-h) + 20px); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 12px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 700;
  z-index: 60; opacity: 0; transition: all 0.3s var(--ease);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px;
}
.toast svg { width: 16px; height: 16px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ MODAL (action editor) ============ */
.modal-fields { display: flex; flex-direction: column; gap: 14px; }
.icon-choices, .color-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.icon-opt {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-2); border: 2px solid transparent; font-size: 21px; transition: all 0.15s;
}
.icon-opt svg { width: 22px; height: 22px; }
.icon-opt.on { border-color: var(--text); background: var(--surface-3); }
.color-opt { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; transition: transform 0.15s; }
.color-opt.on { transform: scale(1.15); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.mini-label { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }

.streak-pill { display: inline-flex; align-items: center; gap: 7px; background: linear-gradient(135deg, rgba(134,214,44,.16), rgba(31,199,154,.14)); border: 1px solid rgba(134,214,44,.25); color: var(--m5b); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.streak-pill svg { width: 15px; height: 15px; color: var(--m5); }

.menu-installed { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px; border-radius: var(--r-md); background: rgba(134,214,44,.12); border: 1px solid rgba(134,214,44,.25); color: var(--m5b); font-weight: 700; font-size: 14px; }
.menu-installed svg { width: 18px; height: 18px; color: var(--m5); }
