*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fff;
  --bg-2: #f8f8f8;
  --text: #111;
  --text-2: #444;
  --text-3: #888;
  --border: #e5e5e5;
  --accent: #2563eb;
  --zone-work: #fef9c3;
  --zone-stage: #dbeafe;
  --zone-repo-bg: #1a1a1a;
  --zone-repo-text: #fff;
  --mono: 'Menlo', 'Monaco', monospace;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

nav {
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
}
nav a { color: var(--text-2); text-decoration: none; font-size: 14px; }
nav a:hover { color: var(--accent); }

.page-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 32px 40px;
}
.page-header h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.page-header .subtitle { font-size: 15px; color: var(--text-2); }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Three-zone board */
.board {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 24px;
  min-height: 320px;
}

.zone {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.zone-work { background: var(--zone-work); }
.zone-stage {
  background: var(--zone-stage);
  border-left: 1px solid rgba(0,0,0,.06);
  border-right: 1px solid rgba(0,0,0,.06);
}
.zone-repo { background: var(--zone-repo-bg); }

.zone-header {
  margin-bottom: 4px;
}
.zone-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-2);
}
.zone-repo .zone-title { color: rgba(255,255,255,.6); }
.zone-subtitle {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.zone-repo .zone-subtitle { color: rgba(255,255,255,.35); }
.zone-divider {
  height: 1px;
  background: rgba(0,0,0,.08);
  margin: 4px 0 8px;
}
.zone-repo .zone-divider { background: rgba(255,255,255,.1); }

.zone-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

/* File cards */
.file-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: rgba(255,255,255,.9);
  border-radius: 7px;
  border: 1px solid rgba(0,0,0,.06);
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.2s;
  user-select: none;
}
.file-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.file-card.selected {
  border-color: var(--accent);
  background: #eff6ff;
}
.file-card input[type=checkbox] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.file-card .file-icon { font-size: 14px; flex-shrink: 0; }
.file-card .file-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  flex: 1;
}
.file-card .modified-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 1px 6px;
  white-space: nowrap;
}
.file-card .modified-badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d97706;
}
.file-card .staged-badge {
  font-size: 10px;
  color: #1e40af;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1px 6px;
}

.zone-empty-msg {
  font-size: 12px;
  color: rgba(0,0,0,.3);
  font-style: italic;
  text-align: center;
  padding: 20px 0;
}
.zone-repo .zone-empty-msg { color: rgba(255,255,255,.25); }

/* Commit nodes in repo */
.commit-node {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  animation: commitPop 0.35s ease forwards;
}
@keyframes commitPop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.commit-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
  margin-top: 3px;
}
.commit-info { flex: 1; }
.commit-hash { font-family: var(--mono); font-size: 10px; color: #93c5fd; }
.commit-msg { font-size: 11px; color: rgba(255,255,255,.85); font-weight: 500; margin-top: 1px; }
.commit-time { font-size: 10px; color: rgba(255,255,255,.35); margin-top: 1px; }

/* Controls */
.controls {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--mono);
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-add-sel {
  background: var(--accent);
  color: #fff;
}
.btn-add-sel:hover:not(:disabled) { background: #1d4ed8; }
.btn-add-all {
  background: #1e40af;
  color: #fff;
}
.btn-add-all:hover:not(:disabled) { background: #1e3a8a; }
.btn-restore {
  background: var(--bg);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-restore:hover:not(:disabled) { background: var(--border); }
.btn-status {
  background: var(--bg);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-status:hover { background: var(--border); }
.btn-reset {
  background: transparent;
  color: var(--text-3);
  border-color: var(--border);
  margin-left: auto;
  font-family: system-ui, sans-serif;
  font-size: 12px;
}
.btn-reset:hover { color: var(--text-2); background: var(--bg-2); }

/* Commit form */
.commit-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 260px;
}
.commit-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.commit-input:focus { border-color: var(--accent); }
.btn-commit {
  background: #16a34a;
  color: #fff;
  font-family: var(--mono);
}
.btn-commit:hover:not(:disabled) { background: #15803d; }

/* Status panel */
.status-panel {
  margin-top: 12px;
  padding: 14px 18px;
  background: #0d1117;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: #e2e8f0;
  display: none;
  animation: fadeInUp 0.25s ease;
}
.status-panel.visible { display: block; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.status-panel .s-head { color: #7dd3fc; margin-bottom: 8px; }
.status-panel .s-work { color: #fde68a; }
.status-panel .s-stage { color: #86efac; }
.status-panel .s-repo { color: #c4b5fd; }

/* Commit history */
.history-section {
  margin-top: 24px;
  padding-bottom: 48px;
}
.history-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-title span { font-size: 12px; color: var(--text-3); font-weight: 400; }
.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  animation: fadeInUp 0.3s ease;
}
.h-hash {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  width: 44px;
  flex-shrink: 0;
}
.h-msg { font-size: 13px; color: var(--text); flex: 1; }
.h-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* Card animation */
.file-card.animate-out {
  animation: slideOut 0.3s ease forwards;
}
@keyframes slideOut {
  to { transform: translateX(30px); opacity: 0; height: 0; margin: 0; padding: 0; overflow: hidden; }
}
.file-card.animate-in {
  animation: slideIn 0.35s ease forwards;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 640px) {
  nav, .page-header { padding-left: 20px; padding-right: 20px; }
  .container { padding: 0 20px; }
  .board { grid-template-columns: 1fr; }
  .zone-stage, .zone-repo { border-left: none; border-right: none; border-top: 1px solid rgba(0,0,0,.08); }
  .controls { flex-direction: column; align-items: stretch; }
  .btn-reset { margin-left: 0; }
}
