:root {
  --bg: #fbfdfc;
  --paper: #ffffff;
  --paper-soft: #f6faf8;
  --text: #121614;
  --muted: #68736e;
  --subtle: #98a5a0;
  --line: rgba(18, 22, 20, 0.09);
  --green: #18b86f;
  --green-dark: #0c8d57;
  --green-soft: #eaf8f0;
  --blue: #3478f6;
  --red: #e0445e;
  --shadow: 0 22px 70px rgba(36, 61, 48, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 6%, rgba(24, 184, 111, 0.08), transparent 24rem),
    linear-gradient(rgba(18, 22, 20, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 22, 20, 0.026) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 28px 28px, 28px 28px, auto;
  font-family:
    Inter, "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui,
    sans-serif;
  letter-spacing: 0;
}

body.has-lightbox {
  overflow: hidden;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-panel {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-panel h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.16;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.login-form,
.data-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.password-field:focus-within {
  border-color: rgba(24, 184, 111, 0.55);
  box-shadow: 0 0 0 3px rgba(24, 184, 111, 0.11);
}

.password-field input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.password-field input:focus {
  box-shadow: none;
}

.password-field button {
  min-width: 58px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--paper-soft);
  color: var(--green-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

.field-hint {
  color: var(--red);
  font-size: 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(24, 184, 111, 0.55);
  box-shadow: 0 0 0 3px rgba(24, 184, 111, 0.11);
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(20px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 26px rgba(24, 184, 111, 0.22);
}

.brand-block strong,
.brand-block small,
.user-panel span {
  display: block;
}

.brand-block small {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav button,
.text-button,
.primary-button,
.secondary-button {
  border: 0;
  cursor: pointer;
  font-weight: 760;
}

.side-nav button {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: #4e5953;
  text-align: left;
}

.side-nav button:hover,
.side-nav button.active {
  color: var(--green-dark);
  background: var(--green-soft);
}

.user-panel {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.text-button {
  margin-top: 8px;
  padding: 0;
  background: transparent;
  color: var(--green-dark);
}

.content {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.content-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 16px 0;
  background: rgba(251, 253, 252, 0.86);
  backdrop-filter: blur(18px);
}

.content-top h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.status-line {
  margin: 6px 0 0;
  color: var(--subtle);
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.range-filter {
  display: flex;
  align-items: end;
  gap: 10px;
}

.range-filter input {
  min-width: 150px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 8px;
}

.primary-button {
  color: #fff;
  background: var(--green);
  box-shadow: 0 12px 28px rgba(24, 184, 111, 0.18);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.danger-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(224, 68, 94, 0.24);
  border-radius: 8px;
  background: rgba(224, 68, 94, 0.08);
  color: var(--red);
  cursor: pointer;
  font-weight: 760;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.insight-card {
  min-height: 84px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.insight-card span {
  display: block;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 760;
}

.insight-card strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.45;
}

.panel,
.metric-card,
.stat-card,
.export-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head span,
.readonly-note {
  color: var(--subtle);
  font-size: 12px;
}

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.panel-tools input {
  min-width: 210px;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.panel-tools select {
  min-width: 118px;
  min-height: 34px;
  padding: 7px 30px 7px 10px;
  font-size: 12px;
}

.hero-role-group td {
  padding: 9px 12px;
  border-top: 1px solid #dce7e2;
  background: #f4f8f6;
  color: var(--subtle);
}

.hero-role-group strong {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  margin-right: 9px;
  border-radius: 6px;
  background: #e1f2e9;
  color: #176b48;
  font-size: 13px;
}

.hero-role-group span {
  font-size: 12px;
}

.hero-role-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-role-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border: 0;
  background: transparent;
  color: #287557;
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
}

.hero-role-toggle:hover {
  color: #124c37;
}

.hero-role-toggle:focus-visible {
  outline: 2px solid rgba(25, 166, 104, 0.35);
  outline-offset: 2px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 760;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.compare-grid,
.compact-list {
  display: grid;
  gap: 10px;
}

.compare-row,
.compact-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--paper-soft);
}

.delta-up {
  color: var(--green-dark);
}

.delta-down {
  color: var(--red);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.data-table tbody tr:hover {
  background: rgba(24, 184, 111, 0.045);
}

.density-table {
  min-width: 860px;
}

.dense-stack {
  display: grid;
  gap: 3px;
}

.dense-stack span,
.row-title-button span {
  color: var(--muted);
  font-size: 12px;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 760;
}

.tag.loss {
  color: var(--red);
  background: rgba(224, 68, 94, 0.1);
}

.tag.warning {
  color: #9a6700;
  background: rgba(214, 158, 46, 0.14);
}

.tag.confirmed {
  color: var(--green-dark);
  background: var(--green-soft);
}

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

.row-actions button {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.row-title-button {
  display: grid;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.scope-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.scope-switch button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

.scope-switch button.active {
  background: #fff;
  color: var(--green-dark);
  box-shadow: 0 1px 6px rgba(17, 24, 39, 0.08);
}

.form-grid,
.entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.small {
  grid-template-columns: minmax(0, 0.45fr) minmax(0, 1fr);
}

.import-result .form-grid,
.manual-panel .form-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
  align-items: start;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.flow-steps span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.flow-steps span.active {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: rgba(24, 184, 111, 0.24);
}

.import-source,
.import-result,
.import-pane.active,
.entry-pane.active {
  display: grid;
  gap: 14px;
}

.import-source h3,
.import-result h3 {
  margin: 0;
  font-size: 16px;
}

.import-tabs,
.entry-tabs {
  width: fit-content;
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.import-tabs button,
.entry-tabs button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
}

.import-tabs button.active,
.entry-tabs button.active {
  color: #fff;
  background: var(--green);
}

.import-pane,
.entry-pane {
  display: none;
}

.parse-action {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.parse-action small {
  max-width: 420px;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.65;
}

.dropzone {
  min-height: 168px;
  place-items: center;
  padding: 22px;
  border: 1px dashed rgba(24, 184, 111, 0.42);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  text-align: center;
  cursor: pointer;
}

.dropzone.is-dragging {
  border-color: rgba(24, 184, 111, 0.78);
  background: rgba(24, 184, 111, 0.14);
  box-shadow: inset 0 0 0 1px rgba(24, 184, 111, 0.18);
}

.dropzone input {
  display: none;
}

.dropzone strong {
  display: block;
  font-size: 16px;
}

.dropzone em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  line-height: 1.7;
}

.upload-preview {
  width: 100%;
  display: grid;
  gap: 10px;
}

.upload-preview [data-zoom-src] {
  cursor: zoom-in;
}

.upload-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid rgba(24, 184, 111, 0.24);
  border-radius: 8px;
  background: #fff;
}

.upload-preview-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.upload-preview-grid img {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: none;
  object-fit: cover;
}

.batch-source-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 10px;
}

.folder-picker {
  min-height: 42px;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  background: #fff;
}

.folder-picker input {
  display: none;
}

.batch-queue {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.batch-queue[hidden] {
  display: none;
}

.batch-queue-head,
.batch-queue-head > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.batch-queue-head > div {
  min-width: 0;
}

.batch-queue-head strong {
  font-size: 13px;
}

.batch-queue-head span,
.batch-queue > small {
  color: var(--muted);
  font-size: 11px;
}

.batch-queue-list {
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}

.batch-queue-item {
  display: grid;
  grid-template-columns: 24px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.batch-queue-item:disabled {
  cursor: default;
  opacity: 0.72;
}

.batch-queue-item:not(:disabled):hover,
.batch-queue-item.active {
  border-color: rgba(24, 184, 111, 0.5);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(24, 184, 111, 0.08);
}

.batch-queue-item.active {
  border-color: var(--green);
  box-shadow:
    inset 3px 0 0 var(--green),
    0 0 0 3px rgba(24, 184, 111, 0.12);
}

.batch-queue-item.active em {
  color: var(--green-dark);
}

.batch-queue-item.review {
  border-color: rgba(214, 158, 46, 0.42);
  background: rgba(214, 158, 46, 0.07);
}

.batch-queue-item.error {
  border-color: rgba(224, 68, 94, 0.3);
  background: rgba(224, 68, 94, 0.06);
}

.batch-queue-item.saved {
  border-color: rgba(24, 184, 111, 0.24);
  background: var(--green-soft);
}

.batch-queue-item img {
  width: 44px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
}

.batch-index {
  color: var(--subtle);
  text-align: center;
  font-size: 11px;
  font-weight: 760;
}

.batch-queue-item > div {
  min-width: 0;
}

.batch-queue-item strong,
.batch-queue-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-queue-item strong {
  font-size: 12px;
}

.batch-queue-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.batch-queue-item em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
  font-weight: 760;
}

.batch-queue-item.review em {
  color: #946200;
}

.batch-queue-item.error em {
  color: var(--red);
}

.batch-queue-item.saved em {
  color: var(--green-dark);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 16, 13, 0.72);
  cursor: zoom-out;
}

.image-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(1280px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.image-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.image-lightbox-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-lightbox-panel img {
  width: 100%;
  max-height: calc(92vh - 68px);
  object-fit: contain;
  border-radius: 6px;
  background: #08160f;
}

.dropzone span,
.helper-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.ocr-status {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.ocr-status span {
  grid-row: span 2;
  align-self: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.1);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ocr-status strong {
  color: var(--text);
  font-size: 13px;
}

.ocr-status small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ocr-status.is-ready {
  border-color: rgba(24, 184, 111, 0.24);
  background: var(--green-soft);
}

.ocr-status.is-ready span {
  background: #daf6e8;
  color: var(--green-dark);
}

.ocr-status.is-unavailable {
  border-color: rgba(214, 158, 46, 0.34);
  background: rgba(214, 158, 46, 0.08);
}

.ocr-status.is-unavailable span {
  background: rgba(214, 158, 46, 0.16);
  color: #9a6700;
}

.manual-panel {
  display: grid;
  gap: 16px;
  padding-top: 4px;
}

.import-table table {
  min-width: 760px;
}

.import-table input,
.import-table select {
  min-width: 74px;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.import-table input[data-field="notes"] {
  min-width: 170px;
}

.import-table input.is-uncertain-cell,
.import-table select.is-uncertain-cell,
.form-grid select.is-uncertain-cell {
  border-color: rgba(214, 158, 46, 0.58);
  background: rgba(214, 158, 46, 0.06);
}

.performance-cell {
  display: grid;
  gap: 4px;
  min-width: 124px;
}

.performance-cell small {
  max-width: 210px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-note-field {
  margin-top: 2px;
  opacity: 0.78;
}

.import-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.batch-save-hint {
  margin-right: auto;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 760;
}

.perspective-note {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.perspective-note.is-ready {
  border-color: rgba(24, 184, 111, 0.24);
  background: var(--green-soft);
  color: var(--green-dark);
}

.perspective-note.needs-review {
  border-color: rgba(214, 158, 46, 0.34);
  background: rgba(214, 158, 46, 0.08);
  color: #8a5c00;
}

.alias-panel {
  display: grid;
  gap: 12px;
}

.alias-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(120px, 0.35fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.alias-form label {
  display: grid;
  gap: 6px;
}

.alias-table {
  min-width: 720px;
}

.scrim-list {
  display: grid;
  gap: 14px;
}

.scrim-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.scrim-board-card {
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.scrim-board-card span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 760;
}

.scrim-board-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.scrim-board-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.import-linked-note {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(24, 184, 111, 0.24);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 760;
}

.scrim-workbench {
  display: grid;
  grid-template-columns: minmax(560px, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.scrim-table-wrap {
  max-height: calc(100vh - 292px);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scrim-table-wrap table {
  min-width: 700px;
}

.scrim-group-row td {
  padding: 8px 10px;
  background: #f7faf8;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.scrim-group-bar {
  display: grid;
  grid-template-columns: minmax(92px, 0.7fr) minmax(310px, 2fr) minmax(105px, 0.8fr);
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.scrim-group-date {
  color: var(--muted);
  font-weight: 760;
}

.scrim-group-scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
}

.scrim-group-scoreboard strong {
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

.scrim-group-scoreboard strong span {
  margin: 0 3px;
  color: var(--subtle);
  font-size: 11px;
  text-transform: uppercase;
}

.scrim-group-scoreboard b {
  min-width: 52px;
  color: var(--text);
  font-size: 23px;
  line-height: 1;
  text-align: center;
}

.scrim-group-scoreboard em {
  min-width: 72px;
  padding: 5px 9px;
  border-radius: 999px;
  font-style: normal;
  font-weight: 820;
  text-align: center;
}

.scrim-group-scoreboard em.win {
  background: var(--green-soft);
  color: var(--green-dark);
}

.scrim-group-scoreboard em.draw {
  background: rgba(76, 141, 246, 0.12);
  color: #2869c7;
}

.scrim-group-scoreboard em.loss {
  background: rgba(224, 68, 94, 0.1);
  color: var(--red);
}

.scrim-group-scoreboard em.pending {
  background: rgba(214, 158, 46, 0.14);
  color: #9a6700;
}

.scrim-group-meta {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 0;
}

.scrim-group-meta small {
  color: var(--subtle);
  font-weight: 720;
}

.scrim-group-meta span,
.row-version {
  color: var(--subtle);
  font-size: 11px;
}

.row-version {
  display: block;
  margin-top: 4px;
}

.scrim-table-row {
  cursor: pointer;
}

.scrim-table-row.is-active {
  background: rgba(24, 184, 111, 0.07);
  box-shadow: inset 3px 0 0 var(--green);
}

.scrim-table-row.is-highlight {
  background: rgba(24, 184, 111, 0.08);
}

.scrim-detail {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  min-height: 360px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.scrim-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.scrim-detail-head h3 {
  margin: 4px 0 5px;
  font-size: 17px;
}

.scrim-detail-head p,
.detail-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: -6px;
}

.detail-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

.detail-actions .danger-button {
  border-color: rgba(224, 68, 94, 0.24);
  background: rgba(224, 68, 94, 0.08);
  color: var(--red);
}

.side-detail-grid {
  display: grid;
  gap: 12px;
}

.side-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.side-detail.blue {
  border-left: 3px solid #4c8df6;
}

.side-detail.red {
  border-left: 3px solid #e0445e;
}

.side-detail.is-own {
  box-shadow: 0 0 0 1px rgba(28, 185, 111, 0.18);
}

.side-detail.is-own .side-detail-head {
  background: #f2fbf6;
}

.side-detail.own {
  border-left: 3px solid var(--green);
}

.side-detail.opponent {
  border-left: 3px solid #94a3b8;
}

.side-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 12px;
}

.side-detail-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.own-side-mark {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #daf6e8;
  color: #0b7d47;
  font-size: 12px;
  font-weight: 700;
}

.side-table {
  min-width: 0;
}

.side-table th,
.side-table td {
  padding: 8px 9px;
}

.side-table tr.is-missing td {
  background: rgba(214, 158, 46, 0.06);
}

.role-pill,
.performance-pill,
.team-chip {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.performance-pill.carry {
  color: var(--green-dark);
  background: var(--green-soft);
}

.performance-pill.noob {
  color: var(--red);
  background: rgba(224, 68, 94, 0.1);
}

.team-chip {
  margin-right: 5px;
}

.team-chip.own {
  color: var(--green-dark);
  background: var(--green-soft);
}

.team-chip.opponent {
  color: #7a5360;
  background: rgba(224, 68, 94, 0.08);
}

.team-chip.all {
  color: #4f5f59;
  background: #edf2ef;
}

.usage-cell {
  display: grid;
  gap: 5px;
  min-width: 92px;
}

.usage-bar {
  display: block;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--paper-soft);
  overflow: hidden;
}

.usage-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.starter-card {
  display: grid;
  gap: 12px;
  min-height: 154px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.starter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.starter-head span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.starter-head strong {
  font-size: 17px;
}

.starter-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.starter-metrics div {
  display: grid;
  gap: 3px;
}

.starter-metrics span,
.hero-pool-line span {
  color: var(--muted);
  font-size: 11px;
}

.starter-metrics strong {
  font-size: 15px;
}

.hero-pool-line {
  display: grid;
  gap: 5px;
}

.hero-pool-line strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

.scrim-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.scrim-card.is-highlight {
  border-color: rgba(24, 184, 111, 0.5);
  box-shadow: 0 0 0 3px rgba(24, 184, 111, 0.12);
}

.scrim-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  background: var(--paper-soft);
}

.scrim-card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.scrim-card-title strong {
  font-size: 16px;
}

.scrim-card-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.scrim-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scrim-card-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

.scrim-entry-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.scrim-entry-mini {
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scrim-entry-mini.is-missing {
  border-color: rgba(214, 158, 46, 0.48);
  background: rgba(214, 158, 46, 0.05);
}

.scrim-entry-mini span {
  color: var(--subtle);
  font-size: 12px;
}

.scrim-entry-mini strong {
  font-size: 15px;
}

.scrim-entry-mini em {
  color: var(--green-dark);
  font-style: normal;
  font-weight: 760;
}

.wide {
  grid-column: span 1;
}

.full-field {
  margin-top: 2px;
}

.entry-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.entry-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.entry-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.card-grid,
.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-card,
.export-grid article {
  padding: 16px;
}

.stat-card h3,
.export-grid h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
}

.stat-line strong {
  color: var(--text);
}

.empty {
  padding: 18px;
  color: var(--subtle);
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: 360px;
  padding: 13px 15px;
  border: 1px solid rgba(24, 184, 111, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  font-size: 13px;
  font-weight: 720;
}

.readonly .admin-only,
.readonly .admin-only-inline {
  display: none;
}

.readonly .readonly-note {
  display: block;
}

.readonly-note {
  display: none;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-top,
  .range-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .insight-grid,
  .scrim-board,
  .scrim-workbench,
  .alias-form,
  .starter-grid,
  .two-column,
  .form-grid,
  .import-layout,
  .batch-source-actions,
  .entry-grid,
  .card-grid,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .panel-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tools input,
  .panel-tools select {
    min-width: 100%;
  }

  .scrim-detail {
    position: static;
  }
}
