/* ============================================================
   PIGEONHOLE — Sorting Office No. 7
   A team inbox reimagined as a vintage postal sorting room.
   ============================================================ */

@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Courier New", monospace;
  --font-body: "Literata", Georgia, "Times New Roman", serif;

  /* Kraft paper palette */
  --paper: #e7d8b3;
  --paper-2: #dcc99c;
  --paper-deep: #c9b486;
  --envelope: #e3d2a6;
  --envelope-2: #d8c290;
  --slot: #b89a5e;
  --slot-shadow: #8a6f3c;

  --ink: #1b1712;
  --ink-soft: #4a4035;
  --ink-faint: #6e604a;
  --rule: #9c8450;

  /* Postal stamp inks */
  --stamp-red: #a92218;
  --stamp-blue: #1b4c7a;
  --stamp-green: #2a6235;
  --stamp-amber: #9a5a0c;
  --stamp-grey: #5b5240;

  --st-todo: var(--stamp-grey);
  --st-progress: var(--stamp-blue);
  --st-blocked: var(--stamp-red);
  --st-done: var(--stamp-green);

  --radius: 4px;
  --shadow-card: 0 1px 0 rgba(255,255,255,.4) inset, 0 6px 14px -8px rgba(40,28,8,.55);
  --maxw: 1240px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  /* kraft paper grain */
  background-image:
    radial-gradient(circle at 12% 18%, rgba(120, 90, 40, .10), transparent 40%),
    radial-gradient(circle at 88% 8%, rgba(90, 65, 25, .12), transparent 38%),
    radial-gradient(circle at 70% 90%, rgba(70, 50, 20, .10), transparent 42%),
    repeating-linear-gradient(90deg, rgba(90,70,30,.04) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(0deg, rgba(90,70,30,.03) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  background-attachment: fixed;
  line-height: 1.5;
}

/* paper fibers overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background-image:
    radial-gradient(rgba(60,42,12,.06) 1px, transparent 1.4px),
    radial-gradient(rgba(255,250,235,.10) 1px, transparent 1.4px);
  background-size: 5px 5px, 7px 7px;
  background-position: 0 0, 2px 3px;
  mix-blend-mode: multiply;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .02em; line-height: 1.1; margin: 0; }

button { font-family: inherit; cursor: pointer; }
select, input { font-family: inherit; }

:focus-visible {
  outline: 3px solid var(--stamp-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 100;
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ============================================================
   MASTHEAD
   ============================================================ */
.postmasthead {
  position: relative;
  z-index: 3;
  padding: 18px 22px 14px;
  background:
    linear-gradient(180deg, rgba(60,42,14,.06), rgba(60,42,14,.02)),
    var(--paper-deep);
  border-bottom: 2px solid var(--ink);
  box-shadow: 0 2px 0 var(--rule), 0 8px 18px -10px rgba(40,28,8,.5);
}
.mast-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.mast-brand { display: flex; align-items: center; gap: 14px; color: var(--ink); }
.mast-mark { width: 46px; height: 46px; color: var(--stamp-red); flex: 0 0 auto; }
.mast-titles { line-height: 1; }
.mast-name {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,250,235,.5);
}
.mast-sub {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.mast-rule {
  margin-top: 14px;
  height: 6px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 10px);
  opacity: .85;
}
.mast-perf {
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 10px;
  background-image: radial-gradient(circle, var(--paper) 2.4px, transparent 2.8px);
  background-size: 14px 10px;
  background-position: 0 0;
  opacity: .9;
}

/* Tally board */
.tally {
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, auto));
  gap: 8px;
  margin: 0;
  padding: 8px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.tally-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px 6px;
  border-right: 1px dashed var(--rule);
  text-align: center;
  min-width: 70px;
}
.tally-item:last-child { border-right: 0; }
.tally-key {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tally-key .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--ink); }
.tally-val {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-top: 2px;
}
.tally-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border-radius: 2px;
  transition: background .15s ease;
}
.tally-btn:hover { background: rgba(40,28,8,.06); }
.tally-btn.active { background: rgba(40,28,8,.10); box-shadow: inset 0 0 0 2px var(--ink); }

/* ============================================================
   SORTING DESK
   ============================================================ */
