/* =====================================================
   Sunday — Monday-parity Light Theme (Phase 1)
   Default theme is Monday-style white. A dark variant
   is preserved as `[data-theme="dark"]` for Phase 2.
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  /* ── Monday light palette ────────────────────────── */
  --bg:           #FFFFFF;
  --surface:      #FFFFFF;
  --surface-2:    #F5F6F8;     /* sidebar hover, alt bg */
  --surface-3:    #ECEEF2;     /* pressed/quiet chips  */
  --surface-tint: #F5F6F8;
  --border:       #E6E9EF;
  --border-strong:#D0D4DC;
  --accent:       #0073EA;      /* Monday primary blue */
  --accent-hover: #0060B9;
  --accent-dim:   rgba(0,115,234,0.08);
  --accent-tint:  #CCE5FF;
  --selected:     #CCE5FF;
  --text:         #323338;
  --text-muted:   #676879;
  --text-dim:     #9B9FA8;
  --hover:        #F5F6F8;
  --row-hover:    #F5F6F8;

  /* Monday status palette */
  --st-done:        #00C875;
  --st-working:     #FDAB3D;
  --st-stuck:       #E2445C;
  --st-blocked:     #333333;
  --st-on-hold:     #7F5347;
  --st-to-do:       #C4C4C4;
  --st-review:      #FFCB00;
  --st-pink:        #FF5AC4;
  --st-purple:      #A25DDC;
  --st-teal:        #66CCFF;
  --st-indigo:      #5559DF;
  --st-mid-blue:    #0086C0;
  --pr-high:        #00C875;
  --pr-medium:      #579BFC;
  --pr-low:         #66CCFF;
  --pr-missing:     #E2445C;

  --row-h:        36px;
  --header-h:     56px;
  --toolbar-h:    52px;
  --sidebar-w:    240px;
  --drawer-w:     560px;
  --radius:       4px;
  --radius-sm:    3px;
  --radius-md:    6px;
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:    0 8px 24px rgba(0,0,0,0.10);
  --shadow-lg:    0 14px 40px rgba(0,0,0,0.14);
}

/* Dark theme (preserved for Phase 2 toggle) */
[data-theme="dark"] {
  --bg:           #0e0f12;
  --surface:      #1a1c20;
  --surface-2:    #23262c;
  --surface-3:    #2c2f36;
  --surface-tint: #1a1c20;
  --border:       #2e3039;
  --border-strong:#3a3d48;
  --accent:       #4DA3FF;
  --accent-dim:   rgba(77,163,255,0.15);
  --accent-tint:  rgba(77,163,255,0.20);
  --selected:     rgba(77,163,255,0.25);
  --text:         #e8eaf0;
  --text-muted:   #8b8fa8;
  --text-dim:     #555868;
  --hover:        rgba(255,255,255,0.04);
  --row-hover:    rgba(255,255,255,0.03);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Figtree', 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
#layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.1px;
  color: var(--text);
}
.sidebar-logo svg { flex-shrink: 0; }

.sidebar-section-label {
  padding: 14px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
}

.sidebar-ws { padding: 6px 10px 8px; }
.sidebar-ws-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 8px 6px 4px;
}
.sidebar-board {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 400;
  transition: background 0.08s, color 0.08s;
}
.sidebar-board:hover { background: var(--surface-2); }
.sidebar-board.active {
  background: var(--accent-tint);
  color: var(--text);
  font-weight: 600;
}
.sidebar-board .board-icon { font-size: 13px; flex-shrink: 0; opacity: 0.75; }

/* ── Main area ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
}

/* ── Board header ── */
#board-header {
  flex-shrink: 0;
  padding: 0 20px;
  min-height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
}
#board-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  letter-spacing: -0.2px;
}
.view-tabs {
  display: flex;
  gap: 2px;
  margin-left: 12px;
  align-items: center;
}
.view-tab {
  padding: 16px 14px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.08s, border-color 0.08s;
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── Toolbar ── */
#toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  min-height: var(--toolbar-h);
  position: relative;
}

/* New Item split button (left = primary, right = chevron) */
.split-btn {
  display: inline-flex;
  align-items: stretch;
  height: 32px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  overflow: hidden;
  margin-right: 8px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.split-btn-main, .split-btn-caret {
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.08s;
}
.split-btn-main { padding: 0 14px; gap: 6px; }
.split-btn-caret {
  padding: 0 8px;
  border-left: 1px solid rgba(255,255,255,0.25);
  font-size: 10px;
}
.split-btn-main:hover, .split-btn-caret:hover { background: var(--accent-hover); }
.split-btn-main:disabled, .split-btn-caret:disabled { opacity: 0.5; cursor: not-allowed; }

/* Toolbar ghost button */
.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.08s, color 0.08s;
  position: relative;
  white-space: nowrap;
}
.tb-btn:hover { background: var(--surface-2); }
.tb-btn.active {
  background: var(--accent-tint);
  color: var(--text);
}
.tb-btn .tb-icon {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.tb-btn:hover .tb-icon { color: var(--text); }
.tb-btn .tb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 2px;
}
.tb-btn .tb-caret {
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 1px;
}
.tb-search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.tb-search {
  height: 32px;
  width: 200px;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 10px 0 30px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  border-radius: var(--radius);
  transition: width 0.15s, background 0.08s;
}
.tb-search:hover { background: var(--surface-2); }
.tb-search:focus { background: var(--surface-2); width: 240px; }
.tb-search::placeholder { color: var(--text-muted); }
.tb-search-wrap::before {
  content: '';
  position: absolute;
  left: 8px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23676879' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.868-3.834zm-5.242 1.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}
#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 360px;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 500;
  max-height: 480px;
  overflow-y: auto;
}

