* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  background: #f5f6fa;
  color: #222;
}

#app {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  background: #fff;
  border-right: 1px solid #e0e3eb;
  display: flex;
  flex-direction: column;
}
.brand {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 14px;
  color: #444;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand .progress {
  font-size: 12px;
  font-weight: 400;
  color: #888;
}

.tabs { display: flex; }
.tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: #fafbfc;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  color: #555;
  font-weight: 500;
}
.tab.active {
  background: #fff;
  border-bottom-color: #1976d2;
  color: #1976d2;
}
.tab .cnt {
  background: #e0e3eb;
  color: #555;
  border-radius: 10px;
  padding: 1px 8px;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
}
.tab.active .cnt { background: #bbdefb; color: #0d47a1; }

.list {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.list li {
  padding: 9px 14px;
  border-bottom: 1px solid #f0f1f4;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}
.list li:hover { background: #f5f9ff; }
.list li.active { background: #e3f2fd; border-left: 3px solid #1976d2; padding-left: 11px; }
.list li .pno { color: #999; font-size: 11px; flex-shrink: 0; }
.list li .pname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list li .tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  font-weight: 600;
}
.tag.html-sig { background: #fff3cd; color: #92660b; }
.tag.lbl-yes { background: #c8e6c9; color: #2e7d32; }
.tag.lbl-no { background: #ffcdd2; color: #b71c1c; }
.tag.lbl-unsure { background: #e1bee7; color: #6a1b9a; }
.tag.lbl-not_drug { background: #cfd8dc; color: #37474f; }

/* Main */
.main {
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}
.page-title {
  font-size: 36px;
  font-weight: 800;
  color: #1976d2;
  margin: 0 0 28px;
  text-align: center;
  letter-spacing: -1px;
  line-height: 1.2;
}

.header { width: 100%; max-width: 600px; margin-bottom: 20px; }
.header h1 {
  font-size: 22px;
  margin: 0 0 8px;
  text-align: center;
  word-break: keep-all;
  line-height: 1.4;
}
.meta {
  font-size: 13px;
  color: #777;
  text-align: center;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}
.meta .pno-tag { color: #999; }
.meta .cat-tag {
  background: #e8eaf6;
  color: #3f51b5;
  padding: 2px 8px;
  border-radius: 3px;
}
.meta .sig-on { color: #2e7d32; font-weight: 600; }
.meta .sig-off { color: #c62828; }

.image-wrap {
  background: #fff;
  border: 1px solid #e0e3eb;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
#product-image {
  display: block;
  max-width: 500px;
  max-height: 500px;
  width: auto;
  height: auto;
}

.buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 700px;
}
.label-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.label-row button {
  flex: 1;
  min-width: 130px;
}
.buttons button {
  padding: 14px 22px;
  font-size: 16px;
  border: 2px solid #d0d3da;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.buttons button:hover { border-color: #999; }
.buttons button kbd {
  background: #f0f1f4;
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  color: #666;
  border: 1px solid #d0d3da;
  font-weight: 500;
}

.lbl.yes.selected { background: #4caf50; color: #fff; border-color: #2e7d32; }
.lbl.yes.selected kbd { background: rgba(255,255,255,0.3); color: #fff; border-color: transparent; }
.lbl.no.selected { background: #f44336; color: #fff; border-color: #c62828; }
.lbl.no.selected kbd { background: rgba(255,255,255,0.3); color: #fff; border-color: transparent; }
.lbl.unsure.selected { background: #ab47bc; color: #fff; border-color: #6a1b9a; }
.lbl.unsure.selected kbd { background: rgba(255,255,255,0.3); color: #fff; border-color: transparent; }
.lbl.not-drug.selected { background: #607d8b; color: #fff; border-color: #37474f; }
.lbl.not-drug.selected kbd { background: rgba(255,255,255,0.3); color: #fff; border-color: transparent; }

.save {
  width: 100%;
  padding: 18px !important;
  font-size: 18px !important;
  background: #1976d2 !important;
  color: #fff !important;
  border-color: #0d47a1 !important;
}
.save kbd { background: rgba(255,255,255,0.3) !important; color: #fff !important; border-color: transparent !important; }
.save:disabled { opacity: 0.35; cursor: not-allowed; }

.hint {
  color: #999;
  font-size: 12px;
  margin-top: 8px;
}
.hint kbd {
  background: #f0f1f4;
  padding: 1px 6px;
  font-size: 11px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  border: 1px solid #d0d3da;
}