/* FB Linker dashboard.
   One bold element: the navigation rail is drawn as a racking upright, with an
   orange beam clipped in at the active view. Everything else stays quiet. */

@font-face {
  font-family: 'Barlow';
  src: url('/fonts/barlow-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url('/fonts/barlow-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url('/fonts/barlow-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Condensed';
  src: url('/fonts/barlow-condensed-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Condensed';
  src: url('/fonts/barlow-condensed-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --upright: #1b4f9c;
  --upright-deep: #143e7c;
  --upright-fold: #2a63b6;
  --upright-tint: #e6edf7;
  --beam: #f26a1b;
  --concrete: #eceeec;
  --shelf: #ffffff;
  --ink: #14233a;
  --steel: #5e6b78;
  --line: #d4d9dd;
  --line-strong: #b9c1c8;
  --go: #1e8c4e;
  --go-tint: #e2f1e8;
  --stop: #c3372b;
  --stop-tint: #f8e3e0;
  --wait: #9a6412;
  --wait-tint: #f6ecd9;

  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-cond: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;

  --r-input: 6px;
  --r-panel: 10px;
  --rail-w: 212px;
  --gap: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--concrete);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
}

a {
  color: var(--upright);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--upright-deep);
}

h1,
h2,
h3 {
  font-family: var(--font-cond);
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0.005em;
}

h1 {
  font-size: 30px;
  font-weight: 700;
}

h2 {
  font-size: 21px;
  font-weight: 600;
}

h3 {
  font-size: 17px;
  font-weight: 600;
}

p {
  margin: 0 0 10px;
}

:focus-visible {
  outline: 2px solid var(--upright);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------ shell */

.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100%;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--upright);
  /* the upright's punched face: a column of teardrop slots, and a lit fold on the edge */
  background-image:
    linear-gradient(90deg, transparent calc(100% - 4px), var(--upright-fold) calc(100% - 4px), var(--upright-fold) calc(100% - 2px), var(--upright-deep) calc(100% - 2px)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='30' viewBox='0 0 10 30'%3E%3Cpath d='M5 3c2.8 0 4 1.7 4 4.2 0 3.6-2.3 8.3-4 10.3C3.3 15.5 1 10.8 1 7.2 1 4.7 2.2 3 5 3z' fill='%230f356b'/%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat-y;
  background-position: 0 0, calc(100% - 16px) 6px;
  background-size: 100% 100%, 10px 30px;
  color: #fff;
  padding: calc(18px + var(--safe-top)) 0 calc(16px + var(--safe-bottom));
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 44px 0 20px;
  font-family: var(--font-cond);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  width: 22px;
  height: 22px;
  flex: none;
}

.nav {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 44px 8px 20px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-family: var(--font-cond);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav a[aria-current='page'] {
  color: #fff;
}

/* the beam: an orange member clipped across the upright, with a connector at the slot column */
.nav a[aria-current='page']::before {
  content: '';
  position: absolute;
  left: 0;
  right: 8px;
  bottom: 4px;
  height: 6px;
  background: var(--beam);
}

.nav a[aria-current='page']::after {
  content: '';
  position: absolute;
  right: 8px;
  bottom: 1px;
  width: 22px;
  height: 12px;
  background: #0f2c57;
}

.nav a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

.count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: #fff;
  color: var(--upright);
  font-family: var(--font-cond);
  font-size: 15px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.rail-foot {
  margin-top: auto;
  padding: 0 44px 0 20px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.rail-foot .conn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 6px;
  flex: none;
  background: var(--line-strong);
}

.dot.ok {
  background: #53d18a;
}

.dot.warn {
  background: #ffc15e;
}

.dot.bad {
  background: #ff8a7d;
}

.rail-foot .logout {
  margin-top: 10px;
  background: none;
  border: 0;
  padding: 0;
  color: #fff;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.main {
  min-width: 0;
  padding: 26px 32px 60px;
  outline: none;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-input);
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: var(--shelf);
  font-size: 14px;
}

.banner p {
  margin: 0;
}

.banner.demo {
  border-color: #c9d6ea;
  background: var(--upright-tint);
}

.banner.warn {
  border-color: #e7cf9f;
  background: var(--wait-tint);
}

.banner.bad {
  border-color: #ecb8b1;
  background: var(--stop-tint);
}

.banner .btn {
  margin-left: auto;
  flex: none;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 20px;
}

.view-head h1 {
  outline: none;
}

.view-head .sub {
  margin: 4px 0 0;
  color: var(--steel);
  max-width: 68ch;
}

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

/* ------------------------------------------------------------ building blocks */

.panel {
  background: var(--shelf);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}

.panel-pad {
  padding: 18px 20px;
}

.panel + .panel,
.stack > * + * {
  margin-top: 16px;
}

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

.small {
  font-size: 13px;
}

.num {
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.01em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-input);
  background: var(--shelf);
  color: var(--ink);
  font: 500 14px/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--steel);
  color: var(--ink);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--upright);
  border-color: var(--upright);
  color: #fff;
}

