/* Trackwell workspace. Root rules are scoped to .uwapp-root.uwapp-trackwell (the body carries the app class too).
   Light and dark tokens follow html[data-theme] / prefers-color-scheme. CSP: no inline styles (CSSOM only). */
.uwapp-root.uwapp-trackwell {
  --tw-bg: #eef2f5; --tw-surface: #ffffff; --tw-surface-2: #eef2f6; --tw-col: #f3f5f8; --tw-ink: #15202b; --tw-muted: #4a5666;
  --tw-line: #d3dae3; --tw-control: #6b7787; --tw-accent: #0f766e; --tw-accent-ink: #0b5e58; --tw-on-accent: #ffffff;
  --tw-warn: #a3271b; --tw-warn-bg: #fde4e1; --tw-good: #0d5a2e; --tw-good-bg: #dcf5e6; --tw-focus: #b45309;
  --tw-todo-bg: #e2e8f0; --tw-todo-ink: #1e293b; --tw-prog-bg: #dbeafe; --tw-prog-ink: #1e3a8a; --tw-done-bg: #dcfce7; --tw-done-ink: #14532d;
  --tw-chip: #e8edf3; --tw-sel: #e0f2f1;
  background: var(--tw-bg); color: var(--tw-ink); color-scheme: light;
}
:root[data-theme="dark"] .uwapp-root.uwapp-trackwell {
  --tw-bg: #0f141a; --tw-surface: #19212b; --tw-surface-2: #243040; --tw-col: #141b24; --tw-ink: #edf2f7; --tw-muted: #b4bfcc;
  --tw-line: #344255; --tw-control: #8a97a8; --tw-accent: #5eead4; --tw-accent-ink: #99f6e4; --tw-on-accent: #042f2c;
  --tw-warn: #ffb3a8; --tw-warn-bg: #4a1d19; --tw-good: #9be3b5; --tw-good-bg: #143823; --tw-focus: #fbbf24;
  --tw-todo-bg: #334155; --tw-todo-ink: #f1f5f9; --tw-prog-bg: #1e3a8a; --tw-prog-ink: #dbeafe; --tw-done-bg: #14532d; --tw-done-ink: #dcfce7;
  --tw-chip: #2a3646; --tw-sel: #12403b;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .uwapp-root.uwapp-trackwell {
    --tw-bg: #0f141a; --tw-surface: #19212b; --tw-surface-2: #243040; --tw-col: #141b24; --tw-ink: #edf2f7; --tw-muted: #b4bfcc;
    --tw-line: #344255; --tw-control: #8a97a8; --tw-accent: #5eead4; --tw-accent-ink: #99f6e4; --tw-on-accent: #042f2c;
    --tw-warn: #ffb3a8; --tw-warn-bg: #4a1d19; --tw-good: #9be3b5; --tw-good-bg: #143823; --tw-focus: #fbbf24;
    --tw-todo-bg: #334155; --tw-todo-ink: #f1f5f9; --tw-prog-bg: #1e3a8a; --tw-prog-ink: #dbeafe; --tw-done-bg: #14532d; --tw-done-ink: #dcfce7;
    --tw-chip: #2a3646; --tw-sel: #12403b;
    color-scheme: dark;
  }
}

