:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #2b2b2b;
  --muted: #7a7a7a;
  --border: #e4e1da;
  --accent: #3d8bfd;
  --radius: 10px;
  --sidebar-w: 260px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
#app { min-height: 100vh; }

/* ---------- Auth ---------- */
.auth-wrap {
  max-width: 380px;
  margin: 10vh auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.auth-wrap h1 { font-size: 1.3rem; margin-top: 0; }
.auth-wrap input {
  width: 100%; padding: 10px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 1rem;
}
.auth-wrap button {
  width: 100%; padding: 10px; border: none; border-radius: 6px;
  background: var(--accent); color: white; font-size: 1rem; cursor: pointer;
}
.auth-toggle { text-align: center; margin-top: 12px; font-size: 0.9rem; color: var(--muted); }
.auth-toggle a { color: var(--accent); cursor: pointer; }
.error-msg { color: #d33; font-size: 0.85rem; margin-bottom: 8px; }

/* ---------- Shell layout: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0; overflow-y: auto;
}
.sidebar-header { padding: 14px 14px 8px; }
.sidebar-header .brand { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 6px; }
.sidebar-who { display: flex; align-items: center; gap: 8px; padding: 8px 14px 14px; border-bottom: 1px solid var(--border); }
.sidebar-who .name { font-size: 0.85rem; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.sidebar-who .name:hover { text-decoration: underline; }
.sidebar-who button { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 0.75rem; text-decoration: underline; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; color: white;
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}

.sidebar-nav { padding: 8px 8px; }
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px;
  cursor: pointer; font-size: 0.88rem; color: var(--ink);
}
.sidebar-nav .nav-item:hover { background: var(--bg); }
.sidebar-nav .nav-item.active { background: var(--bg); font-weight: 700; }

.sidebar-section { padding: 10px 8px 0; }
.sidebar-section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.sidebar-section-title .add-icon { cursor: pointer; font-size: 0.95rem; color: var(--muted); }
.sidebar-section-title .add-icon:hover { color: var(--accent); }

.folder-block { margin-bottom: 2px; }
.folder-header {
  display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 6px;
  cursor: pointer; font-size: 0.85rem; font-weight: 700;
}
.folder-header:hover { background: var(--bg); }
.folder-header .chev { display: inline-block; transition: transform 0.15s; font-size: 0.7rem; color: var(--muted); }
.folder-header.collapsed .chev { transform: rotate(-90deg); }
.folder-items { padding-left: 18px; }
.folder-items.hidden { display: none; }

.item-link {
  display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 6px;
  cursor: pointer; font-size: 0.85rem; color: var(--ink); overflow: hidden;
}
.item-link span.label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.item-link:hover { background: var(--bg); }
.item-link.active { background: #eaf1ff; color: var(--accent); font-weight: 600; }
.item-icon { flex-shrink: 0; font-size: 0.9rem; }
.item-menu-btn { flex-shrink: 0; font-weight: 700; color: var(--muted); opacity: 0; cursor: pointer; padding: 0 4px; border-radius: 4px; }
.item-link:hover .item-menu-btn { opacity: 1; }
.item-menu-btn:hover { background: var(--border); color: var(--ink); }
.move-icon:hover { opacity: 1 !important; }

.sidebar-add-row { padding: 4px 10px 10px; }
.sidebar-add-row button {
  width: 100%; text-align: left; border: none; background: none; color: var(--muted);
  font-size: 0.82rem; cursor: pointer; padding: 5px 0;
}
.sidebar-add-row button:hover { color: var(--accent); }

main.content { flex: 1; padding: 20px 24px; min-width: 0; }
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.content-header h1 { font-size: 1.25rem; margin: 0; }

/* ---------- Table board ---------- */
.board-table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
table.board-table { border-collapse: collapse; width: 100%; min-width: 640px; table-layout: fixed; }
table.board-table th {
  text-align: left; font-size: 0.75rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: relative;
}
table.board-table th.name-col { min-width: 200px; }
table.board-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.88rem;
  vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.col-resize-handle {
  position: absolute; top: 0; right: -3px; width: 6px; height: 100%; cursor: col-resize; z-index: 5;
}
.col-resize-handle:hover, .col-resize-handle:active { background: var(--accent); opacity: 0.4; }
tr.group-row td {
  background: var(--panel); font-weight: 700; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
tr.group-row .chev { display: inline-block; margin-right: 6px; transition: transform 0.15s; cursor: pointer; }
tr.group-row.collapsed .chev { transform: rotate(-90deg); }
.group-title { cursor: pointer; font-size: 1.2rem; }
.group-title:hover { text-decoration: underline; }
.group-menu-btn { cursor: pointer; color: var(--muted); margin-right: 8px; font-weight: 700; }
.group-menu-btn:hover { color: var(--ink); }
.group-check-cell { background: var(--panel); border-bottom: 1px solid var(--border); text-align: center; width: 32px; }
.group-spacer td { border: none; height: 44px; background: var(--bg); padding: 0; }
.check-col-head { width: 32px; }
.item-check-cell { text-align: center; width: 32px; }
tr.item-row.selected { background: #eaf1ff; }
.selection-bar {
  position: sticky; bottom: 0; margin-top: 10px; background: var(--ink); color: white;
  border-radius: 10px; padding: 10px 16px; display: flex; align-items: center; gap: 12px; font-size: 0.85rem;
}
.selection-bar select { padding: 4px 8px; border-radius: 6px; border: none; }
.selection-bar .btn { border: none; }
.selection-bar .btn.danger { background: #ef476f; color: white; }
tr.item-row.hidden { display: none; }
tr.item-row:hover { background: #fafaf8; }
.item-name-cell { cursor: pointer; font-weight: 500; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.item-name-cell:hover { color: var(--accent); text-decoration: underline; }

.cell-editable { cursor: pointer; border-radius: 6px; padding: 4px 6px; display: inline-block; min-width: 30px; color: var(--muted); }
.cell-editable:hover { background: var(--bg); color: var(--ink); }
.cell-input { width: 100%; min-width: 70px; padding: 4px 6px; border: 1px solid var(--accent); border-radius: 6px; font-size: 0.85rem; font-family: inherit; }

.status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 14px; color: white;
  font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.status-menu {
  position: absolute; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12); z-index: 60; padding: 4px; min-width: 160px;
}
.status-menu .opt { padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; }
.status-menu .opt:hover { background: var(--bg); }
.status-menu .swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.color-grid-menu {
  position: absolute; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12); z-index: 60; padding: 10px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 190px;
}
.color-swatch-btn { width: 28px; height: 28px; border-radius: 6px; cursor: pointer; display: inline-block; }
.color-swatch-btn:hover { outline: 2px solid var(--ink); outline-offset: 1px; }

.person-chips { display: flex; gap: 4px; flex-wrap: wrap; cursor: pointer; }
.person-chip {
  display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 12px;
  padding: 2px 8px 2px 2px; font-size: 0.75rem;
}
.person-chip .avatar { width: 18px; height: 18px; font-size: 0.6rem; }
.person-menu {
  position: absolute; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12); z-index: 60; padding: 4px; min-width: 180px;
}
.person-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; }
.person-menu label:hover { background: var(--bg); }
.checkbox-cell { cursor: pointer; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; }
.checkbox-cell:hover { background: var(--bg); }
.checkbox-empty { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-radius: 4px; }
.add-teammate-link { display: block; text-align: center; padding: 8px; border-top: 1px solid var(--border); margin-top: 4px; color: var(--accent); cursor: pointer; font-size: 0.85rem; }
.add-teammate-link:hover { text-decoration: underline; }
.edit-labels-link { display: block; text-align: center; padding: 8px; border-top: 1px solid var(--border); margin-top: 4px; color: var(--muted); cursor: pointer; font-size: 0.85rem; }
.edit-labels-link:hover { color: var(--ink); }
.label-edit-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.label-edit-row input[type=color] { width: 30px; height: 30px; border: none; padding: 0; flex-shrink: 0; }
.label-edit-row input[type=text] { flex: 1; }

.add-item-row td { padding: 6px 10px; }
.add-item-btn { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 4px 0; }
.add-item-btn:hover { color: var(--accent); }
.add-group-btn { margin-top: 10px; }
.col-actions { display: flex; align-items: center; gap: 4px; }
.col-name-btn { cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.col-name-btn:hover { background: rgba(0,0,0,0.06); }
.wrap-cell { white-space: normal !important; max-width: 280px; overflow: visible; text-overflow: clip; }
tr.item-row { cursor: grab; }
tr.item-row.drag-over { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.add-item-row.drag-over td { background: #eaf1ff; }
.add-col-btn {
  border: 1px dashed var(--border); background: none; color: var(--muted); cursor: pointer;
  padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; white-space: nowrap;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px;
  overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--panel); border-radius: var(--radius); padding: 20px;
  width: 100%; max-width: 480px;
}
.modal.wide { max-width: 640px; }
.modal h2 { margin-top: 0; font-size: 1.1rem; }
.modal label { display: block; font-size: 0.8rem; color: var(--muted); margin: 10px 0 4px; }
.modal input, .modal select, .modal textarea {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; font-family: inherit;
}
.modal textarea { min-height: 70px; resize: vertical; }
.modal-actions { display: flex; justify-content: space-between; margin-top: 16px; gap: 8px; }
.modal-actions .left { display: flex; gap: 8px; }
.btn { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; font-size: 0.85rem; }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.danger { color: #d33; }
.btn.small { padding: 4px 10px; font-size: 0.78rem; }

.comments { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.comments > label { font-weight: 600; color: var(--ink); }
.comment-list { max-height: 320px; overflow-y: auto; margin: 8px 0; }
.comment { display: flex; gap: 8px; font-size: 0.85rem; margin-bottom: 12px; }
.comment .comment-body { flex: 1; }
.comment .who { font-weight: 700; margin-right: 6px; }
.comment .when { color: var(--muted); font-size: 0.75rem; }
.comment .mention { background: #eaf1ff; color: var(--accent); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.comment-form { display: flex; gap: 6px; margin-top: 8px; }
.comment-form textarea { flex: 1; min-height: 50px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 0.88rem; resize: vertical; }
.comment-form textarea.drag-over { border-color: var(--accent); background: #eaf1ff; }
.comment-badge { display: inline-flex; align-items: center; gap: 2px; font-size: 0.72rem; color: var(--muted); margin-left: 6px; background: var(--bg); border-radius: 10px; padding: 1px 6px; }
.updates-col-head { text-align: center; width: 90px; }
.updates-cell { text-align: center; cursor: pointer; color: var(--muted); overflow: visible; }
.updates-cell:hover { background: var(--bg); }
.updates-cell .update-count { font-weight: 600; color: var(--ink); }
.updates-cell .update-add { opacity: 0; font-size: 0.85rem; }
tr.item-row:hover .update-add { opacity: 0.5; }
.updates-modal-header { font-size: 1.15rem; font-weight: 700; padding: 4px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.update-toolbar { display: flex; gap: 4px; margin-top: 10px; }
.update-toolbar .tb-btn {
  border: 1px solid var(--border); background: var(--panel); border-radius: 6px; width: 30px; height: 30px;
  cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.update-toolbar .tb-btn:hover { background: var(--bg); }
.rendered-comment img { max-width: 100%; border-radius: 6px; margin: 6px 0; display: block; }
.rendered-comment p { margin: 0 0 6px; }
.rendered-comment ul { margin: 0 0 6px; padding-left: 18px; }
.rendered-comment a { color: var(--accent); }

.field-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.field-row .fname { color: var(--muted); }

/* ---------- New board setup ---------- */
.setup-col-row, .setup-group-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.setup-col-row input[type=text], .setup-group-row input[type=text] { flex: 1; }
.setup-col-row select { width: 120px; flex-shrink: 0; }
.setup-remove { cursor: pointer; color: var(--muted); padding: 4px 8px; }
.status-opt-row { display: flex; gap: 6px; align-items: center; margin: 4px 0 4px 20px; }
.status-opt-row input[type=text] { flex: 1; }
.status-opt-row input[type=color] { width: 34px; height: 30px; border: none; padding: 0; }

/* ---------- Calendar ---------- */
.cal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-views { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.cal-views .seg { border: none; background: none; padding: 6px 14px; cursor: pointer; font-size: 0.85rem; color: var(--ink); }
.cal-views .seg + .seg { border-left: 1px solid var(--border); }
.cal-views .seg.on { background: #eaf1ff; color: var(--accent); font-weight: 600; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-label { margin-left: 8px; font-size: 1.05rem; }
.cal-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); font-size: 0.82rem; }
.cal-check { display: inline-flex; align-items: center; gap: 4px; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.btn.content-on { background: #fff3d6; border-color: #f1af54; color: #8a5a00; font-weight: 600; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.75rem; color: var(--muted); margin-bottom: 8px; min-height: 16px; }
.cal-leg { display: inline-flex; align-items: center; gap: 5px; }
.cal-ldot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.cal-tip { font-size: 0.75rem; color: var(--muted); margin-top: 10px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { font-size: 0.75rem; color: var(--muted); text-align: center; margin-bottom: 2px; }
.cal-cell {
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  min-height: 108px; padding: 4px; font-size: 0.75rem; cursor: pointer; min-width: 0;
}
.cal-cell.other { background: #faf9f6; }
.cal-cell.other .daynum { opacity: 0.5; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.today .daynum { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; }
.cal-daytop { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.cal-cell .daynum { color: var(--muted); font-weight: 600; }
.cal-add { border: none; background: none; color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; opacity: 0; padding: 0 4px; border-radius: 4px; }
.cal-cell:hover .cal-add, .cal-add.show { opacity: 1; }
.cal-add:hover { background: #eaf1ff; color: var(--accent); }
.drop-hover { background: #eaf1ff !important; outline: 2px dashed var(--accent); outline-offset: -2px; }

.cal-chip {
  display: flex; align-items: center; gap: 3px; background: color-mix(in srgb, var(--chip) 16%, white);
  border-left: 3px solid var(--chip); border-radius: 4px; padding: 2px 5px; margin-bottom: 2px;
  cursor: grab; white-space: nowrap; overflow: hidden; font-size: 0.74rem; color: var(--ink);
}
.cal-chip:hover { background: color-mix(in srgb, var(--chip) 30%, white); }
.cal-chip.dragging, .cal-lrow.dragging { opacity: 0.4; }
.cal-chip-name { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.cal-chip-board { font-size: 0.66rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.cal-chip.done, .cal-lrow.done { opacity: 0.5; }
.cal-chip.done .cal-chip-name, .cal-lrow.done .cal-lname { text-decoration: line-through; }
.cal-flag { background: #d83a52; color: #fff; border-radius: 50%; width: 13px; height: 13px; font-size: 0.6rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cal-chip.overdue .cal-chip-name { color: #b3261e; }
.cal-rep { font-size: 0.65rem; }
.cal-more { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 0.72rem; padding: 1px 4px; }
.cal-more:hover { text-decoration: underline; }

.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-wcol { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; min-height: 420px; display: flex; flex-direction: column; min-width: 0; }
.cal-wcol.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-whead { display: flex; align-items: baseline; gap: 6px; padding: 8px 8px 6px; border-bottom: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); }
.cal-whead strong { font-size: 1.1rem; color: var(--ink); }
.cal-wcol.today .cal-whead strong { color: var(--accent); }
.cal-wbody { padding: 6px; flex: 1; }
.cal-wbody .cal-chip { flex-wrap: wrap; white-space: normal; padding: 4px 6px; }
.cal-wbody .cal-chip-board { max-width: none; flex-basis: 100%; }
.cal-wadd { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 0.78rem; padding: 4px; width: 100%; text-align: left; opacity: 0; }
.cal-wcol:hover .cal-wadd { opacity: 1; }
.cal-wadd:hover { color: var(--accent); }

.cal-list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-lday + .cal-lday { border-top: 1px solid var(--border); }
.cal-lhead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #faf9f6; font-weight: 600; font-size: 0.85rem; }
.cal-lday.today .cal-lhead { color: var(--accent); background: #eef4ff; }
.cal-lrow { display: grid; grid-template-columns: 14px minmax(0, 2fr) minmax(0, 1.4fr) 120px 80px; align-items: center; gap: 10px; padding: 7px 12px; border-top: 1px solid #f0eee9; cursor: pointer; font-size: 0.86rem; }
.cal-lrow:hover { background: #f7f9ff; }
.cal-lname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-lrow.overdue .cal-lname { color: #b3261e; }
.cal-lwhere { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-lstatus { color: #fff; font-size: 0.74rem; text-align: center; border-radius: 4px; padding: 2px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-lstatus.empty { background: none; }
.cal-lpeople { display: flex; justify-content: flex-end; gap: 2px; }
.cal-lempty { padding: 10px 12px; color: var(--muted); font-size: 0.85rem; }

.cal-pop { padding: 8px; width: 280px; max-height: 60vh; overflow: auto; }
.cal-pop .cal-chip { font-size: 0.8rem; padding: 4px 6px; }
.cal-pop-head { font-weight: 700; font-size: 0.85rem; margin: 2px 2px 8px; }
.cal-pop-note { font-size: 0.78rem; color: var(--muted); margin: 0 2px 8px; }
.cal-bp-list { max-height: 45vh; overflow: auto; }
.cal-bp-row { display: flex; align-items: center; gap: 7px; padding: 4px 4px; font-size: 0.85rem; cursor: pointer; border-radius: 4px; }
.cal-bp-row:hover { background: var(--bg); }

.repeat-badge { font-size: 0.75rem; margin-left: 6px; cursor: default; }
#repeatHost .modal-backdrop { z-index: 1200; }
.rp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rp-row input[type=number] { width: 70px; }
.rp-row select { flex: 1; }
.rp-now { background: #eef8f1; border: 1px solid #bfe5cb; border-radius: 6px; padding: 8px 10px; font-size: 0.85rem; margin-bottom: 6px; }

@media (max-width: 760px) {
  .cal-cell { min-height: 70px; }
  .cal-chip-name { font-size: 0.66rem; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-wcol { min-height: 0; }
  .cal-lrow { grid-template-columns: 14px 1fr 90px; }
  .cal-lwhere, .cal-lpeople { display: none; }
}

/* ---------- Docs ---------- */
/* ---------- Docs (always-editable, monday-style) ---------- */
.doc-page { max-width: 980px; }
.doc-toolbar.ql-toolbar.ql-snow {
  position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px;
  font-family: inherit; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.doc-toolbar.ql-snow .ql-formats { margin-right: 0; }
.doc-toolbar .tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.doc-toolbar .tb-btn { width: 30px; height: 28px; border: none; background: none; cursor: pointer; font-size: 1.05rem; color: #444; border-radius: 4px; padding: 0; }
.doc-toolbar .tb-btn:hover { background: var(--bg); }
.doc-toolbar.ql-snow button:hover { background: var(--bg); border-radius: 4px; }
.doc-toolbar.ql-snow .ql-picker.ql-header { width: 128px; }
.doc-toolbar.ql-snow .ql-picker.ql-header .ql-picker-label::before,
.doc-toolbar.ql-snow .ql-picker.ql-header .ql-picker-item::before { content: 'Normal text'; }
.doc-toolbar.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
.doc-toolbar.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { content: 'Large title'; }
.doc-toolbar.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.doc-toolbar.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: 'Medium title'; }
.doc-toolbar.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.doc-toolbar.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: 'Small title'; }
.doc-add-btn { background: var(--accent); color: white; border: none; border-radius: 6px; padding: 6px 14px !important; width: auto !important; height: auto !important; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.doc-toolbar.ql-snow .doc-add-btn:hover { background: var(--accent); filter: brightness(1.08); }
.doc-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.doc-table-bar { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.doc-table-bar.hidden { display: none; }
.doc-sheet { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; padding: 36px 56px 48px; min-height: 60vh; }
.doc-title-input { width: 100%; border: none; resize: none; overflow: hidden; font-family: inherit; font-size: 2.1rem; font-weight: 800; line-height: 1.2; color: var(--ink); padding: 0; background: transparent; }
.doc-title-input:focus { outline: none; }
.doc-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; margin: 10px 0 18px; }
.doc-sheet .ql-container.ql-snow { border: none; font-family: inherit; font-size: 1rem; }
.doc-sheet .ql-editor { padding: 0; line-height: 1.65; min-height: 40vh; }
.doc-sheet .ql-editor.ql-blank::before { left: 0; right: 0; font-style: normal; color: #aaa; }
.doc-sheet .ql-editor h1 { font-size: 1.8rem; margin: 18px 0 6px; }
.doc-sheet .ql-editor h2 { font-size: 1.4rem; margin: 16px 0 6px; }
.doc-sheet .ql-editor h3 { font-size: 1.15rem; margin: 14px 0 4px; }
.doc-sheet .ql-editor p { margin: 0 0 4px; }
.doc-sheet .ql-editor img { max-width: 100%; border-radius: 6px; margin: 8px 0; }
.doc-sheet .ql-editor hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.doc-sheet .ql-editor table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.doc-sheet .ql-editor td { border: 1px solid var(--border); padding: 6px 8px; min-width: 60px; }
.doc-sheet .ql-editor li[data-list="checked"] { color: var(--muted); text-decoration: line-through; }
.doc-sheet .ql-snow .ql-tooltip { z-index: 30; }
.doc-footer { margin-top: 12px; display: flex; justify-content: flex-end; }
.doc-add-menu {
  position: absolute; z-index: 60; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14); padding: 6px; width: 250px;
}
.doc-add-menu .opt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 0.92rem; }
.doc-add-menu .opt:hover { background: var(--bg); }
.doc-add-menu .add-icon-box { width: 26px; text-align: center; font-weight: 700; color: #555; }
.doc-add-menu .add-label { flex: 1; }
.doc-add-menu .add-hint { font-size: 0.75rem; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-family: ui-monospace, monospace; }

.saved-note { font-size: 0.75rem; color: var(--muted); }

.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
}

/* Group (section) drag-and-drop */
.group-drag-handle { cursor: grab; color: var(--muted); margin-right: 8px; font-size: 1rem; user-select: none; touch-action: none; }
.group-drag-handle:hover { color: var(--ink); }
body.dragging-group, body.dragging-group * { cursor: grabbing !important; user-select: none !important; }
tr.group-row.group-dragging td { opacity: 0.5; }
tr.group-drop-above td { box-shadow: inset 0 3px 0 var(--accent); }
tr.group-drop-below td { box-shadow: inset 0 -3px 0 var(--accent); }

/* Profile photos */
img.avatar { object-fit: cover; background: var(--border); }
.my-avatar { cursor: pointer; display: inline-flex; }
.my-avatar:hover .avatar { box-shadow: 0 0 0 2px var(--accent); }
.photo-setup { text-align: center; }
.photo-setup h2 { margin-top: 0; }
.photo-intro { color: var(--muted); font-size: 0.9rem; margin: 4px 0 16px; }
.photo-preview { width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 50%; overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-preview span { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: white; font-size: 2.4rem; font-weight: 700; }
.photo-setup .modal-actions { margin-top: 20px; }

/* Sharing & Team page */
.content-header .share-btn, .content-header #teamAddBtn { margin-left: auto; }
.share-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.share-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.modal .share-row { color: var(--ink); margin: 0; font-size: 0.9rem; }
.share-row:hover { background: var(--bg); }
.share-row input { width: auto; margin: 0; }
.team-list { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.team-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.team-card-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.team-card[data-user] .team-card-head { cursor: pointer; }
.team-name { font-weight: 700; }
.team-access { border-top: 1px solid var(--border); padding: 10px 14px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 20px; }
.team-folder-name { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px; }
.team-folder-name a { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--accent); cursor: pointer; margin-left: 6px; }
.team-folder-name a.team-none { margin-left: 0; }
.team-saved { grid-column: 1 / -1; }
.auth-wrap.photo-setup .btn { width: auto; margin: 0; background: var(--panel); color: var(--ink); border: 1px solid var(--border); padding: 8px 14px; font-size: 0.85rem; }
.auth-wrap.photo-setup .btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.auth-wrap.photo-setup .btn:disabled, .modal.photo-setup .btn:disabled { opacity: 0.5; cursor: default; }
.modal label.share-row { display: flex; }
.modal .share-row input[type="checkbox"] { width: auto; padding: 0; }

/* Sidebar drag-and-drop + item menu */
body.dragging-side, body.dragging-side * { cursor: grabbing !important; user-select: none !important; }
.item-link { user-select: none; }
.item-link.side-dragging { opacity: 0.4; }
.item-link.side-drop-above { box-shadow: inset 0 3px 0 var(--accent); }
.item-link.side-drop-below, .sidebar-section-title.side-drop-below { box-shadow: inset 0 -3px 0 var(--accent); }
.folder-header.side-drop-into { background: #eaf1ff; outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.sidebar-item-menu {
  position: absolute; z-index: 60; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12); padding: 6px; min-width: 200px; max-height: 70vh; overflow-y: auto; font-size: 0.88rem;
}
.sidebar-item-menu .menu-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 4px 8px; }
.sidebar-item-menu .opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.sidebar-item-menu .opt:hover { background: var(--bg); }
.sidebar-item-menu .opt.danger { color: #d33; }
.sidebar-item-menu .swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.sidebar-item-menu .menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.folder-header { user-select: none; }
.folder-block.side-dragging { opacity: 0.4; }
.folder-block.folder-drop-above { box-shadow: inset 0 3px 0 var(--accent); }
.folder-block.folder-drop-below { box-shadow: 0 3px 0 var(--accent); }
.doc-toolbar.ql-snow button.doc-add-btn { background: var(--accent); color: white; width: auto; height: auto; padding: 6px 14px; font-weight: 600; font-size: 0.9rem; border-radius: 6px; }
.doc-toolbar.ql-snow button.doc-add-btn:hover { background: var(--accent); color: white; filter: brightness(1.08); }
.doc-toolbar.ql-snow button.share-btn { width: auto; height: auto; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.78rem; white-space: nowrap; }
.doc-toolbar.ql-snow button.tb-btn { width: 30px; }

/* ---------- monday-style menus ---------- */
.mmenu {
  position: absolute; z-index: 70; background: #fff; border-radius: 10px; padding: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.04); min-width: 240px; font-size: 0.95rem; color: #323338;
}
.mmenu-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.mmenu-item:hover, .mmenu-item.open { background: #f0f1f5; }
.mmenu-item.danger { color: #323338; }
.mmenu-item.danger:hover { color: #d83a52; }
.mmenu-icon { width: 20px; height: 20px; display: inline-flex; flex-shrink: 0; }
.mmenu-icon svg, .mmenu-chev svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.mmenu-label { flex: 1; }
.mmenu-chev { width: 16px; height: 16px; display: inline-flex; color: #676879; }
.mmenu-check { color: var(--accent); font-weight: 700; }
.mmenu-dot { width: 14px; height: 14px; border-radius: 4px; margin: 0 3px; flex-shrink: 0; }
.mmenu-divider { height: 1px; background: #e1e2e8; margin: 6px 4px; }
.mmenu-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #676879; padding: 4px 10px 6px; }
.folder-header { display: flex; align-items: center; }
.folder-header .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-header:hover .item-menu-btn { opacity: 1; }

/* Color palette */
.pal-box { padding: 16px 16px 10px; min-width: 0; }
.pal-grid { display: grid; grid-template-columns: repeat(5, 44px); gap: 12px; }
.pal-swatch {
  position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--sw); cursor: pointer;
  box-shadow: inset 0 0 0 0 #fff; transition: transform 0.1s;
}
.pal-swatch:hover { transform: scale(1.08); }
.pal-swatch.selected { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #0073ea; }
.pal-remove {
  position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; border-radius: 50%; background: #323338; color: #fff;
  font-size: 12px; line-height: 18px; text-align: center; display: none;
}
.pal-swatch:hover .pal-remove { display: block; }
.pal-add {
  position: relative; width: 44px; height: 44px; border-radius: 50%; border: 2px dashed #c5c7d0; color: #676879;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; cursor: pointer; overflow: hidden;
}
.pal-add:hover { border-color: #0073ea; color: #0073ea; }
.pal-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: none; padding: 0; }
.pal-footer { margin-top: 10px; }
.pal-hint { display: block; font-size: 0.75rem; color: #9699a6; padding: 0 2px 4px; }
.color-grid-menu.mmenu { display: block; width: auto; padding: 16px 16px 10px; border: none; }

/* Doc "someone else edited this" banner */
.doc-conflict { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding: 10px 14px; background: #fff4e5; border: 1px solid #f5c26b; border-radius: var(--radius); font-size: 0.9rem; }
.doc-conflict.hidden { display: none; }
.doc-conflict-msg { flex: 1; min-width: 240px; }

/* ---------- Column labels under every section ---------- */
/* The top header row still sets column widths, but is invisible. */
table.board-table thead tr.sizer-row th {
  height: 0; padding-top: 0; padding-bottom: 0; border: none; font-size: 0; line-height: 0; overflow: hidden;
}
table.board-table thead tr.sizer-row th * { display: none; }
tr.group-label-row th {
  background: var(--panel); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--border);
  overflow: visible;
}
tr.group-label-row .col-name-btn { display: block; overflow: hidden; text-overflow: ellipsis; }
tr.group-label-row th + th { border-left: 1px solid var(--border); }
tr.group-label-row th.label-check-cell { padding: 0; }
tr.group-label-row th.label-add-cell { border-left: none; }
tr.group-label-row.hidden { display: none; }
tr.group-label-row .col-name-btn { cursor: pointer; }
tr.group-label-row .col-name-btn:hover { color: var(--ink); }
tr.group-label-row .add-col-btn { padding: 1px 8px; font-size: 0.85rem; }
tr.group-row td { border-bottom: none; }
tr.group-row.collapsed td { border-bottom: 1px solid var(--border); }

/* ---------- Notifications ---------- */
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bell-btn { position: relative; border: none; background: none; font-size: 1.15rem; cursor: pointer; padding: 4px 6px; border-radius: 8px; line-height: 1; }
.bell-btn:hover { background: var(--bg); }
.bell-badge {
  position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #e2445c; color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--panel);
}
.bell-badge.hidden { display: none; }
.notif-panel {
  position: fixed; top: 10px; left: 250px; width: 400px; max-height: calc(100vh - 20px); z-index: 80;
  background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
  display: flex; flex-direction: column; overflow: hidden;
}
.notif-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.notif-head h3 { margin: 0; font-size: 1.05rem; flex: 1 0 100%; }
.notif-tabs { display: flex; gap: 4px; }
.notif-tab { border: none; background: none; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.notif-tab.active { background: #eaf1ff; color: var(--accent); font-weight: 600; }
.notif-readall { margin-left: auto; border: none; background: none; color: var(--accent); cursor: pointer; font-size: 0.8rem; }
.notif-list { overflow-y: auto; padding: 6px; }
.notif-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 8px; cursor: pointer; position: relative; }
.notif-row:hover { background: var(--bg); }
.notif-row.unread { background: #f3f7ff; }
.notif-row.unread:hover { background: #e9f0ff; }
.notif-body { flex: 1; min-width: 0; font-size: 0.88rem; line-height: 1.4; }
.notif-snippet { color: var(--muted); font-size: 0.82rem; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-meta { color: #9699a6; font-size: 0.75rem; margin-top: 4px; }
.notif-status { display: inline-block; background: #eceef3; border-radius: 4px; padding: 0 6px; font-weight: 600; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.notif-empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* ---------- Name & logo ---------- */
.brand-logo { width: 24px; height: 24px; flex-shrink: 0; }
.auth-logo { text-align: center; margin-bottom: 4px; }
.auth-logo img { width: 64px; height: 64px; }
.auth-wrap h1 { text-align: center; }
.app-name-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; max-width: 720px; }
.app-name-logo { width: 36px; height: 36px; }
.app-name-card input { width: 200px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; }

/* ---------- Passwords ---------- */
.sidebar-who button + button { margin-left: 2px; }
.password-setup form { text-align: left; }
.password-setup label { display: block; font-size: 0.8rem; color: var(--muted); margin: 10px 0 4px; }
.password-setup input { width: 100%; }
.login-details { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; font-family: inherit; font-size: 0.9rem; white-space: pre-wrap; line-height: 1.5; margin: 8px 0 0; user-select: all; }
.reset-pw-btn { margin-left: auto; white-space: nowrap; }
.team-card-head .reset-pw-btn + .chev { margin-left: 10px; }

/* ---------- ☀️ Start page ---------- */
.start-page { max-width: 1180px; }
.start-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 4px 0 18px; }
.start-hero h1 { margin: 0; font-size: 1.6rem; }
.start-date { color: var(--muted); margin-top: 4px; }
.start-summary { margin-top: 8px; font-size: 0.95rem; }
.overdue-text { color: #cd414f; }
.start-page { max-width: none; }
.start-actions { display: flex; gap: 8px; align-items: center; }
.widget-grid { margin: 0 -8px; }  /* the grid's own 8px margins line the widgets up with the page edge */
.widget { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; }
.widget-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: grab; flex-shrink: 0; user-select: none; }
.widget-head:active { cursor: grabbing; }
.widget-head .mine-toggle, .widget-head .widget-menu { cursor: pointer; }
.widget-grip { color: #c3c6d4; font-size: 0.95rem; margin-right: -2px; }
.widget:hover .widget-grip { color: var(--muted); }
.widget-title { font-weight: 700; flex: 1; }
.widget-head .widget-menu { opacity: 0.6; }
.widget:hover .widget-menu { opacity: 1; }
.widget-body { padding: 12px 14px 14px; flex: 1; min-height: 0; overflow-y: auto; }
/* while dragging/resizing */
.grid-stack-item.ui-draggable-dragging .widget, .grid-stack-item.ui-resizable-resizing .widget { box-shadow: 0 12px 30px rgba(0,0,0,0.15); }
.grid-stack > .grid-stack-placeholder > .placeholder-content { border: 2px dashed #43b36f; background: rgba(67,179,111,0.07); border-radius: 12px; }
.grid-stack-item > .ui-resizable-se { width: 18px; height: 18px; right: 10px; bottom: 10px; opacity: 0.5; }
.widget-empty { color: var(--muted); font-size: 0.9rem; padding: 10px 2px; }
.widget-empty.small { font-size: 0.83rem; padding: 4px 2px 8px; }
.start-empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--border); border-radius: 12px; }
.mine-toggle { display: inline-flex; background: var(--bg); border-radius: 6px; padding: 2px; }
.mine-toggle button { border: none; background: none; font-size: 0.75rem; padding: 3px 8px; border-radius: 5px; cursor: pointer; color: var(--muted); }
.mine-toggle button.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* to-dos */
.todo-add input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.92rem; margin-bottom: 8px; }
.todo-add input:focus { outline: none; border-color: var(--accent); }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 6px; }
.todo-row:hover { background: var(--bg); }
.todo-row input[type=checkbox] { width: 17px; height: 17px; accent-color: #43b36f; cursor: pointer; flex-shrink: 0; }
.todo-text { flex: 1; cursor: text; font-size: 0.93rem; overflow-wrap: anywhere; }
.todo-text input { width: 100%; padding: 3px 6px; border: 1px solid var(--accent); border-radius: 5px; font-size: 0.93rem; }
.todo-row.done .todo-text { color: var(--muted); text-decoration: line-through; }
.todo-carried { font-size: 0.72rem; color: #b76e00; background: #fff4e5; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.todo-del { border: none; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; opacity: 0; padding: 0 4px; }
.todo-row:hover .todo-del { opacity: 1; }
.todo-done-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 12px 4px 4px; }

/* due & upcoming, shared rows */
.due-section { margin-bottom: 12px; }
.due-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; margin: 2px 2px 6px; }
.due-label span { font-weight: 400; margin-left: 4px; }
.due-section.overdue .due-label { color: #cd414f; }
.due-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
.due-row:hover { background: var(--bg); }
.due-row.finished { opacity: 0.55; }
.due-row.finished .due-name { text-decoration: line-through; }
.due-dot { width: 8px; height: 30px; border-radius: 4px; flex-shrink: 0; }
.due-main { flex: 1; min-width: 0; }
.due-name { font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-meta { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-status { color: #fff; font-size: 0.72rem; font-weight: 600; border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.due-status.neutral { background: #eceef3; color: var(--ink); }
.due-when.late { font-size: 0.75rem; color: #cd414f; font-weight: 600; white-space: nowrap; }

/* mini calendar */
.mc-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mc-nav strong { min-width: 130px; text-align: center; }
.mc-full { margin-left: auto; font-size: 0.8rem; color: var(--accent); cursor: pointer; }
.mc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mc-head { text-align: center; font-size: 0.7rem; color: var(--muted); padding: 2px 0; }
.mc-cell { border: none; background: none; border-radius: 8px; padding: 5px 0 3px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.82rem; min-height: 38px; }
.mc-cell:hover { background: var(--bg); }
.mc-cell.today span:first-child { background: #43b36f; color: #fff; border-radius: 50%; width: 22px; height: 22px; line-height: 22px; font-weight: 700; }
.mc-cell.selected { background: #eaf1ff; }
.mc-dots { display: flex; gap: 2px; height: 6px; }
.mc-dots i { width: 5px; height: 5px; border-radius: 50%; display: block; }
.mc-day { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }

/* for me */
.inbox-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
.inbox-row:hover { background: var(--bg); }
.inbox-row.unread { background: #f3f7ff; }
.inbox-msg { font-size: 0.85rem; line-height: 1.35; }

.dup-keep { display: flex !important; align-items: center; gap: 8px; margin-top: 12px; color: var(--ink); cursor: pointer; }
.dup-keep input { width: auto !important; margin: 0; }

/* ---------- Toast (with Undo) ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000;
  background: #2b2b2b; color: #fff; border-radius: 10px; padding: 10px 12px 10px 16px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.25); font-size: 0.9rem;
  max-width: calc(100vw - 32px);
}
.toast-undo { background: none; border: 1px solid rgba(255,255,255,0.5); color: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-weight: 600; }
.toast-undo:hover { background: rgba(255,255,255,0.12); }
.toast-x { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 1.1rem; cursor: pointer; }

/* ---------- Trash ---------- */
.trash-list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.trash-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.trash-row + .trash-row { border-top: 1px solid var(--border); }
.trash-icon { font-size: 1.2rem; width: 24px; text-align: center; }
.trash-main { flex: 1; min-width: 0; }
.trash-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-kind { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; margin-right: 4px; }
.trash-left { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.trash-left.soon { color: #d83a52; font-weight: 600; }

/* ---------- Search ---------- */
.side-search { padding: 10px 12px 2px; }
.side-search input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem; background: var(--bg); }
.side-search input:focus { outline: none; border-color: var(--accent); background: #fff; }
.search-section { margin-bottom: 18px; }
.search-section h3 { font-size: 0.9rem; margin: 0 0 6px; }
.search-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.search-row:hover { border-color: var(--accent); background: #f7f9ff; }
.search-icon { width: 20px; text-align: center; }
.search-dot { width: 10px; height: 10px; border-radius: 50%; margin: 5px 5px 0; flex-shrink: 0; }
.search-title { font-weight: 600; }
.search-snip { font-size: 0.82rem; color: #555; margin-top: 3px; }
mark { background: #fff1a8; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- Activity (item details) ---------- */
.activity-box { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.activity-box summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.activity-box[open] summary { margin-bottom: 8px; }
#activityList { max-height: 260px; overflow: auto; }
.act-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.84rem; }
.act-row + .act-row { border-top: 1px solid #f0eee9; }
.act-text { flex: 1; min-width: 0; }
.act-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.act-when { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

/* ---------- Board filter & sort toolbar ---------- */
.board-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.bt-search { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem; width: 220px; background: var(--panel); }
.bt-search:focus { outline: none; border-color: var(--accent); }
.bt-select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.82rem; background: var(--panel); max-width: 200px; }
.bt-select.on { border-color: var(--accent); background: #eef4ff; color: var(--accent); }
.bt-count { font-size: 0.8rem; color: var(--muted); margin-left: 4px; }
.bt-note { margin: -4px 0 8px; }

/* ---------- Files column ---------- */
.file-cell { display: flex; align-items: center; gap: 4px; cursor: pointer; min-height: 22px; overflow: hidden; border-radius: 4px; }
.file-cell.file-drop { outline: 2px dashed var(--accent); background: #eaf1ff; }
.file-chip { display: inline-flex; align-items: center; gap: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 1px 8px; font-size: 0.76rem; max-width: 130px; }
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-more { font-size: 0.75rem; color: var(--muted); }
.file-menu { width: 330px; padding: 8px; }
.file-menu-head { font-weight: 700; font-size: 0.82rem; padding: 2px 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 6px; font-size: 0.85rem; }
.file-row:hover { background: var(--bg); }
.file-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }
.file-dl { text-decoration: none; color: var(--muted); }
.file-remove { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
.file-remove:hover { color: #d33; }
.file-add-btn { margin: 8px 6px 4px; }

/* ---------- Team: turned-off accounts ---------- */
.team-off { opacity: 0.7; background: #faf9f6; }
.off-pill { font-size: 0.68rem; background: #e4e1da; color: #555; border-radius: 10px; padding: 1px 8px; margin-left: 6px; font-weight: 600; vertical-align: middle; }

/* ---------- Phone layout: the sidebar becomes a slide-out menu ---------- */
.mobile-bar, .sidebar-scrim { display: none; }
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 60;
    background: var(--panel); border-bottom: 1px solid var(--border); padding: 8px 12px;
  }
  .mobile-bar .brand { flex: 1; font-weight: 700; display: flex; align-items: center; gap: 6px; }
  .mobile-menu-btn { border: none; background: none; font-size: 1.4rem; cursor: pointer; padding: 2px 6px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: 100vh; z-index: 90;
    transform: translateX(-102%); transition: transform 0.2s ease; border-right: 1px solid var(--border); border-bottom: none;
    box-shadow: 0 0 40px rgba(0,0,0,0.2);
  }
  .shell.sidebar-open .sidebar { transform: translateX(0); }
  .shell.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 85; }
  main.content { padding: 14px 12px; }
  .content-header h1 { font-size: 1.1rem; }
  .notif-panel { left: 8px; right: 8px; width: auto; top: 56px; max-height: calc(100vh - 70px); }
  .modal { width: calc(100vw - 20px) !important; max-width: none !important; padding: 16px !important; }
  .modal.wide { width: calc(100vw - 20px) !important; }
  .board-table-wrap { -webkit-overflow-scrolling: touch; }
  .bt-search { width: 100%; }
  .board-toolbar .bt-select { flex: 1 1 40%; max-width: none; }
  .trash-row { flex-wrap: wrap; }
  .trash-main { flex-basis: calc(100% - 40px); }
  .toast { bottom: 12px; }
  .start-hero { flex-wrap: wrap; }
}

/* ---------- Resizable sidebar ---------- */
.sidebar-resizer {
  width: 7px; margin-left: -4px; margin-right: -3px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  cursor: col-resize; z-index: 30; background: transparent; transition: background 0.15s;
}
.sidebar-resizer:hover, .sidebar-resizer.active { background: linear-gradient(to right, transparent 2px, var(--accent) 2px, var(--accent) 5px, transparent 5px); }
body.resizing-sidebar, body.resizing-sidebar * { cursor: col-resize !important; user-select: none !important; }
.notif-panel { left: calc(var(--sidebar-w) - 10px); }
@media (max-width: 800px) {
  .sidebar-resizer { display: none; }
  .notif-panel { left: 8px; }
  .sidebar { width: min(300px, 86vw) !important; }
}

/* ---------- Email settings ---------- */
.mail-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; margin-bottom: 14px; max-width: 720px; }
.mail-form input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
.team-email-row { padding-left: 14px !important; padding-right: 14px !important; }
.team-email-input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; }
.mail-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; }
.mail-form input[type=email], .mail-form input[type=password] { flex: 1 1 220px; margin: 0; }
.on-pill { font-size: 0.68rem; background: #d6f3df; color: #1e7a3c; border-radius: 10px; padding: 1px 8px; margin-left: 6px; font-weight: 600; vertical-align: middle; }
.team-email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0 4px; }
.team-email-row label { font-size: 0.8rem; color: var(--muted); margin: 0; }
.team-email-input { flex: 1 1 220px; max-width: 320px; margin: 0 !important; }
.sidebar-who { flex-wrap: wrap; row-gap: 2px; }
.sidebar-who .name { flex: 1 1 calc(100% - 40px); }
.sidebar-who button:first-of-type { margin-left: 34px; }

/* ---------- Show password ---------- */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-right: 62px !important; box-sizing: border-box; }
.auth-wrap .pw-wrap input { margin-bottom: 10px; }
.pw-wrap .pw-toggle, .auth-wrap .pw-wrap .pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: auto;
  background: none; border: none; color: var(--accent); font-size: 0.8rem; font-weight: 600;
  padding: 4px 8px; cursor: pointer; border-radius: 4px; margin: 0;
}
.auth-wrap .pw-wrap .pw-toggle { top: calc(50% - 5px); }
.pw-wrap .pw-toggle:hover { background: #eef4ff; }
.mail-form .pw-wrap { flex: 1 1 220px; width: auto; }