.btn.primary:hover {
  background: var(--upright-deep);
  border-color: var(--upright-deep);
  color: #fff;
}

.btn.danger {
  color: var(--stop);
  border-color: #e3aaa3;
}

.btn.danger:hover {
  border-color: var(--stop);
  color: var(--stop);
}

.btn.solid-danger {
  background: var(--stop);
  border-color: var(--stop);
  color: #fff;
}

.btn.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--upright);
  padding-left: 8px;
  padding-right: 8px;
}

.btn.quiet:hover {
  background: var(--upright-tint);
}

.btn.small {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 13px;
}

.btn[aria-busy='true'] {
  cursor: progress;
}

.btn[aria-busy='true']::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  background: #eef0f2;
  color: var(--steel);
  white-space: nowrap;
}

.chip.go {
  background: var(--go-tint);
  color: #17693b;
}

.chip.wait {
  background: var(--wait-tint);
  color: var(--wait);
}

.chip.stop {
  background: var(--stop-tint);
  color: #9d2a20;
}

.chip.info {
  background: var(--upright-tint);
  color: var(--upright);
}

/* forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  min-width: 0;
}

.field > label,
.field > .label {
  font-weight: 500;
  font-size: 14px;
}

.field .hint {
  font-size: 13px;
  color: var(--steel);
}

.field .error {
  font-size: 13px;
  color: var(--stop);
  font-weight: 500;
}

.field .counter {
  font-size: 12px;
  color: var(--steel);
  align-self: flex-end;
  font-variant-numeric: tabular-nums;
}

.field .counter.over {
  color: var(--stop);
}

input[type='text'],
input[type='url'],
input[type='password'],
input[type='number'],
input[type='search'],
input[type='datetime-local'],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-input);
  background: #fff;
  color: var(--ink);
  font: 400 15px/1.4 var(--font);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--upright);
  box-shadow: 0 0 0 3px rgba(27, 79, 156, 0.18);
}

input[aria-invalid='true'],
textarea[aria-invalid='true'],
select[aria-invalid='true'] {
  border-color: var(--stop);
}

input:disabled,
textarea:disabled,
select:disabled {
  background: #f4f5f5;
  color: var(--steel);
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0 14px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 10px;
  cursor: pointer;
}

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

/* switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 600;
}

.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  margin: 0;
  flex: none;
  transition: background 0.15s;
}

.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch input:checked {
  background: var(--go);
}

.switch input:checked::after {
  transform: translateX(20px);
}

/* empty and loading states */

.empty {
  padding: 34px 24px;
  text-align: center;
  color: var(--steel);
}

.empty h2 {
  color: var(--ink);
  margin-bottom: 6px;
}

.empty .btn {
  margin-top: 8px;
}

.loading {
  padding: 24px;
  color: var(--steel);
}

.error-box {
  padding: 12px 14px;
  border-radius: var(--r-input);
  background: var(--stop-tint);
  color: #8e261d;
  font-size: 14px;
}

