/* Admin-only blocks (the React app in /admin). Tokens, .btn, .field and .visually-hidden
   come from styles.css. Layout: a sidebar on the left that mirrors the site's rail, and
   one screen at a time on the right. */

.admin {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.admin[data-login] {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--gutter);
}

.admin__main {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: var(--gutter);
  min-width: 0;
}

.admin__note {
  color: var(--muted);
  font-size: 14px;
  max-width: var(--measure);
}

.admin__code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-2);
}

.admin__error {
  color: #c0392b;
  font-size: 14px;
}

/* ---------- sidebar ---------- */

.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.side__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.side__brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  min-width: 0;
}

.side__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.44px;
  line-height: 1.1;
}

.side__role {
  font-size: 13px;
  color: var(--muted);
}

.side__menu {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
}

.side__bar {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.side__nav,
.side__foot {
  display: none;
}

.side[data-open] .side__nav,
.side[data-open] .side__foot {
  display: flex;
}

.side__nav {
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.side__link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
}

.side__link:hover {
  color: var(--text);
}

.side__label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.side__count {
  font-family: var(--display);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.side__foot {
  flex-direction: column;
  gap: 2px;
}

.side__action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  text-align: left;
}

.side__action:hover {
  color: var(--text);
}

.side__arrow,
.side__icon {
  display: block;
  color: var(--muted);
}

/* ---------- screen head ---------- */

.head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.head__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.head__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.6px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.head__note {
  font-size: 14px;
  color: var(--muted);
  max-width: var(--measure);
}

.head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.head__search {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  padding: 9px 12px;
  width: 100%;
}

.head__search:focus {
  outline: 2px solid var(--hue);
  outline-offset: 0;
  border-color: transparent;
}

.head__status {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- shared bits ---------- */

.action {
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 1px;
}

.action:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

.action:disabled {
  opacity: 0.4;
  cursor: default;
}

.action[data-danger]:hover {
  color: #c0392b;
  border-bottom-color: #c0392b;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.17px;
}

.card__empty {
  font-size: 14px;
  color: var(--muted);
}

.card__note {
  font-size: 13px;
  color: var(--muted);
}

.card__col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card__subtitle {
  font-size: 14px;
  font-weight: 600;
}

/* ---------- login ---------- */

.login {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(400px, 100%);
  padding: 28px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.56px;
  line-height: 1.1;
}

.login__note {
  font-size: 14px;
  color: var(--muted);
}

.login__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ---------- projects table ---------- */

.notice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--hue);
  border-radius: var(--radius-s);
  background: var(--bg-2);
  list-style: none;
}

.notice__line {
  font-size: 14px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  align-self: flex-start;
  max-width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}

.filters__btn {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 6px;
}

.filters__btn:hover {
  color: var(--text);
}

.filters__btn[data-active] {
  background: var(--bg-3);
  color: var(--text);
}

.filters__count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.table__sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--muted);
}

.table__sort:hover,
.table__sort[data-active] {
  color: var(--text);
}

.table__arrow {
  min-width: 8px;
}

/* The arrow is always there, so every label sits on the same line; it shows on the sorted one. */
.table__arrow[data-off] {
  visibility: hidden;
}

.table {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  /* The row's columns follow the table's own width, not the window's: see the container
     rules below. */
  container-type: inline-size;
}

.table__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 12px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.table__row:last-child {
  border-bottom: 0;
}

.table__row[data-head] {
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.48px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-3);
}

.table__row:not([data-head]):hover {
  background: var(--bg);
}

.table__row[data-head] .table__cell {
  display: flex;
  align-items: center;
  color: var(--muted);
}

