/* ═══════════════════════════════════════
   GanttFlow v2 — Component Styles
   ═══════════════════════════════════════ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn-link {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: var(--sp-2);
  font-size: var(--text-sm);
}

.btn-link:hover {
  color: var(--accent);
}

.btn-sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-sm);
  height: 32px;
}

.btn-full {
  width: 100%;
  height: 40px;
}

.btn-spinner {
  display: inline-flex;
  animation: spin 0.8s linear infinite;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ── Connection Panel ── */
.connection-panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 100;
  padding: var(--sp-4);
}

.connection-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-10);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.connection-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-8);
}

.connection-brand {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.connection-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
  letter-spacing: -0.02em;
}

.connection-desc {
  color: var(--text-muted);
  font-size: var(--text-md);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--sp-6);
}

.connection-error {
  background: var(--error-bg);
  color: var(--error);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-4);
  line-height: var(--lh-base);
}

.connection-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.connection-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin: var(--sp-5) 0;
  color: var(--text-faint);
  font-size: var(--text-sm);
}

.connection-divider::before,
.connection-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Form Elements ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  flex: 1;
}

.form-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-md);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 21, 75, 0.12);
}

[data-theme="dark"] .form-input:focus {
  box-shadow: 0 0 0 3px rgba(199, 143, 208, 0.2);
}

.form-input::placeholder {
  color: var(--text-faint);
}

.form-input[type="date"] {
  cursor: pointer;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.form-row {
  display: flex;
  gap: var(--sp-4);
}

.input-wrap {
  position: relative;
}

.eye-btn {
  position: absolute;
  right: var(--sp-2);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--duration) var(--ease);
}

.eye-btn:hover {
  color: var(--text-muted);
}

.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: help;
  border-radius: var(--radius-full);
  position: relative;
}

.info-btn:hover {
  color: var(--text-muted);
}

.info-btn:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: var(--lh-base);
  width: 260px;
  white-space: normal;
  z-index: 50;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

/* ── Slack OAuth Button ── */
.btn-slack {
  background: #4A154B;
  color: #FFFFFF;
  border-color: #4A154B;
  font-weight: 600;
  height: 48px;
  font-size: var(--text-md);
  text-decoration: none;
  gap: var(--sp-3);
}

.btn-slack:hover {
  background: #611f69;
  border-color: #611f69;
}

.btn-slack:active {
  transform: scale(0.98);
}

[data-theme="dark"] .btn-slack {
  background: #C78FD0;
  color: #1A1D21;
  border-color: #C78FD0;
}

[data-theme="dark"] .btn-slack:hover {
  background: #D9A8E0;
  border-color: #D9A8E0;
}

/* ── OAuth User Info ── */
.oauth-user-info {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  padding: var(--sp-2) var(--sp-3);
  background: var(--success-bg);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--success);
}

/* ── Lists Container ── */
.lists-loading {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.lists-container {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 280px;
  overflow-y: auto;
  padding: var(--sp-1) 0;
}

.list-option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-align: left;
}

.list-option:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.list-option:active {
  transform: scale(0.99);
}

.list-option-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--surface-offset);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.list-option-info {
  flex: 1;
  min-width: 0;
}

.list-option-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-option-meta {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 400;
}

.list-option-arrow {
  color: var(--text-faint);
  flex-shrink: 0;
}

.lists-empty {
  text-align: center;
  padding: var(--sp-6);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ── Manual List Entry ── */
.manual-list-form {
  width: 100%;
}

.manual-list-row {
  display: flex;
  gap: var(--sp-2);
}

.manual-list-row .form-input {
  flex: 1;
  font-size: var(--text-sm);
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
}

.manual-list-hint {
  margin: var(--sp-2) 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── List ID Help ── */
.list-id-help {
  width: 100%;
  margin-top: var(--sp-3);
}

.list-id-help-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: var(--text-sm);
  color: var(--accent);
  cursor: pointer;
  transition: color var(--duration) var(--ease);
}

.list-id-help-toggle:hover {
  color: var(--accent-hover);
}

.list-id-help-toggle svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.list-id-help-content {
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface-offset);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.list-id-steps {
  margin: 0;
  padding-left: var(--sp-5);
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: var(--lh-relaxed);
}

.list-id-steps li {
  margin-bottom: var(--sp-2);
}

.list-id-steps li:last-child {
  margin-bottom: 0;
}

.list-id-steps-note {
  margin: var(--sp-3) 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

.list-id-steps-note code {
  background: var(--surface-elevated);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
}

/* ── Connection Step visibility ── */
.connection-step {
  animation: fadeIn var(--duration) var(--ease);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  z-index: 200;
  padding: var(--sp-4);
  animation: fadeIn var(--duration) var(--ease);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--duration-slow) var(--ease);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

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

.modal-desc {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-4);
  line-height: var(--lh-relaxed);
}

.modal-desc code {
  background: var(--surface-offset);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: var(--text-xs);
}

.modal-actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-5);
}

