:root {
  --paper: #f4efe6;
  --shelf: #e6dfd2;
  --ink: #1c1915;
  --muted: #5c564c;
  --line: rgba(28, 25, 21, 0.16);
  --pine: #2c3f36;
  --brass: #c9a36a;
  --serif: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  --sans: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.5;
  min-height: 100vh;
}

::selection { background: rgba(201, 163, 106, 0.35); }

:focus-visible {
  outline: 1px solid var(--pine);
  outline-offset: 3px;
}

a { color: var(--pine); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 22px;
  padding: 18px 28px 14px;
  border-bottom: 1px solid rgba(201, 163, 106, 0.9);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-mark line {
  stroke: var(--brass);
  stroke-width: 1.35;
  stroke-linecap: round;
}
.brand-mark .n-y { fill: #fedf00; }
.brand-mark .n-b { fill: #0018a8; }
.brand-mark .n-r { fill: #d52b1e; }

.langs, .rooms {
  display: flex;
  align-items: center;
  gap: 16px;
}

.langs button,
.rooms button,
.rooms .room {
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 2px 0;
  text-decoration: none;
  cursor: pointer;
}

.langs button {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.langs button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--brass);
}

.rooms button,
.rooms .room {
  border-bottom-color: var(--brass);
}

.desk-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.desk-label.here { color: var(--ink); }

.door .site-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.product {
  margin: 0;
  justify-self: center;
  font-family: var(--serif);
  font-size: 1.05rem;
  text-align: center;
}

.door .langs { justify-self: end; }

.gate {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
  padding: 24px 28px 72px;
}

.gate-stack {
  display: grid;
  justify-items: center;
  gap: 28px;
}

#open-andorra {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--brass);
  border-radius: 0;
  padding: 0 0 8px;
  cursor: pointer;
}

.code-form {
  display: grid;
  gap: 12px;
  width: min(18rem, calc(100vw - 56px));
  margin-top: 28px;
}

.code-form label {
  font-family: var(--serif);
  font-size: 1.15rem;
}

.code-form input {
  font-family: var(--sans);
  font-size: 1.02rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--brass);
  border-radius: 0;
  padding: 8px 0;
  width: 100%;
}

.code-form button {
  justify-self: start;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--brass);
  border-radius: 0;
  padding: 2px 0 4px;
  cursor: pointer;
}

.code-error {
  margin: 0;
  color: var(--pine);
  font-family: var(--serif);
  font-size: 1rem;
}

.door main {
  max-width: 38rem;
  padding: 64px 28px 28px;
}

.door h1,
.door main p {
  font-family: var(--serif);
}

.door h1 {
  font-size: clamp(2.2rem, 5vw, 3.35rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--muted);
}

.door .kicker {
  font-style: italic;
  font-size: 1.05rem;
}

.lead {
  font-size: 1.28rem;
  line-height: 1.4;
}

.enter {
  margin: 28px 0 0;
}

.enter button {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--brass);
  border-radius: 0;
  padding: 0 0 4px;
  cursor: pointer;
  text-align: left;
}

.workshop {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.92rem;
  color: var(--muted);
}

.foot {
  padding: 8px 28px 32px;
  font-size: 0.92rem;
}

.supervision {
  margin: 0;
  padding: 14px 28px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  align-items: stretch;
  min-height: calc(100vh - 112px);
}

.layout aside {
  background: var(--shelf);
  border-right: 1px solid var(--line);
  padding: 20px 16px 48px 20px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 16px;
}

.filters button {
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 2px 0;
  cursor: pointer;
}

.filters button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom: 2px solid var(--brass);
  background: transparent;
}

.matter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.matter-list button {
  width: 100%;
  font: inherit;
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 2px;
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
  padding: 10px 12px;
  cursor: pointer;
}

.matter-list button[aria-pressed="true"] {
  background: var(--paper);
  border-left-color: var(--brass);
}

.mid {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.mname {
  font-size: 0.95rem;
  line-height: 1.3;
}

.mpri { color: var(--muted); font-size: 0.75rem; }
.mpri.today { color: var(--pine); }

.matter-list button[aria-pressed="true"] .mid,
.matter-list button[aria-pressed="true"] .mpri { color: var(--muted); }
.matter-list button[aria-pressed="true"] .mpri.today { color: var(--pine); }

#matter {
  padding: 32px 40px 72px;
  max-width: 44rem;
}

.matter-id {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.desk h1,
.profile,
.answer,
#steps,
.docs,
#blocks,
.drafts {
  font-family: var(--serif);
}

.desk h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 3vw, 2.45rem);
  font-weight: 500;
  line-height: 1.15;
}

.profile {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.asks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 22px;
  border-bottom: 1px solid var(--line);
}

.asks button {
  font: inherit;
  font-size: 0.92rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 8px 0;
  cursor: pointer;
}

.asks button[aria-pressed="true"] {
  color: var(--ink);
  background: transparent;
  border-bottom: 2px solid var(--brass);
}

.answer {
  min-height: 4.5rem;
  margin: 0;
  padding: 18px 0 4px;
  font-size: 1.22rem;
  line-height: 1.45;
}

.desk section { margin-top: 28px; }

.desk h2 {
  margin: 0 0 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs, .drafts, #blocks, #steps {
  margin: 0;
  padding-left: 1.15rem;
}

.docs li { margin: 0 0 14px; }
.docs p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

#steps li[data-current="1"] {
  color: var(--pine);
  font-weight: 650;
}
#steps li[data-later="1"] { color: var(--muted); }

.pill {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pine);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: baseline;
  margin-top: 14px;
}

.actions button {
  font: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 6px 0;
  cursor: pointer;
}

#draft {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 1px solid var(--brass);
}

#send, #file { color: var(--muted); }

.actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#drafts li[data-prepared="1"] {
  list-style: none;
  margin: 8px 0 8px -1.15rem;
  padding: 14px 16px 14px 14px;
  background: #efe8da;
  border-left: 2px solid var(--brass);
}

#drafts li[data-prepared="1"] div + div { margin-top: 4px; }

#drafts li[data-prepared="1"] div:last-child {
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--pine);
}

.action-note {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 800px) {
  .site-header { padding-left: 18px; padding-right: 18px; }
  .door .site-header { display: flex; flex-wrap: wrap; }
  .door .langs { margin-left: auto; }
  .product {
    order: 3;
    flex-basis: 100%;
    text-align: left;
    padding-top: 8px;
    white-space: nowrap;
  }
  .supervision { padding-left: 18px; padding-right: 18px; }
  .door main { padding: 36px 18px 24px; }
  .foot { padding-left: 18px; padding-right: 18px; }
  .layout {
    grid-template-columns: 1fr;
    min-height: 0;
    min-width: 0;
  }
  .layout aside {
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 0 12px;
  }
  .filters { padding: 0 18px; }
  .matter-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 18px 6px;
  }
  .matter-list li {
    flex: 0 0 auto;
    width: 15.5rem;
  }
  .matter-list button { height: 100%; }
  #matter { padding: 22px 18px 56px; }
  .asks {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}
