/* NotMeantTo on top of gateiron-shared's brand.css: the grid, the drawer, and the few pages around them. */

:root { --row-h: 2.1rem; --cell-x: 0.55rem; }
@media (prefers-color-scheme: dark) { :root.gi-dark-auto { --grid-line: rgba(236, 229, 216, 0.09); } }
:root { --grid-line: rgba(42, 37, 32, 0.08); }

[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nmt-mark { display: block; }
kbd { font: 600 0.72rem/1 ui-monospace, monospace; padding: 0.15em 0.35em; border-radius: 4px; border: 1px solid currentColor; opacity: 0.7; }
code, pre { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 0.86rem; }
pre { background: var(--surface); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 0.8rem 1rem; overflow-x: auto; line-height: 1.5; }
.docs { max-width: 52rem; }
.narrow { max-width: 34rem; margin: 2rem auto; }
.narrow .table-wrap table { min-width: 0; }
.hero { max-width: 40rem; margin: 3rem auto; }
.hero h1 { font-size: 2.6rem; }
.lede { font-size: 1.15rem; color: var(--text-muted); }

/* ---- the grid page fills the window; the table scrolls inside it ---- */
body.is-grid main {
  max-width: none;
  padding: 0.75rem 16px 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--bar-h));
  height: calc(100dvh - var(--bar-h));
  min-height: 24rem;
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding-bottom: 0.6rem; }
.toolbar select, .toolbar input { width: auto; padding: 0.35rem 0.6rem; font-size: 0.92rem; }
.tb-project { max-width: 16rem; padding-right: 2rem !important; }
#search { width: 16rem; max-width: 100%; }
.tb-spacer { flex: 1 1 auto; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); overflow: hidden; }
main .seg button:not(.btn) { border: 0; border-radius: 0; padding: 0.3em 0.85em; font-size: 0.86rem; background: transparent; }
main .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-on); }
.toolbar #status { white-space: nowrap; }
#warn { margin: 0 0 0.6rem; padding: 0.45rem 0.8rem; font-size: 0.9rem; }

