/* server/public/style.css */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --border: #222222;
  --border-light: #333333;
  --text: #e0e0e0;
  --text-muted: #999999;
  --text-dim: #666666;
  --text-faint: #444444;
  --text-ghost: #333333;
  --accent: #4a3aff;
  --accent-light: #6b5cff;
  --green: #2a2;
  --red: #e44;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --max-width: 1280px;
  --content-width: 720px;
  --shadow: 4px 4px 0 var(--accent);
  --shadow-sm: 3px 3px 0 var(--accent);
  --on-accent: #fff;
  --surface-raised: #fff;
  --accent-tint-05: rgba(74, 58, 255, 0.05);
  --accent-tint-08: rgba(74, 58, 255, 0.08);
  --accent-tint-10: rgba(74, 58, 255, 0.1);
  --accent-tint-12: rgba(74, 58, 255, 0.12);
  --accent-shadow-30: rgba(74, 58, 255, 0.3);
  --accent-shadow-40: rgba(74, 58, 255, 0.4);
  --overlay-shadow: rgba(0, 0, 0, 0.5);
  --scroll-thumb: #333;
  --red-shadow-30: rgba(238, 68, 68, 0.3);
  --warn: #e6a23c;
  --info-accent: #4af;
  --on-accent-strong: #000;
  --pg-brand: #e0e0e0;  /* Paper Giant wordmark — soft white on dark, brand pink on light */
  --link: #a49bff;          /* accent text that meets 4.5:1 on the surface */
  --field-border: #6e6e6e;  /* input and control boundaries, 3:1 or better */
  --admin-bg: #3a2a05;      /* Admin view: amber, unmistakable in both themes */
  --admin-fg: #ffd27a;
  --admin-border: #b58421;
  color-scheme: dark;
}

/* Paper-cream light theme. Twin blocks: attribute (explicit choice) and
   media query (auto). Keep in sync with each other. */
html[data-theme="light"] {
  --bg: #faf9f5;
  --surface: #ffffff;
  --border: #e8e6e0;
  --border-light: #d8d6d0;
  --text: #3d3d3a;
  --text-muted: #6b6a64;
  --text-dim: #8a8880;
  --text-faint: #b5b3ac;
  --text-ghost: #d0cec7;
  --overlay-shadow: rgba(0, 0, 0, 0.15);
  --scroll-thumb: #cfcdc6;
  --pg-brand: #db1b5c;
  --link: #4a3aff;
  --field-border: #8c8a83;
  --admin-bg: #fff4dc;
  --admin-fg: #6b4500;
  --admin-border: #b07a14;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  /* keep in sync with the html[data-theme="light"] block above */
  html:not([data-theme="dark"]) {
    --bg: #faf9f5;
    --surface: #ffffff;
    --border: #e8e6e0;
    --border-light: #d8d6d0;
    --text: #3d3d3a;
    --text-muted: #6b6a64;
    --text-dim: #8a8880;
    --text-faint: #b5b3ac;
    --text-ghost: #d0cec7;
    --overlay-shadow: rgba(0, 0, 0, 0.15);
    --scroll-thumb: #cfcdc6;
    --pg-brand: #db1b5c;
    --link: #4a3aff;
    --field-border: #8c8a83;
    --admin-bg: #fff4dc;
    --admin-fg: #6b4500;
    --admin-border: #b07a14;
    color-scheme: light;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Header: a slim utility row above the main row */
header {
  max-width: var(--max-width);
  margin: 0 auto 28px;
  padding: 0 16px;
  border-bottom: 3px solid var(--border);
}
.utility-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.user-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-link {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-link:hover { color: var(--text); text-decoration: underline; }
.logout-form { display: inline; }
.logout-btn { background: none; border: 0; padding: 4px 0; color: var(--text-muted); cursor: pointer; font-size: 12px; }
.logout-btn:hover { color: var(--text); text-decoration: underline; }
.notif-wrap { position: relative; display: flex; }
.notif-bell { background: none; border: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; }
.utility-row :is(button, a):focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }

.main-row {
  display: flex;
  align-items: center;
  gap: 16px 20px;
  padding: 14px 0 16px;
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.logo { text-decoration: none; display: flex; align-items: center; }
.logo-img { height: 64px; width: auto; display: block; }
.pg-mark {
  display: flex;
  align-items: center;
  padding-left: 16px;
  border-left: 1px solid var(--border-light);
  color: var(--pg-brand);
}
.pg-mark:hover { color: #db1b5c; }
.pg-mark svg { height: 20px; width: auto; display: block; }
.primary-nav { display: flex; gap: 4px; flex: 0 0 auto; }
.nav-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 12px;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: all 0.1s;
  letter-spacing: 0.02em;
}
.nav-link:hover { color: var(--text); border-color: var(--border); }
.nav-link.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-tint-08);
}
.nav-link:focus-visible, .logo:focus-visible, .pg-mark:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.search-trigger {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 520px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 8px 6px 12px;
  background: var(--surface);
  border: 1.5px solid var(--field-border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.search-trigger:hover { border-color: var(--accent); color: var(--text); }
.search-trigger:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.search-trigger-long, .search-trigger-short { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger-short { display: none; }
.search-trigger-kbd { flex: 0 0 auto; font-family: var(--mono); font-size: 10px; color: var(--text-muted); border: 1px solid var(--border-light); border-radius: 4px; padding: 1px 6px; }
.upload-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--accent);
  box-shadow: 3px 3px 0 var(--accent-shadow-40);
  transition: transform 0.1s, box-shadow 0.1s;
}
.upload-cta:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--accent-shadow-40); }
.upload-cta:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.upload-cta.active { box-shadow: inset 0 0 0 2px var(--on-accent); }

