/* Legislation editor.
   The `.bill-doc` rules are shared by the editor surface and the server-rendered
   read-only view, so a shared bill looks exactly like the one being drafted. */

/* ------------------------------------------------------------------- chrome */

.editor-nav {
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  padding: 0.6rem 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.title-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
}

.title-stamp {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: #6c757d;
  white-space: nowrap;
}

.title-code {
  border: 0;
  background: transparent;
  font-family: "Times New Roman", Times, serif;
  font-size: 1rem;
  color: #495057;
  padding: 0.15rem 0.25rem;
  border-radius: 3px;
}

.title-code:hover,
.title-code:focus {
  background: #f1f3f7;
  outline: none;
}

.title-subject {
  flex: 1 1 16rem;
  min-width: 12rem;
  border: 0;
  border-bottom: 1px solid #ced4da;
  font-family: "Times New Roman", Times, serif;
  font-size: 1rem;
  padding: 0.15rem 0.25rem;
}

.title-subject:focus {
  outline: none;
  border-bottom-color: #2f56a6;
  background: #f8faff;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding-bottom: 0.6rem;
}

.control-row .sep {
  width: 1px;
  height: 1.5rem;
  background: #dee2e6;
  margin: 0 0.35rem;
}

.control-right {
  margin-left: auto;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.readonly-badge {
  font-size: 0.8rem;
  color: #6c757d;
  border: 1px solid #dee2e6;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

#editor-status {
  font-size: 0.8rem;
  opacity: 0.85;
}

/* Download menu, kept dependency-free */
.menu-wrap {
  position: relative;
}

.menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 15rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  padding: 0.35rem 0;
  z-index: 30;
}

.menu.open {
  display: block;
}

.menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 0.4rem 1rem;
  font-size: 0.875rem;
}

.menu button:hover:not(:disabled) {
  background: #f1f3f7;
}

/* An export the reader is not entitled to is shown, locked, rather than
   hidden: what Plus buys is easier to judge when you can see it. */
.menu button:disabled {
  color: #adb5bd;
  cursor: not-allowed;
}

.menu button .lock {
  display: none;
}

.menu button:disabled .lock {
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.75rem;
}

.menu-heading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #adb5bd;
  padding: 0.5rem 1rem 0.15rem;
}

.menu-upsell {
  text-transform: none;
  letter-spacing: normal;
  border-top: 1px solid #eee;
  margin-top: 0.25rem;
  padding-top: 0.5rem;
}

/* ------------------------------------------------------------------ layout */

.editor-main {
  padding: 1.5rem 1.25rem 0;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: 1.5rem;
  align-items: start;
  max-width: 76rem;
  margin: 0 auto;
}

.editor-layout.readonly {
  grid-template-columns: minmax(0, 1fr);
  max-width: 52rem;
}

