:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #20242b;
  --muted: #69707d;
  --line: #d9dde5;
  --accent: #2167d4;
  --accent-weak: #e8f0ff;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: #244b83;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
}

.user-badge {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
}

button:hover {
  border-color: #9aa6ba;
}

button.primary,
.class-btn.active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: #123d82;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.project-controls {
  display: flex;
  gap: 8px;
  align-items: end;
}

.project-controls label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.project-controls input,
.project-controls select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(420px, 1fr) 280px;
  gap: 12px;
  height: calc(100vh - 70px);
  padding: 12px;
}

.admin-layout {
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 420px) 360px;
}

.sidebar,
.rightbar {
  min-width: 0;
  overflow: auto;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.panel + .panel {
  margin-top: 12px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 650;
}

.panel.compact {
  font-size: 13px;
  color: var(--muted);
}

.panel.compact ul {
  margin: 0;
  padding-left: 18px;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.admin-form input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.admin-form select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.inline-check {
  display: flex !important;
  align-items: center;
  grid-template-columns: unset;
}

.inline-check input {
  min-height: auto;
}

.upload {
  display: block;
  border: 1px dashed #aab4c4;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  color: #244b83;
  background: #f8fbff;
  cursor: pointer;
  margin-bottom: 10px;
}

.upload input {
  display: none;
}

.image-list,
.annotation-list {
  display: grid;
  gap: 6px;
}

.image-row,
.annotation-row {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
  border-radius: 6px;
  padding: 8px;
}

.image-row.active,
.annotation-row.active {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  font-size: 12px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.class-tools,
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.class-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.canvas-shell {
  position: relative;
  overflow: auto;
  background: #2a2f39;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 360px;
  display: grid;
  place-items: center;
}

canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #1f2430;
  cursor: crosshair;
}

.empty-state {
  position: absolute;
  color: #e7ebf3;
  background: rgba(0, 0, 0, 0.35);
  padding: 10px 12px;
  border-radius: 6px;
}

.hidden {
  display: none;
}

.danger {
  color: var(--danger);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 220px minmax(360px, 1fr);
  }

  .admin-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .rightbar {
    display: none;
  }
}
