/* Dark is the default; theme.js sets data-theme from the saved toggle choice or the system setting. */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --text: #E8E8E8;
  --dim: #8C8C8C;
  --art-bg: #000000;
  --art-ink: #5B8FD8;
  --art-alt: #9576EA;
  --art-ship: #6E5440;
  --art-ship-new: #A8927A;
  --art-flag: #FFFFFF;
  --art-bird: #E9E3D3;
  --art-sail: #E9E3D3;
  --art-foam: #FFFFFF;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --text: #111111;
  --dim: #6B6B6B;
  --art-bg: #FFFFFF;
  --art-ink: #3473BE;
  --art-alt: #6A45C2;
  --art-ship: #3E2C1F;
  --art-ship-new: #8A7560;
  --art-flag: #B9B9B9;
  --art-bird: #B5AC9A;
  --art-sail: #B5AC9A;
  --art-foam: #FFFFFF;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #FFFFFF;
    --text: #111111;
    --dim: #6B6B6B;
    --art-bg: #FFFFFF;
    --art-ink: #3473BE;
    --art-alt: #6A45C2;
    --art-ship: #3E2C1F;
    --art-ship-new: #8A7560;
    --art-flag: #B9B9B9;
    --art-bird: #B5AC9A;
    --art-sail: #B5AC9A;
    --art-foam: #FFFFFF;
  }
}

:root {
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }
/* Elements marked hidden stay hidden, even when a class gives them a display value. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s, color 0.25s;
}

p { margin: 0 0 1em; }
a { color: inherit; }
:focus-visible { outline: 1px dashed currentColor; outline-offset: 4px; }

/* ---- Buttons & cursor ---- */
.btn {
  display: inline-block;
  padding: 0.2em 0.4em;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover, .btn-solid { background: var(--text); color: var(--bg); }
.btn-solid:hover { background: transparent; color: var(--text); outline: 1px solid var(--text); }

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 0.3em;
  vertical-align: text-bottom;
  background: currentColor;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* ---- Header ---- */
.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); /* side columns equal, so the logo stays centred */
  align-items: center;
  gap: 16px;
  padding: 20px var(--gutter);
}
.site-header .btn { justify-self: start; }
.header-links { justify-self: start; display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; }

/* [ ~ ] menu on signed-in pages */
.menu { position: relative; justify-self: start; }
.menu-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  min-width: 12rem;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--text);
}
.menu-list a,
.menu-list button {
  display: block;
  width: 100%;
  padding: 0.3rem 0.9rem;
  font: inherit;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.menu-list a::before,
.menu-list button::before { content: '  '; white-space: pre; }
.menu-list a:hover, .menu-list a:focus-visible,
.menu-list button:hover, .menu-list button:focus-visible { background: var(--text); color: var(--bg); outline: none; }
.menu-list a[aria-current="page"]::before { content: '> '; }
.menu-list [role="separator"] { margin: 0.35rem 0.9rem; border-top: 1px dotted var(--dim); }
.logo { text-decoration: none; }
.logo:hover { text-decoration: underline; text-underline-offset: 4px; }

.theme-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.2em 0;
  background: none;
  border: 0;
  color: var(--dim);
  font: inherit;
  cursor: pointer;
}
.theme-toggle .track {
  position: relative;
  width: 2.4em;
  height: 1.2em;
  border: 1px solid currentColor;
}
.theme-toggle .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.2em - 6px);
  height: calc(1.2em - 6px);
  background: var(--text);
  transition: transform 0.2s;
}
.theme-toggle[aria-checked="true"] .knob { transform: translateX(1.2em); }
.theme-toggle[aria-checked="true"] span:last-child,
.theme-toggle[aria-checked="false"] span:first-child { color: var(--text); }

