/* ============================================================
   FONT FACES
   ============================================================ */
@font-face {
  font-family: 'MarkPro';
  src: url('Mark Pro/FontFont - MarkPro.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'MarkPro';
  src: url('Mark Pro/FontFont - MarkPro-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
}
@font-face {
  font-family: 'MarkPro';
  src: url('Mark Pro/FontFont - MarkPro-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: 'MarkPro';
  src: url('Mark Pro/FontFont - MarkPro-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
}
@font-face {
  font-family: 'MarkPro';
  src: url('Mark Pro/FontFont - MarkPro-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
}

/* ============================================================
   CSS CUSTOM PROPERTIES (THEME)
   ============================================================ */
:root {
  --bg-app: #F4F6F9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-header: #004A80;
  --text-primary: #41484F;
  --text-secondary: #666;
  --border-color: #E0E4E8;
  --shadow: 0 1px 4px rgba(0,0,0,0.1);
  --input-bg: #ffffff;
  --primary-blue: #004A80;
  --teal: #007CA0;
  --gray: #41484F;
  --red: #EF373E;
  --sidebar-width: 260px;
  --header-height: 60px;
}

[data-theme="dark"] {
  --bg-app: #0E1318;
  --bg-sidebar: #161C24;
  --bg-card: #1E262F;
  --bg-header: #0A1929;
  --text-primary: #E8EAED;
  --text-secondary: #9AA0A8;
  --border-color: #2D3748;
  --shadow: 0 1px 4px rgba(0,0,0,0.4);
  --input-bg: #252F3A;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'MarkPro', 'Segoe UI', Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.2s, color 0.2s;
}

/* ============================================================
   LAYOUT
   ============================================================ */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* HEADER */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--header-height);
  background-color: var(--bg-header);
  color: #ffffff;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #ffffff;
  padding: 6px;
  border-radius: 4px;
  transition: background-color 0.15s;
}

#hamburger-btn:hover {
  background-color: rgba(255,255,255,0.15);
}

#crestron-logo {
  height: 28px;
  width: auto;
  margin-right: 12px;
  flex-shrink: 0;
}

#app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
}

#app-title span {
  font-weight: 300;
  opacity: 0.85;
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* CONTENT WRAPPER */
#content-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: none;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.25s ease, background-color 0.2s;
  z-index: 50;
}

/* SIDEBAR RESIZE HANDLE */
#sidebar-resizer {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background-color: var(--border-color);
  transition: background-color 0.15s;
  z-index: 51;
  position: relative;
}

#sidebar-resizer:hover,
#sidebar-resizer.is-resizing {
  background-color: var(--teal);
}

/* Hide resizer on mobile where sidebar is an overlay */
@media (max-width: 768px) {
  #sidebar-resizer {
    display: none;
  }
}

#sidebar-nav {
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  transition: background-color 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background-color: rgba(0, 74, 128, 0.07);
  color: var(--primary-blue);
}

.nav-item.active {
  background-color: rgba(0, 74, 128, 0.1);
  color: var(--primary-blue);
  border-left-color: var(--primary-blue);
}

[data-theme="dark"] .nav-item:hover {
  background-color: rgba(0, 124, 160, 0.15);
  color: #5BB8D4;
}

[data-theme="dark"] .nav-item.active {
  background-color: rgba(0, 124, 160, 0.2);
  color: #5BB8D4;
  border-left-color: #5BB8D4;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

#sidebar-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 8px 16px;
}

#sidebar-groups-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

#groups-list {
  flex: 1;
  list-style: none;
}

.group-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13.5px;
  transition: background-color 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.group-nav-item:hover {
  background-color: rgba(0, 74, 128, 0.07);
}

.group-nav-item.active {
  background-color: rgba(0, 74, 128, 0.1);
  font-weight: 500;
}

[data-theme="dark"] .group-nav-item:hover {
  background-color: rgba(255,255,255,0.05);
}

[data-theme="dark"] .group-nav-item.active {
  background-color: rgba(0, 124, 160, 0.2);
}

.group-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.group-nav-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-item-count {
  font-size: 11px;
  color: var(--text-secondary);
  background-color: var(--bg-app);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}

[data-theme="dark"] .group-item-count {
  background-color: rgba(255,255,255,0.08);
}

.group-agile-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background-color: rgba(107, 63, 160, 0.15);
  color: #6B3FA0;
  flex-shrink: 0;
}

[data-theme="dark"] .group-agile-badge {
  background-color: rgba(107, 63, 160, 0.25);
  color: #b88fe0;
}

.btn-agile-active {
  background-color: rgba(107, 63, 160, 0.15);
  color: #6B3FA0;
  border: 1px solid rgba(107, 63, 160, 0.4);
}

.btn-agile-active:hover {
  background-color: rgba(107, 63, 160, 0.25);
}

[data-theme="dark"] .btn-agile-active {
  background-color: rgba(107, 63, 160, 0.25);
  color: #b88fe0;
  border-color: rgba(107, 63, 160, 0.5);
}

.list-item-agile-group {
  opacity: 0.9;
}

.list-item-agile-initiative {
  opacity: 0.9;
}

/* Invisible placeholder on non-collapsible rows — keeps color badge/name aligned */
.expand-toggle-placeholder {
  display: inline-block;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

/* Expand/collapse toggle — sits after the rank number in the flex row */
.expand-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}

.expand-toggle-btn:hover {
  background: var(--bg-hover, rgba(0,0,0,0.06));
  color: var(--text-primary);
}

[data-theme="dark"] .expand-toggle-btn:hover {
  background: rgba(255,255,255,0.08);
}

