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

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --bg-card: #1e2746;
  --bg-hover: #253a5e;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --text-muted: #6b7280;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-light: rgba(124, 58, 237, 0.15);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.12);
  --border: #2a3550;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon { font-size: 28px; }
.logo h1 { font-size: 20px; font-weight: 700; }

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

#searchInput {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius);
  width: 260px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
#searchInput:focus { border-color: var(--accent); }

main {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 24px;
  padding: 24px;
  min-height: calc(100vh - 60px);
}

/* Sidebar */
#sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 84px;
  align-self: flex-start;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 12px 8px;
}

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

.sidebar-section li {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.sidebar-section li:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-section li.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* Content */
#content {
  flex: 1;
  min-width: 0;
}

/* Entry Cards */
.entry-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.entry-card:hover { border-color: var(--accent); }

.entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.entry-title {
  font-size: 16px;
  font-weight: 600;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.entry-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.entry-badge.added { background: var(--green-bg); color: var(--green); }
.entry-badge.changed { background: var(--blue-bg); color: var(--blue); }
.entry-badge.removed { background: var(--red-bg); color: var(--red); }
.entry-badge.fixed { background: var(--orange-bg); color: var(--orange); }

.entry-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.entry-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.entry-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.entry-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.entry-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.entry-actions .btn {
  padding: 5px 12px;
  font-size: 12px;
}

/* Buttons */
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-edit {
  background: var(--blue-bg);
  color: var(--blue);
}
.btn-edit:hover { background: rgba(59,130,246,0.25); }

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h2 { font-size: 18px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }

form {
  padding: 20px 24px 24px;
}

.form-group {
  margin-bottom: 16px;
  flex: 1;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

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

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* Empty State */
#emptyState {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 16px;
}

/* Date group headers */
.date-group-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Responsive */
@media (max-width: 768px) {
  main { flex-direction: column; padding: 16px; }
  #sidebar { width: 100%; position: static; max-height: none; }
  .header-inner { flex-wrap: wrap; }
  #searchInput { width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
}
