:root {
  color-scheme: dark;
  --bg: #0b1511;
  --ink: #f6f0e6;
  --muted: #b4beb3;
  --line: rgba(255, 255, 255, 0.14);
  --panel: rgba(16, 31, 23, 0.82);
  --panel-strong: rgba(9, 18, 14, 0.92);
  --field: rgba(255, 255, 255, 0.075);
  --green: #78c087;
  --lime: #b8d66d;
  --gold: #d9b766;
  --blue: #7fb5d8;
  --red: #e06d62;
  --violet: #a99be8;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(11, 21, 17, 0.96), rgba(18, 30, 23, 0.92)),
    url("assets/course-texture.svg") center / cover fixed;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar,
.workspace {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  min-height: 680px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  overflow: auto;
}

.workspace {
  min-height: calc(100vh - 36px);
  padding: 18px;
}

.brand,
.workspace-header,
.section-title,
.data-actions,
.assessment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  justify-content: flex-start;
}

.brand img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #17241b;
}

.brand p,
.workspace-header p {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand h1,
.workspace-header h2,
.empty-state h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: 0;
}

.workspace-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.metric-grid div,
.point-form,
.capture-panel,
.instruction-panel,
.compare-panel,
.assessment-panel,
.timeline-panel,
.report-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.metric-grid div {
  padding: 11px;
}

.metric-grid span,
label span,
.section-title small,
.point-meta dt,
.point-row small,
.timeline-item p,
.timeline-item span,
.empty-state small {
  color: var(--muted);
  font-size: 12px;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1;
}

.point-form,
.capture-panel,
.instruction-panel,
.compare-panel,
.assessment-panel,
.timeline-panel,
.report-panel {
  padding: 14px;
}

.report-panel {
  margin-bottom: 14px;
}

.report-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(160px, 0.8fr) auto auto;
  gap: 10px;
  align-items: end;
}

#report-output {
  margin-top: 12px;
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
}

.section-title {
  margin-bottom: 12px;
}

.section-title span {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

form label,
.criterion-field,
.score-field {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--field);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(217, 183, 102, 0.74);
  box-shadow: 0 0 0 3px rgba(217, 183, 102, 0.12);
}

button,
.data-actions label,
.data-actions a,
.button-link {
  border: 1px solid rgba(217, 183, 102, 0.46);
  border-radius: 8px;
  color: #16150e;
  background: var(--gold);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.danger,
.timeline-delete {
  color: var(--ink);
  border-color: rgba(224, 109, 98, 0.48);
  background: rgba(224, 109, 98, 0.16);
}

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

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 8px;
}

.point-list {
  display: grid;
  gap: 8px;
}

.point-row {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
}

.point-row[data-active="true"] {
  border-color: rgba(217, 183, 102, 0.72);
  background: rgba(217, 183, 102, 0.12);
}

.point-row[data-tone="good"] {
  border-left: 4px solid var(--green);
}

.point-row[data-tone="steady"] {
  border-left: 4px solid var(--blue);
}

.point-row[data-tone="bad"] {
  border-left: 4px solid var(--red);
}

.point-row[data-tone="warn"] {
  border-left: 4px solid var(--gold);
}

.point-row span {
  min-width: 0;
}

.point-row strong,
.point-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.point-row b {
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(127, 181, 216, 0.15);
  font-size: 11px;
  white-space: nowrap;
}

.list-empty,
.timeline-empty {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 14px;
  text-align: center;
}

.data-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: auto;
}

.data-actions input {
  display: none;
}

.data-actions label {
  display: grid;
  place-items: center;
  min-height: 35px;
  text-align: center;
}

.data-actions a,
.button-link {
  display: grid;
  place-items: center;
  min-height: 35px;
  text-align: center;
}

.upload-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
}

.upload-brand,
.upload-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  padding: 16px;
}

.upload-brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.upload-form,
.upload-selection,
.upload-list {
  display: grid;
  gap: 10px;
}

.upload-drop {
  position: relative;
  min-height: 220px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(217, 183, 102, 0.52);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(127, 181, 216, 0.12), transparent),
    rgba(255, 255, 255, 0.05);
}

