/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
  user-select: none;
  font-family: var(--font-sans);
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--brand-500);
  color: white;
  border-color: var(--brand-500);
}
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover { background: var(--border-subtle); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: rgba(188,80,75,0.3);
}
.btn-danger:hover { background: rgba(188,80,75,0.25); }

.btn-sm {
  padding: 4px 10px;
  font-size: var(--text-xs);
}
.btn-sm svg { width: 13px; height: 13px; }

.btn-lg {
  padding: 10px 20px;
  font-size: var(--text-base);
}

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

/* ── CARD ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { color: var(--text-muted); }

/* ── KPI CARD ── */
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.kpi-card:hover { border-color: var(--border-default); }

.kpi-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-label svg { color: var(--text-muted); }

.kpi-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-delta {
  font-size: var(--text-xs);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 3px;
}

.kpi-delta.positive { color: var(--success-fg); }
.kpi-delta.negative { color: var(--danger-fg); }
.kpi-delta.neutral  { color: var(--text-muted); }

.kpi-bar {
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.kpi-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-priority-critical { background: rgba(216,110,106,0.15); color: var(--priority-critical); }
.badge-priority-high     { background: rgba(232,120,90,0.15);  color: var(--priority-high); }
.badge-priority-medium   { background: rgba(201,168,76,0.15);  color: var(--priority-medium); }
.badge-priority-low      { background: rgba(127,185,138,0.15); color: var(--priority-low); }

.badge-status-backlog    { background: rgba(94,95,101,0.2);   color: var(--text-muted); }
.badge-status-pending    { background: var(--info-bg);        color: var(--info-fg); }
.badge-status-in_progress{ background: rgba(232,120,90,0.15); color: var(--brand-400); }
.badge-status-review     { background: var(--warning-bg);     color: var(--warning-fg); }
.badge-status-done       { background: var(--success-bg);     color: var(--success-fg); }
.badge-status-blocked    { background: var(--danger-bg);      color: var(--danger-fg); }

/* ── AVATAR ── */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  position: relative;
}

.avatar-lg { width: 40px; height: 40px; font-size: 15px; }
.avatar-xl { width: 56px; height: 56px; font-size: 20px; }

.avatar-online::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 7px;
  height: 7px;
  background: var(--success-fg);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

/* ── PROGRESS BAR ── */
.progress {
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.progress-md { height: 6px; border-radius: 3px; }
.progress-lg { height: 8px; border-radius: 4px; }

/* ── TABLE ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--text-primary); }

thead th .sort-icon { display: inline-block; margin-left: 4px; opacity: 0.4; }
thead th.asc  .sort-icon,
thead th.desc .sort-icon { opacity: 1; color: var(--brand-500); }

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
  cursor: pointer;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-elevated); }
tbody tr.selected { background: rgba(232,120,90,0.08); }

tbody td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-muted { color: var(--text-secondary); font-size: var(--text-xs); }
.td-code  { color: var(--text-muted); font-family: var(--font-mono); font-size: var(--text-xs); }

.table-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.action-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.action-btn.danger:hover { color: var(--danger-fg); }

/* ── FORMS ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-label.required::after {
  content: ' *';
  color: var(--danger-fg);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
  font-family: var(--font-sans);
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--brand-500); }

.form-input.error,
.form-select.error { border-color: var(--danger-fg); }

.form-textarea { resize: vertical; min-height: 80px; }

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235E5F65' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-hint { font-size: var(--text-xs); color: var(--text-muted); }
.form-error { font-size: var(--text-xs); color: var(--danger-fg); }

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Slider */
.form-range {
  width: 100%;
  accent-color: var(--brand-500);
  height: 4px;
}

/* Toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle {
  width: 36px;
  height: 20px;
  background: var(--border-default);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle.on { background: var(--brand-500); }

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}

.toggle.on::after { transform: translateX(16px); }

/* Checkbox */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--brand-500);
  cursor: pointer;
}