@media (max-width: 900px) {
  .main-row { flex-wrap: wrap; }
  .brand { flex: 1 1 100%; }
  .logo-img { height: 56px; }
  .search-trigger { margin-left: 0; max-width: none; }
}
@media (max-width: 600px) {
  .logo-img { height: 48px; }
  .primary-nav { flex: 1 1 100%; }
  .search-trigger-long, .search-trigger-kbd { display: none; }
  .search-trigger-short { display: inline; }
  .search-trigger { flex: 1 1 0; }
  .search-trigger, .upload-cta, .nav-link { min-height: 44px; }
  .nav-link { display: inline-flex; align-items: center; }
  .notif-bell { min-width: 44px; min-height: 44px; }
}

/* Search palette */
.search-palette {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  max-height: min(70vh, 640px);
  margin: 12vh auto auto;
}
.search-palette[open] { display: flex; flex-direction: column; }
.search-palette::backdrop { background: var(--overlay-shadow); }
.sp-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.sp-input { flex: 1 1 auto; min-width: 0; background: transparent; border: 0; font-size: 16px; color: var(--text); padding: 6px 0; }
.sp-input:focus { outline: none; }
.sp-head:focus-within { box-shadow: inset 0 -2px 0 var(--accent); }
.sp-status { padding: 8px 16px 0; font-size: 12px; color: var(--text-muted); min-height: 1.5em; }
.sp-scroll { overflow-y: auto; min-height: 0; flex: 1 1 auto; padding: 4px 8px 8px; }
.sp-group { padding-top: 6px; }
.sp-group-label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 6px 8px; }
.sp-opt { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 6px; cursor: pointer; border-left: 3px solid transparent; min-height: 44px; justify-content: center; }
.sp-opt:hover { background: var(--accent-tint-05); }
.sp-opt.active { background: var(--accent-tint-12); border-left-color: var(--accent); }
.sp-opt-title { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-opt.active .sp-opt-title { font-weight: 600; }
.sp-opt-meta { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-extra { padding: 4px 10px; font-size: 12px; color: var(--text-muted); }
.sp-extra:empty { display: none; }
.sp-extra-link { color: var(--link); }
.sp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.sp-all { color: var(--link); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sp-all:focus-visible, .sp-close:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.sp-keys { flex: 0 0 auto; font-family: var(--mono); font-size: 11px; }
@media (max-width: 600px) {
  .search-palette {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .sp-close { min-height: 44px; }
  .sp-keys { display: none; }
}

.search-page-form { display: flex; gap: 8px; margin-bottom: 16px; max-width: 640px; }
.search-page-input { flex: 1 1 auto; min-width: 0; }

/* Main content */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* Feed grid */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* App cards (feed) */
.card {
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
  /* No overflow clipping here, so action menus can extend past the body;
     the preview clips itself. */
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card.menu-open { z-index: 5; }
.card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--accent);
}

.card-preview {
  height: 140px;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid var(--border-light);
  border-radius: 8px 8px 0 0;
}

.card-preview-iframe {
  --preview-scale: 0.21875;
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% / var(--preview-scale));
  height: 800px;
  transform: scale(var(--preview-scale));
  transform-origin: top left;
  border: none;
  pointer-events: none;
  background: var(--surface-raised);
}

.card-body { padding: 14px 16px; }

.card-slug {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--link);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-version {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  white-space: nowrap;
}

.card-description {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.card .card-meta { column-gap: 0; }
/* Each item stays whole; the dot belongs to the item after it. */
.card .card-meta > * { white-space: nowrap; }
.card .card-meta > * + *::before { content: "·"; margin: 0 6px; color: var(--text-muted); }
/* The Admin label is a bordered chip: separate it with space, not a dot inside it. */
.card .card-meta > .admin-chip::before { content: none; }
.card .card-meta > .admin-chip { margin-left: 8px; }
.card-meta .meta-author { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* Content-width wrapper for narrower views */
.content-narrow {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* Upload form */
.tab-toggle {
  display: flex;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 6px 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.tab-btn.active {
  color: var(--text);
  background: var(--accent);
  color: var(--on-accent);
}

.drop-zone {
  border: 3px dashed var(--border-light);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  margin-bottom: 24px;
  transition: border-color 0.1s, background 0.1s, box-shadow 0.1s;
}
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-tint-05);
  box-shadow: var(--shadow);
}

.drop-zone-icon { font-size: 24px; margin-bottom: 8px; opacity: 0.4; }
.drop-zone-text { font-family: var(--mono); font-size: 14px; color: var(--text-dim); }
.drop-zone-hint { font-family: var(--mono); font-size: 12px; color: var(--text-ghost); margin-top: 4px; }

.upload-btns { display: flex; gap: 8px; margin-top: 8px; }
.btn-small { font-family: var(--mono); font-size: 12px; padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text-muted); cursor: pointer; transition: border-color 0.1s; }
.btn-small:hover { border-color: var(--accent); color: var(--text); }

.paste-area {
  width: 100%;
  min-height: 200px;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  resize: vertical;
  margin-bottom: 24px;
}
.paste-area:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-sm); }

.file-list {
  margin-bottom: 24px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.file-name {
  font-family: var(--mono);
  color: var(--text-muted);
}

.file-size { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

.file-remove {
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}
.file-remove:hover { color: var(--red); }

/* Slug input */
.slug-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 8px;
  padding: 0 14px;
  height: 44px;
  margin-bottom: 6px;
}

.slug-prefix, .slug-suffix {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-ghost);
  white-space: nowrap;
}

.slug-input {
  background: none;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-light);
  padding: 0 4px;
  min-width: 80px;
  flex: 1;
}

