/* Dark like the app (ThemeData.dark), teal accent from empty_guide.dart. */
:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-2: #2a2a2a;
  --border: #3a3a3a;
  --text: #ffffff;
  --text-2: #b3b3b3;
  --accent: #2a9d8f;
  --accent-text: #ffffff;
  --danger: #e57373;
  --ok: #4caf50;
  --radius: 8px;
  --gap: 12px;
  --bar-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100%; display: flex; flex-direction: column; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 8px 14px;
}
button:hover { border-color: var(--text-2); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.link { background: none; border: none; color: var(--accent); padding: 4px; }

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

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 18px; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand img { width: 28px; height: 28px; border-radius: 6px; background: #fff; }
.topbar .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

/* Connection dot, same colours as server_status_icon.dart */
.conn { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.conn::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--danger); }
a.conn:hover { text-decoration: none; color: var(--text); }
.conn.open::before { background: var(--ok); border-color: var(--ok); }
.conn.connecting::before { border-color: var(--text-2); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .3; } }

main.page { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--gap); min-height: 50vh; }
.muted { color: var(--text-2); }
.err { color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--text-2); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

select.lang { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 8px; }

button.big { width: 100%; min-height: 48px; border-radius: 12px; font-size: 16px; font-weight: 600; }
a.button.big { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; min-height: 48px; border-radius: 12px; font-size: 16px; font-weight: 600; }
.auth-stores { display: grid; gap: 10px; margin: 8px 0 4px; }
button.danger { background: #b23b3b; border-color: #b23b3b; color: #fff; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Auth screens (login.dart) */
.auth { display: flex; justify-content: center; padding: 8px 0 32px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.auth-card.welcome { text-align: center; align-items: center; padding-top: 24px; }
.auth-card.welcome .muted { margin-bottom: 24px; }
.auth-card h1 { margin: 4px 0 0; font-size: 24px; font-weight: 600; }
.auth-card p { margin: 0; }
.auth-nav { display: flex; justify-content: space-between; align-self: stretch; min-height: 32px; }
.auth-nav button.link { font-size: 22px; line-height: 1; }
.auth-logo { background: #fff; border-radius: 22%; box-sizing: content-box; }
.auth-form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-form fieldset:disabled { opacity: .6; }
.switch { text-align: center; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: var(--text-2); }
.field input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field input.code { letter-spacing: 4px; font-size: 20px; text-transform: lowercase; }
.field .hint { font-size: 12px; color: var(--text-2); }
.field .err { font-size: 12px; color: var(--danger); min-height: 0; }
.field .err:empty { display: none; }

.notice {
  padding: 12px 14px;
  border: 1px solid var(--accent);
  background: rgb(42 157 143 / 16%);
  border-radius: 12px;
}

label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
label.check input { margin-top: 3px; accent-color: var(--accent); }

/* Dialogs, menus, toasts */
dialog.dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: min(440px, calc(100vw - 32px));
}
dialog.dialog::backdrop { background: rgb(0 0 0 / 60%); }
dialog.dialog h2 { margin: 0 0 12px; font-size: 19px; }
.dialog-body p { margin: 0 0 12px; }
.dialog-body .links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.dialog-actions > button { white-space: nowrap; }

.menu-anchor { position: relative; }
button.avatar {
  width: 36px; height: 36px; padding: 0; border-radius: 50%; overflow: hidden;
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
button.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  min-width: 260px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - var(--bar-h) - 16px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / 50%);
  padding: 6px 0;
  z-index: 20;
}
.menu.align-end { right: 0; }
.menu-head { padding: 8px 14px 10px; }
.menu-head .muted { font-size: 13px; overflow-wrap: anywhere; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu .item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 14px; border: 0; border-radius: 0; background: none;
  color: var(--text); text-align: left; font-size: 14px;
}
.menu .item:hover:not(:disabled), .menu .item:focus-visible { background: var(--surface-2); text-decoration: none; outline: none; }
.menu .item:disabled { opacity: .4; cursor: default; }
.menu .item[aria-checked]:disabled { opacity: 1; }
.menu .check { width: 16px; color: var(--accent); text-align: center; }

.toasts {
  position: fixed; inset: auto auto 20px 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 100;
  width: min(480px, calc(100vw - 24px));
  margin: 0; padding: 0; border: 0; background: none; color: inherit; overflow: visible;
}
.toasts:popover-open { display: flex; }
.toasts[popover]:not(:popover-open) { display: none; }
.toast {
  background: #333; color: #fff; padding: 12px 16px; border-radius: var(--radius);
  box-shadow: 0 4px 16px rgb(0 0 0 / 50%); cursor: pointer;
}
.toast.error { border-left: 4px solid var(--danger); }

.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon { display: block; flex: none; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pre { white-space: pre-line; }
.spinner.small { width: 18px; height: 18px; border-width: 2px; }
.danger-text { color: var(--danger) !important; }

button.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  background: none; border-color: transparent; color: var(--text-2);
}
button.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
button.icon-btn.alert { color: var(--danger); }
button.icon-btn.spinning .icon { animation: spin .8s linear infinite; }
button.with-icon { display: inline-flex; align-items: center; gap: 6px; padding-left: 10px; }
.badge {
  position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff; font-size: 11px; line-height: 16px; font-weight: 700;
}

/* Project list (project_list.dart) */
.list-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.list-head h1 { margin: 0; font-size: 22px; font-weight: 600; flex: 1; }
.list-head .tools { display: flex; align-items: center; gap: 4px; }
select.sort { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; margin-right: 2px; }

.updates {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
  padding: 8px 12px; border-radius: var(--radius); background: #1f3b38;
}
.updates .grow { flex: 1; }
.updates button.link { color: #4fd1c5; font-weight: 600; }
.dot-new { width: 10px; height: 10px; border-radius: 50%; background: #4fd1c5; flex: none; }

.project-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.project-row { display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.project-row:hover { background: var(--surface); }
.project-row.deleted .project-title { color: var(--text-2); }
.project-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 10px 8px; color: var(--text); }
.project-link:hover { text-decoration: none; }
.cover {
  flex: none; width: 48px; height: 48px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
}
.project-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.project-title { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.project-desc { color: var(--text-2); font-size: 13px; }
.muted-icon { color: var(--text-2); }
.badge-new { flex: none; padding: 1px 6px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.project-row .menu-anchor { padding-right: 4px; }

/* Empty guide (empty_guide.dart) */
.guide { max-width: 560px; margin: 24px auto; text-align: center; }
.guide h2 { margin: 0 0 6px; font-size: 22px; }
.guide-steps { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.guide-step { display: flex; gap: 14px; padding: 14px; border-radius: var(--radius); background: rgb(255 255 255 / 6%); }
.guide-step p { margin: 4px 0 8px; }
.step-n {
  flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

/* Form dialogs, invitations, pickers */
.dialog-form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.dialog-form fieldset:disabled { opacity: .6; }
.dialog-form p { margin: 0; }
.field textarea, .field select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-size: 15px; resize: vertical;
}
.field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field .label { font-size: 13px; color: var(--text-2); }
.roles { display: flex; flex-direction: column; gap: 8px; }
.roles .hint { display: block; font-size: 12px; color: var(--text-2); }
ul.invited { margin: 4px 0 0; padding-left: 4px; list-style: none; color: var(--ok); }

ul.invites { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; }
.invite { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 4px; }
.invite-text { font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.pick-list { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; margin: 0 -8px 8px; }
.pick-list .item { text-align: left; border: 0; background: none; border-radius: var(--radius); padding: 10px 8px; }
.pick-list .item:hover { background: var(--surface-2); }

/* Project view */
a.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; color: var(--text-2);
}
a.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.active { color: var(--accent); }
.project-head h1 { min-width: 0; }
.project-head .back { flex: none; margin-left: -8px; }
.cover { position: relative; overflow: hidden; }
.cover .thumb { position: absolute; inset: 0; }
a.button {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text);
}
a.button:hover { border-color: var(--text-2); text-decoration: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab { padding: 8px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.filter-bar, .search-bar { margin-bottom: 12px; }
input.filter, input.search {
  width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
}
input.filter:focus, input.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.center-text { text-align: center; margin: 32px 0; }
.tag-head h2 { margin: 0 0 12px; font-size: 18px; }

.media-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px;
}
.tile { position: relative; aspect-ratio: 1; background: #000; border-radius: 4px; overflow: hidden; }
.tile-link { position: absolute; inset: 0; display: block; color: var(--text); }
.tile-link:hover { text-decoration: none; }
.tile-link:focus-visible { outline-offset: -2px; }
.thumb { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: rgb(255 255 255 / 4%); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-wait { width: 40%; height: 3px; border-radius: 2px; background: var(--border); }
.thumb-icon { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-2); }
.thumb-icon .ext { font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.thumb .mark { position: absolute; display: flex; color: #fff; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 70%)); }
.thumb .mark.play { inset: 0; align-items: center; justify-content: center; opacity: .9; }
.thumb .mark.pdf { right: 4px; bottom: 4px; color: #e53935; background: #fff; border-radius: 3px; }
.tile .pin {
  position: absolute; top: 4px; right: 4px; display: flex; padding: 3px; border-radius: 50%;
  background: rgb(0 0 0 / 55%); color: #4fd1c5; pointer-events: none;
}
.tile-more {
  position: absolute; top: 2px; left: 2px; background: rgb(0 0 0 / 55%) !important; color: #fff !important;
  opacity: 0; transition: opacity .15s;
}
.tile:hover .tile-more, .tile-more:focus-visible, .tile-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .tile-more { opacity: 1; } }
.tile-text {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 8px; background: rgb(0 0 0 / 62%); border: 1px solid rgb(255 255 255 / 25%); border-radius: 4px;
}
.tile.text-mode:not(:has(.thumb)) .tile-text { background: var(--surface); }
.tile-text .caption {
  font-size: 12px; text-align: center; overflow-wrap: anywhere; margin: auto 0;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-text .poster { display: flex; flex-direction: column; align-items: flex-end; font-size: 10px; color: var(--text-2); }
.tile-text .poster strong { color: rgb(255 255 255 / 75%); }
.mention { color: #64b5f6; }
.media-ref { color: #ffb74d; }
.tag { color: #4fd1c5; }
.more-sentinel { height: 1px; }

.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.activity-row {
  display: flex; gap: 12px; padding: 10px; border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.activity-row:hover { background: var(--surface-2); }
.activity-thumb { flex: none; width: 56px; height: 56px; border-radius: 4px; overflow: hidden; background: #000; }
.activity-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.activity-text { margin: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.activity-meta { margin: 0; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); }

.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
button.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 16px; font-size: 13px; color: #4fd1c5; }
button.chip .count { color: var(--text-2); font-size: 11px; }

.menu.at-point { position: fixed; top: auto; z-index: 50; min-width: 220px; }

/* Media page (comment_list.dart): file on the left, details and thread on the right */
a.media-ref { color: #ffb74d; }
a.web-link { color: #81d4fa; text-decoration: underline; overflow-wrap: anywhere; }
.media-view { display: flex; flex-direction: column; height: calc(100dvh - var(--bar-h) - 48px); min-height: 480px; }
.media-head h1 { min-width: 0; }
.media-head .back { flex: none; margin-left: -8px; }
.media-head .position { font-size: 13px; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.media-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; }
.media-body.no-file { grid-template-columns: minmax(0, 720px); justify-content: center; }
.media-body.no-file .stage { display: none; }

.stage {
  position: relative; min-height: 0; border-radius: var(--radius); background: #000; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.stage-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.stage.zoomed { overflow: auto; display: grid; place-content: normal; place-items: normal; }
.stage.zoomed .stage-img { max-width: none; max-height: none; margin: auto; cursor: zoom-out; }
.stage-video { width: 100%; height: 100%; background: #000; }
.stage-audio { width: min(480px, 90%); }
.stage-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.stage-wait .thumb { position: absolute; inset: 0; background: none; }
.stage-wait .thumb img { object-fit: contain; filter: blur(2px) brightness(.6); }
.stage-wait .thumb .mark { display: none; }
.stage-msg, .stage-file { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; text-align: center; }
.stage-msg p { margin: 0; }
.row-center { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }
.pdf-preview { width: min(320px, 70vw); aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; }
.pdf-preview .thumb img { object-fit: contain; }
.pdf-preview .thumb .mark { display: none; }
.file-icon { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); }
.file-icon .ext { font-weight: 700; letter-spacing: 1px; }
.file-name { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }

.media-side { min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.media-info { padding: 12px 12px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.poster-row, .comment-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.poster-row .author { flex: 1; }
a.author { color: var(--text); font-weight: 600; min-width: 0; }
.activity-meta a.author { color: var(--text-2); font-weight: normal; }
a.mention { color: #64b5f6; }
.date { flex: none; font-size: 12px; }
.caption-row { display: flex; align-items: flex-start; gap: 4px; }
.caption-row .clamp-box, .caption-row > .caption-text { flex: 1; min-width: 0; }
.caption-text { font-size: 16px; }
.caption-edit { display: flex; flex-direction: column; gap: 8px; }
.avatar-pic {
  flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  overflow: hidden; background: #3c4a59; color: #cfd8dc;
}
.avatar-pic img { width: 100%; height: 100%; object-fit: cover; }

.clamp { white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: var(--lines, 6); -webkit-box-orient: vertical; overflow: hidden; }
.clamp.open { display: block; -webkit-line-clamp: none; }
.read-more { padding: 2px 0; font-weight: 600; font-size: 14px; color: #81d4fa; }

.comments { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; }
.comment:hover { background: rgb(255 255 255 / 3%); }
.comment-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.comment-meta .author { font-size: 13px; }
.comment-actions { flex: none; display: flex; align-items: center; gap: 2px; }
.comment-more { opacity: 0; }
.comment:hover .comment-more, .comment-more:focus-visible, .comment-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .comment-more { opacity: 1; } }
a.reply-count {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; background: #fff; color: #000;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
a.reply-count:hover { text-decoration: none; background: #e0f2f1; }
.no-comments { padding: 24px 12px; text-align: center; }
.thread-parent {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 8px 8px; padding: 10px;
  border-radius: 12px; background: #262626;
}
.thread-parent .up { flex: none; background: rgb(0 0 0 / 40%); }
.attachment-img { width: 160px; height: 160px; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: #000; }
.attachment-link { align-self: flex-start; padding: 2px 0; }

.composer-box { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.composer { display: flex; align-items: flex-end; gap: 4px; }
.composer .mention-box { flex: 1; }
.composer .send { color: var(--accent); }
.reply-banner { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #181818; color: var(--text-2); }
.reply-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.reply-banner-text span:first-child { color: var(--text); }

.mention-box { position: relative; }
textarea.mention-text {
  display: block; width: 100%; resize: none; background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 12px; line-height: 1.45;
}
textarea.mention-text:focus { outline: none; border-color: var(--accent); }
.mention-list {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 30; list-style: none; margin: 0; padding: 4px 0;
  max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / 50%);
}
.dialog .mention-list { bottom: auto; top: calc(100% + 4px); }
.mention-item { display: flex; align-items: center; gap: 10px; padding: 6px 12px; cursor: pointer; min-width: 0; }
.mention-item.active { background: var(--surface-2); }
.mention-icon { display: flex; color: #ffb74d; }

dialog.dialog.wide { width: min(760px, calc(100vw - 32px)); }
.picker-scroll { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.picker-grid { width: 100%; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
button.picker-tile { padding: 0; border: 0; border-radius: 0; background: none; width: 100%; height: 100%; }
.picker-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 4px; background: rgb(0 0 0 / 60%);
  font-size: 11px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-tile:not(:has(.thumb)) .picker-caption { top: 0; display: flex; align-items: center; justify-content: center; white-space: normal; background: var(--surface-2); }
.picker-empty { grid-column: 1 / -1; text-align: center; padding: 24px; }

/* Uploads */
.project-view { position: relative; }
.drop-hint {
  display: none; position: absolute; inset: -8px; z-index: 40; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  border: 2px dashed var(--accent); border-radius: var(--radius); background: rgb(18 18 18 / 88%); color: var(--accent); font-size: 18px; pointer-events: none;
}
.project-view.dropping .drop-hint { display: flex; }
button.tile-link { padding: 0; border: 0; border-radius: 0; background: none; width: 100%; height: 100%; cursor: pointer; }
.tile.pending .thumb img { opacity: .45; }
.tile.pending { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile.pending.failed { outline-color: var(--danger); }
.pending-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #fff; }
.tile.failed .pending-overlay { color: var(--danger); }
.pending-label { font-weight: 700; text-shadow: 0 1px 3px rgb(0 0 0 / 80%); }
.pending-bar { width: 70%; height: 4px; border-radius: 2px; background: rgb(255 255 255 / 25%); overflow: hidden; }
.pending-bar span { display: block; height: 100%; background: var(--accent); }

.upload-usage { margin-top: 0; }
.upload-rows { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.upload-row { display: flex; gap: 12px; align-items: flex-start; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.upload-preview { flex: none; width: 72px; height: 72px; border-radius: 6px; overflow: hidden; background: #000; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.upload-name { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.upload-name .ellipsis { flex: 1; min-width: 0; }
.upload-info .err { margin: 0; display: flex; align-items: center; gap: 4px; }
.upload-actions { display: flex; flex-direction: column; }
.upload-more { margin-right: auto; display: inline-flex; align-items: center; gap: 4px; }
.mention-item .count { margin-left: auto; color: var(--text-2); font-size: 12px; }

.crop-tools, .draw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 10px; }
.crop-ratios { display: inline-flex; gap: 4px; }
.crop-ratios .chip[aria-pressed="true"], .chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.crop-stage { height: min(60vh, 560px); background: #000; }
.crop-img { display: block; max-width: 100%; }

.draw-group { display: inline-flex; align-items: center; gap: 2px; }
.swatch { display: block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgb(255 255 255 / 50%); }
.width-dot { display: block; border-radius: 50%; background: currentColor; }
.draw-tools .icon-btn.active { background: var(--surface-2); }
.draw-stage { position: relative; display: flex; justify-content: center; background: #000; }
.draw-canvas { display: block; max-width: 100%; max-height: 62vh; touch-action: none; cursor: crosshair; }
.draw-text {
  position: absolute; min-width: 120px; padding: 0 2px; border: 1px dashed currentColor; background: rgb(0 0 0 / 35%);
  font-weight: 700; line-height: 1.2; resize: none; overflow: hidden;
}

.attach-chip { display: flex; align-items: center; gap: 8px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius); }
.attach-thumb { flex: none; width: 44px; height: 44px; border-radius: 4px; overflow: hidden; background: #000; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.attach-text .err { display: flex; align-items: center; gap: 4px; }

@media (max-width: 900px) {
  .media-view { height: auto; min-height: 0; }
  .media-body, .media-body.no-file { display: flex; flex-direction: column; }
  .stage { height: 50vh; flex: none; }
  .comments { overflow: visible; }
}
@media (max-width: 600px) {
  .list-head.media-head h1 { flex-basis: auto; flex: 1; }
  .media-head .tools { margin-left: auto; }
}

/* People, profile and settings */
.section-title { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); margin: 20px 0 8px; }
.members { max-width: 760px; }
.members-head { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.members-head button { display: inline-flex; align-items: center; gap: 6px; }
.member-list { list-style: none; margin: 0; padding: 0; }
.member-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); }
.member-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 4px; color: var(--text); }
a.member-link:hover { text-decoration: none; background: var(--surface-2); }
.member-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.member-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.member-text .muted { font-size: 13px; }
.you { flex: none; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.invite-icon { width: 40px; height: 40px; }
.profile-view, .settings-view { max-width: 760px; }
.profile-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 8px 0 16px; }
.profile-name { margin: 8px 0 0; font-size: 22px; }
.profile-email { margin: 0; user-select: all; }
.role-chip { font-size: 12px; padding: 2px 10px; border-radius: 12px; border: 1px solid var(--border); color: var(--text-2); }
.profile-bio { margin: 4px 0 0; max-width: 560px; overflow-wrap: anywhere; }
.profile-card a.button { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
a.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 16px; font-size: 13px; background: var(--surface-2); color: var(--text); }
a.chip:hover { text-decoration: none; background: var(--border); }
.settings-section { border-top: 1px solid var(--border); padding: 16px 0; }
.settings-section h2 { font-size: 17px; margin: 0 0 12px; }
.settings-section h3 { font-size: 15px; margin: 16px 0 8px; }
.settings-photo { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.settings-photo button { display: inline-flex; align-items: center; gap: 6px; }
.settings-form { display: flex; flex-direction: column; gap: 4px; max-width: 480px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.settings-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.settings-links a { display: inline-flex; align-items: center; gap: 4px; }
.settings-view select { max-width: 240px; }

@media (max-width: 600px) {
  .topbar .brand span { display: none; }
  .conn .label { display: none; }
  main.page { padding: 16px 12px; }
  .list-head h1 { flex-basis: 100%; }
  .projects .list-head .tools { width: 100%; }
  select.sort { flex: 1 1 auto; min-width: 0; text-overflow: ellipsis; }
  button.with-icon span { display: none; }
  button.with-icon { padding: 0 8px; }
  .project-head h1 { flex-basis: auto; flex: 1; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 2px; }
}