.table__cell {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table__cell[data-main] {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table__cell[data-store],
.table__cell[data-years] {
  color: var(--text-2);
}

.table__cell[data-num] {
  font-variant-numeric: tabular-nums;
}

/* Every column starts on its left edge, label and value alike. Only the project and the
   buttons are always there; the rest come in as the table gets room for them, each threshold
   being the sum of the tracks, gaps and padding with a project column wide enough for a name. */
.table__cell[data-store],
.table__cell[data-years],
.table__cell[data-num],
.table__row[data-head] .table__cell[data-store],
.table__row[data-head] .table__cell[data-years],
.table__row[data-head] .table__cell[data-num] {
  display: none;
}

@container (min-width: 520px) {
  .table__row {
    grid-template-columns: minmax(220px, 1.6fr) minmax(130px, 1fr) 108px;
  }

  .table__cell[data-store],
  .table__row[data-head] .table__cell[data-store] {
    display: flex;
  }
}

@container (min-width: 700px) {
  .table__row {
    grid-template-columns: minmax(220px, 1.6fr) minmax(130px, 1fr) 76px 76px 108px;
  }

  .table__cell[data-features],
  .table__cell[data-commits] {
    display: block;
  }

  .table__row[data-head] .table__cell[data-features],
  .table__row[data-head] .table__cell[data-commits] {
    display: flex;
  }
}

@container (min-width: 810px) {
  .table__row {
    grid-template-columns: minmax(220px, 1.6fr) minmax(130px, 1fr) 76px 76px 96px 108px;
  }

  .table__cell[data-opens] {
    display: block;
  }

  .table__row[data-head] .table__cell[data-opens] {
    display: flex;
  }
}

@container (min-width: 900px) {
  .table__row {
    grid-template-columns: minmax(220px, 1.6fr) minmax(130px, 1fr) 84px 76px 76px 96px 108px;
  }

  .table__cell[data-years] {
    display: block;
  }

  .table__row[data-head] .table__cell[data-years] {
    display: flex;
  }
}

.table__cell[data-actions] {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* View, edit and show/hide: one square button each. */
.table__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
}

.table__tool:hover {
  color: var(--text);
  border-color: var(--line-2);
  background: var(--bg-3);
}

.table__tool[data-pressed] {
  color: var(--hue);
  border-color: var(--hue);
}

.table__tool[data-off] {
  opacity: 0.35;
  cursor: default;
}

.table__tool[data-off]:hover {
  color: var(--text-2);
  border-color: var(--line);
  background: transparent;
}

.table__glyph {
  display: block;
}

/* A hidden project stays in the list, faded; its buttons keep full strength. */
.table__row[data-hidden] .table__cell:not([data-actions]) {
  opacity: 0.45;
}

.table__thumb {
  flex: none;
  width: 64px;
  height: 40px;
  object-fit: cover;
  object-position: top;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.table__thumb[data-empty] {
  border-style: dashed;
  background: transparent;
}

.table__cell[data-store] {
  flex-direction: column;
  gap: 4px;
}

.table__row[data-head] .table__cell[data-store] {
  flex-direction: row;
}

.table__store {
  overflow-wrap: anywhere;
}

.table__dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.table__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.table__name {
  font-weight: 500;
  text-align: left;
  overflow-wrap: anywhere;
}

.table__name:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.table__kind {
  font-size: 12px;
  color: var(--muted);
}

.table__empty {
  padding: 24px 20px;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- store links ---------- */

.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
}

.store-links__link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.store-links__link[data-domain] {
  color: var(--text-2);
}

.store-links__link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.store-links__arrow {
  font-size: 11px;
}

/* ---------- project form ---------- */

/* Stores and domains: one row per value, a link out, Remove; Add under the rows. */
.list-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}

.list-field__rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-field__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.list-field__input {
  flex: 1 1 auto;
  min-width: 0;
}

.list-field__open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--text-2);
  font-size: 14px;
}

.list-field__open:hover {
  color: var(--text);
  border-color: var(--line-2);
  background: var(--bg-3);
}

.list-field__open[data-off] {
  opacity: 0.35;
}

.list-field__open[data-off]:hover {
  color: var(--text-2);
  border-color: var(--line);
  background: transparent;
}

.list-field__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.pform {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 920px;
}

.pform__section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px 24px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pform__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.17px;
}

.pform__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}


.pform__shot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  /* The taller column stretches this one; without this the extra height is shared between the rows and pushes the picture down. */
  align-content: start;
}

.pform__frame {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.pform__source {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pform__img,
.pform__blank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--bg-3);
  font-size: 13px;
  color: var(--muted);
}

.pform__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

/* Delete sits apart from Save, at the far end of the row. */
.pform__danger {
  margin-left: auto;
}

.field__input[data-color] {
  height: 44px;
  padding: 4px 6px;
}

.field__textarea[data-mono] {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- address tags ---------- */

.chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chips__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.chips__count {
  font-size: 12px;
  color: var(--muted);
}

.chips__count[data-over] {
  color: #e5594a;
}

.chips__box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  cursor: text;
}

.chips__box:focus-within {
  outline: 2px solid var(--hue);
  border-color: transparent;
}

.chips__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px 4px 3px 10px;
  font-size: 14px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
}

.chips__item[data-invalid] {
  color: #e5594a;
  border-color: #e5594a;
}