@media (max-width: 900px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.editor-paper {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  padding: 2.5rem 3rem;
  min-height: 60vh;
}

/* --------------------------------------------------------------- the bill */

.bill-doc {
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: 2;
  text-align: justify;
  white-space: pre-wrap;
  outline: none;
  counter-reset: billsection;
}

.bill-doc p {
  margin: 0 0 0.75rem 0;
}

.bill-title::before {
  content: "A DRAFT LOCAL LAW";
  display: block;
  text-align: center;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.bill-title:empty::after {
  content: "\00a0";
}

.enacting-clause {
  text-decoration: underline;
  user-select: none;
}

.bill-section {
  counter-increment: billsection;
  display: block;
  margin-bottom: 1rem;
}

/* Rule 3: bill sections are numbered consecutively and only the first spells
   out the word "Section". Derived from document order so it cannot drift.
   Rule 11.4: a space follows the section symbol.

   The read-only view draws the number in CSS; the editor draws it as a control
   (.section-pill) so it can be selected. */
.bill-doc:not(.bill-editable) .bill-section > .section-lead::before {
  content: "\00a7\0020" counter(billsection) ". ";
}

.bill-doc:not(.bill-editable) .bill-section:first-of-type > .section-lead::before {
  content: "Section 1. ";
}

.section-pill {
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: #2f56a6;
  background: #eef2f9;
  border: 1px solid #d7e0ef;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  margin-right: 0.4rem;
  vertical-align: 0.12em;
  user-select: none;
}

.section-pill:hover {
  background: #2f56a6;
  border-color: #2f56a6;
  color: #fff;
}

.section-lead {
  text-indent: 2em;
}

/* The designator is drawn, not typed, so the law cannot be renumbered by
   accident. */
.law-block[data-label]:not([data-label=""])::before {
  content: attr(data-label) " ";
}

.law-block {
  text-indent: 2em;
}

.level-paragraph {
  padding-left: 1.5em;
}
.level-subparagraph {
  padding-left: 3em;
}
.level-clause {
  padding-left: 4.5em;
}
.level-item {
  padding-left: 6em;
}

/* Rule 11.1: additions are underlined, deletions stay in the bill inside
   brackets. The brackets are drawn by CSS so they cannot be edited away. */
.bill-doc u.ins {
  text-decoration: underline;
  text-decoration-skip-ink: none;
}

.bill-doc span.del::before {
  content: "[";
}
.bill-doc span.del::after {
  content: "]";
}
.bill-doc span.del {
  color: #8b0000;
}

/* ------------------------------------------------- cross-references (Rule 5) */

/* A reference the editor built, pointing at a provision of existing law. Blue
   and dotted rather than solidly underlined: Rule 11.1 gives a solid underline
   a meaning of its own, and a reference is an affordance of the editor, not
   part of the bill. Nothing here reaches print or any export. */
.law-ref {
  color: #2f56a6;
  border-bottom: 1px dotted currentColor;
  cursor: help;
}

/* Language being struck reads as struck, whatever it points at. */
.bill-doc span.del .law-ref {
  color: inherit;
  border-bottom-color: transparent;
}

/* Read-only: no hover card, so the reference is a link you can follow. */
.bill-doc:not(.bill-editable) a.law-ref {
  text-decoration: none;
}
.bill-doc:not(.bill-editable) a.law-ref::after {
  content: "\2197";
  font-size: 0.75em;
  vertical-align: super;
  margin-left: 0.1em;
}

.law-ref-card {
  position: absolute;
  z-index: 1200;
  max-height: 22rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
  padding: 0.75rem 0.9rem;
  font-family: "Times New Roman", Times, serif;
  font-size: 11pt;
  line-height: 1.4;
}

.law-ref-card p {
  margin: 0 0 0.4rem;
}

.law-ref-head {
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 0.8rem;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}

.law-ref-cite {
  font-weight: 600;
}

.law-ref-heading {
  margin-left: 0.3em;
}

.law-ref-code {
  display: block;
  color: #6c757d;
}

.law-ref-open {
  float: right;
  margin-left: 0.5rem;
  white-space: nowrap;
}

.law-ref-designator {
  font-weight: 600;
}

.law-ref-loading,
.law-ref-more {
  color: #6c757d;
}

.ref-source {
  font-size: 0.8rem;
  color: #6c757d;
  margin: 0.4rem 0 0;
}

/* ------------------------------------------------------------ style checks */

.lint {
  border-bottom: 2px dotted transparent;
}
.lint-error {
  border-bottom-color: #dc3545;
  background: rgba(220, 53, 69, 0.07);
}
.lint-warning {
  border-bottom-color: #fd7e14;
}
.lint-info {
  border-bottom-color: #6c757d;
}

.editor-sidebar {
  position: sticky;
  top: 8rem;
  font-family: "Be Vietnam Pro", sans-serif;
}

#issues {
  max-height: 70vh;
  overflow-y: auto;
}

.issue {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid #e9ecef;
  padding: 0.5rem 0.25rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.issue:hover {
  background: #eef2f9;
}

.issue-message {
  display: inline;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}

.issue-rule {
  font-weight: 500;
  color: #2f56a6;
  margin-right: 0.25rem;
  text-decoration: none;
  border-bottom: 1px dotted #2f56a6;
}

.issue-rule:hover {
  border-bottom-style: solid;
}

.issue-excerpt {
  font-family: "Times New Roman", Times, serif;
  color: #444;
}

/* ------------------------------------------------------------------ modals */

.editor-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0, 0, 0, 0.4);
  padding: 3rem 1rem;
  overflow-y: auto;
}

.editor-modal.open {
  display: block;
}

.editor-modal .panel {
  background: #fff;
  border-radius: 4px;
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.5rem;
}