.expand-toggle-btn .chevron-icon {
  transition: transform 0.18s ease;
}

.expand-toggle-btn.is-expanded .chevron-icon {
  transform: rotate(180deg);
}

/* Sub-rows rendered inside expanded agile group/initiative rows */
.list-item-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 170px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-app);
  min-height: 46px;
  transition: background-color 0.12s;
}

.list-item-sub-row:last-child {
  border-bottom: none;
}

.list-item-sub-row:hover {
  background-color: rgba(0, 74, 128, 0.04);
}

[data-theme="dark"] .list-item-sub-row {
  background-color: rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .list-item-sub-row:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

#add-group-btn {
  margin: 10px 16px 16px;
}

/* MAIN CONTENT */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  transition: background-color 0.2s;
}

/* SIDEBAR OVERLAY (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.45);
  z-index: 40;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'MarkPro', 'Segoe UI', Arial, sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary-blue);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: #005A9E;
  box-shadow: 0 2px 8px rgba(0,74,128,0.35);
}

.btn-teal {
  background-color: var(--teal);
  color: #ffffff;
}

.btn-teal:hover:not(:disabled) {
  background-color: #00698A;
  box-shadow: 0 2px 8px rgba(0,124,160,0.35);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-app);
  border-color: var(--text-secondary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 10px;
}

.btn-ghost:hover:not(:disabled) {
  background-color: rgba(0,0,0,0.06);
  color: var(--text-primary);
}

[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background-color: rgba(255,255,255,0.08);
}

.btn-danger {
  background-color: transparent;
  color: var(--red);
  border: none;
  padding: 6px 10px;
}

.btn-danger:hover:not(:disabled) {
  background-color: rgba(239,55,62,0.1);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  border-radius: 5px;
}

/* Header Buttons */
.btn-header {
  background-color: rgba(255,255,255,0.15);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 7px 14px;
  font-size: 13px;
}

.btn-header:hover:not(:disabled) {
  background-color: rgba(255,255,255,0.25);
}

.btn-header-danger {
  background-color: rgba(239,55,62,0.2);
  border-color: rgba(239,55,62,0.4);
}

.btn-header-danger:hover:not(:disabled) {
  background-color: rgba(239,55,62,0.35);
  border-color: rgba(239,55,62,0.6);
}

/* ============================================================
   VIEW HEADINGS
   ============================================================ */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.view-title-input {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--primary-blue);
  outline: none;
  font-family: 'MarkPro', 'Segoe UI', Arial, sans-serif;
  padding-bottom: 2px;
  min-width: 120px;
  max-width: 400px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 8px;
  background-color: var(--primary-blue);
  color: #ffffff;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
}

