/* ============================================================
   MDM SORP — Airtable-style grid + multi-view system
   ============================================================ */

/* ---------- View switcher (tabs above grid) ---------- */
.at-views {
  display: flex; align-items: center; gap: 2px;
  padding: 8px 16px 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.at-view-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: var(--w-medium);
  color: var(--fg-2);
  border: 0; background: transparent;
  border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
}
.at-view-tab:hover { color: var(--fg-1); background: var(--bg-page); }
.at-view-tab.active {
  color: var(--fg-1);
  font-weight: var(--w-semibold);
  border-bottom-color: var(--sorp-red);
  background: var(--bg-surface);
}
.at-view-tab .ic { color: currentColor; opacity: 0.7; }
.at-view-tab .badge {
  font-size: 10px; padding: 1px 5px;
  background: rgba(0,0,0,0.06); border-radius: 999px;
  color: var(--fg-3); margin-left: 2px;
}
.at-view-tab.active .badge { background: var(--sorp-red-wash); color: var(--sorp-red-deep); }
.at-views .spacer { flex: 1; }
.at-views .new-view {
  font-size: 12px; color: var(--fg-3);
  background: transparent; border: 0; padding: 4px 8px;
  border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.at-views .new-view:hover { background: var(--bg-page); color: var(--fg-1); }

/* ---------- Airtable-style toolbar ---------- */
.at-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--hairline-strong);
  flex-shrink: 0;
}
.at-tool {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  font-size: 12.5px;
  font-weight: var(--w-medium);
  color: var(--fg-2);
  background: transparent;
  border: 0; border-radius: 6px;
  cursor: pointer;
  height: 28px;
  white-space: nowrap;
  position: relative;
}
.at-tool:hover { background: var(--bg-page); color: var(--fg-1); }
.at-tool.has-value {
  background: rgba(214, 61, 74, 0.06);
  color: var(--sorp-red-deep);
}
.at-tool.has-value .count {
  background: var(--sorp-red); color: white;
  font-size: 10px; padding: 0 5px; border-radius: 999px;
  min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  font-weight: var(--w-semibold);
}
.at-tool .ic { opacity: 0.75; }
.at-tool .chev { opacity: 0.5; font-size: 9px; }
.at-tool.danger:hover { background: rgba(214,61,74,0.08); color: var(--sorp-red-deep); }

.at-toolbar .sep { width: 1px; height: 18px; background: var(--hairline-strong); margin: 0 4px; }
.at-toolbar .at-search {
  position: relative;
  display: inline-flex; align-items: center;
  background: var(--bg-page);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  height: 28px;
  padding: 0 10px 0 30px;
  width: 240px;
  font-size: 12.5px;
  transition: border-color var(--dur-fast);
}
.at-toolbar .at-search .ic { position: absolute; left: 9px; color: var(--fg-3); }
.at-toolbar .at-search input {
  border: 0; background: transparent; outline: none;
  flex: 1; font-size: 12.5px;
  color: var(--fg-1);
}
.at-toolbar .at-search:focus-within { border-color: var(--sorp-red); background: var(--bg-surface); }

/* ---------- Filter / sort / group active row ---------- */
.at-active {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: #FBF9F4;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--fg-2);
  flex-wrap: wrap;
  min-height: 36px;
}
.at-active .lbl {
  font-size: 10.5px; font-weight: var(--w-semibold);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: #8B8475;
  margin-right: 2px;
}
.at-active .clause {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  font-size: 12px;
}
.at-active .clause .conj { color: var(--fg-3); font-size: 10.5px; font-weight: var(--w-medium); }
.at-active .clause .field { font-weight: var(--w-semibold); color: var(--fg-1); }
.at-active .clause .op { color: var(--fg-3); }
.at-active .clause .val { color: var(--sorp-red-deep); font-weight: var(--w-medium); }
.at-active .clause .x { color: var(--fg-3); margin-left: 2px; cursor: pointer; }
.at-active .clause .x:hover { color: var(--sorp-red); }

