.row2 { margin-top: 9px; }
.row2 .seg { flex: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 9px; font-size: 12.5px; color: var(--text); }
.lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lg i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; box-shadow: 0 0 0 1px rgba(255,255,255,.15) inset; }
.lg i.bar { height: 4px; border-radius: 2px; }

/* month grid */
.mgrid { display: flex; flex-direction: column; gap: 3px; }
.mhead, .mrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.mhead b { text-align: center; font-size: 12px; color: var(--mute); padding-bottom: 2px; }
.mhead b.we { color: #9fb3ff; }
.mcell { position: relative; min-height: 74px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px 3px 7px;
    display: flex; flex-direction: column; gap: 2px; text-align: left; overflow: hidden; }
.mcell.we { background: var(--wk); }
.mcell.out { opacity: .38; }
.mcell.today { border-color: var(--acc); border-width: 2px; }
.mcell.sel { box-shadow: 0 0 0 2px #fff; }
.mnum { font-size: 13px; font-weight: 700; line-height: 1.1; padding-left: 2px; }
.mcell.today .mnum { color: var(--acc); }
.mev { --ec: var(--acc); --et: #fff; background: var(--ec); color: var(--et); font-size: 9.5px; font-weight: 700; line-height: 1.25; border-radius: 3px;
    padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.mmore { font-size: 9.5px; color: var(--mute); padding-left: 2px; }
.hbar { --hc: #facc15; position: absolute; left: -1px; right: -1px; bottom: 0; height: 4px; background: var(--hc); }
.hbar.s { left: 3px; border-bottom-left-radius: 3px; } .hbar.e { right: 3px; border-bottom-right-radius: 3px; }

/* events */
.ev { --ec: var(--acc); --et: #fff; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line);
    border-left: 6px solid var(--ec); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.ev-time { width: 54px; flex: none; color: var(--mute); font-size: 13px; font-variant-numeric: tabular-nums; }
.ev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-main b { font-size: 16px; font-weight: 700; }
.ev-main small { color: var(--mute); font-size: 13px; }
.ev-grp { flex: none; background: var(--ec); color: var(--et); font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.daylist { margin-top: 16px; }
.daylist h2, .wd-head, .ld-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.daylist h2 { font-size: 18px; }
.tag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.tag.bh { background: var(--wk); color: #9fb3ff; }
.tag.hol { --hc: #facc15; border: 2px solid var(--hc); color: var(--hc); }

/* week */
.wday { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 10px; position: relative; overflow: hidden; }
.wday.we { background: var(--wk); }
.wday.today { border-color: var(--acc); border-width: 2px; }
.wday.hol::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--hc, #facc15); }
.wd-head b { font-size: 20px; font-weight: 800; }
.wd-head span { color: var(--mute); }
.wd-head i { font-style: normal; margin-left: auto; width: 30px; height: 30px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--acc); }
.wday.today .wd-head b { color: var(--acc); }
.wd-empty { color: var(--mute); font-size: 14px; margin-top: 6px; }
.wday .ev { background: var(--panel-2); }

/* list */
.lday { margin-bottom: 16px; }
.ld-head b { font-size: 17px; }
.ld-head span { color: var(--mute); }
.lday.today .ld-head b { color: var(--acc); }

.fab { position: fixed; right: 18px; bottom: calc(22px + var(--safe-b)); width: 60px; height: 60px; border-radius: 20px; background: var(--acc); color: #fff;
    font-size: 34px; font-weight: 300; box-shadow: 0 6px 20px rgba(0,0,0,.5); z-index: 30; line-height: 1; }
.main { padding-bottom: calc(100px + var(--safe-b)); }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { bottom: calc(96px + var(--safe-b)); }

/* tapping an entry */
.ev[data-ev] { cursor: pointer; }
.ev-info { color: var(--mute); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.ev-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ec); flex: none; }
.ev-note { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; white-space: pre-wrap; }
.ev-err { color: #ffb3b3; }

.chip-h { flex-basis: 100%; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--mute, #8b95a5); margin-top: 6px; }

/* Phone turned sideways: one compact bar at the top, so the month has the room */
@media (orientation: landscape) and (max-height: 520px) {
  .top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-top: 6px; padding-bottom: 6px; }
  .top .top-row { margin: 0; }
  .top h1 { font-size: 18px; }
  .top .icon-btn { width: 34px; height: 34px; }
  .top .seg button { padding-top: 5px; padding-bottom: 5px; }
  .legend { margin-top: 0; font-size: 11.5px; flex-basis: 100%; }
  .mcell { min-height: 52px; }
  .fab { width: 48px; height: 48px; border-radius: 16px; bottom: 12px; }
}

/* Year view (computer): a wall planner – a row a month, a column a day; each day tall enough to read its entries */
.ygrid { display: flex; flex-direction: column; gap: 3px; }
.yrow { display: grid; grid-template-columns: 44px repeat(31, minmax(0, 1fr)); gap: 2px; align-items: stretch; }
.yhead b { font-size: 11px; color: var(--mute); text-align: center; font-weight: 600; }
.ym { font-weight: 700; font-size: 13px; display: flex; align-items: center; }
.ycell { position: relative; min-height: max(84px, calc((100vh - 250px) / 12)); background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 2px 1px 6px;
    display: flex; flex-direction: column; align-items: stretch; gap: 2px; cursor: pointer; font: inherit; color: inherit; overflow: hidden; text-align: left; }
.ycell.we { background: var(--wk); }
.ycell.none { background: none; border-color: transparent; cursor: default; }
.ycell.today { border-color: var(--acc); border-width: 2px; }
.ycell:hover { border-color: var(--acc); }
.yd { font-size: 9px; color: var(--mute); text-align: center; }
.yev { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 0 1px; min-width: 0; }
.yev i { display: block; font-style: normal; font-size: 9.5px; line-height: 1.25; font-weight: 600; padding: 1px 2px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.yev em { font-style: normal; font-size: 9px; color: var(--mute); text-align: center; }
.ybar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0 0 4px 4px; }
.ynote { color: var(--mute); font-size: 13px; text-align: center; margin: 10px 0 0; }