.edit-title-btn {
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.edit-title-btn:hover {
  color: var(--primary-blue);
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transition: background-color 0.2s, border-color 0.2s;
}

/* ============================================================
   LIST ITEMS (SHARED)
   ============================================================ */
.list-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.12s;
  cursor: default;
  min-height: 62px;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item.item-released {
  opacity: 0.6;
}
.list-item.item-released .item-feature,
.list-item.item-released .item-subtitle {
  text-decoration: line-through;
  text-decoration-color: var(--text-secondary);
}

/* WSJF rank differs from current rank — red gradient scaled by distance.
   --rdi (rank diff intensity) is set inline: 0 = 1 position off, 1 = 20+ positions off.
   Opacity range: ~0.06 (barely visible) → ~0.50 (clearly red). */
.list-item.item-wsjf-rank-diff {
  background-color: rgba(239, 68, 68, calc(0.06 + var(--rdi, 0) * 0.44));
}

.list-item.item-wsjf-rank-diff:hover {
  background-color: rgba(239, 68, 68, calc(0.12 + var(--rdi, 0) * 0.44));
}

[data-theme="dark"] .list-item.item-wsjf-rank-diff {
  background-color: rgba(248, 113, 113, calc(0.06 + var(--rdi, 0) * 0.36));
}

[data-theme="dark"] .list-item.item-wsjf-rank-diff:hover {
  background-color: rgba(248, 113, 113, calc(0.12 + var(--rdi, 0) * 0.36));
}

/* WSJF rank column (secondary priority number shown when toggle is on) */
.wsjf-rank-col {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0 5px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* WSJF Rank toggle button — active state */
.toggle-wsjf-rank.active {
  background-color: var(--accent-blue-light, rgba(59,130,246,0.12));
  color: var(--accent-blue, #3B82F6);
  border-color: var(--accent-blue, #3B82F6);
}

[data-theme="dark"] .toggle-wsjf-rank.active {
  background-color: rgba(96,165,250,0.15);
  color: #60A5FA;
  border-color: #60A5FA;
}

.list-item.item-released .item-feature,
.list-item.item-released .item-subtitle {
  text-decoration: line-through;
  text-decoration-color: var(--text-secondary);
}

.list-item:hover {
  background-color: rgba(0,74,128,0.03);
}

[data-theme="dark"] .list-item:hover {
  background-color: rgba(255,255,255,0.03);
}

.list-item.sortable-ghost {
  opacity: 0.4;
  background-color: rgba(0,124,160,0.1);
}

.list-item.sortable-drag {
  background-color: var(--bg-card);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  border-radius: 8px;
}

/* DRAG HANDLE */
.drag-handle {
  cursor: grab;
  color: var(--text-secondary);
  opacity: 0.4;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 4px 2px;
  transition: opacity 0.15s;
}

.drag-handle:hover {
  opacity: 0.8;
}

.drag-handle:active {
  cursor: grabbing;
}

/* UP / DOWN REORDER BUTTONS */
.list-reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.list-move-btn {
  background: none;
  border: none;
  padding: 1px 3px;
  cursor: pointer;
  color: var(--text-secondary);
  opacity: 0.45;
  border-radius: 3px;
  display: flex;
  align-items: center;
  line-height: 1;
  transition: opacity 0.12s, background 0.12s;
}

.list-move-btn:hover {
  opacity: 1;
  background: rgba(0,124,160,0.1);
}

.list-move-btn:active {
  background: rgba(0,124,160,0.2);
}

/* Resolve list up/down buttons */
.resolve-reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.resolve-move-up,
.resolve-move-down {
  background: none;
  border: none;
  padding: 1px 3px;
  cursor: pointer;
  color: var(--text-secondary);
  opacity: 0.45;
  border-radius: 3px;
  display: flex;
  align-items: center;
  line-height: 1;
  transition: opacity 0.12s, background 0.12s;
}

.resolve-move-up:hover,
.resolve-move-down:hover {
  opacity: 1;
  background: rgba(0,124,160,0.1);
}

/* Disable boundary buttons via CSS — no JS needed */
.sortable-resolve-item:first-child .resolve-move-up,
.sortable-resolve-item:last-child .resolve-move-down {
  opacity: 0.15;
  pointer-events: none;
}

/* RANK NUMBER */
.rank-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.rank-num:not(.rank-num-inactive) {
  cursor: text;
  border-radius: 4px;
  padding: 1px 3px;
  transition: background 0.1s;
}
.rank-num:not(.rank-num-inactive):hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.rank-jump-input {
  width: 44px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--teal);
  border-radius: 4px;
  padding: 1px 4px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.rank-jump-input::-webkit-inner-spin-button,
.rank-jump-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* GROUP COLOR BADGE (master list) */
.group-color-badge {
  width: 4px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ITEM INFO */
.item-info {
  flex: 1;
  min-width: 0;
}

.item-feature {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.item-notes-preview {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-style: italic;
}

.initiative-notes-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  opacity: 0.7;
  cursor: default;
  flex-shrink: 0;
}

/* META COLUMNS */
.item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Status/type pill inside the flat meta row — fixed width so the WSJF
   badge always lines up regardless of label length ("Idea" vs "In Development"
   vs "Agile Initiative"). Width is sized to the widest label. */
.item-meta > .badge {
  min-width: 130px;
  justify-content: center;
}

.item-meta-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 80px;
}

.meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.meta-value {
  font-size: 12.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-status-idea {
  background-color: #B0BEC5;
  color: #37474F;
}

.badge-status-in-requirements {
  background-color: #41484F;
  color: #ffffff;
}

.badge-status-in-development {
  background-color: #007CA0;
  color: #ffffff;
}

.badge-status-in-beta {
  background-color: #E8A800;
  color: #3D2A00;
}

.badge-status-released {
  background-color: #2E8B57;
  color: #ffffff;
}

.badge-status-canceled {
  background-color: #6B3FA0;
  color: #ffffff;
}

.badge-bc-not-started {
  background-color: #9AA0A8;
  color: #ffffff;
}

.badge-bc-in-progress {
  background-color: #007CA0;
  color: #ffffff;
}

.badge-bc-approved {
  background-color: #2E8B57;
  color: #ffffff;
}

.badge-agile-project {
  background-color: #6B3FA0;
  color: #ffffff;
}

[data-theme="dark"] .badge-agile-project {
  background-color: rgba(107, 63, 160, 0.85);
}

.badge-agile-initiative {
  background-color: #2E7D9A;
  color: #ffffff;
}

[data-theme="dark"] .badge-agile-initiative {
  background-color: rgba(46, 125, 154, 0.85);
}

.badge-bc-not-applicable {
  background-color: #B0BEC5;
  color: #ffffff;
}

.badge-bc-rejected {
  background-color: #EF373E;
  color: #ffffff;
}

/* WSJF BADGE */
.wsjf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* WSJF color scale */
.wsjf-low    { background-color: #D1ECF1; color: #0C5460; }
.wsjf-medium { background-color: #B8DFF0; color: #004A80; }
.wsjf-high   { background-color: #007CA0; color: #ffffff; }
.wsjf-very-high { background-color: #004A80; color: #ffffff; }

[data-theme="dark"] .wsjf-low    { background-color: #1A3A42; color: #7ED6EA; }
[data-theme="dark"] .wsjf-medium { background-color: #0D3A52; color: #7EC8E8; }
[data-theme="dark"] .wsjf-high   { background-color: #007CA0; color: #ffffff; }
[data-theme="dark"] .wsjf-very-high { background-color: #1E4D80; color: #8BC4FF; }

/* ============================================================
   ITEM ACTIONS
   ============================================================ */
.item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 58px;
  opacity: 0;
  transition: opacity 0.15s;
}

.list-item:hover .item-actions {
  opacity: 1;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  color: var(--text-secondary);
  gap: 12px;
  text-align: center;
}

.empty-state svg {
  opacity: 0.3;
}

.empty-state p {
  font-size: 15px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
  overflow: hidden;
}

.modal-small {
  max-width: 400px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background-color 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
  background-color: rgba(0,0,0,0.06);
}

[data-theme="dark"] .modal-close:hover {
  background-color: rgba(255,255,255,0.08);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-footer-cancel {
  margin-right: auto;
}

/* FORM ELEMENTS */
.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.required-star {
  color: var(--red);
  margin-left: 2px;
}

.group-edits-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
}

.group-edit-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.group-edit-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--teal, #007CA0);
}

input[type="text"],
input[type="number"],
select,
textarea {
  font-family: 'MarkPro', 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  background-color: var(--input-bg);
  color: var(--text-primary);
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,124,160,0.15);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2341484F' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239AA0A8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 18px 0;
}

/* WSJF Preview */
.wsjf-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background-color: var(--bg-app);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-top: 6px;
}

.wsjf-scale-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

.wsjf-preview-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.wsjf-preview-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-blue);
}

[data-theme="dark"] .wsjf-preview-value {
  color: #5BB8D4;
}

/* COLOR PICKER */
.color-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

/* ============================================================
   SERVER DOWN OVERLAY
   ============================================================ */
#server-down-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

#server-down-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 48px 56px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  max-width: 380px;
}

#server-down-card svg {
  color: var(--text-secondary);
  opacity: 0.7;
}

#server-down-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

#server-down-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

#server-down-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-color);
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  min-width: 260px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastIn 0.25s ease;
  font-size: 13.5px;
  font-weight: 500;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(10px) scale(0.97); }
}

.toast.dismissing {
  animation: toastOut 0.2s ease forwards;
}

.toast-success {
  background-color: #1E4D2B;
  color: #C6EFD1;
  border-left: 4px solid #2E8B57;
}

.toast-error {
  background-color: #4D1010;
  color: #FFCDD2;
  border-left: 4px solid #EF373E;
}

.toast-info {
  background-color: #0A2A40;
  color: #B3D9F0;
  border-left: 4px solid #007CA0;
}

.toast-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-modal {
  max-width: 360px;
}

.confirm-message {
  font-size: 14.5px;
  color: var(--text-primary);
  line-height: 1.6;
  padding: 4px 0;
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-secondary);
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  #hamburger-btn {
    display: flex;
  }

  #sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar-overlay.visible {
    display: block;
  }

  #main-content {
    padding: 18px 16px;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .list-item {
    flex-wrap: wrap;
    padding: 12px 12px;
  }

  .item-meta {
    width: 100%;
    padding-left: 36px;
    margin-top: 6px;
    gap: 8px;
  }

  .item-meta-col {
    min-width: 70px;
  }

  .item-actions {
    opacity: 1;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   UTILITY
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.text-muted {
  color: var(--text-secondary);
}

.font-bold {
  font-weight: 700;
}

.gap-8 {
  gap: 8px;
}

/* ============================================================
   CONFLICT DIALOG
   ============================================================ */
.conflict-intro {
  margin-bottom: 16px;
  color: var(--text-primary);
  line-height: 1.5;
}

.conflict-group {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--bg-app);
}

.conflict-group:last-child {
  margin-bottom: 0;
}

.conflict-group-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text-primary);
}