/* ---- Home: one piece of art ---- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px var(--gutter) 40px;
}
.art { margin: 0; width: min(100%, 1100px); }
.art canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: calc(100svh - 170px);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.count { font-variant-numeric: tabular-nums; }
.contact-line { margin-top: 0.9rem; text-align: center; font-size: 0.82rem; color: var(--dim); }
.contact-line a { color: var(--dim); }
.contact-line a:hover { color: var(--text); }

/* ---- Footer: the homepage's dithered sea, full width (every page but home) ---- */
.site-footer { margin-top: auto; }
.site-footer canvas {
  display: block;
  width: 100%;
  height: 26svh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---- Login / 404 ---- */
.screen-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px var(--gutter);
}
.session { max-width: 40rem; margin: auto; }
.session p { margin-bottom: 0.35rem; }
.session .btn { margin-top: 1.75rem; }
.login-form { margin: 1.25rem 0 0; max-width: 32rem; }
.login-form input:not([type]) { min-width: 18ch; }
.prompt { color: var(--dim); }

/* ---- Small screens ---- */
@media (max-width: 640px) {
  .site-header { grid-template-columns: 1fr 1fr; }
  .site-header .logo { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
  .art canvas { aspect-ratio: 4 / 5; }
}

/* ---- Auth: status lines, forms ---- */
.status { min-height: 1.65em; color: var(--dim); }
.status.error { color: var(--text); }
.status.error::first-letter { color: var(--art-alt); }
button.btn { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button.btn-solid { background: var(--text); color: var(--bg); }
button.btn:disabled { opacity: 0.5; cursor: progress; }

.term-form { display: grid; gap: 0.6rem; margin: 1rem 0; }
.term-form label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6em; }
.term-form input,
.term-form select {
  flex: 1;
  min-width: 12ch;
  padding: 0.15em 0.3em;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--dim);
  border-radius: 0;
}
.term-form input:focus { outline: none; border-bottom-style: solid; border-bottom-color: var(--text); }
.term-form .btn { justify-self: start; margin-top: 0.5rem; }
.term-form.inline { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); align-items: end; }

/* ---- Private console (/home) ---- */
.console {
  flex: 1;
  width: min(100%, 60rem);
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
}
.console p { margin-bottom: 0.35rem; }
.console section { margin-top: 2.25rem; }
.console h2 { font-size: inherit; font-weight: normal; margin: 1.5rem 0 0.5rem; }
.rows { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.rows li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px dotted var(--dim);
  overflow-wrap: anywhere;
}
.rows .actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.dim { color: var(--dim); }
.secret {
  padding: 0.75rem;
  border: 1px dashed var(--text);
  overflow-wrap: anywhere;
}
.secret code { font: inherit; user-select: all; }


/* ---- Admin overview ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0 0 0.75rem;
}
.stats div { border-bottom: 1px dotted var(--dim); padding-bottom: 0.35rem; }
.stats dt { color: var(--dim); font-size: 0.85em; }
.stats dd { margin: 0; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.stats dd.warn { color: var(--art-alt); }

/* ---- Message board (/home) ---- */
.board-h { font-size: inherit; font-weight: normal; margin: 0 0 0.75rem; }
h2.board-h { margin-top: 2rem; }
.threads, .replies { list-style: none; margin: 1rem 0; padding: 0; }
.threads li, .replies li { padding: 0.8rem 0; border-bottom: 1px dotted var(--dim); }
.thread-title { font-weight: bold; text-decoration: none; overflow-wrap: anywhere; }
.thread-title:hover { text-decoration: underline; text-underline-offset: 4px; }
.thread-h { font-size: 1.15rem; margin: 1.25rem 0 0.25rem; overflow-wrap: anywhere; }
.tag { color: var(--art-alt); font-weight: normal; }
.meta { margin: 0.2rem 0 0; color: var(--dim); font-size: 0.85em; }
.excerpt { margin: 0.35rem 0 0; color: var(--dim); overflow-wrap: anywhere; }
.post-body { margin: 0.6rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-body a { text-underline-offset: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.25rem 0 0; }
.thread-head + .post-body { margin-top: 1rem; }
.term-form textarea {
  width: 100%;
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px dashed var(--dim);
  border-radius: 0;
  resize: vertical;
}
.term-form textarea:focus { outline: none; border-style: solid; border-color: var(--text); }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.form-actions .btn { margin-top: 0; }
.compose { max-width: 48rem; }

/* ---- People: avatars and name links ---- */
.avatar {
  display: inline-block;
  flex: none;
  overflow: hidden;
  background: var(--art-bg);
  border: 1px solid var(--dim);
  vertical-align: middle;
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* No photo: their initial, in the art ink. */
.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--art-ink);
  font-weight: bold;
  line-height: 1;
}
.avatar-sm { width: 1.5em; height: 1.5em; }
.avatar-sm .avatar-initial { font-size: 0.85em; }
.avatar-md { width: 3.5rem; height: 3.5rem; font-size: 1.6rem; }
.avatar-lg { width: 7.5rem; height: 7.5rem; font-size: 3.4rem; }
.avatar-gone .avatar-initial { color: var(--dim); }
.avatar-gone { opacity: 0.5; }
.person { display: inline-flex; align-items: center; gap: 0.45em; text-decoration: none; }
a.person:hover { text-decoration: underline; text-underline-offset: 4px; }
.meta .person { color: var(--text); }