.desk {
  position: relative;
  z-index: 2;
  padding: 18px 22px 4px;
}
.desk-form {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-search { flex: 1 1 280px; min-width: 220px; }
.field-filter { flex: 0 1 240px; min-width: 200px; }
.field-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field-icon { width: 15px; height: 15px; color: var(--ink-soft); }
.field-input, .field-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 10px 12px;
  border-radius: 0;
  width: 100%;
}
.field-input::placeholder { color: var(--ink-faint); }
.field-select {
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.result-count {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ink-soft);
  text-transform: uppercase;
  white-space: nowrap;
  align-self: end;
  padding-bottom: 12px;
}
.desk-reset {
  align-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 10px 14px;
  margin-bottom: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
.desk-reset svg { width: 15px; height: 15px; }
.desk-reset:hover { background: var(--paper-deep); }
.desk-reset:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

/* ============================================================
   THE WALL
   ============================================================ */
.wall-wrap {
  position: relative;
  z-index: 1;
  padding: 22px 22px 60px;
}
.wall {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Pigeonhole cubby: the wooden slot behind the envelope */
.slot {
  position: relative;
  background:
    linear-gradient(180deg, var(--slot) 0%, var(--slot-shadow) 100%);
  border: 3px solid var(--ink);
  border-radius: 3px;
  box-shadow:
    inset 0 3px 6px rgba(40,28,8,.55),
    inset 0 -2px 4px rgba(255,250,235,.18),
    2px 3px 0 var(--ink),
    0 8px 18px -10px rgba(20,12,2,.6);
  padding: 10px;
  display: flex;
  align-items: stretch;
  min-height: 168px;
}
.slot::before {
  /* slot depth line */
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(40,28,8,.35);
  border-radius: 2px;
  pointer-events: none;
}

/* Envelope (the item) */
.env {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(160deg, var(--envelope) 0%, var(--envelope-2) 100%);
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  box-shadow: var(--shadow-card);
  padding: 10px 12px 10px;
  transform: rotate(-1.2deg);
  transition: transform .18s ease, box-shadow .18s ease;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  background-image:
    linear-gradient(160deg, var(--envelope) 0%, var(--envelope-2) 100%);
}
.env:nth-child(even) { transform: rotate(1.1deg); }
.env:hover, .env:focus-visible {
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 0 2px 0 rgba(255,255,255,.4) inset, 0 12px 22px -10px rgba(20,12,2,.7);
  outline: none;
}
.env-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.env-stamps { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* priority + status seals */
.seal {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--paper);
  padding: 3px 6px;
  border: 1.5px solid var(--paper);
  border-radius: 2px;
  background: var(--stamp-grey);
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
  white-space: nowrap;
  line-height: 1;
}
.seal.s-high { background: var(--stamp-red); }
.seal.s-medium { background: var(--stamp-blue); }
.seal.s-low { background: var(--stamp-grey); }

/* circular postmark status stamp */
.postmark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: grid;
  place-items: center;
  text-align: center;
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.05;
  color: var(--stamp-grey);
  background:
    radial-gradient(circle, rgba(231,216,179,.55) 58%, transparent 60%);
  position: relative;
  flex: 0 0 auto;
  transform: rotate(-8deg);
}
.postmark::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px dashed currentColor;
  border-radius: 50%;
}
.postmark small { display: block; font-size: 6.5px; letter-spacing: .08em; }
.pm-todo { color: var(--stamp-grey); }
.pm-in-progress { color: var(--stamp-blue); }
.pm-blocked { color: var(--stamp-red); }
.pm-done { color: var(--stamp-green); }

.env-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.18;
  color: var(--ink);
  margin: 2px 0 6px;
  letter-spacing: 0;
  text-transform: none;
}

.env-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: .03em;
  margin-top: auto;
}
.env-meta b { color: var(--ink); font-weight: 600; }
.env-meta .m-assignee { display: inline-flex; align-items: center; gap: 5px; }
.env-meta .m-assignee::before {
  content: "";
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink);
  display: inline-block;
  box-shadow: 0 0 0 1.5px var(--paper), inset 0 0 0 2px var(--envelope);
  background-image: linear-gradient(45deg, var(--paper-deep), var(--ink));
}