.slug-status {
  font-size: 11px;
  font-family: var(--mono);
  padding-left: 4px;
  margin-bottom: 16px;
  min-height: 16px;
  line-height: 16px;
}
.slug-status.available { color: var(--green); }
.slug-status.taken { color: var(--red); }
.slug-status.invalid { color: var(--red); }

/* Form fields */
.form-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  display: block;
}

.form-input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--field-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-sm); }

.btn-deploy {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid var(--accent);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 4px 4px 0 var(--accent-shadow-30);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-deploy:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--accent-shadow-40);
}
.btn-deploy:disabled { opacity: 0.35; cursor: not-allowed; }

/* App detail */
.app-detail-header { margin-bottom: 24px; }

.app-detail-title {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.app-detail-slug {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-light);
}

.app-detail-description {
  color: var(--text-muted);
  margin: 12px 0;
}

.app-preview-iframe {
  width: 100%;
  height: 400px;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  background: var(--surface-raised);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.app-actions .btn { flex: 0 0 auto; white-space: nowrap; }
.app-actions .card-meta { flex: 1 1 220px; align-self: center; }
.app-actions .card-meta ~ .btn { align-self: center; }

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border-light);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--accent);
}
.btn-danger { color: var(--red); border-color: var(--red); box-shadow: 3px 3px 0 var(--red-shadow-30); }
.btn-danger:hover { box-shadow: 4px 4px 0 var(--red); }
.btn-small { padding: 6px 14px; font-size: 11px; }