/* Priority radio buttons */
.priority-radios {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.priority-radio {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 500;
  transition: all 0.15s;
}

.priority-radio input { display: none; }
.priority-radio.critical { color: var(--priority-critical); }
.priority-radio.high     { color: var(--priority-high); }
.priority-radio.medium   { color: var(--priority-medium); }
.priority-radio.low      { color: var(--priority-low); }
.priority-radio.selected.critical { background: rgba(216,110,106,0.15); border-color: var(--priority-critical); }
.priority-radio.selected.high     { background: rgba(232,120,90,0.15);  border-color: var(--priority-high); }
.priority-radio.selected.medium   { background: rgba(201,168,76,0.15);  border-color: var(--priority-medium); }
.priority-radio.selected.low      { background: rgba(127,185,138,0.15); border-color: var(--priority-low); }

/* Status radios */
.status-radios {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-radio {
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border-default);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 600;
  transition: all 0.15s;
  color: var(--text-secondary);
}

.status-radio.selected { border-color: currentColor; }
.status-radio[data-status="backlog"].selected    { color: var(--text-muted); background: rgba(94,95,101,0.2); }
.status-radio[data-status="pending"].selected    { color: var(--info-fg); background: var(--info-bg); }
.status-radio[data-status="in_progress"].selected{ color: var(--brand-400); background: rgba(232,120,90,0.15); }
.status-radio[data-status="review"].selected     { color: var(--warning-fg); background: var(--warning-bg); }
.status-radio[data-status="done"].selected       { color: var(--success-fg); background: var(--success-bg); }
.status-radio[data-status="blocked"].selected    { color: var(--danger-fg); background: var(--danger-bg); }

/* Tags / Chips */
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: text;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(232,120,90,0.12);
  color: var(--brand-400);
  border-radius: 9999px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.tag-chip button {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  display: flex;
  line-height: 1;
  opacity: 0.7;
  font-size: 14px;
}

.tag-chip button:hover { opacity: 1; }

.tags-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: var(--text-sm);
  color: var(--text-primary);
  min-width: 80px;
  flex: 1;
}

.tags-input::placeholder { color: var(--text-muted); }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: backdropIn 0.15s ease-out;
}

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

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.18s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-sm { max-width: 440px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

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

.modal-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}

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

.modal-close:hover { color: var(--text-primary); background: var(--bg-elevated); }

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

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

/* ── DRAWER (panel lateral) ── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 900;
  animation: backdropIn 0.15s ease-out;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 480px;
  max-width: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  z-index: 901;
  display: flex;
  flex-direction: column;
  animation: drawerIn 0.2s ease-out;
}

@keyframes drawerIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

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

.drawer-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

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

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

.toast {
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: all;
  animation: toastIn 0.2s ease-out;
  border-left: 3px solid var(--info-fg);
}

.toast.success { border-left-color: var(--success-fg); }
.toast.warning { border-left-color: var(--warning-fg); }
.toast.error   { border-left-color: var(--danger-fg); }
.toast.info    { border-left-color: var(--info-fg); }

.toast-icon { margin-top: 1px; flex-shrink: 0; }
.toast-icon svg { width: 16px; height: 16px; }

.toast.success .toast-icon { color: var(--success-fg); }
.toast.warning .toast-icon { color: var(--warning-fg); }
.toast.error   .toast-icon { color: var(--danger-fg); }
.toast.info    .toast-icon { color: var(--info-fg); }

.toast-content { flex: 1; min-width: 0; }
.toast-title   { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.toast-message { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); max-height: 80px; }
  to   { opacity: 0; transform: translateX(20px); max-height: 0; padding: 0; margin: 0; }
}

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

/* ── ALERT PANEL ── */
.alert-panel {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  font-size: var(--text-sm);
}

.alert-danger  { background: var(--danger-bg);  border: 1px solid rgba(188,80,75,0.3);  color: var(--danger-fg); }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(195,162,80,0.3); color: var(--warning-fg); }
.alert-success { background: var(--success-bg); border: 1px solid rgba(100,140,107,0.3);color: var(--success-fg); }
.alert-info    { background: var(--info-bg);    border: 1px solid rgba(117,179,200,0.3); color: var(--info-fg); }