.chips__address {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chips__remove {
  padding: 0 6px;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}

.chips__remove:hover {
  color: #e5594a;
}

.chips__input {
  flex: 1 1 160px;
  min-width: 0;
  padding: 4px 2px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: none;
  border: 0;
  outline: 0;
}

/* ---------- visits ---------- */

.stats {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.tiles {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 20px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tile__label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.48px;
  text-transform: uppercase;
  color: var(--muted);
}

.tile__value {
  font-family: var(--display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.68px;
  font-variant-numeric: tabular-nums;
}

.tile__sub {
  font-size: 13px;
  color: var(--muted);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
}

.bars__col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  align-items: center;
}

.bars__col {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.bars__col[data-active] .bars__bar {
  background: var(--text);
}

.bars__col:hover .bars__label,
.bars__col[data-active] .bars__label {
  color: var(--text);
}

.bars__bar {
  display: block;
  width: 100%;
  min-height: 2px;
  background: var(--hue);
  border-radius: 2px 2px 0 0;
}

/* ---------- a day's visitors ---------- */

.visits__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.visits__sum {
  font-size: 13px;
  color: var(--muted);
  margin-right: auto;
}

.visits__date {
  flex: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.visits {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  overflow: hidden;
}

.visits__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 4px 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.visits__row:last-child {
  border-bottom: 0;
}

.visits__row[data-head] {
  display: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.48px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-3);
}

.visits__row:not([data-head]):hover {
  background: var(--bg);
}

.visits__cell {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-2);
}

.visits__cell[data-ip] {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.visits__row[data-bot] {
  opacity: 0.55;
}

.visits__flag {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.visits__views {
  color: var(--text);
}

@media (min-width: 1200px) {
  .visits__row {
    grid-template-columns: 150px minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 0.9fr) minmax(0, 1.4fr) 92px;
  }

  .visits__row[data-head] {
    display: grid;
  }
}

.bars__label {
  display: none;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rank {
  display: flex;
  flex-direction: column;
}

.rank__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.rank__item:last-child {
  border-bottom: 0;
}

.rank__key {
  overflow-wrap: anywhere;
  color: var(--text-2);
}

.rank__count {
  font-variant-numeric: tabular-nums;
}

/* ---------- messages ---------- */

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 920px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 22px 20px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.message__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 20px;
}

.message__who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.message__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  font-size: 13px;
}

.message__name {
  font-size: 16px;
}

.message__email {
  font-size: 14px;
  color: var(--text-2);
}

.message__at {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.message__sent {
  color: var(--muted);
}

.message__sent[data-off] {
  color: var(--hue);
}

.message__body {
  white-space: pre-wrap;
  font-size: 15px;
  color: var(--text-2);
  max-width: var(--measure);
}

/* ---------- portrait ---------- */

.portrait {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  max-width: 920px;
}

.portrait__figure {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.portrait__img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.portrait__caption {
  font-size: 13px;
  color: var(--muted);
}

.portrait__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px 24px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- links ---------- */

.links {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 920px;
}

.link {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 22px 22px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.link__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.link__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}

.link__icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

.link__name {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.link__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.link__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* ---------- from 701px: two columns where there is room ---------- */

@media (min-width: 701px) {
  .head__search {
    width: 220px;
  }

  .pform__grid,
  .stats__cols,
  .tiles,
  .link__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pform__grid[data-three] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pform__shot,
  .portrait {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .bars__label {
    display: inline;
  }
}

/* ---------- desktop: the sidebar stays, the screen scrolls ---------- */

@media (min-width: 900px) {
  .admin {
    grid-template-columns: var(--rail) minmax(0, 1fr);
    grid-template-rows: none;
  }

  .admin__main {
    padding: var(--gutter);
    gap: 32px;
  }

  .side {
    position: sticky;
    top: 0;
    height: 100vh;
    gap: 24px;
    padding: var(--gutter);
    border-bottom: 0;
    border-right: 1px solid var(--line);
    /* on a short screen the sidebar scrolls on its own, so "Sign out" is always reachable */
    overflow-y: auto;
  }

  .side__menu {
    display: none;
  }

  .side__nav,
  .side__foot {
    display: flex;
  }

  .side__foot {
    margin-top: auto;
  }

  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


/* ---------- content ---------- */

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.check__input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--hue);
}

.check__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.check__label {
  font-size: 14px;
  font-weight: 500;
}

.check__note {
  font-size: 13px;
  color: var(--muted);
}

.motion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.motion__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.motion__label {
  font-size: 14px;
  font-weight: 500;
}

.motion__frame {
  display: block;
  width: 100%;
  height: 134px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.motion__note {
  font-size: 13px;
  color: var(--muted);
}

.range {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.range__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.range__label {
  font-weight: 500;
}

.range__value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.range__input {
  width: 100%;
  accent-color: var(--hue);
}

.range__note {
  font-size: 13px;
  color: var(--muted);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 920px;
}

.content__section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  outline: none;
}

.content__section[hidden] {
  display: none;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  align-self: flex-start;
  max-width: 100%;
}

.subnav__btn {
  padding: 7px 12px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 6px;
}

.subnav__btn:hover {
  color: var(--text);
}

.subnav__btn[data-state='active'] {
  background: var(--bg-3);
  color: var(--text);
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px 16px;
}

.pair__label {
  grid-column: 1 / -1;
  font-size: 14px;
  font-weight: 500;
}

.entries {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.entry {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 22px 22px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.entry__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.entry__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.17px;
  overflow-wrap: anywhere;
}

.entry__tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.entry__body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.entry__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.entry__sub {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.48px;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

/* Nested entries (points inside a case) sit on the page colour so the levels read. */
.entry .entry {
  background: var(--bg);
  padding: 14px 16px 16px;
}

.entry .entry__name {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.14px;
  color: var(--text-2);
}

/* ---------- Radix primitives (headless, styled here) ---------- */

.admin__screen {
  display: flex;
  flex-direction: column;
  gap: 28px;
  outline: none;
}

/* Radix keeps the other screens in the DOM with the hidden attribute; flex would win over it. */
.admin__screen[hidden] {
  display: none;
}

.side__link[data-state='active'] {
  color: var(--text);
}

.side__link[data-state='active'] .side__label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hue);
}

.select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  text-align: left;
}

.select__trigger:focus-visible {
  outline: 2px solid var(--hue);
  outline-offset: 0;
  border-color: transparent;
}

.select__icon {
  display: flex;
  color: var(--muted);
}

.select__content {
  z-index: 20;
  min-width: var(--radix-select-trigger-width);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.select__list {
  padding: 4px;
}

.select__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  font-size: 14px;
  border-radius: 6px;
  color: var(--text-2);
  cursor: default;
  outline: none;
}

.select__item[data-highlighted] {
  background: var(--bg-3);
  color: var(--text);
}

.select__check {
  font-size: 12px;
  color: var(--hue);
}

.dialog__overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(20, 23, 28, 0.45);
  animation: dialog-fade 160ms ease;
}

.dialog__panel {
  position: fixed;
  z-index: 31;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 2 * var(--gutter)));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 26px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: dialog-rise 200ms ease;
}

.dialog__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.4px;
  line-height: 1.2;
  margin: 0;
}

.dialog__text {
  font-size: 14px;
  color: var(--text-2);
  margin: 0;
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.btn[data-danger] {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

.btn[data-danger]:hover {
  border-color: #c0392b;
  opacity: 0.9;
}

.toast__viewport {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 2 * var(--gutter)));
  margin: 0;
  padding: 0;
  list-style: none;
  outline: none;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px 12px 16px;
  background: var(--ink);
  color: var(--ink-text);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toast-in 200ms ease;
}

.toast[data-err] {
  background: #c0392b;
  color: #fff;
}

.toast[data-state='closed'] {
  animation: toast-out 160ms ease forwards;
}

.toast[data-swipe='move'] {
  transform: translateX(var(--radix-toast-swipe-move-x));
}

.toast[data-swipe='end'] {
  animation: toast-out 160ms ease forwards;
}

.toast__text {
  margin: 0;
}

.toast__close {
  font-size: 18px;
  line-height: 1;
  color: inherit;
  opacity: 0.7;
}

.toast__close:hover {
  opacity: 1;
}

@keyframes dialog-fade {
  from { opacity: 0; }
}

@keyframes dialog-rise {
  from { opacity: 0; transform: translate(-50%, -48%); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

/* After the blocks above, so it wins over their one-column defaults. */
@media (min-width: 701px) {
  .pair,
  .entry__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- walkthrough slides ---------- */

.slides {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slide {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.slide__img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.slide__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.slide__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.slide__num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
}

.slide__tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

@media (min-width: 701px) {
  .slide {
    grid-template-columns: 200px minmax(0, 1fr);
  }
}

/* ---------- demo store tab ---------- */

.demo-admin {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 22px 22px;
  margin-bottom: 24px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.demo-admin__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.17px;
}

.demo-admin__grid {
  display: grid;
  gap: 16px;
}

.field__hint {
  font-size: 13px;
  color: var(--muted);
}

@media (min-width: 750px) {
  .demo-admin__grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* ---------- site tab ---------- */

.site-admin {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 760px;
}

.site-admin__link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--hue);
  text-underline-offset: 3px;
}

/* ---------- mail tab ---------- */

.forwards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 920px;
  padding: 18px 22px 20px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.forwards__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.forwards__title,
.inbox__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.forwards__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.forwards__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.forwards__input {
  flex: 1 1 260px;
}

.forwards__state {
  font-size: 13px;
  color: var(--hue);
}

.forwards__state[data-verified] {
  color: var(--muted);
}

.forwards__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inbox {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 920px;
  padding-top: 24px;
}

.inbox__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.letter {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.letter__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  padding: 14px 18px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.letter__from {
  font-size: 14px;
  color: var(--text-2);
}

.letter[data-unseen] .letter__from {
  font-weight: 600;
  color: var(--text);
}

.letter__subject {
  grid-column: 1;
  font-size: 15px;
}

.letter__at {
  grid-column: 2;
  grid-row: 1;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.letter__preview {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.letter__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 18px 18px;
}

.letter__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  font-size: 13px;
  color: var(--muted);
}

.letter__address {
  color: var(--text-2);
}

.letter__delete {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 14px;
  color: #e5594a;
  border: 1px solid #e5594a;
  border-radius: var(--radius-s);
}

.letter__delete:hover {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
}

.letter__forward[data-failed] {
  color: var(--hue);
}

.letter__frame {
  width: 100%;
  height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: #ffffff;
}

.letter__text {
  margin: 0;
  white-space: pre-wrap;
  font-size: 15px;
  color: var(--text-2);
  max-width: var(--measure);
}

.letter__files {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- demo page tab ---------- */

.dgroup {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dgroup__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dgroup__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.17px;
}

.dgroup__count {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dgroup__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dgroup__foot {
  display: flex;
  padding-bottom: 12px;
}

/* A feature: a row that opens into its form. */
.dfeat {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dfeat[data-open] {
  border-color: var(--line-2);
}

.dfeat__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 18px;
}

.dfeat__main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 240px;
  min-width: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dfeat__thumb {
  flex: none;
  width: 64px;
  height: 40px;
  object-fit: cover;
  object-position: top;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.dfeat__thumb[data-empty] {
  border-style: dashed;
  background: transparent;
}

.dfeat__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.dfeat__name {
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.dfeat__meta {
  font-size: 12px;
  color: var(--muted);
}

.dfeat[data-hidden] .dfeat__main {
  opacity: 0.45;
}

.dfeat__tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dfeat__body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 18px 20px;
  border-top: 1px solid var(--line);
}

/* ---------- inbox: kinds and replies ---------- */

.letter__from {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.letter__kind {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.44px;
  text-transform: uppercase;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  color: var(--muted);
}

.letter__kind[data-form] {
  color: var(--hue);
  border-color: var(--hue);
}

.letter__replied {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.reply {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.reply__sent {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-left: 2px solid var(--hue);
  background: var(--bg);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
}

.reply__meta {
  font-size: 12px;
  color: var(--muted);
}

.reply__text {
  margin: 0;
  white-space: pre-wrap;
  font-size: 14px;
  color: var(--text-2);
}

.reply__actions {
  display: flex;
}

.attach {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.attach__input {
  display: none;
}

.attach__status {
  font-size: 14px;
}

.attach__status[data-empty] {
  color: var(--muted);
}

.attach__list {
  display: flex;
  flex-basis: 100%;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attach__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}

.attach__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach__size {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.attach__remove {
  padding: 0 6px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
}

.attach__remove:hover {
  color: #e5594a;
}

.attach__error {
  font-size: 14px;
  color: #e5594a;
}

/* ---------- versions tab ---------- */

.versions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.versions__col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.versions__title {
  font-size: 16px;
  font-weight: 600;
}

.versions__note {
  font-size: 13px;
  color: var(--muted);
}

.versions__link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* The site is laid out at desktop width inside the iframe and scaled down to the column. */
.frame {
  position: relative;
  height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.frame__page {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  transform-origin: 0 0;
}

.shared {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
  max-width: 980px;
}

.shared__title {
  font-size: 16px;
  font-weight: 600;
}

.shared__note {
  font-size: 13px;
  color: var(--muted);
}

.shared__form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.shared__list {
  display: flex;
  flex-direction: column;
}

.shared__item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.shared__label {
  min-width: 140px;
  font-weight: 500;
}

.shared__url {
  flex: 1 1 260px;
  min-width: 0;
  font-size: 13px;
}

.shared__date {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- two previews: public and private ---------- */

.pform__shots {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 900px) {
  .pform__shots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pform__version {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.pform__shots .pform__shot {
  grid-template-columns: minmax(0, 1fr);
}
