/* The One — Playground workspace. */

body.playground {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--ink);
}

.pg-frame {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--shell) * 2);
  height: calc(100dvh - var(--shell) * 2);
  margin: var(--shell);
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* ------------------------------------------------------------------ head */

.pg-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.7rem;
  padding: 0 clamp(0.9rem, 2vw, 1.5rem);
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pg-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex: none;
}

.pg-brand .brand-mark {
  background: var(--paper);
  color: var(--ink);
  width: 1.7rem;
  height: 1.7rem;
  font-size: 0.95rem;
}

.pg-brand span:last-child {
  font-family: var(--serif);
  font-size: 1.22rem;
  letter-spacing: -0.01em;
  line-height: 1;
}

.pg-divider {
  width: 1px;
  height: 1.2rem;
  background: rgba(244, 238, 226, 0.18);
}

.pg-crumb {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(244, 238, 226, 0.55);
}

.pg-head-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
}

.pg-engine {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 238, 226, 0.5);
  white-space: nowrap;
}

.pg-engine i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--muted-light);
  transition: background 0.3s var(--ease);
}

.pg-engine[data-state="on"] i {
  background: var(--copper-bright);
}

.pg-engine[data-state="err"] i {
  background: #b44a2e;
}

.pg-head .btn--solid {
  background: var(--copper);
  border-color: var(--copper);
  color: #fff;
}

.pg-head .btn--solid:hover {
  background: var(--copper-bright);
  border-color: var(--copper-bright);
  color: var(--ink);
}

.pg-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 238, 226, 0.55);
  transition: color 0.25s var(--ease);
}

.pg-back:hover {
  color: var(--paper);
}

.pg-back svg {
  width: 0.8rem;
}

/* ------------------------------------------------------------------ body */

.pg-body {
  flex: 1;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 430px;
  min-height: 0;
}

/* ------------------------------------------------------------------ rail */

.rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper-dim);
  border-right: 1px solid var(--line);
}

.rail-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1.2rem 1rem 0.95rem;
  border-bottom: 1px solid var(--line);
}

.rail-head .eyebrow {
  font-size: 0.52rem;
  color: var(--copper-deep);
}

.rail-title {
  margin-top: 0.25rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
}

.rail-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.35rem 0.55rem 0.8rem;
}

.rail-empty {
  padding: 1.6rem 0.8rem;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--muted);
}

.session {
  position: relative;
  border-bottom: 1px solid var(--line);
}

.session-main {
  display: block;
  width: 100%;
  padding: 0.8rem 2rem 0.8rem 0.7rem;
  text-align: left;
  transition: background 0.25s var(--ease);
}

.session:hover .session-main {
  background: rgba(251, 247, 238, 0.5);
}

.session.is-active .session-main {
  background: var(--paper-bright);
  box-shadow: inset 2px 0 0 var(--copper);
}

.session-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-eq {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 1.4;
  color: var(--copper-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  margin-top: 0.4rem;
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.session-meta span {
  position: relative;
}

.session-meta span + span::before {
  content: "·";
  position: absolute;
  left: -0.4rem;
  color: var(--muted-light);
}

.session-menu-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.35rem;
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}

.session:hover .session-menu-btn,
.session.is-menu-open .session-menu-btn,
.session.is-active .session-menu-btn {
  opacity: 1;
}

.session-menu-btn:hover {
  background: var(--paper);
  color: var(--text);
}

.session-menu {
  position: absolute;
  z-index: 20;
  top: 2.1rem;
  right: 0.35rem;
  min-width: 9.5rem;
  display: none;
  flex-direction: column;
  background: var(--paper-bright);
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 36px rgba(20, 16, 11, 0.16);
}

.session.is-menu-open .session-menu {
  display: flex;
}

.session-menu button,
.session-menu a {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  border-bottom: 1px solid var(--line);
  transition: background 0.2s var(--ease);
}

.session-menu button:last-child,
.session-menu a:last-child {
  border-bottom: 0;
}

.session-menu button:hover,
.session-menu a:hover {
  background: var(--paper);
  color: var(--copper-deep);
}

.session-menu .danger {
  color: #9b3a24;
}

.rail-foot {
  flex: none;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid var(--line);
}

.rail-foot p {
  font-size: 0.62rem;
  line-height: 1.55;
  color: var(--muted);
}

.rail-link {
  margin-top: 0.6rem;
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper-deep);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease);
}