/* ── SEARCH MODAL ── */
.search-modal .modal { max-width: 560px; }

.search-input-wrap {
  position: relative;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrap input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--brand-500);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 40px;
  font-size: var(--text-base);
  color: var(--text-primary);
  outline: none;
}

.search-input-wrap .si { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.search-results { padding: 8px 0; }

.search-group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 16px 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.1s;
}

.search-result-item:hover, .search-result-item.focused { background: var(--bg-elevated); }

.search-result-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.search-result-title { font-size: var(--text-sm); color: var(--text-primary); }
.search-result-meta  { font-size: var(--text-xs); color: var(--text-secondary); }

.search-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ── KANBAN ── */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
  min-height: calc(100vh - 200px);
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-width: 240px;
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.kanban-col-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.kanban-col-count {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 9999px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.kanban-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-col-body.drag-over {
  background: rgba(232,120,90,0.05);
  border-radius: var(--radius-sm);
}

.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  border-top: 3px solid var(--border-default);
}

.kanban-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-default); }

.kanban-card.dragging { opacity: 0.4; }

.kanban-card-code {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kanban-card-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kanban-card-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.kanban-card-due {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

.kanban-card-due.overdue  { color: var(--danger-fg); }
.kanban-card-due.soon     { color: var(--warning-fg); }

.kanban-add-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s;
  margin-top: 4px;
}

.kanban-add-btn:hover { border-color: var(--brand-500); color: var(--brand-500); }

/* ── GANTT ── */
.gantt-wrap {
  display: flex;
  height: calc(100vh - 180px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
}

.gantt-left {
  width: 320px;
  min-width: 200px;
  flex-shrink: 0;
  border-right: 2px solid var(--border-default);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gantt-right {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.gantt-header-row {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
}

.gantt-left-header {
  padding: 8px 14px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gantt-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.gantt-row {
  display: flex;
  align-items: center;
  height: 38px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
}

.gantt-row:hover { background: rgba(255,255,255,0.02); }

.gantt-cell-left {
  width: 320px;
  min-width: 200px;
  flex-shrink: 0;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  border-right: 2px solid var(--border-default);
}

.gantt-task-code {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

.gantt-task-title {
  font-size: var(--text-xs);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.gantt-milestone-icon { color: var(--brand-500); flex-shrink: 0; }

/* ── TEAM CARDS ── */
.team-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.team-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}

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

.team-card-info { flex: 1; min-width: 0; }
.team-card-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.team-card-role { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }

.team-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.team-stat {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}

.team-stat-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.team-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── WORKLOAD HEATMAP ── */
.heatmap-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.heatmap-table {
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.heatmap-table th, .heatmap-table td {
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  text-align: center;
}

.heatmap-table thead th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  position: sticky;
  top: 0;
}

.heatmap-table .row-header {
  background: var(--bg-surface);
  text-align: left;
  color: var(--text-primary);
  font-weight: 500;
  position: sticky;
  left: 0;
}

.heat-0    { background: var(--bg-surface); }
.heat-low  { background: rgba(127,185,138,0.15); color: var(--success-fg); }
.heat-norm { background: rgba(117,179,200,0.15); color: var(--info-fg); }
.heat-over { background: rgba(201,168,76,0.15);  color: var(--warning-fg); }
.heat-high { background: rgba(188,80,75,0.18);   color: var(--danger-fg); font-weight: 600; }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.tab-item {
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--brand-500); border-bottom-color: var(--brand-500); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

.empty-state svg { color: var(--border-default); }
.empty-state h3 { font-size: var(--text-base); font-weight: 600; color: var(--text-secondary); }
.empty-state p  { font-size: var(--text-sm); max-width: 280px; }

/* ── LOADING ── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-default);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── CONFIRM DIALOG ── */
.confirm-dialog {
  text-align: center;
  padding: 8px;
}

.confirm-dialog .icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--danger-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--danger-fg);
}

.confirm-dialog p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 8px;
  margin-bottom: 20px;
}

/* ── NOTIFICATIONS PANEL ── */
.notifications-panel {
  position: absolute;
  top: calc(var(--header-h) + 4px);
  right: 16px;
  width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}

.notifications-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-weight: 600;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.1s;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-elevated); }

.notif-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-icon.danger  { background: var(--danger-bg);  color: var(--danger-fg); }
.notif-icon.warning { background: var(--warning-bg); color: var(--warning-fg); }

.notif-title { font-size: var(--text-xs); font-weight: 500; color: var(--text-primary); }
.notif-meta  { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── CHART CONTAINER ── */
.chart-container {
  position: relative;
  width: 100%;
}

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 28px 5px 10px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235E5F65' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
}

.filter-select:focus, .filter-select:hover { border-color: var(--border-default); color: var(--text-primary); }

.search-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: var(--text-xs);
  color: var(--text-primary);
  outline: none;
  width: 180px;
  font-family: var(--font-sans);
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--brand-500); }

