/* Staff workspace layout and gallery-matched light/dark palettes. */
html[data-theme] {
  color-scheme: light;
  --admin-ink: #29241e;
  --admin-muted: #756f66;
  --admin-line: #e9e2d8;
  --admin-paper: #fffdfa;
  --admin-wash: #f8f3ea;
}

html[data-theme] body {
  min-height: 100dvh;
  padding: 0 !important;
  color: var(--admin-ink);
  background: linear-gradient(155deg, #fffaf0, #f9f5ee 55%, #f4eee3);
}

html[data-theme] body::selection { background: #f5dfb6; }

html[data-theme] main {
  display: grid;
  grid-template-columns: clamp(11.5rem, 16vw, 14.25rem) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  column-gap: clamp(1rem, 2vw, 2rem);
  width: min(100%, 112rem);
  max-width: none;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(0.75rem, 1.25vw, 1.5rem);
}

html[data-theme] main > header {
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  min-width: 0;
  margin: 0 0 1rem;
  padding: 0.35rem 0.15rem 0.8rem;
  border-bottom: 1px solid var(--admin-line);
}

html[data-theme] header a[href="/"] { display: none; }
html[data-theme] header h1 {
  margin-top: 0;
  color: var(--admin-ink);
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.18;
}
html[data-theme] header #subtitle {
  margin-top: 0.35rem;
  color: var(--admin-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

html[data-theme] .admin-tools { gap: 0.55rem; }
html[data-theme] .admin-tools > .btn-secondary,
html[data-theme] .admin-tools > .ai-kill-btn,
html[data-theme] .bell-btn {
  min-height: 2.45rem;
  border: 1px solid #e5ded2;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.84);
  color: #39332b;
  box-shadow: 0 2px 8px rgba(67, 48, 20, 0.035);
}
html[data-theme] .admin-tools > .ai-kill-btn {
  padding: 0.42rem 0.8rem;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
}
html[data-theme] .admin-tools > .ai-kill-btn.on { color: #9c4139; }
html[data-theme] .admin-tools > .ai-kill-btn.off { color: #21735c; }
html[data-theme] .admin-tools > .ai-kill-btn:hover:not(:disabled),
html[data-theme] .admin-tools > .btn-secondary:hover,
html[data-theme] .bell-btn:hover {
  color: var(--admin-ink);
  background: #fff;
  border-color: #cbbda9;
  box-shadow: 0 4px 12px rgba(67, 48, 20, 0.06);
}
html[data-theme] .bell-btn { width: 2.45rem; height: 2.45rem; }
html[data-theme] .bell-panel {
  color: var(--admin-ink);
  background: #fffdfa;
  border-color: var(--admin-line);
  box-shadow: 0 18px 44px rgba(50, 35, 15, 0.15);
}

.admin-identity {
  display: flex;
  align-items: center;
  gap: 0.58rem;
  min-width: 0;
  margin-left: 0.2rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--admin-line);
}
.admin-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background: #4b4740;
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
}
.admin-identity-copy { display: grid; min-width: 0; line-height: 1.25; }
.admin-identity-copy strong { font-size: 0.75rem; font-weight: 650; }
.admin-identity-copy small {
  max-width: 10.5rem;
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] #admin-tabs {
  position: sticky;
  top: clamp(0.75rem, 1.25vw, 1.5rem);
  grid-column: 1;
  grid-row: 1 / 4;
  display: flex;
  flex-direction: column;
  align-self: start;
  align-items: stretch;
  gap: 0.2rem;
  width: 100%;
  max-height: calc(100dvh - 2rem);
  margin: 0;
  padding: 0.65rem;
  overflow: auto;
  border: 1px solid #ede5d9;
  border-radius: 1rem;
  background: rgba(255, 253, 249, 0.92) !important;
  box-shadow: 0 8px 30px rgba(74, 52, 24, 0.055);
  scrollbar-width: thin;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 3.35rem;
  margin: 0 0 0.3rem;
  padding: 0.35rem 0.48rem 0.75rem;
  border-bottom: 1px solid var(--admin-line);
  color: var(--admin-ink);
  text-decoration: none;
}
.admin-brand-mark { font-size: 1.75rem; line-height: 1; }
.admin-brand strong { display: block; font-size: 0.85rem; letter-spacing: -0.02em; white-space: nowrap; }
.admin-brand small { display: block; margin-top: 0.13rem; color: #8a8176; font-size: 0.66rem; white-space: nowrap; }
html[data-theme] #admin-tabs .tab-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: transparent;
  box-shadow: none;
  color: #5e564e;
  font-size: 0.76rem;
  font-weight: 530;
  text-align: left;
  white-space: nowrap;
}
html[data-theme] #admin-tabs .tab-btn:hover,
html[data-theme] #admin-tabs .tab-btn:focus-visible { background: #f4eee6; color: #26211d; }
html[data-theme] #admin-tabs .tab-btn.active {
  background: #eee9e2;
  color: #25201c;
  font-weight: 650;
}
.admin-nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.35rem;
  color: #73685c;
  font-family: Arial, sans-serif;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
}
.admin-nav-foot {
  display: block;
  margin-top: 1.1rem;
  padding: 0.75rem 0.5rem 0.25rem;
  border-top: 1px solid var(--admin-line);
  color: #9b9186;
  font-size: 0.65rem;
}