/* ---------- Group rows (collapsible) ---------- */
.dg tr.group-row td {
  background: #F2EEE5;
  height: 32px;
  padding: 0 16px;
  border-bottom: 1px solid var(--hairline-strong);
  font-size: 12px;
  font-weight: var(--w-semibold);
  color: var(--fg-1);
  letter-spacing: -0.005em;
  position: sticky;
  z-index: 1;
}
.dg tr.group-row:hover td { background: #ECE7DC; }
.dg tr.group-row .grow {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
}
.dg tr.group-row .caret {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  color: var(--fg-2);
  transition: transform var(--dur-fast);
}
.dg tr.group-row.collapsed .caret { transform: rotate(-90deg); }
.dg tr.group-row .gtitle { font-weight: var(--w-semibold); color: var(--fg-1); }
.dg tr.group-row .gcount {
  margin-left: 6px;
  color: var(--fg-3); font-weight: var(--w-regular);
  font-variant-numeric: tabular-nums;
}
.dg tr.group-row .gsummary {
  margin-left: auto;
  color: var(--fg-3);
  font-size: 11.5px;
  display: flex; gap: 12px;
}
.dg tr.group-row .gsummary strong { color: var(--fg-1); font-weight: var(--w-semibold); }

/* group color-bar */
.dg tr.group-row .gbar {
  display: inline-block;
  width: 3px; height: 14px; border-radius: 2px;
  background: var(--neutral-300);
  margin-right: 2px;
}

/* ---------- Color-by row left bar ---------- */
.dg tbody tr td:first-child { position: relative; }
.dg tbody tr td:first-child::before {
  content: ""; position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--row-color, transparent);
}

