/* Jours workspace: Notion-grade document canvas, quiet navigation, and interactive database. */
.jours-workspace { --sidebar-width: 224px; --rail: #f7f7f5; --surface-elevated: #ffffff; }
.dark .jours-workspace { --rail: #1c1c1c; --surface-elevated: #191919; }
.jours-workspace.sidebar-collapsed { --sidebar-width: 0px; }

.workspace-skip { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 10px 16px; background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: 6px; }
.workspace-skip:focus { top: 8px; }

.workspace-sidebar {
  position: fixed; inset: 0 auto 0 0; width: 224px; z-index: 30;
  background: var(--rail); display: flex; flex-direction: column; padding: 14px 10px 10px;
  border-right: 1px solid hsl(var(--border) / .65);
  transition: transform .16s ease-out, opacity .16s ease-out;
}
.sidebar-collapsed .workspace-sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; visibility: hidden; }
.workspace-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-size: 15px; font-weight: 650; letter-spacing: -.03em; text-decoration: none !important; }
.workspace-brand img { border-radius: 6px; }
.workspace-create {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--background));
  font-size: 13px; font-weight: 500; text-align: left;
  transition: background-color .12s ease-out, border-color .12s ease-out;
}
.workspace-create kbd { margin-left: auto; color: hsl(var(--muted-foreground)); font: inherit; font-size: 11px; opacity: .85; }
.workspace-nav-label { color: hsl(var(--muted-foreground)); font-size: 11px; font-weight: 500; padding: 22px 10px 6px; letter-spacing: .01em; }
.workspace-nav { display: grid; gap: 2px; }
.workspace-nav a, .workspace-settings {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 5px;
  color: hsl(var(--muted-foreground)); font-size: 13.5px; text-decoration: none !important;
  transition: background-color .12s ease-out, color .12s ease-out;
}
.workspace-nav a[aria-current], .workspace-settings[aria-current] { color: hsl(var(--foreground)); background: hsl(var(--foreground) / .065); font-weight: 500; }
.workspace-nav a:hover, .workspace-settings:hover, .workspace-create:hover { background: hsl(var(--foreground) / .045); color: hsl(var(--foreground)); }
.workspace-nav svg, .workspace-settings svg { flex-shrink: 0; }
.workspace-sidebar-bottom { margin-top: auto; padding-top: 8px; }
.workspace-account { display: flex; align-items: center; gap: 9px; padding: 14px 7px 4px; margin-top: 10px; border-top: 1px solid hsl(var(--border) / .7); min-width: 0; }
.workspace-avatar { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 5px; background: hsl(var(--foreground) / .08); font-size: 12px; font-weight: 600; }
.workspace-account > div { min-width: 0; flex: 1; }
.workspace-account-name, .workspace-account-email { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-account-name { font-size: 12px; font-weight: 500; }
.workspace-account-email { font-size: 10px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.workspace-account > a { display: grid; place-items: center; width: 28px; height: 32px; border-radius: 5px; color: hsl(var(--muted-foreground)); }
.workspace-account > a:hover { background: hsl(var(--foreground) / .05); color: hsl(var(--foreground)); }

.workspace-topbar {
  margin-left: var(--sidebar-width); height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 24px;
  transition: margin-left .16s ease-out;
}
.workspace-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: hsl(var(--muted-foreground)); min-width: 0; }
.workspace-breadcrumb a {
  color: inherit; text-decoration: none !important; padding: 2px 5px; margin: -2px -5px; border-radius: 4px;
  transition: background-color .12s ease-out, color .12s ease-out;
}
.workspace-breadcrumb a:hover { background: hsl(var(--foreground) / .055); color: hsl(var(--foreground)); }
.workspace-breadcrumb > svg { opacity: .45; flex-shrink: 0; }
.workspace-breadcrumb [aria-current] { color: hsl(var(--foreground)); font-weight: 500; }
.workspace-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.workspace-topbar form { margin: 0; }
.workspace-icon-btn {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 5px;
  background: transparent; color: hsl(var(--muted-foreground));
  transition: background-color .12s ease-out, color .12s ease-out;
}
.workspace-icon-btn:hover { background: hsl(var(--foreground) / .06); color: hsl(var(--foreground)); }
.jr-cmd-trigger {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px;
  border-radius: 5px; border: 0; background: transparent;
  color: hsl(var(--muted-foreground)); font-size: 12px;
  transition: background-color .12s ease-out, color .12s ease-out;
}
.jr-cmd-trigger:hover { background: hsl(var(--foreground) / .06); color: hsl(var(--foreground)); }
.jr-cmd-trigger kbd { font: inherit; font-size: 10.5px; line-height: 1.3; padding: 0 4px; border-radius: 3px; border: 1px solid hsl(var(--border)); background: hsl(var(--background)); color: hsl(var(--muted-foreground)); }

.workspace-main { margin-left: var(--sidebar-width); padding: 14px max(24px, var(--page-padding)) 56px; min-width: 0; transition: margin-left .16s ease-out; }
.workspace-main > * { max-width: var(--max-width); margin-left: auto; margin-right: auto; }
.workspace-main h1 { font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -.025em; }
.workspace-main > section > header { margin-bottom: 14px; }
.workspace-page-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.workspace-page-title { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.workspace-page-glyph { display: inline-flex; align-items: center; justify-content: center; color: hsl(var(--muted-foreground) / .8); flex-shrink: 0; }
.workspace-page-tag { font-weight: 450; color: hsl(var(--muted-foreground)); font-size: 20px; letter-spacing: -.015em; }
.workspace-page-metrics { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.workspace-page-metrics b { color: hsl(var(--foreground)); font-weight: 500; }
.workspace-page-heading > p { flex-basis: 100%; font-size: 13.5px; color: hsl(var(--muted-foreground)); margin-top: -4px; line-height: 1.55; }

.workspace-grid { padding: 0; max-width: none; }
.jr-plan-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: start; }
@media (min-width: 1024px) { .jr-plan-split { grid-template-columns: auto minmax(0, 1fr); } }
.workspace-table-layout { display: flex; align-items: flex-start; gap: 24px; }
.workspace-table-content { min-width: 0; flex: 1; }
.database-toolbar {
  display: flex; align-items: flex-end; gap: 12px; min-height: 36px; margin-bottom: 0;
  border-bottom: 1px solid hsl(var(--border)); flex-wrap: wrap;
}
.database-views { display: flex; align-items: center; gap: 2px; margin-bottom: -1px; }
.database-views a {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; font-size: 13px; color: hsl(var(--muted-foreground));
  padding: 0 8px; border-radius: 4px 4px 0 0; border-bottom: 1.5px solid transparent; text-decoration: none !important;
  transition: background-color .12s ease-out, color .12s ease-out, border-color .12s ease-out;
}
.database-views a:hover { background: hsl(var(--foreground) / .045); color: hsl(var(--foreground)); }
.database-views a[aria-current] { color: hsl(var(--foreground)); background: transparent; border-bottom-color: hsl(var(--foreground)); font-weight: 500; }
.database-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; padding-bottom: 5px; flex-wrap: wrap; }
.database-tool {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 7px;
  color: hsl(var(--muted-foreground)); border-radius: 4px; font-size: 12.5px;
  transition: background-color .12s ease-out, color .12s ease-out;
}
.database-tool:hover, .database-tool[aria-expanded=true], .database-tool[data-active=true] { background: hsl(var(--foreground) / .06); color: hsl(var(--foreground)); }
#birdview-toggle[aria-expanded=true] { background: transparent; color: hsl(var(--muted-foreground)); }
#birdview-toggle[aria-expanded=true]:hover { background: hsl(var(--foreground) / .06); color: hsl(var(--foreground)); }
.database-filter { position: relative; }
.database-filter summary { cursor: pointer; list-style: none; }
.database-filter summary::-webkit-details-marker { display: none; }
.database-filter[open] summary { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.database-filter-menu {
  position: absolute; top: 34px; right: 0; min-width: 210px; max-height: 300px; overflow-y: auto;
  border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  padding: 5px; border-radius: 8px; z-index: 35; box-shadow: 0 8px 24px #00000014;
}
.dark .database-filter-menu { box-shadow: 0 8px 28px #0000004d; }
.database-filter-menu a, .database-sort-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border-radius: 5px;
  font-size: 13px; text-align: left; text-decoration: none !important; color: hsl(var(--foreground));
}
.database-filter-menu a:hover, .database-filter-menu a[aria-current],
.database-sort-menu button:hover, .database-sort-menu button[aria-current] { background: hsl(var(--muted)); }
.database-filter-menu .jr-menu-check { margin-left: auto; opacity: 0; color: hsl(var(--foreground)); }
.database-filter-menu a[aria-current] .jr-menu-check,
.database-sort-menu button[aria-current] .jr-menu-check { opacity: 1; }

.jr-inline-search {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 7px;
  border-radius: 4px; border: 1px solid transparent; color: hsl(var(--muted-foreground));
  transition: background-color .12s ease-out, border-color .12s ease-out, color .12s ease-out;
}
.jr-inline-search:hover:not(.is-open) { background: hsl(var(--foreground) / .06); color: hsl(var(--foreground)); }
.jr-inline-search.is-open { background: hsl(var(--muted) / .55); border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.jr-inline-search input {
  width: 0; opacity: 0; padding: 0; border: 0; background: transparent; color: hsl(var(--foreground));
  font-size: 12.5px; outline: none; box-shadow: none !important;
  transition: width .14s ease-out, opacity .12s ease-out;
}
.jr-inline-search.is-open input { width: 165px; opacity: 1; }
.jr-search-clear { display: none; padding: 2px; border-radius: 3px; color: hsl(var(--muted-foreground)); }
.jr-inline-search.has-value .jr-search-clear { display: grid; place-items: center; }
.jr-search-clear:hover { color: hsl(var(--foreground)); background: hsl(var(--muted)); }

.database-new {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; margin-left: 4px;
  border-radius: 5px; font-size: 12.5px; font-weight: 500; text-decoration: none !important;
  background: #1e6ec4; color: #ffffff;
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / .14), 0 1px 1px hsl(0 0% 0% / .08);
  transition: background-color .12s ease-out, box-shadow .12s ease-out, opacity .12s ease-out;
}
.database-new:hover { background: #185ea8; color: #ffffff; }
.database-new:active { opacity: .88; }
.dark .database-new:hover { background: #2275cf; }
.database-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 10px 0 0; padding-left: 38px; color: hsl(var(--muted-foreground)); font-size: 12px; font-variant-numeric: tabular-nums; }
.database-summary b { color: hsl(var(--foreground)); font-weight: 500; }
.database-summary .database-count { margin-right: auto; }

.workspace-grid .jr-scroll { border: 0; border-radius: 0; max-height: calc(100dvh - 220px); background: transparent; }
.workspace-grid .jr-table { min-width: 100%; table-layout: fixed; font-family: var(--font-stack); }
.workspace-grid .jr-table .jr-cell { width: 100%; min-width: 0; }
.workspace-grid .jr-thead th {
  height: 33px; font-size: 12px; font-weight: 500; color: hsl(var(--muted-foreground));
  padding-top: 0; padding-bottom: 0; position: sticky; top: 0; z-index: 10;
  background: hsl(var(--background)); box-shadow: inset 0 -1px 0 hsl(var(--border));
  border-right: 1px solid hsl(var(--border) / .45);
}
.workspace-grid .jr-thead th:first-child, .workspace-grid .jr-thead th:last-child { border-right: 0; }
.workspace-grid .jr-th svg { opacity: .6; flex-shrink: 0; }
.workspace-grid .jr-property {
  display: flex; align-items: center; gap: 5px; width: 100%; height: 33px; opacity: 1; padding: 0 8px;
  text-align: left; font-family: var(--font-stack); font-size: 12px; font-weight: 500;
  color: hsl(var(--muted-foreground)); transition: background-color .12s ease-out, color .12s ease-out;
}
.workspace-grid .jr-property-right { justify-content: flex-end; }
.workspace-grid .jr-property-right .jr-chevron { margin-left: 4px; }
.workspace-grid .jr-property:hover, .workspace-grid .jr-property[aria-expanded=true] { background: hsl(var(--foreground) / .045); color: hsl(var(--foreground)); }
.jr-chevron { margin-left: auto; opacity: 0; display: inline-flex; align-items: center; transition: opacity .12s ease-out; }
.jr-property:hover .jr-chevron, .jr-property:focus-visible .jr-chevron, .jr-property[aria-expanded=true] .jr-chevron { opacity: 1; }
.jr-resize { position: absolute; top: 0; right: -4px; width: 9px; height: 33px; cursor: col-resize; touch-action: none; background: transparent; padding: 0; border: 0; z-index: 12; }
.jr-resize:hover::after, .jr-resize:focus-visible::after, .jr-resize.is-resizing::after { content: ''; position: absolute; top: 4px; bottom: 4px; left: 4px; width: 2px; border-radius: 1px; background: hsl(var(--foreground) / .45); }

.workspace-grid .jr-row { transition: background-color .12s ease-out; }
.workspace-grid .jr-row:hover { background: hsl(var(--foreground) / .028); }
.workspace-grid .jr-row td { border-right: 1px solid hsl(var(--border) / .35); padding-top: 3px; padding-bottom: 3px; }
.workspace-grid .jr-row td:first-child, .workspace-grid .jr-row td:last-child { border-right: 0; }
.workspace-grid .jr-cell { font-family: var(--font-stack); font-size: 13.5px; min-height: 29px; text-overflow: ellipsis; background: transparent; border: 0; outline: none; transition: box-shadow .12s ease-out; }
.workspace-grid .jr-cell:focus { text-overflow: clip; box-shadow: inset 0 0 0 1.5px #1e6ec4; border-radius: calc(var(--radius) - 2px); }
.dark .workspace-grid .jr-cell:focus { box-shadow: inset 0 0 0 1.5px #3b82f6; }
.workspace-grid .jr-cell[name=value] { font-variant-numeric: tabular-nums; }
.workspace-grid .jr-table td input, .workspace-grid .jr-table td select { background: transparent; }
.workspace-grid .jr-tight td { padding-top: 1px; padding-bottom: 1px; }
.workspace-grid .jr-loose td { padding-top: 7px; padding-bottom: 7px; }
.workspace-grid .jr-newrow { transition: background-color .12s ease-out; }
.workspace-grid .jr-newrow:hover { background: hsl(var(--foreground) / .025); }
.workspace-grid .jr-newrow input { font-family: var(--font-stack); font-size: 13px; padding-top: 8px; padding-bottom: 8px; }
.workspace-grid .jr-newrow input::placeholder { color: hsl(var(--muted-foreground) / .65); }
.workspace-grid .jr-row[data-active="0"] .jr-name-editor,
.workspace-grid .jr-row[data-active="0"] td:not(:nth-child(2)) > * { opacity: .48; }
.workspace-grid .jr-row[data-active="0"] td:nth-child(2) { background: hsl(var(--background)); }
.workspace-grid .jr-row:focus-within { background: hsl(var(--foreground) / .03); }
.workspace-grid .jr-row:focus-within .jr-rowadd, .workspace-grid .jr-row:focus-within .jr-rowdel,
.workspace-grid .jr-row:focus-within .jr-open-btn, .workspace-grid .jr-th:focus-within .jr-colmenu,
.workspace-grid .jr-schema:focus-visible { opacity: 1; }
.workspace-grid .jr-colmenu, .workspace-grid .jr-addcol { min-width: 24px; min-height: 24px; }
.workspace-grid .jr-rowadd, .workspace-grid .jr-rowdel {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; min-width: 20px; min-height: 20px; border-radius: 4px;
  opacity: 0; color: hsl(var(--muted-foreground)); transition: opacity .12s ease-out, color .12s ease-out, background-color .12s ease-out;
}
.workspace-grid .jr-row:hover .jr-rowadd { opacity: .6; }
.workspace-grid .jr-rowadd:hover { opacity: 1; color: hsl(var(--foreground)); background: hsl(var(--foreground) / .06); }
.workspace-grid .jr-row:hover .jr-rowdel { opacity: .5; }
.workspace-grid .jr-rowdel:hover { opacity: 1; color: var(--btn-destructive-hover-text, hsl(var(--foreground))); background: var(--btn-destructive-hover-bg, hsl(var(--foreground) / .06)); }
.workspace-grid .jr-th { position: relative; }
.workspace-grid .jr-th:hover .jr-colmenu, .workspace-grid .jr-colmenu[aria-expanded="true"] { opacity: 1; }
.workspace-grid .jr-addcol { color: hsl(var(--muted-foreground)); transition: background-color .12s ease-out, color .12s ease-out; }
.workspace-grid .jr-addcol:hover { color: hsl(var(--foreground)); background: hsl(var(--foreground) / .06); }
.workspace-grid .jr-schema { opacity: .45; color: hsl(var(--muted-foreground)); transition: opacity .12s ease-out, background-color .12s ease-out, color .12s ease-out; }
.workspace-grid .jr-thead tr:hover .jr-schema, .workspace-grid .jr-schema:hover, .workspace-grid .jr-schema[aria-expanded="true"] { opacity: 1; }
.workspace-grid .jr-schema:hover { color: hsl(var(--foreground)); background: hsl(var(--foreground) / .06); }
.jr-pop, .jr-schema-pop { border: 1px solid hsl(var(--border)); background: hsl(var(--background)); box-shadow: 0 8px 24px #00000014; }
.dark .jr-pop, .dark .jr-schema-pop { box-shadow: 0 10px 30px #0000004d; }
.jr-pop input, .jr-pop select { background: hsl(var(--background)); }
.jr-pop [disabled] { opacity: .55; cursor: default; }
.workspace-grid .jr-row td:nth-child(2) input { width: 100%; min-width: 0; }
.workspace-grid .jr-scroll td { white-space: nowrap; }

.jr-name-editor { display: flex; align-items: center; gap: 6px; position: relative; min-width: 0; padding-left: 4px; }
.jr-color-dot { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; }
.jr-name-editor svg { flex-shrink: 0; color: hsl(var(--muted-foreground)); }
.jr-name-editor input { font-weight: 500; padding-right: 54px; }
.jr-open-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 6px;
  border-radius: 4px; border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  color: hsl(var(--muted-foreground)); font-size: 11px; font-weight: 500;
  opacity: 0; transition: opacity .12s ease-out, color .12s ease-out, background-color .12s ease-out;
}
.jr-row:hover .jr-open-btn, .jr-open-btn:focus-visible { opacity: 1; }
.jr-open-btn:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }

.jr-tag-editor { position: relative; }
.jr-tag-editor input:not(:focus) { color: transparent; }
.jr-tag-editor input:not(:focus)::placeholder { color: transparent; }
.jr-tag-chips { display: flex; align-items: center; gap: 4px; position: absolute; inset: 0 8px; overflow: hidden; pointer-events: none; }
.jr-tag-chips span { background: hsl(var(--foreground) / .08); color: hsl(var(--foreground) / .85); border-radius: 4px; padding: 1.5px 6px; font-size: 11.5px; white-space: nowrap; }
.jr-tag-chips .jr-tag-empty { background: transparent; color: hsl(var(--muted-foreground) / .5); padding: 0; font-size: 13px; }
.jr-tag-chips .jr-tag-more { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); font-size: 10.5px; }
.jr-tag-editor:focus-within .jr-tag-chips { visibility: hidden; }

.jr-cell-invalid { box-shadow: inset 0 0 0 1.5px var(--input-invalid-border) !important; border-radius: calc(var(--radius) - 2px); }
.jr-bool-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 4px; border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  color: transparent; cursor: pointer; vertical-align: middle;
  transition: background-color .12s ease-out, border-color .12s ease-out, color .12s ease-out;
}
.jr-bool-toggle[aria-checked="true"] {
  background: hsl(var(--foreground)); border-color: hsl(var(--foreground)); color: hsl(var(--background));
}
.jr-bool-toggle:hover { border-color: hsl(var(--foreground) / .45); }

.jr-date-cell::-webkit-datetime-edit { color: inherit; }
.jr-date-cell[data-empty="true"]:not(:focus)::-webkit-datetime-edit { color: transparent; }
.jr-date-cell[data-empty="true"]:not(:focus)::before { content: "—"; color: hsl(var(--muted-foreground) / .5); }

.workspace-grid #table-inspector, .workspace-grid #cv-inspector { width: 256px; max-height: calc(100dvh - 210px); overflow-y: auto; }
.workspace-grid #canvas-outer { max-width: 100%; overflow-x: auto; }
.workspace-grid #canvas-outer:focus-within .cv-rail span { opacity: 1; }
.workspace-grid #canvas-outer .cv-rail { touch-action: none; }
.jours-workspace #fab { display: none; }
.jours-workspace #quick-modal, .jours-workspace #confirm-modal { padding-left: 16px; padding-right: 16px; }
.jours-workspace #quick-panel { box-shadow: 0 16px 48px #00000028; }
.jours-workspace :is(a, button, summary):focus-visible { outline: 2px solid var(--input-focus-border); outline-offset: 2px; }
.workspace-grid .canvas-heading { margin-bottom: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.workspace-grid .canvas-heading h1 { font-size: 30px; }
.workspace-grid .canvas-heading #canvas-sub { font-family: var(--font-stack); font-size: 13px; }
.workspace-connections { max-width: 1000px; }
.workspace-connections > div:first-child { margin-bottom: 16px; }
.dark .jours-workspace { --input-bg: #191919; --input-text: #e7e6e3; --input-border: #353535; --input-border-hover: #555; --input-placeholder: #939393; --btn-secondary-bg: #202020; --btn-secondary-border: #353535; }

/* Sticky Name column on horizontal overflow */
@media (max-width: 900px) {
  .workspace-grid .jr-scroll th:nth-child(2),
  .workspace-grid .jr-scroll td:nth-child(2) {
    position: sticky; left: 0; z-index: 6; background: hsl(var(--background));
    box-shadow: inset -1px 0 0 hsl(var(--border) / .55);
  }
  .workspace-grid .jr-scroll th:nth-child(2) { z-index: 12; }
  .workspace-grid .jr-scroll tr:hover td:nth-child(2) { background: hsl(var(--muted)); }
}

/* Command & Quick-Add Palette */
.jr-cmd-backdrop {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-start; justify-content: center;
  padding: min(14vh, 110px) 16px 16px; background: #00000052;
}
.jr-cmd-backdrop.hidden { display: none; }
.jr-cmd-panel {
  width: min(600px, 100%); border-radius: 12px; border: 1px solid hsl(var(--border));
  background: hsl(var(--background)); box-shadow: 0 20px 60px #00000033; overflow: hidden;
}
.jr-cmd-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); }
.jr-cmd-input-row input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 15px; outline: none; box-shadow: none !important; }
.jr-cmd-preview {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 14px;
  background: hsl(var(--muted) / .45); border-bottom: 1px solid hsl(var(--border)); font-size: 12.5px;
}
.jr-cmd-preview.hidden { display: none; }
.jr-cmd-section { padding: 10px 14px; border-bottom: 1px solid hsl(var(--border) / .7); }
.jr-cmd-section:last-child { border-bottom: 0; }
.jr-cmd-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  border: 1px solid hsl(var(--border)); background: hsl(var(--background)); font-size: 12px; color: hsl(var(--muted-foreground));
  transition: background-color .12s ease-out, color .12s ease-out;
}
.jr-cmd-chip:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.jr-cmd-list { max-height: 220px; overflow-y: auto; padding: 6px; }
.jr-cmd-list.hidden, .jr-cmd-item.hidden { display: none; }
.jr-cmd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px;
  font-size: 13px; text-align: left; color: hsl(var(--foreground)); text-decoration: none !important;
}
.jr-cmd-item:hover, .jr-cmd-item[data-selected="true"] { background: hsl(var(--muted)); }
.jr-cmd-item kbd { margin-left: auto; font: inherit; font-size: 11px; color: hsl(var(--muted-foreground)); }
.jr-swatch { width: 16px; height: 16px; border-radius: 999px; border: 1px solid transparent; transition: opacity .12s ease-out; }
.jr-swatch[aria-pressed="true"] { outline: 2px solid hsl(var(--foreground)); outline-offset: 2px; }

