/* DM Campaigns — app layout and page-specific rules on top of organic.css (the design system).
   Implements the "1a Workbench" shell and the "2a message composer" from the Claude Design project
   (docs/superpowers/specs/2026-09-11-organic-ui-design.md). Take colours, fonts, radii and shadows
   from the tokens; never hard-code them here. */

/* — shell: sidebar + main — */
html { height: 100%; }
body { min-height: 100vh; display: grid; grid-template-columns: 196px minmax(0, 1fr); }
.side { display: flex; flex-direction: column; gap: 28px; padding: 28px 14px; background: var(--color-neutral-200); position: sticky; top: 0; height: 100vh; }
.side .brand { font-family: var(--font-heading); font-size: 19px; padding: 0 12px; color: inherit; text-decoration: none; white-space: nowrap; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a { text-decoration: none; color: inherit; border-radius: 999px; padding: 9px 14px; }
.side nav a:hover { background: var(--color-neutral-300); }
.side nav a[aria-current="page"] { color: var(--color-accent-800); background: var(--color-accent-200); font-weight: 600; }
.side .who { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 12px; font-size: 13px; }
.who .me { display: flex; flex-direction: column; }
.who .name { font-weight: 600; overflow-wrap: anywhere; }
.who form { display: inline; }
.who .link { font-size: 12px; }
/* the extension badge is a dot + text in the sidebar, whatever .badge class bridge.js sets */
.side .badge, .side .badge.ok, .side .badge.warn, .side .badge.err { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; background: none; color: inherit; padding: 0; letter-spacing: 0; opacity: 1; }
.side .badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--color-neutral-400); flex: none; }
.side .badge.ok::before { background: var(--color-accent-2-500); }
.side .badge.warn::before { background: var(--color-accent-400); }
.side .badge.err::before { background: var(--color-accent-700); }
main { padding: 36px 40px; display: flex; flex-direction: column; gap: 24px; min-width: 0; max-width: 1280px; }
.banner { background: var(--color-accent-200); color: var(--color-accent-900); border-radius: var(--radius-md); padding: 12px 18px; font-size: 14px; }
.banner .link { color: var(--color-accent-900); font-weight: 600; }

