/* Notion clone — dark theme styling */

:root {
  color-scheme: dark;
  --bg: #191919;
  --bg-raised: #202020;
  --bg-modal: #202020;
  --text: #d4d4d4;
  --text-strong: #ececec;
  --text-mid: #9b9b9b;
  --text-dim: #7a7a7a;
  --text-faint: rgba(255, 255, 255, 0.32);
  --divider: rgba(255, 255, 255, 0.065);
  --border: rgba(255, 255, 255, 0.094);
  --hover: rgba(255, 255, 255, 0.055);
  --active-tab: rgba(255, 255, 255, 0.075);
  --card-bg: #242424;
  --card-border: rgba(255, 255, 255, 0.06);
  --link-underline: rgba(255, 255, 255, 0.28);
  --accent: #2383e2;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #373737; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #474747; }

button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: inherit;
}

svg { display: block; }

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 10px;
  background: var(--bg);
}

.tb-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  color: var(--text-mid);
  font-size: 14px;
}
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn.starred { color: #f5c518; }
.tb-btn.starred:hover { color: #f5c518; }

.tb-crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-strong);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-crumb:hover { background: var(--hover); }
.tb-sep { color: var(--text-faint); font-size: 14px; padding: 0 1px; }
.tb-here { padding: 3px 8px; font-size: 14px; color: var(--text-strong); white-space: nowrap; }

.tb-spacer { flex: 1 1 auto; min-width: 12px; }

.tb-edited { font-size: 13px; color: var(--text-faint); white-space: nowrap; padding: 0 6px; }
.tb-edited-btn { height: 28px; border-radius: 6px; padding: 0 8px; }
.tb-edited-btn:hover { background: var(--hover); color: var(--text-mid); }

/* ---------- sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 244px;
  background: #202020;
  border-right: 1px solid var(--divider);
  z-index: 90;
  transform: translateX(-100%);
  transition: transform 0.18s ease;
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
}

body.sb-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.4); }

@media (min-width: 761px) {
  body.sb-open .topbar, body.sb-open .page { margin-left: 244px; }
  body.sb-open .sidebar { box-shadow: none; }
}

.sb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
}
.sb-head:hover { background: var(--hover); }
.sb-ws-icon {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: #37393b;
  color: var(--text-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.sb-ws-name { font-size: 14px; font-weight: 600; color: var(--text-strong); flex: 1; }
.sb-collapse { color: var(--text-dim); border-radius: 5px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.sb-collapse:hover { background: rgba(255,255,255,0.08); color: var(--text); }

.sb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mid);
  text-align: left;
}
.sb-row:hover { background: var(--hover); color: var(--text); }
.sb-row.active { background: var(--active-tab); color: var(--text-strong); }
.sb-row .sb-icon { width: 20px; display: flex; justify-content: center; color: var(--text-dim); flex: 0 0 auto; font-size: 15px; }
.sb-row .sb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-indent { padding-left: 28px; }

.sb-section {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  padding: 12px 8px 4px;
  text-transform: uppercase;
}

.sb-chevron { color: var(--text-dim); transition: transform 0.12s; display: flex; }
.sb-chevron.open { transform: rotate(90deg); }

/* ---------- page frame ---------- */

.page {
  min-height: calc(100vh - 44px);
  padding: 0 0 120px;
}

.page-inner {
  padding: 0 96px;
}

.page-header {
  padding-top: 50px;
}

.page-icon {
  font-size: 72px;
  line-height: 1;
  display: inline-block;
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
  position: relative;
}
.page-icon:hover { background: var(--hover); }

.page-title {
  margin-top: 18px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  outline: none;
  caret-color: var(--text-strong);
}

.page-title:empty::before { content: "Untitled"; color: var(--text-faint); }

/* ---------- top row: links + status widget ---------- */

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 48px;
  margin-top: 40px;
}

.page-links { flex: 0 0 auto; padding-top: 4px; }

.page-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  margin: 2px 0;
  border-radius: 6px;
  cursor: pointer;
  width: fit-content;
}

.page-link:hover { background: var(--hover); }

.page-link .pl-icon { width: 21px; height: 21px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 18px; }

.page-link .pl-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-strong);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* status widget */

.widget {
  flex: 0 1 700px;
  min-width: 320px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.012);
  padding: 12px 14px 10px;
}

.widget-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.widget-tabs::-webkit-scrollbar { display: none; }

.widget-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mid);
  white-space: nowrap;
  flex: 0 0 auto;
}

.widget-tab:hover { background: var(--hover); }

.widget-tab.active {
  background: rgba(255, 255, 255, 0.085);
  color: var(--text-strong);
}

.widget-body {
  padding: 14px 8px 18px;
  min-height: 58px;
  max-height: 176px; /* five rows (32px each + padding); the rest scrolls */
  overflow-y: auto;
}

.widget-empty {
  font-style: italic;
  color: var(--text-dim);
  font-size: 15px;
  padding: 6px 2px 10px;
}

.widget-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.widget-row:hover { background: var(--hover); }

.widget-row .wr-icon { color: var(--text-dim); flex: 0 0 auto; }

.widget-row .wr-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-row .pill { flex: 0 0 auto; margin-left: auto; }

/* ---------- collection ---------- */

.collection { margin-top: 52px; }

.collection-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 4px;
}

.views-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 0;
  position: relative;
}

.views-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.view-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mid);
  white-space: nowrap;
  flex: 0 0 auto;
}

.view-tab:hover { background: var(--hover); color: var(--text); }

.view-tab.active { background: var(--active-tab); color: var(--text-strong); }

.view-tab .vt-icon { color: var(--text-dim); }
.view-tab.active .vt-icon { color: var(--text-mid); }

.view-more {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mid);
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.view-more:hover { background: var(--hover); }

.views-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--text-mid);
}

.va-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-mid);
  position: relative;
}
.va-btn:hover { background: var(--hover); color: var(--text); }
.va-btn.va-on { color: #529cca; }

.new-btn {
  display: flex;
  align-items: stretch;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 0;
  border-radius: 6px;
  margin-left: 6px;
  white-space: nowrap;
  overflow: hidden;
}
.new-btn .nb-main {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 10px;
  color: #fff;
}
.new-btn .nb-caret {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  position: relative;
}
.new-btn .nb-main:hover, .new-btn .nb-caret:hover { background: #1b74cc; }

.tab-add {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-dim);
  margin: 4px 0;
  flex: 0 0 auto;
}
.tab-add:hover { background: var(--hover); color: var(--text); }

.search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-strong);
  font-family: inherit;
  font-size: 14px;
  width: 0;
  padding: 0;
  transition: width 0.15s ease;
}
.search-input.open { width: 150px; padding: 0 4px; }
.search-input::placeholder { color: var(--text-faint); }

/* filter / sort chips */

