* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f5f5;
}

/* App shell */
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 210px;
  min-width: 210px;
  flex-shrink: 0;
  background: #1a1a1a;
  color: white;
  padding: 20px 0;
}
.sidebar-logo {
  padding: 0 20px 16px;
  font-weight: bold;
  font-size: 18px;
}
.role-switcher {
  padding: 0 16px 16px;
  border-bottom: 1px solid #333;
}
.role-select {
  width: 100%;
  padding: 8px 10px;
  background: #333;
  color: white;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.role-select:hover {
  background: #444;
}
.role-label {
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.sidebar-nav {
  padding: 20px 0;
}
.nav-item {
  padding: 12px 20px;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-item:hover { background: #333; color: white; }
.nav-item.active { background: #333; color: white; }
.sidebar-section-label {
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 20px 8px;
}
.nav-item .indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: auto;
}
.nav-item .indicator.active {
  background: #4CAF50;
}
.nav-item .indicator.learning {
  background: #FF9800;
}
.nav-item.add-new {
  color: #666;
}
.nav-item.add-new:hover {
  color: #999;
}

.main {
  flex: 1;
  padding: 32px 48px;
  min-width: 0;
  overflow-x: auto;
}

/* Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.page-title {
  font-size: 28px;
  font-weight: 600;
}
.btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-weight: 500;
}
.btn-primary {
  background: #333;
  color: white;
}
.btn-primary:hover { background: #000; }
.btn-secondary {
  background: white;
  border: 1px solid #ddd;
  color: #333;
}
.btn-secondary:hover { border-color: #333; }

/* Empty state */
.empty-state {
  background: white;
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 80px 40px;
  text-align: center;
  max-width: 600px;
  margin: 60px auto;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.empty-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}
.empty-desc {
  color: #666;
  margin-bottom: 24px;
}
.empty-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Project list */
.project-table {
  background: white;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  overflow: visible;
}
.project-table table {
  width: 100%;
  border-collapse: collapse;
}
.project-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  background: #fafafa;
  border-bottom: 1px solid #e0e0e0;
}
.project-table td {
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
}
.project-table tr:last-child td {
  border-bottom: none;
}
.project-table tr:hover {
  background: #fafafa;
  cursor: pointer;
}
.project-name {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-icon {
  width: 16px;
  height: 16px;
  background: #4CAF50;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
}
.project-budget {
  font-weight: 500;
}
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-active {
  background: #e8f5e9;
  color: #2e7d32;
}
.status-setup {
  background: #fff3e0;
  color: #e65100;
}
/* Table cell variants */
.cell-primary { font-weight: 500; }
.cell-secondary { color: #666; }
.cell-code { font-size: 13px; }
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e3f2fd;
  color: #1565c0;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.not-synced {
  color: #999;
}
.status-closed {
  background: #f5f5f5;
  color: #666;
}

/* Close project modal specifics */
.close-warning {
  background: #fff3e0;
  border: 1px solid #ffcc80;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}
.close-warning-title {
  font-weight: 600;
  color: #e65100;
  margin-bottom: 8px;
}
.close-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}
.close-item:last-child {
  border-bottom: none;
}
.close-item-icon {
  font-size: 18px;
}
.close-item-text {
  flex: 1;
}
.close-item-detail {
  font-size: 12px;
  color: #666;
}
.card-list {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
}
.card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
}
.card-row-name {
  flex: 1;
}
.card-row-number {
  color: #666;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 220px;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
}
.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: auto;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Form elements */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #333;
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}
.form-input:focus {
  outline: none;
  border-color: #333;
}
.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}
.form-hint {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

/* Choice cards */
.choice-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
.choice-card {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.choice-card:hover {
  border-color: #999;
}
.choice-card.selected {
  border-color: #333;
  background: #f9f9f9;
}
.choice-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px auto;
  color: white;
  font-weight: bold;
  font-size: 14px;
}
.choice-title {
  font-weight: 500;
  margin-bottom: 4px;
}
.choice-desc {
  font-size: 12px;
  color: #666;
}

/* Import list */
.import-list {
  border: 1px solid #ddd;
  border-radius: 8px;
  max-height: 300px;
  overflow: auto;
}
.import-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.import-item:last-child {
  border-bottom: none;
}
.import-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
.import-info {
  flex: 1;
}
.import-name {
  font-weight: 500;
}
.import-meta {
  font-size: 12px;
  color: #666;
}
.import-exists {
  font-size: 12px;
  color: #999;
}

/* Checkbox toggle */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid #eee;
  margin-top: 16px;
}
.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}
.checkbox-label {
  flex: 1;
}
.checkbox-title {
  font-weight: 500;
  margin-bottom: 2px;
}
.checkbox-desc {
  font-size: 12px;
  color: #666;
}

/* Connection indicator */
.connection-banner {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.connection-icon {
  font-size: 20px;
}
.connection-text {
  flex: 1;
}
.connection-title {
  font-weight: 500;
  font-size: 14px;
}
.connection-desc {
  font-size: 12px;
  color: #666;
}

/* Step indicator for import */
.step-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
}
.step-dot.active {
  background: #333;
}

/* Instant tooltip */
.bar-segment {
  position: relative;
  cursor: pointer;
}
.bar-segment::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  margin-bottom: 4px;
  z-index: 10;
}
.bar-segment:hover::after {
  opacity: 1;
}

/* Hint icon tooltip */
.hint-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  margin-bottom: 4px;
  z-index: 10;
}
.hint-icon:hover::after {
  opacity: 1;
}

/* Sync progress circle */
.sync-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.sync-circle-100 {
  background: conic-gradient(#4CAF50 100%, #e0e0e0 0);
  color: #4CAF50;
}
.sync-circle-93 {
  background: conic-gradient(#ff9800 93%, #e0e0e0 0);
  color: #e65100;
}
.sync-circle-78 {
  background: conic-gradient(#ff9800 78%, #e0e0e0 0);
  color: #e65100;
}
.sync-circle-0 {
  background: #e0e0e0;
  color: #999;
}
/* Editable sync circle (not mapped) */
.sync-circle-edit {
  background: #f5f5f5;
  border: 1px dashed #ccc;
  color: #666;
  cursor: pointer;
  position: relative;
}
.sync-circle-edit:hover {
  background: #eee;
  border-color: #999;
}
/* Sync dropdown */
.sync-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 220px;
  z-index: 1000;
  overflow: visible;
}
.sync-dropdown.active {
  display: block;
}
.sync-dropdown-header {
  padding: 8px 12px;
  font-size: 10px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #f0f0f0;
}
.sync-dropdown-item {
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-dropdown-item:hover {
  background: #f5f5f5;
}
.sync-dropdown-item.suggested {
  background: #f0f7ff;
}
.sync-dropdown-item.suggested:hover {
  background: #e3f0ff;
}
.sync-dropdown-item .badge {
  font-size: 10px;
  background: #e3f0ff;
  color: #1565c0;
  padding: 2px 6px;
  border-radius: 4px;
}
.sync-dropdown-divider {
  border-top: 1px solid #f0f0f0;
}
.sync-dropdown-item.create {
  color: #1565c0;
}
.sync-circle-inner {
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Screen management */
.screen { display: none; }
.screen.active { display: block; }
