.rules-heading h2 { font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 500; }
.rules-heading p { max-width: 70ch; }
.rules-project-control { max-width: 440px; margin: 24px 0; }
.rules-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--line); }
.rules-tabs button { color: var(--muted); background: transparent; border-radius: 0; padding: 13px 16px; border-bottom: 3px solid transparent; }
.rules-tabs button[aria-selected="true"] { color: var(--ink); background: var(--accent); border-bottom-color: var(--ink); }
.rules-tabs button:hover { color: var(--ink); background: #eee5ed; }
.rules-tabs button[aria-selected="true"]:hover { background: var(--accent); }
.rules-panel { padding: 18px 0; }
.rules-panel > p { max-width: 74ch; }
.rules-controls { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.rules-controls label { min-width: 0; }
.rules-list-heading { display: flex; gap: 20px; align-items: center; justify-content: space-between; margin: 24px 0 8px; }
.rules-list-heading h3 { margin: 0; }
.rule-card-heading { display: flex; gap: 16px; align-items: baseline; justify-content: space-between; }
.rule-card-heading h3 { font-size: 17px; margin: 0; }
.rule { padding: 22px 0; border-top: 1px solid var(--line); }
.rule p { max-width: 74ch; white-space: pre-wrap; line-height: 1.6; }
.rule details { margin: 12px 0; border: 0; padding: 0; }
.rule button { font-size: 13px; }
.rules-footnote { font-size: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
#rules-topic-platform-label { grid-column: 1/-1; }
@media(max-width:550px) { .rules-controls { grid-template-columns: 1fr; gap: 0; } .rules-tabs button { flex: 1 0 45%; } .rules-list-heading,.rule-card-heading { align-items: flex-start; flex-direction: column; gap: 12px; } }

.profile-body { white-space: pre-wrap; overflow-wrap: anywhere; }

#rule-history-list details { margin: 16px 0; padding: 16px 0; border-top: 1px solid var(--line); }
#rule-history-title { overflow-wrap: anywhere; }

/* One rule per row; details and editing live in the rule dialog. */
.rules-audience-tabs { display:flex; flex-wrap:wrap; gap:6px; border-bottom:1px solid var(--line); margin:22px 0; }
.rules-audience-tabs button { background:transparent; color:var(--muted); border-radius:0; border:0; border-bottom:3px solid transparent; padding:12px 17px; }
.rules-audience-tabs button[aria-selected="true"] { background:var(--accent); color:var(--ink); border-bottom-color:var(--plum); }
.rules-controls { display:flex; flex-wrap:wrap; gap:16px; margin:18px 0; }
.rules-controls label { max-width:320px; }
.rule-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:18px; align-items:center; padding:17px 0; }
.rule-row .rule-open { border:0; background:transparent; color:var(--ink); padding:0; text-align:left; font-size:16px; font-weight:600; overflow-wrap:anywhere; }
.rule-row .rule-open:hover { color:var(--plum); }
.rule-row .field-hint { margin:4px 0 0; font-size:13px; }
.rule-row .rule-menu { position:relative; margin:0; }
.rule-menu summary { list-style:none; font-size:23px; padding:4px 12px; }
.rule-menu summary::-webkit-details-marker { display:none; }
.rule-menu > div { position:absolute; right:0; top:100%; z-index:4; background:var(--paper); border:1px solid var(--line); border-radius:4px; padding:5px; width:220px; box-shadow:0 5px 20px #0002; }
.rule-menu button { display:block; width:100%; text-align:left; border:0; }
.rule-editor-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
#rule-detail-body { margin:22px 0; line-height:1.6; }
#rule-detail-title { overflow-wrap:anywhere; }
#rule-detail-dialog > .toolbar { justify-content:flex-end; border-top:1px solid var(--line); padding-top:18px; }
#rule-detail-dialog, #instruction-dialog { width:min(690px,calc(100% - 28px)); }
@media(max-width:550px) { .rule-editor-fields { grid-template-columns:1fr; gap:0; } .rules-audience-tabs button { flex:1; } .rule-row .rule-menu > div { width:200px; } }

.rules-controls label { display:flex; align-items:center; gap:10px; font-size:13px; }
.rules-controls select { margin:0; width:auto; min-width:180px; padding-top:7px; padding-bottom:7px; }
.rules-list-heading h3 { font-size:20px; }
.rule-row { grid-template-columns:minmax(0,1fr) 172px 44px; }
.rule-row > div { display:contents; }
.rule-row .field-hint { margin:0; }
@media(max-width:650px) { .rule-row { grid-template-columns:minmax(0,1fr) 44px; gap:6px; } .rule-row .field-hint { grid-column:1; grid-row:2; } .rule-row .rule-menu { grid-column:2; grid-row:1 / 3; } }

/* Article profiles share the compact list and dialog pattern with rules. */
.profile-row { display:grid; grid-template-columns:minmax(0,1fr) 150px 44px; gap:18px; align-items:center; padding:17px 0; }
.profile-open { border:0; background:transparent; color:var(--ink); padding:0; text-align:left; font-size:16px!important; font-weight:600; overflow-wrap:anywhere; }
.profile-open:hover { color:var(--plum); }
.profile-row .profile-description { margin:4px 0 0; font-size:13px; line-height:1.5; }
.profile-default { grid-column:2; font-size:12px; text-align:center; background:var(--accent); color:var(--plum); padding:4px 9px; border-radius:3px; }
.profile-row .rule-menu { grid-column:3; margin:0; position:relative; }
.profile-default-help { margin-top:20px; padding-top:16px; border-top:1px solid var(--line); font-size:13px; }
#article-profile-list { margin-top:20px; }
#article-profile-dialog { width:min(700px,calc(100% - 28px)); }
#article-profile-dialog-title { overflow-wrap:anywhere; }
#article-profile-description { margin:20px 0; }
#article-profile-body { line-height:1.6; margin-bottom:22px; }
#article-profile-view h3 { font-size:15px; }
#article-profile-view > .toolbar { border-top:1px solid var(--line); padding-top:18px; justify-content:flex-end; }
#profile-view-archive { margin-top:14px; }
@media(max-width:650px) { .profile-row { grid-template-columns:minmax(0,1fr) 44px; gap:8px; } .profile-row-main { grid-column:1; } .profile-default { grid-column:1; grid-row:2; justify-self:start; } .profile-row .rule-menu { grid-column:2; grid-row:1 / 3; } }

#style-sample-dialog { width:min(690px,calc(100% - 28px)); }
#style-sample-dialog-title { overflow-wrap:anywhere; }
#style-sample-body { line-height:1.6; }
.style-sample-empty { text-align:center; padding:28px 12px; border-block:1px solid var(--line); }
.style-sample-fallback { border-top:1px solid var(--line); padding-top:18px; margin-top:20px; }
#style-sample-default { padding:0; background:transparent; border:0; color:var(--plum); text-align:left; overflow-wrap:anywhere; }
#style-sample-form .sample-active { display:flex; align-items:center; gap:10px; }
.sample-active input { width:auto; margin:0; }
.sample-methods button[aria-pressed="true"] { background:var(--accent); color:var(--ink); }
.style-sample-row { grid-template-columns:minmax(0,1fr) auto; }
.style-sample-row > div { display:block; min-width:0; }
.style-sample-row .field-hint { margin-top:5px; }
@media(max-width:550px) { .style-sample-row { grid-template-columns:minmax(0,1fr); gap:8px; } .style-sample-row .status { justify-self:start; } }

/* Registered destinations open one compact settings dialog. */
.platform-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:18px; align-items:center; padding:18px 0; border-top:1px solid var(--line); }
.platform-open { padding:0; border:0; background:transparent; color:var(--plum); font-size:16px; font-weight:600; text-align:left; overflow-wrap:anywhere; }
.platform-row .field-hint, .platform-sample-row .field-hint { margin:5px 0 0; }
.platform-sample-row { padding:15px 0; border-top:1px solid var(--line); }
#platform-detail-dialog { width:min(740px,calc(100% - 28px)); }
#platform-detail-title { overflow-wrap:anywhere; }
.platform-detail-tabs { display:flex; flex-wrap:wrap; border-bottom:1px solid var(--line); margin:20px 0; }
.platform-detail-tabs button { background:transparent; color:var(--muted); border:0; border-radius:0; padding:11px 16px; border-bottom:3px solid transparent; }
.platform-detail-tabs button[aria-selected="true"] { background:var(--accent); color:var(--ink); border-bottom-color:var(--plum); }
#platform-detail-dialog .rule-row { grid-template-columns:minmax(0,1fr) 44px; gap:6px 16px; }
#platform-detail-dialog .rule-row .field-hint { grid-column:1; grid-row:2; }
#platform-detail-dialog .rule-menu { grid-column:2; grid-row:1 / 3; }
@media(max-width:550px) { .platform-row { gap:12px; } .platform-row > div { min-width:0; } }

/* Text actions stay readable; the global filled-button hover is inappropriate here. */
.platform-open:hover, .platform-open:focus-visible,
.profile-open:hover, .profile-open:focus-visible,
.rule-row .rule-open:hover, .rule-row .rule-open:focus-visible,
#style-sample-default:hover, #style-sample-default:focus-visible {
  background:transparent;
  color:var(--plum);
  text-decoration:underline;
  text-underline-offset:3px;
}

/* Topic requirements are grouped by existing material, with optional details in a dialog. */
.topic-base {border-left:3px solid var(--line);padding-left:16px;margin:24px 0 30px;}
.topic-count {font-size:.85rem;color:var(--plum);background:var(--accent);padding:4px 8px;white-space:nowrap;}
#topic-requirements-list {margin-top:24px;}
#topic-requirements-dialog {width:min(860px,calc(100vw - 40px));}
#topic-requirements-dialog .rule-row {grid-template-columns:minmax(0,1fr) auto;}
#topic-requirements-dialog .rule-row .field-hint {grid-column:1;grid-row:2;}
#topic-requirements-dialog .rule-menu {grid-column:2;grid-row:1 / span 2;}
#topic-requirement-form details {border-top:1px solid var(--line);padding-top:16px;margin-top:20px;}
#topic-requirements-dialog h2,#topic-requirements-list .platform-open {overflow-wrap:anywhere;}
@media(max-width:550px) {#topic-requirements-list .platform-row {grid-template-columns:minmax(0,1fr);} .topic-count {justify-self:start;} #topic-requirements-dialog {width:calc(100vw - 24px);}}

.archive-search {max-width:430px;margin:22px 0;}
.archive-empty {border-top:1px solid var(--line);padding:28px 0;}
.archive-empty h3 {margin-top:0;}
.archive-status {display:inline-block;background:var(--accent);padding:4px 8px;font-size:12px;}
#archive-detail-dialog {width:min(760px,calc(100vw - 40px));}
#archive-detail-title {overflow-wrap:anywhere;}
#archive-restore-help {border-top:1px solid var(--line);padding-top:18px;margin-top:24px;}
#rules-archive-notice {color:var(--plum);overflow-wrap:anywhere;}
@media(max-width:550px) {.archive-row {grid-template-columns:minmax(0,1fr);} .archive-row>button {justify-self:start;}}

/* Editorial areas belong to the second level of Settings navigation. */
#settings-rules-menu {border:0;margin:0;padding:0;min-width:0;}
#settings-rules-menu>summary {padding:14px 10px;list-style-position:inside;color:var(--ink);font-size:14px;}
#settings-rules-menu>summary.selected {background:transparent;font-weight:600;}
#settings-rules-current {display:none;color:var(--muted);font-size:12px;font-weight:400;}
.settings-rules-subnav {display:flex;flex-direction:column;gap:2px;margin:2px 0 0 13px;padding-left:12px;border:0;border-left:1px solid var(--line);}
.settings-rules-subnav button {width:100%;text-align:left;border:0;border-left:2px solid transparent;border-radius:0;background:transparent;color:var(--muted);font-size:13px;padding:10px;overflow-wrap:anywhere;}
.settings-rules-subnav button[aria-current=page] {background:var(--accent);color:var(--ink);border-left-color:var(--plum);font-weight:600;}
.settings-rules-subnav button:hover,.settings-rules-subnav button:focus-visible {background:var(--accent);color:var(--plum);}
.rules-how {border:0;margin:0 0 20px;padding:0;font-size:12px;color:var(--muted);}
.rules-how summary {color:var(--plum);}
.rules-how li {margin:8px 0;}
.rules-mobile-section {display:none;}
#rules-project {margin-bottom:0;}
.rules-project-control {margin:20px 0;}
.rule-editor-options {border-top:1px solid var(--line);padding-top:16px;margin-top:20px;}
.rule-row,.profile-row {grid-template-columns:minmax(0,1fr) auto;}
.rule-row>div {display:block;min-width:0;}
.rule-row .field-hint {margin-top:5px;}
.profile-default {grid-column:auto;}
#platform-detail-dialog .rule-row,#topic-requirements-dialog .rule-row {grid-template-columns:minmax(0,1fr) auto;}
#rules-general-list .rule-open {color:var(--plum);}
@media(max-width:850px) {
  .settings-layout>aside {display:block;}
  #settings-rules-menu:not([open]) #settings-rules-current {display:block;margin-top:4px;padding-left:17px;}
  .settings-rules-subnav {margin-bottom:10px;}
}
@media(max-width:620px) {
  .rules-tabs {display:none;}
  .rules-mobile-section {display:block;margin:18px 0 24px;}
  .rule-row,.profile-row,#platform-detail-dialog .rule-row,#topic-requirements-dialog .rule-row {grid-template-columns:minmax(0,1fr);gap:10px;}
  .rule-row>button[data-rule-open],.profile-row>button,.profile-default {justify-self:start;grid-column:1;}
}
