* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f3f4f6;
  color: #1a1a1a;
  overflow: hidden;
}

html, body, #app {
  width: 100%;
  height: 100%;
}

/* ===== TITLEBAR ===== */
.titlebar {
  height: 48px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.titlebar .hamburger {
  font-size: 16px;
  color: #6b7280;
  padding: 4px 8px;
}

.titlebar .back-btn {
  font-size: 14px;
  color: #6b7280;
  padding: 4px 8px;
  cursor: pointer;
}

.titlebar .icon {
  width: 20px;
  height: 20px;
  background: #076bc9;
  border-radius: 4px;
}

.titlebar .title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}

/* ===== LAYOUT ===== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: calc(100vh - 48px);
  overflow: hidden;
}

/* ===== NAVIGATION ===== */
.nav-pane {
  width: 200px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 14px;
  color: #374151;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: #f3f4f6;
}

.nav-item.active {
  background: #e8f1fb;
  color: #076bc9;
  border-left-color: #076bc9;
  font-weight: 600;
}

.nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-content.settings {
  padding: 32px;
  overflow-y: auto;
}

.main-content.detail {
  position: relative;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hercules-logo {
  width: 32px;
  height: 32px;
  background: #076bc9;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
}

.header-title {
  font-size: 24px;
  font-weight: 700;
  color: #076bc9;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: white;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  border-color: #9ca3af;
}

.btn-primary {
  background: #076bc9;
  color: white;
  border-color: #076bc9;
  font-weight: 600;
}

.btn-primary:hover {
  background: #0560a8;
}

.btn-secondary {
  color: #374151;
}

.toggle-btn {
  position: relative;
  padding-left: 50px;
}

.toggle-btn::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 18px;
  background: #10b981;
  border-radius: 9px;
}

.toggle-btn::after {
  content: '';
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
}

/* ===== KANBAN BOARD ===== */
.kanban-board {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  overflow: hidden;
}

.column {
  background: #f9fafb;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.column-accent {
  width: 4px;
  height: 20px;
  border-radius: 4px;
}

.column-accent.backlog {
  background: #6b7280;
}

.column-accent.inprogress {
  background: #f59e0b;
}

.column-accent.review {
  background: #10b981;
}

.column-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.count-badge {
  background: #e8f1fb;
  color: #076bc9;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
}

.cards-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== CARD ===== */
.card {
  background: white;
  border-radius: 10px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.card-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.badge {
  background: #e8f1fb;
  color: #076bc9;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge.issue {
  background: #fef3c7;
  color: #92400e;
}

.badge.bug {
  background: #fee2e2;
  color: #991b1b;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  line-height: 1.4;
  color: #1a1a1a;
}

.card-status {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #f59e0b33;
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.card-status.review-status {
  color: #10b981;
}

/* ===== STATUS BAR ===== */
.status-bar {
  margin-top: 12px;
  background: white;
  border-radius: 8px;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e5e7eb;
}

.status-message {
  font-size: 12px;
  color: #6b7280;
}

.status-counts {
  display: flex;
  gap: 16px;
}

.status-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.backlog {
  background: #6b7280;
}

.status-dot.inprogress {
  background: #f59e0b;
}

.status-dot.review {
  background: #10b981;
}

/* ===== SETTINGS PAGE ===== */
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: #076bc9;
  margin-bottom: 24px;
}

.settings-stack {
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid #e5e7eb;
  cursor: auto;
}

.card:hover {
  box-shadow: none;
  transform: none;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 16px;
}

.field {
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #f9fafb;
  color: #1a1a1a;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #076bc9;
  box-shadow: 0 0 0 3px rgba(7, 107, 201, 0.12);
}

.field .hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.hint {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
}

.repo-row {
  background: #f9fafb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.repo-row .row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.repo-row .desc-row {
  margin-top: 8px;
}

.remove-btn {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: white;
  font-size: 14px;
  cursor: pointer;
  color: #ef4444;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.add-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: white;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: #076bc9;
  font-weight: 600;
}

.auth-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.auth-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.auth-dot.connected {
  background: #10b981;
}

.auth-dot.disconnected {
  background: #ef4444;
}

.auth-text {
  font-size: 13px;
}

.auth-text.connected-text {
  color: #10b981;
  font-weight: 600;
}

.btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-msg {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 12px;
}

.save-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.save-status {
  font-size: 13px;
  color: #10b981;
  font-weight: 600;
}

/* ===== DETAIL MODAL ===== */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.dialog {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.dialog-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 20px;
}

.dialog-title .id {
  color: #076bc9;
}

.detail-row {
  margin-bottom: 16px;
}

.detail-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: #1a1a1a;
  line-height: 1.5;
}