.json-textarea {
  width: 100%;
  height: 200px;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: var(--text-sm);
  line-height: var(--lh-relaxed);
  resize: vertical;
  transition: border-color var(--duration) var(--ease);
}

.json-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── App Layout ── */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 1fr;
  height: 100dvh;
  position: relative;
}

/* ── Sidebar ── */
.sidebar {
  grid-row: 1 / -1;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 20;
  transition: transform var(--duration-slow) var(--ease);
}

.sidebar-header {
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.sidebar-brand {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding: var(--sp-1) 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-dot--connected {
  background: var(--success);
}

.status-dot--demo {
  background: var(--text-faint);
}

.status-text {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-3) var(--sp-2);
}

.sidebar-section {
  margin-bottom: var(--sp-4);
}

.sidebar-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-2) var(--sp-3);
}

.sidebar-list {
  list-style: none;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-align: left;
}

.sidebar-item:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.sidebar-item--active {
  background: var(--surface-offset);
  color: var(--text-primary);
}

.sidebar-item:disabled {
  opacity: 0.5;
  cursor: default;
}

.sidebar-item--danger:hover {
  color: var(--error);
}

.badge-soon {
  font-size: var(--text-xs);
  color: var(--text-faint);
  background: var(--surface-offset);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: auto;
}

.sidebar-footer {
  padding: var(--sp-2);
  border-top: 1px solid var(--border-subtle);
}

.sidebar-save-status {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-save-status.visible {
  opacity: 1;
}
.sidebar-save-status svg {
  color: #22c55e;
}

.list-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ── Main Area ── */
.main-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Top Bar ── */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  z-index: 10;
  min-height: 52px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.sidebar-toggle {
  display: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-sm);
  color: var(--text-faint);
  min-width: 0;
}

.breadcrumb-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.filter-pills {
  display: flex;
  gap: var(--sp-1);
  background: var(--surface-offset);
  border-radius: var(--radius-md);
  padding: 2px;
}

.filter-pill {
  padding: var(--sp-1) var(--sp-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}

.filter-pill:hover {
  color: var(--text-primary);
}

.filter-pill--active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* ── Theme Toggle Icons ── */
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ── Gantt Wrapper ── */
.gantt-wrapper {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.gantt-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gantt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
  flex-shrink: 0;
}

.gantt-zoom {
  display: flex;
  gap: var(--sp-1);
  background: var(--surface-offset);
  border-radius: var(--radius-md);
  padding: 2px;
}

.zoom-btn {
  padding: var(--sp-1) var(--sp-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.zoom-btn:hover {
  color: var(--text-primary);
}

.zoom-btn--active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ── Gantt Grid ── */
.gantt-scroll {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
}

.gantt-grid {
  display: flex;
  min-height: 100%;
}

.gantt-task-col {
  width: 320px;
  min-width: 320px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
}

.gantt-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  height: 44px;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 6;
}

.task-count {
  font-weight: 400;
  color: var(--text-faint);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.gantt-task-rows {
  flex: 1;
}

.gantt-task-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  height: 44px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}

.gantt-task-row:hover {
  background: var(--surface-hover);
}

.gantt-task-row--group {
  background: var(--surface-offset);
  cursor: default;
}

.gantt-task-row--group:hover {
  background: var(--surface-offset);
}

.task-color-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

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

.task-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  font-size: var(--text-xs);
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--surface-offset);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.task-status-badge {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  white-space: nowrap;
}

.task-status-badge--done {
  background: var(--success-bg);
  color: var(--success);
}

.task-status-badge--progress {
  background: rgba(69, 115, 210, 0.12);
  color: var(--cat-blue);
}

.task-status-badge--todo {
  background: var(--surface-offset);
  color: var(--text-faint);
}

.group-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.group-count {
  font-weight: 400;
  color: var(--text-faint);
  font-size: var(--text-xs);
}

/* ── Gantt Timeline ── */
.gantt-timeline {
  flex: 1;
  min-width: 0;
  position: relative;
}

.gantt-time-header {
  display: flex;
  height: 44px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--surface);
}

