/* Calendar — phone first (390px). */
#screen-calendar { display: flex; flex-direction: column; min-height: 100%; }
#cal-body { padding: 0 0 88px; }
.cal-toolbar { padding: 8px 16px 10px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; z-index: 3; background: var(--bg); }
.cal-views { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.cal-views button { flex: 1; min-height: 40px; border: 0; background: transparent; color: var(--text); font-weight: 700; font-size: 14px; }
.cal-views button.on { background: var(--accent); color: #fff; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-heading { flex: 1; text-align: center; font-size: 17px; margin: 0; }
.cal-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.btn.slim { min-height: 36px; padding: 0 10px; font-size: 13px; }
#screen-calendar, #cal-body { overflow-x: hidden; max-width: 100%; }
.cal-wd, .cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); width: 100%; max-width: 100%; box-sizing: border-box; }
.cal-wd { padding: 0 12px; font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; }
.cal-month { gap: 3px; padding: 6px 12px 4px; }
.cal-cell { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-height: 64px; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); padding: 4px 3px 3px; text-align: left; }
.cal-cell .num { font-size: 12px; font-weight: 800; padding: 0 2px; }
.cal-cell.other { opacity: 0.45; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.selected { background: var(--raise, var(--bg-elev)); }
.cal-cell .chips { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
.cal-chip { display: block; max-width: 100%; font-size: 9px; line-height: 1.2; font-weight: 700; color: #fff; border-radius: 4px; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; text-align: left; }
.cal-chip.more { background: transparent; color: var(--muted); font-weight: 600; }
.cal-chip.block { width: 100%; margin: 0 0 2px; }
.cal-agenda { padding: 8px 16px 16px; }
.cal-agenda-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-agenda-h h2 { margin: 0; font-size: 16px; }
.cal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cal-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; color: var(--text); min-height: 52px; }
.cal-item .dot { width: 10px; height: 10px; border-radius: 99px; margin-top: 5px; flex: none; }
.cal-item .body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-item .when { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-item .ttl { font-weight: 700; font-size: 15px; }
.cal-item .loc { font-size: 12px; color: var(--muted); }
.cal-layer-tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.cal-fab { position: fixed; right: 16px; bottom: calc(16px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 28px; line-height: 1; box-shadow: 0 8px 20px rgba(0,0,0,.35); z-index: 4; }
.cal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.cal-sheet { width: 100%; max-width: 520px; max-height: min(92vh, 820px); overflow: auto; background: var(--bg-elev, var(--card)); border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + var(--safe-b)); color: var(--text); }
.cal-sheet.slim { padding-bottom: calc(24px + var(--safe-b)); }
.cal-sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-sheet-h h2 { margin: 0; font-size: 18px; }
.cal-sheet .field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.cal-sheet .field input, .cal-sheet .field select, .cal-sheet .field textarea { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 8px 10px; font: inherit; font-weight: 500; }
.cal-sheet .field textarea { min-height: 80px; resize: vertical; }
.cal-sheet .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cal-sheet .chk { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 0 0 10px; }
.cal-cols { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.cal-col { display: block; }
.cal-col input { position: absolute; opacity: 0; pointer-events: none; }
.cal-col span { display: block; width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 2px transparent; }
.cal-col.on span, .cal-col input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.cal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cal-err, .cal-flash { color: var(--warn); font-weight: 600; }
.btn.danger { color: var(--danger, #d45a5a); }
.cal-week, .cal-week-grid, .cal-week-hd, .cal-week-allday { max-width: 100%; overflow-x: hidden; }
.cal-week { padding: 0 8px 8px; }
.cal-week-hd, .cal-week-allday, .cal-week-grid .hr { display: grid; grid-template-columns: 36px repeat(7, 1fr); gap: 2px; align-items: stretch; }
.cal-week-hd { text-align: center; font-size: 11px; font-weight: 700; }
.cal-week-hd .wd { border: 0; background: transparent; color: var(--text); padding: 4px 0; }
.cal-week-hd .wd.today b { background: var(--accent); color: #fff; border-radius: 99px; display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; }
.cal-week-allday { min-height: 28px; margin: 4px 0 6px; }
.cal-week-allday .gutter, .cal-week-grid .gutter { font-size: 9px; color: var(--muted); padding-top: 2px; }
.cal-week-grid { position: relative; }
.cal-week-grid .hr { min-height: 44px; border-top: 1px solid var(--line); }
.cal-week-grid .slot { border: 0; background: transparent; min-height: 44px; }
.cal-week-grid .cal-block { position: absolute; border: 0; border-radius: 4px; color: #fff; font-size: 9px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; padding: 2px 3px; text-align: left; z-index: 1; }
.cal-day { padding: 0 16px 16px; }
.cal-hour { display: grid; grid-template-columns: 64px 1fr; gap: 8px; min-height: 52px; border-top: 1px solid var(--line); padding: 4px 0; }
.cal-hour .lab { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; padding: 4px 0; }
.cal-draft { border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin: 0 0 10px; background: var(--card); }
.cal-raw { margin: 0 0 12px; }
.cal-raw pre { white-space: pre-wrap; font-size: 12px; background: var(--surface-2, var(--bg)); padding: 8px; border-radius: 8px; max-height: 160px; overflow: auto; }
.cal-banner { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 8px 16px; padding: 10px 12px; border-radius: 14px; background: var(--accent); color: #fff; }
.cal-banner .muted { color: rgba(255,255,255,.9); }
.ml-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 16px; }
.ml-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
@media (min-width: 720px) {
  .cal-sheet { border-radius: 20px; margin: 24px; max-height: 90vh; }
  .cal-overlay { align-items: center; }
}

.cal-loc-wrap { margin: 0 0 12px; }
.cal-loc-wrap .field { margin-bottom: 4px; }
.cal-maps { display: inline-block; margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: underline; }
.cal-maps[hidden] { display: none; }
.cal-rems { margin: 0 0 14px; }
.cal-rem-list { list-style: none; margin: 0 0 10px; padding: 0; }
.cal-rem-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cal-rem-add .field { margin-bottom: 8px; }
.cal-attach { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2, var(--bg)); }
.cal-attach .btn { margin-top: 8px; }
.cal-pdf-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 99px; background: var(--line); font-size: 10px; font-weight: 800; letter-spacing: .02em; vertical-align: middle; }