/* New order list */
.conflict-new-order {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conflict-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid transparent;
  font-size: 13px;
  color: var(--text-primary);
}

.conflict-row-moved {
  background: rgba(0, 124, 160, 0.07);
  border-color: rgba(0, 124, 160, 0.2);
}

[data-theme="dark"] .conflict-row-moved {
  background: rgba(0, 124, 160, 0.14);
  border-color: rgba(0, 124, 160, 0.3);
}

.conflict-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}

.conflict-feature {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conflict-delta {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.conflict-delta-up {
  background: rgba(0, 160, 100, 0.12);
  color: #009955;
}

.conflict-delta-down {
  background: rgba(239, 55, 62, 0.1);
  color: #C62B30;
}

.conflict-delta-same {
  background: transparent;
  color: var(--text-secondary);
  font-weight: 400;
}

[data-theme="dark"] .conflict-delta-up   { background: rgba(0, 160, 100, 0.2);  color: #33CC88; }
[data-theme="dark"] .conflict-delta-down { background: rgba(239, 55, 62, 0.18); color: #F07075; }

/* ============================================================
   IMPORT PREVIEW
   ============================================================ */
.import-groups-list {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}

.import-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.import-group-row:last-child { border-bottom: none; }

.import-group-name { flex: 1; font-weight: 500; color: var(--text-primary); }

.import-group-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 10px;
}

.import-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(239,55,62,0.07);
  border: 1px solid rgba(239,55,62,0.2);
  color: var(--text-primary);
  border-radius: 7px;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.5;
}
.import-warning svg { flex-shrink: 0; color: #EF373E; margin-top: 1px; }

/* ============================================================
   USER WIDGET (header)
   ============================================================ */
#user-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 4px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.user-display-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
}

.user-role-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
}
.user-role-admin  { background: rgba(255,255,255,0.25); color: #fff; }
.user-role-editor { background: rgba(0,124,160,0.5);    color: #fff; }
.user-role-viewer { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); }

.header-logout-btn {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.header-logout-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

@media (max-width: 768px) {
  .user-display-name, .user-role-badge { display: none; }
}

/* ============================================================
   USERS MANAGEMENT VIEW
   ============================================================ */
#nav-users-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  margin: 0 8px 2px;
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
}
#nav-users-btn:hover {
  background: rgba(0,74,128,0.07);
  color: var(--text-primary);
}
#nav-users-btn.active {
  background: rgba(0,74,128,0.1);
  color: var(--primary-blue);
  font-weight: 700;
}
[data-theme="dark"] #nav-users-btn:hover  { background: rgba(255,255,255,0.07); }
[data-theme="dark"] #nav-users-btn.active { background: rgba(0,124,160,0.15); color: #7EC8E8; }

.users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}

.user-row-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.user-row-info {
  flex: 1;
  min-width: 0;
}

