/* settings-writing-style.css — Settings → Writing style.
 *
 * Everything here is namespaced `cbws-` and scoped to the page, so it cannot
 * reach any other settings screen. Colours come from the app-shell tokens
 * (--text-1/2/3, --line, --surface, --warn-soft) rather than literals, so the
 * page follows the shell rather than pinning its own palette next to it.
 *
 * ⚠️ NO NEW COMPONENT WHERE ONE EXISTS. The buttons are `.btn`/.btn-secondary,
 * the "we could not read this" states are `.empty-block`, and the page head is
 * the standard .page-head/.display/.sub markup in app.html. What is defined
 * here is only the thing that genuinely did not exist before: a rule row that
 * shows a rule and then shows it working.
 */

#writing-style-content {
  max-width: 780px;
}

.cbws-intro {
  border: 1px solid var(--line, #e5e7eb);
  background: var(--surface-2, #f9fafb);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2, #374151);
  margin-bottom: 22px;
}

.cbws-rules {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cbws-rule {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 9px;
  background: var(--surface, #fff);
  overflow: hidden;
}

/* The name and its two labels share a row and stay on one line each; the name
   is what wraps, because a wrapped "Set by us" reads as a fault. `min-width: 0`
   is doing real work — without it the name refuses to shrink below its content
   width and pushes the labels out of the card. */
.cbws-rule-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 13px 16px 0;
}
.cbws-rule-name {
  font-weight: 650;
  font-size: 15px;
  color: var(--text-1, #111827);
  min-width: 0;
}
.cbws-rule-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--text-3, #6b7280);
  white-space: nowrap;
}
.cbws-who { font-weight: 600; color: var(--text-2, #374151); }
.cbws-where {
  background: var(--surface-2, #f3f4f6);
  border-radius: 999px;
  padding: 2px 9px;
}

.cbws-rule-body {
  padding: 5px 16px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2, #4b5563);
  max-width: 64ch;
}

/* ── The rule doing its job ────────────────────────────────────────────────
   Two lines, labelled, with the before greyed and the after in full ink so the
   eye lands on the version they will actually get. */
.cbws-demo {
  margin: 0 16px 15px;
  border-top: 1px solid var(--line-soft, #f3f4f6);
  padding-top: 12px;
  display: grid;
  gap: 7px;
  font-size: 13px;
}
.cbws-demo-line {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}
.cbws-lab {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-3, #9ca3af);
}
.cbws-was { color: var(--text-3, #9ca3af); }
.cbws-now { color: var(--text-1, #111827); }

/* On a narrow screen the label sits above its line rather than squeezing the
   sentence into a column too thin to read. */
@media (max-width: 560px) {
  .cbws-demo-line { grid-template-columns: 1fr; gap: 2px; }
}

/* The clash between a coach's rule and one of ours. Amber, which is the
   shell's own "read this" colour, and never red: nothing has gone wrong and
   nobody needs alarming. */
.cbws-clash {
  margin: 0 16px 15px;
  padding: 11px 13px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #92400e;
  max-width: 62ch;
}

.cbws-sect {
  margin: 28px 0 12px;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-3, #9ca3af);
}

/* Dashed, not solid: this is a space waiting to be filled rather than a card
   reporting something. */
.cbws-empty {
  border: 1px dashed var(--line-strong, #d1d5db);
  border-radius: 9px;
  padding: 20px;
  background: var(--surface-2, #fafafa);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2, #4b5563);
  max-width: 64ch;
}
.cbws-empty ul {
  margin: 11px 0 15px;
  padding-left: 19px;
  display: grid;
  gap: 6px;
}
.cbws-empty li { color: var(--text-1, #374151); }

/* ── Writing one ──────────────────────────────────────────────────────────
   Added 2026-08-18 when Alex asked the obvious question the read-only version
   had no answer to: "what's my UI when I actually do want to make my
   suggestions?" One box, no taxonomy — the store's four categories are read
   identically, so asking a coach to file their own preference into one of them
   is overhead for them that buys us nothing. */

.cbws-editor { padding: 0 16px 15px; }
.cbws-empty .cbws-editor { padding: 0; margin-top: 4px; }

.cbws-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1, #111827);
  background: var(--surface, #fff);
  border: 1px solid var(--line-strong, #d1d5db);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 74px;
}
.cbws-input:focus-visible {
  outline: 2px solid var(--accent, #111827);
  outline-offset: 1px;
  border-color: transparent;
}

.cbws-editor-row {
  display: flex;
  gap: 9px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Quiet text buttons, because Edit and Remove sit inside a card whose job is
   to be read. Two solid buttons per rule would make a list of three rules look
   like a control panel. */
.cbws-acts {
  display: flex;
  gap: 16px;
  padding: 0 16px 13px;
}
.cbws-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3, #6b7280);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cbws-link:hover { color: var(--text-1, #111827); }
.cbws-link:focus-visible { outline: 2px solid var(--accent, #111827); outline-offset: 2px; border-radius: 2px; }

/* Asked inline rather than in a browser confirm(): a native dialog here reads
   as the browser complaining rather than us asking. */
.cbws-confirm {
  margin: 0 16px 15px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong, #d1d5db);
  border-radius: 8px;
  background: var(--surface-2, #f9fafb);
  font-size: 13.5px;
  color: var(--text-2, #374151);
  max-width: 62ch;
}

.cbws-add { margin-top: 14px; }

/* Said once, under the thing it happened to. A toast would be gone before a
   coach reading carefully had looked up. */
.cbws-msg {
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--text-2, #374151);
  padding: 10px 13px;
  background: var(--surface-2, #f9fafb);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  max-width: 62ch;
}

/* ── Suggestions ──────────────────────────────────────────────────────────
   🔻 Added 2026-08-18 on Alex's ruling that nothing platform-level decides how
   a coach writes. What used to be an unremovable "our rules" section is now an
   offer: visibly not in force, one button to take it, and once taken it is
   simply one of their own rules. */
.cbws-offer { border-style: dashed; background: var(--surface-2, #fafafa); }
.cbws-off {
  font-weight: 600;
  color: var(--text-3, #6b7280);
  background: var(--surface-2, #f3f4f6);
  border-radius: 999px;
  padding: 2px 9px;
}
.cbws-offer .cbws-acts { padding: 0 16px 15px; }

/* Said on a rule of THEIRS that we also check mechanically. Quiet: it is a
   footnote about how well we keep their instruction, not a status. */
.cbws-checked {
  margin: 0 16px 14px;
  font-size: 12.5px;
  color: var(--text-3, #6b7280);
}

/* ── Maya's Brain (step 4.1): the four cards, tabs, facts, palettes ──────
   Same namespace, same token discipline. The rule row above is unchanged —
   it simply now lives inside the "How you write" card. */
.cbws-card {
  border: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #fff);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.cbws-card-head {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
}
.cbws-card-note {
  font-size: 13px;
  color: var(--text-3, #8a8f98);
  line-height: 1.5;
  margin-top: 6px;
}
.cbws-facts { display: grid; gap: 8px; }
.cbws-fact { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.45; }
.cbws-fact-k {
  flex: none; width: 170px; color: var(--text-3, #8a8f98);
  font-size: 12px; font-weight: 600; padding-top: 1px;
}
.cbws-fact-v { flex: 1; min-width: 0; color: var(--text-1, #111827); }
@media (max-width: 640px) {
  .cbws-fact { flex-direction: column; gap: 2px; }
  .cbws-fact-k { width: auto; }
}
.cbws-pal { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cbws-pal-name { font-size: 13.5px; }
.cbws-pal-chips { display: inline-flex; gap: 4px; }
.cbws-chip {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--line, #e5e7eb); display: inline-block;
}
.cbws-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.cbws-tab {
  border: 1px solid var(--line, #e5e7eb); background: transparent;
  border-radius: 20px; padding: 5px 13px; font-size: 12.5px; font-weight: 600;
  color: var(--text-2, #374151); cursor: pointer;
}
.cbws-tab.on {
  background: var(--accent, #6a4cf1); border-color: var(--accent, #6a4cf1);
  color: #fff;
}

/* ── Maya screen additions (approved mockup, 2026-08-22) ─────────────────
   Edit-from-here on the fact rows, the "used going forward" line, and the
   How-you-look mini page: the colours shown doing their actual jobs, each
   role named in the DIY palette panel's own words. */
.cbws-fact-act { flex: none; margin-left: auto; }
.cbws-fact-empty .cbws-fact-v { color: var(--text-3, #98a0ab); font-style: italic; }
.cbws-fwd {
  font-size: 12px; color: var(--text-3, #8a8f98);
  border-top: 1px dashed var(--line, #e5e7eb); margin-top: 12px; padding-top: 9px;
}

.mlk-wrap { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; margin-top: 10px; }
@media (max-width: 720px) { .mlk-wrap { grid-template-columns: 1fr; } }
.mlk-site { border: 1px solid var(--line, #e5e7eb); border-radius: 12px; overflow: hidden; font-size: 12px; }
.mlk-nav { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid; }
.mlk-logo { height: 22px; max-width: 110px; object-fit: contain; }
.mlk-logotext { font-weight: 700; font-size: 13px; }
.mlk-logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* Her sources (11.8) — kind headers carry their own On/Off */
.mss-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mss-kind { min-width: 52px; }
.mss-kind.on { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .4); color: #16813c; }
.mlk-navcta { color: #fff; border-radius: 7px; padding: 4px 10px; font-size: 11px; font-weight: 600; }
.mlk-hero { padding: 18px 16px 20px; }
.mlk-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mlk-h1 { font-size: 19px; font-weight: 700; line-height: 1.25; margin: 6px 0; }
.mlk-lede { font-size: 12px; line-height: 1.5; }
.mlk-ctas { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.mlk-btn { color: #fff; border-radius: 8px; padding: 7px 12px; font-size: 11.5px; font-weight: 600; }
.mlk-link { font-size: 11.5px; font-weight: 600; text-decoration: underline; }

.mlk-roles { display: flex; flex-direction: column; gap: 8px; }
.mlk-pname { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.mlk-role { display: flex; align-items: center; gap: 10px; }
.mlk-pick {
  width: 30px; height: 30px; border-radius: 8px; flex: none; cursor: pointer;
  border: 1px solid rgba(0,0,0,.14); position: relative; overflow: hidden;
}
.mlk-pick input[type=color] { position: absolute; inset: -8px; width: 46px; height: 46px; opacity: 0; cursor: pointer; }
.mlk-role-t { flex: 1; min-width: 0; }
.mlk-role-n { font-size: 12.5px; font-weight: 600; }
.mlk-role-d { font-size: 11px; color: var(--text-3, #8a8f98); }
.mlk-hex { font-size: 10.5px; color: var(--text-3, #98a0ab); font-family: ui-monospace, monospace; }

/* Maya pointing at an existing rule ("where in the rules?") */
.cbws-rule.cbws-hl {
  border-color: var(--accent, #6a4cf1);
  box-shadow: 0 0 0 3px rgba(106, 76, 241, .18);
  animation: cbws-hl-pulse 1.2s ease-in-out 2;
}
@keyframes cbws-hl-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(106, 76, 241, .18); }
  50% { box-shadow: 0 0 0 7px rgba(106, 76, 241, .05); }
}

/* Page-level tabs (the four-tab split, 2026-08-22) */
.cbws-page-tabs { margin: 0 0 16px; }
.cbws-page-tabs .cbws-tab { font-size: 13px; padding: 7px 16px; }

/* Her-settings rows (Preferred tone / Message length, per surface) */
.ms-setting { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line, #e5e7eb); border-radius: 11px; padding: 10px 13px; margin-top: 8px; background: var(--surface, #fff); }
.ms-setting-k { font-weight: 600; font-size: 13px; width: 120px; flex: none; padding-top: 1px; }
.ms-setting-v { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2, #4d5168); }
.ms-setting-unset { color: var(--text-3, #98a0ab); font-style: italic; }
.ms-setting-src { flex: none; font-size: 10.5px; border-radius: 999px; padding: 2px 8px; font-weight: 600; }
.ms-setting-src.own { background: var(--accent-soft, #efeaff); color: var(--accent-deep, #4a32b8); }
.ms-setting-src.inherit { background: rgba(0,0,0,.05); color: var(--text-3, #8a8fa6); }
.cbws-rules-inherited { opacity: .85; }

/* The write tab's area chooser (checklist 11.2) */
.mar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
@media (max-width: 640px) { .mar-grid { grid-template-columns: repeat(2, 1fr); } }
.mar-card { border: 1px solid var(--line, #e5e7eb); border-radius: 12px; padding: 12px; background: var(--surface, #fff); cursor: pointer; text-align: left; position: relative; }
.mar-card:hover { border-color: var(--accent, #6a4cf1); }
.mar-name { font-weight: 700; font-size: 13.5px; }
.mar-sub { font-size: 11px; color: var(--text-3, #8a8fa6); margin-top: 2px; }
.mar-net { height: 44px; margin-top: 8px; width: 100%; }
.mar-count { position: absolute; top: 10px; right: 10px; font-size: 10.5px; color: var(--accent-deep, #4a32b8); background: var(--accent-soft, #efeaff); border-radius: 999px; padding: 2px 8px; font-weight: 600; }
.mar-open-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mar-open-title { font-weight: 700; font-size: 15px; }

/* What-she-knows restyle (checklist 11.3) */
.mk-progress { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.mk-progress-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3, #f1eee5); overflow: hidden; }
.mk-progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent, #6a4cf1), #8b6dff); }
.mk-progress-n { font-size: 11.5px; color: var(--text-3, #8a8fa6); font-weight: 600; flex: none; }
.mk-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.mk-answer { border: 1px solid var(--line, #e5e7eb); border-radius: 11px; padding: 10px 12px; margin-top: 10px; background: var(--surface, #fff); }
.mk-answer-label { font-size: 11px; color: var(--text-3, #8a8fa6); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px; }

/* Language chooser (12.3) — Everything only */
.ms-lang-row { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ms-lang.on { background: rgba(106, 76, 241, .12); border-color: var(--accent, #6a4cf1); color: var(--accent, #6a4cf1); font-weight: 600; }