/* — type and links — */
a { color: var(--color-accent-700); }
a:hover { color: var(--color-accent-800); }
.back { font-size: 13px; text-decoration: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1, h1.page { font-size: 36px; margin: 0; }
.page-head .sub { display: block; opacity: .6; font-size: 14px; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row.baseline { align-items: baseline; }
.title-row h1 { font-size: 32px; margin: 0; line-height: 1.1; }
.card h2 { font-size: 20px; margin: 0; }
.card h2 .opt { font-family: var(--font-body); font-size: 13px; opacity: .6; }
.meta { display: flex; gap: 18px; font-size: 13px; opacity: .75; flex-wrap: wrap; }
.meta a { color: inherit; }
.kicker { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .6; }
.strong { font-weight: 600; color: inherit; text-decoration: none; }
.dim { opacity: .6; }
.dim13 { font-size: 13px; opacity: .7; }
.dim12 { font-size: 12px; opacity: .6; }
.sm { font-size: 13px; }
.sub { display: block; font-size: 11px; opacity: .55; }
.muted { opacity: .6; }
.err { color: var(--color-accent-800); }
.ml-auto { margin-left: auto; }
.ta-r { text-align: right; }
.stack1, .stack8, .stack16 { display: flex; flex-direction: column; }
.stack1 { gap: 2px; align-items: flex-start; } .stack8 { gap: 8px; } .stack16 { gap: 16px; }
.stack1 > .link { text-align: left; }
.between { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
p.muted, p.err { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
mark.v { background: var(--color-accent-2-200); color: inherit; border-radius: 6px; padding: 0 3px; }

/* — cards (the design's 28px cards; the DS default is a smaller content card) — */
.card { border-radius: 28px; padding: 24px 28px; gap: 16px; margin: 0; }
.card.tight { padding: 8px 20px 12px; }
.card.soft { background: var(--color-neutral-100); }
.card.tint { background: var(--color-accent-2-200); color: var(--color-accent-2-900); gap: 10px; font-size: 13px; }
.card.tint .kicker { opacity: 1; }
.card.aside-card { border-radius: 24px; padding: 20px 18px; gap: 12px; }
details.card { display: block; }
details.card > *:not(summary) { margin-top: 16px; }
summary { cursor: pointer; }
summary > h2 { display: inline; }
summary .dim13 { display: block; margin-left: 1.25em; }
.narrow { max-width: 420px; margin: 60px auto; width: 100%; }

/* — two-column page body with a sticky helper column — */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: start; }
.two-col.wide { grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 16px; }
.two-col .aside { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 24px; }
.aside .btn-block { margin: 0; padding: 12px; }

/* — stat cards — */
.stats { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; }
.stat { background: var(--color-surface); border-radius: 24px; padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stat .num { font-family: var(--font-heading); font-size: 40px; line-height: 1; }
.stat .num small { font-size: 16px; opacity: .5; font-family: var(--font-body); }
.stat .sub { font-size: 12px; opacity: .6; }
.stat .numrow { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.stat.done .kicker { color: var(--color-accent-700); opacity: 1; }
.stat.call { background: var(--color-accent-200); color: var(--color-accent-900); }
.stat.call .kicker, .stat.call .sub { color: var(--color-accent-800); opacity: 1; }

/* — progress bars — */
.bar { height: 8px; border-radius: 999px; background: var(--color-neutral-300); overflow: hidden; }
.bar > div { height: 100%; border-radius: 999px; background: var(--color-accent-2-500); width: 0; transition: width .3s; }
.bar.thick { height: 10px; }

/* — buttons: app sizes and the text-link button used in table rows — */
.btn.sm { font-size: 13px; padding: 6px 12px; }
.btn-primary { color: var(--color-bg); }
.link { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--color-accent-700); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; color: var(--color-accent-800); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.group { display: flex; flex-direction: column; gap: 8px; }
.toolrow { display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--color-divider); padding-top: 14px; font-size: 13px; flex-wrap: wrap; }
.toolrow .right { margin-left: auto; display: flex; gap: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--color-accent); }

/* — badges (status tags rendered by the scripts) — */
.badge { display: inline-flex; align-items: center; font-size: 11px; letter-spacing: .02em; padding: 3px 10px; border-radius: 999px; background: var(--color-neutral-100); color: var(--color-neutral-800); width: max-content; }
.badge.ok { background: var(--color-accent-2-200); color: var(--color-accent-2-900); }
.badge.warn { background: var(--color-accent-200); color: var(--color-accent-900); }
.badge.err { background: var(--color-accent-300); color: var(--color-accent-900); }
.badge.muted { opacity: .75; }
.note-warn { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; background: var(--color-accent-200); color: var(--color-accent-900); font-size: 12px; }

/* — forms — */
.field { position: relative; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline > label { margin: 0; }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23645c50' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; }
textarea.input { border-radius: 20px; }
input[type="date"].input { min-width: 0; }
.search { position: relative; }
.search > svg { position: absolute; left: 14px; top: 11px; opacity: .5; pointer-events: none; }
.search .input { padding-left: 36px; }
.suggest { position: absolute; left: 0; right: 0; margin-top: 4px; background: var(--color-neutral-100); border: 1px solid var(--color-divider); border-radius: 16px; z-index: 5; max-height: 220px; overflow: auto; box-shadow: var(--shadow-md); font-size: 14px; }
.suggest div { padding: 8px 14px; cursor: pointer; }
.suggest div:hover { background: var(--color-neutral-200); }
.hours { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.hours .input { width: 80px; }
.timing { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--color-divider); padding-top: 16px; }

/* segmented controls: the input covers its label (opacity 0, not zero-sized) so a click — a
   person's or a test's — lands on the radio itself */
.seg-opt { position: relative; }
.seg-opt input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; pointer-events: auto; }
.seg-opt .n { opacity: .7; }
.seg-opt:has(input:checked) .n { opacity: .85; }
.seg a.seg-opt { color: inherit; text-decoration: none; }
.seg a.seg-opt.on { background: var(--color-accent); color: var(--color-bg); }
.seg a.seg-opt:not(.on):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }

/* — chips (picker) — */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--color-bg); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; }
.chip button { border: 0; background: var(--color-neutral-300); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; padding: 0; color: inherit; font-size: 13px; line-height: 1; }
.chip button:hover { background: var(--color-neutral-400); }
.pk-pane { max-width: 420px; }

