/* ========================================
   DESIGN WORKSTREAMS — PROJECT BOARD
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root, [data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fb;
  --bg-tertiary: #f1f3f5;
  --bg-hover: #f1f3f5;
  --bg-elevated: #ffffff;

  --text-primary: #111827;
  --text-secondary: #5f6b7a;
  --text-tertiary: #9ca3af;

  --border-color: #e8ecf0;
  --border-color-strong: #d1d5db;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-bg: #eef2ff;
  --accent-text: #4338ca;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg-primary: #0d1017;
  --bg-secondary: #141820;
  --bg-tertiary: #1c2030;
  --bg-hover: #222738;
  --bg-elevated: #1a1f2e;

  --text-primary: #e8ecf0;
  --text-secondary: #8b95a5;
  --text-tertiary: #5a6372;

  --border-color: #252a3a;
  --border-color-strong: #333a4d;

  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-bg: rgba(99,102,241,0.12);
  --accent-text: #a5b4fc;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.35), 0 2px 4px -2px rgba(0,0,0,0.25);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3);

  color-scheme: dark;
}

html {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background: var(--bg-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ========================================
   HEADER
   ======================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

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

.app-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.app-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.app-title[contenteditable="true"] {
  cursor: text;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: var(--radius-sm);
}
.app-title[contenteditable="true"]:hover {
  background: var(--bg-hover);
}
.app-title[contenteditable="true"]:focus {
  outline: none;
  background: var(--bg-hover);
}

.workstream-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 999px;
}

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

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color-strong);
}

.header-data-btn {
  width: auto;
  padding: 0 10px;
  font-size: 13px;
}

/* Theme toggle icon visibility */
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ========================================
   TOOLBAR
   ======================================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* View Toggle */
