:root {
  --bg: #101214;
  --surface: #171b1f;
  --surface-2: #20262b;
  --surface-3: #2a3137;
  --line: #3a434b;
  --text: #f6f3ee;
  --muted: #b9c0c5;
  --soft: #89939a;
  --accent: #d5ef5f;
  --amber: #f3b348;
  --danger: #ed6a5e;
  --cyan: #4db7c8;
  --green: #72c66f;
  --shadow: 0 18px 54px rgba(0, 0, 0, .32);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 104px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #15181b;
}

.brand-block {
  max-width: 980px;
}

.eyebrow,
.section-head span,
.asset-header span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.08;
}

.brand-block p,
.asset-header p,
.note,
.form-message {
  color: var(--muted);
  line-height: 1.45;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-width: 158px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--amber);
}

.system-status.ready .status-dot {
  background: var(--green);
}

.system-status.error .status-dot {
  background: var(--danger);
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 290px minmax(460px, 1fr) 390px;
  gap: 12px;
  padding: 12px;
}

.left-rail,
.right-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.left-rail,
.right-panel,
.viewer-stage {
  max-height: calc(100vh - 128px);
}

.left-rail,
.right-panel {
  overflow: auto;
}

.panel,
.asset-panel,
.record-panel,
.viewer-stage {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.asset-panel,
.record-panel {
  padding: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.section-head strong {
  color: var(--text);
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: #111417;
}

.scene-list,
.workflow-list,
.record-list,
.detail-list {
  display: grid;
  gap: 8px;
}

.scene-button {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  background: #111417;
}

.scene-button.active {
  border-color: var(--accent);
  background: #21281f;
}

.scene-button small,
.record-item small {
  color: var(--soft);
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric-grid div {
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #111417;
}

.metric-grid span {
  display: block;
  color: var(--soft);
  font-size: 12px;
}

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

.workflow-list {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}

.workflow-list li {
  padding: 6px 0;
}

.viewer-stage {
  min-height: 620px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-toolbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #15191d;
}

.viewer-toolbar div {
  min-width: 0;
  text-align: center;
}

#scene-zone {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

#scene-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#panorama {
  flex: 1;
  min-height: 560px;
  background: #0a0c0d;
}

.hotspot {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, .86);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
  cursor: pointer;
}

.hotspot::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 999px;
  background: #fff;
}

.hotspot-asset {
  background: var(--cyan);
}

.hotspot-loto {
  background: var(--danger);
}

.hotspot-pending {
  background: var(--amber);
}

.hotspot-nav {
  background: var(--accent);
}

.hotspot-label {
  position: absolute;
  left: 40px;
  top: 0;
  min-width: 128px;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(10, 12, 13, .86);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.asset-header {
  display: grid;
  gap: 7px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.asset-header h2 {
  font-size: 23px;
  line-height: 1.15;
}

.tab-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0;
}

.tab-button {
  min-height: 36px;
  padding: 7px 6px;
  font-size: 13px;
}

.tab-button.active {
  color: #111417;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 900;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.asset-card,
.record-item,
.proposal-line {
  padding: 10px;
  border: 1px solid var(--line);
  background: #111417;
}

.asset-card + .asset-card,
.proposal-line + .proposal-line {
  margin-top: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.label-row:last-child {
  border-bottom: 0;
}

.label-row span {
  color: var(--soft);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.pill {
  padding: 5px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
}

.record-list {
  margin-top: 10px;
}

.record-item {
  display: grid;
  gap: 4px;
}

.record-item strong {
  color: var(--text);
}

.record-item[data-priority="Critical"],
.record-item[data-priority="High"] {
  border-left: 4px solid var(--danger);
}

.record-item[data-priority="Medium"] {
  border-left: 4px solid var(--amber);
}

.record-item[data-priority="Completed"] {
  border-left: 4px solid var(--green);
}

form {
  display: grid;
  gap: 10px;
}

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

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0f1214;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 0;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

.primary-action {
  color: #101214;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 900;
}

.form-message {
  min-height: 20px;
  font-size: 13px;
}

.empty-state {
  padding: 12px;
  border: 1px dashed var(--line);
  color: var(--soft);
  background: #111417;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 260px minmax(420px, 1fr);
  }

  .right-panel {
    grid-column: 1 / -1;
    max-height: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace,
  .right-panel {
    grid-template-columns: 1fr;
  }

  .left-rail,
  .right-panel,
  .viewer-stage {
    max-height: none;
  }

  .viewer-stage {
    min-height: 540px;
  }

  #panorama {
    min-height: 470px;
  }

  .viewer-toolbar {
    grid-template-columns: 78px minmax(0, 1fr) 78px;
  }

  h1 {
    font-size: 25px;
  }
}