/* ── DETAIL SECTIONS ── */
.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.detail-value { font-size: var(--text-sm); color: var(--text-primary); }

/* ── COMMENTS ── */
.comment {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

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

.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: var(--text-xs); font-weight: 600; color: var(--text-primary); }
.comment-time   { font-size: 10px; color: var(--text-muted); }
.comment-text   { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }

/* ── MILESTONE DIAMOND ── */
.milestone-diamond {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--brand-500);
  transform: rotate(45deg);
  border-radius: 2px;
}

/* ── PAGE SECTION ── */
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
}

.section-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.section-card-body { padding: 20px; }

/* ── SKILL CHIP ── */
.skill-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ── RECURRING TASK UI ── */
.day-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.day-chip.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: white;
}

.day-chip:hover:not(.active) {
  border-color: var(--brand-500);
  color: var(--brand-500);
}

.recurring-box {
  margin-top: 4px;
}

/* ── CALENDAR ── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-header-cell {
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 2px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cal-cell {
  min-height: 90px;
  padding: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  transition: background 0.1s;
  border: 1px solid transparent;
}

.cal-cell:hover { background: var(--bg-surface); border-color: var(--border-subtle); }

.cal-cell-empty { background: transparent; border-color: transparent; min-height: 90px; }

.cal-today {
  background: rgba(232,120,90,0.07) !important;
  border-color: var(--brand-500) !important;
}

.cal-day-num {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1;
}

.cal-today .cal-day-num {
  color: var(--brand-500);
  font-size: var(--text-sm);
}

.cal-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-chip {
  font-size: 10px;
  color: var(--text-primary);
  padding: 2px 5px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.1s;
  line-height: 1.4;
}

.cal-chip:hover { opacity: 0.75; }

.day-task-card:hover { background: var(--bg-surface) !important; }

/* ── COMMENTS ── */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.comment-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.comment-bubble {
  flex: 1;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.comment-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-author { font-weight: 600; color: var(--text-secondary); }

.comment-text {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.comment-input-wrap textarea {
  flex: 1;
  min-height: 60px;
  resize: none;
}

/* ── ATTACHMENTS ── */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.attachment-item-name {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-item-size {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── MOBILE OVERRIDES ── */
@media (max-width: 768px) {
  /* Full-width drawer */
  .drawer { width: 100% !important; }

  /* Modal near-full-screen */
  .modal, .modal-sm, .modal-lg, .modal-xl {
    max-width: calc(100vw - 24px);
    max-height: 95vh;
    margin: 0 auto;
  }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }

  /* Toast full-width at bottom */
  #toast-container {
    right: 12px;
    left: 12px;
    bottom: 12px;
    align-items: stretch;
  }
  .toast { width: 100%; max-width: 100%; }

  /* Kanban wider columns */
  .kanban-col { min-width: 270px; width: 270px; }

  /* Calendar compact */
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-chip { font-size: 9px; padding: 1px 3px; }
  .cal-header-cell { font-size: 9px; padding: 4px 2px; }

  /* Larger touch targets in nav */
  .nav-item { min-height: 44px; }
  .btn { min-height: 36px; }
  .header-btn { min-width: 36px; min-height: 36px; }
}