.view-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}
.view-btn:hover {
  color: var(--text-primary);
}
.view-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* Search */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input {
  width: 240px;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s ease;
  outline: none;
}
.search-input::placeholder {
  color: var(--text-tertiary);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.search-shortcut {
  position: absolute;
  right: 8px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  line-height: 1.4;
  pointer-events: none;
}

/* Filter selects */
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 30px 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.filter-select:hover {
  border-color: var(--border-color-strong);
  color: var(--text-primary);
}
.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.filter-select.active-filter {
  border-color: var(--accent);
  color: var(--accent-text);
  background-color: var(--accent-bg);
}

.sort-select {
  border-left: 2px solid var(--border-color);
  padding-left: 14px;
  margin-left: 6px;
}

/* ========================================
   STATS BAR
   ======================================== */
/* Hide filters and stats bar */
.filter-group,
#sort-by.sort-select,
.stats-bar {
  display: none !important;
}

.stats-bar {
  display: flex;
  gap: 6px;
  padding: 16px 32px;
  flex-wrap: wrap;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

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

.stat-count {
  font-weight: 650;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ========================================
   CONTENT AREA
   ======================================== */
.content {
  padding: 0 32px 96px; /* extra bottom so last row isn't covered by FAB */
}

/* ========================================
   TABLE VIEW
   ======================================== */
.table-container {
  margin-top: 4px;
}

.track-group {
  margin-bottom: 8px;
}

.track-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 8px;
  position: sticky;
  top: 65px;
  background: var(--bg-primary);
  z-index: 10;
}

.track-color-bar {
  width: 3px;
  height: 18px;
  border-radius: 2px;
  flex-shrink: 0;
}

.track-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.track-name-icon {
  margin-right: 4px;
}
.track-name-editable {
  cursor: text;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: var(--radius-sm);
}
.track-name-editable:hover {
  background: var(--bg-hover);
}
.track-name-editable:focus {
  outline: none;
  background: var(--bg-hover);
}

.track-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 1px 7px;
  border-radius: 999px;
}

/* Table header — same 9 columns as table-row so headers align */
.table-header {
  display: grid;
  grid-template-columns: 28px 120px minmax(180px, 2fr) minmax(260px, 2.5fr) 56px 110px 110px minmax(140px, 220px);
  gap: 12px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.drag-handle-spacer {
  cursor: default !important;
}

.table-header-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}
.table-header-cell:hover {
  color: var(--text-primary);
}
.table-header-cell.sorted {
  color: var(--accent-text);
}

.sort-arrow {
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  font-size: 10px;
}
.table-header-cell:hover .sort-arrow {
  opacity: 0.5;
}
.table-header-cell.sorted .sort-arrow {
  opacity: 1;
}
.sort-arrow.desc {
  transform: rotate(180deg);
}
.table-header-cell-left {
  justify-content: flex-start;
  text-align: left;
}
.table-header-cell-nowrap {
  white-space: nowrap;
  min-width: 0;
}

/* Table row */
.table-row {
  display: grid;
  grid-template-columns: 28px 120px minmax(180px, 2fr) minmax(260px, 2.5fr) 56px 110px 110px minmax(140px, 220px);
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  align-items: center;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
  animation: fadeInRow 0.3s ease forwards;
  opacity: 0;
  cursor: default;
}
.table-row:hover {
  background: var(--bg-hover);
}

/* Add new row at bottom of each section */
.table-row-add-new {
  display: grid;
  grid-template-columns: 28px 120px minmax(180px, 2fr) minmax(260px, 2.5fr) 56px 110px 110px minmax(140px, 220px);
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  align-items: center;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 13px;
  transition: background-color 0.15s ease, color 0.15s ease;
  margin-top: 2px;
}
.table-row-add-new:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.table-row-add-new-label {
  grid-column: 1 / -1;
}

/* Inline add row */
.table-row-add {
  display: grid;
  grid-template-columns: 28px 120px minmax(180px, 2fr) minmax(260px, 2.5fr) 56px 110px 110px minmax(140px, 220px);
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  margin-bottom: 4px;
}
.table-row-add .add-cell {
  min-width: 0;
}
.table-row-add .add-input,
.table-row-add .add-select {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
}
.table-row-add .add-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.table-row-add .add-btn-cancel,
.table-row-add .add-btn-save {
  padding: 6px 12px;
  font-size: 13px;
}

/* Inline edit row (same layout as add row) */
.table-row-edit {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  cursor: default;
  opacity: 1;
  animation: none;
}
.table-row-edit .add-cell,
.table-row-edit .add-input,
.table-row-edit .add-select {
  min-width: 0;
}
.table-row-edit .add-input,
.table-row-edit .add-select {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
}
.table-row-edit .add-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.table-row-edit .edit-btn-cancel,
.table-row-edit .edit-btn-save {
  padding: 6px 12px;
  font-size: 13px;
}

/* Table row clickable to edit */
.table-row:not(.table-row-edit) {
  cursor: pointer;
}

/* Drag handle */
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: grab;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  padding: 4px 2px;
  border-radius: var(--radius-xs);
}
.table-row:hover .drag-handle {
  opacity: 1;
}
.drag-handle:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.drag-handle:active {
  cursor: grabbing;
}

/* Delete button (shared) */
.delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}
.table-row:hover .delete-btn,
.kanban-card:hover .delete-btn {
  opacity: 1;
}
.delete-btn:hover {
  background: #fef2f2;
  color: #ef4444;
}
[data-theme="dark"] .delete-btn:hover {
  background: #3a1515;
  color: #f87171;
}
.delete-btn:active {
  transform: scale(0.9);
}

/* Table row delete - position at right edge */
.table-row {
  position: relative;
}
.table-row > .delete-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}
.table-row:hover > .delete-btn {
  opacity: 1;
}

/* Delete animation */
.table-row.deleting,
.kanban-card.deleting {
  animation: deleteSlide 0.3s ease forwards !important;
}

@keyframes deleteSlide {
  0% {
    opacity: 1;
    transform: translateX(0);
    max-height: 100px;
  }
  50% {
    opacity: 0;
    transform: translateX(30px);
    max-height: 100px;
  }
  100% {
    opacity: 0;
    transform: translateX(30px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    overflow: hidden;
  }
}

/* Dragging state - table row */
.table-row.dragging {
  opacity: 0.3 !important;
  transform: scale(0.98);
}

/* Ghost element for drag image */
.drag-ghost {
  position: fixed;
  top: -9999px;
  left: -9999px;
  background: var(--bg-elevated);
  border: 2px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 10px 16px;
  opacity: 0.95;
  z-index: 9999;
}

/* Sprint drop zone */
.sprint-drop-zone {
  min-height: 8px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  position: relative;
}

.sprint-drop-zone.drag-over {
  background: var(--accent-bg);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-md);
  padding: 4px;
}