.rail-link:hover {
  border-color: currentColor;
}

.rail-link[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* ------------------------------------------------------------------ chat */

.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--paper-bright);
  position: relative;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(1.2rem, 2.6vw, 2.4rem) clamp(1rem, 3vw, 3rem) 0.8rem;
  scrollbar-gutter: stable;
}

.chat-scroll::-webkit-scrollbar,
.rail-list::-webkit-scrollbar,
.law-body::-webkit-scrollbar,
.sheet-body::-webkit-scrollbar {
  width: 9px;
}

.chat-scroll::-webkit-scrollbar-thumb,
.rail-list::-webkit-scrollbar-thumb,
.law-body::-webkit-scrollbar-thumb,
.sheet-body::-webkit-scrollbar-thumb {
  background: rgba(26, 22, 17, 0.16);
  border: 3px solid transparent;
  background-clip: padding-box;
}

.msg {
  width: min(46rem, 100%);
  margin: 0 auto 1.5rem;
  animation: message-in 0.45s var(--ease) both;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.msg--user {
  display: flex;
  justify-content: flex-end;
}

.msg--user .bubble {
  max-width: min(34rem, 88%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 0.95rem;
  font-size: 0.82rem;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.msg--user .bubble p + p {
  margin-top: 0.55rem;
}

.msg--user .bubble code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: rgba(244, 238, 226, 0.12);
  padding: 0.08em 0.3em;
  color: var(--copper-bright);
}

.msg--user .bubble ul {
  margin: 0.4rem 0;
  padding-left: 1rem;
  list-style: disc;
}

.msg--assistant {
  position: relative;
  padding-left: 1.05rem;
  border-left: 1px solid rgba(181, 98, 44, 0.55);
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.msg-head .dot {
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--copper);
}

.msg-body {
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.msg-body p + p {
  margin-top: 0.65rem;
}

.msg-body strong {
  font-weight: 600;
  color: var(--text);
}

.msg-body em {
  font-style: italic;
}

.msg-body code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: rgba(26, 22, 17, 0.065);
  border: 1px solid rgba(26, 22, 17, 0.06);
  padding: 0.06em 0.3em;
  color: var(--copper-deep);
  overflow-wrap: anywhere;
}

.msg-body pre {
  margin: 0.6rem 0;
  padding: 0.7rem 0.8rem;
  background: var(--ink);
  color: var(--paper);
  overflow-x: auto;
  font-size: 0.74rem;
  line-height: 1.5;
}

.msg-body pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

.msg-body ul {
  margin: 0.5rem 0;
  padding-left: 1.1rem;
  list-style: disc;
}

.msg-body ul li + li {
  margin-top: 0.25rem;
}

.msg-body a {
  border-bottom: 1px solid currentColor;
}

/* status bubble */

.msg--status .msg-body {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.typing {
  display: inline-flex;
  gap: 0.18rem;
  align-items: center;
}

.typing i {
  width: 0.24rem;
  height: 0.24rem;
  border-radius: 50%;
  background: var(--copper);
  animation: pulse-dot 1.15s infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 0.14s;
}

.typing i:nth-child(3) {
  animation-delay: 0.28s;
}

.status-detail {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--muted-light);
  overflow-wrap: anywhere;
}

/* error bubble */

.msg--error .msg-body {
  color: #8f3420;
}

.msg--error .msg-actions {
  margin-top: 0.6rem;
}

/* empty state */

.empty {
  width: min(44rem, 100%);
  margin: 0 auto;
  padding: clamp(0.6rem, 4vh, 3.5rem) 0 1.5rem;
}

.empty-title {
  margin-top: 0.9rem;
  font-family: var(--serif);
  font-size: clamp(2.3rem, 4.4vw, 3.7rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--text);
}

.empty-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--copper-deep);
}