.ok-box {
  padding: 12px 14px;
  border-radius: var(--r-input);
  background: var(--go-tint);
  color: #17693b;
  font-size: 14px;
}

.note {
  padding: 12px 14px;
  border-radius: var(--r-input);
  background: #f4f5f5;
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink);
}

/* ------------------------------------------------------------ split panes (inbox, comments) */

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

.pane {
  background: var(--shelf);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  min-width: 0;
  overflow: hidden;
}

.pane-scroll {
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list > li + li {
  border-top: 1px solid var(--line);
}

.list-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.list-btn:hover {
  background: #f6f7f8;
}

.list-btn[aria-current='true'] {
  background: var(--upright-tint);
  box-shadow: inset 4px 0 0 var(--upright);
}

.list-btn:focus-visible {
  outline-offset: -3px;
}

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

.lb-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-time {
  font-size: 13px;
  color: var(--steel);
  flex: none;
}

.lb-snippet {
  margin-top: 2px;
  color: var(--steel);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lb-meta {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.unread {
  font-weight: 600;
  color: var(--ink);
}

/* thread */

.thread {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: calc(100vh - 118px);
}

.thread-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.thread-head h2 {
  margin-right: auto;
}

.back {
  display: none;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafbfb;
}

.msg {
  max-width: min(78%, 560px);
  align-self: flex-start;
}

.msg.page {
  align-self: flex-end;
}

.bubble {
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.page .bubble {
  background: var(--upright-tint);
  border-color: #c9d6ea;
}

.msg-time {
  font-size: 12px;
  color: var(--steel);
  margin: 3px 4px 0;
}

.msg.page .msg-time {
  text-align: right;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.attachments img {
  width: 140px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.day {
  align-self: center;
  font-size: 12px;
  color: var(--steel);
  padding: 2px 10px;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 12px 16px 14px;
  background: #fff;
}

.composer textarea {
  min-height: 76px;
}

.composer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}

.composer-bar select {
  width: auto;
  max-width: 240px;
  min-height: 36px;
  padding: 5px 9px;
  font-size: 14px;
}

.composer-bar .counter {
  margin-left: auto;
  font-size: 13px;
  color: var(--steel);
  font-variant-numeric: tabular-nums;
}

.composer-note {
  font-size: 14px;
  margin-bottom: 8px;
}

.demo-box {
  margin-top: 16px;
  padding: 14px 16px;
}

.demo-box h3 {
  margin-bottom: 4px;
}

/* ------------------------------------------------------------ comments */

.post-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.post-card .thumb,
.thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--concrete);
  border: 1px solid var(--line);
  display: block;
}

.thumb.blank {
  background: repeating-linear-gradient(135deg, #eef0f1 0 8px, #e5e8ea 8px 16px);
}

.comment-list {
  padding: 6px 18px 18px;
}

.comment {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.comment:first-child {
  border-top: 0;
}

.comment.reply {
  margin-left: 26px;
  padding-left: 14px;
  border-top: 0;
  border-left: 3px solid var(--line);
  padding-top: 8px;
  padding-bottom: 8px;
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.comment-head strong {
  font-weight: 600;
}

.comment-text {
  margin: 4px 0 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment.is-hidden .comment-text {
  color: var(--steel);
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: -8px;
}

.inline-form {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: #fafbfb;
}

.inline-form textarea {
  min-height: 70px;
}

.inline-form .actions {
  margin-top: 8px;
}

/* ------------------------------------------------------------ products */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.toolbar input[type='search'] {
  max-width: 320px;
}

.product {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
}

.product .thumb {
  width: 64px;
  height: 64px;
}

.product-title {
  font-weight: 600;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  margin-top: 3px;
  font-size: 13px;
  color: var(--steel);
}

.price {
  font-family: var(--font-cond);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.price s {
  color: var(--steel);
  font-size: 16px;
  margin-left: 6px;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

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

.preview-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--concrete);
}

.preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  border: 1px dashed var(--line-strong);
  color: var(--steel);
  font-size: 14px;
  text-align: center;
  padding: 16px;
}

.sticky-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.save-status {
  margin-top: 12px;
}

/* ------------------------------------------------------------ marketplace */

.listing {
  padding: 18px 20px;
}

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

.copy-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.copy-row:first-of-type {
  border-top: 0;
}

.copy-row .k {
  color: var(--steel);
  font-size: 14px;
  padding-top: 5px;
}

.copy-row .v {
  padding-top: 5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.copy-row .v.clamp {
  max-height: 9.5em;
  overflow: auto;
}

.photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.photos a {
  display: block;
}

.photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--concrete);
}

/* ------------------------------------------------------------ post */

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

.photo-picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin: 4px 0 12px;
}

.pick {
  position: relative;
}

.pick img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--concrete);
  display: block;
}

.pick button {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 26px;
  padding: 2px 8px;
  font-size: 12px;
}

.file-drop {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.post-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 16px;
}

.post-row p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

/* ------------------------------------------------------------ replies */

.rule {
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.rule:first-child {
  border-top: 0;
}

.rule-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.rule-head .rule-no {
  font-family: var(--font-cond);
  font-size: 20px;
  font-weight: 700;
  color: var(--upright);
  min-width: 22px;
}

.rule-head input[type='text'] {
  max-width: 280px;
  font-weight: 600;
}

.rule-head .actions {
  margin-left: auto;
}

.inline-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.try-result {
  margin-top: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 16px;
}

.saved-reply {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.saved-reply:first-child {
  border-top: 0;
}

.saved-reply p {
  margin: 4px 0 0;
  white-space: pre-wrap;
  color: var(--steel);
}

/* ------------------------------------------------------------ setup */

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

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

.step-no {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--upright);
  color: #fff;
  font-family: var(--font-cond);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step.done .step-no {
  background: var(--go);
}

.step h2 {
  margin: 4px 0 6px;
}

.step .intro {
  color: var(--steel);
  margin-bottom: 14px;
  max-width: 70ch;
}

details.help {
  margin: 4px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: #fafbfb;
}

details.help summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 500;
  color: var(--upright);
}

details.help ol,
details.help ul {
  margin: 0;
  padding: 0 16px 12px 34px;
}

details.help li + li {
  margin-top: 6px;
}

code,
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: #f1f3f4;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

.copy-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-field input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.choice-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
}

.choice-list li + li {
  border-top: 1px solid var(--line);
}

.choice-list label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  cursor: pointer;
}

.choice-list input {
  margin-top: 4px;
  accent-color: var(--upright);
}

.feature {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.feature:first-of-type {
  border-top: 0;
}

.feature .dot {
  margin-top: 7px;
}

.feature .dot.ok {
  background: var(--go);
}

.feature .dot.bad {
  background: var(--stop);
}

.feature .dot.warn {
  background: #d8962b;
}

.activity {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.activity li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.activity li:first-child {
  border-top: 0;
}

.activity .fail {
  color: var(--stop);
}

.activity time {
  display: block;
  font-size: 12px;
  color: var(--steel);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
  border: 0;
}

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

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login {
  width: min(400px, 100%);
  padding: 28px;
}

.login h1 {
  margin-bottom: 6px;
}

/* ------------------------------------------------------------ dialog & toasts */

dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(20, 35, 58, 0.28);
}

dialog::backdrop {
  background: rgba(20, 35, 58, 0.45);
}

.dialog-body {
  padding: 22px 22px 8px;
  overflow: auto;
}

.dialog-body h2 {
  margin-bottom: 8px;
}

.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 20px;
}

.preview-post {
  white-space: pre-wrap;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: #fafbfb;
  max-height: 260px;
  overflow: auto;
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 40px));
}