/* Public sharing toggle */
.sharing-toggle {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.sharing-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sharing-toggle-label {
  font-weight: 700;
  font-size: 14px;
  font-family: var(--mono);
}
.sharing-toggle-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--mono);
}
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
}
.toggle-switch.active {
  background: var(--accent);
}
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--surface-raised);
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch.active .toggle-knob {
  transform: translateX(20px);
}
.invite-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.invite-form .comment-input { min-height: 40px; }
.invite-form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Name and email sit side by side when there is room and stack when not. */
.invite-fields { flex-wrap: wrap; }
.invite-fields .sharing-link-input { flex: 1 1 180px; }
/* One invited person: who they are, then their actions (wrapping below on narrow screens). */
.invite-item { align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.invite-who { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.sharing-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--border);
}
.sharing-link-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  outline: none;
}
.sharing-password-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.sharing-password-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.sharing-password-label {
  color: var(--text-muted);
  font-size: 13px;
}
.sharing-password-actions {
  display: flex;
  gap: 6px;
}
.sharing-password-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.sharing-password-edit .sharing-link-input {
  flex: 1 1 160px;
}

/* Deploy history */
.deploy-list { margin-top: 24px; }
.deploy-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 2px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* People */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.person-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}
.person-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--accent);
}

.person-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--border-light);
  border: 2px solid var(--border);
}

.person-name { color: var(--text); font-size: 14px; font-weight: 600; }
.person-stats { font-family: var(--mono); color: var(--text-dim); font-size: 11px; }

/* Utilities */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.time-ago { color: var(--text-muted); }

.section-title {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* Reactions */
.reaction-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.reaction-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.1s;
}
.reaction-btn:hover {
  border-color: var(--accent);
  background: var(--accent-tint-08);
}
.reaction-btn.reacted {
  border-color: var(--accent);
  background: var(--accent-tint-12);
  box-shadow: 0 0 0 1px var(--accent);
}

.reaction-count {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.reaction-summary {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.reaction-pill {
  font-size: 11px;
  background: var(--border);
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* Comments */
.comment {
  padding: 12px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.comment-reply {
  margin-left: 24px;
  margin-top: 8px;
  border-color: var(--border-light);
  background: var(--bg);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-author {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
}

.comment-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 0 4px;
}
.comment-delete:hover { color: var(--red); }

.comment-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-reply-btn, .comment-resolve-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 0 0;
}
.comment-reply-btn:hover, .comment-resolve-btn:hover { color: var(--accent-light); }

.comment-empty {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 0;
}

.comment-form {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  margin-bottom: 24px;
}

.comment-input {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--text);
  resize: vertical;
  min-height: 40px;
}
.comment-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.comment-submit {
  padding: 10px 16px;
  white-space: nowrap;
}

.comment-cancel {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-dim);
  border-color: var(--border);
  box-shadow: none;
}

.mention {
  color: var(--accent-light);
  font-weight: 600;
  background: var(--accent-tint-10);
  padding: 1px 4px;
  border-radius: 3px;
}

.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 4px;
  overflow: hidden;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.mention-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
}
.mention-item-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mention-item:hover, .mention-item.active {
  background: var(--accent-tint-10);
}

.mention-item-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.mention-item-email {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
}

/* Notification bell */
.notif-bell {
  position: relative;
  cursor: pointer;
  color: var(--text-dim);
  padding: 6px;
  border-radius: 8px;
  transition: color 0.15s;
}
.notif-bell:hover { color: var(--text); }
.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 480px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px var(--overlay-shadow);
  z-index: 1000;
}
.notif-dropdown::-webkit-scrollbar { width: 4px; }
.notif-dropdown::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 2px; }
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.notif-mark-read {
  background: none;
  border: none;
  color: var(--link);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.notif-mark-read:hover { text-decoration: underline; }
.notif-list { list-style: none; }
.notif-list li { border-bottom: 1px solid var(--border); }
.notif-list li:last-child { border-bottom: none; }
.notif-item {
  display: flex;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.notif-item:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; }
.notif-item:hover { background: var(--accent-tint-05); }
.notif-item.unread { background: var(--accent-tint-08); }
.notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notif-content {
  flex: 1;
  min-width: 0;
}
.notif-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.notif-text strong { font-weight: 600; }
.notif-text, .notif-body, .notif-time { display: block; }
.notif-body {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-family: var(--sans);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-light); }

