* { box-sizing: border-box; }
:root {
  --brand-accent: #b9ff32;
  --brand-teal: #0f8f7c;
  --brand-teal-dark: #062f2b;
  --brand-ink: #031f1d;
  --brand-soft: #f3f5f4;
  --brand-border: #d9dfdd;
  --surface-tint: #f4f5f4;
  --text-strong: #111827;
  --text-muted: #52606d;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2933;
  background: var(--surface-tint);
}
button, select, input {
  font: inherit;
}
button {
  border: 1px solid #b8c2cc;
  background: #fff;
  padding: 6px 10px;
  cursor: pointer;
}
button:hover {
  border-color: var(--brand-teal);
}
button.active {
  background: #f3f5f4;
  color: var(--brand-teal-dark);
  border-color: var(--brand-teal);
  box-shadow: inset 0 -2px 0 var(--brand-accent);
}
.hidden { display: none !important; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-panel {
  width: 320px;
  display: grid;
  gap: 10px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--brand-border);
}
.login-logo {
  width: min(220px, 100%);
  max-height: 42px;
  object-fit: contain;
  object-position: left center;
}
.login-panel h1 {
  margin: 0 0 8px;
  font-size: 22px;
}
.login-panel input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #bcccdc;
}
#loginError {
  min-height: 18px;
  margin: 0;
  color: #b91c1c;
}
.app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}
header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--brand-border);
  background: #fff;
  flex-wrap: wrap;
}
.help-tip {
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #475569;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  height: 18px;
  justify-content: center;
  width: 18px;
}
.session-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding-right: 4px;
  font-weight: 700;
  color: var(--brand-ink);
  white-space: nowrap;
}
.app-brand img {
  width: 34px;
  height: 22px;
  object-fit: contain;
}
.role-mode-badge {
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  text-transform: uppercase;
}
body.worker-mode .role-mode-badge {
  border-color: #99f6e4;
  color: #0f766e;
}
body.reviewer-mode .role-mode-badge {
  border-color: #bfdbfe;
  color: #1d4ed8;
}
body.admin-mode .role-mode-badge {
  border-color: #ddd6fe;
  color: #6d28d9;
}
.header-label {
  font-size: 12px;
  color: #52606d;
}
.attendance-status {
  min-width: 92px;
  text-align: center;
  border: 1px solid var(--brand-border);
  background: #f8fafc;
  color: #52606d;
  padding: 5px 8px;
  font-size: 12px;
}
.attendance-status.active {
  border-color: var(--brand-border);
  background: #f7fee7;
  color: var(--brand-teal-dark);
}
#status {
  flex: 1 0 100%;
  min-height: 24px;
  margin-left: 0;
  color: #52606d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#status.status-error {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 4px 8px;
}
body.worker-mode .debug-control,
body.worker-mode .admin-control {
  display: none !important;
}
body.admin-mode .debug-control {
  display: none !important;
}
@media (max-width: 900px) {
  .session-actions {
    margin-left: 0;
  }
}
main {
  min-height: 0;
  display: grid;
  grid-template-columns: var(--left-panel-width, 280px) 6px minmax(260px, 1fr) 6px var(--right-panel-width, 260px);
}
.sidebar, .objects {
  min-width: 0;
  min-height: 0;
  padding: 10px;
  background: #fff;
  border-right: 1px solid var(--brand-border);
}
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.objects {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: none;
  border-left: 1px solid var(--brand-border);
}
.toolbar {
  display: flex;
  gap: 6px;
  margin: 10px 0;
  flex-wrap: wrap;
}
.shortcuts {
  container-type: inline-size;
  flex: 0 0 auto;
  margin: 10px 0;
  padding: 8px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  overflow: visible;
}
.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.shortcuts-header h2 {
  margin: 0;
}
.shortcuts-header button {
  padding: 3px 8px;
  font-size: 12px;
}
.shortcuts dl {
  display: grid;
  grid-template-columns: minmax(72px, 0.42fr) minmax(0, 1fr);
  gap: 4px 8px;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}
