/* The table workbench uses the V12 prototype palette and scale. */
.work, .workspace-floating {
  --ink: #122624;
  --muted: #69766d;
  --brand: #087f6f;
  --brand-hover: #086759;
  --brand-soft: #e7f4f0;
  --brand-stroke: #c5e0d8;
  --line: #e6ebe7;
  --soft-line: #eef2ef;
  --paper: #f9faf9;
  --grid-paper: #f9fcfb;
  --rail-paper: #f4f8f7;
  --radius: 7px;
}

.work {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 26rem;
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
  background: var(--surface);
}

.qlark-icon {
  display: inline-block;
  flex: none;
  vertical-align: middle;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
  gap: 12px;
  min-height: 58px;
  padding: 2px 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workspace-identity,
.workspace-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.workspace-identity { flex: 1; }
.workspace-head-actions { align-self: stretch; flex: 0 1 auto; }
.workspace-heading { min-width: 0; padding-bottom: 4px; }

.workspace-title-line {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.workspace-header h1 {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 725;
  letter-spacing: -.025em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.workspace-title-text,
.workspace-title-line > h1 > span {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.workspace-title-line button,
.workspace-title-line a,
.workspace-header .table-tab,
.workspace-header .table-action,
.workspace-header .table-overflow,
.workspace-account,
.workspace-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
}

.workspace-back {
  flex: none;
  width: 32px;
  padding: 0;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius);
}

.workspace-back:hover,
.workspace-back:focus-visible { background: var(--rail-paper); color: var(--ink); }

.workspace-caption {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
  margin-top: 3px;
  padding: 0;
  min-height: 15px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 11px;
}

.workspace-caption > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-caption time { flex: none; margin-inline-start: 4px; padding-inline-start: 8px; border-inline-start: 1px solid var(--line); }
.workspace-share {
  flex: none;
  padding: 0 9px;
  color: var(--brand-hover);
  background: var(--brand-soft);
  border-color: var(--brand-stroke);
  white-space: nowrap;
}

.workspace-header .table-tabs {
  display: flex;
  align-items: end;
  align-self: end;
  justify-content: end;
  min-width: 0;
  gap: 4px;
  margin-bottom: -1px;
}

.workspace-header .table-slot {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 172px;
  color: var(--muted);
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 7px 7px 0 0;
}

.workspace-header .table-slot:hover { background: var(--paper); }

.workspace-header .table-slot[data-renaming] {
  flex: 0 1 auto;
  width: clamp(125px, 45vw, 222px);
  max-width: none;
}
.workspace-header .table-inline-name {
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
}
.workspace-header .table-inline-name input {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
}
.workspace-header .table-inline-name button {
  flex: 0 0 24px;
  min-width: 24px;
  padding-inline: 0;
}

.workspace-header .table-slot.active {
  border-color: var(--brand-stroke);
  color: var(--brand-hover);
  background: var(--brand-soft);
}

.workspace-header .table-slot .table-tab {
  flex: 0 1 auto;
  justify-content: start;
  max-width: 100%;
  min-width: 0;
  padding: 0 7px;
  border: 0;
  color: inherit;
  background: none;
  text-decoration: none;
  font-weight: 610;
}

.table-tab > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.workspace-header .table-action { width: 23px; min-height: 26px; flex: none; padding: 0; }
.workspace-header .table-overflow { flex: none; padding: 0 6px; color: var(--muted); border-color: transparent; background: none; }
.workspace-header .table-overflow:hover { color: var(--ink); background: var(--rail-paper); }
.workspace-header .overflow-compact-only { display: none; }

.workspace-account {
  flex: none;
  align-self: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  color: var(--brand-hover);
  background: var(--brand-soft);
  font-weight: 720;
}

.workspace-account .cloud-account-name,
.workspace-account .cloud-account-trigger > svg { display: none; }
.workspace-account .cloud-account-trigger { padding: 0; border: 0; background: transparent; }
.workspace-title-line .workspace-title-button {
  max-width: 100%;
  min-width: 0;
  min-height: 25px;
  padding: 0 1px;
  border: 0;
  font-weight: inherit;
}
.workspace-title-button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.workspace-title-button > svg { color: var(--muted); }

.workspace-tools {
  display: flex;
  position: relative;
  flex: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 57px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workspace-tools .view-toolbar,
.workspace-tools .toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.workspace-tools .view-toolbar { flex: 1 1 auto; }
.workspace-tools .toolbar { flex: 0 1 auto; margin-inline-start: auto; }
.workspace-tools .view-alert { flex-basis: 100%; font-size: 12px; }
.workspace-tools .view-persist { margin-inline-start: auto; }
.workspace-tools .view-controls,
.workspace-tools .view-persist,
.workspace-tools .toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

.workspace-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
  white-space: nowrap;
}

.workspace-tools .view-controls button,
.workspace-tools .toolbar-actions .quiet { border-color: transparent; color: #536158; background: transparent; }
.workspace-tools .view-controls button:hover,
.workspace-tools .toolbar-actions .quiet:hover { background: #edf2ee; color: var(--ink); }
.workspace-tools .view-controls .view-enabled {
  color: var(--brand-hover);
  border-color: var(--brand-stroke);
  background: var(--brand-soft);
}

.view-condition-count {
  padding: 0 4px;
  border-radius: 4px;
  color: var(--brand-hover);
  background: #d4ebe4;
  font-size: 10px;
  line-height: 1.45;
}

.workspace-tools .view-state { font-size: 11px; }
.workspace-search-trigger { flex: none; }
.workspace-search-popover { width: min(23rem, calc(100vw - 2rem)); }
.workspace-search-popover input[type="search"] { width: 100%; }
.workspace-search-line,
.floating-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-block: 6px;
}
.workspace-tools .toolbar-actions .view-enabled {
  background: var(--brand-soft);
  color: var(--brand-hover);
}

@media (min-width: 651px) {
  .workspace-tools [data-new-record] { position: relative; margin-inline-start: 5px; }
  .workspace-tools [data-new-record]::before {
    content: "";
    position: absolute;
    inset-block: 6px;
    inset-inline-start: -6px;
    border-inline-start: 1px solid var(--line);
    pointer-events: none;
  }
}

.table-switch-menu { width: min(18rem, calc(100vw - 16px)); }
.table-switch-menu h2 { font-size: 14px; margin-bottom: 4px; }
.table-switch-menu .floating-search input { flex: 1 1 auto; width: 0; }
.table-switch-menu .all-table-list button, .height-options button {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: start;
}
.height-options { display: grid; gap: 2px; margin-top: 4px; }
.height-options button > span { flex: 1; }
.height-options button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-hover); }

@media (max-width: 950px) {
  .workspace-header .table-slot:not(.active):not([data-renaming]) { display: none; }
  .workspace-header .overflow-compact-only { display: inline-flex; }
}

@media (max-width: 650px) {
  .workspace-header { flex-direction: row; align-items: center; padding: 3px 8px 0; gap: 6px; }
  .workspace-identity,
  .workspace-head-actions,
  .workspace-title-line { gap: 5px; }
  .workspace-header h1 { font-size: 15px; }
  .workspace-header .table-tabs { align-self: center; margin-bottom: 0; gap: 3px; }
  .workspace-header .table-slot.active:not([data-renaming]) { max-width: 105px; border-radius: var(--radius); }
  .workspace-header .table-slot .table-tab { gap: 4px; padding: 0 4px; }
  .workspace-caption time { display: none; }
  .workspace-back { width: 28px; }
  .workspace-account { width: 28px; height: 28px; min-height: 28px; }
  .workspace-tools { gap: 3px 6px; min-height: 45px; padding: 5px 6px; }
  .workspace-tools .view-toolbar { flex: 1 1 auto; }
  .workspace-tools button { gap: 4px; min-height: 28px; padding-inline: 5px; font-size: 12px; }
}

@media (max-width: 420px) {
  .workspace-header .table-slot.active:not([data-renaming]) { max-width: 86px; }
  .workspace-header .table-overflow > span,
  .workspace-header .table-overflow > svg:last-child:not(:first-child) { display: none; }
}

.workspace-floating {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 10px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow: auto;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 7px 26px #142d212f;
}

button.cell-tool-trigger,
.grid button.cell-tool-trigger {
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 5px;
  min-width: 0;
  min-height: 31px;
  width: 100%;
  padding: 3px 5px;
  color: var(--muted);
  text-align: start;
}

.cell-tool-placeholder,
.cell-tool-value,
.cell-tool-chip {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cell-tool-placeholder,
.cell-tool-value { flex: 1; }
.cell-tool-value { display: flex; align-items: center; gap: 3px; color: var(--ink); }

.cell-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--chip-color, #5b9380) 14%, white);
  color: var(--ink);
}

.cell-tool-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.cell-tool-chip::before {
  flex: none;
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 50%;
  background: var(--chip-color, #5b9380);
}

.cell-tool-more { flex: none; color: var(--muted); font-size: 10px; }
.cell-tool-popover { font-size: 13px; line-height: 1.45; }
.cell-choice-popover { width: 250px; }
.cell-calendar-popover { width: 268px; }

.cell-tool-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-inline: 7px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.cell-tool-search input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 31px;
  padding: 4px 0;
  border: none;
  outline: none;
}

.cell-tool-search:focus-within { outline: 2px solid var(--brand); outline-offset: -1px; }

.cell-choice-list {
  display: grid;
  align-content: start;
  gap: 2px;
  margin-block-start: 6px;
  max-height: min(38dvh, 210px);
  overflow-y: auto;
}

.cell-choice-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  min-height: 31px;
  padding: 3px 5px;
  text-align: start;
}