/* Account admin */
.admin-toggle {
  background: none; border: 1px solid var(--field-border); color: var(--text-muted);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-family: var(--sans);
  cursor: pointer;
}
.admin-toggle:hover { color: var(--text); }
.admin-toggle[hidden] { display: none; }
.admin-toggle.active { background: var(--admin-bg); color: var(--admin-fg); border-color: var(--admin-border); font-weight: 600; }
.admin-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--admin-bg); color: var(--admin-fg); border-bottom: 1px solid var(--admin-border);
  padding: 10px 24px; font-size: 13px; line-height: 1.5;
}
.admin-banner[hidden] { display: none; }
body.admin-mode main { margin-top: 16px; }
.admin-banner-text { margin: 0; flex: 1 1 320px; }
.admin-banner .btn { border-color: var(--admin-border); color: var(--admin-fg); background: transparent; }
.admin-chip {
  font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 600;
  background: var(--admin-bg); color: var(--admin-fg); border: 1px solid var(--admin-border);
}
.admin-notice {
  background: var(--admin-bg); color: var(--admin-fg); border: 1px solid var(--admin-border);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px; line-height: 1.6;
}
.admin-note { color: var(--admin-fg); background: var(--admin-bg); border-left: 3px solid var(--admin-border); padding: 8px 10px; border-radius: 0 6px 6px 0; }
.admin-confirm { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 12px; font-size: 13px; }
.admin-confirm dt { color: var(--text-muted); }
.admin-confirm dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.card-preview-held { display: flex; align-items: center; justify-content: center; text-align: center; }
.card-preview-note {
  font-size: 12px; line-height: 1.5; padding: 6px 10px; border-radius: 6px;
  background: var(--admin-bg); color: var(--admin-fg); border: 1px solid var(--admin-border);
}
.app-preview-held {
  border: 1px dashed var(--admin-border); background: var(--admin-bg); color: var(--admin-fg);
  border-radius: 8px; padding: 32px 16px; text-align: center; margin-bottom: 16px; font-size: 14px;
}
.app-preview-held p { margin: 0 0 12px; }
@media (max-width: 600px) {
  .admin-banner { padding: 10px 16px; }
}

/* Landing page */
/* landing stays accent-on-purpose in both themes */
.landing-hero {
  background: #4a3aff;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  padding: 80px 24px 72px;
  display: flex;
  justify-content: center;
}

.landing-logo {
  display: block;
  width: 280px;
  height: auto;
  margin: 0 auto 32px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.landing-hero-inner {
  max-width: 520px;
  width: 100%;
}

.landing-drop-card {
  background: #fff;
  border: 3px solid #000;
  border-radius: 16px;
  padding: 56px 32px;
  text-align: center;
  box-shadow: 8px 8px 0 #000;
}

.landing-drop-icon {
  width: 52px;
  height: 52px;
  background: #4a3aff;
  color: #fff;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  margin: 0 auto 20px;
}

.landing-drop-title {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: #000;
  letter-spacing: 0.03em;
}

.landing-drop-hint {
  font-family: var(--mono);
  font-size: 14px;
  color: #999;
  margin-top: 6px;
  letter-spacing: 0.05em;
}

.landing-divider {
  height: 6px;
  background: #4a3aff;
}

.landing-features {
  background: #f5f5f0;
  padding: 64px 24px 80px;
  text-align: center;
}

.landing-features-inner {
  max-width: 880px;
  margin: 0 auto;
}

.landing-heading {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 700;
  color: #000;
  letter-spacing: 0.05em;
  margin-bottom: 40px;
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 56px;
}

.landing-card {
  background: #fff;
  border: 3px solid #000;
  border-radius: 12px;
  padding: 28px 24px;
  text-align: left;
  box-shadow: 5px 5px 0 #000;
}

.landing-card h3 {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: #000;
  margin-bottom: 10px;
}

.landing-card p {
  font-size: 14px;
  color: #555;
  line-height: 1.55;
}

.landing-card em {
  font-style: normal;
  color: #4a3aff;
  font-family: var(--mono);
  font-size: 12px;
}

.landing-login-btn {
  display: inline-block;
  padding: 16px 48px;
  background: #000;
  color: #fff;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 10px;
  border: 3px solid #000;
  text-decoration: none;
  box-shadow: 4px 4px 0 #4a3aff;
  transition: transform 0.1s, box-shadow 0.1s;
}
.landing-login-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #4a3aff;
}