.detail-value.subtle {
  color: #6b7280;
  font-size: 13px;
}

.timeline {
  margin-top: 4px;
}

.timeline-entry {
  font-size: 12px;
  color: #6b7280;
  padding: 3px 0;
  display: flex;
  gap: 8px;
}

.timeline-entry .time {
  color: #9ca3af;
  min-width: 60px;
  font-variant-numeric: tabular-nums;
}

.timeline-entry .msg {
  color: #374151;
}

.timeline-entry .msg.active {
  color: #f59e0b;
  font-weight: 600;
}

.notes-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #f9fafb;
  resize: vertical;
  min-height: 60px;
}

.notes-input::placeholder {
  color: #9ca3af;
}

.notes-input:focus {
  outline: none;
  border-color: #076bc9;
  box-shadow: 0 0 0 3px rgba(7, 107, 201, 0.12);
}

.action-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-warn {
  color: #ef4444;
  border-color: #fca5a5;
}

.close-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.btn-close {
  padding: 8px 24px;
}

.branch-info {
  background: #f9fafb;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  color: #076bc9;
  border: 1px solid #e5e7eb;
  word-break: break-all;
}

/* ===== HIDDEN CLASS ===== */
.hidden {
  display: none !important;
}

/* ===== MOBILE / TABLET ===== */
@media (max-width: 768px) {
  body {
    overflow: auto;
  }

  html,
  body,
  #app {
    height: auto;
    min-height: 100%;
  }

  .app-container {
    height: auto;
    min-height: 100vh;
  }

  .app-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .titlebar {
    padding: 0 12px;
    gap: 8px;
  }

  .nav-pane {
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
    position: sticky;
    top: 48px;
    z-index: 5;
  }

  .nav-pane > div {
    flex: 1;
    display: flex;
  }

  .nav-item {
    flex: 1;
    justify-content: center;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 12px 8px;
  }

  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: #076bc9;
  }

  .main-content {
    padding: 16px;
    overflow: visible;
  }

  .main-content.settings {
    padding: 16px;
    overflow: visible;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-left {
    justify-content: flex-start;
  }

  .header-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .header-title {
    font-size: 20px;
  }

  .page-title {
    font-size: 22px;
    margin-bottom: 16px;
  }

  .kanban-board {
    grid-template-columns: 1fr;
    overflow: visible;
    gap: 16px;
  }

  .column {
    overflow: visible;
  }

  .cards-container {
    overflow: visible;
  }

  .status-bar {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .settings-stack {
    max-width: 100%;
  }

  .repo-row .row-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
  }

  .remove-btn {
    justify-self: flex-end;
    width: auto;
  }

  .save-row {
    flex-wrap: wrap;
  }

  .overlay {
    position: fixed;
    padding: 12px;
  }

  body.modal-open {
    overflow: hidden;
  }

  .dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    padding: 20px;
  }

  .dialog-title {
    font-size: 16px;
  }

  .action-row {
    flex-wrap: wrap;
  }

  .branch-info {
    word-break: break-all;
    white-space: normal;
  }
}