.user-row-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.user-row-group-edits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.group-edit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

.user-row-username {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.user-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.role-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
}
.role-badge-admin  { background: #004A80; color: #fff; }
.role-badge-editor { background: #007CA0; color: #fff; }
.role-badge-viewer { background: #E0E4E8; color: #41484F; }

[data-theme="dark"] .role-badge-viewer { background: #2D3748; color: #9AA0A8; }

.user-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.provider-badge {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 2px 7px;
  border-radius: 4px;
}

.user-you-tag {
  font-size: 10px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ── Import Validation Modals ───────────────────────────────────── */

/* Wider modal variant for side-by-side conflict options */
.modal-wide {
  max-width: 780px;
  width: calc(100vw - 32px);
}

/* Orphan assignment */
.orphan-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.orphan-row {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.orphan-row-invalid {
  border-color: #EF373E;
}

.orphan-item-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.orphan-item-initiative {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: -4px;
}

.orphan-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.orphan-controls select {
  flex: 1;
  min-width: 140px;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
}

.orphan-error {
  font-size: 12px;
  color: #EF373E;
  font-weight: 500;
}

/* Import conflict resolution */
.cf-blocks {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cf-block {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  background: var(--bg-app);
}

.cf-block .conflict-group-name {
  margin-bottom: 14px;
  font-size: 14px;
}

.cf-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 600px) {
  .cf-options { grid-template-columns: 1fr; }
}

.cf-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg-card);
}

.cf-option:hover {
  border-color: #007CA0;
}

.cf-option-selected {
  border-color: #007CA0;
  background: rgba(0, 124, 160, 0.05);
}

[data-theme="dark"] .cf-option-selected {
  border-color: #007CA0;
  background: rgba(0, 124, 160, 0.12);
}

.cf-option-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cf-option-header input[type="radio"] {
  flex-shrink: 0;
  accent-color: #007CA0;
}

.cf-option-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.cf-option-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cf-option-list .conflict-row {
  font-size: 12px;
  padding: 4px 8px;
}

.cf-option-list .conflict-rank {
  font-size: 10px;
  min-width: 14px;
}

.import-section-intro {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.5;
}

/* ── Clear All Modal ─────────────────────────────────────────── */
.clear-all-summary {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clear-all-summary li {
  font-size: 14px;
  color: var(--text-primary);
  padding: 8px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.clear-all-warning {
  font-size: 13px;
  font-weight: 700;
  color: #EF373E;
}

.clear-all-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  font-size: 15px;
  font-family: inherit;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.clear-all-input:focus {
  outline: none;
  border-color: #EF373E;
}

/* ============================================================
   GROUP TABS
   ============================================================ */
.group-tab-bar {
  display: flex;
  gap: 4px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
}

.group-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.group-tab:hover {
  background-color: rgba(0,0,0,0.06);
  color: var(--text-primary);
}

[data-theme="dark"] .group-tab:hover {
  background-color: rgba(255,255,255,0.08);
}

.group-tab.active {
  background-color: var(--bg-card);
  color: var(--primary-blue);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

[data-theme="dark"] .group-tab.active {
  background-color: var(--bg-sidebar);
  color: #5BB8D4;
}

/* ============================================================
   INITIATIVE SECTIONS
   ============================================================ */
.initiative-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.initiative-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 8px;
}

.initiative-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.initiative-drag-handle {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  opacity: 0.4;
  cursor: grab;
  flex-shrink: 0;
  padding: 2px;
  border-radius: 3px;
  transition: opacity 0.15s;
}

.initiative-drag-handle:hover {
  opacity: 1;
}

.initiative-drag-handle:active {
  cursor: grabbing;
}

.initiative-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.initiative-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.initiative-count {
  font-size: 11px;
  color: var(--text-secondary);
  background-color: var(--bg-card);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .initiative-count {
  background-color: rgba(255,255,255,0.08);
}

.initiative-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.initiative-items {
  padding: 0;
  min-height: 20px;
}

.initiative-items .list-item {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  box-shadow: none;
  border-bottom: 1px solid var(--border-color);
}

.initiative-items .list-item:last-child {
  border-bottom: none;
}

.initiative-empty {
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

.initiative-unassigned .initiative-header {
  background-color: transparent;
  border-bottom-color: var(--border-color);
}

/* ============================================================
   PRIORITY TAB
   ============================================================ */
.priority-tab-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding: 8px 12px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

/* ── Sticky header (title + filters) on all list views ──
   #main-content has padding-top: 28px, so the sticky "top" constraint is
   computed from the content box (inside the padding), not from the visible
   scroll edge. top: -28px shifts the constraint to the padding edge so the
   header covers the full visible area — no bleed-through gap. */
.list-sticky-header {
  position: sticky;
  top: -28px;
  z-index: 20;
  background: var(--bg-app);
  padding-top: 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  /* #main-content has padding-top: 18px on mobile */
  .list-sticky-header {
    top: -18px;
    padding-top: 18px;
  }
}

/* Tighten internal gaps so the sticky bar stays compact */
.list-sticky-header .view-header {
  margin-bottom: 10px;
}

.list-sticky-header .list-filter-bar {
  margin-bottom: 0;
}

.list-sticky-header .priority-tab-note {
  margin-bottom: 8px;
}

.list-sticky-header .master-group-filter-bar {
  margin-bottom: 8px;
}


.list-filter-bar {
  margin-bottom: 10px;
}

/* ── Master list group filter chips ── */
.master-group-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.master-group-filter-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.master-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.master-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.master-group-chip:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.master-group-chip.active {
  border-color: var(--chip-color, var(--primary-blue));
  color: var(--chip-color, var(--primary-blue));
  background-color: var(--bg-app);
  font-weight: 500;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── View-controls row (buttons + inputs in master list header) ── */
.view-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Master list top-N per group control ── */
.top-n-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}

.top-n-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.top-n-input {
  padding: 3px 4px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.top-n-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-blue) 20%, transparent);
}

.list-filter-input {
  width: 100%;
  max-width: 340px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.list-filter-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(0, 74, 128, 0.12);
}

.list-filter-input::placeholder {
  color: var(--text-secondary);
}

.initiative-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1.5px solid;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ============================================================
   CONFLICT RESOLUTION MODAL
   ============================================================ */
.modal-conflict .modal-body {
  padding: 0 24px 8px;
}

/* ============================================================
   INTERACTIVE RESOLVE LIST
   ============================================================ */
.modal-resolve {
  max-width: 560px;
}

.resolve-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.resolve-list-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.btn-text {
  background: none;
  border: none;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--teal);
  cursor: pointer;
  border-radius: 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-text:hover {
  background: rgba(0,124,160,0.08);
}

.sortable-resolve-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 380px;
  overflow-y: auto;
  margin-bottom: 4px;
}

.sortable-resolve-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: default;
  user-select: none;
}

.sortable-resolve-item.sortable-ghost {
  opacity: 0.4;
  background: rgba(0,124,160,0.08);
}

.sortable-resolve-handle {
  cursor: grab;
  color: var(--text-secondary);
  opacity: 0.5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.sortable-resolve-handle:hover {
  opacity: 1;
}

.sortable-resolve-handle:active {
  cursor: grabbing;
}

.sortable-resolve-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: right;
  flex-shrink: 0;
}

.sortable-resolve-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.sortable-resolve-init-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.resolve-was-rank {
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
  font-style: italic;
  opacity: 0.75;
}

.resolve-item-count {
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.resolve-hint {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
}

[data-theme="dark"] .sortable-resolve-item {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

.resolve-preview-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 380px;
  overflow-y: auto;
  margin-bottom: 4px;
}

.resolve-preview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  font-size: 13px;
  user-select: none;
}

[data-theme="dark"] .resolve-preview-item {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

/* ── Master placement picker modal ──────────────────────────── */

.modal-picker {
  max-width: 560px;
}

.master-picker-list-wrap {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.master-picker-list {
  display: flex;
  flex-direction: column;
}

.master-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.master-picker-item:last-child {
  border-bottom: none;
}

.master-picker-group-item {
  background: rgba(0,124,160,0.06);
  user-select: none;
  cursor: default;
}

.master-picker-group-item.master-picker-moving {
  background: rgba(0,124,160,0.13);
  border-left: 3px solid var(--teal);
  padding-left: 7px;
}

.master-picker-anchor-item {
  background: transparent;
  opacity: 0.5;
}

.master-picker-rank {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 24px;
  flex-shrink: 0;
  text-align: right;
}

.master-picker-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.master-picker-group-tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(0,124,160,0.15);
  color: var(--teal);
  flex-shrink: 0;
}

.master-picker-anchor-tag {
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
  font-style: italic;
}

.master-picker-legend {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgba(0,124,160,0.15);
  border: 1px solid var(--teal);
  vertical-align: middle;
  margin: 0 2px;
}

[data-theme="dark"] .master-picker-group-item {
  background: rgba(76,201,224,0.08);
}

[data-theme="dark"] .master-picker-group-item.master-picker-moving {
  background: rgba(76,201,224,0.15);
  border-left-color: #4cc9e0;
}

[data-theme="dark"] .master-picker-group-tag {
  background: rgba(76,201,224,0.15);
  color: #4cc9e0;
}

[data-theme="dark"] .master-picker-legend {
  background: rgba(76,201,224,0.15);
  border-color: #4cc9e0;
}

[data-theme="dark"] .btn-text {
  color: #4cc9e0;
}

[data-theme="dark"] .btn-text:hover {
  background: rgba(76,201,224,0.1);
}

.conflict-choose-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.conflict-compare {
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  gap: 0;
  align-items: start;
  margin-bottom: 16px;
}

.conflict-compare-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conflict-compare-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.conflict-compare-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 28px;
  color: var(--text-secondary);
  font-size: 20px;
}

.conflict-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--bg-app);
  font-size: 13px;
  color: var(--text-primary);
  border: 1px solid transparent;
}

.conflict-item-highlight {
  border-color: var(--teal);
  background: rgba(0, 124, 160, 0.07);
}

.conflict-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 18px;
  text-align: right;
}

.conflict-feature {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conflict-initiative-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(0, 74, 128, 0.1);
  color: var(--primary-blue);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   INITIATIVE IMPACT MODAL
   ============================================================ */
.impact-changes-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.impact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--bg-app);
  font-size: 13px;
}