.env-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--rule);
}
.env-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 2px 5px;
  border-radius: 2px;
}
.env-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 5px 8px;
  border-radius: 2px;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .15s;
  min-height: 28px;
}
.env-open svg { width: 13px; height: 13px; }
.env:hover .env-open,
.env:focus-visible .env-open { background: var(--ink); color: var(--paper); }
.env-open:active { transform: translate(1.5px, 1.5px); box-shadow: 0 0 0 var(--ink); }

.comments-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.comments-chip svg { width: 13px; height: 13px; color: var(--ink-soft); }

/* status accent strip on left of envelope */
.env[data-status="todo"]      { box-shadow: var(--shadow-card), inset 3px 0 0 var(--st-todo); }
.env[data-status="in-progress"]{ box-shadow: var(--shadow-card), inset 3px 0 0 var(--st-progress); }
.env[data-status="blocked"]    { box-shadow: var(--shadow-card), inset 3px 0 0 var(--st-blocked); }
.env[data-status="done"]      { box-shadow: var(--shadow-card), inset 3px 0 0 var(--st-done); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  max-width: 520px;
  margin: 40px auto;
  text-align: center;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 32px 26px;
}
.empty-art { width: 150px; height: auto; margin: 0 auto 12px; display: block; color: var(--rule); }
.empty-title { font-family: var(--font-display); font-size: 26px; letter-spacing: .04em; text-transform: uppercase; }
.empty-body { font-size: 15px; color: var(--ink-soft); margin: 8px auto 18px; max-width: 38ch; }
.empty-recover {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--stamp-red);
  padding: 10px 16px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.empty-recover:hover { background: var(--stamp-red); }
.empty-recover:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--stamp-red); }

/* ============================================================
   FOOTER
   ============================================================ */
.postmark-foot {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 22px 40px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-top: 1px dashed var(--rule);
}
.foot-stamp {
  border: 2px solid var(--stamp-red);
  color: var(--stamp-red);
  padding: 4px 9px;
  border-radius: 2px;
  transform: rotate(-2deg);
  font-weight: 600;
}

/* ============================================================
   DETAIL DIALOG
   ============================================================ */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 2, .62);
  backdrop-filter: blur(2px);
  z-index: 50;
  animation: fade .18s ease;
}
.letter-modal {
  position: fixed;
  z-index: 51;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 0;
  border: none;
  background: transparent;
}
.letter-modal[hidden] { display: none; }

.letter {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink), 0 24px 50px -20px rgba(10,6,0,.7);
  border-radius: 3px;
}
/* envelope flap behind the letter */
.letter::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 70%;
  height: 60px;
  background: var(--envelope-2);
  border: 2px solid var(--ink);
  border-bottom: none;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  z-index: 0;
  box-shadow: 0 -6px 14px -10px rgba(10,6,0,.5);
}

.letter-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 12px;
  border-bottom: 2px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 9px) bottom / 100% 4px no-repeat,
    linear-gradient(180deg, var(--paper-deep), var(--paper));
}
.letter-headleft { min-width: 0; flex: 1; }
.letter-postalbar {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.letter-postalbar .id {
  border: 1.5px solid var(--ink);
  padding: 2px 7px;
  background: var(--paper);
  letter-spacing: .14em;
}
.letter-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(22px, 3.4vw, 30px);
  line-height: 1.12;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  margin: 2px 0 0;
  word-wrap: break-word;
}

.letter-stampbox { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: 0 0 auto; }
.letter-postmark {
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  display: grid;
  place-items: center;
  text-align: center;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.05;
  color: var(--stamp-grey);
  position: relative;
  transform: rotate(-7deg);
  background: radial-gradient(circle, rgba(231,216,179,.5) 58%, transparent 60%);
}
.letter-postmark::before { content: ""; position: absolute; inset: 4px; border: 1.5px dashed currentColor; border-radius: 50%; }
.letter-postmark small { display: block; font-size: 8px; letter-spacing: .08em; }