.people { list-style: none; margin: 1rem 0; padding: 0; }
.people li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dotted var(--dim);
}

.profile-head { display: flex; align-items: center; gap: 1.25rem; margin: 0.5rem 0 1rem; }
.profile-head .thread-h { margin-top: 0; }
.profile .term-form { max-width: 40rem; }

.btn.link { padding: 0 0.2em; font-size: 0.9em; color: var(--dim); }
.btn.link:hover { color: var(--bg); }
.badge { color: var(--art-alt); }

/* ---- Notifications indicator (next to [ ~ ]) ---- */
.menu { display: flex; align-items: center; gap: 0.35rem; }
.btn.notify { color: var(--art-alt); }
.btn.notify:hover, .btn.notify[aria-expanded="true"] { background: var(--art-alt); color: var(--bg); }
.notify-panel { min-width: min(22rem, calc(100vw - 2 * var(--gutter))); max-height: 60vh; overflow-y: auto; }
.notify-panel p { margin: 0; padding: 0.3rem 0.9rem; }
.notify-panel a { white-space: normal; line-height: 1.45; }
.notify-panel a::before { content: none; }
.notify-panel .notify-clear { color: var(--dim); border-top: 1px dotted var(--dim); margin-top: 0.35rem; }

/* ---- Whole-row links: click anywhere on a thread to open it ---- */
/* The title link's hit area is stretched over the row, so it stays a real link
   (keyboard, middle-click, open in new tab). Links inside the row sit above it. */
.threads li {
  position: relative;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  margin-left: -0.6rem;
  margin-right: -0.6rem;
}
.threads .thread-title::after {
  content: '';
  position: absolute;
  inset: 0;
}
.threads li .person { position: relative; z-index: 1; }
.threads li:has(.thread-title):hover {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  cursor: pointer;
}
.threads li:hover .thread-title { text-decoration: underline; text-underline-offset: 4px; }
.threads .thread-title:focus-visible { outline: none; }
.threads li:has(.thread-title:focus-visible) {
  outline: 1px dashed currentColor;
  outline-offset: -1px;
}

/* ---- Birds that fly by in the background (dither.js) ---- */
/* Attached to the page (not the window) so the birds scroll with the background.
   dither.js sets its height to the full page. */
