* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 24px;
  color: #1a1a1a;
  background: #f7f7f8;
}
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
header h1 { margin: 0; font-size: 22px; }
.stats { color: #666; font-size: 14px; }

.filters {
  background: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #e5e5e7;
  margin-bottom: 16px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.filters label { font-size: 13px; color: #555; }
.filters select {
  margin-left: 6px;
  padding: 4px 8px;
  font-size: 14px;
}

table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0f2;
  vertical-align: top;
}
th {
  background: #fafafa;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: #666;
}
tr:last-child td { border-bottom: none; }
tr.status-cancelled td { color: #999; }
tr.status-cancelled .task-text { text-decoration: line-through; }

tr.deadline-today td { background: #fff5f7; }
tr.deadline-overdue td { background: #ffd8d8; }
.muted { color: #888; font-size: 13px; }
.task-text { max-width: 480px; }
.src-link { margin-left: 6px; text-decoration: none; color: #666; }

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.badge.llm { background: #eef; color: #449; }

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-pill.status-waiting { background: #f1f3f5; color: #555; }
.status-pill.status-in_progress { background: #fff4d6; color: #8b6500; }
.status-pill.status-done { background: #e7f6ec; color: #1a7f3e; }
.status-pill.status-cancelled { background: #fde2e2; color: #a02; }
.status-pill.status-open { background: #f1f3f5; color: #555; } /* legacy fallback */

button {
  background: #1a73e8;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
button:hover { background: #1558c0; }
tr.status-done button { background: #888; }
tr.status-done button:hover { background: #555; }

button.del {
  background: #d33;
  padding: 4px 8px;
  margin-left: 4px;
  font-weight: bold;
  line-height: 1;
}
button.del:hover { background: #a02; }
tr.status-done button.del { background: #d33; }
tr.status-done button.del:hover { background: #a02; }

.empty { color: #888; padding: 40px; text-align: center; background: #fff; border-radius: 8px; }

.nav {
  margin-bottom: 20px;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
}
.nav a {
  text-decoration: none;
  color: #1a73e8;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 6px;
}
.nav a.active { background: #1a73e8; color: white; }
.nav a:not(.active):hover { background: #e8f0fe; }

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.inline-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.inline-form button { padding: 8px 16px; }

.card {
  background: #fff;
  padding: 16px 20px;
  border-radius: 8px;
  border: 1px solid #e5e5e7;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 12px 0; font-size: 16px; }

.form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr auto;
  gap: 12px;
  align-items: end;
}
.form-grid label { font-size: 13px; color: #555; display: flex; flex-direction: column; gap: 4px; }
.form-grid input {
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.form-grid button {
  padding: 8px 16px;
  font-size: 14px;
}
.hint { color: #888; font-size: 12px; margin-top: 12px; }

.bulk-actions {
  background: #fff;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.bulk-actions .sep { color: #ccc; }
.bulk-actions button { padding: 6px 12px; font-size: 13px; }
.bulk-actions button[value="reject"] { background: #d33; }
.bulk-actions button[value="reject"]:hover { background: #a02; }
.bulk-actions button[type="button"] { background: #888; }

.kind-pill {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500;
}
.kind-pill.kind-task { background: #e7f6ec; color: #1a7f3e; }
.kind-pill.kind-change { background: #fff4d6; color: #8b6500; }

.status-pill.bf-pending { background: #f0f0f0; color: #555; }
.status-pill.bf-fetching, .status-pill.bf-analyzing { background: #fff4d6; color: #8b6500; }
.status-pill.bf-done { background: #e7f6ec; color: #1a7f3e; }
.status-pill.bf-error { background: #fde2e2; color: #a02; }

.small { font-size: 12px; }
.error-box { background: #fde2e2; color: #a02; padding: 12px; border-radius: 8px; }
h2 { font-size: 18px; margin-top: 24px; }

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  margin: 0;
}
.login-card {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.login-card h1 { margin: 0 0 20px 0; font-size: 22px; text-align: center; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #555; }
.login-card input {
  padding: 8px 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.login-card button {
  margin-top: 8px;
  padding: 10px;
  font-size: 15px;
  font-weight: 500;
}

.logout-btn {
  background: transparent;
  color: #888;
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid #ddd;
}
.logout-btn:hover { background: #f0f0f0; color: #333; }

tr.login-fail td:first-child { border-left: 3px solid #d33; }
tr.login-ok td:first-child { border-left: 3px solid #1a7f3e; }

/* tasks table — two-line cells & inline controls */
.id-link, .task-link {
  color: inherit;
  text-decoration: none;
}
.id-link:hover, .task-link:hover { text-decoration: underline; }

.cell-project a, .cell-created a {
  color: #1a73e8;
  text-decoration: none;
}
.cell-project a:hover, .cell-created a:hover { text-decoration: underline; }

.cell-project .small, .cell-created .small {
  margin-top: 2px;
  font-size: 12px;
}

.cell-deadline input[type="date"] {
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  width: 130px;
}
.cell-deadline .small { margin-top: 2px; font-size: 11px; }

.cell-actions button {
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1;
}

.cell-assignee select,
.cell-status select {
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  max-width: 160px;
}
.cell-assignee a { color: #1a73e8; text-decoration: none; }
.cell-assignee a:hover { text-decoration: underline; }

.cell-status.status-waiting select { background: #f1f3f5; color: #555; }
.cell-status.status-in_progress select { background: #fff4d6; color: #8b6500; }
.cell-status.status-done select { background: #e7f6ec; color: #1a7f3e; }
.cell-status.status-cancelled select { background: #fde2e2; color: #a02; }

/* detail page */
.back-link {
  color: #1a73e8;
  text-decoration: none;
  font-size: 14px;
}
.back-link:hover { text-decoration: underline; }

.detail-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.detail-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #555;
}
.detail-form label.full { grid-column: 1 / -1; }
.detail-form input, .detail-form select, .detail-form textarea {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
}
.detail-form textarea { resize: vertical; }
.form-actions { display: flex; gap: 12px; }
.form-actions button { padding: 8px 16px; font-size: 14px; }

.meta-card h2 { margin: 0 0 12px 0; font-size: 16px; }
.meta {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 14px;
}
.meta dt { color: #888; }
.meta dd { margin: 0; }
.meta a { color: #1a73e8; text-decoration: none; }
.meta a:hover { text-decoration: underline; }