/* ---------- Row height variants ---------- */
.dg.row-short tbody td { height: 28px; font-size: 12px; padding-top: 0; padding-bottom: 0; }
.dg.row-medium tbody td { height: 40px; }
.dg.row-tall tbody td { height: 56px; white-space: normal; vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.dg.row-xtall tbody td { height: 96px; white-space: normal; vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.dg.row-tall .cell-with-badge, .dg.row-xtall .cell-with-badge { align-items: flex-start; }
.dg.row-tall td .v.wrap, .dg.row-xtall td .v.wrap {
  white-space: normal; word-wrap: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- Cell types: select pills, currency, date, linked records, ai-suggested ---------- */
.cell-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: var(--w-semibold);
  background: var(--sel-bg, rgba(20,23,28,0.06));
  color: var(--sel-fg, var(--fg-1));
  letter-spacing: -0.005em;
  line-height: 1.5;
  white-space: nowrap;
}
.cell-pill-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: 0.8; }

/* select palettes — Airtable-like soft tints */
.cell-pill.sel-gray   { --sel-bg: #ECEAE3;  --sel-fg: #4A4640; }
.cell-pill.sel-red    { --sel-bg: #FDE5E2;  --sel-fg: #B02A36; }
.cell-pill.sel-orange { --sel-bg: #FCE7D2;  --sel-fg: #9E5F18; }
.cell-pill.sel-yellow { --sel-bg: #FAEBA3;  --sel-fg: #6B5712; }
.cell-pill.sel-green  { --sel-bg: #D4EBDE;  --sel-fg: #266447; }
.cell-pill.sel-teal   { --sel-bg: #CFEAE7;  --sel-fg: #1F6862; }
.cell-pill.sel-blue   { --sel-bg: #D7E5F5;  --sel-fg: #2C5C8C; }
.cell-pill.sel-purple { --sel-bg: #E2DAF1;  --sel-fg: #5237A1; }
.cell-pill.sel-pink   { --sel-bg: #F5DAE5;  --sel-fg: #94365D; }
.cell-pill.sel-ink    { --sel-bg: var(--sorp-ink); --sel-fg: white; }

/* linked records (chips) */
.cell-linked {
  display: inline-flex; align-items: center; flex-wrap: nowrap;
  gap: 3px;
  max-width: 100%;
  overflow: hidden;
}
.cell-linked .chip-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 5px;
  background: var(--bg-page);
  border: 1px solid var(--hairline-strong);
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: var(--w-medium);
  color: var(--fg-1);
  cursor: pointer;
  text-decoration: none;
  max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-linked .chip-link:hover { background: var(--sorp-red-wash); border-color: var(--sorp-red-soft); color: var(--sorp-red-deep); }
.cell-linked .chip-link .flag { flex-shrink: 0; }
.cell-linked .chip-link .key {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--fg-3); margin-right: 2px;
}
.cell-linked .more {
  font-size: 11px; color: var(--fg-3);
  padding: 2px 6px;
}

/* AI-suggested empty cell */
.cell-ai-suggest {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--fg-3);
  font-style: normal;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px dashed rgba(214, 61, 74, 0.30);
  background: rgba(214, 61, 74, 0.03);
  cursor: pointer;
}
.cell-ai-suggest:hover { background: rgba(214, 61, 74, 0.06); }
.cell-ai-suggest .ic { color: var(--sorp-red); }
.cell-ai-suggest .v { color: var(--sorp-red-deep); font-weight: var(--w-medium); }

/* currency cells */
.cell-currency { display: inline-flex; align-items: baseline; gap: 4px; justify-content: flex-end; }
.cell-currency .ccy { font-size: 10px; font-weight: var(--w-semibold); color: var(--fg-3); letter-spacing: 0.04em; }
.cell-currency .v { font-variant-numeric: tabular-nums; font-weight: var(--w-medium); }

/* date cells */
.cell-date {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  color: var(--fg-1);
}
.cell-date .rel { color: var(--fg-3); font-size: 11px; margin-left: 6px; }
.cell-date.overdue { color: var(--sorp-red-deep); font-weight: var(--w-semibold); }
.cell-date.soon { color: #9E5F18; font-weight: var(--w-medium); }

/* progress bar (item completion) */
.cell-progress {
  display: inline-flex; align-items: center; gap: 6px;
  width: 100%;
}
.cell-progress .bar {
  flex: 1; min-width: 40px;
  height: 4px; background: var(--neutral-200); border-radius: 2px; overflow: hidden;
}
.cell-progress .bar i {
  display: block; height: 100%;
  background: var(--prog-color, var(--status-success));
  border-radius: 2px;
}
.cell-progress .num { font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--fg-2); min-width: 38px; text-align: right; }
.cell-progress.bad .bar i { background: var(--sorp-red); }
.cell-progress.warn .bar i { background: var(--status-warning); }

/* workflow stepper inline */
.cell-stepper {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px;
}
.cell-stepper .step {
  width: 14px; height: 4px; border-radius: 2px;
  background: var(--neutral-200);
}
.cell-stepper .step.done { background: var(--status-success); }
.cell-stepper .step.current { background: var(--sorp-red); }
.cell-stepper .label {
  margin-left: 6px;
  font-size: 11.5px; color: var(--fg-1); font-weight: var(--w-medium);
}

/* primary field — link styled, with star toggle */
.cell-primary {
  display: inline-flex; align-items: center; gap: 8px;
  width: 100%;
  min-width: 0;
}
.cell-primary .expand {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 4px;
  color: var(--fg-3); background: transparent;
  border: 0; cursor: pointer;
  opacity: 0;
}
.dg tbody tr:hover .cell-primary .expand { opacity: 1; }
.cell-primary .expand:hover { background: var(--bg-surface); color: var(--sorp-red); box-shadow: 0 0 0 1px var(--hairline-strong); }
.cell-primary .title {
  flex: 1; min-width: 0;
  font-weight: var(--w-medium);
  color: var(--fg-1);
  overflow: hidden; text-overflow: ellipsis;
}
.dg.row-tall .cell-primary .title, .dg.row-xtall .cell-primary .title {
  white-space: normal; word-wrap: break-word;
}

/* system-link pills inside a deal row */
.cell-systems {
  display: inline-flex; gap: 3px; align-items: center;
}
.cell-systems .sys {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 18px;
  font-size: 9px; font-weight: var(--w-bold);
  letter-spacing: 0.04em;
  border-radius: 3px;
  border: 1px solid currentColor;
  opacity: 0.85;
  text-transform: uppercase;
}
.cell-systems .sys.amo   { color: #1F73C7; }
.cell-systems .sys.asana { color: #D14545; }
.cell-systems .sys.drive { color: #1A73E8; }
.cell-systems .sys.onec  { color: #C7A218; }
.cell-systems .sys.missing { color: var(--neutral-300); border-style: dashed; }

/* row action buttons that show on hover */
.cell-actions {
  display: inline-flex; gap: 2px; align-items: center;
  opacity: 0; transition: opacity var(--dur-fast);
}
.dg tbody tr:hover .cell-actions { opacity: 1; }
.cell-actions .btn-mini {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  background: transparent; border: 0;
  color: var(--fg-2); cursor: pointer;
}
.cell-actions .btn-mini:hover { background: var(--bg-page); color: var(--fg-1); }
.cell-actions .btn-mini.danger:hover { color: var(--sorp-red); }

/* row-number column */
.dg .rownum {
  width: 36px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-disabled);
  text-align: right; padding-right: 12px;
  font-variant-numeric: tabular-nums;
}
.dg tbody tr:hover .rownum { color: var(--fg-3); }

/* ============================================================
   KANBAN VIEW
   ============================================================ */
.at-kanban {
  flex: 1; min-height: 0; overflow: auto;
  background: var(--bg-page);
  padding: 16px 12px;
}
.at-kanban-row {
  display: inline-flex; gap: 12px;
  align-items: flex-start;
  height: 100%;
  padding-bottom: 16px;
}
.at-stack {
  width: 280px; flex-shrink: 0;
  background: rgba(20,23,28,0.025);
  border-radius: 10px;
  padding: 8px;
  display: flex; flex-direction: column;
  max-height: 100%;
  min-height: 200px;
}
.at-stack-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 10px;
  font-size: 12.5px;
}
.at-stack-head .swatch {
  width: 8px; height: 8px; border-radius: 2px;
  flex-shrink: 0;
  background: var(--swatch, var(--neutral-300));
}
.at-stack-head .name { font-weight: var(--w-semibold); }
.at-stack-head .count {
  color: var(--fg-3); font-variant-numeric: tabular-nums;
  margin-left: 4px;
}
.at-stack-head .sum { color: var(--fg-3); margin-left: auto; font-size: 11.5px; }
.at-stack-head .add {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px; border: 0; background: transparent;
  color: var(--fg-3); cursor: pointer;
}
.at-stack-head .add:hover { background: var(--bg-surface); color: var(--fg-1); }
.at-stack-cards {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 6px;
  overflow: auto;
  padding: 2px 0;
}
.at-card {
  background: var(--bg-surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  position: relative;
  font-size: 12.5px;
  transition: box-shadow var(--dur-fast);
}
.at-card:hover { box-shadow: 0 4px 12px rgba(20,23,28,0.06); }
.at-card .id { font-family: var(--font-mono); color: var(--sorp-red); font-weight: var(--w-semibold); font-size: 11.5px; }
.at-card .ttl { font-weight: var(--w-medium); margin-top: 4px; line-height: 1.4; }
.at-card .meta {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  margin-top: 8px;
  font-size: 11px; color: var(--fg-3);
}
.at-card .row {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px;
  margin-top: 6px;
  color: var(--fg-2);
}
.at-card .row.num { font-variant-numeric: tabular-nums; font-weight: var(--w-medium); }
.at-card .bar { height: 3px; background: var(--neutral-200); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.at-card .bar i { display: block; height: 100%; background: var(--card-color, var(--sorp-red)); }

/* ============================================================
   GALLERY VIEW
   ============================================================ */
.at-gallery {
  flex: 1; min-height: 0; overflow: auto;
  background: var(--bg-page);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 16px;
}
.at-gallery-card {
  background: var(--bg-surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  font-size: 13px;
  transition: box-shadow var(--dur-fast);
}
.at-gallery-card:hover { box-shadow: 0 6px 18px rgba(20,23,28,0.08); }
.at-gallery-card .cover {
  height: 80px; background: var(--cover, linear-gradient(135deg, #FBF9F4, #F2EEE5));
  position: relative;
  display: flex; align-items: flex-end; padding: 12px;
}
.at-gallery-card .cover .id {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--sorp-red); font-weight: var(--w-bold);
  background: var(--bg-surface); padding: 3px 8px; border-radius: 5px;
}
.at-gallery-card .body { padding: 12px 14px 14px; }
.at-gallery-card .ttl { font-weight: var(--w-semibold); line-height: 1.35; font-size: 14px; }
.at-gallery-card .meta { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.at-gallery-card .stats {
  display: flex; gap: 12px;
  margin-top: 10px;
  font-size: 11px; color: var(--fg-3);
}
.at-gallery-card .stats strong { color: var(--fg-1); font-size: 13px; font-weight: var(--w-semibold); display: block; }

/* ============================================================
   CALENDAR VIEW
   ============================================================ */
.at-cal {
  flex: 1; min-height: 0; overflow: auto;
  background: var(--bg-surface);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--hairline);
}
.at-cal-h, .at-cal-d {
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 8px;
  min-height: 110px;
  font-size: 11.5px;
  position: relative;
}
.at-cal-h {
  background: #FBF9F4;
  font-weight: var(--w-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8B8475;
  font-size: 10.5px;
  text-align: center;
  min-height: 28px;
  padding: 8px;
}
.at-cal-d .dn {
  font-size: 12px; font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--fg-2);
  margin-bottom: 4px;
}
.at-cal-d.today .dn { color: var(--sorp-red); }
.at-cal-d.today { background: rgba(214, 61, 74, 0.025); }
.at-cal-d.muted { background: #FBF9F4; }
.at-cal-d.muted .dn { color: var(--fg-disabled); }
.at-cal-evt {
  display: block;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: var(--w-medium);
  color: var(--evt-fg, var(--fg-1));
  background: var(--evt-bg, rgba(20,23,28,0.06));
  margin-top: 2px;
  cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============================================================
   EXPANDED RECORD SIDESHEET (record detail)
   ============================================================ */
.at-sheet { width: 760px; max-width: 96vw; }
.at-sheet .drawer-head {
  padding: 20px 28px 16px;
  background: var(--bg-surface);
}
.at-sheet .at-sheet-stepper {
  display: flex; align-items: center; gap: 0;
  margin: 14px 0 4px;
  padding: 6px;
  background: var(--bg-page);
  border-radius: 8px;
  border: 1px solid var(--hairline);
  font-size: 11.5px;
}
.at-sheet .at-sheet-stepper .step {
  flex: 1; padding: 5px 8px;
  text-align: center;
  border-radius: 5px;
  color: var(--fg-3);
  font-weight: var(--w-medium);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.at-sheet .at-sheet-stepper .step:hover { color: var(--fg-1); }
.at-sheet .at-sheet-stepper .step.done { color: var(--status-success); }
.at-sheet .at-sheet-stepper .step.current {
  background: var(--bg-surface);
  color: var(--fg-1);
  font-weight: var(--w-semibold);
  box-shadow: 0 1px 3px rgba(20,23,28,0.06);
}

.at-sheet .sheet-actions {
  display: flex; align-items: center; gap: 6px;
  padding: 0 28px 18px;
  flex-wrap: wrap;
}

.at-sheet .sheet-fields {
  padding: 0 28px 24px;
}
.at-sheet .group-title {
  font-size: 11px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8B8475;
  padding: 20px 0 8px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}

/* big tabs inside the sheet */
.at-sheet .sheet-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--hairline-strong);
  padding: 0 28px;
  background: var(--bg-surface);
}
.at-sheet .sheet-tabs .t {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: var(--w-medium);
  color: var(--fg-3);
  border: 0; background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.at-sheet .sheet-tabs .t.active { color: var(--fg-1); font-weight: var(--w-semibold); border-bottom-color: var(--sorp-red); }
.at-sheet .sheet-tabs .t .count { font-size: 10.5px; color: var(--fg-3); }

/* comments thread */
.at-comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.at-comment:last-child { border-bottom: 0; }
.at-comment .body { flex: 1; font-size: 13px; line-height: 1.5; }
.at-comment .body .who { font-weight: var(--w-semibold); font-size: 12.5px; }
.at-comment .body .when { color: var(--fg-3); font-size: 11px; margin-left: 6px; }
.at-comment .body .text { margin-top: 4px; color: var(--fg-1); }
.at-comment .body .mention { color: var(--sorp-red-deep); font-weight: var(--w-semibold); }

/* empty cell styling for Airtable feel */
.dg td .cell-empty {
  color: var(--fg-disabled);
  font-size: 11.5px;
}

/* popover (filter / sort / group menus) */
.at-popover {
  position: absolute; z-index: 200;
  top: calc(100% + 4px); left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(20,23,28,0.12), 0 2px 6px rgba(20,23,28,0.06);
  min-width: 320px;
  padding: 10px;
  font-size: 13px;
}
.at-popover .pop-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.at-popover .pop-row select, .at-popover .pop-row input {
  border: 1px solid var(--hairline-strong); border-radius: 6px;
  padding: 4px 8px; font-size: 12.5px;
  background: var(--bg-page);
  font-family: var(--font-sans);
  outline: none;
}
.at-popover .pop-row select:focus, .at-popover .pop-row input:focus { border-color: var(--sorp-red); background: var(--bg-surface); }
.at-popover .pop-row .field-name { flex: 1; font-weight: var(--w-medium); }
.at-popover .pop-row .x { color: var(--fg-3); cursor: pointer; padding: 2px 4px; }
.at-popover .pop-row .x:hover { color: var(--sorp-red); }
.at-popover h4 { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #8B8475; margin: 0 0 8px; }
.at-popover .pop-add {
  font-size: 12px; color: var(--sorp-red); cursor: pointer;
  background: transparent; border: 0; padding: 6px 0 0;
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: var(--w-semibold);
}

/* hide-fields list */
.at-popover .field-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12.5px;
  cursor: pointer;
}
.at-popover .field-toggle:hover { background: var(--bg-page); }
.at-popover .field-toggle .sw {
  width: 24px; height: 14px; border-radius: 999px;
  background: var(--neutral-200); position: relative;
  flex-shrink: 0;
  transition: background var(--dur-fast);
}
.at-popover .field-toggle .sw::after {
  content: ""; position: absolute; left: 1px; top: 1px;
  width: 12px; height: 12px; border-radius: 999px;
  background: white;
  transition: transform var(--dur-fast);
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.at-popover .field-toggle.on .sw { background: var(--sorp-red); }
.at-popover .field-toggle.on .sw::after { transform: translateX(10px); }
.at-popover .field-toggle .nm { flex: 1; }
.at-popover .field-toggle .ftype {
  font-size: 10px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.04em;
}

/* row-height picker */
.at-popover .height-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12.5px;
  cursor: pointer;
}
.at-popover .height-row:hover { background: var(--bg-page); }
.at-popover .height-row.active { background: var(--sorp-red-wash); color: var(--sorp-red-deep); font-weight: var(--w-semibold); }
.at-popover .height-row .preview {
  display: inline-flex; flex-direction: column;
  width: 22px; gap: 2px;
}
.at-popover .height-row .preview span {
  display: block; height: 2px; background: currentColor; opacity: 0.5; border-radius: 1px;
}

/* color-by picker */
.at-popover .color-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12.5px;
  cursor: pointer;
}
.at-popover .color-row:hover { background: var(--bg-page); }
.at-popover .color-row.active { background: var(--sorp-red-wash); color: var(--sorp-red-deep); font-weight: var(--w-semibold); }
