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

/* ── monday.com light palette (default) ── */
:root, [data-theme="light"] {
  --bg: #f6f7fb;
  --bg-surface: #ffffff;
  --bg-card: #f5f6f8;
  --bg-input: #ffffff;
  --border: #e6e9ef;
  --text: #323338;
  --text-muted: #676879;
  --accent: #6161ff;
  --accent-light: #5151e0;
  --green: #00c875;
  --red: #e2445c;
  --yellow: #fdab3d;
  --blue: #0073ea;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 36px rgba(0,0,0,0.16);
  --hover: rgba(97,97,255,0.06);
}

/* ── Dark variant (toggle) ── */
[data-theme="dark"] {
  --bg: #0f111a;
  --bg-surface: #161929;
  --bg-card: #1e2235;
  --bg-input: #1a1e30;
  --border: #2c3252;
  --text: #e8eaf6;
  --text-muted: #8892b8;
  --accent: #6161ff;
  --accent-light: #8a8aff;
  --green: #00c875;
  --red: #e2445c;
  --yellow: #fdab3d;
  --blue: #0073ea;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.45);
  --hover: rgba(138,138,255,0.10);
}

body { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 15px; }

/* ── Login ── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; padding: clamp(24px, 6vw, 40px); width: 100%; max-width: 380px; text-align: center; }
.login-logo { font-size: 28px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.login-logo span { color: var(--accent-light); }
.login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 32px; }
.login-field { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; color: var(--text); font-size: 15px; width: 100%; margin-bottom: 12px; outline: none; }
.login-field:focus { border-color: var(--accent-light); }
.login-btn { background: var(--accent); color: #fff; border: none; border-radius: var(--radius); padding: 12px; width: 100%; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.login-btn:hover { background: var(--accent-light); }
.login-error { color: var(--red); font-size: 13px; margin-top: 8px; }

/* ── App Shell ── */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Top Nav ── */
.topnav { background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 0 16px; padding-top: env(safe-area-inset-top, 0px); height: calc(56px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 12px; flex-shrink: 0; z-index: 100; overflow: hidden; box-shadow: var(--shadow-sm); }
.topnav-logo { font-size: 20px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 3px; }
.logo-text { letter-spacing: -0.02em; white-space: nowrap; }
.logo-accent { color: var(--accent-light); }
.topnav-m5-logo { height: 44px; width: auto; object-fit: contain; display: block; transition: height 0.2s; flex-shrink: 0; }
.topnav-m5-logo.logo-ets { height: 56px; }
.board-tabs { display: flex; gap: 4px; flex: 1; }
.board-tab { background: transparent; border: none; color: var(--text-muted); padding: 5px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.15s; white-space: nowrap; }
.board-tab:hover { background: rgba(97,97,255,0.12); color: var(--text); border-radius: 8px; }
.board-tab.active { background: rgba(97,97,255,0.18); color: var(--board-color, var(--accent-light)); border-radius: 8px; border-left: 3px solid var(--board-color, var(--accent)); }
.sidebar-item.board-tab { border-left: 3px solid transparent; }
.topnav-user { color: var(--text-muted); font-size: 13px; cursor: pointer; padding: 6px 10px; border-radius: 6px; }
.topnav-user:hover { background: var(--border); }
.theme-toggle { background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); cursor: pointer; font-size: 15px; padding: 4px 9px; transition: all 0.15s; flex-shrink: 0; }
.theme-toggle:hover { background: var(--border); color: var(--text); }

/* ── Sidebar Collapse Arrow Button ── */
.sidebar-collapse-btn { background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); cursor: pointer; font-size: 11px; padding: 3px 7px; margin-left: auto; flex-shrink: 0; transition: all 0.15s; line-height: 1; }
.sidebar-collapse-btn:hover { background: var(--border); color: var(--text); }
.sidebar.collapsed .sidebar-collapse-btn { margin-left: 0; }

/* ── App Body: Sidebar + Main ── */
.app-body { display: flex; flex: 1; overflow: hidden; }