.cell-choice-item[data-current],
.cell-choice-item:hover,
.cell-calendar-day:hover { background: var(--paper); }

.cell-choice-item[aria-selected="true"],
.cell-tool-check { color: var(--brand); }

.cell-tool-status,
.cell-tool-empty {
  margin: 4px 0;
  padding: 3px 4px;
  color: var(--muted);
  font-size: 12px;
}

.cell-tool-status { color: var(--danger); }
.cell-tool-footer {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin-block-start: 7px;
  padding-block-start: 5px;
  border-top: 1px solid var(--line);
}

.cell-tool-footer .cell-tool-link {
  min-height: 28px;
  padding: 2px 6px;
  color: var(--brand);
}

.cell-calendar-popover > input { width: 100%; min-height: 31px; }
.cell-calendar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block: 6px 4px;
}

.cell-calendar-heading button { width: 29px; min-height: 29px; padding: 0; }
.cell-calendar-weekdays,
.cell-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.cell-calendar-weekdays { padding: 3px 0; color: var(--muted); font-size: 12px; }
.cell-calendar-days { gap: 2px; }
.cell-calendar-days button {
  min-width: 0;
  min-height: 30px;
  padding: 0;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}

.cell-calendar-day[data-adjacent] { color: var(--muted); }
.cell-calendar-day[aria-current="date"] { border-color: var(--brand-stroke, var(--line)); }
.cell-calendar-day[aria-pressed="true"] { color: white; background: var(--brand); }
.cell-calendar-day[aria-pressed="true"]:hover { background: var(--brand-hover); }

@media (max-width: 440px) {
  button.cell-tool-trigger, .grid button.cell-tool-trigger { min-height: 29px; }
  button.cell-tool-trigger > svg:first-child { display: none; }
}