.empty-copy {
  margin-top: 1rem;
  max-width: 42ch;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--muted);
}

.empty-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 10.5rem;
  margin-top: 1.7rem;
  padding: 1.4rem;
  border: 1px dashed var(--line-strong);
  background: var(--paper);
  text-align: center;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease),
    transform 0.3s var(--ease);
}

.empty-drop:hover,
.empty-drop.is-over {
  border-color: var(--copper);
  background: #fdf9f1;
}

.empty-drop svg {
  width: 1.65rem;
  color: var(--copper);
  margin-bottom: 0.25rem;
}

.empty-drop .drop-title {
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.1;
}

.empty-drop .drop-sub {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.empty-row {
  margin-top: 1.4rem;
}

.empty-label {
  display: block;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.empty-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.empty-note {
  margin-top: 1.2rem;
  font-size: 0.66rem;
  color: var(--muted-light);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-soft);
  text-align: left;
  transition: border-color 0.22s var(--ease), background 0.22s var(--ease),
    color 0.22s var(--ease);
}

.chip:hover {
  border-color: var(--copper);
  color: var(--copper-deep);
  background: var(--paper);
}

.chip[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* suggestions + composer */

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: min(51rem, 100%);
  margin: 0 auto;
  padding: 0 0 0.55rem;
}

.suggestions:empty {
  display: none;
}

.suggestions .chip {
  background: var(--paper-bright);
}

.composer-wrap {
  flex: none;
  padding: 0.4rem clamp(1rem, 3vw, 3rem) 0.7rem;
  background: var(--paper-bright);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  width: min(51rem, 100%);
  margin: 0 auto;
  padding: 0.35rem 0.35rem 0.35rem 0.45rem;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.composer:focus-within {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(181, 98, 44, 0.08);
}

.composer-attach {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--muted);
  border: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.composer-attach:hover {
  color: var(--copper-deep);
  border-color: var(--line);
  background: var(--paper-bright);
}

.composer-attach[disabled],
.composer-send[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

.composer-attach svg {
  width: 1rem;
}

.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 2rem;
  max-height: 9rem;
  padding: 0.42rem 0;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 0.84rem;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.composer textarea::placeholder {
  color: var(--muted-light);
}

.composer-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--ink);
  color: var(--paper);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.composer-send:hover {
  background: var(--copper);
}

.composer-send svg {
  width: 0.95rem;
}

.composer-send[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.composer-note {
  width: min(51rem, 100%);
  margin: 0.4rem auto 0;
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: var(--muted-light);
  text-align: center;
}

/* message cards */

.law-summary {
  margin-top: 0.8rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--copper);
  background: var(--paper);
}

.law-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.law-summary-top .tag {
  border-color: rgba(181, 98, 44, 0.32);
  color: var(--copper-deep);
  font-size: 0.55rem;
}

.law-summary-time {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
}

.law-summary-eq {
  margin-top: 0.65rem;
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.25;
  color: var(--text);
  overflow-wrap: anywhere;
}

.law-summary-meta {
  margin-top: 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.law-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.law-summary-actions button {
  padding: 0.38rem 0.6rem;
  border: 1px solid var(--line);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.law-summary-actions button:hover {
  border-color: var(--copper);
  color: var(--copper-deep);
  background: var(--paper-bright);
}

.result-card {
  margin-top: 0.8rem;
  padding: 1rem 1.1rem;
  background: var(--ink);
  color: var(--paper);
}

.result-card-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(244, 238, 226, 0.48);
}

.result-card-value {
  margin-top: 0.45rem;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--paper-bright);
  overflow-wrap: anywhere;
}

.result-card-value small {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--copper-bright);
  margin-left: 0.35rem;
}

.result-card-note {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: rgba(244, 238, 226, 0.58);
}

.result-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.result-inputs span {
  padding: 0.22rem 0.45rem;
  border: 1px solid rgba(244, 238, 226, 0.18);
  font-family: var(--mono);
  font-size: 0.58rem;
  color: rgba(244, 238, 226, 0.72);
}

.result-warnings {
  margin-top: 0.6rem;
  font-size: 0.62rem;
  line-height: 1.5;
  color: #e2b48f;
}

.confidence-list {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.confidence-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr auto;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.64rem;
  color: rgba(244, 238, 226, 0.7);
}

.confidence-bar {
  height: 2px;
  background: rgba(244, 238, 226, 0.16);
  position: relative;
}

.confidence-bar i {
  position: absolute;
  inset: 0;
  background: var(--copper-bright);
  transform-origin: left;
}

.confidence-row span:last-child {
  font-family: var(--mono);
  font-size: 0.56rem;
  color: rgba(244, 238, 226, 0.55);
}

.attachment-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: min(34rem, 88%);
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(244, 238, 226, 0.2);
  background: var(--ink-soft);
  color: var(--paper);
}