/* Platform element defaults leak into app workspaces: reset them at zero specificity. */
:where(.tw-app, .tw-dialog) button { font: inherit; font-size: .9rem; font-weight: 600; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; width: auto; min-height: 0; margin: 0; }
:where(.tw-app, .tw-dialog) button:hover { background: none; }
:where(.tw-app, .tw-dialog) :is(input, select, textarea) { font: inherit; color: var(--tw-ink); background: var(--tw-surface); border: 1px solid var(--tw-control); border-radius: 8px; width: auto; margin: 0; }
:where(.tw-app, .tw-dialog) table { border-collapse: collapse; width: 100%; margin: 0; font-size: .88rem; }
:where(.tw-app, .tw-dialog) :is(th, td) { text-align: start; padding: 6px 8px; border-bottom: 1px solid var(--tw-line); vertical-align: middle; }
:where(.tw-app, .tw-dialog) thead th { background: var(--tw-surface-2); color: var(--tw-ink); }
:where(.tw-app, .tw-dialog) kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; padding: 1px 6px; border: 1px solid var(--tw-control); border-bottom-width: 2px; border-radius: 5px; background: var(--tw-surface-2); color: var(--tw-ink); white-space: nowrap; }
:where(.tw-app, .tw-dialog) a { color: var(--tw-accent-ink); }
:where(.tw-app, .tw-dialog) :is(code, pre) { background: var(--tw-surface-2); color: var(--tw-ink); border-radius: 5px; }
:where(.tw-app, .tw-dialog) code { padding: 0 .25em; font-size: .9em; }
:where(.tw-app, .tw-dialog) pre { padding: .5rem .6rem; overflow: auto; max-width: 100%; }
:where(.tw-app, .tw-dialog) fieldset { border: 1px solid var(--tw-line); border-radius: 10px; padding: .4rem .7rem; margin: 0 0 .6rem; min-width: 0; }
:where(.tw-app, .tw-dialog) legend { font-weight: 700; font-size: .85rem; padding: 0 .3rem; }
:where(.tw-app, .tw-dialog) :is(h2, h3, h4) { color: var(--tw-ink); }
:where(.tw-app, .tw-dialog) caption { text-align: start; font-weight: 700; padding: .4rem .5rem; color: var(--tw-ink); }

.tw-app { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; background: var(--tw-bg); color: var(--tw-ink); }
.tw-app :focus-visible, .tw-dialog :focus-visible { outline: 3px solid var(--tw-focus); outline-offset: 2px; }
.tw-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
/* scroll containers must contain their absolutely positioned .tw-sr children, or those widen the page */
.tw-columns, .tw-table-wrap, .tw-tabs, .tw-wf-diagram, .tw-main, .tw-dialog-body { position: relative; }
.tw-spacer { flex: 1; min-width: 0; }
.tw-app [hidden], .tw-dialog [hidden] { display: none !important; }
.tw-portal-bar > .tw-title, .tw-portal-bar .tw-menus > :not(:last-child), .tw-portal-bar > .tw-icon-btn { display: none; }
.tw-hint { color: var(--tw-muted); font-size: .84rem; margin: .25rem 0 .5rem; }
.tw-muted { color: var(--tw-muted); font-size: .86rem; }
.tw-sub { color: var(--tw-muted); font-size: .84rem; }
.tw-error { color: var(--tw-warn); font-weight: 600; font-size: .88rem; margin: .2rem 0; }
.tw-error:empty { display: none; }
.tw-note, .tw-callout { font-size: .9rem; color: var(--tw-ink); background: var(--tw-surface-2); border-radius: 8px; padding: .5rem .75rem; margin: .5rem 0; display: flex; gap: .4rem; align-items: flex-start; flex-wrap: wrap; }
ul.tw-callout { display: block; padding-inline-start: 1.6rem; }
.tw-callout-warn { background: var(--tw-warn-bg); color: var(--tw-ink); }
.tw-callout-good { background: var(--tw-good-bg); color: var(--tw-ink); }
.tw-plain { list-style: none; margin: 0; padding: 0; }
.tw-empty { padding: 2rem 1rem; text-align: center; color: var(--tw-muted); }
.tw-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--tw-surface-2); padding: .4rem .6rem; border-radius: 6px; overflow-wrap: anywhere; }
.tw-inline { display: inline-flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: center; }
.tw-num { text-align: end; font-variant-numeric: tabular-nums; }