.grid-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  overscroll-behavior: contain;
}
table.grid { table-layout: fixed; width: 100%; min-width: 64rem; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
table.grid:focus { outline: none; }
.grid th, .grid td {
  height: var(--row-h);
  padding: 0 var(--cell-x);
  border-bottom: 1px solid var(--grid-line);
  border-right: 1px solid var(--grid-line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.grid thead th { position: sticky; top: 0; z-index: 2; padding: 0; background: var(--surface-2, var(--paper-dark)); }
main .grid thead th button:not(.btn) {
  all: unset; box-sizing: border-box; display: block; width: 100%; height: var(--row-h); padding: 0 var(--cell-x);
  cursor: pointer; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
  line-height: var(--row-h); overflow: hidden; text-overflow: ellipsis;
}
main .grid thead th button:not(.btn):hover { color: var(--text); }
main .grid thead th button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.grid thead sup { font-size: 0.6rem; }
.grid tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.grid tbody tr.is-current { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.grid td.is-active { box-shadow: inset 0 0 0 2px var(--accent); }
.grid:not(:focus) td.is-active { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.grid td.is-editing { overflow: visible; position: relative; box-shadow: none; }

.c-key { width: 6.2rem; }
.c-project { width: 10rem; }
.c-num { width: 3.2rem; text-align: center; font-variant-numeric: tabular-nums; }
.c-size { width: 3.4rem; text-align: center; }
.c-status { width: 7.4rem; }
.c-title { width: 30%; }
.c-desc { width: auto; color: var(--text-muted); }
.c-release { width: 6.5rem; }
.c-date { width: 6.6rem; font-variant-numeric: tabular-nums; }
.c-updated { width: 5.6rem; color: var(--text-muted); text-align: right; }

main .grid .keylink:not(.btn) { all: unset; cursor: pointer; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
main .grid .keylink:hover { text-decoration: underline; }
.blank { color: var(--text-muted); opacity: 0.6; }
.prio { display: inline-block; min-width: 1.4em; }
.prio-0 { font-weight: 800; color: var(--urgent); }
.prio-1 { font-weight: 700; }
.prio-2 { font-weight: 600; }
.prio-3 { font-weight: 400; }
.prio-4, .prio-5 { font-weight: 400; font-style: italic; color: var(--text-muted); }
.urg-hot { font-weight: 800; color: var(--urgent); }
.urg-parked { color: var(--text-muted); }
.badge-open { background: transparent; color: var(--text); border-color: var(--border-strong); }
.over { color: var(--urgent); text-decoration: underline wavy var(--urgent); }
.grid tr.is-closed td { color: var(--text-muted); }
.grid tr.s-9 .c-title span { text-decoration: line-through; }
.grid tr.is-saving { opacity: 0.55; }
.grid tr.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--ochre) 35%, transparent); } to { background: transparent; } }
.empty { text-align: center; padding: 3rem 1rem; }

/* Resizing, choosing columns, and the selection's bulk bar. */
.grid thead th { overflow: visible; }
.col-resize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 3; touch-action: none; }
.col-resize:hover, .col-resize:active { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.grid tbody tr.is-selected { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.grid tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.colmenu { position: relative; }
.colmenu > summary { list-style: none; cursor: pointer; }
.colmenu > summary::-webkit-details-marker { display: none; }
.colmenu-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 14rem; padding: 0.5rem 0.8rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.colmenu-list label { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0; font-weight: 500; }
.colmenu-list input { width: auto; }
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.6rem; padding: 0.4rem 0.7rem; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid var(--accent); font-size: 0.9rem; }
.bulk select { width: auto; padding: 0.2rem 1.8rem 0.2rem 0.5rem; font-size: 0.88rem; }

/* In-cell editor: floats over the cell, wider than it where the text needs room. */
.editor-wrap { position: absolute; inset: -1px auto auto -1px; z-index: 5; min-width: calc(100% + 2px); background: var(--surface); box-shadow: var(--shadow); border-radius: 4px; }
.editor-wrap.is-long { width: min(40rem, 70vw); }
.editor-wrap .cell-editor { display: block; width: 100%; min-width: 7rem; height: var(--row-h); padding: 0 var(--cell-x); border: 2px solid var(--accent); border-radius: 4px; font-size: 0.9rem; }
.editor-wrap select.cell-editor { padding-right: 1.6rem; }
.editor-wrap textarea.cell-editor { height: auto; min-height: 7.5rem; padding: 0.4rem var(--cell-x); line-height: 1.45; resize: vertical; }
.editor-wrap .counter { position: absolute; right: 0.4rem; bottom: -1.35rem; font-size: 0.72rem; background: var(--surface); padding: 0 0.3rem; border-radius: 3px; }
.counter { color: var(--text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--urgent); font-weight: 700; }

/* ---- drawer ---- */
.drawer {
  position: fixed; top: var(--bar-h); right: 0; bottom: 0; z-index: 15;
  width: min(34rem, 100vw); overflow-y: auto; padding: 0.4rem 1.2rem 2rem;
  background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; background: var(--surface); padding: 0.6rem 0 0.4rem; z-index: 1; }
.drawer-head h2 { margin: 0; font-size: 1.2rem; }
.drawer-head h2 .k { color: var(--accent); }
.drawer-head h2 small { font-family: 'Hanken Grotesk', system-ui, sans-serif; font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.drawer form { max-width: none; }
.drawer label { margin: 0.8rem 0 0.25rem; font-size: 0.85rem; }
.drawer input, .drawer select, .drawer textarea { font-size: 0.93rem; padding: 0.4rem 0.6rem; }
.drawer textarea { min-height: 9rem; }
.drawer [aria-invalid="true"] { border-color: var(--urgent); box-shadow: 0 0 0 1px var(--urgent); }
.df { position: relative; }
.df .counter { position: absolute; right: 0; top: 0.85rem; }
.df-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 0.75rem; }
.df-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.errors { color: var(--urgent); font-size: 0.9rem; margin: 0.6rem 0 0; }
.errors:empty { display: none; }
.lifecycle { margin-top: 1.4rem; border-top: 1px solid var(--border-color); padding-top: 0.6rem; }
.lifecycle details { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 0.35rem 0.8rem; margin: 0.5rem 0; }
.lifecycle summary { cursor: pointer; font-weight: 600; }
.lifecycle form > button { margin-top: 0.7rem; }
.history { list-style: none; padding: 0; margin: 0; font-size: 0.85rem; }
.history li { padding: 0.35rem 0; border-bottom: 1px solid var(--border-color); }
.history time { color: var(--text-muted); display: inline-block; min-width: 3.2rem; }
body.has-drawer .grid-wrap { margin-right: min(34rem, 100vw); }
@media (max-width: 900px) { body.has-drawer .grid-wrap { margin-right: 0; } }

/* ---- requests and threads ---- */
.tag { display: inline-block; margin-right: 0.4rem; padding: 0 0.45em; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 700;
  border: 1px solid var(--border-strong); color: var(--text-muted); vertical-align: 1px; }
.tag-new { border-color: var(--accent); color: var(--accent); }
.tag-wait { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.request-banner { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap;
  margin: 0.4rem 0 0.2rem; padding: 0.5rem 0.8rem; border-radius: var(--radius); border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.request-banner p { margin: 0; }
.drawer form.inline { display: inline; }
.history .entry { padding: 0.5rem 0; }
.history .entry .body { margin: 0.2rem 0 0 3.6rem; white-space: pre-wrap; font-size: 0.9rem; }
.history .entry .fallback { margin: 0.15rem 0 0 3.6rem; font-size: 0.82rem; color: var(--text-muted); font-style: italic; }
.history .kind { text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.04em; }
.history .kind-question { color: var(--warn); }
.history .kind-answer { color: var(--ok); }
.history .kind-closing { color: var(--accent); }
.history .entry-closing { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.compose { margin-top: 0.6rem; }
.compose textarea { min-height: 5rem; }
.compose > button { margin-top: 0.6rem; }

/* ---- the requests page ---- */
.requests-page table td { vertical-align: middle; }
.requests-page .arrow { color: var(--text-muted); }

/* ---- project menu, release notes ---- */
.colmenu-list a { display: block; margin: 0.35rem 0; font-weight: 500; }
dialog.notes { width: min(40rem, 92vw); max-width: none; }
dialog.notes select { width: 100%; }
dialog.notes ul { margin: 1rem 0; padding-left: 1.2rem; max-height: 50vh; overflow-y: auto; }
dialog.notes li { margin: 0.25rem 0; }
dialog.notes .df-actions form { max-width: none; }

/* ---- toasts, help ---- */
.toasts { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: min(36rem, 92vw); padding: 0.55rem 1rem; border-radius: var(--radius); background: var(--ink); color: #f3ecdd; box-shadow: var(--shadow); font-size: 0.92rem; transition: opacity 0.5s; }
.toast-error { background: var(--clay-dark); }
.toast-ok { background: var(--pine); }
.toast.out { opacity: 0; }
dialog.help { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.2rem 1.6rem; max-width: 30rem; }
dialog.help::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog.help dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; }
dialog.help dt { font-weight: 700; }
dialog.help dd { margin: 0; }

/* ---- workspace switcher (top bar) ---- */
.ws-switch { width: auto; padding: 0.25rem 1.8rem 0.25rem 0.6rem; font-size: 0.88rem; margin-right: 0.5rem; }

/* ---- admin ---- */
.admin .inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; max-width: none; margin-top: 0.8rem; align-items: center; }
.admin .inline-form input, .admin .inline-form select { width: auto; flex: 1 1 12rem; padding: 0.4rem 0.6rem; }
.admin .inline-form .short { flex: 0 0 6rem; }
.admin td select { width: auto; padding: 0.2rem 1.8rem 0.2rem 0.4rem; }
.admin tr.is-closed td { color: var(--text-muted); }
code.token { word-break: break-all; user-select: all; }

@media (max-width: 640px) {
  body.is-grid main { padding: 0.5rem 16px 0; }
  #search { width: 100%; }
  .df-row { grid-template-columns: 1fr 1fr; }
}