.chips-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(82, 156, 202, 0.45);
  background: rgba(82, 156, 202, 0.08);
  color: #6fadd6;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  cursor: pointer;
  position: relative;
}
.chip:hover { background: rgba(82, 156, 202, 0.14); }
.chip .chip-x { color: #6fadd6; opacity: 0.7; display: flex; }
.chip .chip-x:hover { opacity: 1; }

/* dropdown menus */

.menu {
  position: absolute;
  z-index: 500;
  background: #252525;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  padding: 6px;
  min-width: 220px;
  max-width: 320px;
}

.menu-right { right: 0; left: auto; }
.menu.menu-wide { max-width: none; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
}
.menu-item:hover, .menu-item.kb-active { background: var(--hover); }
.menu-item .vt-icon { color: var(--text-dim); }
.menu-item.selected { color: var(--text-strong); }
.menu-item .check { margin-left: auto; color: var(--text-mid); }
.menu-item.danger:hover { background: rgba(235, 87, 87, 0.14); color: #eb7369; }

.menu-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 8px 2px;
}

.menu-hint { font-size: 12.5px; color: var(--text-faint); padding: 6px 8px; }

.menu-divider { border: none; border-top: 1px solid var(--divider); margin: 5px 2px; }

.menu-search {
  width: 100%;
  background: #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  margin-bottom: 6px;
}
.menu-search:focus { border-color: rgba(82, 156, 202, 0.6); }
.menu-search::placeholder { color: var(--text-faint); }

/* date picker */

.dp-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.dp-title { font-size: 13.5px; font-weight: 600; color: var(--text-strong); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 30px); gap: 2px; }
.dp-dow { font-size: 11px; color: var(--text-faint); text-align: center; padding: 2px 0; }
.dp-cell {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.dp-cell:hover { background: var(--hover); }
.dp-cell.dp-other { color: var(--text-faint); }
.dp-cell.dp-today { color: #eb5757; font-weight: 700; }
.dp-cell.dp-sel { background: var(--accent); color: #fff; }

/* icon picker (emoji / upload / link) */

.emoji-grid { display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; padding: 2px; }
.emoji-cell { font-size: 21px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; }
.emoji-cell:hover { background: var(--hover); }

.pick-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 8px;
  padding-bottom: 4px;
}
.pick-tab { font-size: 13.5px; color: var(--text-mid); padding: 4px 10px; border-radius: 6px; }
.pick-tab:hover { background: var(--hover); }
.pick-tab.active { color: var(--text-strong); background: var(--active-tab); }

.upload-body { padding: 4px; display: flex; flex-direction: column; gap: 8px; min-width: 260px; }
.upload-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13.5px;
  color: var(--text);
  text-align: center;
}
.upload-btn:hover { background: var(--hover); }
.url-row { display: flex; gap: 6px; }
.url-row .menu-search { margin-bottom: 0; flex: 1; }
.url-set { font-size: 13px; border: 1px solid var(--border); border-radius: 6px; padding: 0 10px; color: var(--text-mid); }
.url-set:hover { background: var(--hover); color: var(--text); }

.icon-img { object-fit: cover; border-radius: 4px; display: block; }
.icon-img.big { border-radius: 10px; }

.add-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-faint);
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
}
.add-icon-btn:hover { background: var(--hover); color: var(--text-mid); }

/* templates */

.tmpl-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6fadd6;
  background: rgba(82, 156, 202, 0.08);
  border: 1px solid rgba(82, 156, 202, 0.35);
  border-radius: 8px;
  padding: 6px 12px;
  margin-bottom: 18px;
}

.tmpl-row { display: flex; align-items: center; gap: 2px; padding: 2px 4px; border-radius: 6px; font-size: 14px; }
.tmpl-row:hover { background: var(--hover); }
.tmpl-use { flex: 1; display: flex; align-items: center; gap: 8px; text-align: left; color: var(--text); min-width: 0; padding: 4px; }
.tmpl-use .t-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmpl-use .t-title.untitled { color: var(--text-faint); }
.tmpl-act { width: 24px; height: 24px; border-radius: 5px; display: flex; align-items: center; justify-content: center; color: var(--text-dim); flex: 0 0 auto; }
.tmpl-act:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.tmpl-act.is-default { color: #f5c518; }

/* view layout switcher */

.layout-row { display: flex; gap: 4px; padding: 2px 6px 6px; }
.layout-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-mid);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
}
.layout-opt:hover { background: var(--hover); }
.layout-opt.active { border-color: rgba(82, 156, 202, 0.7); color: var(--text-strong); }

/* ---------- pills / tags ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  max-width: 100%;
}

.pill-lg { height: 22px; font-size: 13px; }

.c-gray   { background: #3a3a3a; color: #d0d0d0; }
.c-blue   { background: #28456c; color: #b6cff2; }
.c-red    { background: #6e3630; color: #f5c1bb; }
.c-purple { background: #4c3565; color: #d5bff5; }
.c-pink   { background: #692e4e; color: #f3bcd9; }
.c-yellow { background: #58491d; color: #e7cf74; }
.c-orange { background: #5c3a1e; color: #edb77d; }
.c-brown  { background: #4d372c; color: #dba790; }
.c-green  { background: #2b4635; color: #a6ddbc; }

/* ---------- board view ---------- */

.view-body { margin-top: 14px; }

.board {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 30px;
}

.board-col {
  flex: 0 0 262px;
  width: 262px;
  border-radius: 10px;
  padding: 8px 8px 10px;
}

.col-gray   { background: rgba(255, 255, 255, 0.028); }
.col-yellow { background: rgba(231, 207, 116, 0.06); }
.col-orange { background: rgba(237, 183, 125, 0.06); }
.col-brown  { background: rgba(219, 167, 144, 0.055); }
.col-red    { background: rgba(245, 150, 140, 0.06); }
.col-green  { background: rgba(166, 221, 188, 0.055); }
.col-blue   { background: rgba(182, 207, 242, 0.055); }
.col-purple { background: rgba(213, 191, 245, 0.055); }
.col-pink   { background: rgba(243, 188, 217, 0.055); }

.board-col.drag-over { outline: 2px solid rgba(255, 255, 255, 0.1); outline-offset: -2px; }

.col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 8px;
}

.col-count { font-size: 13px; color: var(--text-faint); font-weight: 500; }

.col-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity 0.1s; }
.board-col:hover .col-actions { opacity: 1; }
.col-act {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px;
  color: var(--text-dim);
}
.col-act:hover { background: var(--hover); color: var(--text); }

.col-cards { display: flex; flex-direction: column; gap: 7px; min-height: 4px; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 9px 11px 11px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.card:hover { background: #282828; }

.card.dragging { opacity: 0.35; }

.card.draft { cursor: text; }

.card-title-row { display: flex; align-items: flex-start; gap: 6px; }

.card-title-row .doc-icon { color: var(--text-dim); margin-top: 2px; flex: 0 0 auto; }

.card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-strong);
}

.card-title.untitled { color: var(--text-faint); }

.card-title[contenteditable] {
  outline: none;
  min-width: 60px;
  flex: 1;
  caret-color: var(--text-strong);
}
.card-title[contenteditable]:empty::before { content: "Untitled"; color: var(--text-faint); }

