/* The wide window: side bar, header row (also the window caption row), Home.
   Colours only from tokens.css. No gradients, full outlines, small radii. */

/* ---------- layout */
.app { flex-direction: row; background: var(--bg); color: var(--text); }
.app > .main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.app[data-mode="docked"] { flex-direction: column; }
.app[data-mode="docked"] > .rail { display: none; }
.app[data-mode="docked"] > .main { flex: 1 1 auto; }

/* ---------- side bar */
.rail { flex: none; width: 264px; display: flex; flex-direction: column; min-height: 0; background: var(--railbg); border-right: 1px solid var(--line); }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; user-select: none; }
.rail-logo { width: 30px; height: 30px; border-radius: var(--r); display: block; }
.rail-brand b { display: block; font-size: var(--fs-lead); }
.rail-brand small, .rail-h, .rb small, .ru small, .rail-who small { color: var(--dim); }
.rail-brand small { display: block; font-size: var(--fs-caption); }
.rail-scroll { flex: 1 1 auto; overflow: auto; padding: 4px 10px 8px; }
.rail-h { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .09em; padding: 14px 10px 6px; }
.rail-add { width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line2); border-radius: var(--r-sm); background: none; color: var(--mute); }
.rail-add:hover { color: var(--text); border-color: var(--mute); }
.rb { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); border: 1px solid transparent; color: var(--text); text-decoration: none; }
.rb:hover { background: var(--panel2); }
.rb.is-on { background: var(--panel3); border-color: var(--line2); }
.rb.is-archived { opacity: .65; }
.rb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb small { display: block; font-size: var(--fs-caption); }
.rb-hi { width: 30px; height: 30px; border: 1px solid var(--line2); border-radius: var(--r); display: grid; place-items: center; color: var(--acc); flex: none; }
.rb-home { margin-top: 2px; }
.ru { display: flex; gap: 10px; padding: 6px 10px; border-radius: var(--r); color: var(--text); text-decoration: none; align-items: flex-start; }
.ru:hover { background: var(--panel2); }
.ru-d { font-weight: 600; font-size: var(--fs-caption); font-family: var(--mono); color: var(--acc); min-width: 46px; padding-top: 2px; white-space: nowrap; }
.ru-t { font-size: var(--fs-body); min-width: 0; overflow-wrap: anywhere; }
.ru-t small { display: block; font-size: var(--fs-caption); }
.rail-none { color: var(--dim); font-size: var(--fs-caption); padding: 0 10px; margin: 0; }
.rail-arch { flex: none; border-top: 1px solid var(--line); max-height: 40vh; overflow: auto; }
.rail-arch-t { width: 100%; background: none; border: 0; cursor: pointer; padding: 12px 20px 10px; }
.rail-arch-t:hover { color: var(--text); }
.rail-arch-list { padding: 0 10px 6px; }
.rail-foot { flex: none; border-top: 1px solid var(--line); padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.rail-foot.account-wrap { position: relative; }
.rail-foot .menu-account { position: absolute; left: 12px; bottom: 56px; top: auto; right: auto; }
.rail-acct { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; background: none; border: 0; padding: 0; text-align: left; color: var(--text); cursor: pointer; }
.rail-who { flex: 1; min-width: 0; font-size: var(--fs-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-who small { display: block; font-size: var(--fs-caption); }
.rail-gear { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; background: none; border: 1px solid var(--line2); border-radius: var(--r); color: var(--mute); }
.rail-gear:hover, .rail-gear.is-on { color: var(--text); border-color: var(--mute); }

/* ---------- ring */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { display: block; }
.ring-track { stroke: var(--track); }
.ring-arc { stroke: var(--ring-c, var(--acc)); transition: stroke-dashoffset .5s ease; }
.ring b { position: absolute; font-weight: 650; font-size: var(--fs-body); font-family: var(--mono); color: var(--text); }
.ring.ring-sm b { font-size: var(--fs-caption); }
.ring.ring-big b { font-size: var(--fs-lead); }

/* ---------- header row (the window caption row on the desktop) */
.hdr.hdr-wide { border-bottom: 1px solid var(--line); background: var(--bg); }
.caption.top { display: flex; align-items: center; gap: 14px; padding: 12px 22px 12px; min-height: 64px; user-select: none; }
.top-text { flex: 0 1 auto; min-width: 150px; overflow: hidden; }
.top-facts .hdr-updated { flex: none; white-space: nowrap; }
.top-title, .top-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-facts { flex-wrap: nowrap; overflow: hidden; }
.top-title { margin: 0; font-size: var(--fs-heading); font-weight: 650; letter-spacing: -.2px; line-height: 1.2; }
.top-desc { margin: 2px 0 0; color: var(--mute); font-size: var(--fs-body); }
.top-facts { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.top .grow { flex: 1 1 auto; align-self: stretch; min-width: 12px; }
.fact { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 1px 8px; font-size: var(--fs-caption); color: var(--mute); background: var(--panel2); white-space: nowrap; }
.fact.is-stale { color: var(--warn); border-color: var(--warn); }
.top .hdr-updated { font-size: var(--fs-caption); color: var(--dim); }
.top .hdr-updated.is-stale { color: var(--warn); }
.seg-views { flex: none; display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; }
.seg-views button { background: none; border: 0; border-radius: var(--r-sm); padding: 5px 13px; color: var(--mute); font-weight: 550; cursor: pointer; }
.seg-views button.is-on { background: var(--panel3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.top .search { flex: 0 1 220px; min-width: 150px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); max-width: 220px; }
.top .seg-views button, .top .live { white-space: nowrap; }
.top > .ring, .top > .btn, .top > .more-wrap, .top > .live { flex: none; }
/* Narrower desktop windows: a slimmer side bar, and the header drops the description and facts before anything is cut. */
@media (max-width: 1100px) { .rail { width: 220px; } .caption.top { gap: 10px; padding: 10px 14px; } .top-desc { display: none; } .top > .ring { display: none; } .top .live-text { display: none; } .top .search { flex-basis: 180px; min-width: 120px; } }
/* Narrow wide windows: the title gets the first row and the controls wrap below it, so nothing runs off the window. */
@media (max-width: 960px) {
  .top-facts .fact { display: none; }
  .caption.top { flex-wrap: wrap; row-gap: 8px; }
  .top .top-text { flex: 1 1 100%; }
  .top .grow { display: none; }
  .seg-views button { padding: 5px 10px; }
  .top .search { flex: 0 1 160px; min-width: 110px; max-width: 160px; }
}
@media (max-width: 580px) {
  .hdr-home .caption.top { flex-wrap: wrap; }
  .hdr-home .top-text, .hdr-home .top .grow { min-width: 0; }
  .hdr-home .top .search { order: 1; flex: 1 1 100%; min-width: 0; max-width: none; }
}
.top .live { white-space: nowrap; }

/* ---------- Home */
.home-wide { max-width: 1400px; overflow-wrap: anywhere; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile { background: var(--tilebg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.kpi { display: flex; flex-direction: column; }
.kpi-v { font-weight: 650; font-size: var(--fs-title); font-family: var(--mono); letter-spacing: -.5px; }
.kpi-l { font-size: var(--fs-caption); color: var(--mute); }
.kpi-s { font-size: var(--fs-caption); color: var(--dim); }
.tone-red { color: var(--bad); }
.tone-orange { color: var(--st-blocked); }
.home-actions { display: flex; justify-content: flex-end; margin: 14px 0 10px; }
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 14px; }
.bcard { display: block; background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--r-lg); padding: 14px 16px; color: var(--text); text-decoration: none; transition: border-color .12s; }
.bcard:hover { border-color: var(--acc); }
.bc-h { display: flex; gap: 14px; align-items: flex-start; }
.bc-t { flex: 1; min-width: 0; }
.bc-t h2 { margin: 0; font-size: var(--fs-lead); font-weight: 640; }
.bc-t p { margin: 2px 0 0; color: var(--mute); font-size: var(--fs-caption); }
.bcard .top-facts { flex-wrap: wrap; overflow: visible; }
.bcard .fact { max-width: 100%; white-space: normal; }
.bc-n { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 10px; }
.bc-n div { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 9px; background: var(--panel); }
.bc-n b { display: block; font-weight: 650; font-size: var(--fs-lead); font-family: var(--mono); }
.bc-n span { font-size: var(--fs-caption); color: var(--dim); }
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--track); gap: 2px; }
.stack i { background: var(--c); }
.bc-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.cm { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: var(--fs-caption); color: var(--mute); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 1px 8px; }
.cm i { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.bc-f { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: var(--fs-caption); color: var(--dim); }
.bc-f b { color: var(--text); font-weight: 550; }
.hrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.tile-h { display: flex; margin: 0 0 8px; font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .09em; color: var(--dim); font-weight: 600; }
.tile-h span { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed .ev { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-body); color: var(--mute); text-decoration: none; }
.feed li:last-child .ev { border-bottom: 0; }
.ev-ic { width: 24px; height: 24px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line2); flex: none; }
.ev-tx { flex: 1; min-width: 0; }
.ev-tx b { color: var(--text); font-weight: 580; }
.feed time { font-size: var(--fs-caption); font-family: var(--mono); color: var(--dim); white-space: nowrap; }
.feed time.is-soon { color: var(--warn); }
.tile.attention { box-shadow: none; }

@container page (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hrow { grid-template-columns: minmax(0, 1fr); }
}

@container page (max-width: 360px) {
  .bc-n { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Board (Work tab): columns, cards, the attention strip and the category switcher.
   These rules restyle the markup that work.css lays out; work.css keeps the geometry. */
.work .wattn { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: none; }
.work .wa-cell { border-left-color: var(--line); }
.work .wa-cell:hover, .work .wa-row:hover { background: var(--panel2); }
.switcher .chip { height: 30px; padding: 0 12px; border-radius: var(--r); background: var(--panel); border-color: var(--line2); color: var(--mute); font-size: var(--fs-body); }
.switcher .chip:hover { border-color: var(--mute); color: var(--text); }
.switcher .chip.is-active { background: var(--panel3); border-color: var(--acc); color: var(--text); font-weight: 600; }
.columns { gap: 14px; }
.wcol { background: var(--colbg); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: none; }
.wcol.is-picked { border-color: var(--acc); }
.wcol.is-drop-target { border-color: var(--acc); outline: 2px solid var(--acc); outline-offset: 1px; }
.wcol-head { align-items: center; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.wcol-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--cc); flex: none; }
.wcol-head h2 { font-size: var(--fs-body); font-weight: 620; flex: 0 1 auto; }
.wcol-head .wcol-count { color: var(--dim); font-size: var(--fs-caption); font-family: var(--mono); }
.wcol-pct { margin-left: auto; color: var(--mute); font-size: var(--fs-caption); font-family: var(--mono); }
.wcol-body { padding: 10px; gap: 10px; }
.wcol-foot .wadd, .lgroup-foot .wadd { width: 100%; justify-content: center; border: 1px dashed var(--line2); border-radius: var(--r); background: none; color: var(--dim); padding: 7px; }
.wcol-foot .wadd:hover { color: var(--text); border-color: var(--mute); }

.wcard.tcard { display: block; background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--r); padding: 11px 12px; box-shadow: none; transition: border-color .12s; }
.wcard.tcard:hover { border-color: var(--mute); }
.wcard.tcard.is-selected { border: 1px solid var(--acc); padding: 11px 12px; outline: 2px solid var(--acc); outline-offset: 1px; }
.wcard.tcard.is-dragging { opacity: .4; }
.tc-top { display: flex; gap: 10px; align-items: flex-start; }
.tc-tile { width: 30px; height: 30px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center; color: var(--cc, var(--text)); background: var(--panel3); border: 1px solid var(--line2); }
.tc-tile img, .tc-tile svg { width: 16px; height: 16px; }
.wcard.tcard .wc-title { flex: 1; min-width: 0; font-weight: 590; line-height: 1.3; padding-top: 5px; color: var(--text); text-decoration: none; }
.wcard.tcard.is-closed .wc-title { color: var(--mute); }
.tc-flag { color: #fb7185; flex: none; padding-top: 5px; }
.wcard.tcard .wc-reason { margin: 6px 0 0 40px; font-size: var(--fs-caption); color: var(--bad); }
.wcard.tcard .wbar { margin-top: 10px; height: 5px; border-radius: 5px; background: var(--track); }
.wbar > i { background: var(--sc, var(--acc)); }
.wbar.is-unknown > i { width: 100% !important; background: transparent; border: 1px dashed var(--line2); box-sizing: border-box; }
.tc-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.tc-via { font-size: var(--fs-caption); color: var(--dim); }
.wcard.tcard .wc-pct { margin-left: auto; font-weight: 600; font-size: var(--fs-caption); font-family: var(--mono); color: var(--mute); }
.tc-subs { list-style: none; margin: 9px 0 0; padding: 7px 0 0; border-top: 1px solid var(--line); display: grid; gap: 3px; }
.tc-sub { display: flex; align-items: center; gap: 7px; font-size: var(--fs-caption); color: var(--mute); text-decoration: none; }
.tc-sub:hover { color: var(--text); }
.tc-sub.is-selected { color: var(--text); outline: 2px solid var(--acc); outline-offset: 1px; border-radius: var(--r-sm); }
.tc-sub.is-struck .tc-sub-t { text-decoration: line-through; }
.tc-dot { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--c); flex: none; }
.tc-dot.is-full { background: var(--c); }
.tc-w { margin-left: auto; font-size: var(--fs-caption); font-family: var(--mono); color: var(--dim); }
.tc-more { font-size: var(--fs-caption); color: var(--dim); }
.wcard.tcard .wc-meta { display: flex; align-items: center; gap: 9px; margin-top: 9px; font-size: var(--fs-caption); color: var(--dim); flex-wrap: wrap; }
.tc-m { display: inline-flex; align-items: center; gap: 4px; }
.tc-due.is-soon { color: var(--warn); }
.tc-due.is-over { color: var(--bad); }
.tc-prio { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; }
.tc-prio i { width: 3px; border-radius: 1px; background: var(--line2); }
.tc-prio.p4 i.on { background: #fb7185; } .tc-prio.p3 i.on { background: var(--warn); } .tc-prio.p2 i.on, .tc-prio.p1 i.on { background: var(--acc); }
.tc-who { margin-left: auto; color: var(--mute); }
.tc-ov { color: var(--acc2); }
.tc-sys { color: var(--dim); }
.wcard.tcard .wr-link { margin-left: 0; color: var(--mute); }
.tile.attention h2.tile-h { font-size: var(--fs-caption); font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; }

/* Add task and Note share the column foot */
.wadd-row { display: flex; gap: 8px; width: 100%; }
.wadd-row .wadd { flex: 1 1 auto; }
.wadd-row .wadd-note { flex: 0 0 auto; width: auto; color: var(--mute); }
.tc-unsaved { flex: none; align-self: center; padding: 0 6px; border: 1px solid var(--warn); border-radius: var(--r-sm); color: var(--warn); font-size: var(--fs-caption); }
.cm .cm-n { margin-left: 2px; font-family: var(--mono); font-weight: 400; color: var(--dim); }
.wr-note-text { display: block; margin-top: 2px; color: var(--mute); font-size: var(--fs-caption); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