.impact-row-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.impact-feature {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.impact-init-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(0, 74, 128, 0.1);
  color: var(--primary-blue);
  white-space: nowrap;
  flex-shrink: 0;
}

.impact-rank-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.impact-up {
  color: #2e7d32;
}

.impact-up::before {
  content: '▲ ';
}

.impact-down {
  color: #c62828;
}

.impact-down::before {
  content: '▼ ';
}

.impact-no-change {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  padding: 8px 0;
}

.impact-master-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(0, 74, 128, 0.07);
  border: 1px solid rgba(0, 74, 128, 0.18);
  font-size: 12px;
  color: var(--primary-blue);
  margin-bottom: 14px;
}

.impact-more {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  padding: 4px 8px;
}

[data-theme="dark"] .conflict-item {
  background: rgba(255,255,255,0.05);
}

[data-theme="dark"] .conflict-item-highlight {
  background: rgba(0, 124, 160, 0.15);
}

[data-theme="dark"] .conflict-initiative-badge,
[data-theme="dark"] .impact-init-badge {
  background: rgba(100, 160, 220, 0.15);
  color: #7aadff;
}

[data-theme="dark"] .impact-row {
  background: rgba(255,255,255,0.05);
}

[data-theme="dark"] .impact-master-note {
  background: rgba(100, 160, 220, 0.1);
  border-color: rgba(100, 160, 220, 0.25);
  color: #7aadff;
}

