@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-latin-wght.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  font-optical-sizing: auto;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --desk: #d5dce4;
  --sheet: #f4f6f8;
  --ink: #101820;
  --muted: #5a6572;
  --rule: rgba(16, 24, 32, 0.12);
  --metal: #c4a035;
  --hold: #1f4a73;
  --down: #9b1d18;
  --display: clamp(2.4rem, 7vw, 5.2rem);
  --ease-tag: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--desk);
}
a { color: var(--hold); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--metal);
  outline-offset: 3px;
}

.page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 9.5rem 1fr;
}
.zonefile {
  padding: 2rem 0.85rem 2rem 1.05rem;
}
.zonefile pre {
  margin: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
}
.sheet {
  background: var(--sheet);
  margin: 1.15rem 1.15rem 1.15rem 0;
  padding: 2rem clamp(1.2rem, 4vw, 2.6rem) 2.75rem;
  min-height: calc(100dvh - 2.3rem);
}
.sheet--narrow { max-width: 42rem; }
.sheet--wide { max-width: 74rem; }

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.55rem;
}
.display {
  font-family: "Bricolage Grotesque", "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: var(--display);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0 0 1rem;
}
.display--kit {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}
.lede {
  max-width: 36rem;
  margin: 0 0 1.15rem;
}
.statline,
.sent,
.colophon {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
}
.colophon {
  font-size: 0.72rem;
  margin: 3rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.sent { margin: 1.25rem 0 0.35rem; }

nav.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
nav.top a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.35rem 0 0;
}
.btn {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.68rem 1.05rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}
.btn.primary {
  background: var(--ink);
  color: var(--sheet);
  border-color: var(--ink);
}
.btn.primary:hover {
  background: var(--sheet);
  color: var(--ink);
}
.btn:not(.primary):hover { border-color: var(--ink); }

.tag-anchor {
  display: block;
  color: inherit;
  text-decoration: none;
  margin: 2.1rem 0 2.4rem;
  max-width: 40rem;
}
.tag {
  display: grid;
  grid-template-columns: 4.75rem 1fr;
  background: var(--sheet);
  max-width: 40rem;
  min-height: 16.5rem;
  animation: settle 420ms var(--ease-tag) both;
}
@keyframes settle {
  from { transform: translateY(10px); }
  to { transform: none; }
}
.tag-rail {
  background: var(--metal);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 0;
  position: relative;
}
.tag-rail span {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.tag-rail::after {
  content: "";
  position: absolute;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  background-image: radial-gradient(circle, var(--desk) 2.35px, transparent 2.5px);
  background-size: 10px 13px;
  background-repeat: repeat-y;
  background-position: center top;
  pointer-events: none;
}
.tag-body { padding: 1.45rem 1.55rem 1.65rem 1.7rem; }
.tag-name {
  font-size: clamp(1.85rem, 5vw, 2.85rem);
  overflow-wrap: anywhere;
  word-break: break-word;
  margin-bottom: 0.35rem;
}
.bin {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: 0.04em;
  margin: 0.35rem 0 0.15rem;
  font-variant-numeric: tabular-nums;
}
.month,
.fine {
  color: var(--muted);
  margin: 0 0 0.45rem;
}
.fine { font-size: 0.88rem; max-width: 28rem; }

.stub {
  position: relative;
  display: grid;
  gap: 0.75rem;
  max-width: 40rem;
  margin-top: 0.35rem;
  padding-top: 1.85rem;
}
.stub::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  background-image: radial-gradient(circle, var(--desk) 2.35px, transparent 2.5px);
  background-size: 13px 10px;
  background-repeat: repeat-x;
  background-position: center;
}
.stub h2 {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0;
}
.stub .btn.primary { width: 100%; text-align: center; }

label { display: grid; gap: 0.25rem; font-size: 0.88rem; }
input, textarea {
  font: inherit;
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--rule);
  background: var(--sheet);
  color: var(--ink);
}

.tools-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem 2.25rem;
  margin: 0.4rem 0 0;
  padding: 0;
}
.tools-dl div { display: grid; gap: 0.2rem; }
.tools-dl dt {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 500;
  margin: 0;
}
.tools-dl dd {
  margin: 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.35rem;
  border-bottom: 1px solid var(--rule);
  margin: 0 0 1.35rem;
}
.tab {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.55rem 0;
  margin-bottom: -1px;
  color: var(--muted);
  cursor: pointer;
}
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--metal);
}
.tab:hover { color: var(--ink); }

#panel { overflow-x: auto; }
.ledger {
  width: 100%;
  min-width: 40rem;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.ledger th,
.ledger td {
  text-align: left;
  padding: 0.85rem 0.85rem 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.ledger th {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  background: var(--sheet);
  position: sticky;
  top: 0;
  z-index: 1;
}
.ledger .zone {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.88rem;
}
.ledger .num {
  text-align: right;
  white-space: nowrap;
  padding-right: 1.75rem;
}
.ledger .bin-cell { font-weight: 500; }
.ledger th:last-child,
.ledger td:last-child {
  padding-right: 0;
  white-space: nowrap;
}
.ledger tbody tr:hover {
  background: color-mix(in srgb, var(--desk) 40%, var(--sheet));
}

.sell { color: var(--hold); font-weight: 500; }
.keep { color: var(--muted); }
.down { color: var(--down); font-weight: 500; }
.ok { color: var(--hold); }

.card {
  max-width: 36rem;
  padding: 0;
}
.card h2 {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
}
.card p { margin: 0; color: var(--muted); }

.pass { min-height: 0; margin: 1.75rem 0 2.4rem; }
.pass .tag-name { margin-bottom: 0.85rem; }
.pass-form {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 0.35rem;
}
.pass-form .btn.primary { width: 100%; text-align: center; }
.who {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--muted);
}
.who a { color: inherit; font-weight: 500; }

@media (max-width: 720px) {
  .page { grid-template-columns: 1fr; }
  .zonefile { padding: 0.7rem 1rem 0.45rem; }
  .zonefile pre {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sheet {
    margin: 0 0.7rem 0.7rem;
    min-height: calc(100dvh - 3.1rem);
    padding: 1.4rem 1.15rem 2.25rem;
  }
  .tools-dl { grid-template-columns: 1fr; }
  .tag {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .tag-rail {
    flex-direction: row;
    justify-content: space-between;
    padding: 0.7rem 1rem;
  }
  .tag-rail span {
    writing-mode: horizontal-tb;
    transform: none;
  }
  .tag-rail::after {
    top: auto;
    right: 0;
    bottom: -5px;
    width: 100%;
    height: 10px;
    background-repeat: repeat-x;
    background-size: 13px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tag { animation: none; }
  * { transition: none !important; }
}
