/* The Tabulay window, rebuilt in HTML for the website. Measurements follow the
   design handoff (docs/design/README.md); colors are the app's asset catalog. */

.win {
  --row-h: 26px;
  --head-h: 42px;
  --rownum-w: 52px;
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 280px;
  height: 640px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--app-grid);
  color: var(--app-ink);
  box-shadow: var(--shadow-win);
  font: 400 13px/1.3 var(--sans);
  letter-spacing: -0.005em;
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
  contain: layout paint;
}
.win.no-side { grid-template-columns: minmax(0, 1fr) 280px; }
.win.no-insp { grid-template-columns: 220px minmax(0, 1fr); }
.win.no-side.no-insp { grid-template-columns: minmax(0, 1fr); }
.win.compact { height: 460px; }
.win .m { font-family: var(--mono); letter-spacing: 0; font-variant-numeric: tabular-nums; }

/* Sidebar (vibrancy imitation) */
.w-side { background: var(--app-side); border-right: 0.5px solid var(--app-pane-line); padding: 14px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
.w-lights { display: flex; gap: 8px; padding: 0 8px 18px; }
.w-lights i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12); }
.w-lights i:nth-child(1) { background: #ff5f57; } .w-lights i:nth-child(2) { background: #febc2e; } .w-lights i:nth-child(3) { background: #28c840; }
.w-sec { font: 600 11px/1 var(--sans); color: var(--app-ink-4); padding: 12px 8px 7px; }
.w-nav { display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 8px; border-radius: 6px; color: var(--app-ink); }
.w-nav svg { width: 15px; height: 15px; opacity: 0.6; flex: none; }
.w-nav .c { margin-left: auto; font: 400 11px/1 var(--mono); color: var(--app-ink-4); }
.w-nav.on { background: var(--app-hover); }
.w-file { display: grid; gap: 3px; padding: 6px 8px; border-radius: 6px; }
.w-file b { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-file span { font: 400 10.5px/1.2 var(--mono); color: var(--app-ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-file.on { background: var(--app-active-file); }
.w-file.on b { font-weight: 600; }
.w-file .prog { height: 3px; border-radius: 2px; background: rgba(0, 0, 0, 0.08); overflow: hidden; margin-top: 3px; }
.w-file .prog i { display: block; height: 100%; width: 64%; background: var(--app-accent-fill); }

/* Main column */
.w-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--app-grid); }
.w-bar { height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 14px; background: var(--app-bar); border-bottom: 0.5px solid var(--app-pane-line); min-width: 0; }
.w-ico { width: 28px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--app-ink-3); flex: none; }
.w-ico svg { width: 16px; height: 16px; }
.w-title { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.w-title b { font-size: 13px; font-weight: 600; color: var(--app-titlebar-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-title b em { font-style: normal; font-weight: 400; font-size: 11px; color: var(--app-ink-4); margin-left: 6px; }
.w-title span { font: 400 10.5px/1.2 var(--mono); color: var(--app-ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-seg { display: inline-flex; padding: 2px; border-radius: 7px; background: var(--app-seg-track); flex: none; }
.w-seg span { height: 22px; padding: 0 11px; display: grid; place-items: center; border-radius: 5px; font-size: 12px; color: var(--app-ink-2); }
.w-seg span.on { background: var(--app-seg-on); box-shadow: 0 0.5px 2px rgba(0, 0, 0, 0.18); color: var(--app-ink); }
.w-tools { display: flex; gap: 2px; flex: none; }
.w-tool { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 6px; color: var(--app-ink-2); font-size: 12px; }
.w-tool svg { width: 15px; height: 15px; opacity: 0.8; }
.w-search { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px; background: rgba(127, 127, 127, 0.1); color: var(--app-ink-4); font-size: 12px; width: 150px; flex: none; }
.w-search svg { width: 13px; height: 13px; }
.w-search .k { margin-left: auto; font: 400 10.5px/1 var(--mono); }
@media (max-width: 1180px) { .win .w-tool span { display: none; } }

/* Query area: chips */
.w-chips { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; background: var(--app-surface); border-bottom: 0.5px solid var(--app-pane-line); min-height: 42px; }
.w-chip { display: inline-flex; align-items: stretch; height: 24px; border-radius: 6px; background: var(--app-chip-fill); box-shadow: inset 0 0 0 0.5px var(--app-chip-border); font: 400 11.5px/24px var(--mono); letter-spacing: 0; overflow: hidden; transition: opacity 0.2s ease, transform 0.2s ease; }
.w-chip > span { padding: 0 3px; }
.w-chip > span:first-child { padding-left: 8px; font-weight: 600; }
.w-chip .op { color: var(--app-accent-text); }
.w-chip .x { padding: 0 7px; margin-left: 4px; border-left: 0.5px solid var(--app-chip-border); color: var(--app-ink-4); }
.w-chip.enter { opacity: 0; transform: scale(0.9); }
.w-add { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 6px; border: 1px dashed var(--app-card-line); color: var(--app-ink-3); font-size: 11.5px; }
.w-count { margin-left: auto; font: 400 11px/1 var(--mono); color: var(--app-ink-4); }

/* Query area: SQL editor */
.w-sql { flex: none; display: grid; grid-template-columns: 44px minmax(0, 1fr) 210px; background: var(--app-grid); border-bottom: 0.5px solid var(--app-pane-line); }
.w-gutter { background: var(--app-gutter); padding: 8px 0; font: 400 11px/19px var(--mono); color: var(--app-ink-ghost); text-align: right; padding-right: 10px; white-space: pre; }
.w-code { padding: 8px 12px; font: 400 12.5px/19px var(--mono); letter-spacing: 0; white-space: pre; overflow: hidden; color: var(--app-ink); tab-size: 2; }
.w-rail { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; border-left: 0.5px solid var(--app-pane-line); background: var(--app-surface); }
.w-rail .row { display: flex; gap: 6px; }
.w-run { height: 24px; padding: 0 10px; border-radius: 6px; background: var(--app-accent-fill); color: #1f2a17; box-shadow: inset 0 0 0 0.5px #86a56c; font: 600 12px/24px var(--sans); display: inline-flex; gap: 6px; align-items: center; }
.w-btn2 { height: 24px; padding: 0 10px; border-radius: 6px; background: var(--app-grid); box-shadow: 0 0 0 0.5px var(--app-card-line), 0 0.5px 1px rgba(0, 0, 0, 0.08); font: 500 12px/24px var(--sans); color: var(--app-ink-2); }
.w-ok { font: 400 11px/1.4 var(--mono); color: var(--app-accent-text); }
.w-plan { font: 400 10.5px/1.4 var(--mono); color: var(--app-ink-4); }
.w-err { font: 400 11px/1.4 var(--mono); color: var(--app-danger); }
.kw { color: var(--app-kw); font-weight: 600; }
.str { color: var(--app-str); }
.nm { color: var(--app-num); }
.op { color: var(--app-op); }
.fn { color: var(--app-kw); }
.cm { color: var(--app-comment); font-style: italic; }
.un { color: var(--app-unknown); }

/* Grid */
.w-grid { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: var(--app-grid); }
.w-scroll { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.w-canvas { position: relative; }
.w-head { position: sticky; top: 0; z-index: 3; display: flex; height: var(--head-h); background: var(--app-bar); border-bottom: 1px solid var(--app-header-line); width: max-content; min-width: 100%; }
.w-hc { flex: none; display: grid; align-content: center; gap: 3px; padding: 0 8px; border-right: 1px solid var(--app-cell-line); overflow: hidden; }
.w-hc b { display: flex; align-items: center; gap: 5px; font: 700 12px/1 var(--mono); letter-spacing: 0; white-space: nowrap; }
.w-hc b i { font-style: normal; font-weight: 400; color: var(--app-ink-ghost); font-size: 10px; }
.w-hc b i.on { color: var(--app-accent-text); }
.w-hc span { font: 400 10px/1 var(--mono); color: var(--app-ink-4); white-space: nowrap; }
.w-hc span em { font-style: normal; color: var(--app-danger); margin-left: 6px; }
.w-hc.sel { background: var(--app-sel-header); }
.w-hc.rn { width: var(--rownum-w); position: sticky; left: 0; z-index: 2; background: var(--app-bar); }
.w-hc.num { text-align: right; }
.w-hc.num b { justify-content: flex-end; }
.w-hc.clickable { cursor: pointer; }
.w-hc.clickable:hover { background: color-mix(in srgb, var(--app-sel-header) 60%, var(--app-bar)); }
.w-rows { position: relative; width: max-content; min-width: 100%; overflow: clip; }
.w-row { position: absolute; left: 0; right: 0; display: flex; height: var(--row-h); width: max-content; min-width: 100%; }
.w-row.z { background: var(--app-zebra); }
.w-row.sel { background: var(--app-sel-row); }
.w-c { flex: none; height: var(--row-h); padding: 0 8px; border-right: 1px solid var(--app-cell-line); border-bottom: 1px solid var(--app-cell-line); font: 400 12px/25px var(--mono); letter-spacing: 0; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-c.num { text-align: right; }
.w-c.dim { color: var(--app-ink-3); }
.w-c.pos { color: var(--app-accent-text); }
.w-c.neg { color: var(--app-ink-2); }
.w-c.null { color: var(--app-ink-ghost); font-style: italic; }
.w-c.bad { background: var(--app-danger-fill); color: var(--app-danger); }
.w-c.coltint { background: var(--app-col-tint); }
.w-row.sel .w-c.coltint { background: transparent; }
.w-c.rn { width: var(--rownum-w); position: sticky; left: 0; z-index: 1; background: var(--app-grid); color: var(--app-ink-faint); font-size: 10.5px; text-align: right; }
.w-row.z .w-c.rn { background: var(--app-zebra); }
.w-row.sel .w-c.rn { background: var(--app-sel-rownum); color: var(--app-ink-3); }
.w-c.focus { background: var(--app-grid); box-shadow: inset 0 0 0 2px var(--app-accent-strong); }
.w-c.edited { position: relative; }
.w-c.edited::after { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--app-accent-fill); }
.st-cleared { color: var(--app-accent-text); }
.st-pending { color: var(--app-warn); }
.st-failed, .st-cancelled, .st-returned { color: var(--app-danger); }
.st-reconciled, .st-delivered { color: var(--app-ink-3); }
.w-empty { padding: 60px; text-align: center; color: var(--app-ink-4); font-size: 13px; }

/* Status bar */
.w-status { height: 26px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 12px; background: var(--app-bar); border-top: 0.5px solid var(--app-pane-line); font: 400 11px/1 var(--mono); letter-spacing: 0; color: var(--app-ink-3); white-space: nowrap; overflow: hidden; }
.w-status .r { margin-left: auto; }
.w-status .pill { padding: 3px 7px; border-radius: 5px; background: var(--app-chip-fill); color: var(--app-accent-text); }

/* Inspector */
.w-insp { background: var(--app-surface); border-left: 0.5px solid var(--app-pane-line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.w-insp-head { height: 52px; flex: none; display: grid; place-items: center; border-bottom: 0.5px solid var(--app-pane-line); }
.w-insp-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; flex: 1; min-height: 0; }
.w-insp-body > * { flex-shrink: 0; }
.w-colname { display: flex; align-items: center; gap: 8px; }
.w-colname b { font: 700 16px/1.1 var(--mono); letter-spacing: 0; }
.w-type { font: 500 11px/1 var(--mono); padding: 4px 7px; border-radius: 5px; background: var(--app-chip-fill); color: var(--app-accent-text); }
.w-infer { font: 400 11px/1.45 var(--sans); color: var(--app-ink-3); }
.w-conf { height: 4px; border-radius: 2px; background: var(--app-danger-fill); overflow: hidden; }
.w-conf i { display: block; height: 100%; background: var(--app-accent-fill); transition: width 0.4s ease; }
.w-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--app-card-line); border-radius: 8px; overflow: hidden; }
.w-figs div { background: var(--app-grid); padding: 8px 9px; display: grid; gap: 3px; min-width: 0; }
.w-figs span { font-size: 10px; color: var(--app-ink-4); }
.w-figs b { font: 600 12px/1.2 var(--mono); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-figs div.w-long { padding-inline: 5px; }
.w-figs div.w-long b { font-size: 10px; letter-spacing: -0.03em; }
.w-h { font: 600 11px/1 var(--sans); color: var(--app-ink-4); }
.w-hist { display: flex; align-items: flex-end; gap: 2px; height: 64px; }
.w-hist i { flex: 1; background: var(--app-accent-fill); border-radius: 2px 2px 0 0; min-height: 2px; transition: height 0.4s ease; }
.w-hist i.neg { background: var(--app-hist-neg); }
.w-hist-l { display: flex; justify-content: space-between; font: 400 10px/1 var(--mono); color: var(--app-ink-4); }
.w-top { display: grid; gap: 5px; }
.w-top div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; font: 400 11.5px/1.2 var(--mono); position: relative; padding: 4px 6px; border-radius: 4px; overflow: hidden; }
.w-top div i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--app-chip-fill); z-index: 0; border-radius: 4px; }
.w-top div span, .w-top div b { position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-top div b { font-weight: 400; color: var(--app-ink-3); }
.w-issue { border-radius: 8px; background: var(--app-danger-soft); box-shadow: inset 0 0 0 0.5px var(--app-danger-line); padding: 10px; display: grid; gap: 6px; font-size: 11.5px; line-height: 1.4; }
.w-issue code { font: 400 11px/1.3 var(--mono); color: var(--app-danger); }
.w-ok-card { border-radius: 8px; background: var(--app-chip-fill); padding: 10px; font-size: 11.5px; color: var(--app-accent-text); }

/* Sheet (Transform, Dedupe, Compare...) hanging from the toolbar */
.w-sheet-scrim { position: absolute; inset: 52px 0 0; background: rgba(0, 0, 0, 0.06); z-index: 5; display: flex; justify-content: center; }
.w-sheet { width: min(640px, 92%); max-height: calc(100% - 12px); background: var(--app-surface); border-radius: 0 0 12px 12px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.2), 0 18px 50px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; overflow: hidden; }
.w-sheet-t { padding: 14px 16px 10px; font: 600 14px/1 var(--sans); }
.w-sheet-b { padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.w-sheet-f { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--app-bar); border-top: 0.5px solid var(--app-pane-line); font: 400 11px/1 var(--mono); color: var(--app-ink-3); }
.w-sheet-f .sp { margin-left: auto; }

/* Scaling for small screens: the window is drawn at its design size, then scaled. */
.win-frame { position: relative; width: 100%; }
.win-frame > .win { transform-origin: top left; }
.win-frame.scaled > .win { position: absolute; top: 0; left: 0; }

/* Mobile: the hero shows the window scaled like a screenshot. */
@media (max-width: 760px) {
  .win { font-size: 13px; }
}
