:root {
  color-scheme: light;
  --ink: #34322d;
  --muted: #6f6a60;
  --brand: #123c5a;
  --accent: #f15f22;
  --line: #dedbd4;
  --panel: #ffffff;
  --wash: #f5f3ef;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--wash);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 40px;
  padding: 0 16px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  min-width: 0;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(170px, 1fr) auto auto;
  min-height: 76px;
  padding: 12px 18px;
  z-index: 3;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 3px;
  text-transform: uppercase;
}

h1,
h2 {
  line-height: 1;
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 24px;
}

.section-tabs,
.editor-tabs,
.zoom-controls {
  background: #ece9e3;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
}

.section-tabs button,
.editor-tab,
.zoom-controls button {
  background: transparent;
  color: var(--ink);
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.section-tabs button.is-active,
.editor-tab.is-active {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  color: var(--brand);
}

.edit-button {
  min-width: 74px;
}

.zoom-controls output {
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  min-width: 48px;
  text-align: center;
}

.plan-stage {
  align-items: flex-start;
  display: grid;
  justify-items: center;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  position: relative;
}

.plan-stage > .zoom-controls {
  justify-self: start;
  left: 18px;
  position: sticky;
  top: 0;
  z-index: 4;
}

.page-frame {
  aspect-ratio: 612 / 792;
  background: #ffffff;
  box-shadow: 0 14px 42px rgba(30, 28, 24, 0.18);
  container-type: inline-size;
  flex: 0 0 auto;
  line-height: 0;
  overflow: hidden;
  position: relative;
  width: min(100%, 820px);
}

.page-image {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.assignment-layer {
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.seat-card {
  --left: 50%;
  --top: 50%;
  --seat-width: 9.8%;
  --seat-height: 11.8%;
  --image-scale: 1;
  --image-x: 0%;
  --image-y: 0%;
  --name-gap: 0.35%;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: block;
  left: var(--left);
  line-height: 1.05;
  min-width: 0;
  padding: 0;
  position: absolute;
  top: var(--top);
  height: var(--seat-height);
  width: var(--seat-width);
  z-index: 2;
}

.avatar-frame,
.initials {
  display: block;
  height: 100%;
  width: 100%;
}

.avatar-frame {
  line-height: 0;
  overflow: hidden;
  position: relative;
}

.avatar-frame img {
  display: block;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  transform: translate(var(--image-x), var(--image-y)) scale(var(--image-scale));
  transform-origin: center bottom;
  width: 100%;
}

.initials {
  align-items: center;
  aspect-ratio: auto;
  background: #e9eef2;
  color: var(--brand);
  display: flex;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
}

.seat-name {
  color: var(--brand);
  display: block;
  font-size: clamp(8px, 1.42cqw, 14px);
  font-weight: 700;
  left: 0;
  line-height: 1.05;
  position: absolute;
  text-align: center;
  white-space: normal;
  width: 100%;
  z-index: 3;
}

.seat-card.name-above .seat-name {
  bottom: calc(100% + var(--name-gap));
}

.seat-card.name-below .seat-name {
  top: calc(100% + var(--name-gap));
}

.seat-card.is-selected .avatar-frame {
  outline: 1px dashed rgba(0, 107, 68, 0.8);
  outline-offset: -1px;
}

.desk-foreground {
  display: block;
  pointer-events: none;
  position: absolute;
  z-index: 5;
}

.desk-foreground-operations-cluster-3 {
  height: 15.9091%;
  left: 11.7647%;
  top: 18.4343%;
  width: 13.7255%;
}

.editor {
  background: rgba(0, 0, 0, 0.36);
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 160ms ease;
  z-index: 10;
}

.editor.is-open {
  opacity: 1;
  pointer-events: auto;
}

.editor-panel {
  background: var(--panel);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  height: 100%;
  margin-left: auto;
  max-width: 620px;
  overflow: auto;
  padding: 22px;
  width: min(100%, 620px);
}

.editor-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.icon-button {
  min-height: 38px;
  min-width: 38px;
  padding: 0;
}

.editor-view {
  display: none;
}

.editor-view.is-active {
  display: grid;
  gap: 16px;
  align-content: start;
}

.department-form,
.person-form,
.assignment-form,
.placement-form {
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.placement-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

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

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.secondary-button {
  background: #e8ecef;
  color: #1d252d;
}

.person-list,
.department-list,
.assignment-list {
  display: grid;
  gap: 10px;
}

.department-tools {
  display: grid;
  gap: 12px;
}

.department-row {
  align-items: center;
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 22px 1fr auto;
  min-height: 44px;
  padding: 8px;
}

.department-swatch {
  border: 1px solid rgba(0, 0, 0, 0.18);
  display: block;
  height: 22px;
  width: 22px;
}

.person-row,
.assignment-row {
  align-items: center;
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 46px 1fr auto;
  min-height: 60px;
  padding: 8px;
}

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

.person-row img,
.assignment-row img {
  aspect-ratio: 1 / 1;
  background: #eef2f4;
  display: block;
  height: 46px;
  object-fit: contain;
  width: 46px;
}

.person-row .avatar-frame,
.assignment-row .avatar-frame,
.person-row .initials,
.assignment-row .initials {
  height: 46px;
  width: 46px;
}

.person-row .avatar-frame img,
.assignment-row .avatar-frame img {
  transform: none;
}

.person-row strong,
.assignment-row strong {
  display: block;
  line-height: 1.15;
}

.person-row small,
.assignment-row small {
  color: var(--muted);
}

.tiny-button {
  background: transparent;
  color: #9d332a;
  min-height: 34px;
  padding: 0 8px;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .section-tabs {
    grid-column: 1 / -1;
    overflow-x: auto;
  }

  .page-frame {
    width: 100%;
  }
}
