:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f4;
  --ink: #17212b;
  --muted: #62707c;
  --line: #d9e1e5;
  --teal: #0f766e;
  --teal-dark: #0a4f4a;
  --coral: #c94040;
  --indigo: #4553a4;
  --leaf: #5d8a45;
  --gold: #bc8617;
  --shadow: 0 18px 45px rgba(23, 33, 43, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

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

svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-link,
.nav-button,
.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 2.75rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.icon-link {
  color: var(--ink);
  background: var(--surface-2);
  padding: 0 0.9rem;
  font-weight: 800;
}

.as-button {
  font: inherit;
}

.primary-button,
.ghost-button,
.danger-button {
  padding: 0.75rem 1rem;
  font-weight: 850;
}

.primary-button {
  background: var(--teal);
  color: white;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.18);
}

.ghost-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.danger-button {
  background: #fff1f1;
  color: #9f1d1d;
  border-color: #f3c3c3;
}

.icon-button {
  width: 2.75rem;
  height: 2.75rem;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(69, 83, 164, 0.24);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.gate-shell {
  min-height: calc(100vh - 5.4rem);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.gate-panel {
  width: min(100%, 27rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 4vw, 1.6rem);
  box-shadow: var(--shadow);
}

.gate-panel h2,
.workspace h2,
.staff-panel h2,
.editor-panel h3,
.claim-form h3 {
  margin: 0.2rem 0 1rem;
  line-height: 1.1;
}

.field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.field span,
.check-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0.78rem 0.8rem;
}

textarea {
  resize: vertical;
}

.form-error,
.success-text {
  min-height: 1.3rem;
  margin: 0.8rem 0;
  font-size: 0.92rem;
  font-weight: 750;
}

.form-error {
  color: #a51d2d;
}

.success-text {
  color: var(--leaf);
}

.workspace {
  width: min(100%, 78rem);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.toolbar-band {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.status-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  min-width: min(100%, 23rem);
}

.tab-button {
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  min-height: 2.5rem;
  padding: 0.55rem 0.75rem;
  font-weight: 850;
}

.tab-button.active {
  color: var(--teal-dark);
  background: var(--surface);
  box-shadow: 0 3px 10px rgba(23, 33, 43, 0.08);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(15rem, 1fr) minmax(9rem, 12rem) minmax(8rem, 11rem) auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-field {
  position: relative;
  display: grid;
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 0.8rem;
  color: var(--muted);
}

.search-field input {
  padding-left: 2.4rem;
}

.compact input,
.compact select {
  min-height: 2.75rem;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.item-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 20rem;
  cursor: pointer;
}

.item-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #e7ecef;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.item-image img,
.detail-media img,
.preview-strip img,
.record-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.placeholder-image {
  color: var(--muted);
  font-weight: 850;
}

.item-card-body {
  padding: 0.85rem;
  display: grid;
  gap: 0.55rem;
}

.item-card h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.18;
}

.item-meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.status-pill,
.mini-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 850;
}

.status-pill {
  color: #07413d;
  background: #dff5f1;
}

.status-pill[data-status="Draft"] {
  color: #725107;
  background: #fff1c7;
}

.status-pill[data-status="Reserved"] {
  color: #29357f;
  background: #e4e7ff;
}

.status-pill[data-status="Claimed"],
.status-pill[data-status="Archived"] {
  color: #5d6770;
  background: #eef1f3;
}

.status-pill[data-status="AvailableToTake"] {
  color: #315d1e;
  background: #e4f3db;
}

.mini-chip {
  color: var(--muted);
  background: var(--surface-2);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  background: var(--surface);
}

.empty-state h3,
.empty-state p {
  margin: 0.2rem;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(14, 22, 30, 0.52);
  display: grid;
  place-items: end center;
  padding: 1rem;
}

.drawer {
  width: min(100%, 66rem);
  max-height: min(90vh, 54rem);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}

.close-drawer {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(18rem, 0.92fr) 1.08fr;
  gap: 1.2rem;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.detail-media {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.detail-media .item-image {
  border-radius: var(--radius);
}

.detail-copy {
  display: grid;
  align-content: start;
  gap: 0.8rem;
  min-width: 0;
}

.detail-copy h2,
.detail-copy p {
  margin: 0;
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
}

.meta-list div {
  padding: 0.65rem;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.meta-list dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.meta-list dd {
  margin: 0.15rem 0 0;
  font-weight: 850;
}

.claim-form {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.span-2 {
  grid-column: 1 / -1;
}

.staff-workspace {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 1rem;
  width: min(100%, 82rem);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.staff-nav {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  position: sticky;
  top: 6.1rem;
}

.nav-button {
  justify-content: flex-start;
  padding: 0.75rem 0.8rem;
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  font-weight: 850;
}

.nav-button.active {
  background: var(--surface);
  color: var(--teal-dark);
  border-color: var(--line);
  box-shadow: 0 5px 18px rgba(23, 33, 43, 0.07);
}

.staff-panels {
  min-width: 0;
}

.staff-panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.2rem);
}

.staff-panel.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.capture-form,
.item-editor {
  display: grid;
  gap: 0.9rem;
}

.upload-zone {
  display: grid;
  place-items: center;
  gap: 0.55rem;
  min-height: 11rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fbfcfd;
  cursor: pointer;
  text-align: center;
  font-weight: 850;
}

.upload-zone svg {
  width: 2.6rem;
  height: 2.6rem;
  color: var(--teal);
}

.upload-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.preview-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  gap: 0.6rem;
}

.preview-strip img {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.check-row input {
  width: 1.1rem;
  height: 1.1rem;
}

.editor-panel {
  margin-top: 1.2rem;
  border-top: 1px solid var(--line);
  padding-top: 1.2rem;
}

.warning-box {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  color: #714f00;
  background: #fff4cf;
  border: 1px solid #eac763;
  border-radius: var(--radius);
  font-weight: 780;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.inline-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.inline-filter select,
.inline-filter input {
  width: auto;
  min-width: 9rem;
}

.record-list {
  display: grid;
  gap: 0.75rem;
}

.record-row {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem;
  background: #fbfcfd;
}

.record-thumb {
  width: 5.2rem;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 850;
}

.record-main {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.record-main h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.record-main p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.record-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.claim-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

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

  .filter-bar,
  .detail-layout,
  .staff-workspace {
    grid-template-columns: 1fr;
  }

  .toolbar-band,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .status-tabs {
    width: 100%;
  }

  .staff-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
    min-width: 0;
    padding: 0.65rem 0.4rem;
  }

  .nav-button svg {
    display: none;
  }

  .record-row,
  .claim-row {
    grid-template-columns: 4.4rem minmax(0, 1fr);
  }

  .record-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 0.65rem;
  }

  .topbar h1 {
    font-size: 1.25rem;
  }

  .icon-link span {
    display: none;
  }

  .form-grid,
  .meta-list {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

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

  .drawer-backdrop {
    padding: 0;
  }

  .drawer {
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
  }

  .item-grid {
    grid-template-columns: 1fr;
  }
}