/* the big rubber stamp that appears on status change */
.bigstamp {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg) scale(1.6);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 38px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--stamp-red);
  border: 5px solid var(--stamp-red);
  padding: 8px 22px 6px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
  background: rgba(231,216,179,.25);
  text-shadow: 0 0 1px currentColor;
}
.bigstamp.is-stamping {
  animation: stamp 1s cubic-bezier(.2,1.4,.4,1) forwards;
}
.bigstamp.s-todo { color: var(--stamp-grey); border-color: var(--stamp-grey); }
.bigstamp.s-in-progress { color: var(--stamp-blue); border-color: var(--stamp-blue); }
.bigstamp.s-blocked { color: var(--stamp-red); border-color: var(--stamp-red); }
.bigstamp.s-done { color: var(--stamp-green); border-color: var(--stamp-green); }

.letter-body {
  position: relative;
  z-index: 1;
  padding: 18px 22px 6px;
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.letter-body .body-lead {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.letter-body .body-outcome {
  display: block;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-soft);
}
.letter-body .body-outcome b {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 4px;
}

.letter-meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  margin: 14px 22px 0;
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.meta-cell { background: var(--paper); padding: 9px 12px; }
.meta-cell dt, .meta-cell dd { margin: 0; }
.meta-cell .k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 2px;
}
.meta-cell .v { font-family: var(--font-mono); font-size: 13px; color: var(--ink); font-weight: 600; word-break: break-word; }
.meta-cell .v.tags { display: flex; flex-wrap: wrap; gap: 5px; font-weight: 400; }

/* status control panel */
.stamp-panel {
  position: relative;
  z-index: 1;
  margin: 16px 22px 0;
  padding: 14px;
  background:
    repeating-linear-gradient(45deg, rgba(40,28,8,.04) 0 6px, transparent 6px 12px),
    var(--paper-deep);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.stamp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.stamp-panel-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.stamp-panel-title svg { width: 18px; height: 18px; color: var(--stamp-red); }
.current-status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.current-status b { color: var(--ink); }

.field-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.status-row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.status-row .field-status { flex: 1 1 240px; }
.status-select {
  appearance: none;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 10px 36px 10px 12px;
  border-radius: 0;
  width: 100%;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.stamp-apply {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--stamp-red);
  padding: 10px 16px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s;
  min-height: 44px;
}
.stamp-apply svg { width: 16px; height: 16px; }
.stamp-apply:hover { background: var(--stamp-red); }
.stamp-apply:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--stamp-red); }

.letter-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 16px 22px 18px;
  flex-wrap: wrap;
}
.letter-foot-note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.close-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 11px 16px;
  min-height: 44px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s;
}
.close-detail svg { width: 16px; height: 16px; }
.close-detail:hover { background: var(--paper-deep); }
.close-detail:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .06em;
  padding: 12px 18px;
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--stamp-red);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast b { color: var(--paper); font-weight: 700; }
.toast .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes stamp {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(2.4); }
  35%  { opacity: .92; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
  60%  { opacity: .96; transform: translate(-50%, -50%) rotate(-14deg) scale(1.02); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .env, .env:nth-child(even) { transform: rotate(0deg) !important; }
  .bigstamp { display: none !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .wall { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .wall { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .mast-inner { flex-direction: column; align-items: flex-start; }
  .tally { width: 100%; }
  .letter-meta { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .wall { grid-template-columns: 1fr; gap: 14px; }
  .wall-wrap, .desk, .postmasthead, .postmark-foot { padding-left: 14px; padding-right: 14px; }
  .env { transform: rotate(0deg) !important; }
  .env:nth-child(even) { transform: rotate(0deg) !important; }
  .letter-meta { margin: 14px 14px 0; }
  .stamp-panel { margin: 14px 14px 0; }
  .letter-head, .letter-body, .letter-foot { padding-left: 16px; padding-right: 16px; }
  .letter-foot { flex-direction: column-reverse; align-items: stretch; }
  .close-detail { justify-content: center; }
  .stamp-panel-head { flex-direction: column; align-items: flex-start; }
  .letter::before { width: 84%; }
  .field-search, .field-filter { flex-basis: 100%; }
  .desk-reset { width: 100%; justify-content: center; }
  .result-count { padding-bottom: 4px; }
  .tally { grid-template-columns: repeat(2, 1fr); }
  .tally-item:nth-child(2n) { border-right: 0; }
}

@media (min-width: 1280px) {
  .wall { grid-template-columns: repeat(5, 1fr); }
}
