:root {
  color-scheme: dark;
  --paper: #f0eee6;
  --ink: #e8edef;
  --muted: #9ca8ae;
  --faint: #68757c;
  --void: #080c0f;
  --ground: #0b100d;
  --surface: #11181b;
  --raised: #172025;
  --steel: #2b373d;
  --steel-bright: #435158;
  --signal: #73d7e5;
  --signal-hot: #a5edf3;
  --moss: #b8c979;
  --moss-hot: #d3dfa7;
  --warning: #e5b973;
  --danger: #ee8b82;
  --success: #a8c987;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: Georgia, "Times New Roman", serif;
  --header-height: 72px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--void); }
body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 9px 13px;
  background: var(--signal);
  color: var(--void);
  transform: translateY(-180%);
  transition: transform 160ms ease;
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(18px, 4vw, 58px);
  border-bottom: 1px solid rgba(240, 238, 230, 0.12);
  background: rgba(8, 12, 15, 0.94);
  backdrop-filter: blur(14px);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--paper);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.11em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.wordmark img {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(184, 201, 121, 0.52);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}
.topbar nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }
.topbar nav a, .quiet-button {
  border: 0;
  background: transparent;
  color: #b9c2c5;
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.topbar nav a:hover, .topbar nav a:focus-visible,
.quiet-button:hover, .quiet-button:focus-visible { color: var(--paper); }
.staff-identity { display: grid; text-align: right; }
.staff-identity strong { color: var(--moss-hot); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.staff-identity span { max-width: 230px; overflow: hidden; color: var(--faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.login-stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
}
.login-art {
  position: absolute;
  z-index: -3;
  inset: -3%;
  background: #1b211a url("https://wastelandrevenant.com/assets/media/landing-hero.webp") center 48% / cover no-repeat;
  filter: saturate(.68) contrast(1.08);
  animation: art-enter 1200ms cubic-bezier(.16,.7,.26,1) both;
}
.login-shade {
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 9, 8, .97) 0%, rgba(6, 9, 8, .78) 44%, rgba(6, 9, 8, .2) 80%),
    linear-gradient(0deg, rgba(6, 9, 8, .97) 0%, transparent 48%, rgba(6, 9, 8, .42));
}
.login-shade::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .09;
  background-image: repeating-linear-gradient(0deg, transparent 0 4px, #050806 5px);
}
.login-content {
  width: min(590px, calc(100% - 40px));
  margin: 0 0 clamp(70px, 12vh, 126px) clamp(20px, 8vw, 126px);
  animation: content-enter 720ms 160ms cubic-bezier(.2,.7,.3,1) both;
}
.overline {
  margin: 0 0 13px;
  color: var(--moss-hot);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.login-content h1, .home-title h1, .page-title h1 {
  margin: 0;
  color: var(--paper);
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .94;
}
.login-content h1 { font-size: clamp(56px, 8vw, 112px); }
.login-content > p:not(.overline) { max-width: 520px; margin: 25px 0 0; color: rgba(240,238,230,.72); font-size: 17px; }
.google-button, .primary-button, .secondary-button, .danger-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: .04em;
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}
.google-button { margin-top: 34px; background: var(--paper); color: #111719; }
.google-button span { color: #4285f4; font-size: 17px; }
.google-button:hover:not(:disabled), .primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled), .danger-button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .45; }
.primary-button { background: var(--signal); color: #071013; }
.secondary-button { border-color: var(--steel-bright); background: var(--raised); color: var(--ink); }
.danger-button { border-color: rgba(238,139,130,.55); background: rgba(238,139,130,.1); color: #ffc1bb; }
.small-button { min-height: 34px; padding: 0 12px; font-size: 11px; }
.status-line { min-height: 24px; margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.status-line.error { color: var(--danger); }
.status-line.success { color: var(--success); }

.home-view { opacity: 0; transition: opacity 260ms ease; }
.home-view.visible { opacity: 1; }
.home-main { min-height: calc(100svh - var(--header-height)); }
.home-title {
  position: relative;
  min-height: 370px;
  display: grid;
  align-items: end;
  padding: clamp(58px, 8vw, 110px) clamp(20px, 8vw, 126px);
  overflow: hidden;
  border-bottom: 1px solid var(--steel);
  isolation: isolate;
}
.home-title::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: url("https://wastelandrevenant.com/assets/media/landing-final.webp") center 62% / cover no-repeat;
  filter: saturate(.45) contrast(1.14);
  opacity: .46;
}
.home-title::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(8,12,15,.98), rgba(8,12,15,.68) 58%, rgba(8,12,15,.35)), linear-gradient(0deg, var(--ground), transparent 60%);
}
.home-title h1 { font-size: clamp(50px, 6vw, 82px); }
.home-title p:last-child { max-width: 560px; margin: 20px 0 0; color: #b4bec1; }
.directory { padding: 0 clamp(20px, 8vw, 126px) 100px; }
.directory-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding: 64px 0 24px;
  border-bottom: 1px solid rgba(240,238,230,.25);
}
.directory-head h2 { margin: 0; font: 500 clamp(32px, 4vw, 52px)/1 var(--display); letter-spacing: -.04em; }
.directory-head p { max-width: 430px; margin: 0; color: var(--muted); }
.directory-list { list-style: none; margin: 0; padding: 0; }
.directory-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 4vw, 58px);
  min-height: 108px;
  border-bottom: 1px solid var(--steel);
  text-decoration: none;
  transition: padding 170ms ease, background-color 170ms ease;
}
.directory-row:hover, .directory-row:focus-visible { padding: 0 16px; background: rgba(115,215,229,.05); }
.directory-row > span:first-child { color: var(--faint); font-size: 11px; letter-spacing: .14em; }
.directory-row h3 { margin: 0; color: var(--paper); font-size: clamp(20px, 2vw, 28px); }
.directory-row p { margin: 4px 0 0; color: var(--muted); }
.directory-row > span:last-child { color: var(--signal); font-size: 24px; transition: transform 170ms ease; }
.directory-row:hover > span:last-child { transform: translateX(5px); }
.home-footer { min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 58px); border-top: 1px solid var(--steel); color: var(--faint); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }

.workspace { min-height: calc(100svh - var(--header-height)); display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.side-rail {
  position: sticky;
  top: var(--header-height);
  height: calc(100svh - var(--header-height));
  display: flex;
  flex-direction: column;
  padding: 32px 22px;
  border-right: 1px solid var(--steel);
  background: #0a0f12;
}
.rail-label { margin: 0 10px 18px; color: var(--faint); font-size: 9px; font-weight: 760; letter-spacing: .18em; text-transform: uppercase; }
.side-rail nav { display: grid; gap: 4px; }
.side-rail nav a { padding: 10px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.side-rail nav a:hover, .side-rail nav a.active { border-left-color: var(--signal); background: rgba(115,215,229,.05); color: var(--paper); }
.rail-foot { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid var(--steel); }
.rail-foot strong { display: block; color: var(--moss-hot); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }
.rail-foot span { display: block; overflow: hidden; color: var(--faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.workspace-main { min-width: 0; padding: clamp(34px, 5vw, 72px) clamp(20px, 5vw, 76px) 100px; }
.page-title { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 40px; }
.page-title h1 { font-size: clamp(46px, 5vw, 72px); }
.page-title p:last-child { max-width: 520px; margin: 13px 0 0; color: var(--muted); }

.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-top: 1px solid var(--steel-bright); border-bottom: 1px solid var(--steel); }
.search-form input {
  min-width: 0;
  min-height: 64px;
  padding: 0 18px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font-size: clamp(18px, 2.2vw, 28px);
}
.search-form input::placeholder { color: #536066; }
.search-form button { min-height: 42px; align-self: center; }
.empty-state { min-height: 360px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--paper); font: 500 32px/1 var(--display); }

.user-view { animation: section-enter 260ms ease both; }
.identity-strip {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(110px, .7fr));
  gap: 1px;
  margin-top: 34px;
  border-top: 1px solid var(--steel);
  border-bottom: 1px solid var(--steel);
  background: var(--steel);
}
.identity-cell { min-width: 0; padding: 19px 20px; background: var(--surface); }
.identity-cell span { display: block; color: var(--faint); font-size: 9px; font-weight: 760; letter-spacing: .14em; text-transform: uppercase; }
.identity-cell strong { display: block; margin-top: 4px; overflow: hidden; color: var(--paper); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.identity-cell-uid { grid-column: span 3; }
.identity-cell-uid strong { overflow: visible; overflow-wrap: anywhere; text-overflow: clip; user-select: text; white-space: normal; }
.identity-cell:last-child:nth-child(4n + 1) { grid-column: 1 / -1; }
.state-good { color: var(--success) !important; }
.state-warn { color: var(--warning) !important; }
.state-danger { color: var(--danger) !important; }
.action-bar { display: flex; flex-wrap: wrap; gap: 9px; padding: 22px 0 0; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .38fr); gap: clamp(38px, 5vw, 72px); margin-top: 48px; }
.main-column, .context-column { min-width: 0; }
.section-block { padding: 0 0 44px; margin-bottom: 44px; border-bottom: 1px solid var(--steel); }
.section-block:last-child { margin-bottom: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; color: var(--paper); font: 500 30px/1 var(--display); letter-spacing: -.035em; }
.section-heading p { margin: 0; color: var(--faint); font-size: 11px; }
.data-list { margin: 0; }
.data-row { min-height: 47px; display: grid; grid-template-columns: minmax(150px, 1fr) auto auto; align-items: center; gap: 14px; border-bottom: 1px solid rgba(43,55,61,.72); }
.data-row:last-child { border-bottom: 0; }
.data-row dt { color: var(--muted); }
.data-row dd { margin: 0; color: var(--paper); font-variant-numeric: tabular-nums; }
.data-row .row-action { min-width: 52px; }
.currency-label, .item-identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.currency-icon { width: 30px; height: 30px; flex: 0 0 auto; object-fit: contain; }
.item-thumb { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid rgba(115, 135, 139, .25); border-radius: 2px; background: #0b1114; object-fit: contain; }
.item-identity > span { min-width: 0; }
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 34px; }
.skill-row { min-height: 64px; display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--steel); }
.skill-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.skill-icon { width: 40px; height: 40px; flex: 0 0 auto; object-fit: contain; }
.skill-row strong { display: block; color: var(--paper); }
.skill-row span { display: block; color: var(--faint); font-size: 11px; }
.skill-level { color: var(--signal-hot); font-size: 20px; font-variant-numeric: tabular-nums; }
.equipment-list, .notes-list, .purchase-list { list-style: none; margin: 0; padding: 0; }
.equipment-row { min-height: 54px; display: grid; grid-template-columns: 90px minmax(0,1fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--steel); }
.equipment-row > span { color: var(--faint); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.equipment-row strong { overflow: hidden; color: var(--paper); text-overflow: ellipsis; white-space: nowrap; }
.inventory-tools { display: flex; align-items: center; gap: 9px; }
.inventory-filter { width: min(280px, 100%); min-height: 36px; padding: 0 10px; border: 1px solid var(--steel); background: #0b1114; color: var(--ink); }
.inventory-pagination { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 14px; }
.inventory-pagination p { margin: 0; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.inventory-pagination p span { color: var(--faint); }
.inventory-pagination > div { display: flex; gap: 8px; }
.inventory-pagination button:disabled { opacity: .34; cursor: not-allowed; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 12px; border-bottom: 1px solid var(--steel-bright); color: var(--faint); font-size: 9px; letter-spacing: .14em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--steel); color: var(--muted); }
.data-table td strong { color: var(--paper); }
.data-table td small { color: var(--faint); overflow-wrap: anywhere; }
.data-table td.number { color: var(--paper); font-variant-numeric: tabular-nums; text-align: right; }
.data-table th:last-child, .data-table td:last-child { text-align: right; }
.context-column { position: sticky; top: calc(var(--header-height) + 32px); align-self: start; }
.context-section { padding-bottom: 34px; margin-bottom: 34px; border-bottom: 1px solid var(--steel); }
.context-section h2 { margin: 0 0 17px; font: 500 24px/1 var(--display); }
.context-section p { color: var(--muted); }
.note-form textarea { width: 100%; min-height: 96px; resize: vertical; }
.note-form button { margin-top: 9px; }
.notes-list { margin-top: 20px; }
.note-row { padding: 16px 0; border-top: 1px solid var(--steel); }
.note-row p { margin: 0; color: #c8d0d2; white-space: pre-wrap; }
.note-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--faint); font-size: 10px; }
.purchase-row { padding: 15px 0; border-top: 1px solid var(--steel); }
.purchase-row strong { display: block; color: var(--paper); overflow-wrap: anywhere; }
.purchase-row span { color: var(--faint); font-size: 10px; }
.empty-inline { padding: 18px 0; color: var(--faint); }

input, textarea, select {
  border: 1px solid var(--steel);
  border-radius: 2px;
  outline: none;
  background: #0b1114;
  color: var(--paper);
}
input:focus, textarea:focus, select:focus { border-color: var(--signal); }
textarea { padding: 11px 12px; }

.staff-table .revoked { opacity: .48; }
.staff-principal { display: grid; }
.staff-principal small { color: var(--faint); }
.role-tag { color: var(--moss-hot); font-size: 10px; font-weight: 760; letter-spacing: .1em; text-transform: uppercase; }
.access-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 24px 0 32px; border-top: 1px solid var(--steel); border-bottom: 1px solid var(--steel); }
.access-form label, .dialog-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.access-form input, .dialog-form input, .dialog-form select { min-height: 42px; padding: 0 11px; }
.access-form .full, .dialog-form .full { grid-column: 1 / -1; }
.access-form .actions { grid-column: 1 / -1; display: flex; gap: 9px; }

.modal { width: min(560px, calc(100% - 28px)); max-height: calc(100svh - 30px); padding: 0; border: 1px solid var(--steel-bright); border-radius: 3px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.62); }
.modal::backdrop { background: rgba(2,5,6,.8); backdrop-filter: blur(5px); }
.modal-shell { padding: 27px; }
.modal h2 { margin: 0; color: var(--paper); font: 500 32px/1 var(--display); letter-spacing: -.04em; }
.modal-intro { margin: 12px 0 22px; color: var(--muted); }
.dialog-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.dialog-form textarea { min-height: 90px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; padding-top: 19px; border-top: 1px solid var(--steel); }
.catalog-results { max-height: 280px; overflow-y: auto; border-top: 1px solid var(--steel); }
.catalog-option { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--steel); background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.catalog-option:hover { color: var(--signal-hot); }
.catalog-option .item-identity { width: 100%; }
.catalog-option .item-identity > span { display: grid; gap: 2px; }
.catalog-option small { color: var(--faint); }