body { position: relative; }
.sky-birds {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: -1;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---- Invite codes ---- */
.invite-form { gap: 0.4rem; max-width: 48rem; }
.invite-row { display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem 1rem; }
.invite-row label { flex: 1 1 14rem; }
.invite-row input[type="number"] { flex: 0 0 4.5rem; min-width: 0; }
.invite-row .btn { margin-top: 0; }
.code-list { list-style: none; margin: 0.6rem 0; padding: 0; columns: 2 14rem; }
.code-list li { font-size: 1.05rem; letter-spacing: 0.08em; color: var(--art-ink); user-select: all; padding: 0.1rem 0; }
.code-input { letter-spacing: 0.12em; text-transform: uppercase; }

/* ---- Dashboards (admin and account): sidebar sections, cards, tables ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dash {
  flex: 1;
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 2rem;
  width: min(100%, 76rem);
  margin: 0 auto;
  padding: 1rem var(--gutter) 3rem;
}
.dash-side { position: sticky; top: 1rem; align-self: start; }
.dash-side-title { margin: 0 0 0.75rem; color: var(--dim); font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase; }
.dash-tabs { display: flex; flex-direction: column; gap: 0.15rem; }
.dash-tabs a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.7rem;
  text-decoration: none;
  border-left: 2px solid transparent;
}
.dash-tabs a:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.dash-tabs a[aria-current="page"] { border-left-color: var(--art-ink); background: color-mix(in srgb, var(--art-ink) 14%, transparent); }
.dash-tabs .count { min-width: 1.6em; padding: 0 0.4em; text-align: center; font-size: 0.8em; color: var(--bg); background: var(--art-alt); }
.dash-tabs .count.quiet { color: var(--dim); background: transparent; }

.dash-main { min-width: 0; }
.dash-main > .status:empty { display: none; }
.panel-title { margin: 0 0 1rem; font-size: 1.25rem; font-weight: bold; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; margin: 0 0 1rem; }
.panel-head .panel-title { margin: 0; }
.panel-sub { margin-left: 0.5rem; font-size: 0.8rem; font-weight: normal; color: var(--dim); }
.card {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--dim) 55%, transparent);
  background: color-mix(in srgb, var(--text) 3%, var(--bg));
}
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0 0 0.75rem; font-size: 0.85rem; font-weight: normal; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }
.card-link { text-transform: none; letter-spacing: 0; font-size: 0.85rem; }
.card.secret { border-color: var(--art-ink); border-style: dashed; }
.card.secret p { margin: 0; }
.small { font-size: 0.82em; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; margin: 0 0 1.25rem; }
.stat-tiles .tile { padding: 0.8rem 0.9rem; border: 1px solid color-mix(in srgb, var(--dim) 55%, transparent); }
.stat-tiles dt { color: var(--dim); font-size: 0.8em; }
.stat-tiles dd { margin: 0.2rem 0 0; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat-tiles dd.alt { color: var(--art-alt); }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 0 1.25rem; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px dotted color-mix(in srgb, var(--dim) 60%, transparent); overflow-wrap: anywhere; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { text-decoration: none; }
.mini-list a:hover { text-decoration: underline; }

.table-card { padding: 0; overflow-x: auto; }
.table-card .card-title { padding: 1rem 1.15rem 0; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.dash-table th { padding: 0.6rem 0.9rem; text-align: left; font-weight: normal; color: var(--dim); font-size: 0.8rem; border-bottom: 1px solid color-mix(in srgb, var(--dim) 55%, transparent); white-space: nowrap; }
.dash-table td { padding: 0.55rem 0.9rem; border-bottom: 1px dotted color-mix(in srgb, var(--dim) 45%, transparent); vertical-align: middle; white-space: nowrap; }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table tbody tr:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.dash-table .num { font-variant-numeric: tabular-nums; }
.dash-table .cell-wrap { white-space: normal; overflow-wrap: anywhere; min-width: 12rem; }
.dash-table .cell-actions { text-align: right; width: 1%; }
.warn-text { color: var(--art-alt); }

.badge-pill { display: inline-block; padding: 0 0.45em; font-size: 0.78em; border: 1px solid currentColor; line-height: 1.5; white-space: nowrap; }
.badge-pill.ok { color: var(--art-ink); }
.badge-pill.warn, .badge-pill.alt { color: var(--art-alt); }

.row-menu { position: relative; display: inline-block; }
.row-menu summary { list-style: none; cursor: pointer; padding: 0.15rem 0.5rem; border: 1px solid color-mix(in srgb, var(--dim) 60%, transparent); color: var(--dim); }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary::after { content: ' ▾'; }
.row-menu[open] summary { color: var(--text); border-color: var(--text); }
/* Opens inside the row (not floating), so the table's scroll box can't clip it. */
.row-menu-items {
  margin-top: 4px;
  padding: 0.3rem 0;
  background: var(--bg);
  border: 1px solid var(--text);
  text-align: left;
}
.row-menu-items .btn { display: block; width: 100%; padding: 0.3rem 0.8rem; text-align: left; }

/* Account */
.dash-who { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 1rem; }
.dash-who > div { display: grid; min-width: 0; }
.dash-who strong, .dash-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-note { margin: -0.4rem 0 1rem; max-width: 46rem; font-size: 0.9rem; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 0 1.25rem; align-items: start; }
.profile-form { margin-top: 0; }
.profile-form label { display: grid; gap: 0.3rem; }
.profile-form input:not([type]), .profile-form textarea { width: 100%; }
.photo-row { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 0.4rem; }
.photo-actions { display: grid; justify-items: start; gap: 0.2rem; }
.photo-actions .btn { margin: 0; }
.photo-actions .meta { margin: 0.2rem 0 0; max-width: 26rem; }
.file-btn { cursor: pointer; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 1px solid var(--text); }
.profile-preview .profile-head { margin-top: 0; }
.profile-preview .thread-h { margin: 0 0 0.25rem; }
.profile-preview .post-body { min-height: 3em; }
.unsaved { color: var(--art-alt); }
.card.danger { border-color: color-mix(in srgb, var(--art-alt) 70%, transparent); }
.card.danger .card-title { color: var(--art-alt); }
.card.danger p { margin: 0 0 0.6rem; max-width: 46rem; }
.term-form label.check { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 0.6em; max-width: 46rem; }
.term-form label.check span { flex: 1; }
.term-form label.check input { flex: none; width: auto; min-width: 0; margin: 0.3em 0 0; padding: 0; border: 0; accent-color: var(--art-alt); }
button.btn-danger { color: var(--art-alt); outline: 1px solid var(--art-alt); }
button.btn-danger:not(:disabled):hover { background: var(--art-alt); color: var(--bg); }
button.btn-danger:disabled { cursor: not-allowed; }

/* Mail */
.mail-address { margin: 0 0 0.9rem; color: var(--art-ink); font-size: 0.85rem; overflow-wrap: anywhere; }
.compose-btn { display: inline-block; margin: 0 0 0.9rem; text-decoration: none; }
.mail-new { margin-top: 0; max-width: 52rem; }
.mail-new textarea { width: 100%; }
.mail-new label > span:not(.prompt) { color: var(--dim); }

/* Developer console (admin) */
.devcon { display: flex; flex-direction: column; height: min(70vh, 44rem); min-height: 22rem; border: 1px solid color-mix(in srgb, var(--dim) 55%, transparent); background: color-mix(in srgb, var(--text) 3%, var(--bg)); }
.devcon-out { flex: 1; overflow-y: auto; padding: 0.75rem 0.9rem; font-size: 0.85rem; line-height: 1.45; }
.devcon-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.devcon-line.head { color: var(--art-ink); margin-top: 0.35rem; }
.devcon-line.echo { color: var(--text); margin-top: 0.6rem; }
.devcon-line.dim { color: var(--dim); }
.devcon-line.ok { color: var(--art-ink); }
.devcon-line.err { color: var(--art-alt); }
.devcon-line.warn { color: var(--art-alt); }
.devcon-line.code { color: var(--art-ink); letter-spacing: 0.08em; user-select: all; }
.devcon-in { display: flex; align-items: center; gap: 0.6em; padding: 0.55rem 0.9rem; border-top: 1px solid color-mix(in srgb, var(--dim) 55%, transparent); }
.devcon-in input { flex: 1; min-width: 0; font: inherit; font-size: 0.9rem; color: var(--text); background: transparent; border: 0; outline: none; }

/* Mail conversations: each email a card, yours set apart, reply box at the bottom. */
.mail-thread { display: grid; gap: 0.75rem; margin: 0.25rem 0 1rem; }
.mail-msg { padding: 0.7rem 0.9rem; border-left: 2px solid var(--art-ink); background: color-mix(in srgb, var(--text) 3%, transparent); }
.mail-msg.mine { border-left-color: var(--art-alt); margin-left: 1.5rem; }
.mail-msg-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1rem; margin-bottom: 0.35rem; }
.mail-msg-head .mail-meta { margin: 0; }
.mail-quote { margin-top: 0.4rem; padding-left: 0.7rem; border-left: 1px dotted var(--dim); color: var(--dim); }
.quote-toggle { letter-spacing: 0.1em; border: 1px solid color-mix(in srgb, var(--dim) 60%, transparent); }

