/* ---------- Login ---------- */
.login {
  display: grid;
  place-items: center;
  padding: var(--space-7) 0;
}

.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: var(--space-4);
}

.login-mark {
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.login-mark .logo-mark {
  color: var(--ink);
}

.login-card h1 {
  font-size: var(--step-4);
  font-weight: 750;
  letter-spacing: -0.03em;
}

.login-sub {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.login-form .field-error:empty {
  display: none;
}

.btn-wide {
  width: 100%;
}

/* ---------- Section heads ---------- */
.dash-section {
  display: grid;
  gap: var(--space-4);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--ink);
}

.section-head h2 {
  font-size: var(--step-2);
  font-weight: 700;
}

.section-head a {
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

/* ---------- Time rail (the signature element) ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.tl-row {
  display: grid;
  grid-template-columns: 136px 28px minmax(0, 1fr);
  align-items: start;
  position: relative;
}

.tl-period {
  font-size: 0.4em;
  font-weight: 650;
  letter-spacing: 0;
  margin-left: 3px;
  color: var(--ink-soft);
}

.tl-row::before {
  content: '';
  position: absolute;
  left: 149px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.tl-row:first-child::before {
  top: 18px;
}

.tl-row:last-child::before {
  bottom: calc(100% - 18px);
}

.tl-row:only-child::before {
  display: none;
}

.tl-when {
  display: grid;
  justify-items: end;
  padding: 6px 0 var(--space-5);
  text-align: right;
}

.tl-time {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.tl-day {
  font-size: var(--step--1);
  color: var(--muted);
  margin-top: 4px;
}

.tl-node {
  position: relative;
  z-index: 1;
  justify-self: center;
  width: 12px;
  height: 12px;
  margin-top: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line-strong);
}

.tl-body {
  display: grid;
  gap: var(--space-2);
  padding: 4px 0 var(--space-5) var(--space-2);
  min-width: 0;
}

.tl-flag {
  justify-self: start;
  font-size: var(--step--1);
  font-weight: 700;
  padding: 1px 8px;
  border-radius: var(--radius-s);
  background: var(--signal);
  color: var(--signal-ink);
}

.tl-next .tl-node {
  width: 16px;
  height: 16px;
  margin-top: 10px;
  background: var(--signal);
  border-color: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-wash);
}

.tl-next .tl-time {
  font-size: var(--step-4);
}

.tl-text {
  font-size: 1.0625rem;
  overflow-wrap: anywhere;
}

.tl-open {
  display: inline;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}

.tl-open:hover {
  text-decoration-color: var(--ink);
}

.tl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--space-3);
  align-items: center;
}

.tl-media {
  font-size: var(--step--1);
  color: var(--muted);
}

@media (max-width: 760px) {
  .tl-row {
    grid-template-columns: 76px 20px minmax(0, 1fr);
  }

  .tl-row::before {
    left: 85px;
  }

  .tl-time,
  .tl-next .tl-time {
    font-size: var(--step-1);
    display: grid;
    justify-items: end;
  }

  .tl-period {
    font-size: 0.6em;
    margin: 2px 0 0;
  }

  .tl-node {
    margin-top: 6px;
  }

  .tl-next .tl-node {
    margin-top: 4px;
  }

  .tl-row:first-child::before {
    top: 12px;
  }

  .tl-row:last-child::before {
    bottom: calc(100% - 12px);
  }

  .tl-when {
    padding-top: 2px;
  }
}

/* ---------- Reconnect callout ---------- */
.reconnect {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-m);
  background: var(--bad-wash);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
}

.reconnect h2 {
  color: var(--bad);
}

.reconnect-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.reconnect-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.reconnect-name {
  flex: 1;
  font-weight: 600;
  min-width: 10ch;
}

/* ---------- Accounts ---------- */
.acct-list,
.prov-grid,
.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.acct-list {
  display: grid;
}

.acct {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}

.acct-broken .acct-name {
  color: var(--bad);
}

.acct-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.acct-meta,
.acct-since {
  font-size: var(--step--1);
  color: var(--muted);
}

.acct-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
}

.prov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

.prov {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.prov h3 {
  font-size: var(--step-1);
}

.prov p {
  font-size: var(--step--1);
  color: var(--muted);
}

.prov-off {
  background: transparent;
  border-style: dashed;
}

@media (max-width: 760px) {
  .acct {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .acct-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* ---------- Connect ---------- */
.pick-all {
  align-items: center;
  font-weight: 650;
}

.pick-count {
  margin-left: auto;
  font-weight: 400;
  color: var(--muted);
  font-size: var(--step--1);
}

.pick-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.pick {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.pick input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
  flex: none;
}

.pick-text {
  display: grid;
  min-width: 0;
}

.pick-name {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.pick-meta {
  font-size: var(--step--1);
  color: var(--muted);
}

/* ---------- Posts ---------- */
.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: var(--space-3);
  align-items: end;
  padding: var(--space-4);
  border-radius: var(--radius-m);
  background: var(--surface-2);
}

.result-count {
  color: var(--muted);
  font-size: var(--step--1);
  margin-bottom: var(--space-4);
}

@media (max-width: 760px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .filters .field:first-child {
    grid-column: 1 / -1;
  }

  .filters button {
    grid-column: 1 / -1;
  }
}

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

/* Drawer content */
.dt-main {
  font-size: var(--step-1);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dt-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dt-media,
.dt-targets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.dt-media li {
  font-size: var(--step--1);
  color: var(--muted);
}

.dt-target {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.dt-target-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.dt-target-name {
  font-weight: 650;
}

.dt-error {
  color: var(--bad);
  font-size: 0.9375rem;
}

.dt-link {
  font-weight: 650;
  justify-self: start;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px var(--space-3);
  margin: 0;
  font-size: var(--step--1);
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------- Legal ---------- */
.legal {
  max-width: 68ch;
  margin: 0 auto;
  display: grid;
  gap: var(--space-3);
  padding-bottom: var(--space-6);
}

.legal h1 {
  font-size: var(--step-4);
  letter-spacing: -0.03em;
}

.legal-updated {
  color: var(--muted);
  font-size: var(--step--1);
  margin-bottom: var(--space-4);
}

.legal section {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.legal p {
  color: var(--ink-soft);
  line-height: 1.7;
}

.legal-nav {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .legal h1,
  .login-card h1 {
    font-size: var(--step-3);
  }
}

.drawer-inner > .chip {
  justify-self: start;
}