.attachment-card svg {
  flex: none;
  width: 1.2rem;
  color: var(--copper-bright);
}

.attachment-card .attach-title {
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.35;
}

.attachment-card .attach-meta {
  margin-top: 0.2rem;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 238, 226, 0.5);
}

.msg-actions {
  display: flex;
  gap: 0.45rem;
}

/* ------------------------------------------------------------------- law */

.law {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--paper);
  border-left: 1px solid var(--line);
}

.law.is-fresh {
  animation: law-flash 1.4s var(--ease);
}

@keyframes law-flash {
  0% {
    box-shadow: inset 0 0 0 2px rgba(181, 98, 44, 0.7);
  }
  100% {
    box-shadow: inset 0 0 0 2px rgba(181, 98, 44, 0);
  }
}

.law-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  height: 3rem;
  padding: 0 0.65rem 0 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.law-tabs {
  display: flex;
  align-self: stretch;
}

.law-tabs button {
  position: relative;
  padding: 0 0.7rem;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.law-tabs button::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: -1px;
  height: 1px;
  background: var(--copper);
  transform: scaleX(0);
  transition: transform 0.3s var(--ease);
}

.law-tabs button:hover {
  color: var(--text);
}

.law-tabs button[aria-selected="true"] {
  color: var(--text);
}

.law-tabs button[aria-selected="true"]::after {
  transform: scaleX(1);
}

.law-actions {
  display: flex;
  gap: 0.3rem;
}

.law-actions .icon-btn {
  width: 1.85rem;
  height: 1.85rem;
  border-color: transparent;
}

.law-actions .icon-btn:hover {
  border-color: var(--ink);
}

.law-actions .icon-btn[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.law-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1.05rem 1.4rem;
}

.law-empty {
  padding: 2.4rem 1rem;
  text-align: center;
}

.law-empty svg {
  width: 2.2rem;
  margin: 0 auto 1rem;
  color: var(--copper);
  opacity: 0.7;
}

.law-empty-title {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.law-empty p {
  margin: 0.6rem auto 0;
  max-width: 30ch;
  font-size: 0.72rem;
  line-height: 1.65;
  color: var(--muted);
}

.law-result {
  padding: 0.95rem 1rem;
  background: var(--ink);
  color: var(--paper);
}

.law-result-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(244, 238, 226, 0.48);
}

.law-result-label .live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--copper-bright);
}

.law-result-label .live::before {
  content: "";
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: currentColor;
}

.law-result-value {
  margin-top: 0.45rem;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 2.6vw, 2.25rem);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--paper-bright);
  overflow-wrap: anywhere;
}