/* ---------- buttons and inputs */
.tw-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 34px; padding: .3rem .75rem; border: 1px solid var(--tw-control); border-radius: 8px; background: var(--tw-surface); color: var(--tw-ink); font-size: .86rem; white-space: nowrap; }
.tw-btn:hover:not([disabled]) { background: var(--tw-surface-2); }
.tw-btn[disabled], .tw-icon-btn[disabled] { opacity: .5; cursor: not-allowed; }
.tw-btn-small { min-height: 28px; padding: .15rem .5rem; font-size: .8rem; }
.tw-btn-primary, :is(.tw-app, .tw-dialog) button[type=submit].tw-btn-primary { background: var(--tw-accent); border-color: var(--tw-accent); color: var(--tw-on-accent); }
.tw-btn-primary:hover:not([disabled]), :is(.tw-app, .tw-dialog) button[type=submit].tw-btn-primary:hover:not([disabled]) { background: var(--tw-accent-ink); border-color: var(--tw-accent-ink); color: var(--tw-on-accent); }
:is(.tw-app, .tw-dialog) button[type=submit].tw-btn:not(.tw-btn-primary) { background: var(--tw-surface); color: var(--tw-ink); border: 1px solid var(--tw-control); }
.tw-btn-danger { color: var(--tw-warn); border-color: var(--tw-warn); }
.tw-icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid transparent; border-radius: 8px; color: var(--tw-ink); flex: none; position: relative; }
.tw-icon-btn:hover:not([disabled]) { background: var(--tw-surface-2); border-color: var(--tw-line); }
.tw-link-btn { color: var(--tw-accent-ink); text-align: start; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.tw-input { min-height: 34px; padding: .25rem .5rem; box-sizing: border-box; max-width: 100%; }
textarea.tw-input { width: 100%; resize: vertical; }
.tw-num-in { width: 6.5rem; }
.tw-check { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; }
.tw-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tw-file:focus-visible + *, .tw-file-btn:focus-within { outline: 3px solid var(--tw-focus); }
.tw-file-btn { cursor: pointer; }

/* ---------- toolbar, tabs, status */
.tw-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; padding: .4rem .75rem; background: var(--tw-surface); border-bottom: 1px solid var(--tw-line); }
.tw-title { display: inline-flex; align-items: center; gap: .5rem; max-width: min(40ch, 60vw); padding: .25rem .4rem; border-radius: 8px; }
.tw-title:hover { background: var(--tw-surface-2); }
.tw-title-text { font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-key-chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; font-weight: 700; padding: .1rem .4rem; border-radius: 6px; background: var(--tw-accent); color: var(--tw-on-accent); }
.tw-menus { display: flex; flex-wrap: wrap; gap: .15rem; }
.tw-menu-wrap { position: relative; }
.tw-menu-btn { display: inline-flex; align-items: center; gap: .2rem; min-height: 34px; padding: .2rem .55rem; border-radius: 8px; }
.tw-menu-btn:hover, .tw-menu-btn[aria-expanded="true"] { background: var(--tw-surface-2); }
.tw-menu { position: fixed; z-index: 50; min-width: 240px; max-height: 70vh; overflow: auto; padding: .3rem; background: var(--tw-surface); color: var(--tw-ink); border: 1px solid var(--tw-line); border-radius: 10px; box-shadow: 0 10px 30px rgb(0 0 0 / .18); }
.tw-menu-item { display: flex; justify-content: space-between; gap: 1rem; width: 100%; padding: .4rem .6rem; text-align: start; font-weight: 500; }
.tw-menu-item:hover, .tw-menu-item:focus { background: var(--tw-surface-2); }
.tw-menu-item[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.tw-menu-key { color: var(--tw-muted); font-size: .8rem; }
.tw-menu-sep { height: 1px; background: var(--tw-line); margin: .25rem 0; }
.tw-bell .tw-badge { position: absolute; top: 1px; inset-inline-end: 1px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: #b91c1c; color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; }
.tw-create { font-weight: 700; }
.tw-tabs { background: var(--tw-surface); border-bottom: 1px solid var(--tw-line); padding: 0 .75rem; overflow-x: auto; }
.tw-tablist { display: flex; gap: .2rem; list-style: none; margin: 0; padding: 0; }
.tw-tab { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .7rem; color: var(--tw-ink); text-decoration: none; border-bottom: 3px solid transparent; font-weight: 600; font-size: .9rem; white-space: nowrap; }
:where(.tw-app) .tw-tab { color: var(--tw-ink); }
.tw-tab:hover { background: var(--tw-surface-2); }
.tw-tab-on { border-bottom-color: var(--tw-accent); color: var(--tw-accent-ink); }
:where(.tw-app) .tw-tab.tw-tab-on { color: var(--tw-accent-ink); }
.tw-tab-key { font-size: .7rem; padding: 0 4px; border-width: 1px; opacity: .8; }
.tw-main { flex: 1; min-height: 0; overflow: auto; padding: .75rem 1rem 1.5rem; }
.tw-main:focus { outline: none; }
.tw-status { display: flex; flex-wrap: wrap; gap: .3rem .75rem; align-items: center; padding: .3rem .75rem; font-size: .82rem; background: var(--tw-surface); border-top: 1px solid var(--tw-line); color: var(--tw-muted); }
.tw-status-text { color: var(--tw-ink); }
.tw-view-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; margin-bottom: .5rem; }
.tw-view-head h2 { font-size: 1.25rem; margin: 0; }
.tw-view-head h2:focus { outline: none; }
.tw-filterbar { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin: .3rem 0 .7rem; }

/* ---------- type, priority, status, avatars, chips */
.tw-type { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; color: var(--tc); }
.tw-type svg { flex: none; }
.tw-type-task { --tc: #1d4ed8; } .tw-type-bug { --tc: #b91c1c; } .tw-type-story { --tc: #15803d; } .tw-type-epic { --tc: #7e22ce; }
.tw-type-subtask { --tc: #0e7490; } .tw-type-incident { --tc: #c2410c; } .tw-type-request { --tc: #4338ca; }
:root[data-theme="dark"] :is(.tw-app, .tw-dialog) .tw-type { filter: brightness(1.9) saturate(.8); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.tw-app, .tw-dialog) .tw-type { filter: brightness(1.9) saturate(.8); } }
.tw-type span:not(.tw-sr) { color: var(--tw-ink); }
.tw-prio { display: inline-flex; align-items: center; gap: .25rem; font-size: .82rem; }
.tw-prio-highest, .tw-prio-high { color: #b91c1c; } .tw-prio-medium { color: #b45309; } .tw-prio-low, .tw-prio-lowest { color: #1d4ed8; }
:root[data-theme="dark"] :is(.tw-app, .tw-dialog) :is(.tw-prio-highest, .tw-prio-high) { color: #fca5a5; }
:root[data-theme="dark"] :is(.tw-app, .tw-dialog) .tw-prio-medium { color: #fcd34d; }
:root[data-theme="dark"] :is(.tw-app, .tw-dialog) :is(.tw-prio-low, .tw-prio-lowest) { color: #93c5fd; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.tw-app, .tw-dialog) :is(.tw-prio-highest, .tw-prio-high) { color: #fca5a5; }
  :root:not([data-theme="light"]) :is(.tw-app, .tw-dialog) .tw-prio-medium { color: #fcd34d; }
  :root:not([data-theme="light"]) :is(.tw-app, .tw-dialog) :is(.tw-prio-low, .tw-prio-lowest) { color: #93c5fd; }
}
.tw-prio span:not(.tw-sr) { color: var(--tw-ink); }
.tw-lozenge { display: inline-block; padding: .05rem .45rem; border-radius: 5px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; background: var(--tw-todo-bg); color: var(--tw-todo-ink); }
.tw-lozenge.tw-cat-inprogress { background: var(--tw-prog-bg); color: var(--tw-prog-ink); }
.tw-lozenge.tw-cat-done { background: var(--tw-done-bg); color: var(--tw-done-ink); }
.tw-avatar-wrap { display: inline-flex; }
.tw-avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; font-size: .7rem; width: 26px; height: 26px; flex: none; }
.tw-avatar-s { width: 22px; height: 22px; font-size: .62rem; }
.tw-avatar-none { background: var(--tw-surface-2); color: var(--tw-muted); border: 1px dashed var(--tw-control); }
.tw-avatars { display: flex; flex-wrap: wrap; gap: .2rem; }
.tw-chip { display: inline-flex; align-items: center; gap: .2rem; padding: 0 .4rem; border-radius: 5px; background: var(--tw-chip); color: var(--tw-ink); font-size: .74rem; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-chip-epic { background: #ede9fe; color: #4c1d95; }
:root[data-theme="dark"] :is(.tw-app, .tw-dialog) .tw-chip-epic { background: #3b2a63; color: #ede9fe; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.tw-app, .tw-dialog) .tw-chip-epic { background: #3b2a63; color: #ede9fe; } }
.tw-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; font-weight: 700; color: var(--tw-muted); }
.tw-link-btn.tw-key { color: var(--tw-accent-ink); }
.tw-points { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 .3rem; border-radius: 10px; background: var(--tw-surface-2); font-size: .74rem; font-weight: 700; }
.tw-due { display: inline-flex; align-items: center; gap: .2rem; font-size: .74rem; padding: 0 .35rem; border-radius: 5px; background: var(--tw-surface-2); }
.tw-due-overdue { background: var(--tw-warn-bg); color: var(--tw-warn); font-weight: 700; }
.tw-due-done { background: var(--tw-good-bg); color: var(--tw-good); }
.tw-flag { display: inline-flex; align-items: center; gap: .2rem; font-size: .74rem; font-weight: 700; color: var(--tw-warn); }
.tw-progress { display: inline-block; width: 6rem; height: 8px; border-radius: 4px; background: var(--tw-surface-2); overflow: hidden; vertical-align: middle; }
.tw-progress-bar { display: block; height: 100%; background: var(--tw-accent); }

/* ---------- board */
.tw-columns { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.tw-col { background: var(--tw-col); border: 1px solid var(--tw-line); border-radius: 12px; padding: .5rem; min-width: 0; }
.tw-col-over { border-color: var(--tw-warn); box-shadow: inset 0 3px 0 var(--tw-warn); }
.tw-col-head { display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; margin: .1rem .2rem .5rem; color: var(--tw-muted); }
.tw-col-count { font-weight: 700; color: var(--tw-ink); }
.tw-wip-warn { display: inline-flex; align-items: center; gap: .2rem; color: var(--tw-warn); text-transform: none; letter-spacing: 0; }
.tw-col-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; min-height: 2.5rem; border-radius: 8px; }
.tw-drop { outline: 2px dashed var(--tw-accent); outline-offset: 2px; }
.tw-col-empty { color: var(--tw-muted); font-size: .84rem; margin: .4rem .2rem; }
.tw-card { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: 10px; padding: .5rem .55rem; box-shadow: 0 1px 2px rgb(0 0 0 / .06); cursor: grab; }
.tw-card-done .tw-card-sum { text-decoration: line-through; text-decoration-color: var(--tw-muted); }
.tw-dragging { opacity: .5; }
.tw-card-btn { display: block; width: 100%; text-align: start; font-weight: 600; font-size: .9rem; line-height: 1.35; color: var(--tw-ink); padding: .1rem; overflow-wrap: anywhere; }
.tw-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .4rem; }

/* ---------- backlog */
.tw-backlog-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px); gap: 1rem; align-items: start; }
.tw-backlog-main { display: grid; gap: .9rem; min-width: 0; }
.tw-section { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: 12px; padding: .6rem .75rem; min-width: 0; }
.tw-section-active { border-color: var(--tw-accent); }
.tw-section-head { display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: center; }
.tw-section-head h3 { margin: 0; font-size: 1rem; }
.tw-goal { margin: .2rem 0 .4rem; font-size: .88rem; }
.tw-rows { list-style: none; margin: .4rem 0; padding: 0; border-radius: 8px; }
.tw-row { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto auto auto auto auto; gap: .45rem; align-items: center; padding: .3rem .35rem; border-bottom: 1px solid var(--tw-line); }
.tw-row:last-child { border-bottom: 0; }
.tw-row:hover { background: var(--tw-surface-2); }
.tw-grip { color: var(--tw-muted); cursor: grab; }
.tw-row-btn { text-align: start; font-weight: 500; overflow-wrap: anywhere; color: var(--tw-ink); }
.tw-row-sprint { max-width: 10rem; font-size: .8rem; min-height: 28px; }
.tw-quick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .4rem 0; }
.tw-quick .tw-input:not(select) { flex: 1; min-width: 10rem; }
.tw-epics { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: 12px; padding: .6rem .75rem; }
.tw-epics h3 { margin: 0 0 .4rem; font-size: 1rem; }
.tw-epics ul { list-style: none; margin: 0; padding: 0; }
.tw-epics li { display: grid; gap: .2rem; padding: .4rem 0; border-bottom: 1px solid var(--tw-line); }

/* ---------- list */
.tw-querybar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tw-querybar label { font-weight: 700; }
.tw-query { flex: 1; min-width: min(28rem, 100%); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
.tw-table-wrap { overflow: auto; max-width: 100%; background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: 10px; margin: .4rem 0; }
.tw-issue-table { min-width: 860px; }
.tw-issue-table td { white-space: nowrap; }
.tw-issue-table .tw-td-sum { white-space: normal; min-width: 16rem; }
.tw-sort { font-weight: 700; text-decoration: underline dotted; text-underline-offset: 3px; }
tr.tw-selected td { background: var(--tw-sel); }

/* ---------- dashboard */
.tw-dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: .9rem; }
.tw-card-box { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: 12px; padding: .7rem .85rem; min-width: 0; }
.tw-card-box h3 { margin: 0 0 .3rem; font-size: 1rem; }
.tw-wide { grid-column: 1 / -1; }
.tw-box-head { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; justify-content: space-between; }
.tw-fig { margin: .3rem 0 0; }
.tw-fig figcaption { font-weight: 600; font-size: .86rem; margin-bottom: .2rem; }
.tw-svg { width: 100%; height: auto; max-height: 340px; display: block; }
.tw-fig-table summary { cursor: pointer; font-size: .86rem; color: var(--tw-accent-ink); font-weight: 600; margin: .3rem 0; }
:root[data-theme="dark"] .tw-chart :is(.tw-ax, text) { fill: #d4dbe5; }
:root[data-theme="dark"] .tw-chart .tw-grid { stroke: #3b4a5e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tw-chart :is(.tw-ax, text) { fill: #d4dbe5; } :root:not([data-theme="light"]) .tw-chart .tw-grid { stroke: #3b4a5e; } }

/* ---------- requests, portal */
.tw-portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: .9rem; }
.tw-intro { font-size: 1rem; max-width: 60ch; }
.tw-req { border-bottom: 1px solid var(--tw-line); padding: .5rem 0; }
.tw-req-head { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; justify-content: space-between; }
.tw-msgs { margin: .3rem 0; display: grid; gap: .3rem; }
.tw-msgs li { padding: .3rem .5rem; border-radius: 8px; background: var(--tw-surface-2); font-size: .88rem; }
.tw-msgs p { margin: .2rem 0 0; }
.tw-msg-team { border-inline-start: 3px solid var(--tw-accent); }
.tw-reply { display: flex; gap: .4rem; align-items: flex-end; margin-top: .3rem; }
.tw-reply textarea { flex: 1; }

/* ---------- dialogs */
.tw-dialog { width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--tw-line); border-radius: 14px; background: var(--tw-surface); color: var(--tw-ink); box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
.tw-dialog::backdrop { background: rgb(10 15 25 / .55); }
.tw-dialog-wide { width: min(1100px, calc(100vw - 2rem)); }
.tw-dialog-head { position: sticky; top: 0; z-index: 2; display: flex; gap: .5rem; align-items: center; justify-content: space-between; padding: .6rem .9rem; background: var(--tw-surface); border-bottom: 1px solid var(--tw-line); }
.tw-dialog-head h2 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.tw-dialog-head h2:focus { outline: none; }
.tw-dialog-lede { margin: .5rem .9rem 0; color: var(--tw-muted); font-size: .9rem; }
.tw-dialog-body { padding: .7rem .9rem 1rem; }
.tw-dialog-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.tw-form { display: grid; gap: .55rem; }
.tw-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: .55rem .8rem; }
.tw-span2 { grid-column: 1 / -1; }
.tw-field { display: grid; gap: .2rem; min-width: 0; }
.tw-field > label, .tw-field-label { font-weight: 700; font-size: .82rem; color: var(--tw-muted); }
.tw-field .tw-input { width: 100%; }
.tw-checks { display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.tw-seg { display: inline-flex; flex-wrap: wrap; gap: .2rem; padding: .2rem; border-radius: 10px; background: var(--tw-surface-2); margin: .3rem 0 .6rem; }
.tw-seg-btn { padding: .3rem .7rem; border-radius: 8px; font-size: .85rem; }
.tw-seg-btn[aria-pressed="true"] { background: var(--tw-surface); box-shadow: 0 1px 3px rgb(0 0 0 / .15); color: var(--tw-accent-ink); }

/* issue dialog */
.tw-issue { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 1.2rem; }
.tw-issue-main h3 { font-size: .95rem; margin: 1rem 0 .35rem; }
.tw-issue-head { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin-bottom: .4rem; }
.tw-summary-input { font-size: 1.05rem; font-weight: 700; }
.tw-issue-side { display: grid; gap: .55rem; align-content: start; background: var(--tw-surface-2); border-radius: 12px; padding: .7rem; }
.tw-issue-side .tw-field-value { font-size: .9rem; }
.tw-transitions { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
.tw-transitions .tw-btn { white-space: normal; text-align: start; max-width: 100%; }
.tw-md { overflow-wrap: anywhere; font-size: .92rem; line-height: 1.5; }
.tw-md :is(h3, h4, h5, h6) { margin: .7rem 0 .3rem; font-size: .95rem; }
.tw-md blockquote { margin: .4rem 0; padding: .2rem .7rem; border-inline-start: 3px solid var(--tw-line); color: var(--tw-muted); }
.tw-md-table { overflow: auto; }
.tw-md-box { display: inline-grid; place-items: center; width: 1em; height: 1em; border: 1px solid var(--tw-control); border-radius: 3px; font-size: .8em; }
.tw-md-task { list-style: none; }
.tw-md-preview { border: 1px dashed var(--tw-line); border-radius: 8px; padding: .3rem .6rem; }
.tw-md-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }
.tw-kids li, .tw-links li { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .25rem 0; border-bottom: 1px solid var(--tw-line); }
.tw-link-type { font-size: .8rem; color: var(--tw-muted); min-width: 7rem; }
.tw-attach li { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; padding: .2rem 0; }
.tw-comment { padding: .5rem 0; border-bottom: 1px solid var(--tw-line); }
.tw-comment-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tw-comment-form { display: grid; gap: .3rem; margin-top: .5rem; position: relative; }
.tw-comment-form > label { font-weight: 700; font-size: .85rem; }
.tw-mentions { list-style: none; margin: 0; padding: .2rem; border: 1px solid var(--tw-line); border-radius: 8px; background: var(--tw-surface); max-width: 20rem; }
.tw-mentions li { padding: .3rem .5rem; border-radius: 6px; cursor: pointer; }
.tw-mentions .tw-men-on { background: var(--tw-sel); }
.tw-mention-pick { max-width: 14rem; justify-self: start; }
.tw-history li { padding: .3rem 0; border-bottom: 1px solid var(--tw-line); font-size: .88rem; }
.tw-sla { font-size: .86rem; padding: .15rem 0; }
.tw-sla-breached { color: var(--tw-warn); font-weight: 700; }
.tw-sla-met { color: var(--tw-good); }
.tw-dates { line-height: 1.6; }

/* settings */
.tw-settings-tabs { position: sticky; top: 3.1rem; z-index: 1; }
.tw-subsection { margin-bottom: 1rem; }
.tw-subsection h3, .tw-wf h3, .tw-form h3 { font-size: 1rem; margin: .8rem 0 .3rem; }
.tw-edit-list li, .tw-status-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid var(--tw-line); }
.tw-cf { border: 1px solid var(--tw-line); border-radius: 10px; padding: .5rem .6rem; margin-bottom: .5rem; display: grid; gap: .3rem; }
.tw-cf-head { display: flex; gap: .5rem; align-items: center; }
.tw-matrix td { text-align: center; }
.tw-matrix input { width: 18px; height: 18px; }
.tw-tr { border: 1px solid var(--tw-line); border-radius: 10px; padding: .5rem .6rem; margin-bottom: .5rem; display: grid; gap: .35rem; }
.tw-tr-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tw-colset { border: 1px solid var(--tw-line); border-radius: 10px; padding: .5rem .6rem; margin-bottom: .5rem; }
.tw-wf-diagram { background: var(--tw-col); border: 1px solid var(--tw-line); border-radius: 10px; overflow-x: auto; }
.tw-wf-svg { width: 100%; min-width: 600px; height: auto; display: block; font-family: system-ui, sans-serif; font-size: 13px; }
.tw-wf-band { fill: var(--tw-muted); font-weight: 700; font-size: 12px; }
.tw-wf-edge { fill: none; stroke: var(--tw-control); stroke-width: 1.6; }
.tw-wf-dim { opacity: .2; }
.tw-wf-arrowhead { fill: var(--tw-control); }
.tw-wf-any { fill: var(--tw-muted); font-size: 11px; }
.tw-wf-node { cursor: pointer; }
.tw-wf-node rect { fill: var(--tw-todo-bg); stroke: var(--tw-control); stroke-width: 1.2; }
.tw-wf-node text { fill: var(--tw-todo-ink); font-weight: 700; }
.tw-wf-node.tw-cat-inprogress rect { fill: var(--tw-prog-bg); } .tw-wf-node.tw-cat-inprogress text { fill: var(--tw-prog-ink); }
.tw-wf-node.tw-cat-done rect { fill: var(--tw-done-bg); } .tw-wf-node.tw-cat-done text { fill: var(--tw-done-ink); }
.tw-wf-node.tw-wf-sel rect { stroke: var(--tw-accent); stroke-width: 3; }
.tw-wf-node:focus { outline: none; }
.tw-wf-node:focus-visible rect { stroke: var(--tw-focus); stroke-width: 4; }
.tw-tpl-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: .6rem; }
.tw-tpl { display: grid; gap: .3rem; width: 100%; text-align: start; padding: .7rem .8rem; border: 1px solid var(--tw-line); border-radius: 12px; background: var(--tw-surface); font-weight: 400; }
.tw-tpl:hover { border-color: var(--tw-accent); }
.tw-tpl strong { color: var(--tw-accent-ink); }
.tw-recent li, .tw-notices li { padding: .4rem 0; border-bottom: 1px solid var(--tw-line); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* teams read-only notice inside the app */
.tw-app > .uwt-readonly { margin: 0; border-radius: 0; }

@media (forced-colors: active) {
  .tw-lozenge, .tw-chip, .tw-points, .tw-due { border: 1px solid CanvasText; }
  .tw-wf-node rect { stroke: CanvasText; }
}
@media (prefers-reduced-motion: reduce) { .tw-app *, .tw-dialog * { transition: none !important; animation: none !important; } }
@media (max-width: 900px) {
  .tw-backlog-grid, .tw-issue { grid-template-columns: minmax(0, 1fr); }
  .tw-row { grid-template-columns: auto auto minmax(0, 1fr) auto auto; }
  .tw-row .tw-grip, .tw-row .tw-chip-epic, .tw-row .tw-prio { display: none; }
  .tw-row .tw-row-sprint { grid-column: 3 / -1; }
}
@media (max-width: 640px) {
  .tw-toolbar { padding: .35rem .5rem; }
  .tw-title { max-width: 100%; }
  .tw-main { padding: .5rem .5rem 1rem; }
  .tw-tab span:not(.tw-sr) { font-size: .82rem; }
  .tw-tab-key { display: none; }
  .tw-columns { grid-auto-columns: minmax(78vw, 1fr); }
  .tw-query { min-width: 100%; }
  .tw-dialog, .tw-dialog-wide { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); }
  .tw-settings-tabs { position: static; }
}
@media print {
  .tw-toolbar, .tw-tabs, .tw-status, .tw-filterbar, .tw-quick, .tw-row-sprint { display: none !important; }
  .tw-main { overflow: visible; }
  .tw-columns { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }
}