/* Entry Side-Peek Drawer */
.jr-peek-backdrop { position: fixed; inset: 0; z-index: 65; background: #00000038; }
.jr-peek-backdrop.hidden { display: none; }
.jr-peek {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 66; width: min(460px, 100vw);
  border-left: 1px solid hsl(var(--border)); background: hsl(var(--background));
  display: flex; flex-direction: column; box-shadow: -12px 0 40px #0000001c;
}
.jr-peek.hidden { display: none; }
.jr-peek-header { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid hsl(var(--border)); }
.jr-peek-body { flex: 1; overflow-y: auto; padding: 20px 22px 28px; display: flex; flex-direction: column; gap: 18px; }
.jr-peek-title { width: 100%; border: 0; background: transparent; padding: 2px 0; font-size: 22px; font-weight: 650; letter-spacing: -.02em; outline: none; box-shadow: none !important; }
.jr-peek-title:focus { border-bottom: 1px solid hsl(var(--border)); }
.jr-peek-props { display: grid; grid-template-columns: 118px minmax(0, 1fr); row-gap: 10px; column-gap: 12px; align-items: center; }
.jr-peek-prop-label { font-size: 12px; color: hsl(var(--muted-foreground)); display: flex; align-items: center; gap: 6px; }
.jr-peek-prop-val { min-width: 0; }
.jr-peek-input {
  width: 100%; border: 1px solid transparent; border-radius: 5px; background: transparent;
  padding: 5px 8px; font-size: 13px; transition: background-color .12s ease-out, border-color .12s ease-out;
}
.jr-peek-input:hover { background: hsl(var(--muted) / .55); }
.jr-peek-input:focus { background: hsl(var(--background)); border-color: var(--input-focus-border); outline: none; box-shadow: none !important; }
.jr-seg { display: inline-flex; padding: 2px; border-radius: 6px; border: 1px solid hsl(var(--border)); background: hsl(var(--muted) / .5); }
.jr-seg button { padding: 3px 9px; border-radius: 4px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.jr-seg button[aria-pressed="true"] { background: hsl(var(--background)); color: hsl(var(--foreground)); font-weight: 500; box-shadow: 0 1px 2px #00000010; }
.jr-tag-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 4px; background: hsl(var(--foreground) / .08); font-size: 12px; }
.jr-tag-pill button { color: hsl(var(--muted-foreground)); line-height: 1; }
.jr-tag-pill button:hover { color: hsl(var(--foreground)); }

/* Toast Region */
.jr-toast-region { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.jr-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 13px;
  border-radius: 8px; border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  font-size: 13px; box-shadow: 0 8px 24px #0000001a;
}
.jr-toast[data-kind="error"] { border-color: var(--input-invalid-border); }

/* Row selection & Notion Floating Bulk-Action Bar */
.workspace-grid .jr-gutter { width: 48px; padding: 0 !important; }
.jr-gutter-inner { display: flex; align-items: center; justify-content: flex-start; gap: 4px; width: 48px; padding: 0 4px 0 8px; box-sizing: border-box; }
.jr-gutter-plus { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 20px; font-size: 13px; color: hsl(var(--muted-foreground) / .6); }
.jr-row-check, .jr-select-all {
  width: 14px; height: 14px; margin: 0; flex-shrink: 0; accent-color: #1e6ec4; cursor: pointer;
  opacity: 0; transition: opacity .12s ease-out;
}
.jr-row:hover .jr-row-check, .jr-row:focus-within .jr-row-check, .jr-row[data-selected="true"] .jr-row-check,
.jr-thead:hover .jr-select-all, .jr-select-all:checked, .jr-select-all:indeterminate, .jr-select-all:focus-visible { opacity: .85; }
.jr-row[data-selected="true"] { background: hsl(var(--accent) / .08); }
.jr-row[data-selected="true"] td:nth-child(2) { background: color-mix(in srgb, hsl(var(--background)) 92%, hsl(var(--accent))); }
.jr-bulk-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 62;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px;
  max-width: calc(100vw - 24px); border-radius: 10px; border: 1px solid hsl(var(--border));
  background: hsl(var(--background)); box-shadow: 0 12px 36px #00000024; font-size: 12.5px;
}
.jr-bulk-bar.hidden { display: none; }
.jr-bulk-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px;
  border-radius: 6px; border: 1px solid transparent; color: hsl(var(--foreground)); font-weight: 500;
  transition: background-color .12s ease-out, color .12s ease-out;
}
.jr-bulk-btn:hover { background: hsl(var(--muted)); }
.jr-bulk-btn[data-danger="true"]:hover { color: var(--btn-destructive-hover-text); background: var(--btn-destructive-hover-bg); }
.jr-bulk-tag-form { display: inline-flex; align-items: center; gap: 4px; }
.jr-bulk-tag-form.hidden { display: none; }
.jr-bulk-tag-form input { width: 110px; height: 28px; padding: 0 8px; border-radius: 6px; border: 1px solid hsl(var(--border)); font-size: 12px; }
.jr-qa-fields { padding: 8px 14px; border-bottom: 1px solid hsl(var(--border) / .7); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: hsl(var(--muted) / .25); }
.jr-qa-fields.hidden { display: none; }

