/* Tessel: minimal, precise, enterprise. Graphite, chalk and one chartreuse signal. */
:root {
  --bg: #f5f6f3; --panel: #ffffff; --ink: #16181d; --ink-2: #3c414b; --mute: #646a75; --line: #e3e5e0; --line-2: #cfd2cc;
  --side: #16181d; --side-ink: #e9ebe6; --side-mute: #9aa0a9; --signal: #c8f04a; --signal-ink: #1d2a05;
  --blue: #3a6ea5; --amber: #b7791f; --red: #b8483d; --green: #3d7a4f;
  --r: 8px; --font: "IBM Plex Sans", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace;
}
[data-theme="dark"] { --bg: #111317; --panel: #181b20; --ink: #eceee9; --ink-2: #c7cbd1; --mute: #9aa0a9; --line: #262a31; --line-2: #333842; --side: #0b0c0f; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

.demo-bar { position: sticky; top: 0; z-index: 45; height: 37px; display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 16px; background: var(--signal); color: var(--signal-ink); font-size: 13px; }
.demo-bar a { font-weight: 600; white-space: nowrap; }
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 37px); }
.side { background: var(--side); color: var(--side-ink); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 37px; height: calc(100vh - 37px); align-self: start; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--side-ink); }
.brand svg { width: 28px; height: 28px; color: #f5f6f3; }
.cmd-open { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 8px 10px; background: #22252c; border: 1px solid #2e323a; border-radius: var(--r); color: var(--side-mute); cursor: pointer; font-size: 13px; }
.cmd-open kbd { font-family: var(--mono); font-size: 11px; background: #2e323a; padding: 1px 6px; border-radius: 4px; color: var(--side-ink); }
.views { display: grid; gap: 2px; }
.views a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); text-decoration: none; color: var(--side-mute); }
.views a:hover { background: #20232a; color: var(--side-ink); }
.views a[aria-current="page"] { background: #262a32; color: var(--side-ink); box-shadow: inset 2px 0 0 var(--signal); }
.side-foot { margin-top: auto; padding: 10px; border-top: 1px solid #2a2e35; }
.ws { margin: 0; font-size: 11px; color: var(--side-mute); font-family: var(--mono); }
.ws-name { margin: 2px 0 0; font-weight: 500; }
.ws-name span { color: var(--side-mute); font-weight: 400; }

.main { padding: 22px clamp(16px, 3vw, 36px) 48px; min-width: 0; outline: none; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.bar h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
.bar-actions { display: flex; gap: 10px; align-items: center; }
select, input[type="text"], input:not([type]), input[type="date"], input[type="number"], input[type="search"] { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 7px 10px; min-height: 36px; }
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 7px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: #2b2f37; }
[data-theme="dark"] .btn-primary { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.btn-danger { color: var(--red); margin-top: 18px; }
.icon-btn { width: 32px; height: 32px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--mute); }
.icon-btn:hover { background: var(--line); }

/* Overview */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi p { margin: 0; color: var(--mute); font-size: 12.5px; }
.kpi b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; font-feature-settings: "tnum"; }
.kpi small { color: var(--mute); font-family: var(--mono); font-size: 11.5px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card h2 span { font-weight: 400; color: var(--mute); font-size: 12.5px; }
.chart svg { width: 100%; height: auto; display: block; }
svg text { font-family: var(--font); }
svg text.mono { font-family: var(--mono); }
.views a svg { width: 16px; height: 16px; flex: none; }
.load li { display: grid; grid-template-columns: 26px 1fr 64px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.bar-track { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.bar-track i.over { background: var(--red); }
ul, ol { list-style: none; margin: 0; padding: 0; }
.av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; color: #fff; flex: none; }
.due li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.due li button { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.due li button:hover { text-decoration: underline; }
.empty { color: var(--mute); padding: 22px 0; text-align: center; }

/* Work table */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters input { min-width: 220px; flex: 1; max-width: 340px; }
.count { color: var(--mute); font-size: 12.5px; margin-left: auto; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 500; color: var(--mute); font-size: 12.5px; background: var(--panel); position: sticky; top: 0; }
th button { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font-weight: 500; }
th button[data-sort]::after { content: " ↕"; color: var(--line-2); }
th button.on[data-dir="asc"]::after { content: " ↑"; color: var(--ink); }
th button.on[data-dir="desc"]::after { content: " ↓"; color: var(--ink); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg); }
td.t { white-space: normal; min-width: 260px; font-weight: 500; }
td .k { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--mute)); }
.s-Backlog { --c: #9aa0a9; } .s-In-progress { --c: var(--blue); } .s-Review { --c: var(--amber); } .s-Done { --c: var(--green); }
.p-Urgent { color: var(--red); font-weight: 600; } .p-High { color: var(--amber); font-weight: 500; }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #ecede8; border-radius: 10px; padding: 10px; min-height: 360px; display: flex; flex-direction: column; gap: 8px; transition: background 0.15s; }
[data-theme="dark"] .col { background: #15181c; }
.col.over { background: #e2f3b6; }
[data-theme="dark"] .col.over { background: #26300f; }
.col h2 { margin: 2px 4px 4px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.col h2 span { color: var(--mute); font-weight: 400; font-family: var(--mono); font-size: 12px; }
.col h2 span.wip { color: var(--red); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03); }
.tile:active { cursor: grabbing; }
.tile.dragging { opacity: 0.4; }
.tile p { margin: 0 0 8px; font-weight: 500; line-height: 1.35; }
.tile-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--mute); }
.tile-move { display: flex; gap: 2px; }
.tile-move button { width: 24px; height: 24px; border: 1px solid var(--line); background: var(--bg); border-radius: 5px; cursor: pointer; font-size: 11px; color: var(--mute); }

/* Activity */
.feed li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.feed time { color: var(--mute); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.feed p { margin: 0; }

/* Settings */
.settings { max-width: 620px; display: grid; gap: 14px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.set-row p { margin: 2px 0 0; color: var(--mute); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 6px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.compact td, .compact th { padding-block: 6px; }
.compact .tile { padding: 7px 10px; }

/* Drawer, modal, palette */
.drawer, .modal, .cmd { position: fixed; inset: 0; z-index: 50; background: rgba(15, 17, 20, 0.36); display: flex; }
.drawer { justify-content: flex-end; }
.drawer-in { width: min(460px, 100%); height: 100%; overflow-y: auto; background: var(--panel); padding: 20px 22px; box-shadow: -20px 0 50px rgba(0, 0, 0, 0.15); animation: slide 0.22s ease; }
@keyframes slide { from { transform: translateX(30px); opacity: 0.4; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer h2, .modal h2 { margin: 8px 0 16px; font-size: 19px; letter-spacing: -0.01em; line-height: 1.3; }
.drawer-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; align-items: center; }
.drawer-grid label { color: var(--mute); font-size: 13px; }
.sub { font-size: 13px; margin: 22px 0 8px; color: var(--mute); font-weight: 500; }
.notes li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.notes small { display: block; color: var(--mute); font-family: var(--mono); font-size: 11px; }
.note-form { display: flex; gap: 8px; margin-top: 10px; }
.note-form input { flex: 1; }
.modal { align-items: center; justify-content: center; padding: 16px; }
.modal-in { width: min(520px, 100%); background: var(--panel); border-radius: 12px; padding: 20px 22px; display: grid; gap: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25); }
.f { display: grid; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.f input, .f select { width: 100%; font-weight: 400; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ferr { color: var(--red); font-size: 12.5px; font-weight: 400; }
.ferr:empty { display: none; }
[aria-invalid="true"] { border-color: var(--red) !important; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.cmd { align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.cmd-in { width: min(600px, 100%); background: var(--panel); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
.cmd-in input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 16px; background: var(--panel); outline: none; }
#cmd-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
#cmd-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 7px; cursor: pointer; }
#cmd-list li[aria-selected="true"] { background: var(--bg); box-shadow: inset 2px 0 0 var(--signal); }
#cmd-list li span { color: var(--mute); font-size: 12px; font-family: var(--mono); }
.cmd-help { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--mute); font-size: 11.5px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: 0.2s; z-index: 60; }
.toast.on { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 40; flex-direction: row; padding: 6px 8px; gap: 0; }
  .brand, .cmd-open, .side-foot { display: none; }
  .views { grid-template-columns: repeat(6, 1fr); width: 100%; }
  .views a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 2px; text-align: center; justify-content: center; min-height: 48px; }
  .views a[aria-current="page"] { box-shadow: inset 0 2px 0 var(--signal); }
  .main { padding-bottom: 96px; }
  .board { grid-template-columns: repeat(4, 84vw); scroll-snap-type: x mandatory; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
  .col { scroll-snap-align: start; min-height: 0; }
  .bar h1 { font-size: 19px; }
  .proj-pick select { max-width: 130px; }
  .demo-bar { position: static; height: auto; font-size: 12px; flex-direction: column; align-items: flex-start; gap: 2px; }
  .f-row { grid-template-columns: 1fr; }
  .filters input { min-width: 0; max-width: none; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Pagination and empty-state action */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--mute); }
.pager div { display: flex; gap: 4px; }
.pager button { min-width: 36px; min-height: 36px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); color: var(--ink); font-family: var(--mono); font-size: 12.5px; cursor: pointer; }
.pager button:hover:not(:disabled) { border-color: var(--line-2); }
.pager button[aria-current="page"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.pager button:disabled { opacity: 0.4; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; margin-left: 6px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; }