/* — tables — */
.table td { vertical-align: middle; }
.table .sub { margin-top: 1px; }
.table td.sm { font-size: 13px; }
.person { display: flex; align-items: center; gap: 10px; }
.person .nm { font-weight: 600; }
.person .id { font-size: 11px; opacity: .5; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-family: var(--font-heading); font-size: 12px; color: var(--color-bg); background: var(--color-accent-500); flex: none; }
.avatar.c1 { background: var(--color-accent-2-500); }
.avatar.c2 { background: var(--color-neutral-600); }
.avatar.c3 { background: var(--color-accent-700); }
.r-done.ok { font-weight: 600; color: var(--color-accent-2-700); }
.r-done.dim { font-weight: 600; }
td .link { font-size: 13px; white-space: nowrap; }

/* — the post list on the new-campaign page: rounded rows — */
table.posts { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 13px; table-layout: fixed; }
table.posts td { padding: 10px 8px; background: var(--color-bg); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.posts td:first-child { border-radius: 16px 0 0 16px; padding-left: 14px; }
table.posts td:last-child { border-radius: 0 16px 16px 0; padding-right: 14px; text-align: right; }
table.posts tr.chosen td { background: var(--color-accent-2-200); }
table.posts .link { font-weight: 600; }
.chosen { padding: 10px 14px; background: var(--color-accent-2-200); color: var(--color-accent-2-900); border-radius: 16px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chosen .link { color: var(--color-accent-2-900); font-weight: 600; }

/* — message composer (2a) — */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.editor { display: flex; flex-direction: column; min-width: 0; background: var(--color-bg); border: 1px solid var(--color-divider); border-radius: 22px; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--color-divider); flex-wrap: wrap; }
.toolbar .btn-icon { width: 32px; height: 32px; font-family: var(--font-body); font-size: 14px; }
.toolbar .btn-icon.mono { font-family: ui-monospace, monospace; font-size: 13px; }
.toolbar .btn-icon:hover { background: var(--color-neutral-200); }
.toolbar .sep { width: 1px; height: 18px; background: var(--color-divider); margin: 0 6px; }
.toolbar .hint { margin-left: auto; font-size: 11px; opacity: .5; padding-right: 6px; white-space: nowrap; }
.editor textarea { flex: 1; min-height: 220px; width: 100%; border: 0; background: transparent; padding: 16px 18px; font: inherit; font-size: 15px; line-height: 1.55; resize: vertical; color: inherit; outline: none; }
.editor .foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--color-divider); flex-wrap: wrap; font-size: 12px; }
.var { background: var(--color-accent-2-200); color: var(--color-accent-2-900); font-family: ui-monospace, monospace; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 0; cursor: pointer; }
.var:hover { background: var(--color-accent-2-300); }
.preview { display: flex; flex-direction: column; gap: 10px; min-width: 0; background: var(--color-neutral-100); border-radius: 22px; padding: 16px 18px; }
.preview .head { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.preview .head select.input { min-height: 26px; padding: 2px 26px 2px 10px; font-size: 12px; width: auto; background-color: var(--color-bg); }
.msg { display: flex; gap: 10px; align-items: flex-start; flex: 1; }
.msg .avatar { border-radius: 10px; width: 36px; height: 36px; font-size: 13px; background: var(--color-accent-400); }
.msg .body { display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.5; min-width: 0; }
.msg .from { display: flex; gap: 8px; align-items: baseline; }
.msg .ts { font-size: 11px; opacity: .5; }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .text code { background: var(--color-neutral-200); border-radius: 6px; padding: 0 4px; font-size: 13px; }
.reaction { display: inline-flex; align-items: center; gap: 4px; background: var(--color-bg); border: 1px solid var(--color-divider); border-radius: 999px; padding: 1px 8px; font-size: 12px; }

/* — timeline card (new campaign) and the message-text card (campaign) — */
.tl { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.tl div { display: flex; flex-direction: column; gap: 1px; }
.tl b { font-weight: 600; }
#template { margin: 0; font: inherit; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* — hidden always wins (found by the e2e suite: a display rule once beat [hidden]) — */
[hidden] { display: none !important; }

/* — narrow screens — */
@media (max-width: 1000px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .two-col, .two-col.wide, .composer { grid-template-columns: 1fr; }
  .two-col .aside { position: static; }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  body { display: block; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 14px 16px; gap: 14px; }
  .side nav { flex-direction: row; }
  .side .who { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; padding: 0; }
  .who .me { flex-direction: row; gap: 8px; align-items: baseline; }
  main { padding: 20px 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}