.shortcuts dt {
  color: #111827;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.shortcuts dd {
  margin: 0;
  color: #4b5563;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
@container (max-width: 230px) {
  .shortcuts dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .shortcuts dd {
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
  }
}
.work-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 150px;
  margin: 10px 0;
  border: 1px solid #e5e7eb;
  background: #fff;
  max-height: min(300px, 36vh);
  overflow: hidden;
}
.work-tabs {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #e5e7eb;
}
.work-tabs button {
  border: none;
  border-right: 1px solid #e5e7eb;
  background: #f8fafc;
  padding: 8px 6px;
  font-size: 13px;
}
.work-tabs button:last-child {
  border-right: none;
}
.work-tabs button.active {
  background: #fff;
  color: var(--brand-teal-dark);
  box-shadow: inset 0 -2px 0 var(--brand-accent);
}
.work-pane {
  min-height: 0;
  flex: 1 1 auto;
  display: none;
  flex-direction: column;
  padding: 8px;
}
.work-pane.active {
  display: flex;
}
.job-stats,
.job-meta {
  color: #64748b;
  font-size: 12px;
}
.job-help {
  color: #64748b;
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 6px;
}
#claimJobBtn {
  flex: none;
  width: 100%;
  margin: 7px 0;
}
.job-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}
.job-title {
  font-weight: 700;
  color: #111827;
}
.job-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.job-actions button {
  padding: 4px 7px;
  font-size: 12px;
}
h2 {
  font-size: 14px;
  margin: 14px 0 8px;
}
.object-list-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 58%;
  overflow: hidden;
}
.object-list-panel h2 {
  flex: none;
}
#objectList {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}
.image-list-panel {
  min-height: 120px;
  display: flex;
  flex: 0 1 42%;
  flex-direction: column;
  border-top: 1px solid var(--brand-border);
  margin-top: 8px;
  padding-top: 4px;
}
.image-list-panel h2 {
  flex: none;
}
#imageList {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  border-top: 1px solid #eef2f7;
}
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
li {
  padding: 6px 7px;
  border-bottom: 1px solid #eef2f7;
  cursor: pointer;
}
li.active {
  background: #eef2f1;
  border-left: 3px solid var(--brand-accent);
}
li.muted {
  color: #64748b;
  cursor: default;
}
#imageList li.excluded {
  color: #64748b;
  cursor: default;
  text-decoration: line-through;
}
.object-summary {
  font-size: 12px;
  line-height: 1.35;
  background: #f8fafc;
}

.panel-resizer {
  min-width: 6px;
  cursor: col-resize;
  background: #e5e7eb;
  position: relative;
  z-index: 2;
}
.panel-resizer::after {
  content: "";
  position: absolute;
  inset: 0 2px;
  background: #cbd5e1;
}
.panel-resizer:hover,
body.resizing-panels .panel-resizer {
  background: #cfd8d5;
}
.panel-resizer:hover::after,
body.resizing-panels .panel-resizer::after {
  background: var(--brand-teal);
}
body.resizing-panels {
  cursor: col-resize;
  user-select: none;
}
body.resizing-panels iframe,
body.resizing-panels canvas {
  pointer-events: none;
}

.canvas-wrap {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #111827;
  position: relative;
}
#canvas {
  display: block;
  width: 100%;
  height: 100%;
}
select {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #bcccdc;
  background: #fff;
}
#datasetSelect {
  max-width: 220px;
}
#imageFolderInput,
#labelFolderInput {
  width: min(360px, 28vw);
  min-width: 220px;
  max-width: 520px;
  padding: 6px 8px;
  border: 1px solid #bcccdc;
  background: #f8fafc;
}
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.42);
  z-index: 10;
}
.modal-panel {
  width: min(720px, 92vw);
  max-height: 82vh;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  background: #fff;
  border: 1px solid #cbd5e1;
}
.modal-header,
.folder-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
}
.modal-header button {
  margin-left: auto;
}
.folder-current {
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f8fafc;
  word-break: break-all;
}
.folder-list {
  min-height: 260px;
  max-height: 56vh;
  overflow: auto;
  user-select: none;
}
.folder-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: default;
}
.folder-list li:hover {
  background: #f3f5f4;
}
.folder-list li.active {
  background: #eef2f1;
  border-left: 3px solid var(--brand-accent);
}
.folder-open-btn {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}
.folder-open-btn:hover {
  color: var(--brand-teal);
  text-decoration: underline;
}
.folder-open-btn:active {
  transform: translateY(1px);
}
.folder-meta {
  flex: none;
  color: #64748b;
  font-size: 12px;
}
.excluded-image-name {
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.class-modal-panel {
  width: min(420px, 92vw);
  grid-template-rows: auto 1fr;
}
.class-modal-list {
  margin: 0;
  padding: 8px;
  list-style: none;
  max-height: 64vh;
  overflow: auto;
}
.class-modal-list li + li {
  margin-top: 4px;
}
.class-modal-list button {
  width: 100%;
  padding: 8px 10px;
  text-align: left;
}

.shortcut-modal-panel {
  width: min(560px, 92vw);
  grid-template-rows: auto 1fr;
}
.shortcut-modal-body {
  min-height: 280px;
  max-height: 70vh;
  overflow: auto;
  padding: 8px;
}
.shortcut-rows {
  display: grid;
  gap: 6px;
}
.shortcut-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}
.shortcut-label {
  font-weight: 700;
  color: #111827;
}
.shortcut-key {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #4b5563;
}
.shortcut-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
@media (max-width: 560px) {
  .shortcut-row {
    grid-template-columns: 1fr;
  }
}

.brush-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #4b5563;
}
#brushSizeInput {
  width: 52px;
  padding: 5px 6px;
  border: 1px solid #bcccdc;
}
#brushDecBtn,
#brushIncBtn {
  width: 28px;
  height: 28px;
  padding: 0;
  text-align: center;
}
