* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: flex; flex-direction: column; }
body { font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: #f4f5f7; color: #1d2330; }
a { color: #2457c5; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
button, input, select, textarea { font: inherit; }
button { padding: 5px 12px; border: 1px solid #c3c8d2; background: #fff; border-radius: 6px; cursor: pointer; }
button:hover { background: #eef1f6; }
button.primary { background: #2457c5; border-color: #2457c5; color: #fff; }
button.primary:hover { background: #1c47a6; }
button.danger { color: #b42318; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], select, textarea {
  padding: 5px 8px; border: 1px solid #c3c8d2; border-radius: 6px; background: #fff;
}
textarea { width: 100%; min-height: 90px; font-family: ui-monospace, monospace; }

#nav { display: flex; gap: 18px; align-items: center; padding: 10px 20px; background: #1d2330; color: #fff; }
#nav a { color: #d6dcea; }
#nav a.active { color: #fff; font-weight: 600; }
#nav .sp { flex: 1; }
#nav button { background: transparent; color: #d6dcea; border-color: #4a5366; }

#view { padding: 20px; width: 100%; max-width: 1200px; margin: 0 auto; }
#view.full { padding: 0; max-width: none; flex: 1; min-height: 0; }

.card { background: #fff; border: 1px solid #e1e4ea; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e1e4ea; border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eef0f4; vertical-align: top; }
th { background: #f8f9fb; font-weight: 600; font-size: 13px; color: #505a6c; }
tr:last-child td { border-bottom: 0; }
.muted { color: #6b7385; font-size: 13px; }
.err { color: #b42318; white-space: pre-wrap; }
.ok { color: #127a3a; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f4; }
.badge.done { background: #dcf5e4; color: #127a3a; }
code, pre { font-family: ui-monospace, monospace; font-size: 12.5px; }
pre { background: #1d2330; color: #e6e9f0; padding: 12px; border-radius: 6px; overflow: auto; }
.progress { height: 6px; background: #eef0f4; border-radius: 3px; overflow: hidden; width: 220px; }
.progress > div { height: 100%; background: #2457c5; width: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; margin: 0 6px 6px 0; border: 1px solid #c3c8d2; border-radius: 14px; background: #f8f9fb; }
.chip button { padding: 0 6px; border: 0; background: transparent; }
.chip button[data-rm] { color: #b42318; }
.login { max-width: 320px; margin: 80px auto; }
.login input { width: 100%; margin-bottom: 10px; }

/* annotator */
.ann { display: flex; flex-direction: column; height: 100%; }
.ann-top { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: #fff; border-bottom: 1px solid #e1e4ea; flex-wrap: wrap; }
.ann-top .idx { width: 80px; }
.ann-top .fname { font-family: ui-monospace, monospace; font-size: 12.5px; color: #505a6c; }
.ann-top .status { margin-left: auto; font-size: 13px; }
.ann-body { flex: 1; display: flex; min-height: 0; }
.ann-canvas-wrap { flex: 1; position: relative; background: #2a2f3a; overflow: hidden; }
.ann-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ann-side { width: 260px; background: #fff; border-left: 1px solid #e1e4ea; overflow-y: auto; padding: 10px 12px; }
.ann-side h4 { margin: 10px 0 6px; font-size: 13px; color: #505a6c; }
.cls { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 5px; cursor: pointer; }
.cls:hover { background: #f1f3f7; }
.cls.active { background: #e3ebfb; font-weight: 600; }
.cls .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.cls .key { margin-left: auto; font-size: 11px; color: #6b7385; }
.bx { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.bx:hover { background: #f1f3f7; }
.bx.sel { background: #e3ebfb; }
.bx .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.bx .dim { margin-left: auto; color: #6b7385; font-size: 12px; }
.bx button { padding: 0 6px; border: 0; background: transparent; color: #b42318; }
.help { margin-top: 14px; font-size: 12px; color: #6b7385; line-height: 1.6; }
.help b { color: #1d2330; font-weight: 600; }