.card-props { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.card-props:empty { display: none; }

.prop-row { display: flex; flex-wrap: wrap; gap: 6px; }

.card-comments {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 500;
}

.col-new {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  margin-top: 6px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.board-col:hover .col-new { opacity: 1; }
.col-new:hover { background: var(--hover); color: var(--text-mid); }

/* ---------- table view ---------- */

.dtable { width: 100%; border-collapse: collapse; }

.dtable th {
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}

.dtable td {
  font-size: 14px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}

.dtable td.cell-edit { cursor: pointer; position: relative; }
.dtable td.cell-edit:hover { background: rgba(255, 255, 255, 0.04); }

.dtable tr.data-row:hover td { background: rgba(255, 255, 255, 0.025); }

.dtable .cell-name {
  font-weight: 500;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 7px;
}

.dtable .cell-name .doc-icon { color: var(--text-dim); flex: 0 0 auto; }

.dtable .cell-name .name-text { outline: none; min-width: 40px; }
.dtable .cell-name .name-text:empty::before { content: "Untitled"; color: var(--text-faint); }

.dtable .cell-dim { color: var(--text-mid); font-size: 13.5px; white-space: nowrap; }

td.cell-rel { position: relative; }

.open-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: #2c2c2c;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mid);
  opacity: 0;
  transition: opacity 0.08s;
}
tr:hover .open-btn { opacity: 1; }
.open-btn:hover { background: #363636; color: var(--text); }

.new-row td {
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}
.new-row:hover td { background: rgba(255, 255, 255, 0.025); color: var(--text-mid); }
.new-row .cell-name { display: flex; align-items: center; gap: 7px; font-weight: 400; color: inherit; }

.calc-row { padding: 8px 12px; font-size: 12px; color: var(--text-faint); }
.calc-row b { color: var(--text-dim); font-weight: 600; }

.table-empty {
  color: var(--text-dim);
  font-size: 14.5px;
  padding: 20px 4px;
}

.table-wrap { overflow-x: auto; }

/* ---------- calendar view ---------- */

.cal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.cal-title { font-size: 15px; font-weight: 600; color: var(--text-strong); margin-right: 4px; }

.cal-nav {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-mid);
}
.cal-nav:hover { background: var(--hover); }

.cal-today-btn {
  font-size: 13px;
  color: var(--text-mid);
  padding: 3px 8px;
  border-radius: 6px;
}
.cal-today-btn:hover { background: var(--hover); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--divider);
  border-left: 1px solid var(--divider);
}

.cal-dow {
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
  padding: 6px 10px;
  border-right: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}

.cal-cell {
  min-height: 104px;
  border-right: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  padding: 6px;
  position: relative;
}

.cal-cell.other-month { background: rgba(255, 255, 255, 0.012); }

.cal-add {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: #2c2c2c;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.08s;
}
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add:hover { color: var(--text); background: #363636; }

.cal-daynum {
  font-size: 13px;
  color: var(--text-mid);
  text-align: right;
  padding: 0 4px 4px;
}

.cal-cell.other-month .cal-daynum { color: var(--text-faint); }

.cal-daynum .today {
  background: #eb5757;
  color: #fff;
  border-radius: 6px;
  padding: 1px 6px;
  font-weight: 600;
}

.cal-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-strong);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 2px 6px;
  margin-top: 3px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cal-chip:hover { background: #2b2b2b; }

.cal-dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }

/* ---------- chart view ---------- */

.chart { padding: 26px 8px 8px; }

.chart-plot {
  display: flex;
  align-items: flex-end;
  gap: 34px;
  height: 260px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}

.chart-colgroup {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 76px;
  height: 100%;
}

.chart-count { font-size: 14px; font-weight: 600; color: var(--text-mid); }

.chart-bar { width: 52px; border-radius: 4px 4px 0 0; min-height: 2px; }

.chart-labels { display: flex; gap: 34px; padding: 10px 12px 0; }

.chart-label {
  flex: 0 0 76px;
  display: flex;
  justify-content: center;
}