.editor-modal .panel-narrow {
  max-width: 26rem;
}

/* Share dialog */

.share-add {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}

.share-add .form-control {
  flex: 1 1 auto;
}

.share-add .form-select {
  flex: 0 0 auto;
  width: auto;
}

.share-error {
  color: #dc3545;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.share-note {
  margin-bottom: 0.75rem;
}

.share-people {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  max-height: 15rem;
  overflow-y: auto;
}

.share-people li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f1f3f5;
}

.share-people .share-person {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  overflow: hidden;
}

.share-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-email {
  font-size: 0.8rem;
  color: #868e96;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-people .form-select {
  flex: 0 0 auto;
  width: auto;
}

/* Sits where the role dropdown sits, so the column lines up. */
.share-role {
  flex: 0 0 auto;
  color: #6c757d;
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
}

.share-public {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0.85rem 0;
  padding-left: 0;
  border-top: 1px solid #f1f3f5;
}

.share-public .form-check-input {
  float: none;
  flex: 0 0 auto;
  margin: 0;
}

.share-public .form-check-label {
  margin: 0;
}

.share-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 1rem;
}

.delete-title {
  font-family: "Times New Roman", Times, serif;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.preview-box {
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  background: #f8f9fa;
  border-left: 3px solid #2f56a6;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
}

#picker-blocks {
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  padding: 0.5rem 0.75rem;
}

#picker-blocks .form-check-label {
  font-family: "Times New Roman", Times, serif;
}

.picker-results {
  max-height: 18rem;
  overflow-y: auto;
}

.picker-result {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e9ecef;
  background: none;
  padding: 0.45rem 0.5rem;
  font-size: 0.9rem;
}

.picker-result:hover {
  background: #eef2f9;
}

.picker-cite {
  font-family: "Times New Roman", Times, serif;
  font-weight: 500;
  margin-right: 0.4rem;
}

.picker-path {
  display: block;
  font-size: 0.75rem;
  color: #adb5bd;
}

.picker-chosen {
  font-family: "Times New Roman", Times, serif;
  font-size: 1rem;
  border-left: 3px solid #2f56a6;
  padding-left: 0.75rem;
}

.rule-cite {
  font-size: 0.8rem;
  color: #6c757d;
}

/* --------------------------------------------- sign in, document list, new */

.susi,
.documents,
.new-bill,
.profile {
  max-width: 44rem;
  margin: 2rem auto;
}

.susi h1,
.documents h1,
.new-bill h1,
.profile h1 {
  font-size: 1.6rem;
}

.profile-saved {
  background: #e7f3ea;
  border: 1px solid #cfe6d6;
  border-radius: 4px;
  padding: 0.5rem 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.integrations {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #dee2e6;
}

.integrations h2 {
  font-size: 1.2rem;
}

.integrations h3 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-top: 1.5rem;
}