/* Legacy toolbar buttons forced hidden on Phase 1 — surfaced via overflow menu */
#toolbar #btn-invite-guest,
#toolbar #btn-add-group,
#toolbar #btn-add-column,
#toolbar #btn-edit-board { display: none !important; }

/* Legacy generic buttons kept for compat (modal, drawer composer) */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.08s, opacity 0.08s, border-color 0.08s;
  white-space: nowrap;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); }

/* ── Board content area ── */
#board-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 0 0 40px 0;
  background: var(--bg);
}

/* ── Table view ── */
.board-table {
  width: 100%;
  min-width: 700px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
}

.board-table thead th {
  height: 38px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 3;
}
.board-table thead th:last-child { border-right: none; }
.board-table thead th.th-checkbox { width: 36px; padding: 0; text-align: center; }
.board-table thead th.th-add-col { width: 40px; text-align: center; color: var(--accent); cursor: pointer; }

/* ── Group header ── */
.group-header-row td {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0;
}
.group-header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 6px 14px;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.group-color-bar {
  display: none; /* superseded by group-name pill */
}
.group-chevron {
  color: var(--text-muted);
  transition: transform 0.15s;
  font-size: 10px;
  width: 14px;
  text-align: center;
  display: inline-block;
}
.group-header-row .group-chevron { transform: rotate(90deg); } /* expanded = down */
.group-header-row.collapsed .group-chevron { transform: rotate(0); }
.group-name {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 11px;
  background: var(--group-color, #579BFC);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.1px;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-name.text-style {
  background: transparent !important;
  color: var(--group-color, #579BFC) !important;
  padding: 0;
  font-weight: 700;
  font-size: 15px;
}
.group-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 4px;
}
.group-edit-btn {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s;
}
.group-header-inner:hover .group-edit-btn { opacity: 1; }
.group-edit-btn:hover { background: var(--surface-2); color: var(--text); }

/* Colored left accent bar shown across group's rows */
.group-row-accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--group-color, #579BFC);
  border-radius: 0 2px 2px 0;
}

/* ── Item rows ── */
.item-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.06s;
  position: relative;
}
.item-row:hover { background: var(--row-hover); }
.item-row td {
  height: var(--row-h);
  padding: 0 12px;
  vertical-align: middle;
  font-size: 14px;
  border-right: 1px solid var(--border);
  color: var(--text);
}
.item-row td:last-child { border-right: none; }
.item-row td:first-child { padding-left: 0; }
.item-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.item-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  color: var(--text);
}
.item-row .item-chat-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 3px;
  flex-shrink: 0;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s;
}
.item-row:hover .item-chat-icon { opacity: 1; }
.item-row .item-chat-icon.has-comments { opacity: 1; color: var(--text-muted); }
.item-row .item-chat-icon:hover { background: var(--surface-2); color: var(--accent); }
.item-row .item-chat-count {
  font-size: 10px;
  margin-left: 2px;
  font-weight: 600;
}
.item-open-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  margin-left: auto;
  transition: opacity 0.1s;
  font-weight: 500;
}
.item-row:hover .item-open-btn { opacity: 1; }
.item-open-btn:hover { background: var(--surface-2); }
.subitem-chevron {
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.08s, color 0.08s, transform 0.1s;
  flex-shrink: 0;
}
.subitem-chevron:hover { background: var(--surface-2); color: var(--text); }
.subitem-chevron.expanded { transform: rotate(90deg); color: var(--accent); }

/* ── Subitem rows ── */
.subitem-row {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.subitem-row td:first-child { padding-left: 48px !important; }
.subitem-row td {
  height: 32px;
  padding: 0 12px;
  vertical-align: middle;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Status / Priority pills (Monday-style: fill the cell) ── */
.item-row td.status-cell { padding: 0 !important; height: var(--row-h); }
.status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  height: var(--row-h);
  min-height: var(--row-h);
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.08s;
  border: none;
}
.status-pill:hover { opacity: 0.92; }
.status-pill.empty {
  background: #C4C4C4;
  color: rgba(0,0,0,0.55);
}

/* ── Person avatars ── */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  cursor: default;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.avatar-stack {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
}
.avatar-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); border: none; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-empty {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px dashed var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* ── Date cell ── */
.date-cell {
  color: var(--text);
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 5px;
}
.date-cell::before {
  content: '';
  width: 12px; height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%239B9FA8'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}
.date-cell.empty::before { opacity: 0.5; }
.date-cell.overdue { color: var(--st-stuck); }

/* ── Creation log ── */
.creation-log {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.creation-log .avatar { width: 20px; height: 20px; font-size: 9px; border-width: 1px; }

/* ── New / Add item row ── */
.new-item-row td {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 0 0 14px;
  height: 36px;
}
.new-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius);
  transition: background 0.08s, color 0.08s;
  font-weight: 500;
}
.new-item-btn:hover { background: var(--surface-2); color: var(--accent); }
.new-item-input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 6px 10px;
  outline: none;
}