.bar-gray   { background: #8f8f8f; }
.bar-yellow { background: #c9a83c; }
.bar-orange { background: #cf7c3a; }
.bar-brown  { background: #a97e60; }
.bar-red    { background: #e06c60; }
.bar-green  { background: #58b57e; }
.bar-blue   { background: #5a9bd5; }
.bar-purple { background: #9a7fd1; }
.bar-pink   { background: #d5749f; }

/* ---------- modal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, 0.62);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 20px 40px;
  overflow-y: auto;
}

.modal {
  background: var(--bg-modal);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  width: 760px;
  max-width: 100%;
  padding: 42px 64px 40px;
  position: relative;
}

.modal-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 2px;
}

.modal-tool {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-dim);
  position: relative;
}
.modal-tool:hover { background: var(--hover); color: var(--text); }

.modal-title {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 30px;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 22px;
}
.modal-title::placeholder { color: var(--text-faint); }

.props-grid { display: flex; flex-direction: column; gap: 4px; }

.prop-line { display: flex; align-items: flex-start; min-height: 34px; }

.prop-label {
  flex: 0 0 150px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  font-size: 14px;
  padding: 6px 0;
}

.prop-value {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 34px;
  position: relative;
}

.prop-value:hover { background: var(--hover); }

.prop-empty { color: var(--text-faint); font-size: 14px; }

.prop-date-text { font-size: 14px; color: var(--text); }

.modal-divider { border: none; border-top: 1px solid var(--divider); margin: 20px 0 16px; }

.modal-body {
  min-height: 90px;
  outline: none;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--text);
}

.modal-body:empty::before { content: attr(data-placeholder); color: var(--text-faint); }

.comments-head { font-size: 13px; font-weight: 600; color: var(--text-dim); margin: 24px 0 10px; }

.comment { display: flex; gap: 10px; padding: 7px 0; }

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #454b6b;
  color: #dfe3ff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: 1px;
}

.comment-meta { font-size: 13px; color: var(--text-strong); font-weight: 600; }
.comment-meta .comment-time { color: var(--text-faint); font-weight: 400; margin-left: 8px; font-size: 12px; }
.comment-text { font-size: 14px; color: var(--text); margin-top: 1px; }

.comment-input-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }

.comment-input {
  flex: 1 1 auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.comment-input:focus { border-color: rgba(255, 255, 255, 0.22); }
.comment-input::placeholder { color: var(--text-faint); }

/* ---------- quick search (Cmd+K) ---------- */

.qs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 90px 20px 40px;
}

.qs-panel {
  width: 580px;
  max-width: 100%;
  background: #252525;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.qs-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--divider);
  color: var(--text-dim);
}

.qs-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--text-strong);
}
.qs-input::placeholder { color: var(--text-faint); }

.qs-results { max-height: 340px; overflow-y: auto; padding: 6px; }

.qs-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
}
.qs-row.kb-active, .qs-row:hover { background: var(--hover); }
.qs-row .qs-icon { color: var(--text-dim); width: 20px; display: flex; justify-content: center; flex: 0 0 auto; }
.qs-row .qs-title { color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-row .qs-ctx { margin-left: auto; color: var(--text-faint); font-size: 12.5px; white-space: nowrap; }

.qs-empty { color: var(--text-dim); font-size: 14px; padding: 18px 14px; }

/* ---------- subpage ---------- */

.subpage-inner { max-width: 900px; margin: 0 auto; padding: 26px 48px 140px; }

.subpage-icon {
  width: 72px;
  height: 72px;
  font-size: 64px;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.subpage-icon:hover { background: var(--hover); }

.subpage-title {
  margin-top: 22px;
  font-size: 38px;
  font-weight: 700;
  color: var(--text-strong);
  outline: none;
}
.subpage-title:empty::before { content: "Untitled"; color: var(--text-faint); }

/* ---------- block editor ---------- */

.blocks { margin-top: 22px; min-height: 300px; cursor: text; }

.block { display: flex; align-items: flex-start; gap: 8px; padding: 2px 0; position: relative; }

.btext {
  flex: 1 1 auto;
  outline: none;
  font-size: 16px;
  line-height: 1.6;
  min-height: 26px;
  word-break: break-word;
  white-space: pre-wrap;
  caret-color: var(--text-strong);
}
.btext:empty::before { content: attr(data-ph); color: var(--text-faint); }

.b-h1 .btext { font-size: 27px; font-weight: 700; color: var(--text-strong); margin-top: 14px; line-height: 1.3; }
.b-h2 .btext { font-size: 21px; font-weight: 600; color: var(--text-strong); margin-top: 8px; line-height: 1.3; }
.b-h3 .btext { font-size: 17px; font-weight: 600; color: var(--text-strong); margin-top: 8px; line-height: 1.3; }

.blt {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  margin-top: 11px;
  margin-left: 6px;
  flex: 0 0 auto;
}

.todo-box {
  width: 16px;
  height: 16px;
  border: 1.4px solid #8a8a8a;
  border-radius: 3px;
  margin-top: 5px;
  flex: 0 0 auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}
.todo-box:hover { border-color: #b3b3b3; }
.b-done .todo-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.b-done .btext { color: var(--text-dim); text-decoration: line-through; }

/* ---------- covers ---------- */

.cover {
  position: relative;
  height: 210px;
  background-size: cover;
  background-position: center 50%;
}

.cover.grad-1 { background-image: linear-gradient(120deg, #1f3a5f, #2b6a5c); }
.cover.grad-2 { background-image: linear-gradient(120deg, #4a2c52, #8c3b4a); }
.cover.grad-3 { background-image: linear-gradient(120deg, #223a2c, #4f6b2f); }
.cover.grad-4 { background-image: linear-gradient(120deg, #513b1e, #8c6b2f); }
.cover.grad-5 { background-image: linear-gradient(120deg, #23303f, #54306b); }
.cover.grad-6 { background-image: linear-gradient(120deg, #14343c, #1f6d73); }

.cover-btns {
  position: absolute;
  right: 22px;
  bottom: 12px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.cover:hover .cover-btns { opacity: 1; }
.cover-btn {
  font-size: 12.5px;
  color: var(--text-mid);
  background: rgba(25, 25, 25, 0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  position: relative;
}
.cover-btn:hover { color: var(--text); background: rgba(35, 35, 35, 0.95); }

.has-cover .page-icon, .has-cover .subpage-icon { margin-top: -46px; position: relative; z-index: 5; }
.has-cover.page-header { padding-top: 0; }

.header-ghosts { display: flex; gap: 4px; min-height: 30px; align-items: center; }
.header-ghosts .add-icon-btn { opacity: 0; margin-bottom: 0; }
.page-header:hover .header-ghosts .add-icon-btn,
.subpage-head:hover .header-ghosts .add-icon-btn { opacity: 1; }

.grad-grid { display: grid; grid-template-columns: repeat(3, 84px); gap: 6px; padding: 4px; }
.grad-cell { height: 44px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background-size: cover; }
.grad-cell:hover { outline: 2px solid rgba(82, 156, 202, 0.7); }

/* ---------- login / members / presence ---------- */

.login-title { font-size: 17px; font-weight: 700; color: var(--text-strong); padding: 16px 18px 4px; }
.login-sub { font-size: 13.5px; color: var(--text-dim); padding: 0 18px 10px; }
.login-rows { padding: 4px 10px 6px; }
.login-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14.5px;
  color: var(--text-strong);
}
.login-row:hover { background: var(--hover); }
.login-new { display: flex; gap: 8px; padding: 10px 18px 18px; }
.login-new .comment-input { flex: 1; }
.login-join {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
}
.login-join:hover { background: #1b74cc; }
.login-join:disabled { opacity: 0.5; cursor: default; }

.presence { display: flex; align-items: center; margin-right: 4px; }
.presence .avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border: 2px solid var(--bg);
  margin-left: -7px;
}
.presence .avatar:first-child { margin-left: 0; }

.login-err { color: #eb7369; font-size: 13px; padding: 2px 18px 10px; min-height: 18px; }
.login-back { font-size: 13px; color: var(--text-dim); padding: 4px 18px 14px; text-align: left; }
.login-back:hover { color: var(--text); }

.editing-badge {
  position: absolute;
  top: 5px;
  right: 30px;
  pointer-events: none;
}

.card-acts {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.08s;
}
.card-act {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--text-faint);
  background: var(--card-bg);
}
.card:hover .card-acts { opacity: 1; }
.card-act:hover { color: var(--text); background: #333; }
.editing-badge .avatar { border: 2px solid var(--accent); box-shadow: 0 0 0 2px rgba(35, 131, 226, 0.25); }
.card { position: relative; }

.editing-ind { font-size: 12.5px; color: #6fadd6; align-self: center; padding-right: 4px; white-space: nowrap; }
.edit-chip { font-size: 12.5px; color: #6fadd6; padding: 0 6px; white-space: nowrap; }

.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; font-size: 14px; }
.member-row .m-name { color: var(--text); flex: 1; }
.member-row .m-dot { width: 8px; height: 8px; border-radius: 50%; background: #3f4650; }
.member-row .m-dot.online { background: #4caf6e; }
.member-row .m-you { font-size: 12px; color: var(--text-faint); }

/* ---------- option + property editing ---------- */

.menu-item .opt-edit {
  color: var(--text-faint);
  border-radius: 4px;
  padding: 2px;
  display: flex;
  opacity: 0;
}
.menu-item:hover .opt-edit { opacity: 1; }
.menu-item .opt-edit:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.menu-item .opt-check { color: var(--text-mid); display: flex; }

.prop-label .plabel {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: -5px;
}
.prop-label .plabel:hover { background: var(--hover); color: var(--text); }

.acct-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 12px 18px 2px;
}

.ucolor-grid { display: flex; gap: 8px; padding: 8px 18px 10px; }
.ucolor {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
}
.ucolor:hover { border-color: rgba(255, 255, 255, 0.4); }
.ucolor.sel { border-color: #fff; }

/* ---------- status column menu ---------- */

.color-grid { display: grid; grid-template-columns: repeat(9, 26px); gap: 4px; padding: 4px 8px 8px; }
.color-cell { width: 24px; height: 24px; border-radius: 6px; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.12); }
.color-cell:hover, .color-cell.sel { outline: 2px solid rgba(82, 156, 202, 0.8); }

.col-head[draggable="true"] { cursor: grab; }
.board-col.col-dragging { opacity: 0.45; }

/* ---------- block editor inside modal ---------- */

.blocks-sm { min-height: 84px; margin-top: 0; }
.blocks-sm .btext { font-size: 15px; min-height: 24px; }
.blocks-sm .b-h1 .btext { font-size: 21px; margin-top: 8px; }
.blocks-sm .b-h2 .btext { font-size: 17.5px; margin-top: 5px; }
.blocks-sm .b-h3 .btext { font-size: 16px; margin-top: 4px; }

/* ---------- content revisions ---------- */

.rev-section { margin: 4px 0 18px; }
.rev-headline {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.rev-list { display: flex; flex-direction: column; gap: 14px; }
.rev-item { border: 1px solid var(--divider); border-radius: 10px; overflow: hidden; background: rgba(255,255,255,0.015); }
.rev-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--divider);
}
.rev-tag {
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
}
.rev-name { color: var(--text-strong); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.rev-sub { color: var(--text-faint); font-size: 12px; margin-left: auto; white-space: nowrap; }
.rev-act {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--text-dim);
}
.rev-act:hover { background: var(--hover); color: var(--text); }

.rev-preview { display: flex; justify-content: center; background: #161616; }
.rev-img { max-width: 100%; max-height: 340px; display: block; }
.rev-vid { max-width: 100%; max-height: 360px; display: block; background: #000; }
.rev-pdf { width: 100%; height: 420px; border: 0; background: #fff; }
.rev-preview audio { margin: 12px; }

.rev-fileblock {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  color: var(--text);
}
.rev-fileblock:hover { background: var(--hover); }
.rev-fileicon { color: var(--text-mid); flex: 0 0 auto; }
.rev-fileblock-name { font-size: 14px; color: var(--text-strong); font-weight: 500; }
.rev-fileblock-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.rev-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 18px 14px;
  margin-top: 14px;
  color: var(--text-mid);
  font-size: 14px;
  cursor: pointer;
}
.rev-drop:hover { border-color: rgba(82,156,202,0.6); color: var(--text); background: rgba(82,156,202,0.05); }
.rev-drop-sub { font-size: 12px; color: var(--text-faint); }

.modal.rev-dragging { outline: 2px solid var(--accent); outline-offset: -2px; }
.modal.rev-dragging .rev-drop { border-color: var(--accent); background: rgba(82,156,202,0.12); color: var(--text); }
.card.file-over { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- comments ---------- */

.comment { position: relative; }
.comment .comment-del {
  position: absolute;
  right: 2px;
  top: 8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--text-faint);
  opacity: 0;
}
.comment:hover .comment-del { opacity: 1; }
.comment-del:hover { background: rgba(235, 87, 87, 0.14); color: #eb7369; }

/* ---------- updates & history ---------- */

.hist-row {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  align-items: flex-start;
}
.hist-row:hover { background: var(--hover); }
.hist-main { flex: 1; min-width: 0; }
.hist-text { font-size: 14px; color: var(--text); line-height: 1.45; word-break: break-word; }
.hist-text b { color: var(--text-strong); font-weight: 600; }
.hist-time { font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.hist-acts { display: flex; gap: 4px; flex: 0 0 auto; margin-top: 3px; opacity: 0; }
.hist-row:hover .hist-acts { opacity: 1; }

.hist-detail {
  margin-top: 6px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--divider);
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hd-row { font-size: 12.5px; line-height: 1.5; word-break: break-word; }
.hd-label { color: var(--text-faint); margin-right: 8px; }
.hd-from { color: #d98a80; text-decoration: line-through; text-decoration-color: rgba(217, 138, 128, 0.6); }
.hd-arrow { color: var(--text-faint); margin: 0 6px; }
.hd-to { color: #8fd0a5; }

/* ---------- trash ---------- */

.trash-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13.5px;
}
.trash-row:hover { background: var(--hover); }
.trash-title { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-kind { color: var(--text-faint); font-size: 12px; }
.trash-act { color: var(--text-mid); font-size: 12.5px; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.trash-act:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.trash-act.danger:hover { background: rgba(235, 87, 87, 0.14); color: #eb7369; }

/* ---------- misc ---------- */

.doc-icon, .comment-icon { flex: 0 0 auto; }

.saving-dot {
  position: fixed;
  bottom: 14px;
  right: 16px;
  font-size: 12px;
  color: var(--text-faint);
  background: rgba(32, 32, 32, 0.9);
  border: 1px solid var(--divider);
  padding: 3px 10px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 300;
}
.saving-dot.show { opacity: 1; }

/* ---------- uploads tray (background uploads, outside #app like the modal) ---------- */

.uptray {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 372px;
  max-width: calc(100vw - 32px);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  z-index: 260; /* above the card modal and side panels, below menus */
  overflow: hidden;
  font-size: 13px;
}
.uptray-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text-strong);
  font-weight: 500;
}
.uptray-head:hover { background: var(--hover); }
.uptray-headicon { color: var(--text-mid); flex: 0 0 auto; }
.uptray-title { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uptray-chev { color: var(--text-mid); flex: 0 0 auto; padding: 0 4px; transform: rotate(90deg); transition: transform 0.12s ease; }
.uptray.collapsed .uptray-chev { transform: rotate(-90deg); }
.uptray.collapsed .uptray-list { display: none; }
.uptray.collapsed { width: auto; min-width: 248px; } /* a small footprint while work goes on underneath */
.uptray-list { max-height: min(264px, 40vh); overflow-y: auto; border-top: 1px solid var(--divider); }
.uptray-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px 9px 12px; }
.uptray-row + .uptray-row { border-top: 1px solid var(--divider); }
.uptray-row.is-link { cursor: pointer; }
.uptray-row.is-link:hover { background: var(--hover); }
.uptray-icon { color: var(--text-mid); flex: 0 0 auto; width: 20px; display: flex; justify-content: center; }
.uptray-row.is-done .uptray-icon { color: #4dab9a; }
.uptray-row.is-error .uptray-icon { color: #eb7369; }
.uptray-main { flex: 1 1 auto; min-width: 0; }
.uptray-name { color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uptray-sub { color: var(--text-dim); font-size: 12px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.uptray-row.is-error .uptray-sub { color: #eb7369; white-space: normal; }
.uptray-row.is-needs-file .uptray-sub { white-space: normal; }
.uptray-bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin-top: 6px; overflow: hidden; }
.uptray-barfill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s linear; }
.uptray-row.is-paused .uptray-barfill, .uptray-row.is-needs-file .uptray-barfill { background: var(--text-dim); }
.uptray-row.is-error .uptray-barfill { background: #eb7369; }
.uptray-act {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--text-mid);
}
.uptray-act:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

/* keep the save indicator and the end of an open card clear of the tray */
.has-uptray .saving-dot { bottom: calc(var(--uptray-h, 0px) + 24px); }
.has-uptray .overlay { padding-bottom: calc(var(--uptray-h, 0px) + 40px); }

@media (max-width: 760px) {
  .uptray, .uptray.collapsed { left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none; }
  .uptray-list { max-height: min(200px, 34vh); }
  .uptray-act { width: 34px; height: 34px; }
  /* attachment rows: the who/when/size line drops under the name, so the download and remove buttons stay on screen */
  .rev-meta { flex-wrap: wrap; row-gap: 2px; }
  .rev-name { flex: 1 1 0; min-width: 0; max-width: none; }
  .rev-sub { order: 5; flex: 1 0 100%; margin-left: 0; white-space: normal; }
}

/* ---------- staging ribbon (APP_ENV=staging; injected by the server) ---------- */

.staging-ribbon {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none; /* never in the way of a control underneath */
  padding: 1px 10px 2px;
  border-radius: 0 0 6px 6px;
  background: #d9a344;
  color: #1a1400;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.35;
  white-space: nowrap;
  opacity: 0.92;
}
/* A phone's top bar is controls edge to edge, so the ribbon moves to the bottom-left corner (above the uploads tray). */
@media (max-width: 760px) {
  .staging-ribbon { top: auto; left: 8px; bottom: 8px; transform: none; border-radius: 6px; padding: 1px 8px 2px; font-size: 9.5px; }
  .has-uptray .staging-ribbon { bottom: calc(var(--uptray-h, 0px) + 14px); }
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .page-inner { padding: 0 44px; }
}

@media (max-width: 760px) {
  .page-inner { padding: 0 20px; }
  .page-header { padding-top: 30px; }
  .page-icon { font-size: 56px; }
  .page-title { font-size: 32px; }
  .top-row { flex-direction: column; gap: 24px; margin-top: 28px; }
  .widget { flex: 1 1 auto; width: 100%; min-width: 0; }
  .collection { margin-top: 36px; }
  .views-tabs { overflow-x: auto; scrollbar-width: none; }
  .views-tabs::-webkit-scrollbar { display: none; }
  .modal { padding: 30px 22px 28px; }
  .prop-label { flex-basis: 108px; font-size: 13px; }
  .modal-title { font-size: 24px; }
  .subpage-inner { padding: 20px 20px 120px; }
  .subpage-title { font-size: 30px; }
  .cal-cell { min-height: 64px; }
  .chart-plot { gap: 16px; }
  .chart-labels { gap: 16px; }
  .chart-colgroup, .chart-label { flex-basis: 56px; }
  .chart-bar { width: 36px; }
  .tb-edited { display: none; }
  .sidebar { width: 82vw; max-width: 300px; }
}

/* ---------- analytics ---------- */

:root {
  --an-surface: #1e1e1e;   /* chart surface (card) */
  --an-grid: #2c2c2a;      /* hairline gridline */
  --an-axis: #383835;      /* baseline / crosshair */
  --an-muted: #898781;     /* axis labels */
  --an-deemph: #4a4a48;    /* sparkline stroke */
  --an-up: #0ca30c;
  --an-down: #e66767;
}

.an-inner { max-width: 1040px; }
.an-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 30px 0 10px;
}
.an-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-mid);
  font-size: 13.5px;
  line-height: 1.45;
}
.an-banner b { color: var(--text-strong); font-weight: 600; }
.an-banner svg { flex: 0 0 auto; margin-top: 2px; color: var(--text-dim); }

.an-key {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: 1px;
  flex: 0 0 auto;
}

/* stat tiles */
.an-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.an-tiles.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.an-tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--an-surface);
  padding: 12px 14px 11px;
  cursor: pointer;
  min-width: 0;
}
.an-tile:hover { background: #232323; }
.an-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.an-tile.compact { padding: 9px 11px 8px; border-radius: 8px; }
.an-tile-head { display: flex; align-items: center; gap: 0; font-size: 13px; color: var(--text-mid); min-width: 0; }
.an-tile-head .an-spark { margin-left: auto; }
.an-tile { overflow: hidden; }
.an-tile-label { color: var(--text-strong); font-weight: 600; }
.an-tile-metric { margin-left: 6px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-tile-value { font-size: 26px; font-weight: 600; color: var(--text-strong); line-height: 1.1; letter-spacing: -0.01em; margin-top: 8px; }
.an-tile.compact .an-tile-value { font-size: 21px; }
.an-delta { font-size: 12px; color: var(--text-dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-delta.up { color: var(--an-up); }
.an-delta.down { color: var(--an-down); }
.an-spark { flex: 0 0 auto; display: block; }
.an-sample-note { grid-column: 1 / -1; font-size: 12px; color: var(--text-faint); padding: 2px 2px 0; }
.widget-body-an { max-height: none; padding: 12px 6px 10px; }

/* filter row */
.an-filters { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.an-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.an-seg-btn { padding: 4px 10px; border-radius: 6px; font-size: 13px; color: var(--text-mid); }
.an-seg-btn:hover { background: var(--hover); }
.an-seg-btn.active { background: rgba(255, 255, 255, 0.085); color: var(--text-strong); }
.an-link { font-size: 13px; color: var(--text-mid); padding: 4px 6px; border-radius: 6px; }
.an-link:hover { background: var(--hover); color: var(--text); }
.an-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 7px; font-size: 13.5px; font-weight: 500;
  color: var(--text); border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
}
.an-btn:hover { background: var(--hover); }
.an-btn svg { width: 14px; height: 14px; }

/* channel cards */
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 12px; }
.an-card { border: 1px solid var(--border); border-radius: 12px; background: var(--an-surface); padding: 12px 14px 8px; min-width: 0; }
.an-card-head { display: flex; align-items: baseline; gap: 0; font-size: 14px; margin-bottom: 4px; }
.an-card-title { color: var(--text-strong); font-weight: 600; }
.an-card-sub { color: var(--text-dim); font-size: 12.5px; margin-left: 8px; }
.an-card-handle { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.an-plot { position: relative; }
.an-chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: none; }
.an-chart:focus { outline: none; }
.an-chart:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.an-tick { font-size: 10.5px; fill: var(--an-muted); font-variant-numeric: tabular-nums; }
.an-endlabel { font-size: 11px; fill: var(--text); font-weight: 600; }
.an-bar { transition: filter 0.08s; }
.an-bar.lift { filter: brightness(1.25); }
.an-tip {
  position: absolute; top: 6px;
  background: #2a2a2a; border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 9px; pointer-events: none; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.an-tip-val { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.an-tip-lab { font-size: 11.5px; color: var(--text-mid); margin-top: 1px; }

/* tables */
.an-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 12px; }
.an-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.an-table th {
  text-align: left; font-weight: 500; color: var(--text-dim); font-size: 12.5px;
  padding: 8px 12px; border-bottom: 1px solid var(--divider); white-space: nowrap;
}
.an-table td { padding: 7px 12px; border-bottom: 1px solid var(--divider); color: var(--text); vertical-align: middle; }
.an-table tbody tr:last-child td { border-bottom: 0; }
.an-table tbody tr:hover td { background: var(--hover); }
.an-td-date { color: var(--text-mid); white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-td-num, .an-th-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-td-post { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-td-post a { color: var(--text); text-decoration: underline; text-decoration-color: var(--link-underline); text-underline-offset: 3px; }
.an-td-act { text-align: right; }
.an-dim { color: var(--text-faint); }
.an-channels td:nth-child(1), .an-channels td:nth-child(2) { white-space: nowrap; }
.an-empty { color: var(--text-dim); font-style: italic; text-align: center; padding: 18px !important; }

/* menus */
.an-log-row { display: flex; align-items: center; gap: 0; padding: 4px 8px; }
.an-log-label { flex: 1; font-size: 13px; color: var(--text-mid); }
.an-input { width: 120px !important; margin: 0 !important; text-align: right; font-variant-numeric: tabular-nums; }
.an-save { width: calc(100% - 16px); margin: 8px 8px 4px; }

/* Top-level Content / Analytics switch on the home box: underline tabs, one
   step quieter than the status pills beneath them. */
.widget-modes {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--divider);
  margin: -4px -4px 8px;
  padding: 0 4px;
}
.widget-mode {
  padding: 6px 10px 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
}
.widget-mode:hover { color: var(--text); background: var(--hover); }
.widget-mode.active { color: var(--text-strong); border-bottom-color: var(--text-strong); }
.widget-body-an { padding-top: 6px; }
.widget-body-an .an-pills { margin-top: 10px; gap: 6px; }
.widget-body-an .an-pill { padding: 5px 10px; font-size: 12.5px; }
.widget-body-an .an-pill-value { font-size: 14px; }

/* image blocks in the editor */
.b-image { display: block; padding: 6px 0; }
.b-image-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; }
.b-image .btext { align-self: stretch; }
.b-image img { display: block; max-width: 100%; max-height: 640px; border-radius: 6px; background: #fff; }
.b-image .btext { font-size: 13px; color: var(--text-dim); min-height: 20px; }
.blocks-sm .b-image img { max-height: 360px; }

/* associated content (card relations) */
.rel-chip {
  display: inline-flex; align-items: center; max-width: 100%;
  border-radius: 6px; background: rgba(255, 255, 255, 0.06);
}
.rel-chip:hover { background: rgba(255, 255, 255, 0.1); }
.rel-open {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  padding: 3px 4px 3px 8px; color: var(--text); font-size: 13.5px;
}
.rel-open .rel-ic { color: var(--text-dim); flex: 0 0 auto; display: inline-flex; }
.rel-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; text-decoration: underline; text-decoration-color: var(--link-underline); text-underline-offset: 3px; }
.rel-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 22px; margin-right: 3px; border-radius: 4px;
  color: var(--text-faint); opacity: 0;
}
.rel-chip:hover .rel-x { opacity: 1; }
.rel-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.rel-add {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin-top: 6px; padding: 7px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: 8px;
  background: none; color: var(--text-dim); font-size: 14px;
}
.rel-add:hover { border-color: rgba(255, 255, 255, 0.2); color: var(--text); background: var(--hover); }
.rel-add .vt-icon { color: inherit; }

/* time period on a date field */
.dp-time { display: flex; align-items: center; gap: 6px; padding: 6px 4px 2px; }
.dp-time-label { font-size: 12.5px; color: var(--text-dim); margin-right: 2px; }
.dp-time-input {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 6px; font-family: inherit; font-size: 13px; color: var(--text);
  color-scheme: dark; outline: none; width: 104px;
}
.dp-time-input:focus { border-color: rgba(82, 156, 202, 0.6); }
.dp-time-sep { font-size: 12.5px; color: var(--text-faint); }
.dp-time-clear { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 5px; color: var(--text-faint); }
.dp-time-clear:hover { color: var(--text); background: var(--hover); }
.cal-time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; margin-right: 4px; flex: 0 0 auto; }

/* ideation section (above content revisions) */
.idea-section { border-radius: 10px; transition: background 0.1s; }
.idea-section.idea-dragging { background: rgba(82, 156, 202, 0.06); outline: 1px dashed rgba(82, 156, 202, 0.6); outline-offset: 6px; }
.idea-tag { background: rgba(217, 163, 68, 0.16); color: #e2b65b; }
.idea-note { padding: 12px 14px; font-size: 14.5px; color: var(--text); white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.idea-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); min-width: 0; }
.idea-link:hover { background: var(--hover); }
.idea-link-title { font-size: 14px; font-weight: 500; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idea-link-url { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idea-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.idea-input { min-width: 0; }
.idea-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; color: var(--text-mid); background: rgba(255, 255, 255, 0.03);
}
.idea-btn:hover { background: var(--hover); color: var(--text); }
.idea-btn svg { width: 14px; height: 14px; }
.idea-drop { margin-top: 10px; }
.idea-section .rev-list, .rev-section .rev-drop + input + .rev-list { margin-top: 14px; }
.idea-row { margin-top: 4px; }
.idea-section.idea-dragging .idea-drop { border-color: rgba(82,156,202,0.8); color: var(--text); background: rgba(82,156,202,0.08); }

/* mentions */
.mention { color: var(--accent); font-weight: 500; background: rgba(35, 131, 226, 0.12); border-radius: 4px; padding: 0 3px; }
.mention.mention-me { background: rgba(35, 131, 226, 0.24); }
.mention-menu { min-width: 220px; z-index: 600; }
.mention-menu .menu-item { gap: 10px; }

/* notifications */
.notif-btn { position: relative; }
.notif-btn.has-unread { color: var(--text); }
.notif-badge {
  position: absolute; top: 2px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 8px; background: #e34948; color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 0 0 2px var(--bg);
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 4px; }
.notif-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.notif-row:hover { background: var(--hover); }
.notif-row.unread .notif-text { color: var(--text-strong); font-weight: 500; }
.notif-main { flex: 1; min-width: 0; }
.notif-text { font-size: 14px; color: var(--text); line-height: 1.45; word-break: break-word; }
.notif-snippet { font-size: 13px; color: var(--text-mid); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: 0 0 auto; }

.presence-me { display: inline-flex; border-radius: 50%; cursor: pointer; }
.presence-me:hover .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }


/* drag-to-reorder options inside select menus */
.opt-row { position: relative; }
.opt-grip { display: inline-flex; align-items: center; color: var(--text-faint); opacity: 0; margin-left: -4px; cursor: grab; flex: 0 0 auto; }
.opt-row:hover .opt-grip { opacity: 1; }
.opt-row[draggable="true"] { cursor: grab; }
.opt-row.opt-dragging { opacity: 0.4; }
.opt-row.drop-before::before, .opt-row.drop-after::after {
  content: ''; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 1px; background: var(--accent);
}
.opt-row.drop-before::before { top: -1px; }
.opt-row.drop-after::after { bottom: -1px; }

/* pipeline pills under the Right now tiles */
.an-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.an-pill {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
  color: var(--text-mid); font-size: 13px;
}
.an-pill[role="button"] { cursor: pointer; }
.an-pill[role="button"]:hover { background: var(--hover); color: var(--text); }
.an-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.an-pill-value { font-size: 15px; font-weight: 600; color: var(--text-strong); }
.an-pill.warn .an-pill-value { color: #e66767; }

.widget-modes .an-viewall { margin-left: auto; align-self: center; padding: 4px 8px; margin-bottom: 2px; border-radius: 4px; font-size: 13px; }
.widget-modes .an-viewall:hover { background: var(--hover); color: var(--text); }
.an-viewall { display: inline-flex; align-items: center; gap: 4px; color: var(--text-mid); }
.an-viewall svg { width: 12px; height: 12px; }

/* drag-to-reorder view tabs */
.view-tab { position: relative; }
.view-tab[draggable="true"] { cursor: pointer; }
.view-tab.vt-dragging { opacity: 0.4; }
.view-tab.drop-left::before, .view-tab.drop-right::after {
  content: ''; position: absolute; top: 4px; bottom: 4px; width: 2px; border-radius: 1px; background: var(--accent);
}
.view-tab.drop-left::before { left: -2px; }
.view-tab.drop-right::after { right: -2px; }

/* sidebar rows that are plain links (CRM section) look like the buttons */
a.sb-row { color: inherit; text-decoration: none; }
a.sb-row:hover { background: var(--hover); }

/* CRM hosted inside the workspace */
.crm-frame { position: fixed; border: 0; background: var(--bg); z-index: 40; }
.crm-host { min-height: calc(100vh - 46px); }

/* CRM row badges in the workspace sidebar */
/* Counts in the sidebar are quiet numbers (Notion); only Inbox gets a red pill. */
.sb-count { margin-left: auto; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.sb-row .notif-badge { position: static; margin-left: auto; box-shadow: none; }

/* ---------- Settings & members page ---------- */
.settings-inner { max-width: 1040px; margin: 0 auto; padding: 36px 48px 140px; display: grid; grid-template-columns: 200px 1fr; gap: 40px; }
.set-nav { position: sticky; top: 60px; align-self: start; }
.set-nav-title { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); padding: 4px 8px 6px; }
.set-nav-row { display: block; width: 100%; text-align: left; padding: 5px 8px; border-radius: 6px; font-size: 14px; color: var(--text); }
.set-nav-row:hover { background: var(--hover); }
.set-nav-row.active { background: var(--active-tab); color: var(--text-strong); font-weight: 500; }
.set-h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-strong); margin: 0 0 4px; }
.set-sub { font-size: 14px; color: var(--text-mid); margin-bottom: 26px; }
.set-field { padding: 16px 0; border-top: 1px solid var(--divider); }
.set-field:first-of-type { border-top: 0; }
.set-label { font-size: 14px; font-weight: 600; color: var(--text-strong); margin-bottom: 8px; }
.set-hint { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; }
.set-input { width: 100%; max-width: 380px; background: rgba(255,255,255,0.055); border: 1px solid transparent; border-radius: 6px; padding: 7px 10px; font-family: inherit; font-size: 14px; color: var(--text); outline: none; }
.set-input:focus { border-color: rgba(82,156,202,0.6); background: rgba(255,255,255,0.075); }
.set-stack { display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.set-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-btn { padding: 6px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: var(--text); border: 1px solid rgba(255,255,255,0.13); }
.set-btn:hover { background: var(--hover); }
.set-btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.set-btn.primary:hover { background: #1b74cc; }
.set-photo { display: flex; align-items: center; gap: 16px; }
.set-select { background: rgba(255,255,255,0.055); border: 1px solid transparent; border-radius: 6px; padding: 5px 26px 5px 8px; font-family: inherit; font-size: 13.5px; color: var(--text); appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%239b9b9b' stroke-width='1.8'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.set-select:disabled { opacity: 0.6; background-image: none; padding-right: 8px; cursor: default; }
.set-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.set-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1.2fr; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--divider); }
.set-row:first-child { border-top: 0; }
.set-row.set-head { background: rgba(255,255,255,0.025); font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.set-row:not(.set-head):hover { background: var(--hover); }
.set-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.set-name { font-size: 14px; font-weight: 500; color: var(--text-strong); display: flex; align-items: center; gap: 6px; }
.set-meta { font-size: 12px; color: var(--text-faint); }
.set-actions { display: flex; gap: 10px; justify-content: flex-end; }
.set-link { font-size: 12.5px; color: var(--text-mid); padding: 3px 6px; border-radius: 5px; white-space: nowrap; }
.set-link:hover { background: var(--hover); color: var(--text); }
.set-link.danger:hover { background: rgba(235,87,87,0.14); color: #eb7369; }
.set-list { margin: 0; padding-left: 18px; color: var(--text); font-size: 14px; line-height: 1.7; }
.set-list b { color: var(--text-strong); font-weight: 600; }
.set-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: 0.04em; background: rgba(255,255,255,0.06); padding: 6px 10px; border-radius: 6px; color: var(--text-strong); }
@media (max-width: 800px) {
  .settings-inner { grid-template-columns: 1fr; padding: 20px 18px 120px; gap: 18px; }
  .set-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .set-nav-title { width: 100%; }
  .set-row { grid-template-columns: 1fr 1fr; }
  .set-row.set-head { display: none; }
  .set-who { grid-column: 1 / -1; }
  .set-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

.tb-here { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.set-row.set-perm { grid-template-columns: 2fr 1fr 1fr; }
.set-perm-name { font-size: 13.5px; }
.set-perm-cell { display: flex; align-items: center; gap: 8px; }
.set-perm-cell input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.set-perm-cell .set-select { padding-top: 3px; padding-bottom: 3px; font-size: 12.5px; }

.set-row.set-members { grid-template-columns: 1.6fr 1fr 1.2fr 1.2fr; }
.perm-panel { max-width: 520px; }
.perm-intro { font-size: 13.5px; color: var(--text-mid); padding: 4px 18px 10px; }
.perm-app { padding: 12px 18px; border-top: 1px solid var(--divider); }
.perm-app-head { display: flex; align-items: center; gap: 10px; }
.perm-app-icon { font-size: 16px; }
.perm-app-name { font-size: 14px; font-weight: 600; color: var(--text-strong); flex: 1; }
.perm-desc { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }

.set-members .set-btn { white-space: nowrap; }
.set-row.set-members { grid-template-columns: 1.5fr 0.9fr 1.4fr 1.3fr; }

/* Notion measurements: 27px rows, 14px labels, 18px icon slot, 4px radius */
.sb-row { padding: 4px 8px; min-height: 27px; border-radius: 4px; font-size: 14px; font-weight: 500; }
.sb-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; color: var(--text-dim); font-size: 15px; }
.sb-row.active .sb-icon, .sb-row:hover .sb-icon { color: var(--text); }
.sb-section { font-size: 12px; font-weight: 600; color: var(--text-faint); padding: 14px 8px 4px; letter-spacing: 0; text-transform: none; }
.set-btn, .login-join, .an-btn, .rel-add, .idea-btn { height: 28px; padding-top: 0; padding-bottom: 0; border-radius: 6px; }

.notif-ic { width: 24px; height: 24px; border-radius: 6px; background: rgba(255,255,255,0.06); color: var(--text-mid); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tb-btn.notif-btn .notif-badge { position: absolute; top: 2px; right: 1px; margin: 0; box-shadow: 0 0 0 2px var(--bg); }

/* Bell with its count beside the icon (not on top of it). */
.tb-btn.notif-btn { width: auto; padding: 0 6px 0 5px; gap: 4px; position: static; }
.tb-btn.notif-btn .notif-badge { position: static; margin: 0; box-shadow: none; min-width: 16px; height: 16px; font-size: 10.5px; padding: 0 5px; }

.notif-dot-red { background: #e34948; }
.notif-snippet + .notif-snippet { margin-top: 1px; }

/* ---------- email sign-in: members' emails, add-member row, sign-in notes ---------- */
.set-who-text { min-width: 0; flex: 1; }
.set-email, .set-email-add { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-mid); }
.set-email-add { color: var(--accent); text-decoration: none; }
.set-email-add:hover { text-decoration: underline; }
.set-email-input { display: block; width: 100%; max-width: 260px; margin: 1px 0 1px -5px; padding: 1px 5px; border: 1px solid transparent; border-radius: 4px; background: transparent; font-family: inherit; font-size: 12px; color: var(--text-mid); outline: none; text-overflow: ellipsis; }
.set-email-input::placeholder { color: var(--text-faint); }
.set-email-input:hover { background: rgba(255,255,255,0.055); }
.set-email-input:focus { background: rgba(255,255,255,0.075); border-color: rgba(82,156,202,0.6); color: var(--text); }
.set-add .set-input { flex: 1 1 180px; max-width: 260px; }
.login-note { cursor: default; padding-bottom: 6px; }
.login-note:hover { color: var(--text-dim); }
.qs-panel > .login-back { display: block; width: 100%; }
.qs-panel > .login-back + .login-back { padding-top: 0; }
/* Members rows: fixed column shares (content can no longer push them out of line
   between rows) and actions that wrap inside their own column. */
.set-row.set-members { grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.75fr) minmax(0, 1.35fr) minmax(0, 1.55fr); }
.set-members .set-actions { flex-wrap: wrap; row-gap: 2px; }
@media (max-width: 800px) {
  .set-email-input { max-width: 100%; font-size: 16px; } /* 16px stops iOS zooming into the field */
  .login-new .comment-input { font-size: 16px; }          /* same for the sign-in, join and reset forms */
  .set-add .set-input { max-width: 100%; }
  /* Phone: who on top, role + permissions on one line, actions on their own
     wrapping line. (The four-column rule above used to win here and the page
     scrolled sideways.) */
  .set-row.set-members { grid-template-columns: auto minmax(0, 1fr); row-gap: 8px; }
  .set-row.set-members > .set-who, .set-row.set-members > .set-cell:last-child { grid-column: 1 / -1; }
  .set-members .set-actions { justify-content: flex-start; margin-left: -6px; }
}
