:root {
  color-scheme: dark;
  --room: #0d0f12;
  --wall: #14171c;
  --surface: #1b1f26;
  --surface-2: #222832;
  --ivory: #f4eee3;
  --muted: #aaa49a;
  --quiet: #77716a;
  --line: rgba(244, 238, 227, 0.13);
  --line-strong: rgba(244, 238, 227, 0.24);
  --mint: #86ddbf;
  --blue: #5c86d5;
  --gold: #e9bf53;
  --red: #c9515d;
  --ink-on-light: #111318;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --foil: linear-gradient(135deg, #f4eee3 0%, #86ddbf 30%, #5c86d5 56%, #e9bf53 86%);
  --display: "Iowan Old Style", "Bodoni 72", Georgia, serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(128deg, rgba(134, 221, 191, 0.1), transparent 34%, rgba(92, 134, 213, 0.08) 62%, rgba(201, 81, 93, 0.08)),
    var(--room);
  background-size: 42px 42px, 42px 42px, auto, auto;
  color: var(--ivory);
  font-family: var(--body);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 42px;
  border: 1px solid rgba(244, 238, 227, 0.18);
  border-radius: 7px;
  padding: 0 15px;
  background: var(--foil);
  color: var(--ink-on-light);
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  transition: transform 150ms ease, filter 150ms ease, border-color 150ms ease;
}

button:hover {
  filter: brightness(1.05) saturate(1.08);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(244, 238, 227, 0.15);
  border-radius: 7px;
  background: rgba(5, 7, 10, 0.48);
  color: var(--ivory);
  padding: 11px 12px;
}

select {
  color-scheme: dark;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

a {
  color: inherit;
}

.is-hidden {
  display: none !important;
}

.lock-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(134, 221, 191, 0.13), transparent 36%, rgba(233, 191, 83, 0.1)),
    var(--room);
}

.lock-panel {
  position: relative;
  width: min(560px, 100%);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 40%),
    rgba(23, 27, 33, 0.96);
  box-shadow: var(--shadow);
  padding: 34px;
}

.lock-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--foil);
}

.lock-panel h1 {
  max-width: 11ch;
  margin: 10px 0 14px;
  font-family: var(--display);
  font-size: 4.25rem;
  font-weight: 700;
  line-height: 0.92;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  margin-top: 22px;
}

.inline-form input {
  min-width: 0;
}

.form-error {
  min-height: 22px;
  color: #ffadb5;
  font-weight: 760;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 34%),
    rgba(9, 11, 14, 0.96);
  padding: 12px;
}

.brand {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  position: relative;
  width: 44px;
  height: 60px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 238, 227, 0.35);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 40%),
    var(--surface);
  color: var(--ivory);
  font-family: var(--mono);
  font-weight: 900;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.04);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: auto 7px 7px;
  height: 3px;
  border-radius: 999px;
  background: var(--foil);
}

.brand strong {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.02;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  position: relative;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
}

.nav-item::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}

.nav-item.is-active {
  color: var(--ivory);
  border-color: rgba(244, 238, 227, 0.17);
  background: rgba(255, 255, 255, 0.075);
}

.nav-item.is-active::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 8px;
  bottom: 9px;
  width: 3px;
  border-radius: 999px;
  background: var(--foil);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 84px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 15, 18, 0.84);
  backdrop-filter: blur(18px);
  padding: 14px 26px;
}

.topbar h2,
.dialog-header h3 {
  margin: 3px 0 0;
  font-family: var(--display);
  font-size: 2.45rem;
  font-weight: 700;
  line-height: 0.96;
}

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

.ghost-button {
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(244, 238, 227, 0.18);
  box-shadow: none;
}

.ghost-button:hover {
  border-color: rgba(134, 221, 191, 0.46);
  background: rgba(134, 221, 191, 0.1);
}

.icon-button {
  width: 42px;
  padding: 0;
}

.view {
  display: none;
  padding: 26px;
}

.view.is-active {
  display: grid;
  gap: 22px;
}