.time-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.time-cell--today {
  color: var(--today-line);
  font-weight: 600;
}

.time-cell--weekend {
  background: var(--surface-offset);
}

.gantt-bars-area {
  position: relative;
  min-height: 100%;
}

.gantt-bar-row {
  position: relative;
  height: 44px;
  border-bottom: 1px solid var(--border-subtle);
}

.gantt-bar-row--group {
  background: var(--surface-offset);
}

.gantt-bar {
  position: absolute;
  top: 10px;
  height: 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
  overflow: hidden;
  min-width: 6px;
}

.gantt-bar:hover {
  opacity: 0.85;
  transform: scaleY(1.08);
  z-index: 3;
}

.gantt-bar-bg {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  opacity: 0.25;
}

.gantt-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-radius: var(--radius-sm);
  transition: width var(--duration-slow) var(--ease);
}

.gantt-bar-milestone {
  position: absolute;
  top: 12px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  border-radius: 2px;
  cursor: pointer;
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.gantt-bar-milestone:hover {
  opacity: 0.85;
  transform: rotate(45deg) scale(1.15);
}

/* Today Line */
.today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--today-line);
  z-index: 2;
  pointer-events: none;
}

.today-line::before {
  content: 'Today';
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--today-line);
  white-space: nowrap;
}

/* Grid lines */
.gantt-grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
  pointer-events: none;
}

.gantt-grid-line--weekend {
  width: var(--cell-width, 40px);
  background: var(--surface-offset);
  opacity: 0.5;
}

/* ── Skeleton Loader ── */
.skeleton-loader {
  padding: var(--sp-6) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.skeleton-row {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 var(--sp-4);
}

.skeleton-bar {
  height: 24px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-shimmer) 50%, var(--skeleton) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16);
  text-align: center;
}

.empty-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-muted);
  margin-top: var(--sp-4);
}

.empty-desc {
  font-size: var(--text-sm);
  color: var(--text-faint);
  margin-top: var(--sp-2);
  max-width: 300px;
}

/* ── Detail Panel ── */
.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  display: flex;
  flex-direction: column;
  animation: slideInRight var(--duration-slow) var(--ease);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
  gap: var(--sp-3);
}

.detail-title {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--lh-tight);
}

.detail-body {
  padding: 0 var(--sp-5) var(--sp-5);
}

.detail-field {
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-field:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--sp-1);
}

.detail-value {
  font-size: var(--text-md);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.detail-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-offset);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--sp-2);
}

.detail-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease);
}

/* ── Tutorial Panel ── */
.tutorial-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  display: flex;
  flex-direction: column;
  animation: slideInRight var(--duration-slow) var(--ease);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tutorial-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--sp-5);
  gap: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.tutorial-title {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--lh-tight);
}

.tutorial-body {
  padding: var(--sp-5);
}

.tutorial-step {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.step-content h3 {
  font-size: var(--text-md);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.step-content p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

.step-content strong {
  color: var(--text-primary);
}

.step-content code {
  background: var(--surface-offset);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: var(--text-xs);
}

.tutorial-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--sp-3);
  font-size: var(--text-sm);
}