.law-result-value small {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--copper-bright);
  margin-left: 0.3rem;
}

.law-result-note {
  margin-top: 0.4rem;
  font-size: 0.63rem;
  line-height: 1.5;
  color: rgba(244, 238, 226, 0.58);
}

.law-result-note.is-error {
  color: #eab08b;
}

.law-section {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.law-section:last-child {
  border-bottom: 0;
}

.law-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

.law-section-head h3,
.law-section-head h4 {
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.law-section-head .tag {
  font-size: 0.5rem;
  padding: 0.12rem 0.4rem;
}

.law-eq {
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  background: var(--paper-bright);
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 0.95rem;
  line-height: 1.5;
}

.law-eq .katex {
  font-size: 1.02em;
}

.law-eq code {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.law-general {
  margin-top: 0.55rem;
}

.law-general .law-eq {
  border-color: rgba(181, 98, 44, 0.3);
  background: #fdf9f2;
}

.law-note {
  margin-top: 0.55rem;
  font-size: 0.67rem;
  line-height: 1.6;
  color: var(--muted);
}

.constant-list {
  margin-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.constant-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
}

.constant-list span {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--copper-deep);
}

.constant-list code {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-soft);
}

.control {
  margin-top: 0.75rem;
}

.control:first-of-type {
  margin-top: 0.2rem;
}

.control-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-soft);
}