@media (max-width: 1100px) {
  .workspace-main { padding-left: max(20px, var(--page-padding)); padding-right: max(20px, var(--page-padding)); }
  .workspace-table-layout:has(#table-inspector:not(.hidden)), .workspace-table-layout:has(#cv-inspector:not(.hidden)) { flex-wrap: wrap; }
  .workspace-grid #table-inspector, .workspace-grid #cv-inspector { width: 100%; max-height: none; border-left: 0; border-top: 1px solid hsl(var(--border)); padding: 20px 0 0; }
}
@media (max-width: 800px) {
  .workspace-sidebar { top: 46px; transform: translateX(-100%); opacity: 0; pointer-events: none; visibility: hidden; width: 250px; box-shadow: 6px 8px 24px #00000018; }
  .sidebar-open .workspace-sidebar { transform: translateX(0); opacity: 1; pointer-events: auto; visibility: visible; }
  .workspace-topbar { margin-left: 0; padding: 0 14px; border-bottom: 1px solid hsl(var(--border) / .65); }
  .workspace-main { margin-left: 0; padding-top: 14px; padding-bottom: max(88px, calc(env(safe-area-inset-bottom) + 64px)); }
  .workspace-main h1, .workspace-grid .canvas-heading h1 { font-size: 22px; }
  .workspace-page-heading { margin-bottom: 12px; gap: 6px 12px; }
  .database-toolbar { gap: 6px; }
  .database-views { gap: 2px; }
  .database-tools { gap: 2px; padding-bottom: 4px; }
  .database-tool { padding: 0 7px; }
  .database-tool > .tool-label { display: none; }
  .database-new { padding: 0 9px; }
  .database-summary { padding-left: 0; }
  .jr-cmd-trigger kbd { display: none; }
  .workspace-grid .jr-scroll { max-height: calc(100dvh - 235px); }
  .jours-workspace #fab { display: flex; width: 46px; height: 46px; left: 50%; right: auto; transform: translateX(-50%); bottom: max(18px, env(safe-area-inset-bottom)); border-radius: 12px; box-shadow: 0 6px 20px #00000024; }
  .jours-workspace.sidebar-open #fab { display: none; }
  .workspace-grid .canvas-heading { flex-wrap: wrap; }
  .settings-layout { flex-direction: column; gap: 20px; }
  .settings-layout #settings-nav { position: static; width: 100%; max-height: 220px; overflow-y: auto; padding-right: 4px; }
  .settings-layout > form { width: 100%; }
  .jr-toast-region { left: 16px; right: 16px; bottom: 76px; }
}
@media (pointer: coarse) {
  .workspace-grid .jr-rowadd, .workspace-grid .jr-rowdel, .workspace-grid .jr-colmenu, .workspace-grid .jr-schema, .jr-open-btn { opacity: .8; }
  .workspace-grid .jr-cell { min-height: 36px; }
  .workspace-icon-btn, .database-tool, .database-new, .database-views a { min-height: 40px; }
  .workspace-icon-btn { min-width: 40px; }
  .workspace-grid #canvas-outer { --gut: 40px; --rail: 40px; --ch: 40px; }
}

.entry-editor { max-width: 620px; margin: 0 auto; padding: 20px 0 80px; }
.entry-editor-head { display: flex; align-items: center; gap: 24px; margin-bottom: 24px; }
.entry-editor h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.entry-editor h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.entry-fields { display: grid; gap: 16px; margin: 20px 0; }
.entry-fields label { display: grid; gap: 6px; font-size: 14px; }
.entry-fields input:not([type="checkbox"]), .entry-fields select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid hsl(var(--border)); border-radius: 6px; font-size: 16px; }
.entry-fields select { padding-right: 28px; }
.entry-fields .entry-checkbox { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.entry-checkbox input[type="checkbox"] { flex-shrink: 0; width: 20px; height: 20px; accent-color: hsl(var(--foreground)); }
.entry-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.entry-save, .receipt-pick { min-height: 44px; padding: 10px 16px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.receipt-pick { border: 1px solid hsl(var(--border)); position: relative; }
.receipt-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.receipt-pick:focus-within { outline: 2px solid var(--input-focus-border); outline-offset: 2px; }
.receipt-input, .ai-provider { border-top: 1px solid hsl(var(--border)); padding-top: 20px; margin-top: 24px; }
section.ai-provider { margin-top: 16px; padding: 18px; }
.receipt-input p, .entry-editor > p { color: hsl(var(--muted-foreground)); line-height: 1.5; font-size: 14px; margin: 12px 0; }
.receipt-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.entry-editor .entry-error { color: #c33; }
.dark .entry-error { color: #f87171; }
.entry-save:disabled, .receipt-pick:has(input:disabled) { opacity: .5; cursor: default; }
@media (max-width: 800px) { .entry-editor { padding-top: 8px; } }
@media (max-width: 380px) { .entry-field-pair { grid-template-columns: 1fr; } }

/* Encrypted workspace */
.sync-workspace { padding: 0; max-width: none; }
.sync-workspace [hidden] { display: none !important; }
.sync-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.sync-heading h1 { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.sync-eyebrow, .sync-caption, .sync-footer { color: hsl(var(--muted-foreground)); font-size: 12px; line-height: 1.5; }
.sync-eyebrow { margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.sync-intro { margin-top: 8px; max-width: 52ch; color: hsl(var(--muted-foreground)); line-height: 1.6; font-size: 14px; }
.sync-account { margin-top: 8px; font-size: 12px; color: hsl(var(--muted-foreground)); overflow-wrap: anywhere; }
.sync-unlock { max-width: 540px; padding: 24px; border: 1px solid hsl(var(--border)); border-radius: 10px; background: hsl(var(--background)); }
.sync-section-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; letter-spacing: -.015em; }
.sync-backup { margin-top: 24px; padding-top: 20px; border-top: 1px solid hsl(var(--border)); font-size: 14px; line-height: 1.6; }
.sync-recovery { display: block; overflow-wrap: anywhere; font: 13px/1.8 ui-monospace, monospace; padding: 14px 0; user-select: all; }
.sync-check { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 36px; }
.sync-check input { flex-shrink: 0; width: 16px; height: 16px; accent-color: hsl(var(--primary)); }
.sync-status-row { display: flex; align-items: center; gap: 10px; min-height: 40px; margin-bottom: 12px; font-size: 13px; }
.sync-status-row[data-error="true"] { color: #b34235; }
.dark .sync-status-row[data-error="true"] { color: #f0a195; }
.sync-progress { width: 12px; height: 12px; border: 2px solid hsl(var(--muted-foreground) / .3); border-top-color: hsl(var(--foreground)); border-radius: 50%; animation: sync-spin 1s linear infinite; flex-shrink: 0; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
.sync-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-bottom: 18px; }
.sync-secondary, .sync-text-action { font-size: 13px; padding: 8px 10px; border-radius: 5px; min-height: 36px; }
.sync-secondary:hover, .sync-text-action:hover { background: hsl(var(--muted)); }
.sync-text-action { text-decoration: underline; text-underline-offset: 3px; }
.sync-actions { position: relative; margin-left: auto; font-size: 13px; }
.sync-actions summary { cursor: pointer; padding: 8px; }
.sync-actions > div { position: absolute; right: 0; top: 100%; z-index: 10; min-width: 220px; padding: 5px; border: 1px solid hsl(var(--border)); background: hsl(var(--background)); border-radius: 6px; box-shadow: 0 6px 20px #0001; }
.sync-actions button { display: block; width: 100%; text-align: left; padding: 10px; border-radius: 4px; }
.sync-actions button:hover { background: hsl(var(--muted)); }
.sync-viewbar, .sync-tabs { display: flex; align-items: center; gap: 20px; }
.sync-viewbar { border-bottom: 1px solid hsl(var(--border)); justify-content: space-between; flex-wrap: wrap; }
.sync-tabs button { font-size: 14px; padding: 12px 0; border-bottom: 2px solid transparent; }
.sync-tabs button[aria-selected="true"] { border-bottom-color: hsl(var(--foreground)); font-weight: 500; }
.sync-search { display: flex; align-items: center; gap: 10px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.sync-search input { width: 180px; border: 0; background: transparent; padding: 10px 0; color: hsl(var(--foreground)); }
.sync-table-scroll { overflow-x: auto; }
.sync-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.sync-table th { font-weight: 500; color: hsl(var(--muted-foreground)); padding: 12px 16px 12px 0; white-space: nowrap; }
.sync-table td { padding: 14px 16px 14px 0; border-top: 1px solid hsl(var(--border) / .6); max-width: 300px; overflow-wrap: anywhere; }
.sync-table th:first-child, .sync-table td:first-child { min-width: 180px; }
.sync-table td:nth-child(2) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sync-table tr[data-paused="true"] { color: hsl(var(--muted-foreground)); }
.sync-row-actions { display: flex; gap: 12px; white-space: nowrap; }
.sync-row-actions button { text-decoration: underline; text-underline-offset: 3px; font-size: 12px; min-height: 32px; }
.sync-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-height: 48px; font-size: 12px; }
.sync-pagination span { margin-right: auto; color: hsl(var(--muted-foreground)); }
.sync-pagination button { padding: 8px 0; }
.sync-workspace button:disabled { opacity: .45; cursor: default; }
.sync-workspace :is(button, summary, a, input, select, textarea):focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 3px; }
.sync-calendar-toolbar { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.sync-calendar-toolbar h2 { font-size: 16px; font-weight: 500; }
.sync-calendar-toolbar button { min-width: 36px; min-height: 36px; font-size: 13px; }
.sync-calendar-toolbar button:last-child { margin-left: auto; }
.sync-calendar { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border-top: 1px solid hsl(var(--border)); border-left: 1px solid hsl(var(--border)); }
.sync-calendar-day { min-height: 118px; border-bottom: 1px solid hsl(var(--border)); border-right: 1px solid hsl(var(--border)); padding: 10px 8px; }
.sync-calendar-day > time { display: block; font-size: 12px; color: hsl(var(--muted-foreground)); margin-bottom: 8px; }
.sync-calendar-day[data-today="true"] > time { color: hsl(var(--foreground)); font-weight: 700; }
.sync-calendar-day > button { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1.7; text-align: left; }
.sync-calendar-day > button:hover { text-decoration: underline; }
.sync-calendar-day[data-outside="true"] { background: hsl(var(--muted) / .25); }
.sync-portable { border-top: 1px solid hsl(var(--border)); padding-top: 20px; margin-top: 24px; font-size: 13px; }
.sync-portable summary { cursor: pointer; }
.sync-portable > div { padding-top: 14px; display: grid; gap: 10px; }
.sync-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 28px; border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--background)); color: hsl(var(--foreground)); }
.sync-dialog::backdrop { background: #0006; }
.sync-dialog p { font-size: 14px; line-height: 1.6; margin: 12px 0; }
.sync-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.sync-field { display: grid; gap: 6px; font-size: 13px; margin-bottom: 16px; }
.sync-field :is(input,select,textarea) { padding: 10px; border: 1px solid hsl(var(--border)); border-radius: 5px; background: hsl(var(--background)); color: inherit; width: 100%; }
.sync-dialog-actions { display: flex; justify-content: flex-end; gap: 16px; margin-top: 24px; }
.sync-dialog-actions button { padding: 10px 14px; border-radius: 5px; }
.sync-footer { margin-top: 24px; max-width: 72ch; }
@media (max-width: 640px) {
  .sync-heading { display: block; }
  .sync-account { display: block; margin-top: 14px; }
  .sync-toolbar { gap: 6px; }
  .sync-row-actions button, .sync-secondary, .sync-text-action { min-height: 44px; }
  .sync-toolbar .sync-caption { flex-basis: 100%; order: 8; }
  .sync-viewbar { gap: 4px; }
  .sync-search { width: 100%; border-top: 1px solid hsl(var(--border) / .5); }
  .sync-search input { flex: 1; min-width: 0; }
  .sync-calendar { display: block; border-left: 0; }
  .sync-calendar-day { min-height: 0; border-right: 0; padding: 12px 0; }
  .sync-calendar-day > button { font-size: 13px; line-height: 2; }
  .sync-calendar-day[data-outside="true"], .sync-calendar-day[data-empty="true"] { display: none; }
  .sync-calendar-toolbar { gap: 10px; }
  .sync-dialog { padding: 20px; }
  .sync-form-grid { grid-template-columns: 1fr; }
  .sync-form-grid .col-span-2 { grid-column: span 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; scroll-behavior: auto !important; }
}