/* ── Left Sidebar ── */
.sidebar { width: 220px; min-width: 220px; background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; overflow-x: hidden; transition: width 0.22s cubic-bezier(0.4,0,0.2,1), min-width 0.22s cubic-bezier(0.4,0,0.2,1); }
.sidebar.collapsed { width: 52px; min-width: 52px; }
.sidebar-workspace { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; overflow: hidden; }
.sidebar-workspace-icon { font-size: 18px; flex-shrink: 0; }
.sidebar-workspace-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; transition: opacity 0.15s; }
.sidebar.collapsed .sidebar-workspace-name { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-workspace { padding: 10px 0 8px; flex-direction: column; justify-content: center; align-items: center; gap: 6px; }
.sidebar-section { padding: 8px 0 4px; }
.sidebar-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); padding: 4px 14px 6px; white-space: nowrap; overflow: hidden; transition: opacity 0.15s; }
.sidebar.collapsed .sidebar-section-label { opacity: 0; height: 0; padding: 0; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; border: none; background: transparent; width: 100%; text-align: left; text-decoration: none; transition: all 0.12s; white-space: nowrap; overflow: hidden; }
.sidebar-item:hover { background: rgba(97,97,255,0.08); color: var(--text); }
.sidebar-item.active { color: var(--accent-light); background: rgba(97,97,255,0.1); font-weight: 600; }
.sidebar-item-icon { font-size: 16px; flex-shrink: 0; }
.sidebar-board-logo { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.sidebar-item-text { overflow: hidden; text-overflow: ellipsis; transition: opacity 0.15s; }
.sidebar.collapsed .sidebar-item-text { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-item { padding: 9px; justify-content: center; }
.sidebar-divider { height: 1px; background: var(--border); margin: 4px 12px; }
.sidebar-new-board-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 4px; }
.sidebar-new-board-btn:hover { color: var(--accent-light); background: rgba(97,97,255,0.1); }
.pb-manage-btn { margin-left: auto; opacity: 0; font-size: 14px; color: var(--text-muted); padding: 0 4px; border-radius: 4px; }
.sidebar-item:hover .pb-manage-btn { opacity: 1; }
.pb-manage-btn:hover { color: var(--text); background: var(--border); }

/* ── Main Content (right of sidebar) ── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── ETS Astro Bar ── */
.ets-astro-bar { background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 8px 20px; display: flex; align-items: center; gap: 20px; flex-shrink: 0; flex-wrap: wrap; }
.astro-divider { width: 1px; height: 36px; background: var(--border); flex-shrink: 0; }
.astro-moon-wrap { display: flex; align-items: center; gap: 10px; }
.astro-moon-svg { flex-shrink: 0; }
.astro-moon-phase { font-size: 13px; font-weight: 600; color: var(--text); }
.astro-moon-pct { font-size: 11px; color: var(--text-muted); }
.astro-moon-sign { font-size: 11px; color: var(--text-muted); }
.astro-datetime { display: flex; flex-direction: column; gap: 2px; }
.astro-date { font-size: 13px; font-weight: 600; color: var(--text); }
.astro-time { font-size: 18px; font-weight: 700; color: var(--accent-light); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.astro-sign-wrap { display: flex; align-items: center; gap: 10px; }
.astro-sign-glyph { font-size: 32px; line-height: 1; color: #FFD700; }
.astro-sign-info { display: flex; flex-direction: column; gap: 1px; }
.astro-sign-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.astro-sign-name { font-size: 14px; font-weight: 700; color: #FFD700; }
.astro-moon-phases-strip { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.phase-pip { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.phase-pip-moon { width: 22px; height: 22px; }
.phase-pip-label { font-size: 9px; color: var(--text-muted); white-space: nowrap; }
.phase-pip.current .phase-pip-label { color: #FFD700; font-weight: 700; }

/* ── Board Toolbar ── */
.board-toolbar { background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 8px 20px 6px; display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-search-row { padding-bottom: 2px; }
.search-input-full { width: 100%; max-width: 100%; }
.board-title-wrap { display: flex; align-items: center; gap: 8px; }
.board-color-swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); cursor: pointer; padding: 0; flex-shrink: 0; transition: transform 0.15s; }
.board-color-swatch:hover { transform: scale(1.2); border-color: rgba(255,255,255,0.6); }
[data-theme="light"] .board-color-swatch { border-color: rgba(0,0,0,0.18); box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
[data-theme="light"] .board-color-swatch:hover { border-color: rgba(0,0,0,0.4); }
.board-title-name { font-weight: 700; font-size: 15px; color: var(--text); }
.toolbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.btn { border: none; border-radius: 8px; padding: 7px 16px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.search-input { background: var(--bg-input); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; color: var(--text); font-size: 13px; outline: none; min-width: 180px; }
.search-input:focus { border-color: var(--accent-light); }

/* ── Board Table ── */
.board-wrap { flex: 1; overflow: auto; padding: 0 0 24px 0; -webkit-overflow-scrolling: touch; }
/* monday-style: each group is its own rounded card (title above the card) */
.board-groups { width: max-content; min-width: 100%; padding: 14px 20px 24px; }
.group-block { margin-bottom: 18px; }
.group-card { border: 1px solid var(--border); border-left: 6px solid var(--gc, var(--accent)); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); background: var(--bg-surface); width: max-content; min-width: 100%; }
.board-table { border-collapse: collapse; table-layout: fixed; width: max-content; min-width: 100%; }
body.resizing-col { cursor: col-resize !important; user-select: none; }

/* Column header (per group card — scrolls with its card, not sticky) */
.col-header { background: var(--bg-surface); }
.col-header th { position: relative; padding: 0 10px; height: 40px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); text-align: left; white-space: nowrap; border-bottom: 2px solid var(--border); border-left: 1px solid var(--border); overflow: visible; }
.col-header th span { display: block; overflow: hidden; text-overflow: ellipsis; padding-right: 12px; }
.col-header th:first-child { padding-left: 0; border-left: none; }
.col-header th:nth-child(2) { padding-left: 36px; }
.sortable-col { cursor: pointer; user-select: none; }
.sortable-col:hover { color: var(--text); background: var(--hover); }
.sort-active { color: var(--accent) !important; }
.sort-arrow { font-style: normal; margin-left: 2px; }

/* Resize handle */
.col-resize-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 5px; cursor: col-resize; z-index: 1; }
.col-resize-handle::after { content: ""; position: absolute; right: 0; top: 20%; bottom: 20%; width: 2px; background: var(--border); border-radius: 2px; opacity: 0; transition: opacity 0.15s; }
th:hover .col-resize-handle::after { opacity: 1; }

/* Group title — above the card */
.group-title { display: flex; align-items: center; gap: 9px; padding: 4px 6px 8px; cursor: pointer; user-select: none; }
.group-title:hover .group-name { text-decoration: underline; }
.group-arrow { font-size: 10px; color: var(--text-muted); width: 12px; flex-shrink: 0; }
.group-name { font-weight: 700; font-size: 16px; color: var(--gc, var(--accent)); letter-spacing: -0.01em; }
[data-theme="dark"] .group-name { filter: brightness(1.45); }
.group-count-label { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* Group summary row (footer of expanded card, or the whole collapsed card) */
.group-summary-row td { height: 38px; border-top: 1px solid var(--border); background: var(--bg-card); }
.group-card-collapsed .group-summary-row td { border-top: none; }
.grp-name-cell { padding: 0; vertical-align: middle; }
/* Collapsed group: title lives inside the slim summary card's name cell */
.group-title-inline { padding: 8px 10px; white-space: nowrap; overflow: hidden; }
.group-title-inline .group-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.grp-sum-cell { padding: 6px 10px; vertical-align: middle; text-align: left; }
.grp-sum-val { display: block; font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.15; }
.grp-sum-cap { display: block; font-size: 10px; color: var(--text-muted); }
.grp-dist-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; width: 100%; min-width: 40px; }
.grp-dist-seg { display: block; height: 100%; min-width: 3px; }
.group-color-swatch { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); cursor: pointer; flex-shrink: 0; padding: 0; transition: transform 0.15s, box-shadow 0.15s; }
.group-color-swatch:hover { transform: scale(1.25); box-shadow: 0 0 0 3px rgba(255,255,255,0.2); }
[data-theme="light"] .group-color-swatch { border-color: rgba(0,0,0,0.18); box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
[data-theme="light"] .group-color-swatch:hover { box-shadow: 0 0 0 3px rgba(0,0,0,0.12); }
.group-archive-btn { background: none; border: none; cursor: pointer; padding: 0 4px; font-size: 13px; line-height: 1; opacity: 0; flex-shrink: 0; transition: opacity 0.15s, transform 0.15s; }
.group-title:hover .group-archive-btn, .mobile-group-header .group-archive-btn { opacity: 0.55; }
.group-archive-btn:hover { opacity: 1; transform: scale(1.15); }
.group-color-picker-pop { position: absolute; z-index: 9999; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; box-shadow: var(--shadow-lg); display: grid; grid-template-columns: repeat(5, 32px); gap: 6px; }
.gcp-swatch { width: 32px; height: 32px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.gcp-swatch:hover { transform: scale(1.15); border-color: rgba(255,255,255,0.4); }
.gcp-active { border-color: #fff !important; box-shadow: 0 0 0 2px rgba(255,255,255,0.5); }
.group-count { background: var(--bg-card); color: var(--text-muted); font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 8px; }

/* Checkbox column — center the select-all box so it lines up with the row
   boxes (.col-header th sets text-align:left, so this must win on specificity) */
.col-header th.check-col-th { text-align: center; padding: 0 !important; }
/* Top-align the row checkbox so it sits inline with the first line of the item
   name (monday-style) even when the name wraps to two lines. */
.item-row td.check-col-td { text-align: center; padding: 10px 0 0; border-left: none !important; vertical-align: top; }

/* Item rows */
.item-row { border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.item-row.row-selected { background: rgba(97,97,255,0.1) !important; }
.add-row td, .subitems-section-row td { border-bottom: 1px solid var(--border); }

/* ── Bulk action floating bar ───────────────────────────────────────────────── */
#bulk-action-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
}
.bulk-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 14px;
  padding: 10px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  min-width: 340px;
}
.bulk-bar-count {
  font-size: 13px;
  font-weight: 700;
  color: #7dd3fc;
  white-space: nowrap;
  padding-right: 8px;
  border-right: 1px solid rgba(255,255,255,0.15);
  margin-right: 4px;
}
.bulk-bar-actions { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.bulk-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #f1f5f9;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.bulk-btn:hover { background: rgba(255,255,255,0.16); }
.bulk-btn-danger:hover { background: rgba(239,68,68,0.35); border-color: rgba(239,68,68,0.5); }
.bulk-btn-icon { font-size: 15px; }
.bulk-bar-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s;
}
.bulk-bar-close:hover { color: #f1f5f9; }
.item-row:hover { background: rgba(97,97,255,0.07); }
.item-row.dragging { opacity: 0.4; }
.item-row.drag-over { background: rgba(97,97,255,0.15); box-shadow: inset 0 2px 0 var(--accent); }
.group-card.drag-over-group { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(97,97,255,0.06); }
.drag-handle { color: var(--text-muted); font-size: 16px; cursor: grab; opacity: 0; flex-shrink: 0; padding: 0 2px; line-height: 1; user-select: none; transition: opacity 0.1s; }
.item-row:hover .drag-handle { opacity: 0.5; }
.drag-handle:hover { opacity: 1 !important; cursor: grab; }
.item-row:hover .row-edit-btn { opacity: 1; }
.item-row td { padding: 0; vertical-align: middle; height: 44px; }
.item-name-td { height: auto !important; }
.data-cell { border-left: 1px solid var(--border); }

.item-name-td { border-left: none; }
.item-name-cell { display: flex; align-items: flex-start; gap: 6px; padding: 7px 8px 7px 10px; min-height: 40px; }
.item-name-text { font-size: 14px; font-weight: 500; flex: 1; white-space: normal; word-break: break-word; line-height: 1.4; padding-top: 2px; }
.item-name-cell-inner { display: flex; align-items: flex-start; flex: 1; gap: 4px; min-width: 0; cursor: text; border-radius: 4px; padding: 1px 3px; transition: background 0.1s; }
.item-name-cell-inner:hover { background: var(--bg-card); }
.inline-name-input { flex: 1; font-size: 14px; font-weight: 500; background: var(--bg-card); border: 2px solid var(--accent); border-radius: 4px; padding: 1px 6px; color: var(--text); outline: none; min-width: 0; line-height: 1.4; }
.subitem-indent { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.msg-badge { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 6px; flex-shrink: 0; }
.msg-badge-unread { background: #e53e3e !important; color: #fff; animation: badge-pulse 2s ease-in-out infinite; }
.msg-badge-read { background: transparent !important; color: var(--text-muted); font-size: 13px; padding: 0 2px; font-weight: 400; }
@keyframes badge-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,62,62,0.4); } 50% { box-shadow: 0 0 0 4px rgba(229,62,62,0); } }
.row-edit-btn { background: transparent; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 1px 5px; opacity: 0; flex-shrink: 0; transition: opacity 0.1s, background 0.1s; }
.row-edit-btn:hover { background: var(--border); color: var(--text); }

.cell { padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; height: 40px; display: flex; align-items: center; cursor: pointer; }
.cell:hover { background: var(--bg-card); }
.inline-cell-placeholder { color: var(--text-muted); }
.inline-cell-input { width: 100%; font-size: 13px; background: var(--bg-card); border: 2px solid var(--accent); border-radius: 4px; padding: 2px 6px; color: var(--text); outline: none; }
.inline-cell-select { width: 100%; font-size: 13px; background: var(--bg-card); border: 2px solid var(--accent); border-radius: 4px; padding: 2px 4px; color: var(--text); outline: none; }
.add-row-inline-td { padding: 4px 8px; }
.inline-add-input { width: 100%; font-size: 14px; background: var(--bg-card); border: 2px solid var(--accent); border-radius: 6px; padding: 6px 12px; color: var(--text); outline: none; }

/* ── monday-style full-cell colored status ── */
.status-cell { display: flex; align-items: center; justify-content: center; height: 40px; margin: 0 -10px; padding: 0 10px; width: calc(100% + 20px); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: filter 0.1s; }
.status-cell:hover { filter: brightness(1.07); }
.status-empty { display: flex; align-items: center; justify-content: center; height: 40px; margin: 0 -10px; width: calc(100% + 20px); cursor: pointer; }
.status-empty:hover { background: var(--hover); }

/* Status label popover */
.status-pop { position: fixed; z-index: 9999; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 10px; width: 230px; }
.status-pop-opt { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.status-pop-label { flex: 1; display: flex; align-items: center; justify-content: center; height: 34px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: filter 0.1s, box-shadow 0.1s; }
.status-pop-label:hover { filter: brightness(1.08); }
.status-pop-label.is-current { box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--accent); }
.status-pop-color { width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.15); cursor: pointer; flex-shrink: 0; padding: 0; }
.status-pop-color:hover { transform: scale(1.1); }
.status-pop-foot { display: flex; gap: 6px; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.status-pop-clear, .status-pop-add { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); font-size: 12px; font-weight: 500; padding: 6px 8px; cursor: pointer; transition: background 0.12s, color 0.12s; }
.status-pop-clear:hover { background: var(--border); color: var(--text); }
.status-pop-add:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Status swatch grid (recolor a label) */
.status-swatch-grid { position: fixed; z-index: 10001; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px; display: grid; grid-template-columns: repeat(5, 30px); gap: 7px; }
.status-swatch { width: 30px; height: 30px; border-radius: 7px; cursor: pointer; border: 2px solid transparent; transition: transform 0.1s, border-color 0.1s; }
.status-swatch:hover { transform: scale(1.15); }
.status-swatch.is-active { border-color: var(--text); }

/* Status badges — legacy pill style (sub-items / mobile fallback) */
.status-badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.s-working { background: #3b5bdb; color: #e7f5ff; }
.s-done { background: #0ca678; color: #ebfbee; }
.s-waiting-start { background: #e67700; color: #fff9db; }
.s-waiting-customer { background: #c92a2a; color: #ffe3e3; }
.s-hold { background: #495057; color: #dee2e6; }
.s-invoiced { background: #7c3aed; color: #ede9fe; }
.s-ongoing { background: #1971c2; color: #dbe4ff; }
.s-future { background: #5f3dc4; color: #e5dbff; }
.s-quarterly { background: #2f9e44; color: #ebfbee; }
.s-grabs { background: #e67700; color: #fff3bf; }

/* ── Timeline column (start → end) ── */
.timeline-cell { display: flex; align-items: center; gap: 7px; width: 100%; overflow: hidden; }
.timeline-bar { flex: 1; min-width: 18px; height: 8px; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--blue)); }
.timeline-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.timeline-edit { display: flex; align-items: center; gap: 4px; }
.timeline-edit input { width: 110px; }

/* ── Tags column ── */
.tags-cell { display: flex; flex-wrap: nowrap; gap: 4px; overflow: hidden; cursor: pointer; }
.tag-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 12px; font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; flex-shrink: 0; }
.tags-modal-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-toggle { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 13px; font-size: 12px; font-weight: 600; color: #fff; cursor: pointer; opacity: 0.4; transition: opacity 0.12s; user-select: none; }
.tag-toggle.on { opacity: 1; }
.tag-add-btn { height: 26px; padding: 0 11px; border-radius: 13px; font-size: 12px; font-weight: 600; border: 1px dashed var(--border); background: transparent; color: var(--text-muted); cursor: pointer; }
.tag-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Tag picker popover (table inline) */
.tag-pop { position: fixed; z-index: 9999; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 10px; width: 230px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Progress column ── */
.progress-cell { display: flex; align-items: center; gap: 8px; width: 100%; }
.progress-track { flex: 1; height: 8px; border-radius: 6px; background: var(--bg-card); overflow: hidden; min-width: 30px; }
.progress-fill { height: 100%; border-radius: 6px; transition: width 0.2s; }
.progress-pct { font-size: 11px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; min-width: 30px; text-align: right; }

/* Number unit */
.num-unit { color: var(--text-muted); font-size: 11px; margin-left: 2px; }

/* Avatar chips */
.avatar-group { display: flex; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; border: 2px solid var(--bg-surface); flex-shrink: 0; margin-right: -8px; }
.avatar:last-child { margin-right: 0; }

/* Add item row */
.add-row td { padding: 4px 12px 10px 36px; border-bottom: none; }
.add-item-btn { background: transparent; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.add-item-btn:hover { background: var(--border); color: var(--text); }
.add-group-wrap { padding: 12px 20px 4px; }
.add-group-btn { background: transparent; border: 1px dashed var(--border); color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; padding: 8px 18px; border-radius: 8px; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.add-group-btn:hover { background: var(--bg-card); color: var(--text); border-color: var(--accent); border-style: solid; }
.new-group-colors { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }

/* Subitem row */
.subitem-row .item-name-cell { padding-left: 24px; }

/* ── Item Detail Panel ── */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.panel-overlay.open { opacity: 1; pointer-events: all; }
.item-panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(620px, 100vw); background: var(--bg-surface); border-left: 1px solid var(--border); z-index: 201; transform: translateX(100%); transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), width 0.2s ease; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.item-panel.open { transform: translateX(0); }
.item-panel.expanded { width: min(1400px, 90vw); }

.panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; flex-shrink: 0; }
.panel-title-input { background: transparent; border: none; color: var(--text); font-size: 20px; font-weight: 800; flex: 1; outline: none; resize: none; padding: 0; letter-spacing: -0.02em; }
.panel-expand-btn { background: transparent; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.panel-expand-btn:hover { background: var(--border); }
.item-panel.expanded .panel-expand-btn { color: var(--accent-light); }
.panel-close { background: transparent; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.panel-close:hover { background: var(--border); }

.panel-fields { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 16px; flex-shrink: 0; }
.field-group { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.field-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.field-value select, .field-value input[type="text"], .field-value input[type="number"], .field-value input[type="date"], .field-textarea {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; color: var(--text); font-size: 13px; outline: none; width: 100%; box-sizing: border-box;
}
.field-textarea { resize: vertical; min-height: 70px; font-family: inherit; line-height: 1.5; }
.field-value select:focus, .field-value input:focus, .field-textarea:focus { border-color: var(--accent-light); }
.field-files-wrap { display: flex; flex-direction: column; gap: 5px; }
.field-file-chip { display: flex; align-items: center; gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.field-file-chip a { flex: 1; color: var(--accent-light); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-file-chip a:hover { text-decoration: underline; }
.field-file-chip button { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 11px; flex-shrink: 0; padding: 0 2px; }
.field-file-chip button:hover { color: #ef4444; }
.field-file-add { display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--border); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--text-muted); cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.field-file-add:hover { border-color: var(--accent-light); color: var(--accent-light); }

/* Desktop panel section layout */
/* max-height raised from 40% — boards with many fields (e.g. M5 Micro's 11 columns) were
   getting their last row (Vendors/Notes) clipped to a sliver on shorter windows, making it
   look like the field was hidden underneath the Write-an-Update section below. A visible
   scrollbar (not the OS's auto-hiding overlay one) makes it clear the section still scrolls
   when content doesn't fully fit. */
.panel-section-details { overflow-y: auto; overflow-x: hidden; flex-shrink: 0; max-height: 60%; scrollbar-width: thin; }
.panel-section-details::-webkit-scrollbar { width: 6px; }
.panel-section-details::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.panel-section-messages { flex: 1; display: flex; flex-direction: column; min-height: 200px; overflow: hidden; border-top: 1px solid var(--border); }

/* Messages */
.panel-messages { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg-new-divider { display: flex; align-items: center; gap: 0; margin: 4px 0; }
.msg-new-divider span { flex: 1; text-align: center; font-size: 11px; font-weight: 700; color: #6161ff; letter-spacing: .08em; background: rgba(97,97,255,0.10); border-radius: 20px; padding: 3px 14px; }
.msg-bubble.msg-unread > .msg-bubble-inner { border-left: 2px solid #6161ff; padding-left: 8px; border-radius: 0 6px 6px 0; }
/* Deep-link flash: when you tap a notification, its message pulses so you spot it instantly. */
/* scroll-margin-top keeps the message from sitting flush against the panel's top edge when we jump to it. */
.msg-bubble { scroll-margin-top: 10px; }
.msg-bubble.msg-highlight { animation: msgHighlightFlash 3s ease-out; border-radius: 8px; }
@keyframes msgHighlightFlash {
  0%   { background: rgba(97,97,255,0.28); box-shadow: 0 0 0 3px rgba(97,97,255,0.45); }
  60%  { background: rgba(97,97,255,0.18); box-shadow: 0 0 0 3px rgba(97,97,255,0.22); }
  100% { background: transparent; box-shadow: 0 0 0 0 rgba(97,97,255,0); }
}
.panel-messages::-webkit-scrollbar { width: 4px; }
.panel-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.msg-bubble { display: flex; flex-direction: column; gap: 4px; }
.msg-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; align-self: flex-start; margin-top: 2px; }
.msg-meta { display: flex; align-items: center; gap: 8px; }
.msg-author { font-weight: 700; font-size: 13px; }
.msg-time { font-size: 11px; color: var(--text-muted); }
.msg-body { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 10px 14px; font-size: 14px; line-height: 1.6; word-break: break-word; box-shadow: var(--shadow-sm); }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.attachment-chip { display: flex; align-items: center; gap: 6px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; font-size: 12px; color: var(--accent-light); cursor: pointer; text-decoration: none; }
.attachment-chip:hover { border-color: var(--accent-light); }
.attachment-icon { font-size: 14px; }

/* Reply button */
.msg-reply-btn { background: transparent; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; padding: 4px 0 0; display: inline-flex; align-items: center; gap: 3px; transition: color 0.15s; }
.msg-reply-btn:hover { color: var(--accent-light); }
/* Like button */
.msg-like-btn { background: transparent; border: 1px solid transparent; border-radius: 20px; color: var(--text-muted); font-size: 11px; cursor: pointer; padding: 2px 7px; display: inline-flex; align-items: center; gap: 3px; transition: color 0.15s, background 0.15s, border-color 0.15s; }
.msg-like-btn:hover { background: rgba(97,97,255,0.1); border-color: var(--accent-light); color: var(--accent-light); }
.msg-like-btn.liked { background: rgba(97,97,255,0.15); border-color: var(--accent-light); color: var(--accent-light); }
.msg-like-count { font-weight: 700; }
/* Edit / Delete buttons */
.msg-edit-btn { background: transparent; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; padding: 2px 6px; border-radius: 4px; opacity: 0.5; transition: opacity 0.15s; }
.msg-edit-btn:hover { opacity: 1; }
.msg-delete-btn { background: transparent; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; padding: 2px 6px; border-radius: 4px; opacity: 0.4; transition: opacity 0.15s, color 0.15s; }
.msg-delete-btn:hover { opacity: 1; color: #ef4444; }
.msg-edit-ta { width: 100%; min-height: 60px; background: var(--bg-input, var(--bg)); color: var(--text); border: 1px solid var(--accent); border-radius: 6px; padding: 6px 8px; font-size: 13px; resize: vertical; box-sizing: border-box; font-family: inherit; margin-bottom: 6px; }
.msg-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
/* Message actions row (reply + like + seen-by on same line) */
.msg-actions-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.msg-actions-row > *:last-child { margin-left: auto; }
/* Seen-by indicator */
.msg-seen-wrap { position: relative; display: inline-flex; align-items: center; }
.msg-seen-trigger { font-size: 11px; color: var(--text-muted); cursor: default; user-select: none; padding: 4px 2px 0; transition: color 0.15s; }
.msg-seen-wrap:hover .msg-seen-trigger { color: var(--text); }
.msg-seen-tooltip { display: none; position: absolute; bottom: calc(100% + 6px); right: 0; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; min-width: 150px; z-index: 200; box-shadow: var(--shadow-lg); }
.msg-seen-wrap:hover .msg-seen-tooltip { display: block; }
.msg-seen-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.msg-seen-name { font-size: 12px; color: var(--text); padding: 2px 0; white-space: nowrap; }

/* Reply inline composer — always visible below each message */
.msg-reply-box { padding: 4px 0 8px 16px; }
.reply-box-inner { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.reply-fmt-bar { display: flex; align-items: center; gap: 1px; padding: 4px 6px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.reply-fmt-bar .fmt-btn { padding: 2px 6px; font-size: 12px; }
.reply-fmt-bar .fmt-divider { width: 1px; height: 14px; background: var(--border); margin: 0 3px; }
.reply-textarea { width: 100%; background: transparent; border: none; color: var(--text); padding: 8px 12px; font-size: 13px; resize: none; outline: none; min-height: 44px; font-family: inherit; display: block; transition: min-height 0.15s ease; }
.reply-textarea.ta-expanded { min-height: 40vh; max-height: 55vh; overflow-y: auto; }
.reply-box-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 4px 8px; border-top: 1px solid var(--border); }

/* Threaded replies */
.msg-replies { margin-left: 16px; border-left: 2px solid var(--border); padding-left: 12px; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; margin-bottom: 4px; }
.msg-reply-bubble { gap: 6px; }
.msg-reply-bubble .msg-bubble-inner { flex: 1; }
.msg-reply-indicator { color: var(--text-muted); font-size: 12px; flex-shrink: 0; padding-top: 3px; display: none; }
.msg-bubble { display: flex; gap: 4px; }
.msg-bubble-inner { display: flex; flex-direction: column; gap: 4px; flex: 1; }

/* Message input */
.panel-input { border-bottom: 1px solid var(--border); flex-shrink: 0; }
.panel-input-header { display: flex; align-items: center; gap: 8px; padding: 10px 20px; cursor: pointer; user-select: none; }
.panel-input-header:hover { background: rgba(97,97,255,0.05); }
#composer-body { padding: 0 16px 16px; }
.msg-composer { position: relative; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); overflow: visible; }

/* Format toolbar */
.msg-format-top { border-bottom: 1px solid var(--border); padding: 5px 8px; display: flex; align-items: center; gap: 1px; flex-wrap: wrap; }
.fmt-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 7px; border-radius: 4px; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.fmt-btn:hover { background: var(--border); color: var(--text); }
.fmt-bold b { font-weight: 700; font-style: normal; }
.fmt-italic i { font-style: italic; }
.fmt-underline u { text-decoration: underline; }
.fmt-strike s { text-decoration: line-through; }
.fmt-divider { width: 1px; height: 16px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.fmt-emoji-wrap { position: relative; }
.fmt-emoji-picker { position: absolute; bottom: 100%; left: 0; z-index: 200; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); display: flex; flex-wrap: wrap; gap: 4px; width: 320px; max-height: 220px; overflow-y: auto; font-size: 20px; line-height: 1.4; }
.emoji-item { cursor: pointer; border-radius: 6px; padding: 2px 4px; transition: background 0.1s; user-select: none; }
.emoji-item:hover { background: var(--bg-hover, rgba(0,0,0,0.08)); }
.msg-body code { background: var(--bg-card); border-radius: 3px; padding: 1px 5px; font-size: 12px; font-family: monospace; }

/* @mention dropdown */
.mention-dropdown { display: none; position: fixed; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); z-index: 9999; overflow: hidden; max-height: 220px; overflow-y: auto; }
.mention-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; font-size: 13px; font-weight: 500; transition: background 0.1s; }
.mention-item:hover, .mention-item.mention-active { background: var(--bg-card); }
.msg-composer.drag-over { border-color: var(--accent-light); background: rgba(97,97,255,0.08); }
.msg-textarea { width: 100%; background: transparent; border: none; color: var(--text); padding: 12px 14px; font-size: 14px; resize: none; outline: none; min-height: 72px; font-family: inherit; transition: min-height 0.15s ease; }
.msg-textarea.ta-expanded { min-height: 40vh; max-height: 55vh; overflow-y: auto; }
.msg-composer-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); }
.composer-name { background: transparent; border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: 12px; padding: 4px 8px; outline: none; }
.composer-name:focus { border-color: var(--accent-light); }
.attach-btn { background: transparent; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); padding: 4px 10px; cursor: pointer; font-size: 13px; }
.attach-btn:hover { background: var(--border); }
.ets-team-btn { background: transparent; border: 1px solid var(--accent-light); border-radius: 4px; color: var(--accent-light); padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ets-team-btn:hover { background: rgba(124,58,237,0.12); }
.send-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 5px 16px; font-size: 13px; font-weight: 600; cursor: pointer; margin-left: auto; }
.send-btn:hover { background: var(--accent-light); }
.send-btn:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.pending-file { display: flex; align-items: center; gap: 4px; background: var(--border); border-radius: 4px; padding: 3px 8px; font-size: 12px; }
.pending-file button { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 0 2px; }

/* ── Edit modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 300; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.open { display: flex; }
.modal { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); max-height: calc(100dvh - 40px); overflow-y: auto; }
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 4px; }
.modal-field input, .modal-field select, .modal-field textarea {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; padding: 9px 13px; color: var(--text); font-size: 14px; outline: none; font-family: inherit;
}
.modal-field input:focus, .modal-field select:focus, .modal-field textarea:focus { border-color: var(--accent-light); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.btn-danger { background: #991b1b; color: #fff; }
.btn-danger:hover { background: var(--red); }

/* ── Automations ── */
.auto-builder { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.auto-word { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.auto-select { background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; color: var(--text); font-size: 13px; outline: none; }
.auto-select:focus { border-color: var(--accent-light); }
.automation-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-card); border-radius: 8px; margin-bottom: 6px; }
.automation-row.disabled { opacity: 0.5; }
.auto-toggle { flex-shrink: 0; }
.auto-toggle input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.auto-desc { flex: 1; font-size: 13px; line-height: 1.4; }
.auto-desc strong { color: var(--accent-light); }
.auto-delete { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.auto-delete:hover { background: var(--border); color: var(--red); }

/* ── Add-option button ── */
.field-select-row { display: flex; align-items: center; gap: 6px; }
.field-select-row select { flex: 1; }
.add-opt-btn { flex-shrink: 0; width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 5px; background: var(--bg-card); color: var(--text-muted); font-size: 16px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.add-opt-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── People Picker Dropdown ── */
.pp-dropdown { position: relative; }
.pp-trigger { display: flex; align-items: center; gap: 6px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; cursor: pointer; color: var(--text); font-size: 13px; width: 100%; text-align: left; transition: border-color 0.15s; }
.pp-trigger:hover { border-color: var(--accent-light); }
.pp-trigger-avatars { display: flex; gap: 2px; flex-shrink: 0; }
.pp-trigger-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.pp-trigger-label.has-value { color: var(--text); }
.pp-caret { color: var(--text-muted); font-size: 10px; flex-shrink: 0; }
.pp-menu { display: none; position: fixed; z-index: 9999; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 0; min-width: 200px; max-width: 260px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); max-height: 280px; overflow-y: auto; }
.pp-menu.open { display: block; }
.pp-menu-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-light); padding: 6px 14px 4px; }
.pp-menu-row { display: flex; align-items: center; gap: 9px; padding: 8px 14px; cursor: pointer; transition: background 0.1s; }
.pp-menu-row:hover { background: var(--bg-card); }
.pp-menu-check { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.pp-menu-avatar { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0; }
.pp-menu-name { font-size: 13px; }

/* ── Notification Bell ── */
.notif-btn { position: relative; background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); cursor: pointer; font-size: 15px; padding: 4px 9px; transition: all 0.15s; flex-shrink: 0; }
.notif-btn:hover { background: var(--border); color: var(--text); }
.notif-badge { position: absolute; top: -5px; right: -5px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 5px; min-width: 18px; text-align: center; pointer-events: none; }

/* ── Notification Panel ── */
.notif-overlay { position: fixed; inset: 0; z-index: 300; }
.notif-panel { position: fixed; top: 52px; right: 12px; width: 380px; max-height: 520px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; z-index: 301; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.notif-tab { flex: 1; background: transparent; border: none; color: var(--text-muted); padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.notif-tab:hover { color: var(--text); }
.notif-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.notif-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.notif-email-pref { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--text-muted); cursor: pointer; flex-shrink: 0; user-select: none; }
.notif-email-pref:hover { color: var(--text); }
.notif-email-pref input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.notif-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(97,97,255,0.07); }
.notif-item.unread { background: rgba(97,97,255,0.06); }
.notif-item.unread::before { content: ""; display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-right: 6px; vertical-align: middle; flex-shrink: 0; }
.notif-item-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.notif-item-name { font-size: 12px; font-weight: 700; color: var(--accent-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.notif-item-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.notif-item-subheading { font-size: 11px; color: var(--text-muted); font-style: italic; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item-author { font-size: 12px; font-weight: 600; color: var(--text); }
.notif-item-body { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
/* Tells the reader an attachment exists; the file itself opens on the item. */
.notif-item-file { font-size: 11px; color: var(--text); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item-actions { display: flex; justify-content: flex-end; margin-top: 5px; }
.notif-mark-btn { background: transparent; border: 1px solid var(--border); border-radius: 20px; color: var(--text-muted); font-size: 10px; padding: 2px 9px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.notif-mark-btn:hover { background: var(--border); color: var(--text); }
/* Already read → the button offers "mark unread", so tint it to make the reminder action findable. */
.notif-mark-btn:not(.is-unread) { color: var(--accent-light); border-color: var(--accent); }
.notif-mark-btn:not(.is-unread):hover { background: rgba(97,97,255,0.12); color: var(--accent-light); }
.notif-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 32px 16px; }

/* ── Members Modal ── */
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: none; }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 13px; font-weight: 600; }
.member-email { font-size: 11px; color: var(--text-muted); }
.member-role-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 4px; background: var(--bg-card); color: var(--text-muted); flex-shrink: 0; }
.member-delete-btn { background: transparent; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 3px 8px; flex-shrink: 0; transition: all 0.15s; }
.member-delete-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 10px 22px; font-size: 13px; font-weight: 500; z-index: 9999; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ── Sub-items toggle (inline in name cell) ── */
.subitem-toggle-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 10px; padding: 2px 4px; display: inline-flex; align-items: center; gap: 2px; transition: all 0.15s; opacity: 0; flex-shrink: 0; border-radius: 4px; }
.item-row:hover .subitem-toggle-btn,
.subitem-toggle-btn.has-subitems,
.subitem-toggle-btn.expanded { opacity: 1; }
.subitem-toggle-btn.expanded { color: var(--accent-light); }
.subitem-toggle-btn:hover { background: var(--border); color: var(--text); }
.subitem-toggle-count { font-weight: 700; font-size: 10px; }
.subitem-toggle-count { font-weight: 700; }

/* ── Sub-items expanded section (board table) ── */
.subitems-section-td { padding: 0; }
.subitems-section { background: rgba(97,97,255,0.04); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px 12px 8px 52px; display: flex; flex-direction: column; gap: 2px; }
.subitem-row-card { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; cursor: pointer; transition: background 0.1s; min-width: 0; }
.subitem-col-cell { flex-shrink: 0; display: flex; align-items: center; }
/* Sub-items with the parent's full column set — cells line up under the headers */
.subitems-section-cols { padding-right: 0; }
.subitems-section-cols .subitem-row-card { padding-right: 0; }
.subitems-section-cols .subitem-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subitems-section-cols .subitem-col-cell { overflow: hidden; }
.subitems-section-cols .subitem-col-cell > .cell { width: 100%; min-width: 0; height: 30px; padding: 0 8px; font-size: 12px; }
.subitems-section-cols .subitem-col-cell > .cell:hover { background: rgba(97,97,255,0.10); }
.subitems-section-cols .status-cell,
.subitems-section-cols .status-empty { height: 30px; margin: 0 -8px; width: calc(100% + 16px); }
.subitems-section-cols .status-cell { font-size: 11px; padding: 0 8px; }
.subitem-row-card:hover { background: rgba(97,97,255,0.09); }
.subitem-indent-arrow { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.subitem-row-name { flex: 1; font-size: 13px; font-weight: 500; }
.subitem-avatars { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
/* Square selection checkbox for sub-items */
.subitem-select-box { width: 15px; height: 15px; min-width: 15px; flex-shrink: 0; cursor: pointer; accent-color: var(--accent); border-radius: 3px; margin: 0; }
.subitem-selected { background: rgba(97,97,255,0.12) !important; }
/* Round done-checkbox for subitems */
.sub-check { width: 22px; height: 22px; min-width: 22px; border-radius: 50%; border: 2px solid var(--text-muted); background: transparent; color: transparent; font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; padding: 0; line-height: 1; }
.sub-check:hover { border-color: var(--accent-light); background: rgba(97,97,255,0.1); }
.sub-check.checked { border-color: #10b981; background: #10b981; color: #fff; }
.sub-done .subitem-row-name,
.sub-done .panel-subitem-name { text-decoration: line-through; opacity: 0.5; }
/* Sub-item bulk action bar */
.subitem-action-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--bg-card); border: 1px solid var(--border); border-radius: 32px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); padding: 10px 20px; display: flex; align-items: center; gap: 10px; z-index: 500; white-space: nowrap; }
.sab-count { font-size: 13px; font-weight: 600; color: var(--text); margin-right: 4px; }
.sab-btn { background: var(--bg-input); border: 1px solid var(--border); color: var(--text); border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.sab-btn:hover { background: var(--border); }
.sab-btn-danger { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.sab-btn-danger:hover { background: rgba(239,68,68,0.12); }
.sab-close { background: transparent; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 50%; line-height: 1; }
.sab-close:hover { background: var(--border); color: var(--text); }
.subitem-add-row { padding: 5px 0 2px 20px; }
.subitem-add-input { background: transparent; border: none; border-bottom: 1px dashed var(--border); color: var(--text); font-size: 13px; padding: 4px 6px; outline: none; width: 280px; font-family: inherit; }
.subitem-add-input:focus { border-bottom-color: var(--accent-light); }
.subitem-add-input::placeholder { color: var(--text-muted); }

/* ── Panel Details collapsible header ── */
.panel-details-header { display: flex; align-items: center; gap: 8px; padding: 10px 20px; cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); }
.panel-details-header:hover { background: rgba(97,97,255,0.05); }
#panel-details-body { padding: 0; }

/* ── Panel Sub-items section ── */
.panel-subitems { border-bottom: 1px solid var(--border); flex-shrink: 0; }
.panel-subitems-header { display: flex; align-items: center; gap: 8px; padding: 10px 20px; cursor: pointer; user-select: none; }
.panel-subitems-header:hover { background: rgba(97,97,255,0.05); }
.panel-subitems-toggle { background: transparent; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 0; }
.panel-subitems-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); flex: 1; }
.panel-subitems-count-badge { background: var(--bg-card); color: var(--text-muted); font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 8px; }
.panel-subitems-body { padding: 0 20px 10px; display: flex; flex-direction: column; gap: 4px; }
.panel-subitem-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; transition: background 0.1s; }
.panel-subitem-row:hover { background: rgba(97,97,255,0.08); }
.panel-subitem-name { flex: 1; font-size: 13px; font-weight: 500; }
.panel-subitem-add { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.panel-subitem-add-input { background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; padding: 6px 10px; outline: none; flex: 1; font-family: inherit; }
.panel-subitem-add-input:focus { border-color: var(--accent-light); }
.panel-subitem-add-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer; flex-shrink: 0; }
.panel-subitem-add-btn:hover { background: var(--accent-light); }

/* ── Sub-item assign picker ── */
.sub-assign-picker { position: relative; flex-shrink: 0; }
.sub-assign-trigger { background: transparent; border: none; padding: 2px 4px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; }
.sub-assign-trigger:hover { background: rgba(97,97,255,0.12); }
.sub-assign-empty { width: 20px; height: 20px; border-radius: 50%; border: 1.5px dashed var(--text-muted); color: var(--text-muted); font-size: 14px; display: flex; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0; }

/* ── Hamburger Button ── */
.hamburger-btn { display: none; flex-direction: column; justify-content: center; gap: 5px; background: transparent; border: none; cursor: pointer; padding: 6px 8px; border-radius: 6px; flex-shrink: 0; }
.hamburger-btn:hover { background: var(--border); }
.hamburger-btn span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.25s; }
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.topnav-spacer { flex: 1; }

/* ── Mobile Drawer ── */
.mobile-drawer-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 400; backdrop-filter: blur(2px); }
.mobile-drawer-overlay.open { display: block; }
.mobile-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; background: var(--bg-surface); border-right: 1px solid var(--border); z-index: 401; transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1); display: flex; flex-direction: column; padding: 0; }
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.mobile-drawer-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom, 16px); }
.mobile-drawer-logo { display: flex; align-items: center; gap: 6px; font-size: 18px; font-weight: 800; color: var(--text); }
.mobile-drawer-logoimg { height: 40px; width: auto; object-fit: contain; transition: height 0.2s; }
.mobile-drawer-logoimg.logo-ets { height: 68px; }
.mobile-drawer-close { background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 4px 10px; }
.mobile-drawer-close:hover { background: var(--border); }
.mobile-drawer-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); padding: 16px 18px 6px; }
.mobile-nav-item { display: flex; align-items: center; padding: 13px 18px; font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer; border: none; background: transparent; width: 100%; text-align: left; text-decoration: none; border-radius: 0; transition: background 0.12s; }
.mobile-nav-item:hover { background: rgba(97,97,255,0.08); }
.mobile-nav-item.active { color: var(--accent-light); background: rgba(97,97,255,0.1); font-weight: 600; }
.mobile-drawer-divider { height: 1px; background: var(--border); margin: 8px 0; }
.mobile-user-row { justify-content: space-between; cursor: pointer; user-select: none; }
.mobile-install-arrow { font-size: 11px; color: var(--accent-light); font-weight: 600; }
.mobile-install-panel { display: none; padding: 0 12px 12px; }
.mobile-install-panel.open { display: block; }
.install-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.install-tab { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 4px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-muted); transition: background 0.15s, color 0.15s; }
.install-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.install-intro { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.install-list { padding-left: 18px; margin: 0 0 10px; }
.install-list li { font-size: 13px; color: var(--text); margin-bottom: 8px; line-height: 1.5; }
.install-list li strong { color: var(--accent-light); }
.install-icon { font-size: 15px; }
.install-note { font-size: 11px; color: var(--text-muted); background: var(--bg-card); border-radius: 6px; padding: 6px 10px; line-height: 1.4; }
.mobile-logout-btn { background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); font-size: 13px; padding: 5px 12px; cursor: pointer; }
.mobile-logout-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ── Mobile card board ── */
.mobile-board { display: none; }
.mobile-group { background: var(--bg-surface); margin-bottom: 16px; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); border-left: 8px solid var(--gc, var(--accent)); box-shadow: var(--shadow-sm); }
.mobile-group-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; position: relative; user-select: none; }
.mobile-group-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mobile-group-name { font-size: 15px; font-weight: 700; color: var(--gc, var(--accent)); letter-spacing: -0.01em; }
[data-theme="dark"] .mobile-group-name { filter: brightness(1.35); }
.mobile-group-meta { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.mobile-group-count { font-size: 11px; color: var(--text-muted); background: var(--bg-surface); border-radius: 10px; padding: 1px 8px; }
.mobile-group-arrow { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.mobile-group-body.collapsed { display: none; }

/* Item card — left border color matches group */
.mobile-item-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); cursor: pointer; transition: background 0.12s; -webkit-tap-highlight-color: transparent; }
.mobile-item-card:active { background: rgba(97,97,255,0.07); }
.mobile-item-main { flex: 1; min-width: 0; }
.mobile-item-name { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 5px; line-height: 1.35; word-break: break-word; }
.mobile-item-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 5px; }
.mobile-item-due { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* Machine / category tag pill */
.mobile-tag-pill { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #c0392b; color: #fff; white-space: nowrap; letter-spacing: 0.02em; }

/* Sub-item count — tappable */
.mobile-sub-count { font-size: 11px; color: var(--accent); margin-left: 5px; font-weight: 600; cursor: pointer; padding: 1px 5px; border-radius: 10px; background: rgba(97,97,255,0.1); }

/* Inline subitems under mobile card */
.mobile-subitems-inline { background: var(--bg2); border-left: 3px solid var(--border); margin: 0 0 4px 12px; border-radius: 0 8px 8px 0; padding: 4px 8px; display: flex; flex-direction: column; gap: 2px; }
.mobile-subitem-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; }
.mobile-subitem-row:active { background: rgba(97,97,255,0.07); }
.mobile-subitem-name { flex: 1; font-size: 13px; color: var(--text); cursor: pointer; }
.mobile-subitem-row.sub-done .mobile-subitem-name { text-decoration: line-through; opacity: 0.5; }

/* Owner avatar row */
.mobile-owner-row { display: flex; gap: 4px; margin-top: 3px; }
.mobile-owner-avatar { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* Chat button */
.mobile-chat-btn { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--bg-surface); color: var(--text-muted); font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; transition: background 0.12s, border-color 0.12s; }
.mobile-chat-btn:active { background: var(--border); }
.mobile-chat-btn.has-msg { border-color: var(--accent); color: var(--accent-light); background: rgba(97,97,255,0.08); }
.mobile-chat-btn.unread { background: var(--red); border-color: var(--red); color: #fff; animation: badge-pulse 2s infinite; }

.mobile-add-btn { display: block; width: 100%; padding: 11px 14px; background: transparent; border: none; border-top: 1px solid var(--border); color: var(--accent-light); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.mobile-add-btn:active { background: rgba(97,97,255,0.07); }

/* ── Panel tabs (mobile only) ── */
.panel-tabs { display: none; }

/* ── Responsive ── */
@media (max-width: 768px) {
  /* Nav: single row with hamburger */
  .topnav {
    height: calc(56px + env(safe-area-inset-top, 0px));
    min-height: calc(56px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    flex-wrap: nowrap;
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
  }
  .hamburger-btn { display: flex; }
  .sidebar { display: none; }
  .topnav-logo { font-size: 16px; }
  .topnav-m5-logo { height: 32px; }
  .topnav-m5-logo.logo-ets { height: 44px; }
  .topnav-user { display: none; }
  .theme-toggle, .notif-btn { padding: 4px 8px; font-size: 13px; flex-shrink: 0; }
  .pp-menu { max-width: calc(100vw - 32px); }

  /* Astro bar: compact */
  .ets-astro-bar { padding: 8px 12px; gap: 12px; }
  .astro-time { font-size: 15px; }
  .astro-sign-glyph { font-size: 24px; }
  .astro-moon-phases-strip { justify-content: flex-start; }
  .astro-divider { height: 28px; }

  /* Toolbar */
  .board-toolbar { padding: 8px 12px 6px; gap: 6px; }
  /* Views are desktop-only — mobile uses the card layout */
  .view-tabs-row { display: none; }
  .toolbar-row { gap: 8px; flex-wrap: wrap; }
  .search-input { flex: 1; min-width: 0; }
  .btn { padding: 7px 12px; font-size: 12px; }

  /* Mobile: hide table, show cards */
  .board-wrap { padding: 12px 10px 32px; overflow-x: hidden; }
  .board-table { display: none !important; }
  .mobile-board { display: block; }

  /* Panel: full screen, flex column with tabs */
  .item-panel {
    width: 100vw;
    border-left: none;
    display: flex;
    flex-direction: column;
    height: 100dvh;        /* dynamic viewport height — avoids address bar overlap */
    max-height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
  }
  .item-panel.expanded { width: 100vw; }
  .panel-expand-btn { display: none; }
  /* Panel tabs visible on mobile */
  .panel-tabs {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
  }
  .panel-tab {
    flex: 1;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
  }
  .panel-tab.active { color: var(--accent-light); border-bottom-color: var(--accent-light); }

  /* Tab content visibility */
  .item-panel[data-tab="messages"] .panel-section-details { display: none; }
  .item-panel[data-tab="details"] .panel-section-messages { display: none; }

  /* Details section: scrollable, fills remaining height */
  .panel-section-details {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: none;
    flex-shrink: 1;
  }
  /* Messages section: takes remaining height, scrollable messages */
  .panel-section-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .panel-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px 14px;
  }
  .panel-input { flex-shrink: 0; padding: 10px 12px; }

  .panel-fields { gap: 12px; padding: 12px 16px; flex-shrink: 0; }
  .field-group { min-width: 100%; max-width: 100%; overflow: hidden; }
  .field-value input[type="date"] { max-width: 100%; width: 100%; box-sizing: border-box; }
  .panel-header { padding: 12px 16px; flex-shrink: 0; }

  /* Edit/delete buttons: fully visible on touch — no hover needed */
  .msg-edit-btn { opacity: 1; font-size: 15px; padding: 4px 8px; }
  .msg-delete-btn { opacity: 1; font-size: 15px; padding: 4px 8px; color: #ef4444; }

  /* Modal: bottom sheet */
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92dvh; overflow-y: auto; margin: 0; padding: 20px 16px; }

  /* Composer */
  .msg-composer-bar { flex-wrap: wrap; gap: 6px; }
  .composer-name { width: 100%; }
  .send-btn { padding: 6px 18px; }

  /* Toast */
  .toast { width: calc(100% - 32px); text-align: center; }

  /* Notif panel */
  .notif-panel { right: 0; left: 0; width: 100%; border-radius: 0 0 16px 16px; }
}

@media (max-width: 400px) {
  .topnav-logo span { display: none; }
  .astro-moon-phases-strip { display: none; }
}

/* ── Toolbar controls (Filter / Person / Sort / Hide) ── */
.tb-ctrl { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--text-muted); font-size: 13px; font-weight: 500; padding: 6px 12px; cursor: pointer; transition: all 0.12s; white-space: nowrap; }
.tb-ctrl:hover { background: var(--bg-card); color: var(--text); }
.tb-ctrl-on { color: var(--accent); border-color: var(--accent); background: var(--hover); }
.tb-badge { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 0 5px; min-width: 16px; text-align: center; }
.tb-pop { position: fixed; z-index: 9999; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; max-height: 360px; overflow-y: auto; }
.tb-pop-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 6px 10px 4px; }
.tb-pop-group { font-size: 11px; font-weight: 700; color: var(--accent); padding: 8px 10px 2px; }
.tb-pop-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 13px; color: var(--text); border-radius: 6px; cursor: pointer; width: 100%; text-align: left; background: transparent; border: none; }
.tb-pop-row:hover { background: var(--bg-card); }
.tb-pop-row input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.tb-pop-btn { font-weight: 500; color: var(--text); }
.tb-pop-btn.active { color: var(--accent); font-weight: 700; }
.tb-pop-clear { color: var(--text-muted); border-top: 1px solid var(--border); border-radius: 0; margin-top: 4px; }
.tb-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.tb-avatar { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* ── View switcher tabs ── */
.view-tabs-row { gap: 2px; border-bottom: 1px solid var(--border); padding-bottom: 0; margin-bottom: 2px; }
.view-tab { background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; padding: 7px 14px; cursor: pointer; transition: color 0.12s, border-color 0.12s; margin-bottom: -1px; }
.view-tab:hover { color: var(--text); }
.view-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.view-empty { display: flex; align-items: center; justify-content: center; height: 220px; color: var(--text-muted); font-size: 14px; padding: 24px; text-align: center; }

/* ── Kanban view ── */
.kanban { display: flex; gap: 14px; padding: 16px 20px 24px; overflow-x: auto; align-items: flex-start; min-height: 200px; }
.kanban-col { flex: 0 0 280px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kanban-col-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kanban-col-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-top: 3px solid var(--border); border-radius: 10px 10px 0 0; font-weight: 700; font-size: 13px; }
.kanban-col-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-col-count { background: var(--bg-surface); color: var(--text-muted); font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 8px; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; padding: 10px; overflow-y: auto; }
.kanban-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow 0.12s, transform 0.05s; }
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card:active { transform: scale(0.99); }
.kanban-card.dragging { opacity: 0.4; }
.kanban-card-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; line-height: 1.35; }
.kanban-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }
.kanban-card-date { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ── Calendar view ── */
.calendar-view { padding: 14px 20px 24px; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-month { font-size: 16px; font-weight: 700; min-width: 180px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal-dow { margin-bottom: 0; border-radius: 10px 10px 0 0; border-bottom: none; }
.cal-grid.cal-dow + .cal-grid { border-radius: 0 0 10px 10px; border-top: none; }
.cal-dowcell { background: var(--bg-surface); padding: 7px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); text-align: center; }
.cal-cell { background: var(--bg-surface); min-height: 96px; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal-empty { background: var(--bg-card); }
.cal-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-daynum { font-size: 12px; font-weight: 600; color: var(--text-muted); align-self: flex-end; }
.cal-today .cal-daynum { color: var(--accent); font-weight: 800; }
.cal-event { font-size: 11px; font-weight: 600; color: #fff; padding: 2px 7px; border-radius: 5px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event:hover { filter: brightness(1.07); }

/* ── Team Calendar ── */
.tc-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ── Timeline / Gantt view ── */
.timeline-view { padding: 8px 20px 24px; min-width: 760px; }
.tl-head { display: flex; align-items: stretch; border-bottom: 2px solid var(--border); position: sticky; top: 0; background: var(--bg-surface); z-index: 5; }
.tl-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); min-height: 40px; }
.tl-label { flex: 0 0 220px; padding: 10px 12px; font-size: 13px; font-weight: 500; color: var(--text); display: flex; align-items: center; cursor: pointer; border-right: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-label:hover { color: var(--accent); }
.tl-head-label { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.tl-track { flex: 1; position: relative; min-height: 40px; }
.tl-head-track { min-height: 34px; }
.tl-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); padding-left: 4px; }
.tl-tick span { font-size: 10px; color: var(--text-muted); font-weight: 600; }
.tl-bar { position: absolute; top: 50%; transform: translateY(-50%); height: 22px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; box-shadow: var(--shadow-sm); min-width: 8px; }
.tl-bar:hover { filter: brightness(1.07); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 4; }
.tl-today-label::after { content: "Today"; position: absolute; top: 0; left: 3px; font-size: 9px; font-weight: 700; color: var(--red); white-space: nowrap; }

/* ── Recycle Bin ── */
.recycle-count { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 1px 6px; min-width: 16px; text-align: center; flex-shrink: 0; }
.sidebar.collapsed .recycle-count { display: none !important; }
.recycle-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.recycle-row:last-child { border-bottom: none; }
.recycle-info { flex: 1; min-width: 0; }
.recycle-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recycle-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.recycle-btn { font-size: 12px; padding: 5px 11px; flex-shrink: 0; }

/* ── My Work ── */
.mywork-bucket { margin-bottom: 14px; }
.mywork-bucket-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 6px 4px; border-bottom: 2px solid var(--border); display: flex; align-items: center; gap: 8px; }
.mywork-overdue .mywork-bucket-label { color: var(--red, #e2445c); border-bottom-color: var(--red, #e2445c); }
.mywork-bucket-count { background: var(--border); color: var(--text-muted); border-radius: 10px; font-size: 10px; padding: 1px 7px; font-weight: 600; }
.mywork-row { cursor: pointer; border-radius: 6px; }
.mywork-row:hover { background: rgba(97,97,255,0.07); }
.mywork-status { font-size: 11px; font-weight: 600; color: #fff; border-radius: 4px; padding: 3px 9px; flex-shrink: 0; white-space: nowrap; }
.mywork-date { font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; min-width: 86px; text-align: right; }

/* ── Chart view ── */
.chart-view { padding: 20px 28px; max-width: 760px; }
.chart-head { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.chart-total { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.chart-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.chart-label { flex: 0 0 140px; font-size: 13px; font-weight: 600; color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-track { flex: 1; height: 26px; background: var(--bg-card); border-radius: 6px; overflow: hidden; }
.chart-bar { height: 100%; border-radius: 6px; transition: width 0.3s; min-width: 4px; }
.chart-count { flex: 0 0 36px; font-size: 13px; font-weight: 700; color: var(--text); }

/* ── "New version ready" bar ──────────────────────────────────────────────────
   Shown when a new build is waiting. Deploys no longer reload the page on
   their own, so this is the only way a new version is picked up mid-session. */
#sw-update-bar {
  /* Bottom-right, clear of the centred .toast and of the reply box's text. */
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--accent-light, #818cf8);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  color: var(--text, #e2e8f0);
  max-width: calc(100vw - 32px);
}
#sw-update-bar button {
  border-radius: 8px;
  border: 1px solid var(--border, #334155);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-family: inherit;
}
#sw-update-bar #sw-update-go {
  background: var(--accent, #6366f1);
  border-color: var(--accent, #6366f1);
  color: #fff;
}
#sw-update-bar button:hover { opacity: 0.85; }