.tutorial-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tutorial-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.tutorial-list {
  padding-left: var(--sp-5);
  margin-top: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

.tutorial-list li {
  margin-bottom: var(--sp-1);
}

.tutorial-list--ordered {
  list-style-type: decimal;
}

.tutorial-practices {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}

.tutorial-practices h3 {
  font-size: var(--text-md);
  font-weight: 600;
  margin-bottom: var(--sp-4);
}

.practices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.practice-col ul {
  list-style: none;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

.practice-col li {
  padding: var(--sp-1) 0;
  padding-left: var(--sp-5);
  position: relative;
}

.practice-col--do li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

.practice-col--dont li::before {
  content: '✗';
  position: absolute;
  left: 0;
  color: var(--error);
  font-weight: 700;
}

.practice-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.practice-heading--do { color: var(--success); }
.practice-heading--dont { color: var(--error); }

/* ── Tooltip ── */
.tooltip {
  position: fixed;
  background: var(--text-primary);
  color: var(--bg);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  line-height: var(--lh-base);
  max-width: 280px;
  pointer-events: none;
  z-index: 999;
  box-shadow: var(--shadow-md);
  white-space: normal;
}

/* ── Footer ── */
.app-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: var(--sp-2) var(--sp-4);
  z-index: 1;
}

.app-footer a {
  font-size: var(--text-xs);
  color: var(--text-faint);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}

.app-footer a:hover {
  color: var(--text-muted);
}

/* ── Mobile Message ── */
.mobile-message {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  padding: var(--sp-8);
  text-align: center;
}

/* ── Hidden attribute override ── */
[hidden] {
  display: none !important;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

/* ── Schema Preview (Create List Modal) ── */
.schema-preview {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  background: var(--surface-offset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
}

.schema-col {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  padding: var(--sp-1) 0;
}

.schema-col + .schema-col {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-2);
}

.schema-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  flex-shrink: 0;
}

.schema-icon--text {
  background: rgba(69, 115, 210, 0.15);
  color: #4573D2;
  font-family: serif;
  font-weight: 700;
}

.schema-icon--date {
  background: rgba(26, 168, 168, 0.15);
  color: #1AA8A8;
}

.schema-icon--select {
  background: rgba(227, 98, 160, 0.15);
  color: #E362A0;
}

.schema-icon--user {
  background: rgba(93, 162, 131, 0.15);
  color: #5DA283;
}

.schema-type {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.schema-choices {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-faint);
  margin-left: var(--sp-2);
}

.create-list-result {
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--lh-relaxed);
}

.create-list-result--success {
  background: rgba(93, 162, 131, 0.12);
  border: 1px solid rgba(93, 162, 131, 0.3);
  color: #3d8c6a;
}

[data-theme="dark"] .create-list-result--success {
  color: #7cc9a4;
}

.create-list-result--error {
  background: rgba(207, 81, 61, 0.08);
  border: 1px solid rgba(207, 81, 61, 0.2);
  color: var(--status-danger);
}

.create-list-result a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.create-list-result a:hover {
  text-decoration-thickness: 2px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .app { display: none; }
  .connection-panel { display: none; }
  .mobile-message { display: flex; }
  .app-footer { display: none; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .app {
    grid-template-columns: 0 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 50;
  }
  .sidebar.sidebar--open {
    transform: translateX(0);
  }
  .sidebar-toggle {
    display: flex;
  }
  .filter-pills {
    display: none;
  }
}

@media (min-width: 1025px) {
  .sidebar-toggle {
    display: none;
  }
}

/* ═══════════════════════════════════════
   Dependency Arrows
   ═══════════════════════════════════════ */

:root {
  --dep-arrow-color: #9a9b9d;
}

[data-theme="dark"] {
  --dep-arrow-color: #6b6f76;
}

.dep-arrows-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.dep-path {
  fill: none;
  stroke: var(--dep-arrow-color);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.6;
  transition: opacity var(--duration) var(--ease);
}

.dep-arrows-svg:hover .dep-path {
  opacity: 0.35;
}

.dep-arrows-svg:hover .dep-path:hover {
  opacity: 1;
  stroke-width: 2;
  pointer-events: stroke;
}

/* ── Link Mode ── */
.link-mode--active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.link-mode-on .gantt-bar,
.link-mode-on .gantt-bar-milestone,
.link-mode-on .gantt-task-row:not(.gantt-task-row--group) {
  cursor: crosshair;
}

.link-mode-on .gantt-bar:hover,
.link-mode-on .gantt-bar-milestone:hover {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.dep-link-source {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
  border-radius: var(--radius-sm);
  animation: linkPulse 1s ease-in-out infinite;
}

@keyframes linkPulse {
  0%, 100% { outline-color: var(--accent); }
  50% { outline-color: transparent; }
}

/* ── Dependency Chips (detail panel) ── */
.detail-deps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.dep-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.6;
}

.dep-chip--predecessor {
  background: var(--surface-offset);
  color: var(--text-secondary);
}

.dep-chip--successor {
  background: rgba(74, 21, 75, 0.1);
  color: var(--accent);
}

[data-theme="dark"] .dep-chip--successor {
  background: rgba(74, 21, 75, 0.3);
}