.upload-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-drop span {
  display: grid;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.upload-drop strong {
  color: var(--ink);
  font-size: 18px;
}

.upload-row,
.upload-empty {
  display: grid;
  gap: 4px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  padding: 11px;
}

.upload-row span,
.upload-empty {
  color: var(--muted);
  font-size: 12px;
}

.upload-link {
  text-decoration: none;
}

.empty-state {
  min-height: 540px;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  align-items: center;
  gap: 28px;
  padding: 34px;
}

.empty-state p {
  margin: 0 0 8px;
  color: var(--gold);
  font-weight: 900;
}

.empty-state small {
  display: block;
  max-width: 56ch;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.empty-visual {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(127, 181, 216, 0.22), transparent 48%),
    linear-gradient(155deg, rgba(120, 192, 135, 0.55), rgba(184, 214, 109, 0.2));
}

.empty-visual span,
.empty-visual i,
.empty-visual b {
  position: absolute;
  border-radius: 999px;
  display: block;
}

.empty-visual span {
  left: -18%;
  right: -10%;
  bottom: -12%;
  height: 52%;
  background: #5f7a42;
  transform: rotate(-6deg);
}

.empty-visual i {
  left: 17%;
  top: 24%;
  width: 34%;
  height: 24%;
  border: 8px solid rgba(246, 240, 230, 0.82);
  border-right-color: transparent;
  background: transparent;
}

.empty-visual b {
  right: 16%;
  bottom: 28%;
  width: 18px;
  height: 120px;
  border-radius: 4px;
  background: var(--gold);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr);
  grid-template-areas:
    "capture instruction"
    "compare assessment"
    "timeline timeline";
  gap: 14px;
}

.capture-panel {
  grid-area: capture;
}

.instruction-panel {
  grid-area: instruction;
}

.compare-panel {
  grid-area: compare;
}

.assessment-panel {
  grid-area: assessment;
}

.timeline-panel {
  grid-area: timeline;
}

.capture-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.camera-drop {
  position: relative;
  min-height: 334px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(217, 183, 102, 0.52);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(127, 181, 216, 0.12), transparent),
    rgba(255, 255, 255, 0.05);
}

.camera-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.camera-drop img,
.compare-grid img,
.timeline-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#capture-placeholder {
  display: grid;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

#capture-placeholder strong {
  color: var(--ink);
  font-size: 18px;
}

.capture-form,
.assessment-form {
  display: grid;
  gap: 12px;
}

.instruction-panel p {
  margin: 0 0 16px;
  color: var(--ink);
  line-height: 1.5;
}

.point-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.point-meta div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  padding: 10px;
}

.point-meta dt,
.point-meta dd {
  margin: 0;
}

.point-meta dd {
  margin-top: 4px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, auto));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.segmented button {
  border: 0;
  color: var(--muted);
  background: transparent;
  padding: 7px 9px;
}

.segmented button.active {
  color: #16150e;
  background: var(--gold);
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compare-grid figure {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.compare-grid img {
  aspect-ratio: 4 / 3;
}

.compare-grid figcaption {
  min-height: 40px;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.criteria-fields,
.score-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.score-fields {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.criterion-field,
.score-field {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 10px;
}

.criterion-field small,
.score-field small {
  min-height: 38px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.assessment-actions {
  align-items: stretch;
}

.assessment-actions button {
  flex: 1;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  padding: 10px;
}

.timeline-item[data-active="true"] {
  border-color: rgba(217, 183, 102, 0.72);
}

.timeline-item[data-tone="good"] {
  box-shadow: inset 4px 0 0 var(--green);
}

.timeline-item[data-tone="steady"] {
  box-shadow: inset 4px 0 0 var(--blue);
}

.timeline-item[data-tone="bad"] {
  box-shadow: inset 4px 0 0 var(--red);
}

.timeline-item[data-tone="warn"] {
  box-shadow: inset 4px 0 0 var(--gold);
}

.timeline-photo {
  grid-row: 1 / span 2;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  padding: 0;
}

.timeline-item strong,
.timeline-item span,
.timeline-item p {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-item span {
  margin-top: 4px;
  color: var(--gold);
  font-weight: 900;
}

.timeline-item p {
  margin: 7px 0 0;
}

.timeline-delete {
  grid-column: 2;
  width: max-content;
  padding: 8px 10px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
  }

  .point-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0;
    gap: 0;
  }

  .upload-shell {
    padding: 0;
    gap: 0;
  }

  .sidebar,
  .workspace,
  .upload-brand,
  .upload-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .workspace {
    padding: 14px;
  }

  .workspace-header,
  .empty-state,
  .detail-grid,
  .capture-layout,
  .compare-grid,
  .criteria-fields,
  .score-fields,
  .report-controls {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-areas:
      "instruction"
      "capture"
      "compare"
      "assessment"
      "timeline";
  }

  .header-actions,
  .brand,
  .upload-brand,
  .section-title,
  .assessment-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-brand {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-actions button,
  .assessment-actions button {
    width: 100%;
  }

  .empty-state {
    min-height: auto;
    padding: 18px;
  }

  .empty-visual {
    min-height: 220px;
  }

  .point-meta {
    grid-template-columns: 1fr;
  }

  .camera-drop {
    min-height: 280px;
  }
}