/* Inbox: list on the left, reader on the right. */
.inbox { display: grid; grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.inbox-list { padding: 0; max-height: 75vh; overflow-y: auto; }
.inbox-list ul { list-style: none; margin: 0; padding: 0; }
.inbox-list li { border-bottom: 1px dotted color-mix(in srgb, var(--dim) 45%, transparent); }
.inbox-list li.empty { padding: 1rem; }
.inbox-list li:not(.empty) { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; border-left: 2px solid transparent; }
.inbox-list li .mail-pick { display: flex; padding: 0.75rem 0 0.5rem 0.7rem; }
.mail-pick input { margin: 0; accent-color: var(--art-alt); }
.star { padding: 0; font: inherit; line-height: 1; color: var(--dim); background: none; border: 0; cursor: pointer; }
.star:hover, .star[aria-pressed="true"] { color: var(--art-alt); }
.inbox-list .star { align-self: center; min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.5rem; font-size: 1.9rem; }
.mail-bulk { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; padding: 0.5rem 0.9rem; font-size: 0.85rem; background: var(--bg); border-bottom: 1px solid color-mix(in srgb, var(--dim) 45%, transparent); }
.mail-bulk label { display: flex; align-items: center; gap: 0.5em; }
.mail-bulk input { margin: 0; accent-color: var(--art-alt); }
.mail-bulk-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.mail-search { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.mail-search input { flex: 1 1 14rem; min-width: 0; padding: 0.3rem 0; font: inherit; color: var(--text); background: transparent; border: 0; border-bottom: 1px dashed var(--dim); }
.mail-search input:focus { outline: none; border-bottom-style: solid; border-bottom-color: var(--text); }
.mail-note { margin: -0.4rem 0 1rem; }
.inbox-list a { display: grid; gap: 0.1rem; padding: 0.7rem 0.9rem; text-decoration: none; }
.inbox-list li:not(.empty):hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.inbox-list li.unread { border-left-color: var(--art-alt); }
.inbox-list li.unread .mail-subject { font-weight: bold; }
.inbox-list li.open { background: color-mix(in srgb, var(--art-ink) 14%, transparent); }
.mail-top { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.85rem; }
.mail-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-snippet { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-reader { min-height: 20rem; }
.mail-title { margin: 0 0 0.4rem; font-size: 1.15rem; overflow-wrap: anywhere; }
.mail-meta { margin: 0.1rem 0; font-size: 0.85rem; overflow-wrap: anywhere; }
.auth { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; margin-left: 0.3rem; vertical-align: middle; }
.mail-tools { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.9rem 0; padding-bottom: 0.9rem; border-bottom: 1px dotted color-mix(in srgb, var(--dim) 60%, transparent); }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.mail-frame { display: block; width: 100%; height: 32rem; border: 1px solid color-mix(in srgb, var(--dim) 55%, transparent); background: #fff; }
.mail-attachments { margin: 0.2rem 0 0; padding-left: 1rem; font-size: 0.85rem; }
.mail-replies { margin-top: 1.25rem; }
.mail-reply { margin-top: 0.75rem; padding: 0.6rem 0.8rem; border-left: 2px solid var(--art-ink); }
.mail-compose { margin-top: 1.25rem; }

@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; gap: 1rem; }
  .dash-side { position: static; }
  .dash-side-title { display: none; }
  .dash-tabs { flex-direction: row; overflow-x: auto; border-bottom: 1px solid color-mix(in srgb, var(--dim) 55%, transparent); }
  .dash-tabs a { flex: none; gap: 0.4rem; border-left: 0; border-bottom: 2px solid transparent; }
  .dash-tabs a[aria-current="page"] { border-bottom-color: var(--art-ink); }
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { max-height: 40vh; }
}
