/* ---------- calendar ---------- */
#calendar { height: 100%; display: flex; flex-direction: column; }
.cal-shell { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 230px; min-height: 0; }
.cal-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cal-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.cal-bar h2 { margin: 0 6px 0 0; font-size: 17px; font-weight: 600; min-width: 170px; }
.cal-bar .sp { margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; align-items: stretch; }
.seg > span { padding: 6px 8px; color: var(--muted); font-size: 12px; background: var(--head); border-right: 1px solid var(--line); display: flex; align-items: center; }
.seg button { border: 0; background: var(--panel); padding: 6px 11px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
#calSearch { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; width: 190px; background: var(--bg); }
#calJump { padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
#calState, #calCount { font-size: 12px; color: var(--muted); }
#calBody { flex: 1; overflow: auto; background: var(--panel); }
.cal-side { border-left: 1px solid var(--line); background: var(--panel); padding: 12px 10px; overflow: auto; }
.cal-leghead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 2px 6px 8px; }
.cal-leghead h3 { margin: 0 !important; }
.cal-leghead span { display: flex; gap: 10px; font-size: 12px; }
.cal-leghead .link:disabled { color: var(--muted); text-decoration: none; cursor: default; opacity: .6; }
.cal-side h3 { margin: 2px 6px 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.leg { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-radius: 5px; padding: 4px 6px; }
.leg:hover { background: var(--head); }
.leg.off { opacity: .4; } .leg.off .nm { text-decoration: line-through; }
.leg .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg .ct { font: 11px var(--mono); color: var(--muted); }
.sw { width: 12px; height: 12px; border-radius: 3px; background: hsl(var(--h) 60% 50%); display: inline-block; flex: none; }
.sw.nohue { background: var(--muted); }
#calUnsched { margin: 14px 6px 0; font-size: 12px; } #calUnsched a { color: var(--warn); }
.chip { --bg: hsl(var(--h) 80% 89%); --bd: hsl(var(--h) 55% 45%); --fg: hsl(var(--h) 45% 18%);
  background: var(--bg); border-left: 3px solid var(--bd); color: var(--fg); border-radius: 3px; padding: 1px 6px; margin: 2px 4px; font-size: 12px; line-height: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; display: flex; gap: 6px; }
.chip.nohue { --bg: var(--head); --bd: var(--muted); --fg: var(--ink); }
.chip:hover { filter: brightness(.96); }
.chip .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chip .t { font-family: var(--mono); font-size: 11px; opacity: .8; }
.chip .who { opacity: .75; font-size: 11px; }
.chip.done { opacity: .55; }
.chip.cx { opacity: .45; text-decoration: line-through; }
.chip.issue { box-shadow: inset 0 0 0 1.5px var(--bad); }
.chip.dragging { opacity: .3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip:not(.nohue) { --bg: hsl(var(--h) 35% 24%); --bd: hsl(var(--h) 60% 58%); --fg: hsl(var(--h) 60% 90%); } }
:root[data-theme="dark"] .chip:not(.nohue) { --bg: hsl(var(--h) 35% 24%); --bd: hsl(var(--h) 60% 58%); --fg: hsl(var(--h) 60% 90%); }
.mgrid { display: flex; flex-direction: column; min-height: 100%; min-width: 760px; }
.mhead { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--head); z-index: 2; }
.mhead div { padding: 6px 8px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mdays { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(128px, 1fr); }
.mday { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); min-width: 0; padding-bottom: 4px; }
.mday:nth-child(7n+1), .mday:nth-child(7n) { background: color-mix(in srgb, var(--head) 45%, var(--panel)); }
.mday.out { background: var(--bg); } .mday.out .dn { color: var(--muted); opacity: .6; }
.dn { background: none; border: 0; font-size: 12.5px; padding: 4px 8px 2px; font-weight: 500; border-radius: 12px; margin: 2px; }
.dn:hover { background: var(--head); }
.mday.today .dn { background: var(--accent); color: var(--accent-ink); }
.more { background: none; border: 0; color: var(--accent); font-size: 12px; padding: 1px 8px; }
.more:hover { text-decoration: underline; }
.drop-on { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft) !important; }
.wgrid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); min-height: 100%; min-width: 1050px; }
.wday { border-right: 1px solid var(--line-soft); padding-bottom: 12px; min-width: 0; }
.wd { display: flex; justify-content: space-between; width: 100%; background: var(--head); border: 0; border-bottom: 1px solid var(--line); padding: 7px 10px; position: sticky; top: 0; z-index: 1; font-size: 12.5px; }
.wd span { color: var(--muted); font: 11px var(--mono); }
.wday.today .wd { background: var(--accent); color: var(--accent-ink); } .wday.today .wd span { color: var(--accent-ink); }
.wday .chip { white-space: normal; }
.wday .chip .nm { white-space: normal; }
.none { color: var(--muted); font-size: 12px; padding: 8px 10px; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; padding: 16px; align-content: start; min-height: 100%; }
.dgroup { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; align-self: start; }
.dgroup h3 { margin: 0; padding: 9px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; background: var(--head); border-bottom: 1px solid var(--line); }
.dgroup h3 .ct { margin-left: auto; font: 11px var(--mono); color: var(--muted); }
.drow { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; align-items: start; }
.drow:last-child { border-bottom: 0; } .drow:hover { background: var(--head); }
.dmain { display: grid; gap: 2px; min-width: 0; } .dmain small { color: var(--muted); } .dmain .scope { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calpop { width: 340px; }
.calpop h4 { font-size: 14px; margin: 2px 2px 10px; }
.daylist { max-height: 55vh; overflow: auto; margin: 0 -4px 8px; }
.daylist .chip { white-space: nowrap; }
.kvs { display: grid; gap: 4px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px; font-size: 12.5px; } .kv span { color: var(--muted); } .kv b { font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 900px) { .cal-shell { grid-template-columns: 1fr; } .cal-side { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
