/* Magic Board — the database screen.
 *
 * Notion's design language, not its branding. The rules that matter:
 * separation by whitespace and hairlines rather than borders, a fixed palette
 * of ten tints, actions hidden until hover, and 3px corners on everything.
 *
 * This is the only stylesheet; the old board and its styles are gone.
 */

:root {
  --text: #37352f;
  --text-2: #787774;
  --text-3: #9b9a97;
  --bg: #ffffff;
  --bg-2: #f7f7f5;
  --bg-hover: rgba(55, 53, 47, 0.06);
  --bg-active: rgba(55, 53, 47, 0.1);
  --line: rgba(55, 53, 47, 0.09);
  --line-2: rgba(55, 53, 47, 0.16);
  --accent: #2383e2;
  --accent-soft: rgba(35, 131, 226, 0.14);
  --danger: #eb5757;
  --shadow: 0 0 0 1px rgba(15, 15, 15, 0.05), 0 3px 6px rgba(15, 15, 15, 0.1),
    0 9px 24px rgba(15, 15, 15, 0.2);
  /* Popovers need to sit *above* the page, which in dark mode means a
     lighter surface — a shadow alone is invisible on near-black. */
  --bg-raised: #ffffff;
  --radius: 3px;
  --row: 34px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #d4d4d4;
    --text-2: #9b9b9b;
    --text-3: #6f6f6f;
    --bg: #191919;
    --bg-2: #202020;
    --bg-hover: rgba(255, 255, 255, 0.055);
    --bg-active: rgba(255, 255, 255, 0.1);
    --line: rgba(255, 255, 255, 0.094);
    --line-2: rgba(255, 255, 255, 0.16);
    --accent: #2383e2;
    --accent-soft: rgba(35, 131, 226, 0.2);
    --bg-raised: #252525;
    color-scheme: dark;
  }
}

[hidden] { display: none !important; }

