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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */

#sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  padding: 20px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

#sidebar h1 {
  font-size: 17px;
  font-weight: 700;
}

#add-form {
  display: flex;
  gap: 6px;
}

#project-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

#project-input:focus {
  border-color: #4a9;
}

#add-form button {
  padding: 6px 12px;
  background: #4a9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

#add-form button:hover {
  background: #3a8;
}

#project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.1s;
}

.project-item:hover {
  background: #f5f5f5;
}

.project-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-remove {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.15s;
}

.project-remove:hover {
  color: #c44;
}

.project-error {
  color: #c44;
  font-size: 11px;
}

#auto-refresh {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
}

#auto-refresh label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

#auto-toggle {
  accent-color: #4a9;
}

#auto-interval {
  padding: 2px 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 11px;
  outline: none;
}

#reload-btn {
  padding: 8px;
  background: #4a9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

#reload-btn:hover:not(:disabled) {
  background: #3a8;
}

#reload-btn:disabled {
  background: #ccc;
  cursor: default;
}

/* ── Main ── */

main {
  flex: 1;
  margin-left: 220px;
  max-width: 680px;
  padding: 24px 20px;
}

#status {
  text-align: center;
  color: #888;
  padding: 40px 0;
  font-size: 14px;
}

#status:empty {
  display: none;
}

#status.error {
  color: #c44;
}

/* ── Timeline ── */

.tl-date-header {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  padding: 16px 0 6px;
  border-bottom: 1px solid #e8e8e8;
  margin-bottom: 10px;
}

.tl-date-header:first-child {
  padding-top: 0;
}

.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 10px;
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.card:hover {
  border-color: #4a9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 0;
}

.card-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  color: #fff;
  white-space: nowrap;
}

.card-time {
  font-size: 11px;
  color: #aaa;
  margin-left: auto;
}

.card-body {
  padding: 6px 16px 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #222;
}

.card-lines {
  font-size: 12.5px;
  color: #666;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-line {
  margin-bottom: 1px;
}

.card-line-bracket {
  color: #4a9;
  text-decoration: underline;
}

.card-more {
  color: #aaa;
}

/* ── Loading ── */

.loading {
  text-align: center;
  padding: 40px 0;
}

.loading::after {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top-color: #4a9;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ── */

@media (max-width: 700px) {
  #sidebar {
    width: 180px;
    padding: 16px 12px;
  }
  main {
    margin-left: 180px;
    padding: 16px 12px;
  }
}