/* ============================================================
   ROLE-BASED ACCESS (viewer = read-only)
   ============================================================ */
[data-readonly] .item-actions,
[data-readonly] #add-group-btn,
[data-readonly] .initiative-actions,
[data-readonly] #clear-all-btn,
[data-readonly] #import-btn,
[data-readonly] .view-header .btn-teal,
[data-readonly] .view-header .btn-primary {
  display: none !important;
}

[data-readonly] .drag-handle,
[data-readonly] .initiative-drag-handle {
  pointer-events: none !important;
  opacity: 0.15 !important;
  cursor: default !important;
}

[data-readonly] .list-reorder-btns,
[data-readonly] .section-reorder-btns {
  display: none !important;
}

/* Nav users button */
#nav-users {
  padding: 0 8px 8px;
}

#nav-users-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
#nav-users-btn:hover {
  background: rgba(0,74,128,0.07);
  color: var(--text-primary);
}
#nav-users-btn.active {
  background: rgba(0,74,128,0.1);
  color: var(--primary-blue);
  font-weight: 700;
}
[data-theme="dark"] #nav-users-btn:hover  { background: rgba(255,255,255,0.07); }
[data-theme="dark"] #nav-users-btn.active { background: rgba(0,124,160,0.15); color: #7EC8E8; }

/* ============================================================
   BASELINE
   ============================================================ */

/* Rank placeholder for post-baseline Released/Canceled rows */
.rank-num-inactive {
  width: 28px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
}

/* Post-baseline Released in-place */
.list-item.item-post-baseline-released {
  opacity: 0.55;
  border-left: 3px solid #2E8B57;
}
.list-item.item-post-baseline-released .item-feature,
.list-item.item-post-baseline-released .item-subtitle {
  text-decoration: line-through;
  text-decoration-color: var(--text-secondary);
}

/* Post-baseline Canceled in-place */
.list-item.item-post-baseline-canceled {
  opacity: 0.55;
  border-left: 3px solid #6B3FA0;
}
.list-item.item-post-baseline-canceled .item-feature,
.list-item.item-post-baseline-canceled .item-subtitle {
  text-decoration: line-through;
  text-decoration-color: var(--text-secondary);
}

