/* file / attachment rows */
.files {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--m-border);
  border-radius: var(--m-r);
  overflow: hidden;
  background: var(--m-bg);
}
.file {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7em 1em;
  border-bottom: 1px solid var(--m-border);
}
.file:last-child { border-bottom: 0; }
.file-name { font-weight: 600; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { color: var(--m-fg-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* number stepper — buttons need a click handler to change the value */
.num { display: inline-flex; align-items: stretch; max-width: 100%; }
.num > * + * { margin-left: -1px; }
.num .num-btn {
  min-width: 2.25rem;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}
.num .num-btn:first-child { border-radius: var(--m-r-sm) 0 0 var(--m-r-sm); }
.num .num-btn:last-child { border-radius: 0 var(--m-r-sm) var(--m-r-sm) 0; }
.num input {
  width: 4.5rem;
  min-width: 0;
  text-align: center;
  border-radius: 0;
  font-variant-numeric: tabular-nums;
}
.num input::-webkit-outer-spin-button,
.num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* password toggle sits in .input-wrap; toggling type is JS */
.pass-toggle {
  margin: 0 .3rem 0 0;
  padding: .2em .55em;
  border: 0;
  background: transparent;
  color: var(--m-fg-3);
  box-shadow: none;
  font-size: .875rem;
  border-radius: var(--m-r-sm);
}
.pass-toggle:hover { background: var(--m-surface); color: var(--m-fg); border-color: transparent; }

/* OTP / PIN */
.otp { display: flex; flex-wrap: wrap; gap: .4rem; }
.otp input {
  width: 2.4em;
  height: 2.6em;
  padding: 0;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* selectable radio / choice cards */
.picks { display: grid; gap: .65rem; }
.pick {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin: 0;
  padding: .9rem 1rem;
  border: 1px solid var(--m-border-2);
  border-radius: var(--m-r);
  background: var(--m-bg);
  cursor: pointer;
  font-weight: 600;
}
.pick > span { min-width: 0; flex: 1; }
.pick input { margin-top: .2em; flex-shrink: 0; }
.pick-title { display: block; }
.pick-sub { display: block; color: var(--m-fg-3); font-weight: 600; margin-top: .15em; }
.pick.selected {
  border-color: var(--m-primary);
  background: var(--m-primary-soft);
}
.pick:has(:checked) {
  border-color: var(--m-primary);
  background: var(--m-primary-soft);
}

/* property grid */
.props {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
  border: 1px solid var(--m-border);
  border-radius: var(--m-r);
  overflow: hidden;
  margin: 0;
}
.props dt, .props dd {
  padding: .65em 1em;
  border-bottom: 1px solid var(--m-border);
  margin: 0;
}
.props dt { background: var(--m-surface); color: var(--m-fg-3); font-size: .9375rem; font-weight: 600; }
.props dd { font-weight: 600; }
.props > :nth-last-child(-n+2) { border-bottom: 0; }

/* result / success-error */
.result { text-align: center; padding: 2.5rem 1.5rem; }
.result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin: 0 auto .75rem;
  border-radius: 50%;
  background: var(--m-surface);
  color: var(--m-fg-2);
  font-size: 1.35rem;
  line-height: 1;
}
.result-title { font-family: var(--m-font-head); font-weight: 700; font-size: 1.35rem; color: var(--m-fg); margin: 0 0 .35em; }
.result-actions { margin-top: 1rem; display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.result-ok .result-title { color: var(--m-success); }
.result-ok .result-icon { background: var(--m-success-soft); color: var(--m-success); }
.result-err .result-title { color: var(--m-danger); }
.result-err .result-icon { background: var(--m-danger-soft); color: var(--m-danger); }

/* numeric pill (inline, not overlay badge) */
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  height: 1.5em;
  padding: 0 .4em;
  border-radius: var(--m-r-full);
  background: var(--m-surface);
  color: var(--m-fg-2);
  font-size: .875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  vertical-align: .1em;
}
.count-primary { background: var(--m-primary); color: var(--m-on-primary); }
.count-danger { background: var(--m-danger); color: #fff; }

/* secondary page nav */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem 1.15rem;
  border-bottom: 1px solid var(--m-border);
}
.subnav a {
  padding: .55em 0;
  color: var(--m-fg-3);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subnav a:hover { color: var(--m-fg); text-decoration: none; }
.subnav .selected { color: var(--m-primary); border-bottom-color: var(--m-primary); }

/* in-page TOC */
.toc { display: flex; flex-direction: column; gap: .15rem; }
.toc a { color: var(--m-fg-2); font-weight: 600; font-size: 1rem; }
.toc a:hover { color: var(--m-fg); text-decoration: none; }
.toc .selected { color: var(--m-primary); }

/* app footer */
.footer {
  padding: 1.5rem 1.25rem;
  color: var(--m-fg-3);
  text-align: center;
  border-top: 1px solid var(--m-border);
}

/* chat / comment bubbles */
.msgs { display: flex; flex-direction: column; gap: .5rem; }
.msg {
  max-width: 80%;
  padding: .65em .95em;
  border-radius: var(--m-r);
  background: var(--m-surface);
  color: var(--m-fg);
}
.msg-out {
  align-self: flex-end;
  background: var(--m-primary);
  color: var(--m-on-primary);
}
.msg-meta { display: block; font-size: .875rem; color: var(--m-fg-3); margin-top: .25em; font-weight: 600; }
.msg-out .msg-meta { color: inherit; opacity: .8; }

/* testimonial */
.quote { margin: 1rem 0; }
.quote blockquote {
  border: 0;
  background: none;
  padding: 0;
  margin: 0 0 .65rem;
  font-size: 1.15rem;
  color: var(--m-fg);
}
.quote figcaption { color: var(--m-fg-2); font-weight: 700; }

/* image + caption */
.fig { margin: 1rem 0; }
.fig img, .fig .aspect { border-radius: var(--m-r); }
.fig figcaption { color: var(--m-fg-3); margin-top: .5rem; }

/* link preview card */
.link-card {
  display: flex;
  gap: .85rem;
  align-items: center;
  padding: .75rem;
  border: 1px solid var(--m-border);
  border-radius: var(--m-r);
  color: inherit;
  text-decoration: none;
  background: var(--m-bg);
}
.link-card:hover { border-color: var(--m-border-2); text-decoration: none; color: inherit; }
.link-card-img {
  width: 5.5rem;
  height: 4rem;
  border-radius: var(--m-r-sm);
  background: var(--m-surface);
  object-fit: cover;
  flex-shrink: 0;
}
.link-card-body { min-width: 0; }
.link-card-body b { display: block; }
.link-card-body span { color: var(--m-fg-3); font-size: 1rem; }

/* nested file / folder tree — reset accordion chrome on nested <details> */
.tree {
  list-style: none;
  padding: 0;
  margin: 0;
  font-weight: 600;
}
.tree ul {
  list-style: none;
  margin: .15rem 0 .15rem .7rem;
  padding: 0 0 0 .85rem;
  border-left: 1px solid var(--m-border);
}
.tree li {
  margin: 0;
  padding: .12em 0 .12em 1.35rem;
  list-style: none;
}
.tree details {
  border: 0;
  border-radius: 0;
  background: none;
  padding: 0;
  margin: 0 0 0 -1.35rem;
}
.tree details summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .45em;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  padding: .2em .4em;
  margin: 0;
  border-radius: var(--m-r-sm);
}
.tree details summary:hover { background: var(--m-surface); }
.tree details[open] > summary { margin-bottom: 0; }
.tree details summary::-webkit-details-marker { display: none; }
.tree details summary::after {
  content: "";
  order: -1;
  width: .42em;
  height: .42em;
  flex-shrink: 0;
  margin: 0;
  border: 2px solid var(--m-fg-3);
  border-top: 0;
  border-left: 0;
  transform: rotate(-45deg);
  transition: transform var(--m-dur);
}
.tree details[open] > summary::after { transform: rotate(45deg); }