@keyframes art-enter { from { transform: scale(1.08); opacity: .3; } to { transform: scale(1.03); opacity: 1; } }
@keyframes content-enter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes section-enter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .workspace { display: block; }
  .side-rail { position: static; height: auto; padding: 12px 18px; border-right: 0; border-bottom: 1px solid var(--steel); }
  .side-rail .rail-label, .rail-foot { display: none; }
  .side-rail nav { display: flex; overflow-x: auto; }
  .side-rail nav a { white-space: nowrap; }
  .content-grid { grid-template-columns: 1fr; }
  .context-column { position: static; }
  .identity-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .identity-cell-uid { grid-column: 1 / -1; }
  .directory-head { align-items: start; flex-direction: column; }
}

@media (max-width: 650px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .wordmark span { display: none; }
  .topbar nav { gap: 12px; }
  .topbar nav a[data-mobile-hide], .staff-identity { display: none; }
  .login-content { margin-bottom: 54px; }
  .home-title { min-height: 320px; }
  .page-title { align-items: start; flex-direction: column; }
  .search-form { grid-template-columns: 1fr; padding-bottom: 12px; }
  .search-form input { min-height: 58px; }
  .search-form button { width: 100%; }
  .identity-strip { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .inventory-tools { width: 100%; align-items: stretch; flex-direction: column; }
  .inventory-filter { width: 100%; }
  .inventory-pagination { align-items: flex-start; flex-direction: column; }
  .access-form, .dialog-form { grid-template-columns: 1fr; }
  .access-form .full, .access-form .actions, .dialog-form .full { grid-column: auto; }
  .directory-row { grid-template-columns: 34px minmax(0, 1fr) auto; min-height: 96px; }
  .directory-row p { font-size: 12px; }
}

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