/* ── Selected row ── */
.item-row.selected { background: var(--selected) !important; }
.item-row.kb-focus { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── Row / Header checkboxes ── */
.row-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.th-checkbox, .td-checkbox {
  width: 36px !important;
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
}

/* ── Kanban view ── */
#kanban-view {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  overflow-x: auto;
  align-items: flex-start;
}
.kanban-column {
  flex-shrink: 0;
  width: 260px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.kanban-col-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
}
.kanban-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kanban-col-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}
.kanban-cards {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.1s, box-shadow 0.1s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.kanban-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.kanban-card-name {
  font-size: 13px;
  margin-bottom: 8px;
  line-height: 1.35;
  color: var(--text);
}
.kanban-card-footer { display: flex; align-items: center; gap: 6px; }

/* ── Item Drawer ── */
#drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#drawer-overlay.open { opacity: 1; pointer-events: all; }
#item-drawer {
  position: fixed;
  top: 0; right: 0;
  width: var(--drawer-w);
  max-width: 95vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
  z-index: 101;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
#item-drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 16px 16px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-top-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
#drawer-item-name {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 6px;
  resize: none;
  outline: none;
  line-height: 1.3;
  transition: border-color 0.1s;
}
#drawer-item-name:focus { border-color: var(--border-strong); background: var(--surface); }
.drawer-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius);
  line-height: 1;
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--surface-2); color: var(--text); }

.drawer-tabs { display: flex; gap: 2px; }
.drawer-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}
.drawer-tab:hover { color: var(--text); }
.drawer-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }

/* Drawer column values */
.drawer-col-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 2px 0;
  margin-bottom: 16px;
}
.drawer-col-label {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 0;
}
.drawer-col-value { padding: 4px 0; display: flex; align-items: center; }

/* ── Comments ── */
.comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.comment-block { display: flex; gap: 10px; }
.comment-body-wrap { flex: 1; min-width: 0; }
.comment-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.comment-meta strong { color: var(--text); }
.comment-text { font-size: 13px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.comment-composer { border-top: 1px solid var(--border); padding-top: 12px; display: flex; gap: 8px; align-items: flex-end; }
.comment-composer textarea {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 10px;
  resize: none;
  outline: none;
  min-height: 64px;
  transition: border-color 0.1s;
}
.comment-composer textarea:focus { border-color: var(--accent); }
.comment-composer textarea::placeholder { color: var(--text-muted); }

/* ── Activity log ── */
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-row { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; }
.activity-row .avatar { width: 20px; height: 20px; font-size: 9px; flex-shrink: 0; margin-top: 1px; border-width: 1px; }
.activity-detail { color: var(--text-muted); line-height: 1.4; }
.activity-detail strong { color: var(--text); }
.activity-time { color: var(--text-dim); font-size: 11px; white-space: nowrap; margin-top: 1px; }

/* ── Status popover (light) ── */
#status-popover {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 200;
  padding: 6px;
  min-width: 200px;
  display: none;
}
#status-popover.open { display: block; }
.status-option {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.08s;
}
.status-option:hover { background: var(--surface-2); }
.status-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* ── Empty / loading states ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 240px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 36px; }
.empty-state p { font-size: 14px; }

.board-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; height: 200px;
  color: var(--text-muted); font-size: 13px;
}

.error-banner {
  display: flex; align-items: center; gap: 10px;
  background: #FEE4E8;
  border: 1px solid #F4A6B0;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 12px 16px;
  color: #B5304A;
  font-size: 13px;
}
.error-banner .error-banner-msg { flex: 1; }
.error-banner button { background: none; border: none; color: inherit; cursor: pointer; font-size: 14px; padding: 0 4px; }

.empty-board {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; color: var(--text-muted); text-align: center; gap: 16px;
}
.empty-board-icon {
  width: 72px; height: 72px;
  background: var(--surface-2);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.empty-board h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.empty-board p  { font-size: 14px; color: var(--text-muted); max-width: 320px; }

/* ── Scrollbar (light) ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D0D4DC; border-radius: 5px; border: 2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,18,28,0.35);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 301;
  width: 480px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.modal-box.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: all; }
.modal-header {
  display: flex; align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-title { flex: 1; font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 3px 6px;
  border-radius: var(--radius); line-height: 1;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 16px; overflow-y: auto; max-height: 60vh; display: flex; flex-direction: column; gap: 12px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border);
}

/* Forms */
.form-field, .field-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-label, .field-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-input, .field-input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.08s, box-shadow 0.08s;
  width: 100%;
}
.form-input:focus, .field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.form-input::placeholder, .field-input::placeholder { color: var(--text-muted); }
select.field-input { cursor: pointer; }

.color-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.color-swatch { width: 24px; height: 24px; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.08s, transform 0.08s; }
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); }

.palette-editor { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.palette-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius); padding: 6px 8px;
}
.palette-row-swatch { width: 20px; height: 20px; border-radius: 3px; flex-shrink: 0; cursor: pointer; border: 1px solid var(--border); }
.palette-row input[type="text"] {
  flex: 1; background: transparent; border: none; color: var(--text);
  font-size: 13px; font-family: inherit; outline: none; padding: 0;
}
.palette-row-done {
  font-size: 11px; color: var(--text-muted); cursor: pointer;
  padding: 2px 6px; border-radius: 3px; border: 1px solid var(--border-strong);
  white-space: nowrap; flex-shrink: 0;
}
.palette-row-done.active { background: #E6F7EE; color: #027F4C; border-color: #6FCB9F; }
.palette-row-remove { color: var(--text-dim); cursor: pointer; font-size: 14px; flex-shrink: 0; padding: 0 2px; }
.palette-row-remove:hover { color: var(--st-stuck); }
.add-palette-option { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--accent); cursor: pointer; padding: 4px 0; }

.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.type-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.1s, background 0.1s;
  font-size: 12px; color: var(--text);
  text-align: center;
}
.type-tile:hover { border-color: var(--accent); }
.type-tile.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.type-tile-icon { font-size: 18px; }

/* ── Bulk toolbar ── */
.bulk-toolbar {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 250;
  display: flex; align-items: center;
  gap: 4px; padding: 8px 10px;
  opacity: 0; pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}