.toast {
  padding: 11px 14px;
  border-radius: var(--r-input);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(20, 35, 58, 0.25);
  border-left: 5px solid var(--go);
}

.toast.error {
  border-left-color: #ff8a7d;
}

@media (prefers-reduced-motion: no-preference) {
  .toast {
    animation: toast-in 0.18s ease-out;
  }
  @keyframes toast-in {
    from {
      transform: translateY(8px);
      opacity: 0;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------ narrower screens */

@media (max-width: 1100px) {
  .setup,
  .editor,
  .two-col,
  .listing-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .listing-grid .photos {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 860px) {
  body {
    font-size: 16px;
  }

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

  /* the upright lies down: a blue header with the beam under the active tab */
  .rail {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: calc(10px + var(--safe-top)) 0 0;
    background-image: linear-gradient(0deg, var(--upright-deep) 0, var(--upright-deep) 2px, transparent 2px);
    background-size: 100% 100%;
    background-position: 0 0;
    background-repeat: no-repeat;
  }

  .brand {
    padding: 0 16px;
    font-size: 21px;
  }

  .rail-foot {
    margin: 0 0 0 auto;
    padding: 0 16px;
    font-size: 12px;
    max-width: 55%;
  }

  .rail-foot .conn span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rail-foot .logout {
    display: none;
  }

  .nav {
    order: 3;
    width: 100%;
    margin: 8px 0 0;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 8px;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    padding: 8px 12px 14px;
    min-height: 46px;
    font-size: 18px;
    white-space: nowrap;
  }

  .nav a[aria-current='page']::before {
    left: 6px;
    right: 6px;
    bottom: 3px;
    height: 5px;
  }

  .nav a[aria-current='page']::after {
    display: none;
  }

  .main {
    padding: 18px 14px 40px;
  }

  h1 {
    font-size: 27px;
  }

  .btn {
    min-height: 42px;
  }

  .btn.small {
    min-height: 36px;
  }

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

  .split.has-selection > .pane:first-child {
    display: none;
  }

  .split:not(.has-selection) > .pane:nth-child(2) {
    display: none;
  }

  .back {
    display: inline-flex;
  }

  .pane-scroll {
    max-height: none;
  }

  .thread {
    max-height: none;
    min-height: 0;
  }

  .messages {
    max-height: 58vh;
  }

  .msg {
    max-width: 88%;
  }

  .product {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .product .thumb {
    width: 56px;
    height: 56px;
  }

  .product-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-left: -8px;
  }

  .copy-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .copy-row .k {
    grid-column: 1 / -1;
    padding-top: 0;
  }

  .copy-row .v {
    padding-top: 0;
  }

  .step {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }

  .toasts {
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    max-width: none;
  }

  .rule-head .actions {
    margin-left: 0;
  }
}

/* ------------------------------------------------------------ additions */

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--r-input);
  background: var(--shelf);
  color: var(--ink);
  font-weight: 600;
}

.skip:focus {
  top: 12px;
}

.post-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  color: var(--ink);
}

.btn.quiet.danger-text {
  color: var(--stop);
}

.btn.quiet.danger-text:hover {
  background: var(--stop-tint);
}

.dialog-body .preview-img {
  aspect-ratio: auto;
  height: 170px;
  margin-bottom: 12px;
}

.help-body {
  padding: 2px 14px 14px;
}

.help-foot {
  margin: 0;
  padding: 0 14px 12px;
  font-size: 13px;
  color: var(--steel);
}

.post-excerpt {
  margin: 0;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--steel);
  font-size: 14px;
  white-space: pre-wrap;
}

.pane-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.panel-intro {
  padding: 14px 18px 4px;
  color: var(--steel);
  max-width: 76ch;
}

.limits {
  padding: 4px 18px 0;
}

.fallback {
  padding: 16px 18px 4px;
  border-top: 1px solid var(--line);
}

.try-box {
  padding: 16px 18px 18px;
}

.try-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px auto;
  gap: 10px;
  align-items: end;
}

.try-row .field {
  margin-bottom: 0;
}

.product-editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.tag-list code + code {
  margin-left: 4px;
}

@media (max-width: 860px) {
  .try-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.input-row input {
  flex: 1;
  min-width: 0;
}