.db {
  font-family: Inter, ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.db *, .db *::before, .db *::after { box-sizing: border-box; }
.db button { font: inherit; color: inherit; }

/* ---- tints ------------------------------------------------------------- */
.t-default { background: #f1f0ef; color: #37352f; }
.t-gray    { background: #e3e2e0; color: #32302c; }
.t-brown   { background: #eee0da; color: #442a1e; }
.t-orange  { background: #fadec9; color: #49290e; }
.t-yellow  { background: #fdecc8; color: #402c1b; }
.t-green   { background: #dbeddb; color: #1c3829; }
.t-blue    { background: #d3e5ef; color: #183347; }
.t-purple  { background: #e8deee; color: #412454; }
.t-pink    { background: #f5e0e9; color: #4c2337; }
.t-red     { background: #ffe2dd; color: #5d1715; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .t-default { background: #373737; color: #d4d4d4; }
  :root:not([data-theme="light"]) .t-gray    { background: #5a5a5a; color: #e6e6e6; }
  :root:not([data-theme="light"]) .t-brown   { background: #603b2c; color: #eedfd8; }
  :root:not([data-theme="light"]) .t-orange  { background: #854c1d; color: #fae0cb; }
  :root:not([data-theme="light"]) .t-yellow  { background: #89632a; color: #fbeecb; }
  :root:not([data-theme="light"]) .t-green   { background: #2b593f; color: #dcecdd; }
  :root:not([data-theme="light"]) .t-blue    { background: #28456c; color: #d5e5f0; }
  :root:not([data-theme="light"]) .t-purple  { background: #492f64; color: #e9e0ef; }
  :root:not([data-theme="light"]) .t-pink    { background: #69314c; color: #f6e2ea; }
  :root:not([data-theme="light"]) .t-red     { background: #6e3630; color: #ffe3de; }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- shell ------------------------------------------------------------- */
.db-shell { display: flex; min-height: 100vh; }

.db-side {
  width: 220px;
  flex: 0 0 220px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.db-side .brand {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text);
}
.db-side a, .db-side .side-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.db-side a:hover, .db-side .side-link:hover { background: var(--bg-hover); }
.db-side a.on { background: var(--bg-active); color: var(--text); }
.db-side .count { margin-left: auto; color: var(--text-3); font-size: 12px; }
.db-side .group-title {
  padding: 14px 8px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.db-side form { display: contents; }
.db-side .side-link.logout {
  border: 0; background: none; cursor: pointer; width: 100%; text-align: left;
}

.db-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.db-head { padding: 26px 46px 0; }
.db-head h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.db-head .sub { margin: 4px 0 0; color: var(--text-3); font-size: 13px; }

/* ---- view tabs --------------------------------------------------------- */
.db-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 14px 46px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.db-tabs::-webkit-scrollbar { display: none; }
.db-tab {
  /* Used for both links and the add button, so the button chrome has to go. */
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px 9px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  border-radius: var(--radius) var(--radius) 0 0;
}
.db-tab:hover { background: var(--bg-hover); }
.db-tab.on { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.db-tab .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
}
.db-tabs .add { color: var(--text-3); font-size: 18px; line-height: 1; padding: 4px 9px 9px; }
.db-tabs .add:hover { color: var(--text); }

/* ---- toolbar ----------------------------------------------------------- */
.db-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 8px 46px;
  flex-wrap: wrap;
}
.db-bar .bar-side {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  border-radius: var(--radius);
  padding: 4px 7px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.chip-btn:hover { background: var(--bg-hover); }
.chip-btn.set { color: var(--accent); background: var(--accent-soft); }
.db-bar .search {
  border: 0;
  background: none;
  font: inherit;
  color: var(--text);
  padding: 4px 7px;
  width: 170px;
  border-radius: var(--radius);
}
.db-bar .search:focus { outline: none; background: var(--bg-hover); }
.db-bar .search::placeholder { color: var(--text-3); }

/* ---- table ------------------------------------------------------------- */
.db-scroll { flex: 1; overflow-x: auto; padding: 0 46px 120px; }
.db-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.db-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  text-align: left;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-2);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  white-space: nowrap;
}
.db-table thead th a { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; }
.db-table thead th a:hover { color: var(--text); }
.db-table td {
  padding: 0 8px;
  height: var(--row);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13px;
}
.db-row:hover td { background: var(--bg-hover); }
.db-row.sel td { background: var(--accent-soft); }
.db-row.done .title-text { color: var(--text-3); }
.db-row.proposed .title-text { font-style: italic; }
.db-row.proposed td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.col-pick { width: 30px; padding-left: 12px !important; }
#pick-all { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.col-title { min-width: 240px; }
.col-open { width: 34px; }

.db-row .pick {
  opacity: 0;
  width: 14px; height: 14px;
  border-radius: 3px;
  accent-color: var(--accent);
  cursor: pointer;
}
.db-row:hover .pick, .db-row .pick:checked, .db-row.sel .pick { opacity: 1; }

.title-cell { display: flex; align-items: center; gap: 6px; }
.title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
  padding: 3px 4px;
  margin: -3px -4px;
  border-radius: var(--radius);
}
.title-text:hover { background: var(--bg-active); }
.title-text[contenteditable="true"] {
  white-space: normal;
  background: var(--bg);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
  cursor: text;
}
.open-btn {
  opacity: 0;
  border: 0; background: none; cursor: pointer;
  color: var(--text-2);
  border-radius: var(--radius);
  padding: 2px 5px;
  font-size: 12px;
}
.db-row:hover .open-btn { opacity: 1; }
.open-btn:hover { background: var(--bg-active); color: var(--text); }

.cell-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 24px;
  border: 0;
  background: none;
  border-radius: var(--radius);
  padding: 2px 4px;
  cursor: pointer;
  text-align: left;
  flex-wrap: wrap;
}
.cell-btn:hover { background: var(--bg-active); }
.cell-btn .empty { color: var(--text-3); font-size: 13px; }
.cell-btn.due.over { color: var(--danger); font-weight: 500; }
.block-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
  padding: 1px 6px 1px 4px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 3px 3px 0;
  white-space: nowrap;
}
.block-pill.prot { border-left-color: var(--danger); background: rgba(235, 87, 87, 0.13); }

/* ---- groups ------------------------------------------------------------ */
.group-head td {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: 18px !important;
  height: auto;
}
.group-head .inner { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.group-head .toggle {
  border: 0; background: none; cursor: pointer;
  color: var(--text-3); width: 18px; height: 18px;
  border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
}
.group-head .toggle:hover { background: var(--bg-active); }
.group-head .toggle svg { transition: transform 120ms ease-out; }
.group-head.closed .toggle svg { transform: rotate(-90deg); }
.group-head .n { color: var(--text-3); font-size: 12px; }
.add-here {
  border: 0; background: none; cursor: pointer;
  color: var(--text-3); font-size: 13px;
  border-radius: var(--radius); padding: 2px 6px;
  text-align: left;
}
.add-here:hover { background: var(--bg-active); color: var(--text); }
/* Hidden until hover in the table, always visible on a board column. */
.group-head .add-here { opacity: 0; }
.group-head:hover .add-here { opacity: 1; }

.new-row td { height: var(--row); border-bottom: 1px solid var(--line); }
.new-row input {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 4px;
}
.new-row input:focus { outline: none; }
.new-row input::placeholder { color: var(--text-3); }
.new-row:hover td { background: var(--bg-hover); }

.db-empty { padding: 40px 0; color: var(--text-3); font-size: 13px; }

/* ---- board layout ------------------------------------------------------ */
.db-board { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 100px; }
.db-col { width: 260px; flex: 0 0 260px; }
.db-col h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.db-col h3 .n { color: var(--text-3); font-weight: 400; }
.db-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.06);
  cursor: pointer;
}
.db-card:hover { background: var(--bg-hover); }
.db-card .t { font-size: 13px; line-height: 1.35; }
.db-card .meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.db-card.proposed { border-style: dashed; }
.db-card.done { background: var(--bg-2); border-style: solid; box-shadow: none; }
.db-card.done .t { color: var(--text-3); text-decoration: line-through; }

.db-card.dragging { opacity: 0.4; }
.new-card {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
}
.new-card:focus { outline: none; background: var(--bg-hover); }
.new-card::placeholder { color: var(--text-3); }
.db-col-cards.over { background: var(--accent-soft); border-radius: 4px; }

/* ---- popover menu ------------------------------------------------------ */
.menu {
  position: fixed;
  /* Above the side peek (71), or a property menu opened from a card page
     renders behind the page that opened it and looks like a dead click. */
  z-index: 300;
  min-width: 220px;
  max-width: 300px;
  max-height: 60vh;
  overflow: auto;
  background: var(--bg-raised);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 4px;
  font-size: 14px;
}
.menu .search-box {
  width: 100%;
  border: 0;
  background: var(--bg-hover);
  border-radius: var(--radius);
  padding: 5px 7px;
  font: inherit;
  color: var(--text);
  margin-bottom: 4px;
}
.menu .search-box:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.menu .hint {
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  border-radius: var(--radius);
  padding: 5px 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}
.menu-item:hover, .menu-item.cursor { background: var(--bg-hover); }
.menu-item .tick { margin-left: auto; color: var(--text-2); font-size: 12px; }
.menu-item.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---- selection bar ----------------------------------------------------- */
.selbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(140%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 6px;
  box-shadow: var(--shadow);
  transition: transform 140ms ease-out;
  max-width: calc(100vw - 32px);
  overflow-x: auto;
}
.selbar.up { transform: translateX(-50%) translateY(0); }
.selbar .n {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 0 8px 0 4px;
  white-space: nowrap;
}
.selbar button { white-space: nowrap; }

/* ---- side peek --------------------------------------------------------- */
.peek-veil {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 15, 15, 0.12);
  opacity: 0;
  transition: opacity 140ms ease-out;
}
.peek-veil.up { opacity: 1; }
.peek {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 71;
  width: min(560px, 100vw);
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 160ms ease-out;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}
.peek.up { transform: none; }
.peek-top {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.peek-top .crumb {
  font-size: 12px;
  color: var(--text-3);
  margin-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  border: 0; background: none; cursor: pointer;
  color: var(--text-2);
  border-radius: var(--radius);
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.peek-body { flex: 1; overflow: auto; padding: 22px 30px 60px; }
.peek-body h1 {
  margin: 0 0 14px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  outline: none;
}
.peek-body h1:empty::before { content: "Untitled"; color: var(--text-3); }
.props {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  align-items: start;
  gap: 2px 8px;
  margin-bottom: 18px;
}
.props dt {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  color: var(--text-2);
  font-size: 13px;
  padding: 0 4px;
}
.props dd { margin: 0; min-width: 0; }
/* Every value is the same height as its label, whatever it holds. */
.props dd .cell-btn { min-height: 28px; padding: 3px 5px; }
.props dd .chip-btn { padding: 4px 5px; margin-top: 2px; }
.props .stack { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.peek-notes {
  min-height: 90px;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  padding: 4px;
  border-radius: var(--radius);
  white-space: pre-wrap;
}
.peek-notes:empty::before { content: "Add a note…"; color: var(--text-3); }
.peek-notes:focus { background: var(--bg-hover); }

/* ---- toasts ------------------------------------------------------------ */
.toasts {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-raised);
  border-radius: 5px;
  box-shadow: var(--shadow);
  padding: 9px 12px;
  font-size: 13px;
  max-width: 380px;
  animation: rise 140ms ease-out;
}
.toast-item.bad { color: var(--danger); }
.toast-item button {
  border: 0; background: none; cursor: pointer;
  color: var(--accent); font-weight: 600; margin-left: auto;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---- command box ------------------------------------------------------- */
.cmd-veil {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 15, 15, 0.2);
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 16vh;
}
.cmd {
  width: min(560px, calc(100vw - 32px));
  background: var(--bg-raised);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cmd input {
  width: 100%;
  border: 0;
  font: inherit;
  font-size: 15px;
  padding: 13px 15px;
  background: none;
  color: var(--text);
}
.cmd input:focus { outline: none; }
.cmd .results { max-height: 46vh; overflow: auto; border-top: 1px solid var(--line); padding: 4px; }
.cmd .foot {
  border-top: 1px solid var(--line);
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-3);
}

/* ---- phone ------------------------------------------------------------- */
/* ---- calendar layout ----------------------------------------------------
   Two layers over the same hours: meetings behind as a shadow, focus blocks
   in front in the client's colour. The point is to make a conflict visible,
   so overlapping items share the width rather than hiding each other.
   ------------------------------------------------------------------------ */
.cal { padding-bottom: 60px; }
.cal-warn {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-2);
  padding: 7px 10px;
  border-radius: 4px;
}
.cal-warn a { color: var(--accent); }

.cal-grid {
  --hour-h: 46px;
  display: flex;
  gap: 0;
  align-items: stretch;
  /* The first hour label sits above its line, so it needs room or it clips. */
  padding-top: 9px;
}
.cal-gutter {
  flex: 0 0 52px;
  position: relative;
  padding-top: calc(var(--due-rows, 0) * 20px);
}
.cal-week .cal-gutter { padding-top: calc(34px + var(--due-rows, 0) * 20px); }
.cal-hour {
  display: block;
  height: var(--hour-h);
  position: relative;
}
.cal-hour i {
  position: absolute;
  top: -7px;
  right: 10px;
  font-size: 11px;
  font-style: normal;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.cal-hour:last-child { height: 0; }

.cal-col { flex: 1; min-width: 0; border-left: 1px solid var(--line); }
.cal-col.weekend { background: var(--bg-2); }
.cal-head {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
  border-bottom: 1px solid var(--line);
}
.cal-col.is-today .cal-head { color: var(--accent); font-weight: 600; }
.cal-head .dy { font-weight: 600; color: var(--text); }
.cal-col.is-today .cal-head .dy { color: var(--accent); }

.cal-lane {
  position: relative;
  height: calc(var(--hours) * var(--hour-h));
}
.cal-slot {
  position: absolute;
  left: 0;
  right: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  cursor: pointer;
  padding: 0;
}
.cal-slot:hover { background: var(--bg-hover); }

.cal-item {
  position: absolute;
  overflow: hidden;
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 11px;
  line-height: 1.25;
  min-height: 14px;
}
.cal-item.busy {
  /* A meeting is a claim on the time, not a plan for it, so it recedes. */
  background: var(--bg-active);
  color: var(--text-2);
  border-left: 2px solid var(--text-3);
}
.cal-item.block {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
}
.cal-item.block.prot { border-left-color: var(--danger); }
.cal-item.block.done .ci-title { text-decoration: line-through; opacity: 0.65; }
.ci-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ci-when { display: block; font-size: 10px; opacity: 0.7; }
/* Taking a block off the calendar. Big enough to hit, at the far end of the
   block from the tick, and it says what it does. */
.ci-drop {
  position: absolute;
  top: 2px; right: 2px;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border: 0;
  border-radius: 4px;
  background: var(--bg-raised);
  box-shadow: 0 0 0 1px var(--line-2);
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1;
  padding: 0 0 2px;
}
.cal-item:hover .ci-drop { opacity: 1; }
.ci-drop:hover { color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }

.cal-now { position: absolute; left: 0; right: 0; height: 0; z-index: 3; }
.cal-now::before {
  content: "";
  display: block;
  border-top: 2px solid var(--danger);
}
.cal-now i {
  position: absolute;
  left: -4px; top: -4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.cal-lane.over { background: var(--accent-soft); }

/* The tray of work that has not been given time yet. */
.cal-tray { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; }
.tray-items { display: flex; flex-wrap: wrap; gap: 5px; }
.tray-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 4px;
  background: var(--bg-2);
  font-size: 13px;
  cursor: grab;
}
.tray-card.dragging { opacity: 0.4; }

@media (max-width: 820px) {
  .cal-grid { --hour-h: 42px; }
  .cal-gutter { flex-basis: 40px; }
  .cal-tray { flex-direction: column; gap: 4px; }
}

/* ---- dragging -----------------------------------------------------------
   The thing being moved lifts off the page and follows the pointer; a line
   shows the gap it will fall into; everything else slides out of the way.
   ------------------------------------------------------------------------ */
.grip {
  flex: 0 0 auto;
  width: 12px;
  margin-left: -4px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1;
  cursor: grab;
  opacity: 0;
  user-select: none;
  touch-action: none;
}
.db-row:hover .grip,
.db-card:hover .grip,
.side-row:hover .grip { opacity: 0.65; }
.grip:hover { opacity: 1 !important; }
.db-card .grip { position: absolute; top: 9px; left: 4px; }
.db-card { position: relative; padding-left: 20px; }
.side-row .grip { margin: 0 1px 0 -2px; }

/* The original stays in place, faded, so the list never collapses under the
   pointer mid-drag. */
.dragging { opacity: 0.32; }
.dragging * { visibility: hidden; }

.drag-ghost {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  margin: 0;
  border-radius: 4px;
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  opacity: 0.96;
  transform: rotate(0.4deg) scale(1.01);
  overflow: hidden;
}
.drag-ghost-table { border-collapse: collapse; table-layout: fixed; }
.drag-ghost .grip, .drag-ghost .open-btn, .drag-ghost .pick { opacity: 0; }

.drop-line {
  position: fixed;
  z-index: 199;
  height: 2px;
  margin-top: -1px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}
.drop-line::before {
  content: "";
  position: absolute;
  left: -3px; top: -3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* While something is moving, nothing else should look clickable. */
body.is-dragging { cursor: grabbing; user-select: none; }
body.is-dragging .cell-btn:hover,
body.is-dragging .db-row:hover td { background: none; }

.side-sort { display: flex; flex-direction: column; gap: 1px; }
.side-link.muted { color: var(--text-3); }

/* ---- stacking -----------------------------------------------------------
   Collapsing a group should read as the rows folding into the header, not as
   them blinking out. */
.db-row, .new-row { transition: opacity 140ms ease-out; }
.db-row.folding, .new-row.folding { opacity: 0; }
.group-head .toggle svg { transition: transform 160ms cubic-bezier(0.2, 0, 0, 1); }
.group-head .stacked {
  margin-left: 4px;
  font-size: 11px;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 140ms ease-out;
}
.group-head.closed .stacked { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .db-row, .new-row, .group-head .toggle svg, .group-head .stacked { transition: none; }
}

/* ---- segmented controls -------------------------------------------------
   Layout and calendar range are choices you make constantly, so they are
   always on screen rather than inside a menu labelled with the current value.
   ------------------------------------------------------------------------ */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  background: var(--bg-2);
  border-radius: 5px;
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  border-radius: 3px;
  padding: 3px 8px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn:hover { background: var(--bg-hover); color: var(--text); }
.seg-btn.on {
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.12);
}

.cal-nav { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cal-range {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 0 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1080px) {
  /* Keep the glyphs, drop the words, so the toolbar still fits. */
  .seg-btn .seg-text { display: none; }
  .cal-nav .cal-range { font-size: 12px; }
}

/* ---- moving and resizing a block ---------------------------------------
   The block itself moves under the pointer rather than a clone following it:
   on a calendar the thing you are dragging *is* the answer.
   ------------------------------------------------------------------------ */
.cal-item.block { cursor: grab; touch-action: none; }
.cal-item.block.editing {
  cursor: grabbing;
  z-index: 8;
  box-shadow: var(--shadow);
  opacity: 0.95;
}
.ci-resize {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 7px;
  cursor: ns-resize;
  touch-action: none;
}
.ci-resize::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 2px;
  width: 20px; height: 2px;
  margin-left: -10px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0;
}
.cal-item.block:hover .ci-resize::after { opacity: 0.45; }

/* The time it would land on, follows the pointer. */
.cal-readout {
  position: fixed;
  z-index: 210;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* The work waiting for time stays reachable instead of sitting below the day. */
.cal-tray {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 10px 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.tray-card { touch-action: none; }
.m3-pick[data-card-id] { cursor: grab; touch-action: none; }

/* ---- the docked calendar ------------------------------------------------
   The same calendar, beside the list instead of instead of it, so work can be
   dragged onto it without leaving the rows it came from.
   ------------------------------------------------------------------------ */
.db-split { flex: 1; display: flex; min-height: 0; min-width: 0; }
.db-split .db-scroll { flex: 1; min-width: 0; }

.rail {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--bg);
}
.rail-top {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.rail-top .cal-range { flex: 1; font-size: 12px; padding: 0; }
.rail-body { flex: 1; overflow: auto; padding: 0 10px; }
.rail-body .cal { padding-bottom: 20px; }
.rail-body .cal-grid { --hour-h: 34px; }
.rail-body .cal-gutter { flex-basis: 38px; }
.rail-body .cal-tray { display: none; }
.rail-hint {
  margin: 0;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--line);
}

/* ---- deadlines ----------------------------------------------------------
   A deadline says when something is owed, not when it will be done, so it
   never looks like a block: a flag, above the hours, never inside them.
   ------------------------------------------------------------------------ */
/* The all-day row. Fixed height across every column and matched by the
   gutter's padding, so an hour line always sits beside its own label. */
.cal-due {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 2px;
  height: calc(var(--due-rows, 0) * 20px);
  overflow: hidden;
}
.due-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  height: 19px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 3px;
  padding: 0 6px;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.due-chip i { font-style: normal; opacity: 0.7; }
.due-chip:hover { background: var(--bg-active); color: var(--text); }
.due-chip.late { background: rgba(235, 87, 87, 0.14); color: var(--danger); }
.due-chip.late i { opacity: 1; }
.due-chip.small { font-size: 12px; padding: 1px 6px; line-height: 18px; }

.due-flag { opacity: 0.6; margin-right: 1px; }
.cell-btn.due.over .due-flag { opacity: 1; }

/* The scheduled slot is a button now: it opens the day it sits on. */
button.block-pill { border: 0; cursor: pointer; font: inherit; }
button.block-pill:hover { filter: brightness(1.12); }

@media (max-width: 1080px) {
  /* Too narrow to dock: the calendar goes under the list instead of beside it. */
  .db-split { flex-direction: column; }
  .rail { flex: none; border-left: 0; border-top: 1px solid var(--line); max-height: 60vh; }
}

/* A slot that has already passed still says where the work sat, quietly. */
.block-pill.past { opacity: 0.55; border-left-style: dotted; }

/* A deadline is one line, never two. */
.cell-btn.due { white-space: nowrap; flex-wrap: nowrap; }

/* A property that is only shown, never picked. */
.cell-btn.plain { cursor: default; }
.cell-btn.plain:hover { background: none; }


/* ---- Magic 3 ------------------------------------------------------------
   Three outcomes for the week, three picks for today. Compact enough to live
   above the table permanently, because a ritual you have to navigate to is a
   ritual you stop doing.
   ------------------------------------------------------------------------ */
.m3 {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  padding: 12px 46px 4px;
}
.m3-half { display: flex; align-items: flex-start; gap: 10px; min-width: 260px; flex: 1; }
.m3-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-top: 5px;
  width: 62px;
}
.m3-items { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; min-width: 0; }

.m3-goal, .m3-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 4px 3px 6px;
  border-radius: 4px;
  background: var(--bg-2);
  font-size: 13px;
}
.m3-goal.done .m3-text, .m3-pick.done .m3-text {
  color: var(--text-3);
  text-decoration: line-through;
}
.m3-pick.empty { color: var(--text-3); background: none; box-shadow: inset 0 0 0 1px var(--line); }
.m3-text {
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.m3-text:hover { text-decoration: underline; }
.m3-when { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.m3-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.m3-tick {
  border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-size: 12px; line-height: 1; padding: 0;
}
.m3-bar {
  width: 40px; height: 3px; border-radius: 2px;
  background: var(--line-2); overflow: hidden; flex: 0 0 auto;
}
.m3-bar i { display: block; height: 100%; background: var(--accent); }
.m3-drop {
  opacity: 0;
  border: 0; background: none; cursor: pointer;
  color: var(--text-3); font-size: 14px; line-height: 1; padding: 0 2px;
}
.m3-goal:hover .m3-drop, .m3-pick:hover .m3-drop { opacity: 1; }
.m3-drop:hover { color: var(--danger); }
.m3-add {
  border: 0; background: none; font: inherit; font-size: 13px;
  color: var(--text); padding: 4px 6px; border-radius: 4px; min-width: 190px;
}
.m3-add:focus { outline: none; background: var(--bg-hover); }
.m3-add::placeholder { color: var(--text-3); }

/* ---- today dot ----------------------------------------------------------
   The one-tap way a row becomes one of today's three. Invisible until hover,
   so it never competes with the title. */
/* A small solid dot, never a ring: a ring would read as a second tick box.
   Half the size of the tick and on the other side of the title. */
.today-dot {
  flex: 0 0 auto;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 0;
  background: var(--text-3);
  cursor: pointer;
  padding: 0;
  opacity: 0;
}
.db-row:hover .today-dot { opacity: 0.4; }
.today-dot:hover { opacity: 1 !important; background: var(--danger); }
.today-dot.on { opacity: 1 !important; background: var(--danger); }

/* ---- sidebar rows with a manage menu ----------------------------------- */
.side-row { display: flex; align-items: center; }
.side-row a { flex: 1; min-width: 0; }
.side-row a > :not(.pill):not(.count) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-more {
  opacity: 0;
  border: 0; background: none; cursor: pointer;
  color: var(--text-3);
  border-radius: var(--radius);
  padding: 2px 5px;
  line-height: 1;
}
.side-row:hover .side-more { opacity: 1; }
.side-more:hover { background: var(--bg-active); color: var(--text); }

/* ==========================================================================
   Phone
   ==========================================================================
   A phone is not for arranging a database. It is for seeing what is on today,
   catching something before it is forgotten, and ticking something off. So:
   the sidebar becomes a sheet, filters collapse behind one button, the page
   header goes, and the things switched between constantly move to the thumb.
   ========================================================================== */

.phone-top, .phone-bottom, .filter-toggle, .side-scrim { display: none; }

@media (max-width: 820px) {
  .phone-top {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .phone-title {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The sidebar slides over instead of eating the top of every screen. */
  .db-shell { position: relative; }
  .db-side {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 75;
    width: 82vw;
    max-width: 320px;
    flex: none;
    overflow-y: auto;
    transform: translateX(-102%);
    transition: transform 180ms cubic-bezier(0.2, 0, 0, 1);
    border-right: 1px solid var(--line);
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  body.side-open .db-side { transform: none; box-shadow: var(--shadow); }
  /* Driven by the body class, not by [hidden]: a class rule setting display
     overrides the hidden attribute, which left the scrim covering the page. */
  body.side-open .side-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 74;
    background: rgba(15, 15, 15, 0.4);
  }
  .db-side .side-row { flex: 0 0 auto; }
  .db-side .side-more, .db-side .grip { display: none; }
  .db-side .group-title, .db-side .count { display: block; }

  /* The header band says nothing the tabs do not. */
  .db-head { display: none; }

  .db-tabs { padding: 6px 12px 0; }
  .db-bar { padding: 6px 12px; gap: 6px; }
  .filter-toggle { display: inline-flex; }
  /* One button, and the chips only when asked for. The selector has to match
     `.db-bar .bar-side` for specificity, or the chips stay visible. */
  .db-bar .bar-filters { display: none; width: 100%; }
  body.filters-open .db-bar .bar-filters { display: flex; }
  .db-bar .bar-side:last-child { width: 100%; gap: 6px; }
  .db-bar .search { flex: 1; min-width: 90px; width: auto; }
  /* The thumb bar already switches layout, and a docked calendar on a 400px
     screen is just the calendar with a list above it — which is the Day tab. */
  .db-bar .seg:not(.cal-nav .seg),
  [data-rail-toggle] { display: none; }
  .cal-nav { order: -1; }
  .cal-nav .seg { display: inline-flex; }

  /* Magic 3 stays, compact: it is the reason to open this on a phone. */
  .m3 { padding: 8px 12px 2px; gap: 6px; }
  .m3-half { min-width: 100%; align-items: center; }
  .m3-label { width: 48px; padding-top: 0; font-size: 10px; }
  .m3-items { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .m3-items::-webkit-scrollbar { display: none; }
  .m3-text { max-width: 18ch; }
  .m3-add { min-width: 150px; }

  .db-split { flex-direction: column; }
  .db-scroll { padding: 0 12px 110px; }
  .rail { flex: none; border-left: 0; border-top: 1px solid var(--line); max-height: 58vh; }

  /* A table on a phone is a list: the properties that matter, nothing else. */
  .db-table { min-width: 0; }
  .db-table thead { display: none; }
  .col-client, .col-labels, .col-due, .col-open { display: none; }
  .col-title { width: auto; }
  .db-table td { height: auto; padding: 9px 6px; }
  .db-row .pick { opacity: 1; }
  .grip { opacity: 0.45; }
  .today-dot { opacity: 0.5; }
  .db-row .title-text { white-space: normal; }
  .col-next_block { width: 40%; text-align: right; }

  .db-board { gap: 10px; }
  .db-col { width: 78vw; flex-basis: 78vw; }

  .cal-grid { --hour-h: 44px; }
  .cal-gutter { flex-basis: 38px; }
  .cal-nav { width: 100%; justify-content: space-between; }
  .cal-tray { padding-bottom: 14px; }

  .peek { width: 100vw; }
  .props { grid-template-columns: 96px minmax(0, 1fr); }
  .selbar {
    left: 12px; right: 12px;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
  .toasts { left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

  /* The thumb zone. */
  .phone-bottom {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 2px;
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    border-top: 1px solid var(--line);
  }
  .pb-btn {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border: 0;
    background: none;
    color: var(--text-3);
    font-size: 10px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    min-width: 54px;
  }
  .pb-btn span { font-size: 16px; line-height: 1; }
  .pb-btn.on { color: var(--accent); }
  .pb-add {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: var(--accent);
    color: #fff;
    width: 46px; height: 46px;
    border-radius: 50%;
    font-size: 26px;
    font-weight: 300;
    line-height: 0;
    padding-bottom: 3px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(35, 131, 226, 0.4);
  }
}

@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  .db-side { transition: none; }
}

/* ---- the scheduling picker ---------------------------------------------
   Blocking time is a question about the day, not a number picked from a list,
   so it opens the day with everything already on it.
   ------------------------------------------------------------------------ */
.picker-pop {
  position: fixed;
  z-index: 305;
  width: min(460px, calc(100vw - 24px));
  background: var(--bg-raised);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.picker-top {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.picker-when {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.picker-for {
  margin: 0;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-for strong { color: var(--text); font-weight: 600; }
.picker-cal { max-height: 46vh; overflow: auto; padding: 0 10px; }
.picker-cal .cal { padding-bottom: 12px; }
.picker-cal .cal-grid { --hour-h: 32px; }
.picker-cal .cal-gutter { flex-basis: 36px; }
.picker-cal .cal-tray, .picker-cal .cal-warn { display: none; }
/* The gaps are the point, so they invite a click rather than hiding. */
.picker-cal .cal-slot:hover { background: var(--accent-soft); }
.picker-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}
.picker-hint { margin-left: auto; font-size: 11px; color: var(--text-3); }

/* ---- a deadline that names an hour -------------------------------------
   Drawn where it bites, but never as a bar that could be mistaken for time
   set aside. */
.cal-item.deadline {
  background: none;
  border-left: 0;
  color: var(--danger);
  font-weight: 600;
  padding: 0 4px;
  pointer-events: auto;
  cursor: pointer;
  border-top: 1.5px dashed currentColor;
}
.cal-item.deadline .ci-title { gap: 3px; }
.cal-item.deadline i { font-style: normal; }

.due-edit { display: flex; gap: 4px; padding: 0 0 4px; }
.due-edit input { flex: 1; min-width: 0; }

/* The empty slot is a button now, so it must not inherit button chrome. */
button.m3-pick.empty {
  border: 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
}
button.m3-pick.empty:hover { background: var(--bg-hover); color: var(--text); }

/* ---- the plain pages ----------------------------------------------------
   Sign-in, settings, archive, history, OAuth consent. Not the database, but
   not a different app either.
   ------------------------------------------------------------------------ */
body.page { background: var(--bg); margin: 0; }
.page-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 28px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--line);
}
.page-top .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.page-top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.page-top nav a {
  padding: 4px 9px;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.page-top nav a:hover { background: var(--bg-hover); color: var(--text); }
.page-top form { margin-left: auto; }

.page-body { padding: 28px; max-width: 900px; }
.page-body h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.page-body h2 { margin: 24px 0 8px; font-size: 16px; font-weight: 600; }
.page-body p { color: var(--text-2); line-height: 1.6; }
.page-body a { color: var(--accent); }
.page-body code {
  font-size: 12px;
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 3px;
}

.plain-list { list-style: none; margin: 14px 0 0; padding: 0; }
.plain-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.plain-list li .when { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.plain-list .muted { color: var(--text-3); }
.plain-list form { margin-left: auto; }

.card-form { max-width: 360px; display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.card-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.card-form input[type="email"],
.card-form input[type="password"],
.card-form input[type="text"] {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}
.card-form input:focus { outline: none; border-color: var(--accent); }
.card-form .row { flex-direction: row; align-items: center; gap: 7px; }
.button, .card-form button[type="submit"] {
  display: inline-block;
  border: 0;
  padding: 9px 14px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
.error { color: var(--danger); font-size: 13px; }
.toast.error { color: var(--danger); }

@media (max-width: 820px) {
  .page-top { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .page-body { padding: 18px 14px; }
}
.button-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; }

/* ---- lanes --------------------------------------------------------------
   A lane is whatever the view groups by, so the board's columns and the
   table's group headers carry the same controls.
   ------------------------------------------------------------------------ */
.lane-more {
  opacity: 0;
  border: 0; background: none; cursor: pointer;
  color: var(--text-3);
  border-radius: var(--radius);
  padding: 1px 5px;
  line-height: 1;
}
.db-col:hover .lane-more, .group-head:hover .lane-more { opacity: 1; }
.lane-more:hover { background: var(--bg-active); color: var(--text); }
.lane-done { color: var(--text-3); font-size: 11px; }
.db-col h3 .grip { opacity: 0; }
.db-col:hover h3 .grip { opacity: 0.55; }
.db-col.dragging { opacity: 0.35; }
.db-col-add { width: 200px; flex: 0 0 200px; padding-top: 26px; }
.lane-row input { color: var(--text-3); }

/* ---- one card, without selecting it first ------------------------------ */
.card-more {
  position: absolute;
  top: 6px; right: 4px;
  opacity: 0;
  border: 0; background: none; cursor: pointer;
  color: var(--text-3);
  border-radius: var(--radius);
  padding: 1px 5px;
  line-height: 1;
}
.db-card:hover .card-more { opacity: 1; }
.card-more:hover { background: var(--bg-active); color: var(--text); }
.db-card { padding-right: 24px; }
.col-open { width: 58px; white-space: nowrap; }
.peek-more { margin-left: auto; }
.chip-btn.danger, .menu-item.danger { color: var(--danger); }
.chip-btn.danger:hover { background: rgba(235, 87, 87, 0.14); }

/* ---- done ---------------------------------------------------------------
   Finishing something is the most frequent act on a task board, so it is a
   tick box in every overview rather than a status you pick from a menu. A
   rounded square, so it never reads as the round "today" dot.
   ------------------------------------------------------------------------ */
.tick {
  flex: 0 0 auto;
  width: 17px; height: 17px;
  border: 1.5px solid var(--line-2);
  /* A circle, never a square: the square beside it selects rows, and two
     different acts must not share a shape. */
  border-radius: 50%;
  background: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: background 120ms ease-out, border-color 120ms ease-out;
}
/* The tick shows faintly on hover, so the target says what it does before
   it is pressed. */
.tick::after {
  content: "";
  position: absolute;
  left: 5px; top: 3px;
  width: 4px; height: 8px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
  opacity: 0;
}
.tick:hover { border-color: #16a34a; color: #16a34a; }
.tick:hover::after { opacity: 0.55; }
.tick.on {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.tick.on::after { opacity: 1; }

/* Struck through once finished, wherever it is drawn. */
.db-row.done .title-text,
.db-card.done .t span,
.m3-pick.done .m3-text { text-decoration: line-through; color: var(--text-3); }

/* The "today" dot follows the title now: a marker, not a second button
   competing with the tick box for the leftmost spot. */
.title-cell .today-dot { margin-left: 6px; }

.db-card .t { display: flex; align-items: flex-start; gap: 7px; }
.db-card .t .tick { margin-top: 1px; }

/* The tick leads the block, exactly as it leads a row and a card. */
.ci-tick {
  width: 13px; height: 13px;
  margin-right: 1px;
  opacity: 0.45;
}
.ci-tick::after { left: 3.5px; top: 2px; width: 3px; height: 6px; border-width: 0 1.5px 1.5px 0; }
.cal-item:hover .ci-tick, .ci-tick.on { opacity: 1; }
.cal-item.block { padding-right: 22px; }

/* In the card page it is a labelled button, because there is room to say it. */
.done-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  background: none;
  border-radius: 5px;
  padding: 6px 12px 6px 10px;
  margin-bottom: 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.done-btn:hover { background: var(--bg-hover); color: var(--text); }
.done-btn.on { color: #16a34a; border-color: #16a34a; }
.done-btn .tick { pointer-events: none; }

/* ---- steps --------------------------------------------------------------
   One bigger task, some steps under it. A step is a real card, so it looks
   like one — indented, never a different species.
   ------------------------------------------------------------------------ */
.twist {
  flex: 0 0 auto;
  width: 14px; height: 14px;
  margin-left: -2px;
  border: 0;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}
.twist:hover { background: var(--bg-active); color: var(--text); }
.twist svg { transition: transform 140ms cubic-bezier(0.2, 0, 0, 1); }
.twist.open svg { transform: rotate(90deg); }
.twist-space { flex: 0 0 auto; width: 14px; margin-left: -2px; }

.db-row.is-step .title-cell { padding-left: 26px; }
.db-row.is-step td:first-child { box-shadow: inset 2px 0 0 var(--line-2); }

.steps-count {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.parent-chip {
  flex: 0 0 auto;
  border: 0;
  background: var(--bg-2);
  color: var(--text-3);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  cursor: pointer;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.parent-chip:hover { color: var(--text); }
.steps-pill { border: 0; cursor: pointer; font: inherit; }

/* ---- the card page's step list ---------------------------------------- */
.steps { margin: 4px 0 18px; }
.steps-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.steps-head .n { color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.steps-list { list-style: none; margin: 0; padding: 0; }
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.step.done .step-title { text-decoration: line-through; color: var(--text-3); }
.step-title { flex: 1; min-width: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-title:hover { text-decoration: underline; }
.step-when { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.step .m3-dot.today { background: var(--danger); }
.step-more {
  opacity: 0;
  border: 0; background: none; cursor: pointer;
  color: var(--text-3); border-radius: 3px; padding: 1px 5px; line-height: 1;
}
.step:hover .step-more { opacity: 1; }
.step-add {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 7px 4px;
  border-radius: 4px;
}
.step-add:focus { outline: none; background: var(--bg-hover); }
.step-add::placeholder { color: var(--text-3); }

.peek-parent { margin: -6px 0 14px; font-size: 12px; color: var(--text-3); }
.link-like {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit;
}
.link-like:hover { text-decoration: underline; }

.m3-parent {
  font-size: 10px;
  color: var(--text-3);
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