.bulk-toolbar .btn { background: transparent !important; color: #fff !important; border: 1px solid rgba(255,255,255,0.2) !important; }
.bulk-toolbar .btn:hover { background: rgba(255,255,255,0.1) !important; }
.bulk-toolbar.open { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: all; }
.bulk-count {
  font-size: 13px; font-weight: 700; color: #fff;
  padding: 0 8px; border-right: 1px solid rgba(255,255,255,0.2);
  margin-right: 4px; white-space: nowrap;
}
.bulk-delete { color: #FF8FA0 !important; }

/* ── Relation chips ── */
.relation-chip {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.08s, color 0.08s;
}
.relation-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ── Sprint view ── */
.sprint-view { padding: 16px 20px; display: flex; flex-direction: column; gap: 20px; }
.sprint-section {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.sprint-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  gap: 12px;
  flex-wrap: wrap;
}
.sprint-name { font-weight: 700; font-size: 14px; color: var(--text); }
.sprint-dates { font-size: 12px; color: var(--text-muted); }
.sprint-progress-bar { width: 100px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.sprint-progress-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.sprint-stats { font-size: 12px; color: var(--text-muted); }

/* ── Toolbar dropdown panels ── */
.tb-panel {
  position: absolute;
  top: calc(100% - 4px);
  left: 0;
  min-width: 280px;
  max-width: min(720px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px;
  z-index: 600;
  display: none;
}
.tb-panel.open { display: block; }
.tb-panel.wide { min-width: 640px; }
.tb-panel-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.tb-panel-title { font-weight: 700; font-size: 15px; color: var(--text); flex: 1; }
.tb-panel-help { color: var(--text-dim); cursor: help; }
.tb-panel-clear {
  font-size: 13px; color: var(--text-muted); cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius);
}
.tb-panel-clear:hover { color: var(--accent); background: var(--surface-2); }
.tb-panel-save {
  font-size: 13px; padding: 6px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); cursor: pointer; background: var(--surface); color: var(--text);
}
.tb-panel-save:hover { background: var(--surface-2); }
.tb-panel-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; }
.tb-panel-section-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin: 8px 0 6px; }

/* Filter quick-chips */
.qf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.qf-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.qf-col-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.qf-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border-radius: 16px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.08s;
}
.qf-chip:hover { background: var(--surface-3); }
.qf-chip.selected { background: var(--accent-tint); }
.qf-chip-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qf-chip-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.qf-chip-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.qf-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.qf-footer a { color: var(--text-muted); text-decoration: none; cursor: pointer; }
.qf-footer a:hover { color: var(--accent); }

/* Sort/Hide rows */
.sort-row, .hide-row, .person-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.sort-row:hover, .hide-row:hover, .person-row:hover { background: var(--surface-2); }
.sort-row select { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 4px 8px; font-size: 12px; font-family: inherit; color: var(--text); }
.sort-row .dir-toggle { font-size: 11px; padding: 3px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface); color: var(--text); }
.sort-row .dir-toggle:hover { background: var(--surface-2); }
.sort-row .remove-x { color: var(--text-dim); cursor: pointer; padding: 0 4px; }
.sort-row .remove-x:hover { color: var(--st-stuck); }

.hide-row input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }
.person-row .avatar { width: 24px; height: 24px; font-size: 10px; border-width: 1px; }
.person-row .person-name { flex: 1; }

/* Overflow menu */
.tb-overflow-menu { min-width: 220px; }
.tb-overflow-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
}
.tb-overflow-item:hover { background: var(--surface-2); }
.tb-overflow-item:disabled, .tb-overflow-item.disabled { color: var(--text-dim); cursor: not-allowed; }
.tb-overflow-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ── Settings tabs ── */
.settings-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.settings-tab {
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid transparent; border-bottom: none;
  transition: color 0.1s, background 0.1s;
  user-select: none;
}
.settings-tab:hover { color: var(--text); background: var(--surface-2); }
.settings-tab.active { color: var(--accent); background: var(--surface); border-color: var(--border); }