.sprint-empty-drop {
  padding: 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.sprint-drop-zone.drag-over .sprint-empty-drop {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-bg);
}

/* Drop indicator line - table */
.drop-indicator {
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  margin: 2px 16px;
  position: relative;
  animation: pulseIndicator 1s ease infinite;
}
.drop-indicator::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.drop-indicator::after {
  content: '';
  position: absolute;
  right: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

@keyframes pulseIndicator {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes fadeInRow {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.table-row-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-row-description {
  min-width: 0;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  padding-right: 4px;
}

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

.workstream-name {
  font-weight: 550;
  color: var(--text-primary);
  font-size: 13.5px;
}

/* DRI */
.dri-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dri-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.dri-name {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  line-height: 1.4;
}

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

/* Priority badge */
.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Track label in table row */
.table-row-asset {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  cursor: pointer;
  padding-right: 16px;
}
.table-row-asset:hover {
  opacity: 0.85;
}

.row-asset-thumbnail {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.row-asset-thumbnail-video {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
}

.row-asset-thumbnail-icon {
  font-size: 10px;
  color: var(--text-tertiary);
}

.gallery-cell-add-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px dashed var(--border-color-strong);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 9px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.gallery-cell-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

/* Editable cells: click to edit one column */
.editable-cell {
  cursor: pointer;
  min-width: 0;
}
.editable-cell:hover {
  outline: none;
}
.editable-cell:focus-within {
  outline: none;
}

.cell-edit-input {
  width: 100%;
  min-width: 0;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
}
.cell-edit-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.table-row-track {
  display: flex;
  align-items: center;
  gap: 8px;
}

.track-label {
  font-size: 12px;
  font-weight: 550;
  color: var(--text-secondary);
}

/* Request type badges */
.type-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
}

/* Substep pills */
.substeps-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.substep-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.substep-empty {
  color: var(--text-tertiary);
  font-size: 12px;
}

.status-cell {
  display: flex;
  align-items: center;
  min-width: 0;
}

.figma-links-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.cell-links-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
  max-width: 280px;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.cell-links-edit-wrap .figma-link-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
}

.cell-links-edit-wrap .figma-link-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.cell-links-edit-wrap .figma-link-row .figma-link-name,
.cell-links-edit-wrap .figma-link-row .figma-link-url {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  font-size: 12px;
}

.cell-links-done {
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
}

.cell-links-done:hover {
  background: var(--bg-hover);
}
.figma-link,
.figma-link-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.figma-link {
  color: var(--accent);
  text-decoration: none;
}
.figma-link:hover {
  text-decoration: underline;
}
.figma-link-name {
  color: var(--text-secondary);
}

.figma-links-edit {
  margin-bottom: 8px;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.figma-link-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
  max-height: 120px;
  overflow-y: auto;
}
.figma-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.figma-link-row .figma-link-name,
.figma-link-row .figma-link-url {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
}
.figma-link-row .figma-link-remove {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.figma-link-row .figma-link-remove:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.figma-add-link-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.figma-add-link-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========================================
   KANBAN VIEW
   ======================================== */
.kanban-container {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  padding-bottom: 16px;
  min-height: 400px;
}

.kanban-column {
  flex: 0 0 280px;
  min-width: 280px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.kanban-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.kanban-column-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: default;
  transition: all 0.15s ease;
  animation: fadeInCard 0.3s ease forwards;
  opacity: 0;
  position: relative;
  overflow: hidden;
}

.kanban-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.kanban-card:hover {
  border-color: var(--border-color-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Inline add card */
.kanban-card-add {
  background: var(--bg-elevated);
  border: 1px dashed var(--border-color-strong);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 8px;
  cursor: default;
}
.kanban-card-add .add-card-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-card-add .add-card-input,
.kanban-card-add .add-card-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
}
.kanban-card-add .add-card-row {
  display: flex;
  gap: 8px;
}
.kanban-card-add .add-card-row .form-select {
  flex: 1;
  min-width: 0;
}
.kanban-card-add .add-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.kanban-card-add .add-btn-cancel,
.kanban-card-add .add-btn-save {
  padding: 6px 12px;
  font-size: 13px;
}

/* Inline edit card (same layout as add card) */
.kanban-card-edit {
  border: 1px dashed var(--border-color-strong);
  cursor: default;
  opacity: 1;
  animation: none;
}
.kanban-card-edit .add-card-input,
.kanban-card-edit .add-card-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
}
.kanban-card-edit .add-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.kanban-card-edit .edit-btn-cancel,
.kanban-card-edit .edit-btn-save {
  padding: 6px 12px;
  font-size: 13px;
}

/* Kanban card clickable to edit */
.kanban-card:not(.kanban-card-edit) {
  cursor: pointer;
}

/* Card drag handle */
.card-drag-handle {
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--text-tertiary);
  cursor: grab;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  padding: 4px;
  border-radius: var(--radius-xs);
  z-index: 2;
}
.kanban-card:hover .card-drag-handle {
  opacity: 1;
}
.card-drag-handle:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.card-drag-handle:active {
  cursor: grabbing;
}

/* Kanban card delete button */
.card-delete-btn {
  width: 24px;
  height: 24px;
}

/* Dragging state - kanban card */
.kanban-card.dragging {
  opacity: 0.3 !important;
  transform: scale(0.96);
  border-style: dashed;
}

/* Ghost element for kanban drag image */
.drag-ghost-card {
  position: fixed;
  top: -9999px;
  left: -9999px;
  background: var(--bg-elevated);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  opacity: 0.95;
  z-index: 9999;
}

/* Kanban column drag-over state */
.kanban-column.drag-over-column {
  background: var(--accent-bg);
  border-radius: var(--radius-lg);
  transition: background 0.2s ease;
}

.kanban-cards.drag-over {
  min-height: 60px;
}

.kanban-cards.drag-over .kanban-empty {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-bg);
}

/* Drop indicator line - kanban */
.drop-indicator-kanban {
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 4px 8px;
  position: relative;
  animation: pulseIndicator 1s ease infinite;
}
.drop-indicator-kanban::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -2.5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.drop-indicator-kanban::after {
  content: '';
  position: absolute;
  right: -3px;
  top: -2.5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

@keyframes fadeInCard {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.card-track {
  font-size: 11px;
  font-weight: 550;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-dri {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-dri-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.card-dri-name {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.card-dates {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 450;
}

.card-sprint-pill {
  font-size: 11px;
  font-weight: 550;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card-types {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.card-type-pill {
  font-size: 11px;
  font-weight: 550;
}

.card-substeps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.card-substep {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.card-figma-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.card-figma-link,
.card-figma-link-name {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
}
.card-figma-link:hover {
  text-decoration: underline;
}
.card-figma-link-name {
  color: var(--text-secondary);
}

/* Empty column */
.kanban-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  gap: 12px;
  text-align: center;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-desc {
  font-size: 13px;
  color: var(--text-tertiary);
}

.btn-reset {
  margin-top: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.btn-reset:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
}

/* ========================================
   FAB (FLOATING ACTION BUTTON)
   ======================================== */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35), 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  z-index: 200;
  letter-spacing: -0.01em;
}
.fab:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45), 0 4px 10px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}
.fab:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.fab svg {
  flex-shrink: 0;
}
.fab-label {
  white-space: nowrap;
}

/* ========================================
   DELETE TOASTER (Redo)
   ======================================== */
.toaster {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.03);
  font-size: 14px;
  z-index: 180;
  animation: toasterIn 0.25s ease;
}

@keyframes toasterIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

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

.toaster-redo {
  padding: 6px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.toaster-redo:hover {
  background: var(--accent-hover);
}

.toaster-redo:active {
  transform: scale(0.98);
}

/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInOverlay 0.2s ease;
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

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

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 20px 60px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideInModal 0.25s ease;
}

[data-theme="dark"] .modal {
  box-shadow: var(--shadow-lg), 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ========================================
   GALLERY PANEL (right-side demo assets)
   ======================================== */
.gallery-panel-container {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.2s ease;
}
.gallery-panel-container.gallery-open {
  pointer-events: auto;
  visibility: visible;
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  cursor: pointer;
}

.gallery-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40%;
  max-width: 520px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  pointer-events: auto;
}
.gallery-panel-container.gallery-open .gallery-panel {
  transform: translateX(0);
}
[data-theme="dark"] .gallery-panel {
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

.gallery-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.gallery-panel-header-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.gallery-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.gallery-panel-description {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.gallery-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.gallery-header-upload-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.gallery-header-upload-btn:hover {
  background: var(--bg-hover);
}
.gallery-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.gallery-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.gallery-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 120px;
  border: 2px dashed transparent;
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.gallery-drop-zone.gallery-drop-active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.gallery-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
  text-align: center;
}
.gallery-empty-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}
.gallery-empty-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
}
.gallery-upload-btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.gallery-upload-btn:hover {
  opacity: 0.9;
}

.gallery-focus {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  min-height: 160px;
  background: #000000;
}
.gallery-asset-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  z-index: 2;
}
.gallery-asset-delete:hover {
  background: rgba(220, 38, 38, 0.9);
}
.gallery-media {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}
.gallery-video {
  width: 100%;
  background: #000000;
}
.gallery-panel-description-edit {
  margin-bottom: 16px;
}
.gallery-panel-description-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.gallery-panel-description-input {
  width: 100%;
  min-height: 56px;
  max-height: 280px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: none;
  overflow-y: auto;
  box-sizing: border-box;
}
.gallery-panel-description-input::placeholder {
  color: var(--text-tertiary);
}
.gallery-panel-description-input:focus {
  outline: none;
  border-color: var(--accent-color);
}
.gallery-description-save {
  margin-top: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--accent-color);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.gallery-description-save:hover {
  opacity: 0.9;
}
.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.gallery-prev,
.gallery-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.gallery-prev:hover:not(:disabled),
.gallery-next:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-tertiary);
}
.gallery-prev:disabled,
.gallery-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.gallery-counter {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Form */
#form-add {
  padding: 20px 24px 24px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-full {
  flex: 1 1 100%;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.required {
  color: #ef4444;
}

.form-input {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
}
.form-input::placeholder {
  color: var(--text-tertiary);
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.btn-cancel {
  padding: 9px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-cancel:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color-strong);
}

.btn-submit {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-submit:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-submit:active {
  transform: scale(0.97);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1100px) {
  .app-header, .toolbar, .stats-bar, .content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .table-header,
  .table-row,
  .table-row-add,
  .table-row-add-new {
    grid-template-columns: 24px 100px minmax(140px, 2fr) minmax(200px, 2fr) 52px 100px 100px minmax(120px, 180px);
    gap: 8px;
  }
}

@media (max-width: 860px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-left, .toolbar-right {
    width: 100%;
  }
  .toolbar-right {
    justify-content: flex-start;
  }
  .filter-group {
    flex-wrap: wrap;
  }
  .search-input {
    width: 100%;
  }
  .sort-select {
    border-left: none;
    margin-left: 0;
    padding-left: 10px;
  }
}

@media (max-width: 700px) {
  .app-header {
    padding: 12px 16px;
  }
  .toolbar, .stats-bar, .content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .table-header {
    display: none;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
  }

  .kanban-column {
    flex: 0 0 260px;
    min-width: 260px;
  }

  .stats-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  /* FAB responsive */
  .fab {
    bottom: 20px;
    right: 20px;
    padding: 12px 18px;
    font-size: 13px;
  }

  /* Modal responsive */
  .modal {
    width: 95%;
    max-height: 85vh;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .modal-header {
    padding: 16px 20px 0;
  }

  #form-add {
    padding: 16px 20px 20px;
  }
}