/* Baseline change indicator badges */
.baseline-new-badge {
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  background: #007CA0;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.baseline-moved-up {
  font-size: 10px;
  font-weight: 600;
  color: #2E8B57;
  background: rgba(46, 139, 87, 0.1);
  border: 1px solid rgba(46, 139, 87, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.baseline-moved-down {
  font-size: 10px;
  font-weight: 600;
  color: #C75B39;
  background: rgba(199, 91, 57, 0.1);
  border: 1px solid rgba(199, 91, 57, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .baseline-moved-up   { color: #4CAF85; background: rgba(76,175,133,0.12); border-color: rgba(76,175,133,0.3); }
[data-theme="dark"] .baseline-moved-down { color: #E07A5F; background: rgba(224,122,95,0.12); border-color: rgba(224,122,95,0.3); }

/* Completed / Canceled bucket sections at bottom of group view */
.bucket-section {
  margin-top: 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.bucket-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bucket-section-header:hover {
  background: rgba(0,0,0,0.04);
}
[data-theme="dark"] .bucket-section-header:hover { background: rgba(255,255,255,0.04); }

.bucket-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--border-color);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 1px 7px;
}

.bucket-chevron {
  margin-left: auto;
  transition: transform 0.2s;
  color: var(--text-secondary);
}

.bucket-section.collapsed .bucket-chevron {
  transform: rotate(-90deg);
}

.bucket-section.collapsed .bucket-items {
  display: none;
}

.bucket-items {
  border-top: 1px solid var(--border-color);
}

.bucket-items .list-item {
  border-radius: 0;
  border-left: none;
  border-bottom: 1px solid var(--border-color);
  opacity: 0.65;
  cursor: default;
}

.bucket-items .list-item:last-child {
  border-bottom: none;
}

.bucket-items .list-item .item-feature {
  text-decoration: line-through;
  text-decoration-color: var(--text-secondary);
}

/* canBaseline permission badge in user management */
.baseline-perm-badge {
  font-size: 10px;
  font-weight: 600;
  color: #007CA0;
  background: rgba(0,124,160,0.1);
  border: 1px solid rgba(0,124,160,0.25);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

[data-theme="dark"] .baseline-perm-badge { color: #7EC8E8; background: rgba(0,124,160,0.15); border-color: rgba(0,124,160,0.3); }

/* ============================================================
   BASELINE VIEW MODE
   ============================================================ */

/* Hide drag handles, reorder buttons, and editing controls in baseline view */
[data-baseline-view] .drag-handle,
[data-baseline-view] .move-up,
[data-baseline-view] .move-down,
[data-baseline-view] .item-actions,
[data-baseline-view] .initiative-drag-handle,
[data-baseline-view] .initiative-actions,
[data-baseline-view] .edit-title-btn,
[data-baseline-view] #add-group-btn,
[data-baseline-view] #baseline-btn,
[data-baseline-view] #clear-all-btn { display: none !important; }

/* Read-only banner */
.baseline-view-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 74, 128, 0.08);
  border-bottom: 1px solid rgba(0, 74, 128, 0.18);
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  color: var(--primary-blue);
  flex-wrap: wrap;
  margin-bottom: 0;
}

[data-theme="dark"] .baseline-view-banner {
  background: rgba(0, 124, 160, 0.12);
  border-bottom-color: rgba(0, 124, 160, 0.25);
  color: #7EC8E8;
}

.baseline-view-label {
  font-weight: 600;
  flex-shrink: 0;
}

.baseline-view-name {
  font-weight: 700;
  flex-shrink: 0;
}

.baseline-view-date {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.baseline-view-readonly {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  background: #C75B39;
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

[data-theme="dark"] .baseline-view-readonly {
  background: #C75B39;
}

/* Sidebar baselines section */
.baselines-nav-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px 0;
}

.baseline-nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
  color: var(--text-secondary);
  font-size: 12px;
  margin: 1px 8px;
}

.baseline-nav-item:hover {
  background: rgba(0, 74, 128, 0.07);
  color: var(--text-primary);
}

[data-theme="dark"] .baseline-nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.baseline-delete-btn {
  display: none;
  background: none;
  border: none;
  padding: 2px 3px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 4px;
  line-height: 0;
  flex-shrink: 0;
  opacity: 0.6;
}

.baseline-nav-item:hover .baseline-delete-btn {
  display: flex;
  align-items: center;
}

.baseline-nav-item:hover .baseline-comparing-badge {
  display: none;
}

.baseline-delete-btn:hover {
  color: var(--red);
  background: rgba(239, 55, 62, 0.1);
  opacity: 1;
}

.baseline-nav-item--active {
  background: rgba(0, 74, 128, 0.06);
}
[data-theme="dark"] .baseline-nav-item--active {
  background: rgba(255, 255, 255, 0.05);
}

.baseline-comparing-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent-blue, #004A80);
  background: rgba(0, 74, 128, 0.12);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .baseline-comparing-badge {
  color: #7ab4d8;
  background: rgba(122, 180, 216, 0.15);
}

.baseline-nav-name {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.baseline-nav-date {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Export XLSX baseline picker modal */
.export-baseline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.export-baseline-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.export-baseline-option:last-child {
  border-bottom: none;
}

.export-baseline-option:hover {
  background: rgba(0, 74, 128, 0.07);
}

[data-theme="dark"] .export-baseline-option:hover {
  background: rgba(255, 255, 255, 0.07);
}

.export-baseline-name {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.export-baseline-date {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Revert button in baseline view banner */
.baseline-revert-btn {
  margin-left: 12px;
  background: var(--primary-blue);
  color: #fff;
  border: none;
  font-size: 12px;
  padding: 4px 12px;
}

.baseline-revert-btn:hover:not(:disabled) {
  background: #005a8e;
  color: #fff;
}

[data-theme="dark"] .baseline-revert-btn { background: #007CA0; }
[data-theme="dark"] .baseline-revert-btn:hover:not(:disabled) { background: #006080; }

/* ===== JIRA INTEGRATION ===== */

.btn-jira {
  background: #0052CC;
  color: #fff;
  border: none;
}
.btn-jira:hover:not(:disabled) {
  background: #0747A6;
  color: #fff;
}
.btn-jira:disabled { opacity: 0.5; cursor: not-allowed; }
[data-theme="dark"] .btn-jira           { background: #0065FF; }
[data-theme="dark"] .btn-jira:hover:not(:disabled) { background: #0052CC; }

/* Jira linked-issue badge on initiative rows */
.jira-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #0052CC;
  background: #DEEBFF;
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .jira-badge { color: #4C9AFF; background: rgba(76,154,255,.15); }

/* Import modal list */
.jira-import-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
}

.jira-import-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.1s;
}
.jira-import-row:hover { background: var(--hover-bg); }
.jira-import-row input[type=checkbox] { flex-shrink: 0; }

.jira-import-row--done {
  opacity: 0.5;
  cursor: default;
  background: var(--bg-secondary);
}
.jira-import-row--done:hover { background: var(--bg-secondary); }

.jira-import-key {
  font-size: 11px;
  font-weight: 600;
  color: #0052CC;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .jira-import-key { color: #4C9AFF; }

.jira-import-rank {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  width: 20px;
  text-align: right;
  flex-shrink: 0;
}

.jira-import-summary {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jira-import-status {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.jira-import-status--autolink {
  color: #0052CC;
  font-weight: 600;
}
[data-theme="dark"] .jira-import-status--autolink { color: #4C9AFF; }

.jira-import-spinner {
  text-align: center;
  padding: 32px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Audit trail modal ──────────────────────────────────────── */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.audit-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--border);
}
.audit-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle, var(--border));
  vertical-align: middle;
}
.audit-table tbody tr:last-child td { border-bottom: none; }
.audit-col-date { color: var(--text-secondary); white-space: nowrap; }
.audit-col-user { font-weight: 500; }
.audit-col-rank { font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-moved-up   { color: #2E8B57; font-weight: 700; margin-left: 4px; }
.audit-moved-down { color: #C75B39; font-weight: 700; margin-left: 4px; }
[data-theme="dark"] .audit-moved-up   { color: #5acc8a; }
[data-theme="dark"] .audit-moved-down { color: #f08060; }