html[data-theme] #pipeline-banner { grid-column: 2; grid-row: 2; }
html[data-theme] main > [id^="view-"] { grid-column: 2; grid-row: 3; min-width: 0; }
html[data-theme] #view-dashboard { container-type: inline-size; }
html[data-theme] #view-dashboard h2 { font-size: 0.94rem; }
html[data-theme] .stat-card,
html[data-theme] .chart-card,
html[data-theme] .admin-overview-card {
  background: var(--admin-paper);
  border: 1px solid var(--admin-line);
  border-radius: 0.85rem;
  box-shadow: 0 3px 14px rgba(73, 52, 24, 0.035);
}
html[data-theme] .stat-card { position: relative; min-width: 0; padding: 0.95rem 1.1rem; }
html[data-theme] .dash-primary .stat-card { min-height: 6.8rem; padding-left: 4.1rem; }
html[data-theme] .dash-primary .stat-card::before {
  position: absolute;
  top: 1.15rem;
  left: 1rem;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 1px solid #e8e4df;
  border-radius: 0.68rem;
  background: linear-gradient(145deg, #fff, #f4f3f1);
  color: #292621;
  font-size: 1.3rem;
}
.dash-primary .stat-card:nth-child(1)::before { content: "◉"; }
.dash-primary .stat-card:nth-child(2)::before { content: "♧"; }
.dash-primary .stat-card:nth-child(3)::before { content: "↺"; }
.dash-primary .stat-card:nth-child(4)::before { content: "✧"; }
html[data-theme] .col-header {
  color: #70685f;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: none;
}
html[data-theme] .stat-card [id^="m-"],
html[data-theme] .stat-card [id^="stat-"],
html[data-theme] .stat-card [id^="o-"] {
  color: #29241e;
  font-size: clamp(1.3rem, 1.65vw, 1.75rem);
  line-height: 1.1;
  -webkit-text-fill-color: currentColor;
}
html[data-theme] .stat-card [id$="-sub"] {
  color: #7e766c;
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1.35;
  -webkit-text-fill-color: currentColor;
}
html[data-theme] .stat-delta { margin-top: 0.28rem; color: #7e766c; font-size: 0.68rem; }
html[data-theme] .dash-secondary .stat-card { padding: 0.78rem 1rem; }
html[data-theme] .dash-secondary .stat-card [id^="m-"]:not([id$="-sub"]) { font-size: 1.32rem; }
html[data-theme] .chart-card { padding: 1.1rem 1.2rem; }
html[data-theme] .chart-title { color: var(--admin-ink); font-size: 0.82rem; }
html[data-theme] .chart-sub { color: #80786e; font-size: 0.69rem; }
html[data-theme] .list-row { border-color: var(--admin-line); color: var(--admin-ink); }
html[data-theme] .list-bar { background: #efe9df; }

html[data-theme] .range-btn,
html[data-theme] .archive-btn {
  border: 1px solid #e6ded4;
  border-radius: 0.6rem;
  background: #fffdfa;
  color: #574e45;
  box-shadow: 0 2px 7px rgba(70, 48, 19, 0.025);
}
html[data-theme] .range-btn:hover,
html[data-theme] .archive-btn:hover { background: #f5eee4; border-color: #d3c3ae; color: #2b251e; }
html[data-theme] .range-btn.active {
  background: #302b25;
  border-color: #302b25;
  color: #fffaf3;
}
html[data-theme] .tab-badge,
html[data-theme] #admin-tabs .tab-btn.active .tab-badge,
.admin-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.22rem;
  height: 1.22rem;
  margin-left: auto;
  padding: 0 0.25rem;
  border-radius: 99px;
  background: #d95658;
  color: white;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
}
.admin-count { margin-left: 0.25rem; vertical-align: middle; }
.admin-count.hidden { display: none; }
.tab-badge.hidden { display: none !important; }

.admin-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.admin-overview-card { min-width: 0; padding: 0.92rem 1rem; }
.admin-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.42rem; }
.admin-card-heading h3 { margin: 0; color: var(--admin-ink); font-size: 0.82rem; font-weight: 650; }
.admin-card-heading > button {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: #746b61;
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}
.admin-card-heading > button:hover { color: #211b16; text-decoration: underline; }
.admin-preview-list { min-height: 7.5rem; }
.admin-preview-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0.38rem 0;
  border-bottom: 1px solid #eee8e1;
}
.admin-preview-row:last-child { border-bottom: 0; }
.admin-preview-thumb { flex: 0 0 auto; width: 2.1rem; height: 2.1rem; border-radius: 0.42rem; object-fit: cover; background: #f0e8dc; }
.admin-preview-copy { display: grid; min-width: 0; gap: 0.1rem; }
.admin-preview-copy strong { overflow: hidden; color: #2f2922; font-size: 0.69rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.admin-preview-copy small { overflow: hidden; color: #81796e; font-size: 0.64rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-preview-empty { margin: 1.3rem 0; color: #81796e; font-size: 0.72rem; line-height: 1.4; }
.admin-preview-rating { flex: 0 0 auto; color: #be8733; font-size: 0.68rem; letter-spacing: 0.03em; }
.admin-quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; margin-top: 0.65rem; }
.admin-quick-grid button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  min-height: 2.55rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid #e9e2d9;
  border-radius: 0.62rem;
  background: #fff;
  color: #37312a;
  font: inherit;
  font-size: 0.69rem;
  text-align: left;
  cursor: pointer;
}
.admin-quick-grid button:hover { background: #f6efe6; border-color: #d9c8b5; }

html[data-theme] .glass-panel,
html[data-theme] .msg-card {
  border: 1px solid var(--admin-line);
  border-radius: 0.85rem;
  background: var(--admin-paper);
  box-shadow: 0 3px 14px rgba(73, 52, 24, 0.035);
}
html[data-theme] .msg-card.unread { border-color: #deb96f; background: #fff9ea; }
html[data-theme] .msg-dot { background: #b8862c; }
html[data-theme] .offer-thumb { border-color: var(--admin-line); }
html[data-theme] .offer-thumb.placeholder { color: #948a7e; background: #f4ede3; }
html[data-theme] .status-complete,
html[data-theme] .status-paid { color: #21735c; background: #edf7f1; border-color: #cce8d8; }
html[data-theme] .status-pending { color: #9b6821; background: #fff8e9; border-color: #efd8aa; }
html[data-theme] .dup-no { color: #766e64; background: #f5f1eb; border-color: #e8e0d6; }
html[data-theme] .status-processing,
html[data-theme] .status-delivered { color: #366790; background: #edf5fc; border-color: #d4e4f3; }
html[data-theme] .status-failed,
html[data-theme] .dup-yes { color: #a34d4c; background: #fff1ef; border-color: #f1d2cf; }
html[data-theme] #graphic_sample { color: #39322a; background: #fff; border-color: #e4ddd3; }
html[data-theme] #graphic_sample::file-selector-button { color: #4a3723; background: #f5e9d2; }
html[data-theme] .field input,
html[data-theme] .field select,
html[data-theme] .field textarea { border-color: #e1d8cb; border-radius: 0.62rem; background: #fff; color: #2d2721; }
html[data-theme] .field label { color: #594f45; }
html[data-theme] .text-rose-400 { color: #a43f45 !important; }
html[data-theme] .text-amber-300 { color: #a36d20 !important; }
html[data-theme] .text-emerald-300 { color: #21735c !important; }
html[data-theme] .text-sky-300 { color: #356b93 !important; }
html[data-theme] .text-rose-300 { color: #a34d4c !important; }
html[data-theme] .border-white\/5,
html[data-theme] .border-white\/10,
html[data-theme] .divide-white\/5 > :not([hidden]) ~ :not([hidden]) { border-color: var(--admin-line); }
html[data-theme] :focus-visible { outline: 2px solid #a9782d; outline-offset: 2px; }

@media (max-width: 1080px) {
  .admin-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-quick-card { grid-column: 1 / -1; }
}

@media (min-width: 850px) {
  html[data-theme] .dash-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  html[data-theme] main { display: block; padding: 0.7rem; }
  html[data-theme] #admin-tabs {
    position: sticky;
    top: 0;
    z-index: 15;
    flex-direction: row;
    align-items: center;
    gap: 0.22rem;
    max-height: none;
    margin: 0 0 0.7rem;
    padding: 0.35rem;
    overflow-x: auto;
    border-radius: 0.75rem;
    background: rgba(255, 253, 249, 0.97) !important;
  }
  html[data-theme] #admin-tabs .tab-btn { width: auto; flex: 0 0 auto; min-height: 2.15rem; padding: 0.42rem 0.65rem; }
  .admin-brand,
  .admin-nav-foot { display: none; }
  .admin-nav-icon { width: 1rem; font-size: 1rem; }
  html[data-theme] main > header { margin-bottom: 0.75rem; padding: 0.25rem 0.1rem 0.75rem; }
  html[data-theme] .admin-tools { width: 100%; }
  .admin-identity { margin-left: auto; }
  .admin-overview-grid { grid-template-columns: 1fr; }
  .admin-quick-card { grid-column: auto; }
}

@media (max-width: 440px) {
  html[data-theme] .dash-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-theme] .dash-primary .stat-card { min-height: 6.3rem; padding: 0.8rem; }
  html[data-theme] .dash-primary .stat-card::before { position: static; width: 1.9rem; height: 1.9rem; margin-bottom: 0.45rem; font-size: 1rem; }
  html[data-theme] .dash-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-theme] .admin-tools > .btn-secondary { padding: 0.45rem 0.65rem !important; }
  .admin-identity-copy { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] * { scroll-behavior: auto !important; }
}

/* Request context is full width so notes and source imagery stay usable. */
.request-kind {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  color: var(--admin-muted);
  font-size: 0.65rem;
  font-weight: 600;
}
.code-optional { color: var(--admin-muted); font-size: 0.82em; }
.request-context { display: grid; gap: 0.75rem; min-width: 0; }
.request-note {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.65rem;
  background: var(--admin-wash);
}
.request-note strong { display: block; margin-bottom: 0.3rem; color: var(--admin-muted); font-size: 0.68rem; }
.request-note p { margin: 0; color: var(--admin-ink); font-size: 0.78rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-photos { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.request-photo { display: grid; align-content: start; gap: 0.35rem; width: 7.5rem; }
.request-photo > a:first-child { display: block; overflow: hidden; border: 1px solid var(--admin-line); border-radius: 0.65rem; background: var(--admin-wash); }
.request-photo img { display: block; width: 100%; height: 6.6rem; object-fit: contain; }
.request-photo .archive-btn { margin: 0; text-align: center; }

/* Permission-gated UI. Tailwind display utilities (and the tab rule above) outrank [hidden]. */
#admin-tabs .tab-btn[hidden],
html[data-theme] #admin-tabs .tab-btn[hidden],
[data-perm][hidden],
[data-owner-only][hidden],
[data-owner-panel][hidden],
.admin-role[hidden],
.admin-dialog [hidden] { display: none !important; }

/* Signed-in identity and small avatars (photo, or the first letter of the name). */
.admin-avatar { overflow: hidden; }
.admin-avatar img,
.mini-avatar img,
.owner-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.admin-identity-copy strong { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.admin-identity-copy strong > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-role {
  display: inline-block;
  flex: 0 0 auto;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: #f5e9d2;
  color: #7a5418;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mini-avatar,
.owner-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: #4b4740;
  color: #fff;
  font-weight: 650;
  line-height: 1;
}
.mini-avatar { width: 1.35rem; height: 1.35rem; font-size: 0.6rem; }
.owner-avatar { width: 2.5rem; height: 2.5rem; font-size: 0.9rem; }

/* Request queue: one grid shared by the header and every row. */
@media (min-width: 640px) {
  .req-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr) minmax(0, 1fr) minmax(0, 0.62fr) minmax(0, 1.2fr);
  }
}
.request-row { position: relative; transition: background 0.2s ease; }
.request-row.photo-target {
  background: linear-gradient(90deg, rgba(187, 132, 52, 0.09), transparent 70%);
  box-shadow: inset 3px 0 0 #bb8434;
}
.request-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.45rem; }
.request-tags:empty { display: none; }
.request-tags .request-kind { margin-top: 0; }
.claim-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  max-width: 100%;
  padding: 0.16rem 0.62rem 0.16rem 0.18rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
}
.claim-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claim-chip .mini-avatar { width: 1.2rem; height: 1.2rem; font-size: 0.55rem; }
.claim-chip.mine { color: #1f6b55; background: #edf7f1; border-color: #cce8d8; }
.claim-chip.mine .mini-avatar { background: #21735c; }
.claim-chip.other { color: #2f5f86; background: #edf5fc; border-color: #d4e4f3; }
.claim-chip.other .mini-avatar { background: #366790; }
.photo-for {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.52rem;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  color: var(--admin-muted);
  font-size: 0.65rem;
  font-weight: 600;
}
.photo-for.is-target { color: #8a5c14; background: #fff8e9; border-color: #efd8aa; }
.completed-by { margin: 0.4rem 0 0; color: var(--admin-muted); font-size: 0.68rem; }
.request-actions { align-items: center; }
.status-pending.is-static,
.status-failed.is-static { cursor: default; }
html[data-theme] .archive-btn.take-btn { background: #302b25; border-color: #302b25; color: #fffaf3; }
html[data-theme] .archive-btn.take-btn:hover { background: #1c1814; border-color: #1c1814; color: #fff; }
html[data-theme] .archive-btn.danger-btn { color: #a34d4c; border-color: #f1d2cf; }
html[data-theme] .archive-btn.danger-btn:hover { color: #8c3b3a; background: #fff1ef; border-color: #e5b3ae; }
html[data-theme] .archive-btn:disabled:hover { background: #fffdfa; border-color: #e6ded4; color: #574e45; }
.reassign-select {
  max-width: 100%;
  min-height: 1.72rem;
  padding: 0.2rem 1.65rem 0.2rem 0.62rem;
  border: 1px solid #e6ded4;
  border-radius: 0.6rem;
  background: #fffdfa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23756f66' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.55rem center / 0.62rem;
  color: #574e45;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  appearance: none;
  cursor: pointer;
}
.reassign-select:hover { border-color: #d3c3ae; }
.reassign-select:disabled { opacity: 0.55; cursor: wait; }

/* "Graphics uploaded by me": a checkbox drawn as a pill. */
.pill-check { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.pill-check input,
.photo-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pill-check span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.45rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid #e1d8cb;
  border-radius: 999px;
  background: #fff;
  color: #574e45;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.pill-check span::before {
  content: "";
  flex: 0 0 auto;
  width: 0.85rem;
  height: 0.85rem;
  border: 1.5px solid #b9ab98;
  border-radius: 50%;
  transition: inherit;
}
.pill-check:hover span { border-color: #cbbda9; }
.pill-check input:checked + span { background: #302b25; border-color: #302b25; color: #fffaf3; }
.pill-check input:checked + span::before { border-color: #f1cb82; background: #f1cb82; box-shadow: inset 0 0 0 2px #302b25; }
.pill-check input:focus-visible + span,
.photo-switch input:focus-visible + span { outline: 2px solid #a9782d; outline-offset: 2px; }

/* Graphic uploads: required-photo checkbox, list toggle and badge. */
.photo-toggle-wrap { display: flex; align-items: flex-end; }
.photo-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.62rem 0.8rem;
  border: 1px solid #e1d8cb;
  border-radius: 0.62rem;
  background: #fff;
  cursor: pointer;
}
.photo-toggle input { flex: 0 0 auto; width: 1rem; height: 1rem; margin: 0.12rem 0 0; accent-color: #a36d20; cursor: pointer; }
.photo-toggle strong { display: block; color: var(--admin-ink); font-size: 0.8rem; font-weight: 650; }
.photo-toggle small { display: block; margin-top: 0.1rem; color: var(--admin-muted); font-size: 0.7rem; line-height: 1.35; }
.photo-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.photo-switch span,
.graphic-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.26rem 0.7rem 0.26rem 0.34rem;
  border: 1px solid #e6ded4;
  border-radius: 999px;
  background: #fffdfa;
  color: #766e64;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.photo-switch span::before {
  content: "";
  flex: 0 0 auto;
  width: 1.7rem;
  height: 0.95rem;
  border-radius: 999px;
  background: #ddd4c8 radial-gradient(circle at 0.48rem 50%, #fff 0.32rem, transparent 0.35rem);
  transition: background 0.2s ease;
}
.photo-switch input:checked + span,
.graphic-badge { color: #8a5c14; background: #fff8e9; border-color: #efd8aa; }
.graphic-badge { padding-left: 0.7rem; }
.photo-switch input:checked + span::before { background: #bb8434 radial-gradient(circle at 1.22rem 50%, #fff 0.32rem, transparent 0.35rem); }
.photo-switch input:disabled + span { opacity: 0.6; cursor: wait; }

/* Graphics list: uploads whose image is missing, and the Replace image action. */
html[data-theme] #graphics-list { overflow: hidden; }
/* The info column absorbs spare width so actions stay right until the row is narrow. */
.graphic-row > :first-child { flex: 1 1 15rem; }
.graphic-row.is-missing {
  background: linear-gradient(90deg, rgba(196, 92, 84, 0.07), transparent 65%);
  box-shadow: inset 3px 0 0 #dc9f99;
}
.graphic-row[aria-busy="true"] { cursor: progress; }
html[data-theme] .offer-thumb.placeholder.is-missing,
.admin-preview-thumb.is-missing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #e2b2ac;
  background: #fff4f1;
  color: #b15c57;
}
.graphic-missing { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.55rem; margin: 0.4rem 0 0; }
.graphic-missing-note { color: var(--admin-muted); font-size: 0.72rem; line-height: 1.35; }
.graphic-badge.is-missing { gap: 0.38rem; padding-left: 0.55rem; color: #a34d4c; background: #fff1ef; border-color: #f1d2cf; }
.graphic-badge.is-missing::before { content: ""; flex: 0 0 auto; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor; }
.admin-preview-copy small.is-missing { color: #a34d4c; }
.graphic-action {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.8rem;
  border: 1px solid #e1d8cb;
  border-radius: 999px;
  background: #fffdfa;
  color: #574e45;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.graphic-action:hover { background: #f5eee4; border-color: #d3c3ae; color: #2b251e; }
.graphic-action.is-primary { background: #302b25; border-color: #302b25; color: #fffaf3; }
.graphic-action.is-primary:hover { background: #1c1814; border-color: #1c1814; color: #fff; }
.graphic-action:disabled,
.graphic-action:disabled:hover { opacity: 0.65; cursor: progress; }
.graphic-action:focus-visible { outline: 2px solid #a9782d; outline-offset: 2px; }
/* The graphics error line doubles as upload progress / success status. */
html[data-theme] #graphics-error.is-status { color: var(--admin-muted) !important; }
html[data-theme] #graphics-error.is-success { color: #2f7a57 !important; }
html[data-theme] #graphics-error.is-status::before {
  content: "";
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.5rem;
  vertical-align: -0.12rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: graphics-status-spin 0.8s linear infinite;
}
html[data-theme] #graphics-error.is-success::before {
  content: "✓";
  width: auto;
  height: auto;
  margin-right: 0.4rem;
  vertical-align: baseline;
  border: 0;
  animation: none;
}
@keyframes graphics-status-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  html[data-theme] #graphics-error.is-status::before { animation: none; }
}

/* Take-ticket dialog. */
.admin-dialog {
  width: min(26rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--admin-line);
  border-radius: 1rem;
  background: var(--admin-paper);
  color: var(--admin-ink);
  box-shadow: 0 30px 80px rgba(50, 35, 15, 0.22);
}
.admin-dialog::backdrop { background: rgba(41, 36, 30, 0.38); backdrop-filter: blur(2px); }
.admin-dialog[open] { animation: admin-dialog-in 0.22s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes admin-dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.admin-dialog-body { padding: 1.2rem 1.3rem 1.1rem; }
.admin-dialog-kicker {
  margin: 0 0 0.35rem;
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-dialog h2 { margin: 0; color: var(--admin-ink); font-size: 1.05rem; font-weight: 680; letter-spacing: -0.02em; }
#claim-dialog-text { margin: 0.45rem 0 0; color: var(--admin-muted); font-size: 0.82rem; line-height: 1.5; }
.admin-dialog-error {
  margin: 0.8rem 0 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid #f1d2cf;
  border-radius: 0.6rem;
  background: #fff1ef;
  color: #a34d4c;
  font-size: 0.78rem;
  line-height: 1.4;
}
.admin-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1.1rem; }
.admin-dialog-actions .btn-primary,
.admin-dialog-actions .btn-secondary { padding: 0.55rem 1.15rem; font-size: 0.82rem; }

/* Graphic edit dialogs: Facebook group code, and details (label + Artwork ID). */
.admin-dialog.graphic-edit-dialog { width: min(28rem, calc(100vw - 1.5rem)); }
.graphic-edit-head { display: flex; align-items: center; gap: 0.75rem; }
.graphic-edit-thumb { display: inline-flex; flex: 0 0 auto; }
.graphic-edit-thumb .offer-thumb { width: 3rem; height: 3rem; }
.graphic-edit-head-copy { flex: 1 1 auto; min-width: 0; }
.graphic-edit-head-copy .admin-dialog-kicker { margin-bottom: 0.2rem; }
.graphic-edit-head-copy h2 { overflow-wrap: anywhere; }
.graphic-edit-dialog .field { margin-top: 0.95rem; }
.graphic-edit-dialog .field label { margin-bottom: 0.35rem; }
.graphic-edit-dialog .field input,
.graphic-edit-dialog .field select { padding: 0.6rem 0.9rem; font-size: 0.875rem; }
.graphic-edit-dialog .field input:disabled,
.graphic-edit-dialog .field select:disabled { opacity: 0.65; cursor: progress; }
.graphic-edit-hint { margin: 0.35rem 0 0; color: var(--admin-muted); font-size: 0.72rem; line-height: 1.4; }
.graphic-edit-note {
  margin: 0.95rem 0 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.6rem;
  background: var(--admin-wash);
  color: var(--admin-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}
.graphic-edit-note.is-tip { margin-top: 0.6rem; color: #8a5c14; background: #fff8e9; border-color: #efd8aa; }
.graphic-edit-shortcut {
  display: inline-flex;
  align-items: center;
  margin: 0.55rem 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: #356b93;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.graphic-edit-shortcut:disabled { opacity: 0.6; cursor: progress; }
/* Remove sits apart from Save/Cancel, on the left. */
.graphic-edit-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: auto;
  padding: 0.55rem 0.95rem;
  border: 1px solid #f1d2cf;
  border-radius: 999px;
  background: none;
  color: #a34d4c;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.graphic-edit-remove:hover { color: #8c3b3a; background: #fff1ef; border-color: #e5b3ae; }
.graphic-edit-remove:disabled,
.graphic-edit-remove:disabled:hover { opacity: 0.6; background: none; cursor: progress; }
.graphic-edit-dialog .admin-dialog-actions .btn-primary:disabled,
.graphic-edit-dialog .admin-dialog-actions .btn-secondary:disabled { opacity: 0.55; cursor: progress; }

/* Graphics list: Facebook line actions (Copy group link, Edit code / Add Facebook code). */
.graphic-fb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.95rem; margin-top: 0.25rem; }
.graphic-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.graphic-link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 640px) {
  .graphic-edit-dialog .field input,
  .graphic-edit-dialog .field select { min-height: 2.75rem; font-size: 1rem; }
  .graphic-edit-dialog .admin-dialog-actions .btn-primary,
  .graphic-edit-dialog .admin-dialog-actions .btn-secondary,
  .graphic-edit-remove,
  .graphic-edit-shortcut,
  .graphic-link-btn { min-height: 2.75rem; }
  .graphic-edit-dialog .admin-dialog-actions .btn-primary,
  .graphic-edit-dialog .admin-dialog-actions .btn-secondary { flex: 1 1 auto; }
}

/* Owner view. */
.owner-subtabs { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.owner-panel-head { margin-bottom: 1rem; }
.owner-panel-head h2 { margin: 0; color: var(--admin-ink); font-size: 0.98rem; font-weight: 650; letter-spacing: -0.015em; }
.owner-panel-head p { max-width: 46rem; margin: 0.3rem 0 0; color: var(--admin-muted); font-size: 0.76rem; line-height: 1.5; }
.owner-subhead { margin: 1.7rem 0 0.7rem; color: var(--admin-ink); font-size: 0.86rem; font-weight: 650; }
.owner-subhead-row { margin: 1.7rem 0 0.9rem; }
.owner-subhead-row .owner-subhead { margin: 0; }
.owner-empty { margin: 0.9rem 0; color: var(--admin-muted); font-size: 0.8rem; }
.owner-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.55rem 0.75rem;
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
}
.owner-hint,
.owner-msg { grid-column: 1 / -1; margin: 0; font-size: 0.7rem; line-height: 1.45; }
.owner-hint { color: var(--admin-muted); }
.owner-msg { color: #21735c; font-size: 0.78rem; font-weight: 600; }
.owner-msg.is-error { color: #a43f45; }

.owner-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 0.8rem; }
.owner-admin-card {
  min-width: 0;
  padding: 0.95rem 1rem 0.8rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.85rem;
  background: var(--admin-paper);
  box-shadow: 0 3px 14px rgba(73, 52, 24, 0.035);
}
.owner-admin-card.is-removed { background: var(--admin-wash); box-shadow: none; }
.owner-admin-card.is-removed .owner-avatar { opacity: 0.7; filter: grayscale(1); }
.owner-admin-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem 0.7rem; }
.owner-admin-id { flex: 1 1 8rem; min-width: 0; }
.owner-admin-id p { display: flex; align-items: center; gap: 0.4rem; min-width: 0; margin: 0; color: var(--admin-ink); font-size: 0.84rem; }
.owner-admin-id strong { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.owner-admin-id small { display: block; overflow: hidden; color: var(--admin-muted); font-size: 0.7rem; text-overflow: ellipsis; white-space: nowrap; }
.owner-status { padding: 0.14rem 0.55rem; border: 1px solid; border-radius: 999px; font-size: 0.66rem; font-weight: 650; }
.owner-status.is-active { color: #21735c; background: #edf7f1; border-color: #cce8d8; }
.owner-status.is-removed { color: #766e64; background: #f5f1eb; border-color: #e8e0d6; }
.owner-metrics { margin-top: 0.3rem; }
.owner-metrics-label { margin: 0.6rem 0 0.3rem; color: var(--admin-muted); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
/* Four equal columns in both rows so Graphics and Tickets line up. */
.owner-metrics dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; margin: 0; }
.owner-metrics dl div { min-width: 0; padding: 0.45rem 0.5rem; border-radius: 0.55rem; background: var(--admin-wash); }
.owner-admin-card.is-removed .owner-metrics dl div { background: var(--admin-paper); }
.owner-metrics dt { overflow: hidden; color: var(--admin-muted); font-size: 0.62rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.owner-metrics dd { margin: 0.1rem 0 0; color: var(--admin-ink); font-size: 1rem; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.owner-admin-foot { margin: 0.7rem 0 0; color: var(--admin-muted); font-size: 0.68rem; }
/* A graphic's private Facebook code line in the graphics list. */
.graphic-code-line { color: #8a5a12; font-weight: 600; }
/* An active admin with nothing ticked can sign in but do nothing yet. */
.owner-admin-note { margin: 0.65rem 0 0; padding: 0.45rem 0.65rem; border: 1px solid #efdcb5; border-radius: 0.6rem; color: #85581a; background: #fbf4e4; font-size: 0.72rem; font-weight: 600; }
.owner-admin-note button { padding: 0; border: 0; color: inherit; background: none; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.owner-admin-note button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 3px; }

/* Access matrix: scrolls sideways on narrow screens with the names pinned. */
.owner-matrix-wrap { overflow-x: auto; padding: 0; -webkit-overflow-scrolling: touch; }
.owner-matrix { width: 100%; min-width: 50rem; border-collapse: separate; border-spacing: 0; font-size: 0.74rem; }
.owner-matrix th,
.owner-matrix td { padding: 0.55rem 0.45rem; border-bottom: 1px solid var(--admin-line); text-align: center; vertical-align: middle; }
.owner-matrix tbody tr:last-child > * { border-bottom: 0; }
.owner-matrix thead th { color: var(--admin-muted); font-size: 0.64rem; font-weight: 650; line-height: 1.25; vertical-align: bottom; }
.owner-matrix thead th span { display: block; max-width: 5.6rem; margin: 0 auto; }
.owner-matrix .owner-matrix-name {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 10.5rem;
  max-width: 13rem;
  padding-left: 0.9rem;
  background: var(--admin-paper);
  box-shadow: 1px 0 0 var(--admin-line);
  text-align: left;
}
.owner-matrix thead .owner-matrix-name { z-index: 2; }
.owner-matrix tr.is-owner > * { background: linear-gradient(var(--admin-wash), var(--admin-wash)), var(--admin-paper); }
.owner-matrix-person { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.owner-matrix-person > span:last-child { display: grid; min-width: 0; }
.owner-matrix-person .mini-avatar { width: 1.75rem; height: 1.75rem; font-size: 0.72rem; }
.owner-matrix-person strong { overflow: hidden; color: var(--admin-ink); font-size: 0.78rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.owner-matrix-person small { min-height: 0.9rem; color: var(--admin-muted); font-size: 0.64rem; font-weight: 500; }
.owner-matrix-person small.is-error { color: #a43f45; }
.perm-cell { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 0.5rem; cursor: pointer; }
.perm-cell:hover { background: var(--admin-wash); }
.perm-cell input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: #302b25; cursor: pointer; }
.perm-cell input:disabled { opacity: 0.7; cursor: not-allowed; }

/* Tickets in progress and the activity feed. */
.owner-ticket-list { display: grid; gap: 0.65rem; }
.owner-ticket {
  display: grid;
  grid-template-columns: minmax(9rem, 0.8fr) minmax(0, 1.4fr) minmax(9rem, 11rem);
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
}
.owner-ticket-who { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.owner-ticket-who strong { display: block; overflow: hidden; color: var(--admin-ink); font-size: 0.8rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.owner-ticket-who small { display: block; color: var(--admin-muted); font-size: 0.68rem; }
.owner-ticket-what { min-width: 0; }
.owner-ticket-names { margin: 0; color: var(--admin-ink); font-size: 0.82rem; font-weight: 600; }
.owner-ticket-graphic { margin: 0.1rem 0 0; color: var(--admin-muted); font-size: 0.72rem; }
.owner-ticket-status { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.owner-ticket-status:empty { display: none; }
.owner-ticket-status > span { padding: 0.08rem 0.5rem; font-size: 0.64rem; }
.owner-ticket-assign { min-width: 0; }
.owner-ticket-assign .reassign-select { width: 100%; }
.owner-activity-wrap { padding: 0.3rem 1rem; }
.owner-activity { margin: 0; padding: 0; list-style: none; }
.owner-event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.65rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--admin-line);
}
.owner-event:last-child { border-bottom: 0; }
.owner-event-icon { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; font-size: 0.78rem; font-weight: 700; }
.owner-event-icon.is-claim { color: #366790; background: #edf5fc; }
.owner-event-icon.is-release { color: #9b6821; background: #fff8e9; }
.owner-event-icon.is-complete { color: #21735c; background: #edf7f1; }
.owner-event-icon.is-reassign { color: #6a4d8c; background: #f4effa; }
.owner-event-icon.is-other { color: var(--admin-muted); background: var(--admin-wash); }
.owner-event-copy p { margin: 0.15rem 0 0; color: var(--admin-ink); font-size: 0.78rem; line-height: 1.4; }
.owner-event-copy strong { font-weight: 650; }
.owner-event-copy small { display: block; margin-top: 0.1rem; color: var(--admin-muted); font-size: 0.68rem; }
.owner-event time { padding-top: 0.2rem; color: var(--admin-muted); font-size: 0.66rem; white-space: nowrap; }

/* Money. */
.owner-fin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 0.75rem; }
.owner-stat-value { margin: 0.35rem 0 0; color: var(--admin-ink); font-size: clamp(1.3rem, 1.65vw, 1.75rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.owner-ledger-wrap { max-height: 28rem; overflow: auto; padding: 0; }
.owner-ledger { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 0.76rem; }
.owner-ledger th {
  position: sticky;
  top: 0;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--admin-line);
  background: var(--admin-paper);
  color: var(--admin-muted);
  font-size: 0.66rem;
  font-weight: 650;
  text-align: left;
}
.owner-ledger td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--admin-line); color: var(--admin-ink); vertical-align: top; }
.owner-ledger tr:last-child td { border-bottom: 0; }
.owner-ledger td:first-child { color: var(--admin-muted); white-space: nowrap; }
.owner-ledger td small { display: block; color: var(--admin-muted); font-size: 0.68rem; }
.owner-ledger .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.owner-ledger .is-credit { color: #21735c; }
.owner-ledger .is-debit { color: #a34d4c; }

/* Switches. */
.owner-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; padding: 1.1rem 1.2rem; }
.owner-switch-copy { flex: 1 1 18rem; min-width: 0; }
.owner-switch-copy h3 { margin: 0; color: var(--admin-ink); font-size: 0.9rem; font-weight: 650; }
.owner-switch-copy p { max-width: 36rem; margin: 0.3rem 0 0; color: var(--admin-muted); font-size: 0.76rem; line-height: 1.5; }
.owner-switch .ai-worker-status { max-width: none; margin-top: 0.75rem; gap: 0.35rem; color: var(--admin-muted); }
.owner-switch .ai-worker-status span { padding: 0.15rem 0.55rem; border: 1px solid var(--admin-line); border-radius: 999px; background: var(--admin-wash); font-size: 0.68rem; }
html[data-theme] .owner-switch .ai-kill-btn { min-width: 11rem; min-height: 2.8rem; border-radius: 0.75rem; box-shadow: none; }
html[data-theme] .owner-switch .ai-kill-btn.on { color: #9c4139; background: #fff1ef; border-color: #f1d2cf; }
html[data-theme] .owner-switch .ai-kill-btn.on:hover:not(:disabled) { background: #ffe6e2; border-color: #e5b3ae; }
html[data-theme] .owner-switch .ai-kill-btn.off { color: #21735c; background: #edf7f1; border-color: #cce8d8; }
html[data-theme] .owner-switch .ai-kill-btn.off:hover:not(:disabled) { background: #e0f2e8; border-color: #b4dcc6; }
html[data-theme] .owner-switch .ai-kill-btn:not(.on):not(.off) { color: #756f66; background: #f5f1eb; border-color: #e8e0d6; }
.owner-switch + .owner-switch { margin-top: 0.75rem; }
.owner-switch .season-previews a { margin-left: 0.4rem; color: var(--admin-ink); text-decoration: underline; text-underline-offset: 2px; }
.owner-switch .season-note:empty { display: none; }
.owner-switch .season-mode { min-width: 11rem; border-radius: 0.75rem; }

/* Insights. Sections size to the panel (container queries), so the bottom sheet and phones get the narrow layout. */
.insights { container: insights / inline-size; }
/* A refetch keeps the last numbers on screen, dimmed; the People list loads on its own. */
.insights > .ins-section { transition: opacity 0.2s ease; }
.insights[aria-busy="true"] > .ins-section:not(#ins-people-section) { opacity: 0.6; }
.ins-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ins-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 1.2rem; }
.ins-range { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ins-updated { flex: 1 1 12rem; margin: 0; color: var(--admin-muted); font-size: 0.7rem; line-height: 1.4; }
.ins-section { margin-top: 2.2rem; }
.ins-section:first-child { margin-top: 0; }
.ins-head { margin-bottom: 0.8rem; }
.ins-head h3 { margin: 0; color: var(--admin-ink); font-size: 0.92rem; font-weight: 650; letter-spacing: -0.015em; }
.ins-head p { max-width: 46rem; margin: 0.25rem 0 0; color: var(--admin-muted); font-size: 0.74rem; line-height: 1.5; }
.ins-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.6rem 1rem; }
.ins-head-row .archive-btn { padding: 0.35rem 0.8rem; }
.ins-note { margin: 0.65rem 0 0; color: var(--admin-muted); font-size: 0.7rem; line-height: 1.45; }
.ins-note:empty { display: none; }
.ins-empty { margin: 0.9rem 0 0.2rem; color: var(--admin-muted); font-size: 0.74rem; line-height: 1.45; list-style: none; }

/* Stat cards: 2 across on phones, one row on wide screens. Cards with a segment are buttons. */
.ins-people-grid { display: grid; gap: 0.6rem; }
.ins-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.ins-cards.is-plans { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ins-cards.is-three { grid-template-columns: minmax(0, 1fr); }
.ins-cards.is-five > :last-child { grid-column: 1 / -1; }
/* Buttons center their content by default; cards read top-down like the plain ones. */
.ins-stat { display: flex; flex-direction: column; justify-content: flex-start; width: 100%; margin: 0; color: inherit; font: inherit; text-align: left; }
.ins-stat .owner-stat-value { overflow-wrap: anywhere; }
.ins-stat .stat-delta { line-height: 1.4; }
button.ins-stat { cursor: pointer; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
html[data-theme] button.ins-stat { padding-right: 1.9rem; }
html[data-theme] button.ins-stat:hover { border-color: #d3c3ae; box-shadow: 0 6px 18px rgba(73, 52, 24, 0.07); }
.ins-stat-go { position: absolute; top: 0.85rem; right: 0.85rem; color: var(--admin-muted); font-size: 0.8rem; opacity: 0.5; transition: opacity 0.2s ease, transform 0.2s ease; }
button.ins-stat:hover .ins-stat-go,
button.ins-stat:focus-visible .ins-stat-go { opacity: 1; transform: translateX(2px); }
.ins-extra { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; margin-top: 0.7rem; }
.ins-extra:empty { display: none; }
.ins-extra-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  background: var(--admin-paper);
  color: var(--admin-muted);
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: left;
}
.ins-extra-item strong { color: var(--admin-ink); font-weight: 680; }
button.ins-extra-item { cursor: pointer; }
button.ins-extra-item:hover { border-color: #d3c3ae; color: var(--admin-ink); }
.ins-extra-item.is-quiet { border-style: dashed; background: transparent; }

/* People list: segment chips, tools, rows and pager. */
.ins-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ins-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid #e6ded4;
  border-radius: 999px;
  background: #fffdfa;
  color: #574e45;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.ins-chip:hover { background: #f5eee4; border-color: #d3c3ae; color: #2b251e; }
.ins-chip.active { background: #302b25; border-color: #302b25; color: #fffaf3; }
.ins-chip-count { padding: 0.02rem 0.4rem; border-radius: 999px; background: var(--admin-wash); color: var(--admin-muted); font-size: 0.64rem; font-variant-numeric: tabular-nums; }
.ins-chip.active .ins-chip-count { background: rgba(255, 250, 243, 0.16); color: #fffaf3; }
.ins-segment-help { min-height: 1.05rem; margin: 0.55rem 0 0; color: var(--admin-muted); font-size: 0.72rem; line-height: 1.45; }
.ins-list-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem; margin: 0.75rem 0 0.6rem; }
.ins-list-tools .field label { margin-bottom: 0.35rem; }
.ins-search { flex: 1 1 14rem; }
.ins-people-summary { min-height: 1rem; margin: 0 0 0.5rem; color: var(--admin-muted); font-size: 0.72rem; }
/* 50 rows scroll inside the card (header pinned) so the sections below stay close. */
.ins-people { max-height: min(38rem, 78vh); padding: 0; overflow-y: auto; transition: opacity 0.2s ease; scrollbar-width: thin; }
.ins-people[aria-busy="true"] { opacity: 0.6; }
.ins-people-rows { margin: 0; padding: 0; list-style: none; }
.ins-person {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
  align-items: start;
  gap: 0.5rem 0.75rem;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--admin-line);
  color: var(--admin-ink);
  font-size: 0.76rem;
}
.ins-people-rows .ins-person:last-child { border-bottom: 0; }
.ins-people-head,
.ins-people-head[hidden] { display: none; }
.ins-people-head { position: sticky; top: 0; z-index: 1; background: var(--admin-paper); }
.ins-person > div { min-width: 0; }
.ins-person small { display: block; overflow: hidden; color: var(--admin-muted); font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }
.ins-person-id { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.65rem; align-self: center; }
.mini-avatar.ins-avatar { width: 2.1rem; height: 2.1rem; font-size: 0.8rem; }
.ins-person-name { min-width: 0; }
.ins-person-name p { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; min-width: 0; margin: 0; }
.ins-person-name strong { overflow: hidden; font-size: 0.8rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ins-person-sub { margin-top: 0.2rem !important; }
.ins-person-sub:empty { display: none; }
.ins-person-sub small { display: inline; }
.ins-plan-cell { display: none; }
.ins-cell-label { display: block; color: var(--admin-muted); font-size: 0.6rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; }
.ins-num { font-variant-numeric: tabular-nums; }
.ins-people-empty { padding: 0 1rem; }
.ins-plan,
.ins-badge {
  display: inline-block;
  padding: 0.1rem 0.52rem;
  border: 1px solid #e8e0d6;
  border-radius: 999px;
  background: #f5f1eb;
  color: #766e64;
  font-size: 0.64rem;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}
.ins-plan.is-basic { color: #366790; background: #edf5fc; border-color: #d4e4f3; }
.ins-plan.is-pro { color: #21735c; background: #edf7f1; border-color: #cce8d8; }
.ins-plan.is-pro-plus { color: #fffaf3; background: #302b25; border-color: #302b25; }
.ins-plan.is-past { color: #6a4d8c; background: #f4effa; border-color: #e3d8f0; }
.ins-badge.is-cancel { color: #a34d4c; background: #fff1ef; border-color: #f1d2cf; }
.ins-badge.is-problem { color: #9b6821; background: #fff8e9; border-color: #efd8aa; }
.ins-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.6rem; margin-top: 0.8rem; color: var(--admin-muted); font-size: 0.72rem; }
.ins-pager:empty { display: none; }
.ins-pager .archive-btn { padding: 0.35rem 0.85rem; }

/* Chart cards, bar lists and facts. */
.ins-pair,
.ins-trio { display: grid; gap: 0.75rem; margin-top: 0.75rem; }
.ins-pair > *,
.ins-trio > * { min-width: 0; }
.ins-trio { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.ins-section > .chart-card { margin-top: 0.75rem; }
.ins-plot { position: relative; height: 200px; margin-top: 0.8rem; }
.ins-chart-empty { display: none; margin: 0.8rem 0 0; }
.ins-chart.is-empty .ins-plot { display: none; }
.ins-chart.is-empty .ins-chart-empty {
  display: grid;
  place-items: center;
  min-height: 8rem;
  padding: 1rem;
  border: 1px dashed var(--admin-line);
  border-radius: 0.65rem;
  color: var(--admin-muted);
  font-size: 0.74rem;
  text-align: center;
}
.ins-list { margin-top: 0.5rem; }
.ins-list .list-row { gap: 0.75rem; font-size: 0.76rem; }
.ins-list-label { flex: 1; min-width: 0; }
.ins-list-label p { margin: 0; overflow: hidden; color: var(--admin-ink); text-overflow: ellipsis; white-space: nowrap; }
.ins-list-label small { color: var(--admin-muted); font-size: 0.66rem; }
/* Fixed value and change columns keep every bar in a list the same length. */
.ins-list-value { flex: 0 0 auto; min-width: 3.4rem; color: var(--admin-ink); font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ins-list-change { flex: 0 0 4.1rem; text-align: right; }
.ins-list-title { margin: 1.1rem 0 0; color: var(--admin-muted); font-size: 0.68rem; font-weight: 650; }
.ins-change { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.04rem 0.42rem; border-radius: 999px; font-size: 0.63rem; font-weight: 650; white-space: nowrap; }
.ins-change.is-up { color: #21735c; background: #edf7f1; }
.ins-change.is-down { color: #a34d4c; background: #fff1ef; }
.ins-change.is-flat,
.ins-change.is-new { color: var(--admin-muted); background: var(--admin-wash); }
.ins-facts { margin: 0.55rem 0 0; }
.ins-facts div { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--admin-line); }
.ins-facts div:last-child { border-bottom: 0; }
.ins-facts dt { min-width: 0; color: var(--admin-ink); font-size: 0.76rem; line-height: 1.35; }
.ins-facts dt small { display: block; margin-top: 0.1rem; color: var(--admin-muted); font-size: 0.66rem; }
.ins-facts dd { margin: 0; color: var(--admin-ink); font-size: 1rem; font-weight: 680; letter-spacing: -0.02em; text-align: right; white-space: nowrap; }
.ins-revenue-plans .ins-note { margin-top: 0.8rem; }

/* Phone vs computer: one split bar, colored by device. */
.ins-devices { margin-top: 0.85rem; }
.ins-split { display: flex; gap: 2px; height: 0.7rem; overflow: hidden; border-radius: 999px; background: var(--admin-wash); }
.ins-split span { min-width: 3px; }
.ins-split-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin: 0.6rem 0 0.25rem; padding: 0; color: var(--admin-ink); font-size: 0.74rem; list-style: none; }
.ins-split-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.ins-split-legend i { width: 0.62rem; height: 0.62rem; border-radius: 0.2rem; }
.ins-split-legend strong { font-weight: 680; }
.ins-devices .is-phone { background: #d99a35; }
.ins-devices .is-computer { background: #557299; }
.ins-devices .is-tablet { background: #3f9f7f; }
.ins-devices .is-other { background: #b3a99c; }

/* Best time to post: weekday × hour, one amber ramp from quiet to busy. */
.ins-best { margin: 0.7rem 0 0; color: var(--admin-ink); font-size: 0.78rem; line-height: 1.5; }
.ins-best strong { font-weight: 650; }
.ins-best:empty { display: none; }
.ins-heat-wrap { margin-top: 0.85rem; overflow-x: auto; }
.ins-heat { display: grid; grid-template-columns: 2.2rem repeat(24, minmax(0.6rem, 1fr)); gap: 2px; min-width: 18.5rem; }
.ins-heat-hour { grid-column: span 3; color: var(--admin-muted); font-size: 0.6rem; line-height: 1.6; white-space: nowrap; }
.ins-heat-day { align-self: center; color: var(--admin-muted); font-size: 0.64rem; font-weight: 600; }
.ins-heat-cell { height: clamp(0.8rem, 2.4cqi, 1.4rem); border-radius: 3px; }
.ins-heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 0.6rem; color: var(--admin-muted); font-size: 0.64rem; }
.ins-heat-legend span { margin: 0 0.3rem; }
.ins-heat-legend i { width: 0.8rem; height: 0.8rem; border-radius: 3px; }
.insights .lv0 { background: #f3eee6; }
.insights .lv1 { background: #f5e3bf; }
.insights .lv2 { background: #ecc98a; }
.insights .lv3 { background: #dba557; }
.insights .lv4 { background: #bb8434; }
.insights .lv5 { background: #8a5c14; }

/* Gallery rows. */
.ins-graphics { margin: 0.55rem 0 0; padding: 0; list-style: none; }
.ins-graphic { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0; border-bottom: 1px solid var(--admin-line); }
.ins-graphic:last-child { border-bottom: 0; }
.ins-thumb { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 0.5rem; background: #f0e8dc; object-fit: cover; }
.ins-thumb.is-missing { border: 1px dashed #e2b2ac; background: #fff4f1; color: #b15c57; }
.ins-thumb svg { width: 1rem; height: 1rem; }
.ins-graphic-copy { flex: 1; min-width: 0; }
.ins-graphic-copy strong { display: block; overflow: hidden; color: var(--admin-ink); font-size: 0.78rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ins-graphic-copy small { display: block; overflow: hidden; color: var(--admin-muted); font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }
.ins-graphic-copy .list-bar { margin-top: 0.3rem; }
.ins-graphic-num { flex: 0 0 auto; min-width: 3.2rem; color: var(--admin-ink); font-size: 0.95rem; font-weight: 680; text-align: right; font-variant-numeric: tabular-nums; }
.ins-graphic-num small { display: block; color: var(--admin-muted); font-size: 0.62rem; font-weight: 500; }
.ins-graphics.is-compact { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); gap: 0.45rem; }
.ins-graphics.is-compact .ins-graphic { padding: 0.4rem; border: 0; border-radius: 0.6rem; background: var(--admin-wash); }
.ins-graphics.is-compact .ins-thumb { width: 2.1rem; height: 2.1rem; }
.ins-graphics.is-compact span.ins-thumb:not(.is-missing) { border: 1px solid var(--admin-line); background: var(--admin-paper); }
.ins-graphics.is-compact .ins-empty { grid-column: 1 / -1; }
.ins-more { grid-column: 1 / -1; align-self: center; color: var(--admin-muted); font-size: 0.7rem; }
.ins-code-state { display: inline-block; margin-top: 0.2rem; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--admin-wash); color: var(--admin-muted); font-size: 0.64rem; font-weight: 650; }
.ins-code-state.is-open { color: #21735c; background: #edf7f1; }

/* Search engine checklist. */
.ins-seo-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem 1rem; }
.ins-seo-score { padding: 0.2rem 0.65rem; border-radius: 999px; background: #fff8e9; color: #8a5c14; font-size: 0.72rem; font-weight: 650; white-space: nowrap; }
.ins-seo-score.is-good { color: #21735c; background: #edf7f1; }
.ins-seo-score:empty { display: none; }
.ins-seo { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); column-gap: 1.4rem; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.ins-seo-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.6rem; padding: 0.7rem 0; border-bottom: 1px solid var(--admin-line); }
.ins-seo-icon { display: grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; font-size: 0.72rem; font-weight: 700; }
.ins-seo-item.is-ok .ins-seo-icon { color: #21735c; background: #edf7f1; }
.ins-seo-item.is-bad .ins-seo-icon { color: #a34d4c; background: #fff1ef; }
.ins-seo-item p { margin: 0.15rem 0 0; color: var(--admin-muted); font-size: 0.72rem; line-height: 1.45; }
.ins-seo-item p:first-child { margin-top: 0.08rem; color: var(--admin-ink); font-size: 0.78rem; }
.ins-seo-item strong { font-weight: 650; }
.ins-seo-why { color: var(--admin-ink) !important; opacity: 0.78; }

@container insights (min-width: 34rem) {
  .ins-cards.is-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ins-cards.is-three,
  .ins-cards.is-five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ins-cards.is-five > :last-child { grid-column: span 2; }
}
@container insights (min-width: 40rem) {
  .ins-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container insights (min-width: 44rem) {
  .ins-person { grid-template-columns: minmax(0, 2fr) minmax(0, 0.85fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 0.6fr) minmax(0, 0.65fr); align-items: center; }
  .ins-people-head { display: grid; padding-top: 0.6rem; padding-bottom: 0.6rem; }
  .ins-people-head[hidden] { display: none; }
  .ins-person-id { grid-column: auto; }
  .ins-plan-inline,
  .ins-cell-label,
  .ins-person-sub:not(:has(small)) { display: none; }
  .ins-plan-cell { display: block; }
  .ins-num { text-align: right; }
}
@container insights (min-width: 56rem) {
  .ins-people-grid { grid-template-columns: minmax(0, 4fr) minmax(0, 3fr); }
  .ins-cards.is-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ins-cards.is-five > :last-child { grid-column: auto; }
  .ins-plot { height: 230px; }
}
@media (prefers-reduced-motion: reduce) {
  .insights > .ins-section,
  .ins-people,
  button.ins-stat,
  .ins-stat-go { transition: none; }
}

@media (max-width: 760px) {
  .owner-ticket { grid-template-columns: minmax(0, 1fr); }
  .owner-ticket-assign { max-width: 16rem; }
  .request-row .reassign-select { flex: 1 1 9rem; }
}
@media (max-width: 440px) {
  .owner-add { grid-template-columns: minmax(0, 1fr); }
  .owner-add .btn-primary { width: 100%; }
  .owner-matrix .owner-matrix-name { min-width: 8.75rem; }
  .pill-check,
  .pill-check span { width: 100%; }
  .owner-event { grid-template-columns: auto minmax(0, 1fr); }
  .owner-event time { grid-column: 2; padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .admin-dialog[open] { animation: none; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --admin-ink: var(--dark-text);
  --admin-muted: var(--dark-muted);
  --admin-line: var(--dark-border);
  --admin-paper: var(--dark-surface);
  --admin-wash: var(--dark-hover);
}
html[data-theme="dark"] body {
  color: var(--admin-ink);
  background: var(--dark-surface);
}
html[data-theme="dark"] body::selection { background: #686046; }
html[data-theme="dark"] .admin-tools > .btn-secondary,
html[data-theme="dark"] .admin-tools > .ai-kill-btn,
html[data-theme="dark"] .bell-btn,
html[data-theme="dark"] .range-btn,
html[data-theme="dark"] .archive-btn,
html[data-theme="dark"] .admin-quick-grid button {
  color: var(--admin-ink);
  border-color: var(--admin-line);
  background: var(--dark-control);
  box-shadow: none;
}
html[data-theme="dark"] .admin-tools > .ai-kill-btn.on { color: #f3aca6; }
html[data-theme="dark"] .admin-tools > .ai-kill-btn.off { color: #9bddbe; }
html[data-theme="dark"] .admin-tools > .ai-kill-btn:hover:not(:disabled),
html[data-theme="dark"] .admin-tools > .btn-secondary:hover,
html[data-theme="dark"] .bell-btn:hover,
html[data-theme="dark"] .range-btn:hover,
html[data-theme="dark"] .archive-btn:hover,
html[data-theme="dark"] .admin-quick-grid button:hover {
  color: var(--admin-ink);
  border-color: var(--dark-focus);
  background: var(--admin-wash);
  box-shadow: none;
}
html[data-theme="dark"] .bell-panel { color: var(--admin-ink); background: var(--admin-paper); border-color: var(--admin-line); }
html[data-theme="dark"] .admin-avatar { background: #75613f; }
html[data-theme="dark"] #admin-tabs {
  border-color: var(--admin-line);
  background: var(--admin-paper) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
html[data-theme="dark"] .admin-brand small,
html[data-theme="dark"] .admin-nav-foot { color: var(--admin-muted); }
html[data-theme="dark"] #admin-tabs .tab-btn,
html[data-theme="dark"] .admin-nav-icon { color: var(--admin-muted); }
html[data-theme="dark"] #admin-tabs .tab-btn:hover,
html[data-theme="dark"] #admin-tabs .tab-btn:focus-visible { color: var(--admin-ink); background: var(--admin-wash); }
html[data-theme="dark"] #admin-tabs .tab-btn.active { color: var(--admin-ink); background: var(--admin-wash); border-color: var(--dark-focus); }
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .admin-overview-card,
html[data-theme="dark"] .glass-panel,
html[data-theme="dark"] .msg-card { background: var(--admin-paper); border-color: var(--admin-line); box-shadow: 0 3px 15px rgba(0, 0, 0, 0.13); }
html[data-theme="dark"] .msg-card.unread { background: #342e24; border-color: #9a794a; }
html[data-theme="dark"] .dash-primary .stat-card::before { color: var(--admin-ink); background: var(--admin-wash); border-color: var(--admin-line); }
html[data-theme="dark"] .col-header,
html[data-theme="dark"] .stat-card [id$="-sub"],
html[data-theme="dark"] .stat-delta,
html[data-theme="dark"] .chart-sub { color: var(--admin-muted); }
html[data-theme="dark"] .stat-card [id^="m-"],
html[data-theme="dark"] .stat-card [id^="stat-"],
html[data-theme="dark"] .stat-card [id^="o-"] { color: var(--admin-ink); }
html[data-theme="dark"] .list-bar { background: var(--admin-wash); }
html[data-theme="dark"] .range-btn.active { color: var(--dark-surface); background: var(--dark-muted); border-color: var(--dark-muted); }
html[data-theme="dark"] .admin-card-heading > button { color: var(--admin-muted); }
html[data-theme="dark"] .admin-card-heading > button:hover { color: var(--admin-ink); }
html[data-theme="dark"] .admin-preview-row { border-color: var(--admin-line); }
html[data-theme="dark"] .admin-preview-thumb { background: var(--admin-wash); }
html[data-theme="dark"] .admin-preview-copy strong { color: var(--admin-ink); }
html[data-theme="dark"] .admin-preview-copy small,
html[data-theme="dark"] .admin-preview-empty { color: var(--admin-muted); }
html[data-theme="dark"] .offer-thumb { border-color: var(--admin-line); }
html[data-theme="dark"] .offer-thumb.placeholder { color: var(--admin-muted); background: var(--admin-wash); }
html[data-theme="dark"] .status-complete,
html[data-theme="dark"] .status-paid { color: #a5eac9; background: #1b3d34; border-color: #386c58; }
html[data-theme="dark"] .status-pending { color: #f1cb82; background: #44361d; border-color: #806635; }
html[data-theme="dark"] .status-processing,
html[data-theme="dark"] .status-delivered { color: #abd3f3; background: #243d53; border-color: #466a8a; }
html[data-theme="dark"] .status-failed,
html[data-theme="dark"] .dup-yes { color: #f7b4b5; background: #4d2a32; border-color: #80515a; }
html[data-theme="dark"] .dup-no { color: var(--admin-muted); background: var(--admin-wash); border-color: var(--admin-line); }
html[data-theme="dark"] #graphic_sample,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea { color: var(--admin-ink); border-color: var(--admin-line); background: var(--admin-paper); }
html[data-theme="dark"] #graphic_sample::file-selector-button { color: var(--admin-ink); background: var(--admin-wash); }
html[data-theme="dark"] .field label { color: var(--admin-muted); }
html[data-theme="dark"] .field input::placeholder,
html[data-theme="dark"] .field textarea::placeholder { color: var(--admin-muted); }
html[data-theme="dark"] .text-cream { color: #f1ede4 !important; }
html[data-theme="dark"] .text-cream\/80 { color: #d6d2ca !important; }
html[data-theme="dark"] .text-cream\/70 { color: #c6c3bd !important; }
html[data-theme="dark"] .text-cream\/60 { color: #b7b5ae !important; }
html[data-theme="dark"] .text-cream\/55 { color: #aeaca6 !important; }
html[data-theme="dark"] .text-cream\/50,
html[data-theme="dark"] .text-cream\/45,
html[data-theme="dark"] .text-cream\/40,
html[data-theme="dark"] .text-cream\/35 { color: #aaa9a3 !important; }
html[data-theme="dark"] .text-rose-400,
html[data-theme="dark"] .text-rose-300 { color: #f5a9ad !important; }
html[data-theme="dark"] .text-amber-300 { color: #efc77b !important; }
html[data-theme="dark"] .text-emerald-300 { color: #a8e8c3 !important; }
html[data-theme="dark"] .text-sky-300 { color: #b0d5f1 !important; }
html[data-theme="dark"] :focus-visible { outline: 2px solid #f1cb82; outline-offset: 2px; }

/* Dark mode: owner tools, ticket claims and the take-ticket dialog. */
html[data-theme="dark"] .admin-role { color: #f1cb82; background: #44361d; }
html[data-theme="dark"] .mini-avatar,
html[data-theme="dark"] .owner-avatar { background: #75613f; }
html[data-theme="dark"] .claim-chip.mine { color: #a5eac9; background: #1b3d34; border-color: #386c58; }
html[data-theme="dark"] .claim-chip.mine .mini-avatar { background: #2f7a62; }
html[data-theme="dark"] .claim-chip.other { color: #abd3f3; background: #243d53; border-color: #466a8a; }
html[data-theme="dark"] .claim-chip.other .mini-avatar { background: #3f6f96; }
html[data-theme="dark"] .photo-for.is-target,
html[data-theme="dark"] .photo-switch input:checked + span,
html[data-theme="dark"] .graphic-badge { color: #f1cb82; background: #44361d; border-color: #806635; }
html[data-theme="dark"] .request-row.photo-target {
  background: linear-gradient(90deg, rgba(241, 203, 130, 0.1), transparent 70%);
  box-shadow: inset 3px 0 0 #f1cb82;
}
html[data-theme="dark"] .archive-btn.take-btn { color: #1a140c; background: #f1cb82; border-color: #f1cb82; }
html[data-theme="dark"] .archive-btn.take-btn:hover { color: #1a140c; background: #f6d998; border-color: #f6d998; }
html[data-theme="dark"] .archive-btn.danger-btn { color: #f7b4b5; border-color: #80515a; }
html[data-theme="dark"] .archive-btn.danger-btn:hover { color: #f7b4b5; background: #4d2a32; border-color: #9b6570; }
html[data-theme="dark"] .archive-btn:disabled:hover { color: var(--admin-ink); background: var(--dark-control); border-color: var(--admin-line); }
html[data-theme="dark"] .reassign-select {
  color: var(--admin-ink);
  border-color: var(--admin-line);
  background-color: var(--dark-control);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23e6d7c2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .reassign-select:hover { border-color: var(--dark-focus); }
html[data-theme="dark"] .reassign-select option { color: var(--admin-ink); background: #17110a; }
html[data-theme="dark"] .pill-check span { color: var(--admin-ink); border-color: var(--admin-line); background: var(--admin-paper); }
html[data-theme="dark"] .pill-check span::before { border-color: var(--admin-muted); }
html[data-theme="dark"] .pill-check:hover span { border-color: var(--dark-focus); }
html[data-theme="dark"] .pill-check input:checked + span { color: var(--dark-surface); background: var(--dark-muted); border-color: var(--dark-muted); }
html[data-theme="dark"] .pill-check input:checked + span::before { border-color: var(--dark-surface); background: var(--dark-surface); box-shadow: inset 0 0 0 2px var(--dark-muted); }
html[data-theme="dark"] .pill-check input:focus-visible + span,
html[data-theme="dark"] .photo-switch input:focus-visible + span { outline-color: #f1cb82; }
html[data-theme="dark"] .photo-toggle { border-color: var(--admin-line); background: var(--admin-paper); }
html[data-theme="dark"] .photo-toggle input { accent-color: #f1cb82; }
html[data-theme="dark"] .photo-switch span { color: var(--admin-muted); border-color: var(--admin-line); background: var(--dark-control); }
html[data-theme="dark"] .photo-switch span::before { background-color: rgba(255, 244, 230, 0.22); }
html[data-theme="dark"] .photo-switch input:checked + span::before { background-color: #c9952a; }
html[data-theme="dark"] .graphic-row.is-missing {
  background: linear-gradient(90deg, rgba(247, 180, 181, 0.08), transparent 65%);
  box-shadow: inset 3px 0 0 #9b6570;
}
html[data-theme="dark"] .offer-thumb.placeholder.is-missing,
html[data-theme="dark"] .admin-preview-thumb.is-missing { color: #f5a9ad; border-color: #80515a; background: #3a2328; }
html[data-theme="dark"] .graphic-badge.is-missing { color: #f7b4b5; background: #4d2a32; border-color: #80515a; }
html[data-theme="dark"] .admin-preview-copy small.is-missing { color: #f5a9ad; }
html[data-theme="dark"] .graphic-action { color: var(--admin-ink); border-color: var(--admin-line); background: var(--dark-control); }
html[data-theme="dark"] .graphic-action:hover { color: var(--admin-ink); border-color: var(--dark-focus); background: var(--admin-wash); }
html[data-theme="dark"] .graphic-action.is-primary { color: #1a140c; background: #f1cb82; border-color: #f1cb82; }
html[data-theme="dark"] .graphic-action.is-primary:hover { color: #1a140c; background: #f6d998; border-color: #f6d998; }
html[data-theme="dark"] .graphic-action:focus-visible { outline-color: #f1cb82; }
html[data-theme="dark"] #graphics-error.is-success { color: #a8e8c3 !important; }
html[data-theme="dark"] .admin-dialog { box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
html[data-theme="dark"] .admin-dialog::backdrop { background: rgba(0, 0, 0, 0.58); }
html[data-theme="dark"] .admin-dialog-error { color: #f7b4b5; background: #4d2a32; border-color: #80515a; }
html[data-theme="dark"] .graphic-edit-note.is-tip { color: #f1cb82; background: #3a2f1c; border-color: #6b5530; }
html[data-theme="dark"] .graphic-edit-shortcut { color: #b0d5f1; }
html[data-theme="dark"] .graphic-edit-remove { color: #f7b4b5; border-color: #80515a; }
html[data-theme="dark"] .graphic-edit-remove:hover { color: #f7b4b5; background: #4d2a32; border-color: #9b6570; }
html[data-theme="dark"] .graphic-edit-remove:disabled:hover { background: none; border-color: #80515a; }
html[data-theme="dark"] .owner-msg { color: #a8e8c3; }
html[data-theme="dark"] .owner-msg.is-error,
html[data-theme="dark"] .owner-matrix-person small.is-error { color: #f5a9ad; }
html[data-theme="dark"] .owner-admin-card { box-shadow: 0 3px 15px rgba(0, 0, 0, 0.13); }
html[data-theme="dark"] .owner-status.is-active { color: #a5eac9; background: #1b3d34; border-color: #386c58; }
html[data-theme="dark"] .graphic-code-line { color: #f1cb82; }
html[data-theme="dark"] .owner-admin-note { color: #f1cb82; background: #3a2f1c; border-color: #6b5530; }
html[data-theme="dark"] .owner-status.is-removed { color: var(--admin-muted); background: var(--admin-wash); border-color: var(--admin-line); }
html[data-theme="dark"] .perm-cell input { accent-color: #f1cb82; }
html[data-theme="dark"] .owner-event-icon.is-claim { color: #abd3f3; background: #243d53; }
html[data-theme="dark"] .owner-event-icon.is-release { color: #f1cb82; background: #44361d; }
html[data-theme="dark"] .owner-event-icon.is-complete { color: #a5eac9; background: #1b3d34; }
html[data-theme="dark"] .owner-event-icon.is-reassign { color: #d6c2f2; background: #372b4a; }
html[data-theme="dark"] .owner-ledger .is-credit { color: #a8e8c3; }
html[data-theme="dark"] .owner-ledger .is-debit { color: #f5a9ad; }
html[data-theme="dark"] .owner-switch .ai-kill-btn.on { color: #f7b4b5; background: #4d2a32; border-color: #80515a; }
html[data-theme="dark"] .owner-switch .ai-kill-btn.on:hover:not(:disabled) { background: #5a313a; border-color: #9b6570; }
html[data-theme="dark"] .owner-switch .ai-kill-btn.off { color: #a5eac9; background: #1b3d34; border-color: #386c58; }
html[data-theme="dark"] .owner-switch .ai-kill-btn.off:hover:not(:disabled) { background: #22493e; border-color: #4a8a71; }
html[data-theme="dark"] .owner-switch .ai-kill-btn:not(.on):not(.off) { color: var(--admin-muted); background: var(--admin-wash); border-color: var(--admin-line); }

/* Dark mode: Insights. */
html[data-theme="dark"] button.ins-stat:hover,
html[data-theme="dark"] button.ins-extra-item:hover { border-color: var(--dark-focus); box-shadow: none; }
html[data-theme="dark"] .ins-chip { color: var(--admin-ink); border-color: var(--admin-line); background: var(--dark-control); }
html[data-theme="dark"] .ins-chip:hover { color: var(--admin-ink); border-color: var(--dark-focus); background: var(--admin-wash); }
html[data-theme="dark"] .ins-chip.active { color: var(--dark-surface); background: var(--dark-muted); border-color: var(--dark-muted); }
html[data-theme="dark"] .ins-chip.active .ins-chip-count { color: var(--dark-surface); background: rgba(18, 16, 14, 0.14); }
html[data-theme="dark"] .ins-plan,
html[data-theme="dark"] .ins-badge { color: var(--admin-muted); background: var(--admin-wash); border-color: var(--admin-line); }
html[data-theme="dark"] .ins-plan.is-basic { color: #abd3f3; background: #243d53; border-color: #466a8a; }
html[data-theme="dark"] .ins-plan.is-pro { color: #a5eac9; background: #1b3d34; border-color: #386c58; }
html[data-theme="dark"] .ins-plan.is-pro-plus { color: #1a140c; background: #f1cb82; border-color: #f1cb82; }
html[data-theme="dark"] .ins-plan.is-past { color: #d6c2f2; background: #372b4a; border-color: #5c4a78; }
html[data-theme="dark"] .ins-badge.is-cancel { color: #f7b4b5; background: #4d2a32; border-color: #80515a; }
html[data-theme="dark"] .ins-badge.is-problem { color: #f1cb82; background: #44361d; border-color: #806635; }
html[data-theme="dark"] .ins-change.is-up,
html[data-theme="dark"] .ins-code-state.is-open,
html[data-theme="dark"] .ins-seo-score.is-good,
html[data-theme="dark"] .ins-seo-item.is-ok .ins-seo-icon { color: #a5eac9; background: #1b3d34; }
html[data-theme="dark"] .ins-change.is-down,
html[data-theme="dark"] .ins-seo-item.is-bad .ins-seo-icon { color: #f7b4b5; background: #4d2a32; }
html[data-theme="dark"] .ins-seo-score { color: #f1cb82; background: #44361d; }
html[data-theme="dark"] .ins-thumb { background: var(--admin-wash); }
html[data-theme="dark"] .ins-thumb.is-missing { color: #f5a9ad; border-color: #80515a; background: #3a2328; }
html[data-theme="dark"] .ins-devices .is-phone { background: #f0c45c; }
html[data-theme="dark"] .ins-devices .is-computer { background: #b9c7dc; }
html[data-theme="dark"] .ins-devices .is-tablet { background: #6ee7b7; }
html[data-theme="dark"] .ins-devices .is-other { background: #8d857a; }
html[data-theme="dark"] .insights .lv0 { background: rgba(255, 244, 230, 0.05); }
html[data-theme="dark"] .insights .lv1 { background: #3b3020; }
html[data-theme="dark"] .insights .lv2 { background: #5c4826; }
html[data-theme="dark"] .insights .lv3 { background: #8a6a33; }
html[data-theme="dark"] .insights .lv4 { background: #c49543; }
html[data-theme="dark"] .insights .lv5 { background: #f1cb82; }

/* Graphic delivery: requester chips, row chips and the Deliver button. */
.requester-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  min-height: 2.25rem;
  margin: 0;
  padding: 0.25rem 0.75rem 0.25rem 0.3rem;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  background: var(--admin-paper);
  color: var(--admin-ink);
  font: inherit;
  text-align: left;
}
button.requester-chip { cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease; }
button.requester-chip:hover { background: #f5eee4; border-color: #d3c3ae; }
.requester-chip .mini-avatar { width: 1.6rem; height: 1.6rem; font-size: 0.66rem; }
.requester-chip.is-guest { border-style: dashed; background: var(--admin-wash); }
.requester-copy { display: grid; min-width: 0; line-height: 1.25; }
.requester-copy strong { overflow: hidden; font-size: 0.78rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.requester-copy small { overflow: hidden; color: var(--admin-muted); font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }
.requester-copy small.requester-guest { color: #9b6821; font-weight: 650; }
.delivery-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}
.delivery-chip.is-draft { color: #8a5c14; background: #fff8e9; border-color: #efd8aa; }
.delivery-chip.is-sent { color: #21735c; background: #edf7f1; border-color: #cce8d8; }
.delivery-chip.is-seen { color: #366790; background: #edf5fc; border-color: #d4e4f3; }
.delivery-chip.is-saved { color: #fffaf3; background: #302b25; border-color: #302b25; }
.delivery-chip.is-change { color: #a34d4c; background: #fff1ef; border-color: #f1d2cf; }
.delivery-chip.is-replied { color: #6a4d8c; background: #f4effa; border-color: #e3d8f0; }
.delivery-chip.is-replied::before { content: ""; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor; }
.status-deliver {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.85rem;
  border: 1px solid #9b6821;
  border-radius: 999px;
  background: #9b6821;
  color: #fffaf3;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.status-deliver:hover { background: #7f5516; border-color: #7f5516; }
.status-deliver:focus-visible,
button.requester-chip:focus-visible { outline: 2px solid #a9782d; outline-offset: 2px; }

/* Messages: delivery tags, studio notes and delivery bubbles. */
.thread-kind-tag,
.thread-tag {
  display: inline-block;
  max-width: 100%;
  margin: 0.35rem 0 0;
  padding: 0.1rem 0.5rem;
  overflow: hidden;
  border: 1px solid #efd8aa;
  border-radius: 999px;
  background: #fff8e9;
  color: #8a5c14;
  font-size: 0.66rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}
.thread-kind-tag[hidden] { display: none; }
.thread-bubble-body { white-space: pre-line; overflow-wrap: anywhere; }
.thread-bubble-eyebrow { margin: 0.25rem 0 0; color: #a34d4c; font-size: 0.66rem; font-weight: 650; }
.thread-bubble-system {
  max-width: 30rem;
  margin: 0 auto;
  padding: 0.45rem 0.8rem;
  border: 1px dashed var(--admin-line);
  border-radius: 0.75rem;
  color: var(--admin-muted);
  font-size: 0.76rem;
  line-height: 1.45;
  text-align: center;
}
.thread-bubble-system p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.thread-bubble-system small { display: block; margin-top: 0.2rem; font-size: 0.64rem; }
.thread-thumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.6rem; }
.thread-thumb { width: 3.25rem; height: 3.25rem; border: 1px solid var(--admin-line); border-radius: 0.5rem; background: var(--admin-paper); object-fit: cover; }
.thread-thumb-more { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 0.5rem; background: var(--admin-wash); color: var(--admin-muted); font-size: 0.74rem; font-weight: 650; }
.thread-bubble-actions { margin-top: 0.6rem; }

/* Owner feed: deliveries. */
.owner-event-icon.is-deliver { color: #21735c; background: #edf7f1; }
.owner-event-icon.is-withdraw { color: #a34d4c; background: #fff1ef; }
.owner-event-icon.is-reopen { color: #9b6821; background: #fff8e9; }

/* Delivery window: wide on computers, a full-height sheet with a fixed footer on phones. */
.admin-dialog.deliver-dialog {
  width: min(58rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
}
.deliver-shell { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.deliver-head {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1.05rem 1.2rem 0.9rem;
  border-bottom: 1px solid var(--admin-line);
}
.deliver-avatar { flex: 0 0 auto; }
.deliver-avatar:empty { display: none; }
.deliver-head-copy { flex: 1 1 auto; min-width: 0; }
.deliver-head-copy h2 { overflow-wrap: anywhere; }
.deliver-head-copy h2:focus:not(:focus-visible) { outline: none; }
.deliver-sub { margin: 0.2rem 0 0; color: var(--admin-muted); font-size: 0.76rem; line-height: 1.4; }
.deliver-email { margin: 0.1rem 0 0; color: var(--admin-muted); font-size: 0.72rem; overflow-wrap: anywhere; }
.deliver-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--admin-line);
  border-radius: 50%;
  background: var(--admin-paper);
  color: var(--admin-muted);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.deliver-close:hover { background: var(--admin-wash); color: var(--admin-ink); }
.deliver-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.95rem 1.2rem 1.2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.deliver-scroll > * { margin: 0 0 0.95rem; }
.deliver-scroll > :last-child,
.deliver-scroll > :empty { margin-bottom: 0; }
.deliver-loading { color: var(--admin-muted); font-size: 0.82rem; text-align: center; }
.deliver-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin: 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.65rem;
  background: var(--admin-wash);
  color: var(--admin-ink);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}
.deliver-status-line.is-success { color: #1f6b55; background: #edf7f1; border-color: #cce8d8; }
.deliver-status-line.is-warn { color: #85581a; background: #fbf4e4; border-color: #efdcb5; }
.deliver-status-line .archive-btn { margin-left: auto; }
.deliver-top { display: grid; gap: 0.5rem; }
.deliver-holder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.65rem;
  background: var(--admin-wash);
  color: var(--admin-ink);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}
.deliver-holder > span:not(.mini-avatar) { flex: 1 1 12rem; min-width: 0; }
.deliver-holder.is-mine { color: #1f6b55; background: #edf7f1; border-color: #cce8d8; }
.deliver-holder.is-mine .mini-avatar { background: #21735c; }
.deliver-holder.is-stepin,
.deliver-holder.is-other { color: #2f5f86; background: #edf5fc; border-color: #d4e4f3; }
.deliver-holder.is-stepin .mini-avatar,
.deliver-holder.is-other .mini-avatar { background: #366790; }
.deliver-holder.is-open { color: #85581a; background: #fbf4e4; border-color: #efdcb5; }
.deliver-banner { margin: 0; padding: 0.6rem 0.8rem; border: 1px solid; border-radius: 0.65rem; font-size: 0.78rem; line-height: 1.45; }
.deliver-banner strong { font-weight: 700; }
.deliver-banner.is-guest { color: #85581a; background: #fbf4e4; border-color: #efdcb5; }
.deliver-banner.is-busy { color: #2f5f86; background: #edf5fc; border-color: #d4e4f3; }
.deliver-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0; color: var(--admin-muted); font-size: 0.74rem; }
.deliver-stars { color: #be8733; letter-spacing: 0.04em; }
.deliver-section { display: grid; gap: 0.65rem; }
.deliver-section-title { margin: 0; color: var(--admin-ink); font-size: 0.84rem; font-weight: 650; }
.deliver-links { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.deliver-dialog .archive-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.35rem 0.8rem; text-decoration: none; }
.deliver-slots { display: grid; gap: 0.75rem; }
.deliver-slot {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.85rem;
  background: var(--admin-paper);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.deliver-slot.is-archived { background: var(--admin-wash); }
.deliver-slot.is-over { border-color: #bb8434; box-shadow: 0 0 0 3px rgba(187, 132, 52, 0.18); }
.deliver-slot-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.35rem 0.75rem; }
.deliver-angel { margin: 0; color: var(--admin-ink); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: anywhere; }
.deliver-angel:focus:not(:focus-visible) { outline: none; }
.deliver-slot-state {
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  background: var(--admin-wash);
  color: var(--admin-muted);
  font-size: 0.66rem;
  font-weight: 650;
  white-space: nowrap;
}
.deliver-slot-state.is-ready { color: #8a5c14; background: #fff8e9; border-color: #efd8aa; }
.deliver-slot-state.is-sent { color: #21735c; background: #edf7f1; border-color: #cce8d8; }
.deliver-slot-state.is-needs { color: #a34d4c; background: #fff1ef; border-color: #f1d2cf; }
.deliver-slot-state.is-busy { color: #366790; background: #edf5fc; border-color: #d4e4f3; }
.deliver-change { padding: 0.6rem 0.75rem; border: 1px solid #f1d2cf; border-radius: 0.65rem; background: #fff1ef; color: #7e3a39; font-size: 0.78rem; }
.deliver-change strong { display: block; font-size: 0.72rem; font-weight: 700; }
.deliver-change p { margin: 0.25rem 0 0; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.deliver-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.8rem;
  padding: 0.55rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.7rem;
  background: var(--admin-wash);
}
.deliver-file.is-draft { border-color: #efd8aa; background: #fffaf0; }
.deliver-thumb {
  display: block;
  flex: 0 0 auto;
  width: 4.5rem;
  height: 4.5rem;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: 0.55rem;
  background: var(--admin-paper);
}
.deliver-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; color: var(--admin-muted); font-size: 0.6rem; }
.deliver-file-copy { display: grid; flex: 1 1 10rem; gap: 0.15rem; min-width: 0; }
.deliver-file-copy strong { color: var(--admin-ink); font-size: 0.78rem; font-weight: 650; overflow-wrap: anywhere; }
.deliver-file-copy small { color: var(--admin-muted); font-size: 0.7rem; line-height: 1.4; }
.deliver-file-actions,
.deliver-slot-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.deliver-include,
.deliver-check { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--admin-ink); font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.deliver-include input,
.deliver-check input { flex: 0 0 auto; width: 1rem; height: 1rem; margin: 0; accent-color: #a36d20; cursor: pointer; }
.deliver-check input:disabled { cursor: not-allowed; }
.deliver-check input:disabled + span { opacity: 0.55; }
.deliver-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.deliver-drop-label {
  position: relative;
  display: grid;
  flex: 1 1 14rem;
  justify-items: center;
  align-content: center;
  gap: 0.25rem;
  min-height: 5.2rem;
  padding: 0.9rem;
  border: 1.5px dashed #d8c7ae;
  border-radius: 0.75rem;
  background: #fffaf2;
  color: var(--admin-ink);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.deliver-drop-label u { text-underline-offset: 2px; }
.deliver-drop-label small { color: var(--admin-muted); font-size: 0.68rem; font-weight: 500; }
.deliver-drop-label:hover,
.deliver-slot.is-over .deliver-drop-label { border-color: #bb8434; background: #fff3de; }
.deliver-drop-label:focus-within,
.deliver-replace:focus-within { outline: 2px solid #a9782d; outline-offset: 2px; }
.deliver-replace { position: relative; cursor: pointer; }
.deliver-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; white-space: nowrap; }
.deliver-warning { margin: 0; padding: 0.5rem 0.7rem; border: 1px solid #efd8aa; border-radius: 0.6rem; background: #fff8e9; color: #85581a; font-size: 0.76rem; font-weight: 650; line-height: 1.4; }
.deliver-progress { margin: 0; color: var(--admin-muted); font-size: 0.76rem; font-weight: 600; }
.deliver-progress.is-error { color: #a34d4c; }
.deliver-progress.is-busy::before {
  content: "";
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.45rem;
  vertical-align: -0.1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: graphics-status-spin 0.8s linear infinite;
}
.deliver-history { color: var(--admin-muted); font-size: 0.74rem; }
.deliver-history summary { width: max-content; max-width: 100%; font-weight: 650; cursor: pointer; }
.deliver-history ul { display: grid; gap: 0.35rem; margin: 0.45rem 0 0; padding: 0; list-style: none; }
.deliver-history li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; }
.deliver-compose .field { margin: 0; }
.deliver-compose textarea { min-height: 9.5rem; font-size: 0.86rem; line-height: 1.5; }
.deliver-count { margin: -0.35rem 0 0; color: var(--admin-muted); font-size: 0.66rem; text-align: right; }
.deliver-cta-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem; }
.deliver-cta-fixed {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: #302b25;
  color: #fffaf3;
  font-size: 0.76rem;
  font-weight: 650;
  user-select: none;
}
.deliver-cta-note small { color: var(--admin-muted); font-size: 0.7rem; }
.deliver-options { display: grid; gap: 0.4rem; }
.deliver-hint { margin: 0; color: var(--admin-muted); font-size: 0.72rem; line-height: 1.45; }
.deliver-bubble {
  max-width: 26rem;
  padding: 0.85rem 1rem;
  border: 1px solid #efd8aa;
  border-radius: 1rem 1rem 1rem 0.3rem;
  background: #fffaf0;
  color: var(--admin-ink);
}
.deliver-bubble-from { margin: 0 0 0.35rem; color: #8a5c14; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; }
.deliver-bubble-text { margin: 0; font-size: 0.84rem; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.deliver-bubble-thumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.deliver-bubble-thumbs img { width: 4rem; height: 4rem; border: 1px solid var(--admin-line); border-radius: 0.5rem; background: var(--admin-paper); object-fit: cover; }
.deliver-bubble-more { display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 0.5rem; background: var(--admin-wash); color: var(--admin-muted); font-size: 0.8rem; font-weight: 650; }
.deliver-bubble-cta {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: linear-gradient(120deg, #f6d56a, #e8a838 48%, #c4841f);
  color: #1a140c;
  font-size: 0.82rem;
  font-weight: 700;
}
.deliver-sends-list { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.deliver-send-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.7rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.6rem;
  color: var(--admin-ink);
  font-size: 0.74rem;
}
.deliver-send-row > span:first-child { flex: 1 1 12rem; min-width: 0; }
.deliver-email-state { padding: 0.08rem 0.5rem; border: 1px solid var(--admin-line); border-radius: 999px; background: var(--admin-wash); color: var(--admin-muted); font-size: 0.64rem; font-weight: 650; white-space: nowrap; }
.deliver-email-state.is-sent { color: #21735c; background: #edf7f1; border-color: #cce8d8; }
.deliver-email-state.is-pending { color: #366790; background: #edf5fc; border-color: #d4e4f3; }
.deliver-email-state.is-failed { color: #a34d4c; background: #fff1ef; border-color: #f1d2cf; }
.deliver-email-state.is-skipped { color: #9b6821; background: #fff8e9; border-color: #efd8aa; }
.deliver-done { padding: 0.9rem; border: 1px solid #efdcb5; border-radius: 0.8rem; background: #fbf4e4; }
.deliver-done .deliver-section-title:focus:not(:focus-visible) { outline: none; }
.deliver-done-list { display: grid; gap: 0.3rem; margin: 0; padding: 0; border: 0; }
.deliver-done-list legend { margin-bottom: 0.3rem; padding: 0; color: var(--admin-muted); font-size: 0.72rem; font-weight: 650; }
.deliver-done .field { margin: 0; }
.deliver-done-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.deliver-foot {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--admin-line);
  background: var(--admin-paper);
}
.deliver-foot .btn-primary,
.deliver-foot .btn-secondary { padding: 0.6rem 1.2rem; font-size: 0.84rem; }
.deliver-more-wrap { position: relative; margin-right: auto; }
.deliver-more-menu {
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 0;
  z-index: 2;
  display: grid;
  min-width: 15rem;
  padding: 0.35rem;
  border: 1px solid var(--admin-line);
  border-radius: 0.75rem;
  background: var(--admin-paper);
  box-shadow: 0 14px 34px rgba(50, 35, 15, 0.16);
}
.deliver-menu-item {
  display: block;
  width: 100%;
  min-height: 2.4rem;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  color: var(--admin-ink);
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}
.deliver-menu-item:hover,
.deliver-menu-item:focus-visible { background: var(--admin-wash); }
.deliver-menu-item.is-danger { color: #a34d4c; }

@media (max-width: 640px) {
  .admin-dialog.deliver-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .deliver-shell { height: 100dvh; max-height: 100dvh; }
  .deliver-head { padding: 0.8rem 1rem 0.7rem; }
  .deliver-scroll { padding: 0.8rem 1rem 1rem; }
  .deliver-foot { padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px)); }
  .deliver-foot #deliver-send { flex: 1 1 100%; order: 3; }
  .deliver-dialog .archive-btn,
  .deliver-foot .btn-primary,
  .deliver-foot .btn-secondary,
  .deliver-menu-item { min-height: 2.75rem; }
  .deliver-close { width: 2.75rem; height: 2.75rem; }
  .deliver-include,
  .deliver-check { min-height: 2.75rem; }
  .deliver-angel { font-size: 1.12rem; }
  .deliver-thumb { width: 3.75rem; height: 3.75rem; }
  .deliver-more-menu { min-width: min(16rem, calc(100vw - 2rem)); }
  .requester-chip,
  .status-deliver { min-height: 2.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .deliver-progress.is-busy::before { animation: none; }
  .deliver-slot,
  .deliver-drop-label,
  button.requester-chip,
  .status-deliver { transition: none; }
}

/* Dark mode: graphic delivery. */
html[data-theme="dark"] button.requester-chip:hover { background: var(--admin-wash); border-color: var(--dark-focus); }
html[data-theme="dark"] .requester-copy small.requester-guest { color: #f1cb82; }
html[data-theme="dark"] .delivery-chip.is-draft,
html[data-theme="dark"] .thread-kind-tag,
html[data-theme="dark"] .thread-tag,
html[data-theme="dark"] .deliver-slot-state.is-ready,
html[data-theme="dark"] .deliver-warning,
html[data-theme="dark"] .deliver-email-state.is-skipped { color: #f1cb82; background: #44361d; border-color: #806635; }
html[data-theme="dark"] .delivery-chip.is-sent,
html[data-theme="dark"] .deliver-slot-state.is-sent,
html[data-theme="dark"] .deliver-email-state.is-sent,
html[data-theme="dark"] .deliver-status-line.is-success,
html[data-theme="dark"] .deliver-holder.is-mine { color: #a5eac9; background: #1b3d34; border-color: #386c58; }
html[data-theme="dark"] .delivery-chip.is-seen,
html[data-theme="dark"] .deliver-slot-state.is-busy,
html[data-theme="dark"] .deliver-email-state.is-pending,
html[data-theme="dark"] .deliver-banner.is-busy,
html[data-theme="dark"] .deliver-holder.is-stepin,
html[data-theme="dark"] .deliver-holder.is-other { color: #abd3f3; background: #243d53; border-color: #466a8a; }
html[data-theme="dark"] .delivery-chip.is-saved { color: var(--dark-surface); background: var(--dark-muted); border-color: var(--dark-muted); }
html[data-theme="dark"] .delivery-chip.is-change,
html[data-theme="dark"] .deliver-slot-state.is-needs,
html[data-theme="dark"] .deliver-email-state.is-failed { color: #f7b4b5; background: #4d2a32; border-color: #80515a; }
html[data-theme="dark"] .delivery-chip.is-replied { color: #d6c2f2; background: #372b4a; border-color: #5c4a78; }
html[data-theme="dark"] .status-deliver { color: #1a140c; background: #f1cb82; border-color: #f1cb82; }
html[data-theme="dark"] .status-deliver:hover { background: #f6d998; border-color: #f6d998; }
html[data-theme="dark"] .status-deliver:focus-visible,
html[data-theme="dark"] button.requester-chip:focus-visible,
html[data-theme="dark"] .deliver-drop-label:focus-within,
html[data-theme="dark"] .deliver-replace:focus-within { outline-color: #f1cb82; }
html[data-theme="dark"] .thread-bubble-eyebrow { color: #f7b4b5; }
html[data-theme="dark"] .owner-event-icon.is-deliver { color: #a5eac9; background: #1b3d34; }
html[data-theme="dark"] .owner-event-icon.is-withdraw { color: #f7b4b5; background: #4d2a32; }
html[data-theme="dark"] .owner-event-icon.is-reopen { color: #f1cb82; background: #44361d; }
html[data-theme="dark"] .deliver-close { background: var(--dark-control); }
html[data-theme="dark"] .deliver-close:hover { background: var(--admin-wash); border-color: var(--dark-focus); }
html[data-theme="dark"] .deliver-status-line.is-warn,
html[data-theme="dark"] .deliver-holder.is-open,
html[data-theme="dark"] .deliver-banner.is-guest,
html[data-theme="dark"] .deliver-done { color: #f1cb82; background: #3a2f1c; border-color: #6b5530; }
html[data-theme="dark"] .deliver-done .deliver-hint,
html[data-theme="dark"] .deliver-done-list legend { color: var(--admin-muted); }
html[data-theme="dark"] .deliver-holder.is-mine .mini-avatar { background: #2f7a62; }
html[data-theme="dark"] .deliver-holder.is-stepin .mini-avatar,
html[data-theme="dark"] .deliver-holder.is-other .mini-avatar { background: #3f6f96; }
html[data-theme="dark"] .deliver-stars { color: #f1cb82; }
html[data-theme="dark"] .deliver-slot.is-over { border-color: #f1cb82; box-shadow: 0 0 0 3px rgba(241, 203, 130, 0.2); }
html[data-theme="dark"] .deliver-change { color: #f7b4b5; background: #3a2328; border-color: #80515a; }
html[data-theme="dark"] .deliver-file.is-draft { border-color: #806635; background: #2e2619; }
html[data-theme="dark"] .deliver-include input,
html[data-theme="dark"] .deliver-check input { accent-color: #f1cb82; }
html[data-theme="dark"] .deliver-drop-label { border-color: rgba(241, 203, 130, 0.4); background: rgba(241, 203, 130, 0.05); }
html[data-theme="dark"] .deliver-drop-label:hover,
html[data-theme="dark"] .deliver-slot.is-over .deliver-drop-label { border-color: #f1cb82; background: rgba(241, 203, 130, 0.1); }
html[data-theme="dark"] .deliver-progress.is-error { color: #f5a9ad; }
html[data-theme="dark"] .deliver-cta-fixed { color: #1a140c; background: #f1cb82; }
html[data-theme="dark"] .deliver-bubble { border-color: #806635; background: #342e24; }
html[data-theme="dark"] .deliver-bubble-from { color: #f1cb82; }
html[data-theme="dark"] .deliver-more-menu { box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5); }
html[data-theme="dark"] .deliver-menu-item.is-danger { color: #f7b4b5; }