.control-head .unit {
  margin-left: 0.25rem;
  font-size: 0.56rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.control-row .range {
  flex: 1;
}

.control-number {
  width: 4.7rem;
  flex: none;
  border: 1px solid var(--line);
  background: var(--paper-bright);
  padding: 0.24rem 0.35rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  text-align: right;
  color: var(--text);
}

.control-select {
  width: 100%;
  margin-top: 0.3rem;
  border: 1px solid var(--line);
  background: var(--paper-bright);
  padding: 0.4rem 1.7rem 0.4rem 0.5rem;
  font-size: 0.7rem;
}

.control-hint {
  margin-top: 0.2rem;
  font-size: 0.56rem;
  color: var(--muted-light);
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.metric {
  background: var(--paper-bright);
  padding: 0.55rem 0.6rem;
}

.metric dt {
  font-size: 0.48rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric dd {
  margin: 0.2rem 0 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.badge-row .tag {
  font-size: 0.52rem;
}

.badge-row .split {
  font-size: 0.54rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.influence {
  margin-top: 0.6rem;
}

.influence-row {
  display: grid;
  grid-template-columns: minmax(5.5rem, 7rem) 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.28rem 0;
  font-size: 0.6rem;
  color: var(--text-soft);
}

.influence-row span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.influence-bar {
  height: 3px;
  background: rgba(26, 22, 17, 0.08);
  position: relative;
}

.influence-bar i {
  position: absolute;
  inset: 0;
  background: var(--copper);
  transform-origin: left;
}

.influence-row code {
  font-family: var(--mono);
  font-size: 0.55rem;
  color: var(--muted);
}

.law-ask {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.law-ask button {
  padding: 0.32rem 0.5rem;
  border: 1px solid var(--line);
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.law-ask button:hover {
  border-color: var(--copper);
  color: var(--copper-deep);
  background: var(--paper-bright);
}

.note-stack {
  margin-top: 0.7rem;
}

.note-item {
  position: relative;
  padding: 0.4rem 0 0.4rem 0.85rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.65rem;
  line-height: 1.55;
  color: var(--muted);
}

.note-item::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--copper);
}

.note-item.is-warning {
  color: #895031;
}

.note-item.is-warning::before {
  content: "!";
  font-weight: 600;
}

.note-item code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--text-soft);
  background: rgba(181, 98, 44, 0.07);
  padding: 0.05em 0.28em;
}

/* data tab */

.data-source {
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.data-source h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.2;
}

.data-source p {
  margin-top: 0.25rem;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.data-block {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
}

.data-block:last-child {
  border-bottom: 0;
}

.data-block h4 {
  margin-bottom: 0.55rem;
  font-size: 0.54rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  max-height: 17rem;
  border: 1px solid var(--line);
  background: var(--paper-bright);
}

.table-wrap table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.table-wrap th,
.table-wrap td {
  padding: 0.36rem 0.5rem;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.table-wrap th:last-child,
.table-wrap td:last-child {
  border-right: 0;
}

.table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap td.is-target {
  background: rgba(181, 98, 44, 0.06);
  color: var(--copper-deep);
  font-weight: 500;
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

.residual-list {
  border-top: 1px solid var(--line);
}

.residual-row {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  gap: 0.5rem;
  padding: 0.36rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.62rem;
  color: var(--text-soft);
}

.residual-row .row-id {
  font-family: var(--mono);
  font-size: 0.55rem;
  color: var(--muted);
}

.residual-row code {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--copper-deep);
}

/* chart tab */

.chart-block {
  padding: 0.6rem 0 1rem;
  border-bottom: 1px solid var(--line);
}

.chart-block:last-child {
  border-bottom: 0;
}

.chart-block h4 {
  margin-bottom: 0.55rem;
  font-size: 0.54rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-block svg {
  width: 100%;
  height: auto;
  background: var(--paper-bright);
  border: 1px solid var(--line);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.56rem;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chart-legend i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--copper);
}

.chart-legend i.val {
  background: var(--ink);
}

.chart-legend i.line {
  width: 1rem;
  height: 1px;
  border-radius: 0;
  background: var(--ink);
}

.residual-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.residual-bar {
  display: grid;
  grid-template-columns: 2.4rem 1fr 3.6rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.58rem;
  color: var(--muted);
}

.residual-track {
  height: 3px;
  background: rgba(26, 22, 17, 0.08);
}

.residual-track i {
  display: block;
  height: 100%;
  background: var(--copper);
  transform-origin: left;
}

.residual-bar code {
  font-family: var(--mono);
  font-size: 0.55rem;
  text-align: right;
  color: var(--text-soft);
}

/* ---------------------------------------------------------------- attach */

.attach-tabs {
  flex: none;
  display: flex;
  gap: 0.2rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.attach-tabs button {
  position: relative;
  padding: 0.8rem 0.85rem;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.attach-tabs button::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: -1px;
  height: 2px;
  background: var(--copper);
  transform: scaleX(0);
  transition: transform 0.25s var(--ease);
}

.attach-tabs button.is-active {
  color: var(--text);
}

.attach-tabs button.is-active::after {
  transform: scaleX(1);
}

.attach-panel {
  animation: fade-in 0.3s ease both;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 18rem;
  padding: 2rem;
  border: 1px dashed var(--line-strong);
  background: var(--paper);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--copper);
  background: #fdf9f1;
}

.dropzone svg {
  width: 2rem;
  color: var(--copper);
}

.dropzone .drop-title {
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1.15;
}

.dropzone .drop-sub {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.7;
}

.dropzone.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

.attach-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.attach-form .field > span {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.attach-form .field > span em {
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted-light);
}

.attach-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.tab-hint {
  margin-bottom: 0.8rem;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--muted);
}

.sample-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.sample-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
  transition: border-color 0.22s var(--ease), background 0.22s var(--ease),
    transform 0.22s var(--ease);
}

.sample-card:hover {
  border-color: var(--copper);
  background: var(--paper-bright);
  transform: translateY(-1px);
}

.sample-card h4 {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1.15;
}

.sample-card p {
  font-size: 0.64rem;
  line-height: 1.55;
  color: var(--muted);
}

.sample-card .tag {
  font-size: 0.48rem;
  padding: 0.12rem 0.35rem;
}

.sample-preview {
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.56rem;
  line-height: 1.5;
  color: var(--copper-deep);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.attach-error {
  margin-top: 0.8rem;
  padding: 0.6rem 0.7rem;
  border-left: 2px solid #a33b23;
  background: #fbeee8;
  font-size: 0.7rem;
  line-height: 1.55;
  color: #86301d;
}

/* ----------------------------------------------------------------- layer */

.layer-dialog .sheet {
  height: calc(100vh - 2rem);
  height: calc(100dvh - 2rem);
}

.layer-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(21rem, 0.9fr);
  gap: 1.5rem;
  padding: 1.2rem 1.5rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.layer-left,
.layer-right {
  min-width: 0;
}

.layer-table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}

.layer-table-head h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
}

.layer-table-head span {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.layer-table .table-wrap,
#layer-table .table-wrap {
  max-height: calc(100dvh - 17rem);
}

.layer-table .table-wrap table,
#layer-table .table-wrap table {
  font-size: 0.66rem;
}

.layer-table .table-wrap th,
.layer-table .table-wrap td,
#layer-table .table-wrap th,
#layer-table .table-wrap td {
  padding: 0.42rem 0.55rem;
}