@media (max-width: 640px) {
  .landing-cards {
    grid-template-columns: 1fr;
  }
  .landing-hero { padding: 48px 16px 40px; }
  .landing-drop-card { padding: 36px 20px; }
  .landing-heading { font-size: 24px; }
}

.vis-badge { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--surface); color: var(--text-muted); }
.vis-private { color: var(--warn); }
.vis-public { color: var(--info-accent); }
.page-title { margin: 0 0 16px; font-size: 20px; }

.vis-segmented { display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin: 8px 0; }
.vis-seg { background: transparent; color: var(--text-muted); border: none; padding: 8px 14px; cursor: pointer; font-size: 13px; }
.vis-seg:not(:last-child) { border-right: 1px solid var(--border); }
.vis-seg.active { background: var(--accent); color: var(--on-accent-strong); font-weight: 600; }
.vis-seg-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.comment-edit { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 0 4px; }
.comment-edit:hover { color: var(--text); }
.comment-edited { color: var(--text-muted); font-size: 11px; font-style: italic; }
.comment-edit-actions { display: flex; gap: 8px; margin-top: 6px; }
.comment-edit-input { width: 100%; }

/* --- Spaces --- */
/* Cards are an <article> holding the link and, beside it, any actions. */
.card { cursor: default; }
.card-main { display: block; flex: 1 1 auto; min-width: 0; color: inherit; text-decoration: none; cursor: pointer; border-radius: 8px; }
.card-main:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
}
.space-chip {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--accent-tint-08);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 8px;
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.space-chip:hover { color: var(--text); border-color: var(--accent); }
.card-action {
  font-family: var(--mono);
  font-size: 11px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-muted);
  padding: 2px 8px;
  cursor: pointer;
  margin-left: auto;
}
.card-action:hover { color: var(--text); border-color: var(--accent); }
.space-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; flex-wrap: wrap; }
.space-row-label { color: var(--text-dim); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.space-row-none { color: var(--text-dim); }
.space-row .card-action { margin-left: 0; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head .page-title { margin-bottom: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-note { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; max-width: 64ch; }
.back-link { display: inline-block; color: var(--text-dim); font-size: 12px; font-family: var(--mono); text-decoration: none; margin-bottom: 12px; }
.back-link:hover { color: var(--text); }
.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 24px; }
.space-card {
  display: block;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 10px;
  padding: 16px;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}
.space-card:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--accent); }
.space-card:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.space-card-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.space-card-meta { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.space-unfiled-link { display: inline-block; color: var(--text-muted); font-size: 13px; text-decoration: none; }
.space-unfiled-link:hover { color: var(--text); }
.load-more-row { display: flex; justify-content: center; margin: 24px 0; }
.form-hint { font-size: 12px; color: var(--text-muted); margin: -4px 0 16px; }
select.form-input { appearance: auto; }

/* Dialogs */
.q-dialog {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border-light);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  margin: auto;
}
.q-dialog::backdrop { background: var(--overlay-shadow); }
.q-dialog-form { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.q-dialog-title { font-size: 16px; margin-bottom: 4px; overflow-wrap: anywhere; }
.q-dialog-body .form-input { width: 100%; margin-bottom: 4px; }
.q-dialog-note { font-size: 12px; color: var(--text-muted); }
.q-dialog-error { color: var(--red); font-size: 12px; min-height: 1em; }
.q-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.btn:focus-visible, .btn-small:focus-visible, .card-action:focus-visible, .space-chip:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }


/* --- Search --- */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.search-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.search-filter { display: flex; flex-direction: column; font-size: 11px; font-family: var(--mono); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.search-filter .form-input { text-transform: none; letter-spacing: 0; font-family: var(--sans); margin-top: 4px; padding: 8px 10px; }
.search-filter .form-input:disabled { opacity: 0.5; }
.search-status { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; min-height: 1.5em; }
.search-results { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.search-result { background: var(--surface); border: 2px solid var(--border-light); border-radius: 10px; padding: 14px 16px; }
.search-result-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.search-result-title { color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; overflow-wrap: anywhere; }
.search-result-title:hover { text-decoration: underline; }
.search-result-title:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.search-result-slug { font-size: 12px; }
.search-result-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.search-pager { display: flex; justify-content: space-between; margin: 20px 0; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border-light); border-radius: 4px; padding: 0 4px; }
.search-result .card-meta { flex-wrap: wrap; row-gap: 4px; }
.space-card-id { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--text-dim); }
.profile-apps { display: flex; flex-direction: column; gap: 16px; }

/* --- Stream shell: spaces navigation beside the prototype stream --- */
body.stream-mode main, body.stream-mode header { max-width: 1600px; }
.stream-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.stream { min-width: 0; }
.stream-nav {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 32px);
  min-width: 0;
}
.sn-fixed, .sn-list { list-style: none; }
.sn-fixed { padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.sn-list { overflow-y: auto; min-height: 0; flex: 1 1 auto; margin: 4px -4px 0; padding: 0 4px; }
.sn-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 6px 10px 6px 12px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
}
.sn-link:hover { color: var(--text); background: var(--accent-tint-05); }
.sn-link:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; }
.sn-link[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  background: var(--accent-tint-10);
  border-left-color: var(--accent);
}
.sn-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-sub { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.sn-count { flex: 0 0 auto; font-family: var(--mono); font-size: 11px; color: var(--text-muted); font-weight: 400; }
.sn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.sn-title { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.sn-filter {
  width: 100%;
  margin-top: 6px;
  background: var(--surface);
  border: 1.5px solid var(--field-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
}
.sn-filter:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-sm); }
.sn-msg { font-size: 12px; color: var(--text-muted); padding: 8px 4px; }
.sn-legend { font-size: 11px; color: var(--text-muted); padding: 8px 4px 0; border-top: 1px solid var(--border); margin-top: 4px; }
.sn-inline-btn { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; }
.sn-inline-btn:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.page-head-text { min-width: 0; }
.page-head-text .page-title { overflow-wrap: anywhere; }
.page-title:focus { outline: none; }
.page-title:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 4px; border-radius: 4px; }
.load-more-error { color: var(--red); font-size: 12px; margin-left: 12px; align-self: center; }
.stream-browse .btn-small { color: var(--text); border-color: var(--border-light); background: var(--surface); }
.stream-browse { display: none; align-items: center; gap: 12px; margin-bottom: 16px; min-width: 0; }
.stream-browse-current { color: var(--text-muted); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Drawer (narrow screens): the same nav element moves into this dialog. */
.stream-drawer {
  background: var(--bg);
  color: var(--text);
  border: 0;
  border-right: 2px solid var(--border-light);
  padding: 16px;
  margin: 0;
  width: min(340px, 100vw);
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
}
.stream-drawer::backdrop { background: var(--overlay-shadow); }
.stream-drawer[open] { display: flex; flex-direction: column; }
.stream-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stream-drawer-head h2 { font-size: 16px; }
.stream-drawer .stream-nav { position: static; max-height: none; flex: 1 1 auto; min-height: 0; }

/* Disclosure menus (card actions, space actions) */
.q-menu { position: relative; display: inline-flex; }
.card-foot .q-menu { margin-left: auto; }
.card-menu-btn {
  min-width: 32px;
  min-height: 28px;
  font-size: 16px;
  line-height: 1;
  background: none;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
}
.card-menu-btn:hover, .card-menu-btn[aria-expanded="true"] { color: var(--text); border-color: var(--accent); }
.q-menu-btn:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.q-menu-panel {
  position: absolute;
  right: 0;
  z-index: 10;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
.q-menu-panel[hidden] { display: none; }
.q-menu-up .q-menu-panel { bottom: calc(100% + 4px); }
.q-menu-down .q-menu-panel { top: calc(100% + 6px); }
.q-menu-item {
  text-align: left;
  background: none;
  border: 0;
  border-radius: 4px;
  padding: 8px 10px;
  min-height: 36px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.q-menu-item:hover { background: var(--accent-tint-08); }
.q-menu-item:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; }
.q-menu-danger { color: var(--red); }

.skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; background: var(--surface); color: var(--text); border: 2px solid var(--accent); border-radius: 6px; padding: 8px 12px; text-decoration: none; }
.skip-link:focus { top: 8px; }

@media (max-width: 900px) {
  .stream-layout { grid-template-columns: minmax(0, 1fr); }
  .stream-layout > .stream-nav { display: none; }
  .stream-browse { display: flex; }
  .stream-browse .btn-small, .sn-link, .q-menu-item, .card-menu-btn { min-height: 44px; }
  .card-menu-btn { min-width: 44px; }
}
@media (max-width: 600px) {
  .feed-grid { grid-template-columns: minmax(0, 1fr); }
  .stream-drawer { width: 100vw; border-right: 0; }
  .page-head { flex-direction: column; }
  .page-actions { width: 100%; }
}

/* Later in the cascade than the base notification rule, so it wins. */
@media (max-width: 600px) {
  .notif-dropdown { position: fixed; top: var(--notif-top, 52px); left: 16px; right: 16px; width: auto; max-width: none; max-height: calc(100vh - var(--notif-top, 52px) - 16px); }
}
/* Touch screens get full-size targets at every width. */
@media (pointer: coarse) {
  .sn-link, .q-menu-item, .card-menu-btn, .search-trigger, .upload-cta, .nav-link, .notif-bell, .theme-toggle, .admin-toggle, .logout-btn, .btn-small, .comment-delete { min-height: 44px; }
  .notif-mark-read, .sp-all, .sn-inline-btn, .sp-extra-link { display: inline-flex; align-items: center; min-height: 44px; }
  .card-menu-btn, .notif-bell { min-width: 44px; }
}
.stream-refresh-error { color: var(--red); font-size: 13px; margin: 0 0 16px; }
.inline-error { color: var(--red); font-size: 12px; margin: -12px 0 20px; }
.inline-error[hidden] { display: none; }

/* Shown while the sign-in check can't reach the server; the page stays as it was. */
.auth-retry {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  width: calc(100% - 32px); max-width: calc(var(--max-width) - 32px); margin: 16px auto;
  background: var(--surface); color: var(--text); border: 2px solid var(--red); border-radius: 8px;
  padding: 10px 14px; font-size: 13px; line-height: 1.5;
}
.auth-retry span { flex: 1 1 220px; }
.empty-state a { color: var(--link); }
.empty-state .page-title { font-family: var(--sans); color: var(--text); }
.empty-state p { margin-top: 8px; }
/* The fixed parts of the address give way to the part being typed. */
@media (max-width: 420px) {
  .slug-prefix { display: none; }
  .slug-input { min-width: 0; }
}

/* Phones. iOS Safari zooms the whole page when a focused field's text is
   smaller than 16px, so every text field is 16px on touch and narrow screens. */
@media (pointer: coarse), (max-width: 600px) {
  input, select, textarea,
  .form-input, .comment-input, .sharing-link-input, .slug-input, .paste-area, .sn-filter, .sp-input { font-size: 16px; }
}
/* Comment controls are small text links with a mouse; a finger needs 44px. */
@media (pointer: coarse) {
  .comment-header { flex-wrap: wrap; gap: 0 8px; }
  .comment-edit, .comment-delete, .comment-reply-btn, .comment-resolve-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; padding: 0 8px;
  }
  /* The larger targets reach into the card's own padding, so a comment
     doesn't grow much taller than its text. */
  .comment-edit, .comment-delete { margin-top: -10px; margin-bottom: -6px; }
  .comment-edit { margin-left: auto; font-size: 16px; }
  .comment-edit + .comment-delete { margin-left: 0; }
  .comment-delete { font-size: 18px; margin-right: -8px; }
  .comment-reply-btn, .comment-resolve-btn { font-size: 12px; margin-bottom: -10px; }
  /* Keep "Reply" lined up with the comment text above it. */
  .comment-reply-btn { justify-content: flex-start; padding-left: 0; }
  .vis-seg, .reaction-btn, .file-remove, .tab-btn { min-height: 44px; }
  .file-remove { min-width: 44px; }
  .btn:not(.btn-small) { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
}

.notif-bell[hidden] { display: none; }

.comment-status { font-size: 12px; color: var(--text-muted); margin: 2px 0 4px; }
.comment-status::before { content: "✓ "; }