.eyebrow {
  margin: 0;
  color: var(--mint);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.section-band {
  display: grid;
  gap: 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.section-header h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
}

.vault-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(330px, 0.86fr) minmax(430px, 1.14fr);
  gap: 24px;
  min-height: 460px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(13, 15, 18, 0.96), rgba(13, 15, 18, 0.7) 56%, rgba(13, 15, 18, 0.36)),
    linear-gradient(135deg, rgba(134, 221, 191, 0.08), transparent 36%, rgba(201, 81, 93, 0.08)),
    var(--wall);
  box-shadow: var(--shadow);
  padding: 24px;
}

.vault-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: var(--foil);
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 18px;
}

.hero-copy h3 {
  max-width: 12ch;
  margin: 0;
  font-family: var(--display);
  font-size: 4.15rem;
  font-weight: 700;
  line-height: 0.96;
}

.hero-subcopy {
  max-width: 42ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.hero-stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 520px;
}

.hero-stat-strip span {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 11px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.hero-stat-strip strong {
  color: var(--ivory);
  font-family: var(--display);
  font-size: 1.55rem;
  line-height: 1;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.showcase-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 238px));
  gap: 20px;
  justify-content: center;
  align-content: center;
  min-width: 0;
  padding: 12px 10px 18px;
}

.showcase-rail .gallery-card {
  max-width: 238px;
}

.showcase-rail .gallery-card:nth-child(2n) {
  transform: translateY(18px);
}

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

.metric {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 44%),
    rgba(27, 31, 38, 0.9);
  padding: 17px;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--foil);
  opacity: 0.78;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 0.9;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 38%),
    rgba(27, 31, 38, 0.88);
  padding: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.panel h4 {
  margin: 0 0 13px;
  color: var(--ivory);
  font-family: var(--display);
  font-size: 1.42rem;
  line-height: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar > * {
  width: auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 22px;
}

.art-wall {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(180deg, #222832, #171b21);
  background-size: 52px 52px, 52px 52px, auto;
  padding: 26px;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.28);
}

.gallery-stage {
  min-height: 62vh;
}

.gallery-card {
  display: grid;
  gap: 11px;
  min-width: 0;
}

.gallery-card:hover .card-frame {
  transform: translateY(-5px);
  border-color: rgba(244, 238, 227, 0.32);
}

.card-frame {
  position: relative;
  aspect-ratio: 2.5 / 3.5;
  overflow: hidden;
  border: 1px solid rgba(244, 238, 227, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02)),
    #ded6c9;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.38),
    inset 0 0 0 8px rgba(17, 19, 24, 0.16);
  transform-origin: center bottom;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.card-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 3px;
  border-radius: inherit;
  background: var(--foil);
  opacity: 0.58;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.card-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, transparent 0 42%, rgba(255, 255, 255, 0.3) 48%, transparent 56%);
  mix-blend-mode: screen;
  opacity: 0.18;
  pointer-events: none;
}

.card-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.placeholder-card {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 24% 1fr 26%;
  color: var(--ink-on-light);
  background:
    linear-gradient(150deg, rgba(134, 221, 191, 0.35), transparent 34%),
    linear-gradient(330deg, rgba(233, 191, 83, 0.24), transparent 34%),
    #efe8dc;
}