.supplied-note {
  margin-top: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-left: 2px solid var(--copper);
  background: var(--paper);
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--text-soft);
}

.supplied-note code {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--copper-deep);
}

.layer-right .field + .field {
  margin-top: 0.8rem;
}

.field-hint {
  font-size: 0.6rem;
  line-height: 1.5;
  color: var(--muted-light);
}

.field > span em {
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted-light);
}

fieldset.field {
  margin: 0.85rem 0 0;
  padding: 0;
  border: 0;
}

fieldset.field legend {
  padding: 0;
  margin-bottom: 0.4rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.feature-list {
  display: flex;
  flex-direction: column;
  max-height: 12.5rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: var(--paper-bright);
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.feature-item:last-child {
  border-bottom: 0;
}

.feature-item:hover {
  background: var(--paper);
}

.feature-item .check {
  flex: 1;
  font-size: 0.72rem;
}

.feature-item > input[type="checkbox"] {
  flex: none;
  width: 0.85rem;
  height: 0.85rem;
  margin: 0.16rem 0 0;
  accent-color: var(--copper);
  cursor: pointer;
}

.feature-item .feature-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  flex: none;
}

.feature-item .tag {
  font-size: 0.45rem;
  padding: 0.1rem 0.3rem;
  letter-spacing: 0.08em;
}

.feature-kind {
  font-family: var(--mono);
  font-size: 0.52rem;
  color: var(--muted-light);
}

.settings {
  margin-top: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}

.settings summary {
  cursor: pointer;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  list-style: none;
}

.settings summary::-webkit-details-marker {
  display: none;
}

.settings summary::after {
  content: "+";
  float: right;
  color: var(--copper);
}

.settings[open] summary::after {
  content: "−";
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.settings-grid .field[hidden] {
  display: none;
}

.settings-grid .field span {
  font-size: 0.52rem;
}

.design-preview {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.design-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.45rem;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.design-head span:last-child {
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted-light);
}

.table-wrap--small {
  max-height: 9.5rem;
}

.table-wrap--small table {
  font-size: 0.56rem;
}

.design-loading {
  padding: 1.3rem;
  text-align: center;
  font-size: 0.62rem;
  color: var(--muted);
  background: linear-gradient(
    90deg,
    rgba(26, 22, 17, 0.03) 25%,
    rgba(26, 22, 17, 0.07) 37%,
    rgba(26, 22, 17, 0.03) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

.layer-error {
  margin-top: 0.7rem;
  padding: 0.55rem 0.65rem;
  border-left: 2px solid #a33b23;
  background: #fbeee8;
  font-size: 0.68rem;
  line-height: 1.55;
  color: #86301d;
}

.layer-foot-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sheet--small {
  width: min(28rem, calc(100vw - 2rem));
}

.sheet--small .sheet-body {
  padding: 1.2rem 1.5rem;
}

.sheet--small .sheet-foot {
  justify-content: flex-end;
}

.confirm-copy {
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--text-soft);
}

.confirm-copy strong {
  color: var(--text);
  font-weight: 500;
}

/* ------------------------------------------------------------ mobile tabs */

.pg-mobile-tabs {
  display: none;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 1240px) {
  .pg-body {
    grid-template-columns: 224px minmax(0, 1fr) 390px;
  }
}

@media (max-width: 1020px) {
  .pg-body {
    grid-template-columns: 210px minmax(0, 1fr) 360px;
  }

  .pg-engine {
    display: none;
  }
}

@media (max-width: 900px) {
  .pg-frame {
    margin: 0;
    height: 100vh;
    height: 100dvh;
    border: 0;
    box-shadow: none;
  }

  .pg-head {
    height: 3.35rem;
    padding: 0 0.8rem;
    gap: 0.65rem;
  }

  .pg-divider,
  .pg-crumb {
    display: none;
  }

  .pg-head-right .btn--small {
    min-height: 2rem;
    padding: 0.45rem 0.7rem;
    font-size: 0.54rem;
  }

  .pg-back span {
    display: none;
  }

  .pg-body {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  .rail,
  .law {
    display: none;
    grid-area: 1 / 1;
    border: 0;
  }

  .chat {
    grid-area: 1 / 1;
  }

  body[data-view="sessions"] .chat,
  body[data-view="law"] .chat {
    display: none;
  }

  body[data-view="sessions"] .rail {
    display: flex;
  }

  body[data-view="law"] .law {
    display: flex;
  }

  .pg-mobile-tabs {
    flex: none;
    display: flex;
    height: 3rem;
    background: var(--paper);
    border-top: 1px solid var(--line);
  }

  .pg-mobile-tabs button {
    flex: 1;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  }

  .pg-mobile-tabs button.is-active {
    color: var(--copper-deep);
    box-shadow: inset 0 2px 0 var(--copper);
  }

  .rail-head {
    padding-top: 1rem;
  }

  .rail-list {
    padding-bottom: 1.2rem;
  }

  .law-body {
    padding: 1rem 1.15rem 2rem;
  }

  .layer-dialog .sheet {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .layer-body {
    grid-template-columns: 1fr;
  }

  .layer-table .table-wrap,
  #layer-table .table-wrap {
    max-height: 16rem;
  }
}

@media (max-width: 620px) {
  .pg-brand span:last-child {
    display: none;
  }

  .pg-head-right {
    gap: 0.5rem;
  }

  .pg-head-right .btn--small {
    letter-spacing: 0.08em;
  }

  .chat-scroll {
    padding: 1.1rem 1rem 0.6rem;
  }

  .composer-wrap {
    padding: 0.35rem 0.8rem 0.55rem;
  }

  .composer-note {
    display: none;
  }

  .suggestions {
    padding-bottom: 0.5rem;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .suggestions .chip {
    flex: none;
  }

  .empty {
    padding-top: 1rem;
  }

  .empty-title {
    font-size: clamp(2.05rem, 9.4vw, 2.8rem);
  }

  .empty-drop {
    min-height: 9rem;
  }

  .law-summary-eq {
    font-size: 1.12rem;
  }

  .result-card-value {
    font-size: 2rem;
  }

  .attach-tabs {
    padding: 0 0.8rem;
  }

  .sample-list {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .sheet-head {
    padding: 1rem;
  }

  .sheet-body {
    padding: 1rem;
  }

  .layer-body {
    padding: 1rem;
  }

  .layer-foot-actions {
    flex: 1;
    justify-content: flex-end;
  }

  .sheet-foot {
    padding: 0.8rem 1rem;
  }

  .sheet-note {
    display: none;
  }

  .sheet-foot .btn {
    flex: 1;
  }

  dialog .sheet {
    width: calc(100vw - 0.8rem);
    max-height: calc(100dvh - 0.8rem);
  }
}
