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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #222;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

header {
  padding: 16px 0 8px;
}

header h1 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #ddd;
}

.tab {
  padding: 8px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab.active {
  border-bottom-color: #2563eb;
  color: #2563eb;
  font-weight: 600;
}

.tab-content { display: none; padding: 16px 0; }
.tab-content.active { display: block; }
.hidden { display: none !important; }

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar button {
  padding: 8px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.toolbar button:hover { background: #e8e8e8; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 95%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-content h3 { margin-bottom: 4px; }

.modal-content label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 500;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

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

button.primary {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

button.primary:hover { background: #1d4ed8; }

.btn-close {
  background: none;
  border: 1px solid #ccc;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

/* Entry rows */
.entry-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 6px;
  align-items: end;
  margin-bottom: 6px;
}

.entry-row input { width: 100%; }

.entry-row .remove-btn {
  background: none;
  border: none;
  color: #e11d48;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px 8px;
}

/* Autocomplete */
.ac-wrapper { position: relative; }

.ac-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-height: 150px;
  overflow-y: auto;
  z-index: 200;
}

.ac-list div {
  padding: 6px 10px;
  cursor: pointer;
}

.ac-list div:hover { background: #eef; }

/* Session cards */
.session-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.session-card h4 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.session-card .source-badge {
  font-size: 0.75rem;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 10px;
}

.session-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.session-card th { text-align: left; padding: 4px 8px; border-bottom: 1px solid #eee; }
.session-card td { padding: 4px 8px; }

.session-card .card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.session-card .card-actions button {
  font-size: 0.85rem;
  padding: 4px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.session-card .card-actions button.danger {
  color: #e11d48;
  border-color: #e11d48;
}

.session-card .card-actions button.complete-btn {
  color: #16a34a;
  border-color: #16a34a;
}

.completed-badge {
  font-size: 0.75rem;
  background: #d1fae5;
  color: #065f46;
  padding: 2px 8px;
  border-radius: 10px;
}

#ai-loading {
  color: #2563eb;
  font-style: italic;
}
