:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #222;
  --muted: #6a7280;
  --line: #d9dfe7;
  --accent: #0b5cab;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.container {
  width: min(1800px, 98vw);
  margin: 0 auto;
}

.topbar {
  background: #0f172a;
  color: #fff;
}

.topbar a {
  color: #fff;
  text-decoration: none;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.brand {
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

.nav-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
}

.nav-with-icon i {
  width: 15px;
  height: 15px;
}

.subnav {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.subnav .container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
}

.subnav a {
  text-decoration: none;
  color: #334155;
  border: 1px solid transparent;
}

.subnav a:hover {
  border-color: var(--line);
  background: #f8fafc;
}

main.container {
  padding: 18px 0 40px;
}

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

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

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.narrow {
  max-width: 420px;
  margin: 40px auto;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.metric h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.metric strong {
  font-size: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

textarea {
  min-height: 72px;
}

button,
.button-link {
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  text-decoration: none;
  cursor: pointer;
}

.button-link.secondary,
button.secondary {
  background: #fff;
  color: #1e293b;
  border-color: #cbd5e1;
}

button.small,
.button-link.small {
  padding: 4px 8px;
  font-size: 0.82rem;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.inline-form input,
.inline-form select {
  max-width: 260px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.table-first td,
.table-first th {
  white-space: nowrap;
}

.table-first td.wrapped,
.table-first .wrapped {
  white-space: normal;
  min-width: 180px;
}

tr.row-grey { background: #f8fafc; }
tr.row-orange { background: #fff7ed; }
tr.row-blue { background: #eff6ff; }
tr.row-green { background: #f0fdf4; }
tr.row-red { background: #fef2f2; }
tr.row-purple { background: #f5f3ff; }

.new-row {
  background: #f8fbff;
}

.new-row input,
.new-row select,
.new-row textarea {
  min-width: 92px;
}

.new-row textarea {
  min-height: 40px;
}

.chip {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 3px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 0.82rem;
  background: #f8fafc;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.78rem;
  color: #fff;
}

.pill.grey { background: #64748b; }
.pill.orange { background: #d97706; }
.pill.blue { background: #2563eb; }
.pill.green { background: #15803d; }
.pill.red { background: #b91c1c; }
.pill.purple { background: #7c3aed; }

.message {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.message.success {
  border-color: #16a34a;
}

.message.warning,
.message.error {
  border-color: #dc2626;
}

.warning {
  background: #fff7ed;
}

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

.edit-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.side-panel {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.inline-status-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.inline-status-form select {
  min-width: 140px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.grey { background: #64748b; }
.status-dot.orange { background: #d97706; }
.status-dot.blue { background: #2563eb; }
.status-dot.green { background: #15803d; }
.status-dot.red { background: #b91c1c; }
.status-dot.purple { background: #7c3aed; }

.scene-text {
  background: #f8fafc;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  padding: 10px;
  line-height: 1.45;
}

.hint-row {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.actions {
  margin-bottom: 8px;
}

.progress-board {
  padding: 0;
  overflow: hidden;
}

.progress-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 0;
  background: #0d0d0d;
  color: #fff;
  font-weight: 700;
}

.progress-summary > div {
  padding: 10px 14px;
  border-right: 1px solid #252525;
}

.progress-summary > div:last-child {
  border-right: 0;
}

.progress-grid-wrap {
  overflow-x: auto;
  background: #cfcfcf;
  padding: 8px;
}

.progress-grid {
  width: auto;
  border-collapse: collapse;
}

.progress-grid td {
  border: 1px solid #cfcfcf;
  min-width: 40px;
  height: 30px;
  text-align: center;
  vertical-align: middle;
  background: #f7f7f7;
  font-weight: 600;
}

.progress-grid td a {
  color: #222;
  text-decoration: none;
}

.progress-percent {
  min-width: 120px !important;
  background: #efefef !important;
  color: #2f2f2f;
  font-weight: 700;
  text-align: right !important;
  padding-right: 10px;
}

.progress-percent.active {
  background: #9ce28e !important;
}

.ep-label {
  min-width: 120px !important;
  background: #f6df8f !important;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: 0;
}

.scene-token {
  background: #f9f9f9 !important;
}

.scene-token.material {
  background: #f0bf75 !important;
}

.scene-token.issue {
  box-shadow: inset 0 0 0 2px #ef4444;
}

.scene-check {
  background: #f5f5f5 !important;
  color: #1f2937;
  font-size: 1.05rem;
}

.scene-check.done {
  background: #b7e7d2 !important;
  font-weight: 800;
}

.progress-spacer td {
  border: 0 !important;
  height: 22px !important;
  background: #cfcfcf !important;
}

.scene-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 94vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid #d1d5db;
  box-shadow: -8px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.scene-drawer-inner {
  height: 100%;
  overflow-y: auto;
  padding: 14px 16px 24px;
}

.scene-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scene-drawer h2 {
  margin: 0;
}

@media (max-width: 980px) {
  .split,
  .edit-layout {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .progress-summary {
    grid-template-columns: 1fr 1fr;
  }
}
