/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  background: #fff;
  color: #111;
  margin: 0;
}

/* ── Top nav ── */
.topnav {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid #ccc;
  background: #f5f5f5;
  padding: 0 12px;
  height: 36px;
}
.topnav .brand {
  font-weight: 600;
  font-size: 13px;
  color: #111;
  text-decoration: none;
  margin-right: 16px;
}
.topnav a {
  font-size: 13px;
  color: #333;
  text-decoration: none;
  padding: 0 10px;
  height: 36px;
  display: flex;
  align-items: center;
  border-right: 1px solid #ddd;
}
.topnav a:first-of-type { border-left: 1px solid #ddd; }
.topnav a:hover, .topnav a.active { background: #e8e8e8; }
.topnav .spacer { flex: 1; }
.topnav .user-info { font-size: 12px; color: #666; padding: 0 10px; }

/* ── Page layout ── */
.page { padding: 10px 14px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #ccc;
  margin-bottom: 0;
}
.tabs button {
  font-size: 12px;
  padding: 4px 14px;
  border: 1px solid #ccc;
  border-bottom: none;
  background: #f5f5f5;
  cursor: pointer;
  margin-right: 2px;
  margin-bottom: -1px;
  color: #444;
}
.tabs button.active {
  background: #fff;
  color: #000;
  font-weight: 600;
  border-color: #ccc;
  border-bottom-color: #fff;
  z-index: 1;
}
.tabs .count {
  display: inline-block;
  background: #ddd;
  color: #555;
  font-size: 11px;
  border-radius: 8px;
  padding: 0 5px;
  margin-left: 4px;
}
.tabs .count.red { background: #fcc; color: #900; }
.tabs .count.yellow { background: #fec; color: #750; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Excel-style table ── */
.xtable-wrap {
  border: 1px solid #ccc;
  border-top: none;
  overflow-x: auto;
}
.xtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.xtable th {
  background: #eee;
  border: 1px solid #ccc;
  padding: 3px 6px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.xtable td {
  border: 1px solid #ddd;
  padding: 3px 6px;
  white-space: nowrap;
}
.xtable tbody tr:hover td { background: #f0f4ff; }
.xtable tbody tr.row-overdue td { background: #fff0f0; }
.xtable tbody tr.row-warn td    { background: #fffbe6; }
.xtable tbody tr.row-done td    { color: #888; }

/* ── Status & direction pills ── */
.pill {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.pill-chromo { background: #dbeafe; color: #1d4ed8; }
.pill-chem   { background: #ede9fe; color: #5b21b6; }
.pill-assigned   { background: #f3f4f6; color: #374151; }
.pill-progress   { background: #dbeafe; color: #1e40af; }
.pill-done       { background: #d1fae5; color: #065f46; }
.pill-overdue    { background: #fee2e2; color: #991b1b; }
.pill-critical   { background: #fee2e2; color: #991b1b; }
.pill-urgent     { background: #fef3c7; color: #92400e; }
.pill-normal     { background: #f3f4f6; color: #6b7280; }

/* ── Action buttons ── */
.btn-go {
  font-size: 11px;
  padding: 1px 8px;
  border: 1px solid #aaa;
  background: #f9f9f9;
  color: #333;
  cursor: pointer;
  border-radius: 2px;
  text-decoration: none;
}
.btn-go:hover { background: #e8e8e8; }

/* ── Top action bar ── */
.actionbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
}
.actionbar .btn-add {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid #aaa;
  background: #f5f5f5;
  color: #222;
  cursor: pointer;
  border-radius: 2px;
  text-decoration: none;
}
.actionbar .btn-add:hover { background: #e4e4e4; }
.actionbar .stat {
  font-size: 12px;
  color: #555;
  margin-left: 8px;
}
.actionbar .stat b { color: #c00; }

/* ── Forms ── */
.form-page { max-width: 480px; padding: 14px; }
.form-page h2 { font-size: 15px; margin: 0 0 14px; }
.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 12px; color: #555; margin-bottom: 3px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  font-size: 13px;
  padding: 4px 6px;
  border: 1px solid #bbb;
  border-radius: 2px;
  background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #4a7feb;
  box-shadow: 0 0 0 2px rgba(74,127,235,.15);
}
.form-actions { display: flex; gap: 8px; margin-top: 14px; }
.form-actions .btn-primary {
  font-size: 13px; padding: 4px 14px;
  background: #2563eb; color: #fff;
  border: none; border-radius: 2px; cursor: pointer;
}
.form-actions .btn-primary:hover { background: #1d4ed8; }
.form-actions .btn-cancel {
  font-size: 13px; padding: 4px 14px;
  background: #f3f3f3; color: #333;
  border: 1px solid #bbb; border-radius: 2px;
  text-decoration: none; cursor: pointer;
}
.form-actions .btn-cancel:hover { background: #e8e8e8; }

/* ── Detail page ── */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 14px; }
@media(max-width:700px){ .detail-grid { grid-template-columns: 1fr; } }
.detail-box { border: 1px solid #ccc; padding: 10px 14px; }
.detail-box h3 { font-size: 13px; font-weight: 600; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid #eee; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 12.5px; }
.dl dt { color: #666; }
.dl dd { margin: 0; }

/* ── History list ── */
.hist-list { font-size: 12px; }
.hist-item { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #f0f0f0; }
.hist-item:last-child { border-bottom: none; }
.hist-time { color: #999; white-space: nowrap; margin-left: 10px; }

/* ── Status change panel ── */
.status-panel select,
.status-panel textarea { width: 100%; font-size: 12.5px; padding: 4px 6px; border: 1px solid #bbb; border-radius: 2px; margin-bottom: 8px; }
.status-panel .btn-save {
  width: 100%; padding: 5px; font-size: 13px;
  background: #2563eb; color: #fff;
  border: none; border-radius: 2px; cursor: pointer;
}
.status-panel .btn-save:hover { background: #1d4ed8; }

/* ── Flash messages ── */
.flash { font-size: 12.5px; padding: 6px 10px; border: 1px solid #ccc; margin-bottom: 8px; border-radius: 2px; }
.flash-success { background: #f0fff4; border-color: #6ee7b7; color: #065f46; }
.flash-warning { background: #fffbeb; border-color: #fcd34d; color: #78350f; }
.flash-danger  { background: #fff1f2; border-color: #fca5a5; color: #991b1b; }
.flash-info    { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }

/* ── Breadcrumb ── */
.bc { font-size: 12px; color: #888; margin-bottom: 10px; }
.bc a { color: #555; text-decoration: none; }
.bc a:hover { text-decoration: underline; }
.bc span { margin: 0 4px; }