.automation-rule-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}
.rule-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.rule-desc { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.trigger-badge { background: #DBE9FF; color: #0073EA; border: 1px solid #B0CFFB; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; }
.action-badge { background: #DAF5E7; color: #027F4C; border: 1px solid #6FCB9F; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 9px; transition: background 0.15s; }
.toggle-slider::before { content: ''; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; background: var(--text-dim); border-radius: 50%; transition: transform 0.15s, background 0.15s; }
.toggle-switch input:checked + .toggle-slider { background: #DAF5E7; border-color: #027F4C; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(14px); background: #027F4C; }

/* Mirror + Formula cells */
.mirror-cell, .formula-cell {
  font-size: 12px; color: var(--text-muted);
  font-style: italic; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 180px; display: inline-block;
}
.mirror-cell { color: var(--accent); }
.formula-cell { color: var(--st-purple); }

/* ── File rows ── */
.files-tab { display: flex; flex-direction: column; gap: 12px; }
.file-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.file-dropzone.dragover, .file-dropzone:hover { border-color: var(--accent); background: var(--accent-dim); }
.file-dropzone-inner p { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.file-upload-label { color: var(--accent); cursor: pointer; text-decoration: underline; }
.file-upload-input { display: none; }

.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.file-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; }
.file-icon { font-size: 28px; flex-shrink: 0; width: 48px; text-align: center; }
.file-info { flex: 1; min-width: 0; }
.file-name { color: var(--accent); font-size: 13px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.file-name:hover { text-decoration: underline; }
.file-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Search results dropdown */
.search-board-header {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}
.search-board-header:first-child { border-top: none; }
.search-result-row { padding: 8px 12px; cursor: pointer; transition: background 0.1s; }
.search-result-row:hover { background: var(--surface-2); }
.search-result-inner { display: flex; align-items: flex-start; gap: 8px; }
.search-result-icon { flex-shrink: 0; font-size: 14px; margin-top: 1px; }
.search-result-text { flex: 1; min-width: 0; }
.search-result-name { font-size: 13px; font-weight: 500; color: var(--text); }
.search-result-snippet { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-snippet mark { background: #FFEEB4; color: var(--text); border-radius: 2px; }
.search-result-author { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Keyboard hint bar */
.kbd-hint-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 28px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.kbd-hint-bar kbd {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 0 4px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 10px;
  color: var(--text);
  line-height: 16px;
}

/* Mobile hamburger */
.sidebar-toggle {
  display: none;
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; padding: 6px;
  border-radius: var(--radius);
  font-size: 18px; line-height: 1;
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text); background: var(--surface-2); }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 90;
}
.sidebar-backdrop.open { display: block; }

/* Responsive */
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; --drawer-w: min(480px, 92vw); }
  .sidebar-toggle { display: flex; align-items: center; }
  #layout { position: relative; }
  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 100; transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }
  #sidebar.open { transform: translateX(0); }
  #board-header { padding: 0 12px; gap: 8px; }
  #toolbar { padding: 6px 8px; flex-wrap: wrap; }
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #item-drawer { width: 100vw !important; max-width: 100vw; }
  .kbd-hint-bar { display: none; }
  .tb-panel { left: 8px !important; right: 8px !important; max-width: calc(100vw - 16px); }
}

@media (max-width: 600px) {
  :root { --drawer-w: 100vw; }
  html, body { overflow: hidden; }
  #board-header { height: 48px; padding: 0 8px; }
  #board-title { font-size: 16px; }
  #toolbar { padding: 4px 8px; }
  .view-tabs { display: none; }
  .modal-box { width: 96vw; max-width: 96vw; }
}

/* Admin invites link */
.admin-invites-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-dim); text-decoration: none;
  padding: 4px 8px; border-radius: var(--radius);
}
.admin-invites-link:hover { color: var(--accent); background: var(--surface-2); }

/* Spinner */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Column drag handle (kept) */
.col-drag-handle { color: var(--text-dim); cursor: grab; padding: 2px 4px; font-size: 12px; }
.col-drag-handle:active { cursor: grabbing; }

/* ============================================================
   Phase 1 Polish (Sunday 2026-06-07)
   ============================================================ */

/* --- #1 Person panel: sticky header + search + Assigned-to-me --- */
#panel-person { max-height: 70vh; display: flex; flex-direction: column; padding-top: 8px; }
.person-panel-sticky {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.person-panel-search-wrap { padding: 4px 4px 6px; }
.person-panel-search-wrap .person-panel-search {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px; font-size: 13px; font-family: inherit;
  background: var(--surface); color: var(--text);
  outline: none;
}
.person-panel-search-wrap .person-panel-search:focus { border-color: var(--accent); }
.person-row-me { background: var(--accent-tint, rgba(0,115,255,0.06)); }
.person-row-me:hover { background: var(--accent-tint, rgba(0,115,255,0.12)); }
.person-row.selected { background: var(--accent-tint, rgba(0,115,255,0.12)); font-weight: 600; }
.person-panel-list {
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: 380px;
}

/* --- #3 Waiting-for-review yellow fallback (belt-and-braces in case DB drifts) --- */
/* Apply a yellow override on status pills whose visible label is "Waiting for review"
   regardless of stored color. Uses :has() which is supported in all evergreen browsers.
   Note: also applies to comment/drawer pills with the same label. */
.status-pill[data-label="waiting for review"],
.status-pill[data-label="waiting-for-review"] {
  background: var(--st-review, #FFCB00) !important;
  color: #1f2937 !important;
}

/* --- #6 RTL / Hebrew support (per-cell, content-driven; NOT global) --- */
/* The item-name text element gets dir="auto" + unicode-bidi:plaintext so the browser
   right-aligns its visual rendering when the content's first strong char is RTL
   (Hebrew/Arabic). The cell itself stays LTR so the checkbox + chevron + chat icon
   stay on the LEFT edge (Monday-consistent). */
.item-name-text.rtl-aware {
  unicode-bidi: plaintext;
}
/* When dir=auto resolves to RTL on the span, fill the remaining horizontal space and
   visually right-align inside that flex item so Hebrew flows to the right edge. */
.item-name-cell .item-name-text.rtl-aware {
  flex: 1 1 auto;
  min-width: 0;
}
.item-name-cell .item-name-text.rtl-aware:dir(rtl) {
  text-align: right;
}
/* Drawer item-name textarea + comment composer textarea auto-detect on input */
#drawer-item-name[dir="auto"],
.comment-composer textarea[dir="auto"] {
  unicode-bidi: plaintext;
}
#drawer-item-name:dir(rtl),
.comment-composer textarea:dir(rtl) {
  text-align: right;
}

/* =====================================================
   PHASE 1.5 — Polish round 2
   ===================================================== */

/* ── White-bubble defensive: never let empty floats render ── */
#search-results:empty,
.tb-panel:empty { display: none !important; }

/* ── 2. Sticky checkbox + item-name columns ── */
.board-table th.th-checkbox,
.board-table td.td-checkbox {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
}
.board-table thead th.th-checkbox { z-index: 6; }
.board-table th.th-item-name,
.board-table td.td-item-name {
  position: sticky;
  left: 36px;          /* matches checkbox col width */
  z-index: 3;
  background: var(--surface);
}
.board-table thead th.th-item-name { z-index: 5; }
.item-row:hover td.td-checkbox,
.item-row:hover td.td-item-name { background: var(--row-hover); }
.item-row.selected td.td-checkbox,
.item-row.selected td.td-item-name { background: var(--selected); }
/* Sticky-shadow when horizontally scrolled */
.board-table.h-scrolled td.td-item-name,
.board-table.h-scrolled th.th-item-name {
  box-shadow: 2px 0 4px rgba(0,0,0,0.04);
}

/* ── 3. Resizable columns ── */
.col-resize-handle {
  position: absolute;
  top: 0; right: -2px; bottom: 0;
  width: 6px;
  cursor: col-resize;
  user-select: none;
  z-index: 10;
}
.col-resize-handle:hover { background: rgba(0,115,234,0.35); }
.board-table thead th { position: sticky; }      /* (already sticky top) */
.board-table thead th.col-header-editable { position: sticky; }
body.col-resizing { user-select: none; cursor: col-resize !important; }
body.col-resizing * { cursor: col-resize !important; }

/* ── 6. Inline Person popover ── */
.inline-person-popover {
  position: fixed;
  width: 280px;
  max-height: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 700;
  display: flex; flex-direction: column;
}
.ipp-head { padding: 8px 8px 6px; border-bottom: 1px solid var(--border); }
.ipp-search {
  width: 100%; padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px; font-family: inherit;
  background: var(--surface); color: var(--text);
  box-sizing: border-box;
}
.ipp-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.ipp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px; color: var(--text);
}
.ipp-row:hover { background: var(--surface-2); }
.ipp-row.selected { background: var(--accent-tint); }
.ipp-row-me { border-bottom: 1px dashed var(--border); margin-bottom: 4px; }
.ipp-name { flex: 1; }
.ipp-check { color: var(--accent); font-weight: 700; }
.ipp-empty { padding: 12px; color: var(--text-muted); font-size: 13px; text-align: center; }
.ipp-foot {
  padding: 6px 10px; border-top: 1px solid var(--border);
  text-align: right;
}
.ipp-clear {
  color: var(--text-muted); cursor: pointer; font-size: 12px;
}
.ipp-clear:hover { color: var(--accent); }

/* ── 8. English nudge toast ── */
.english-nudge-toast {
  position: fixed; top: 16px; right: 16px;
  z-index: 9999;
  width: 320px; max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid #0073EA;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  transform: translateX(360px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.english-nudge-toast.open { transform: translateX(0); opacity: 1; }
.ent-row { display: flex; align-items: flex-start; gap: 10px; }
.ent-flag { font-size: 20px; line-height: 1.1; }
.ent-text { flex: 1; min-width: 0; }
.ent-title { font-weight: 700; font-size: 13px; color: var(--text); }
.ent-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ent-dismiss {
  background: none; border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 4px 8px;
  font-size: 12px; cursor: pointer; color: var(--text-muted);
  font-family: inherit;
}
.ent-dismiss:hover { background: var(--surface-2); color: var(--text); }

/* ── 7. Mobile FAB ── */
.mobile-fab {
  position: fixed; right: 18px; bottom: 18px;
  width: 52px; height: 52px; border-radius: 26px;
  background: var(--accent); color: #fff;
  border: none; font-size: 26px; line-height: 52px;
  box-shadow: 0 4px 14px rgba(0,115,234,0.35);
  cursor: pointer; z-index: 80;
  display: none;
  font-weight: 400;
}
.mobile-fab:hover { background: #005bb5; }
body.is-mobile .mobile-fab,
body.is-tablet .mobile-fab { display: flex; align-items: center; justify-content: center; }

/* ── 7. Tablet (≤1024) — simplify toolbar, keep table ── */
@media (max-width: 1024px) {
  /* Sidebar slides over content via existing 900px rules */
  #toolbar { gap: 6px; flex-wrap: wrap; }
  /* Person/Sort/Hide/Group-by shrink to icon-only */
  #toolbar #btn-person .tb-icon ~ *,
  #toolbar #btn-sort   .tb-icon ~ *,
  #toolbar #btn-hide   .tb-icon ~ *,
  #toolbar #btn-group-by .tb-icon ~ * {
    display: none;
  }
  #toolbar .tb-search-wrap { max-width: 200px; }
}

/* ── 7. Phone (≤767) — card list + simpler toolbar ── */
/* Phase 1.5.1 fix: was max-width: 768px which collided with iPad portrait 768px;
   tablet table layout should kick in at exactly 768px. */
@media (max-width: 767px) {
  /* Hide non-essential toolbar items; keep Search + Filter + overflow */
  #toolbar #btn-person,
  #toolbar #btn-sort,
  #toolbar #btn-hide,
  #toolbar #btn-group-by,
  #toolbar #split-new-item {
    display: none;
  }
  #toolbar .tb-search-wrap { flex: 1; max-width: none; }

  /* View tabs hidden on phone (existing rule already at ≤600) */
  .view-tabs { display: none; }

  /* Convert table to card list:
     - thead hidden
     - each .item-row becomes a card
     - cells stack vertically
     - sticky cols disabled */
  .board-table thead { display: none; }
  .board-table { min-width: 0; }
  .board-table th.th-checkbox,
  .board-table td.td-checkbox,
  .board-table th.th-item-name,
  .board-table td.td-item-name {
    position: static;
    box-shadow: none;
    background: transparent;
  }
  /* New-item rows: keep as compact "+ Add" link */
  .new-item-row td { padding: 8px 12px; }

  /* Item row → card.
     Render the tr as a flex container with wrapping rows. The native
     <tr><td>...</td>...</tr> layout breaks once display != table-row,
     so we override row + cell display modes entirely.
  */
  .item-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    gap: 6px 10px;
    position: relative;
  }
  .item-row > td { display: inline-flex; border: none; height: auto; padding: 0; }
  .item-row td.td-checkbox { flex: 0 0 22px; }
  .item-row td.td-item-name {
    flex: 1 1 100%;
    font-weight: 600;
    font-size: 15px;
    order: 1;
  }
  .item-row td.td-checkbox { order: 0; }
  .item-row td:not(.td-checkbox):not(.td-item-name) {
    order: 2;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
  }
  /* Hide empty placeholder cells on cards */
  .item-row td:empty { display: none; }
  /* Status pill compact on cards */
  .item-row td.status-cell {
    display: inline-flex !important;
    height: auto !important;
    padding: 0 !important;
    background: transparent !important;
  }
  .item-row td.status-cell .status-pill {
    width: auto; min-width: 0;
    padding: 2px 10px; height: 22px; line-height: 22px;
    border-radius: 11px;
    font-size: 11px;
  }
  /* Avatar trim to icon size */
  .item-row td .avatar {
    width: 20px !important; height: 20px !important;
    font-size: 9px !important;
  }
  /* Hide '—' empty placeholders entirely on cards to reduce clutter */
  .item-row td > div > .avatar[style*="surface-3"],
  .item-row td .avatar[style*="surface-3"] { display: none; }
  /* Hebrew text snippet column — truncate visibly in cards */
  .item-row td span[style*="max-width"] { max-width: 140px !important; font-size: 11px !important; }
  .item-row td .date-cell { font-size: 11px; }
  /* Mirror/formula/relation chips shrink on cards */
  .item-row td .relation-chip,
  .item-row td .mirror-cell,
  .item-row td .formula-cell { font-size: 11px; }

  /* Group headers stay full-width */
  .group-header-row td { padding: 0; }
  .group-header-inner { padding: 10px 12px; }

  /* Toolbar dropdowns become near-fullwidth */
  .tb-panel { left: 4px !important; right: 4px !important; max-width: calc(100vw - 8px); }

  /* Drawer fullscreen handled by existing ≤600 rule (--drawer-w:100vw) */

  /* Hide kbd-hint-bar already via existing rule */
}

/* ── Tablet sticky tweak: group header sticks under thead ── */
.group-header-row { position: relative; }
@media (min-width: 768px) {
  .group-header-row td > .group-header-inner {
    position: sticky;
    top: 38px;            /* matches thead th height */
    z-index: 2;
    background: var(--surface);
  }
}

/* =====================================================
   PHASE 1.5.1 — Inline date/timeline pickers + visible
   column separators + first-time resize tooltip
   ===================================================== */

/* Make Date and Timeline cells feel interactive */
.board-table tbody td .date-cell { cursor: pointer; }
.board-table tbody td .date-cell:hover { color: var(--accent); }

/* ── 1. Inline Date popover ── */
.inline-date-popover {
  position: fixed;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 720;
  padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13px;
}
.idp-head .idp-input {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px; font-family: inherit;
  background: var(--surface); color: var(--text);
  box-sizing: border-box;
}
.idp-quick { display: flex; gap: 4px; }
.idp-q {
  flex: 1; padding: 6px 4px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px; cursor: pointer;
  font-family: inherit;
}
.idp-q:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.idp-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.idp-clear {
  background: transparent; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 12px; font-family: inherit; padding: 2px 4px;
}
.idp-clear:hover { color: var(--danger, #d23934); }
.idp-hint { color: var(--text-dim); font-size: 11px; }

/* ── 2. Inline Timeline popover ── */
.inline-timeline-popover {
  position: fixed;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 720;
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13px;
}
.itp-row { display: flex; align-items: center; gap: 8px; }
.itp-row label { width: 50px; color: var(--text-muted); font-size: 12px; }
.itp-row input[type="date"] {
  flex: 1; padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px; font-family: inherit;
  background: var(--surface); color: var(--text);
  box-sizing: border-box;
}
.itp-err { color: #d23934; font-size: 12px; min-height: 14px; }
.itp-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.itp-clear, .itp-save {
  padding: 5px 12px; border-radius: var(--radius); cursor: pointer;
  font-size: 12px; font-family: inherit; border: 1px solid var(--border);
  background: var(--surface);
}
.itp-clear { color: var(--text-muted); }
.itp-clear:hover { color: var(--danger, #d23934); border-color: var(--danger, #d23934); }
.itp-save  { background: var(--accent, #0073EA); color: #fff; border-color: var(--accent, #0073EA); }
.itp-save:hover  { filter: brightness(1.05); }

/* ── 3+4. Visible resize separators + handles ── */
/* Subtle 1px separators between every column header */
.board-table thead th {
  border-right: 1px solid #E6E9EF;
}
.board-table thead th:last-child { border-right: none; }

/* The resize handle (already 6px from Phase 1.5) is invisible by default.
   Phase 1.5.1: show a 1px brand-blue strip on hover so users can find it. */
.col-resize-handle {
  background: transparent;
  transition: background-color 120ms ease;
}
.board-table thead th:hover .col-resize-handle,
.col-resize-handle:hover {
  background: rgba(0,115,234,0.18);
}
.col-resize-handle:hover {
  background: #0073EA;
}
/* Make the sticky/frozen item-name column's handle sit above the sticky stacking context */
.col-resize-handle-sticky { z-index: 12; }
.board-table thead th.th-item-name { position: sticky; }
.board-table thead th.th-item-name .col-resize-handle {
  /* ensure the handle is clickable even though the parent is sticky */
  pointer-events: auto;
}

/* ── First-time resize tooltip ── */
.resize-tooltip {
  position: fixed;
  z-index: 9998;
  background: #2c3e50;
  color: #fff;
  padding: 8px 12px 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  display: flex; align-items: center; gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 200ms ease, transform 200ms ease;
  max-width: 260px;
}
.resize-tooltip.open { opacity: 1; transform: translateY(0); }
.resize-tooltip::before {
  content: "";
  position: absolute;
  top: -5px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #2c3e50;
}
.resize-tooltip .rt-text { white-space: nowrap; }
.resize-tooltip .rt-close {
  background: transparent; border: none; color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer;
  padding: 0 0 0 4px; opacity: 0.8;
}
.resize-tooltip .rt-close:hover { opacity: 1; }


/* ============================================================
   PHASE 1.6 — Aaron-prep polish (panel close, hide-by-status,
   advanced filters builder)
   ============================================================ */

/* ✕ close button on toolbar panels */
.tb-panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.08s, color 0.08s;
  z-index: 2;
}
.tb-panel-close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.tb-panel { position: relative; } /* anchor for the close button */

/* Hide-by-status section visuals */
.hide-section { margin-bottom: 4px; }
.hide-status-col-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  padding: 6px 4px 2px 4px;
  margin-top: 4px;
}
.hide-status-row { padding-left: 8px; }
.hide-status-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 2px;
}
.hide-status-empty {
  padding: 4px 8px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Advanced filters builder */
.af-comb-row {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 0 8px;
  font-size: 13px;
}
.af-comb-label { color: var(--text-muted); }
.af-comb-row select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}
.af-list {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 6px;
}
.af-cond-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(110px, 0.9fr) minmax(160px, 1.6fr) auto;
  gap: 6px;
  align-items: start;
  padding: 6px 4px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.af-cond-row select,
.af-cond-row .af-input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}
.af-cond-row .af-input-num { width: 100%; }
.af-cond-row .af-val { min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.af-cond-row .af-val .af-and { font-size: 11px; color: var(--text-muted); align-self: center; }
.af-cond-row .af-val-na { color: var(--text-muted); font-size: 12px; padding: 4px 6px; }
.af-status-checks {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 140px; overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  background: var(--surface);
}
.af-status-check {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  padding: 2px 4px;
  cursor: pointer;
  white-space: nowrap;
}
.af-status-check input[type="checkbox"] { accent-color: var(--accent); }
.af-remove {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  align-self: center;
}
.af-remove:hover { color: var(--st-stuck); }
.af-add-row { margin-top: 6px; }
.af-add {
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--accent);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.af-add:hover { background: var(--accent-tint); }
.af-apply {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.af-apply:hover { filter: brightness(1.05); }

/* =====================================================
   Phase 1.7 — Edit Column safety rails
   ===================================================== */

/* Overlay + dialog (stacks above the column-edit modal) */
.p17-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.p17-overlay.open { display: flex; }

.p17-dialog {
  background: var(--surface, #1f1f2c);
  color: var(--text, #e6e6f0);
  border: 1px solid var(--border, #2e2e3e);
  border-radius: 10px;
  width: 460px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.55);
  padding: 18px 20px 14px;
  font-size: 13px;
}
.p17-dialog-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}
.p17-warn-banner {
  background: rgba(253, 171, 61, 0.12);
  border: 1px solid rgba(253, 171, 61, 0.45);
  color: #fdab3d;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 10px;
}
.p17-dialog-body { margin-bottom: 14px; }
.p17-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.p17-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 13px;
  cursor: pointer;
}
.p17-radio input[type="radio"] { accent-color: var(--accent, #5559df); }
.p17-radio > span:first-of-type { white-space: nowrap; }
.p17-input {
  background: var(--surface-2, #14141e);
  border: 1px solid var(--border, #2e2e3e);
  color: var(--text, #e6e6f0);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
}
.p17-input:focus { outline: none; border-color: var(--accent, #5559df); }
.p17-select { flex: 1 1 auto; min-width: 140px; }
.p17-input:disabled, .p17-select:disabled { opacity: 0.5; cursor: not-allowed; }
.p17-confirm-input-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border, #2e2e3e);
}
.p17-confirm-input-wrap .p17-input { width: 100%; box-sizing: border-box; }

.p17-btn {
  border: 1px solid var(--border, #2e2e3e);
  background: var(--surface-2, #14141e);
  color: var(--text, #e6e6f0);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.p17-btn:hover:not(:disabled) { filter: brightness(1.1); }
.p17-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.p17-btn-secondary { /* default */ }
.p17-btn-danger {
  background: #e44258;
  color: #fff;
  border-color: #e44258;
}
.p17-btn-danger:hover:not(:disabled) { background: #c93448; border-color: #c93448; }

/* Undo toast (bottom-center) */
.p17-toast-host {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 2100;
  pointer-events: none;
}
.p17-toast {
  pointer-events: auto;
  background: #14141e;
  color: #e6e6f0;
  border: 1px solid #2e2e3e;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
  font-size: 13px;
  animation: p17-toast-in 0.18s ease-out;
}
@keyframes p17-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.p17-toast-text { font-weight: 500; }
.p17-toast-undo {
  background: transparent;
  border: 1px solid #5559df;
  color: #8a8cf0;
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
}
.p17-toast-undo:hover:not(:disabled) { background: rgba(85,89,223,0.15); }
.p17-toast-undo:disabled { opacity: 0.5; cursor: not-allowed; }
.p17-toast-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.p17-toast-close:hover { color: #ccc; }