.integrations .token {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.integration-snippet {
  background: #1f2733;
  color: #e6edf3;
  border-radius: 4px;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
}

.integration-snippet code {
  color: inherit;
}

/* --------------------------------------------------------------- billing */

.billing-current,
.billing-plans {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #dee2e6;
}

.billing-current h2,
.billing-plans h2 {
  font-size: 1.2rem;
}

.billing-notice {
  background: #fff3cd;
  border: 1px solid #ffe69c;
  border-radius: 4px;
  padding: 0.5rem 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

/* The subscribed status: what is being paid for, and when. */
.billing-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.5rem;
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
}

.billing-facts dt {
  font-weight: 500;
  color: #6c757d;
}

.billing-facts dd {
  margin: 0;
}

.billing-facts code {
  font-size: 0.85em;
  color: #6c757d;
}

@media (max-width: 32rem) {
  .billing-facts {
    grid-template-columns: 1fr;
    gap: 0 0;
  }
  .billing-facts dd {
    margin-bottom: 0.75rem;
  }
}

.billing-features-heading {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.billing-features {
  margin: 0 0 1.5rem;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  color: #495057;
}

.billing-features li {
  margin-bottom: 0.2rem;
}

.billing-cards {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.billing-card {
  flex: 1 1 14rem;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1.25rem;
  background: #fff;
}

.billing-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.billing-price {
  font-size: 1.6rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.billing-price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: #6c757d;
}

.billing-error,
.cancel-error {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* ------------------------------------------------------- the drafting manual */

.manual {
  max-width: 48rem;
  margin: 2rem auto 4rem;
}

.manual h1 {
  font-size: 1.6rem;
}

.manual-note {
  background: #fff;
  border: 1px solid #dee2e6;
  border-left: 3px solid #2f56a6;
  border-radius: 3px;
  padding: 0.85rem 1.15rem;
  font-size: 0.9rem;
  color: #495057;
}

.manual-toc {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2.5rem;
}

.manual-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 2rem;
}

@media (max-width: 700px) {
  .manual-toc ul {
    columns: 1;
  }
}

.manual-toc li {
  break-inside: avoid;
  padding: 0.15rem 0;
  font-size: 0.9rem;
}

.manual-rule {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  scroll-margin-top: 1rem;
}

.manual-rule:target {
  border-color: #2f56a6;
  box-shadow: 0 0 0 3px rgba(47, 86, 166, 0.12);
}

.manual-rule h2 {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.manual-rule h3 {
  font-size: 0.95rem;
  font-weight: 500;
}

.manual-rule .rule-number {
  display: inline-block;
  color: #2f56a6;
  font-weight: 400;
  margin-right: 0.5rem;
}

.manual-rule p {
  font-size: 0.925rem;
  line-height: 1.6;
}

/* Examples are set as bill text so the conventions read the way they will in a
   bill. */
.manual-example {
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: 1.7;
  background: #f8f9fa;
  border-left: 3px solid #ced4da;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}

.manual-example p {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  margin-bottom: 0.5rem;
}

.manual-example p:last-child {
  margin-bottom: 0;
}

.manual-example u.ins {
  text-decoration: underline;
  text-decoration-skip-ink: none;
}

.manual-example span.del::before {
  content: "[";
}
.manual-example span.del::after {
  content: "]";
}
.manual-example span.del {
  color: #8b0000;
}

.manual-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 0.75rem 0;
}

@media (max-width: 700px) {
  .manual-compare {
    grid-template-columns: 1fr;
  }
}

.manual-compare h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c757d;
  margin-bottom: 0.35rem;
}

.manual-compare .do,
.manual-compare .dont {
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: 1.6;
  padding: 0.75rem 1rem;
  border-radius: 3px;
}

.manual-compare .do {
  background: #f2f8f4;
  border-left: 3px solid #4a9d6a;
}

.manual-compare .dont {
  background: #fdf4f4;
  border-left: 3px solid #c96a6a;
}

.manual-compare h4 {
  font-family: "Be Vietnam Pro", sans-serif;
}

.manual-compare u.ins {
  text-decoration: underline;
}
.manual-compare span.del::before {
  content: "[";
}
.manual-compare span.del::after {
  content: "]";
}
.manual-compare span.del {
  color: #8b0000;
}

.susi .lead {
  color: #495057;
  font-weight: 200;
}

#auth-container {
  margin-top: 2rem;
}

.documents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.document-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

.document-list li + li {
  border-top: 1px solid #eef0f3;
}

.document-list li {
  display: flex;
  align-items: center;
}

.document-list a {
  display: block;
  flex: 1 1 auto;
  padding: 0.85rem 1.15rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.document-list a:hover {
  background: #eef2f9;
}

.document-delete {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: #adb5bd;
  padding: 0.85rem 1.15rem;
  align-self: stretch;
}

.document-delete:hover {
  color: #dc3545;
  background: #fdf2f3;
}

.editor-error {
  max-width: 40rem;
  margin: 3rem auto;
}

.editor-error h1 {
  font-size: 1.6rem;
}

.document-title {
  display: block;
  font-family: "Times New Roman", Times, serif;
  font-size: 1.05rem;
}

.document-meta {
  display: block;
  font-size: 0.78rem;
  color: #868e96;
  margin-top: 0.15rem;
}

.badge-public {
  color: #2f56a6;
}

.documents .empty {
  color: #6c757d;
}

.type-options .form-check {
  padding: 0.5rem 0.5rem 0.5rem 2rem;
  border-radius: 4px;
}

.type-options .form-check:hover {
  background: #eef2f9;
}

.type-options .form-check-label .rule-cite {
  display: block;
  font-family: "Times New Roman", Times, serif;
}

.brandbar-user {
  white-space: nowrap;
}