.placeholder-card .top,
.placeholder-card .bottom {
  padding: 12px;
  background: rgba(244, 238, 227, 0.78);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.placeholder-card .top strong,
.placeholder-card .bottom strong {
  font-family: var(--display);
  font-size: 1.12rem;
  text-transform: none;
}

.placeholder-card .middle {
  display: grid;
  place-items: center;
  border-top: 1px solid rgba(17, 19, 24, 0.14);
  border-bottom: 1px solid rgba(17, 19, 24, 0.14);
}

.placeholder-card .initials {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(17, 19, 24, 0.36);
  border-radius: 50%;
  background: var(--foil);
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.5rem;
}

.gallery-meta {
  min-width: 0;
}

.gallery-meta strong {
  display: block;
  overflow: hidden;
  color: var(--ivory);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-meta span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.83rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill,
.priority-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--ivory);
  padding: 0 9px;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-owned {
  background: rgba(134, 221, 191, 0.14);
  border-color: rgba(134, 221, 191, 0.42);
}

.status-missing {
  background: rgba(201, 81, 93, 0.16);
  border-color: rgba(201, 81, 93, 0.5);
}

.status-incoming,
.status-watching {
  background: rgba(92, 134, 213, 0.18);
  border-color: rgba(92, 134, 213, 0.48);
}

.priority-grail {
  color: var(--ink-on-light);
  background: var(--foil);
  border-color: rgba(244, 238, 227, 0.44);
}

.priority-high {
  background: rgba(233, 191, 83, 0.18);
  border-color: rgba(233, 191, 83, 0.52);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 15, 18, 0.54);
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-family: var(--mono);
  font-size: 0.67rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

td strong {
  color: var(--ivory);
}

.progress-row {
  display: grid;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

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

.progress-track {
  height: 14px;
  overflow: hidden;
  border: 1px solid rgba(244, 238, 227, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--foil);
}

.list-stack {
  display: grid;
  gap: 10px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

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

.wide {
  grid-column: 1 / -1;
}

.dialog-shell {
  width: min(880px, calc(100vw - 28px));
  display: grid;
  gap: 18px;
}

dialog {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #1b2028;
  color: var(--ivory);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(5, 6, 8, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-header,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 18px;
}

.dialog-header {
  border-bottom: 1px solid var(--line);
}

.dialog-shell .form-grid {
  padding: 0 18px;
}

.dialog-actions {
  border-top: 1px solid var(--line);
}

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

.upload-preview {
  min-height: 190px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(244, 238, 227, 0.26);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.upload-preview img {
  width: 100%;
  height: 100%;
  max-height: 290px;
  object-fit: contain;
}

.empty-state {
  border: 1px dashed rgba(244, 238, 227, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  padding: 22px;
}

.fullscreen-gallery {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: auto;
  border-radius: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    #171b21;
  background-size: 56px 56px, 56px 56px, auto;
  padding: 28px;
}

.fullscreen-gallery .gallery-grid {
  max-width: 1640px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin: 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media (max-width: 1180px) {
  .vault-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-copy h3 {
    max-width: 15ch;
    font-size: 3.55rem;
  }

  .showcase-rail {
    grid-template-columns: repeat(2, minmax(180px, 230px));
    padding-top: 0;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 14px;
  }

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

  .nav-item {
    min-height: 38px;
    padding: 0 10px;
  }

  .topbar {
    position: static;
    min-height: auto;
  }

  .topbar,
  .section-header,
  .list-row {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-form {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .metric-grid,
  .split,
  .form-grid,
  .image-uploader {
    grid-template-columns: 1fr;
  }

  .topbar h2,
  .dialog-header h3 {
    font-size: 2rem;
  }
}

@media (max-width: 640px) {
  .view,
  .topbar,
  .sidebar {
    padding: 14px;
  }

  .lock-screen {
    padding: 14px;
  }

  .lock-panel {
    padding: 24px;
  }

  .lock-panel h1 {
    font-size: 3rem;
  }

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

  .vault-hero {
    padding: 14px;
  }

  .hero-copy {
    padding: 8px;
  }

  .hero-copy h3 {
    max-width: 12ch;
    font-size: 2.75rem;
  }

  .hero-stat-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .showcase-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0 2px 14px;
  }

  .showcase-rail .gallery-card:nth-child(2n) {
    transform: none;
  }

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

  .art-wall,
  .fullscreen-gallery {
    padding: 14px;
  }

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

  .view button,
  .topbar button,
  .inline-form button,
  .dialog-actions button,
  .toolbar button {
    width: 100%;
  }

  .icon-button {
    width: 42px;
  }
}

@media (max-width: 420px) {
  .lock-panel h1 {
    font-size: 2.55rem;
  }

  .hero-copy h3 {
    font-size: 2.35rem;
  }

  .topbar h2,
  .dialog-header h3 {
    font-size: 1.75rem;
  }
}
