/* Jura workspace: one top bar and full-window File surface. */
:root {
  --jura-accent: #215caa;
  --jura-paper: #f4f0ec;
  --jura-ink: #252525;
}
#app {
  background: #f1f1f1;
  color: var(--jura-ink);
}
.jura-topbar {
  height: 58px;
  min-height: 58px;
  padding: 8px 20px;
  background: var(--jura-paper);
  gap: 10px;
  border-bottom: 1px solid #e4ded8;
  color: #272727;
}
.jura-topbar button {
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  padding: 6px 9px;
  border-radius: 4px;
}
.jura-topbar button:hover {
  background: #e7e2dd;
  border-color: #d6d0c9;
}
.jura-topbar .jura-brand {
  font:
    19px Georgia,
    serif;
  letter-spacing: 2px;
  color: #8a6c35;
  padding-right: 14px;
}
.jura-topbar .quick-action {
  font-size: 25px;
  line-height: 1;
  width: 34px;
  padding: 3px;
}
.jura-topbar #save {
  color: #8050a0;
}
.jura-topbar #title {
  min-width: 140px;
  width: 220px;
  max-width: 24vw;
  padding: 6px 9px;
  background: transparent;
  border-color: transparent;
  border-radius: 3px;
  color: #242424;
}
.jura-topbar #title:hover,
.jura-topbar #title:focus {
  background: white;
  border-color: #ccc;
}
.jura-topbar .autosave {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  margin: 0;
}
#autosave {
  appearance: none;
  width: 46px;
  height: 24px;
  border-radius: 20px;
  padding: 2px;
  border: 1px solid #777;
  background: white;
  cursor: pointer;
  position: relative;
  flex: none;
}
#autosave:before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: #777;
  border-radius: 50%;
  transition: transform 0.15s;
}
#autosave:checked {
  background: #215caa;
  border-color: #215caa;
}
#autosave:checked:before {
  background: white;
  transform: translateX(20px);
}
.jura-topbar #status {
  font-size: 11px;
  color: #65615c;
  min-width: 70px;
  max-width: 100px;
}
.jura-topbar .command-search {
  margin-left: auto;
  max-width: 440px;
  min-width: 180px;
  width: 30vw;
  text-align: left;
  background: #fff;
  border: 1px solid #d9d4cf;
  box-shadow: 0 1px 3px #0001;
  height: 38px;
  color: #666;
}
.command-search span {
  margin-left: 10px;
}
#app > footer {
  display: none;
}
#editor {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
}
#backstage {
  position: absolute;
  inset: 58px 0 0;
  z-index: 40;
  background: #f5f5f5;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
}
#file-nav {
  display: flex;
  flex-direction: column;
  background: linear-gradient(#f4eee9, #e9e6df);
  padding: 12px 0 22px;
  overflow: auto;
  border-right: 1px solid #ddd8d1;
}
#file-nav button {
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  padding: 15px 25px;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 53px;
  color: #303030;
}
#file-nav button:hover {
  background: #dedbd5;
}
#file-nav button[aria-current="page"] {
  color: #155bb5;
  background: #eeebe6;
  box-shadow: inset 4px 0 #155bb5;
  font-weight: 600;
}
#file-nav .nav-icon {
  display: inline-flex;
  width: 25px;
  justify-content: center;
  font-size: 24px;
  font-weight: 400;
}
#file-nav .nav-divider {
  border-top: 1px solid #cbc9c4;
  margin: 16px 28px;
}
#file-nav .nav-spacer {
  flex: 1;
  min-height: 32px;
}
#file-nav .file-back {
  font-size: 28px;
  min-height: 54px;
  padding-top: 0;
}
#file-content {
  padding: 32px 54px;
  overflow: auto;
  outline: 0;
}
#file-content h1 {
  font-size: 32px;
  line-height: 1.2;
  margin: 0 0 32px;
  font-weight: 600;
}
#file-content h2 {
  font-size: 25px;
  margin: 25px 0 24px;
  font-weight: 600;
}
#file-content h3 {
  font-size: 18px;
  margin: 0 0 12px;
}
.file-templates {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  margin: 20px 0 40px;
}
.template-card {
  width: 185px;
  background: transparent;
  border: 0;
  text-align: center;
  padding: 12px 10px;
  color: #242424;
}
.template-card:hover {
  background: #e7ebef;
}
.template-sheet {
  height: 145px;
  width: 104px;
  margin: 0 auto 16px;
  border: 1px solid #cfcfcf;
  background: #fff;
  box-shadow: 0 1px 2px #0001;
  padding: 20px 10px;
  font:
    11px Georgia,
    serif;
  text-align: left;
  line-height: 1.6;
  overflow: hidden;
}
.template-card strong {
  font-size: 15px;
}
.template-sheet.cover {
  border-top: 10px solid #19334f;
}
.template-sheet .mini-lines {
  height: 60px;
  margin-top: 14px;
  background: repeating-linear-gradient(transparent 0 7px, #ddd 7px 8px);
}
.file-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.file-filters button {
  border-radius: 24px;
  padding: 10px 22px;
  border-color: #aaa;
  font-size: 16px;
}
.file-filters button[aria-pressed="true"] {
  background: #215caa;
  color: white;
  border-color: #215caa;
}
.file-filters input {
  margin-left: auto;
  min-width: 220px;
  width: 35%;
  background: white;
}
.file-document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.file-document {
  border: 1px solid #ccc;
  border-radius: 7px;
  background: white;
  padding: 20px;
  min-height: 155px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.file-document .document-open {
  border: 0;
  padding: 0;
  text-align: left;
  font-weight: 600;
  font-size: 19px;
  background: transparent;
  overflow-wrap: anywhere;
}
.file-document small {
  color: #686868;
}
.file-document .doc-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.file-document .doc-actions button {
  padding: 5px 10px;
  font-size: 13px;
}
.file-form {
  max-width: 700px;
  display: grid;
  gap: 18px;
}
.file-form label {
  display: grid;
  gap: 7px;
}
.file-form input,
.file-form select {
  padding: 10px;
  border: 1px solid #bbb;
  border-radius: 3px;
  font: inherit;
  background: white;
  min-width: 0;
}
.file-form button {
  justify-self: start;
}
.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}
.file-note {
  color: #666;
  line-height: 1.6;
  max-width: 800px;
}
.file-error {
  color: #a01f2a;
  background: #fff0f0;
  padding: 12px;
  border-radius: 4px;
  white-space: pre-wrap;
}
.file-empty {
  padding: 28px 0;
  color: #666;
}
.file-share-row,
.file-version-row {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 0;
  border-bottom: 1px solid #ddd;
}
.file-share-row span,
.file-version-row span {
  flex: 1;
}
.file-properties {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 15px;
  max-width: 800px;
}
.file-properties dt {
  color: #666;
}
.file-properties dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.file-preview {
  width: 100%;
  height: 65vh;
  border: 1px solid #ccc;
  background: white;
}
.file-pane-message {
  padding: 12px 0;
  color: #215caa;
}
@media (max-width: 1100px) {
  .jura-topbar {
    gap: 4px;
    padding: 8px;
  }
  .jura-topbar #status {
    display: none;
  }
  .jura-topbar .command-search {
    min-width: 110px;
  }
  .jura-topbar #title {
    width: 160px;
  }
  #file-content {
    padding: 28px;
  }
  #backstage {
    grid-template-columns: 185px 1fr;
  }
}
@media (max-width: 700px) {
  .jura-topbar .autosave span,
  .jura-topbar .command-search span,
  .jura-topbar #workspace-share {
    display: none;
  }
  .jura-topbar .command-search {
    width: 36px;
    min-width: 36px;
  }
  .jura-topbar #title {
    width: 120px;
    min-width: 70px;
  }
  .jura-topbar .jura-brand {
    font-size: 14px;
    padding: 3px;
  }
  .jura-topbar #workspace-account {
    font-size: 11px;
  }
  #backstage {
    grid-template-columns: 130px 1fr;
  }
  #file-nav button {
    padding: 12px 10px;
    font-size: 14px;
    gap: 8px;
  }
  #file-content {
    padding: 22px 15px;
  }
  #file-content h1 {
    font-size: 25px;
  }
  .file-templates {
    gap: 8px;
  }
  .template-card {
    width: 135px;
  }
  .file-properties {
    grid-template-columns: 1fr;
  }
  .file-filters input {
    width: 100%;
    margin: 0;
  }
  .file-document-grid {
    grid-template-columns: 1fr;
  }
}
/* Compact, consistent workspace chrome. */
.jura-topbar {
  height: 42px;
  min-height: 42px;
  padding: 4px 14px;
  gap: 7px;
  background: var(--jura-glass-solid);
  border-color: var(--jura-border);
  font-size: 12px;
}
.jura-topbar .quick-action {
  width: 28px;
  height: 28px;
  padding: 4px;
  font-size: 18px;
}
.jura-topbar .quick-action .jura-icon {
  width: 19px;
  height: 19px;
}
.jura-topbar .jura-brand {
  font-size: 17px;
  padding-right: 8px;
}
.jura-topbar .command-search {
  height: 29px;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 2px #30291d08;
  background: #ffffff73;
  border-color: var(--jura-border);
}
.jura-topbar .command-search .jura-icon {
  width: 15px;
  height: 15px;
}
.jura-topbar #title {
  font-size: 12px;
  padding: 4px 7px;
}
.jura-topbar #status {
  font-size: 10px;
}
#autosave {
  width: 36px;
  height: 20px;
  padding: 2px;
  border-color: #99978f;
}
#autosave:before {
  width: 14px;
  height: 14px;
}
#autosave:checked:before {
  transform: translateX(16px);
}
#backstage {
  inset: 42px 0 0;
  grid-template-columns: 190px minmax(0, 1fr);
  background: #f7f5f1;
}
#file-nav {
  background: var(--jura-glass-solid);
  border-color: var(--jura-border);
  padding: 8px 0 14px;
}
#file-nav button {
  font-size: 14px;
  min-height: 42px;
  padding: 10px 20px;
  gap: 14px;
  transition:
    background 0.15s,
    color 0.15s;
}
#file-nav button:hover {
  background: var(--jura-hover);
}
#file-nav button[aria-current="page"] {
  background: #285d9d0a;
  color: #285d9d;
  box-shadow: inset 3px 0 #285d9d;
}
#file-nav .nav-icon {
  width: 23px;
  height: 23px;
}
#file-nav .file-back {
  height: 42px;
  min-height: 42px;
}
#file-nav .nav-divider {
  margin: 12px 22px;
  border-color: var(--jura-border);
}
#file-nav .nav-spacer {
  min-height: 16px;
}
#file-content {
  padding: 28px 38px;
}
#file-content h1 {
  font-size: 27px;
  margin-bottom: 25px;
}
#file-content h2 {
  font-size: 21px;
  margin: 20px 0;
}
.template-card,
.file-document,
.file-filters button,
button {
  transition:
    background-color 0.14s,
    border-color 0.14s,
    box-shadow 0.14s;
}
.file-document {
  background: #ffffff9c;
  border-color: var(--jura-border);
  box-shadow: 0 2px 8px #30291d04;
}
.file-document:hover {
  box-shadow: 0 5px 18px #30291d0c;
}
#app {
  background: #efede8;
}
@media (max-width: 700px) {
  #backstage {
    grid-template-columns: 125px 1fr;
  }
  #file-nav button {
    padding: 9px 10px;
    gap: 8px;
  }
  #file-content {
    padding: 20px 16px;
  }
  .jura-topbar {
    padding: 4px 7px;
    gap: 3px;
  }
}
.jura-workspace dialog {
  background: var(--jura-glass-solid);
  color: var(--ink);
  border: 1px solid var(--jura-border);
  border-radius: 12px;
  box-shadow: var(--jura-shadow);
}
.jura-workspace dialog::backdrop {
  background: #30291d24;
  backdrop-filter: blur(3px);
}
.jura-workspace .jura-surface-exit {
  pointer-events: none !important;
}
.file-appearance {
  max-width: 560px;
  margin: 20px 0 28px;
}
.file-appearance label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 14px 0;
  font-size: 13px;
}
.file-appearance select {
  width: 230px;
  max-width: 55%;
  border: 1px solid var(--jura-border);
  border-radius: 7px;
  padding: 8px 10px;
  background: var(--jura-control, #ffffff73);
  color: inherit;
}
#message {
  position: fixed;
  bottom: 38px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4000;
  max-width: min(540px, calc(100vw - 32px));
  padding: 11px 17px;
  border: 1px solid var(--jura-border);
  border-radius: 12px;
  background: var(--jura-glass);
  color: var(--jura-ink);
  backdrop-filter: blur(20px);
  box-shadow: var(--jura-shadow);
  font-size: 12px;
}
.file-error {
  color: var(--jura-ink);
  background: var(--jura-glass);
  border: 1px solid var(--jura-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --jura-paper: #25292e;
  --jura-glass: rgba(35, 39, 44, 0.89);
  --jura-glass-solid: #25292e;
  --jura-control: rgba(255, 255, 255, 0.045);
  --jura-border: #ffffff20;
  --jura-shadow: 0 12px 40px #0005;
  --jura-ink: #e8e7e4;
  --jura-accent: #91b5e7;
}
html[data-theme="dark"] :is(body, #app, #file-content) {
  background: #1c2025;
  color: var(--jura-ink);
}
html[data-theme="dark"] :is(.jura-topbar, #file-nav, #backstage, dialog) {
  background: var(--jura-glass);
  color: var(--jura-ink);
  border-color: var(--jura-border);
}
html[data-theme="dark"]
  :is(
    .jura-topbar #title,
    .jura-topbar #status,
    #command-search,
    #file-content .file-note,
    #file-content label
  ) {
  color: var(--jura-ink);
}
html[data-theme="dark"]
  :is(
    input,
    select,
    textarea,
    .file-document,
    .template-card,
    .file-actions button,
    .file-filters button,
    .file-form button
  ) {
  background: var(--jura-control);
  color: var(--jura-ink);
  border-color: var(--jura-border);
}
html[data-theme="dark"] :is(.template-sheet, .file-preview) {
  background: #fff;
  color: #252525;
}
html[data-theme="dark"]
  :is(
    #file-nav button:hover,
    #file-nav button[aria-current="page"],
    .jura-topbar button:hover,
    .file-filters button[aria-pressed="true"]
  ) {
  background: #a5c6fa18;
  color: #b2d2ff;
}
html[data-theme="dark"] .jura-topbar .command-search {
  background: var(--jura-control);
  color: var(--jura-ink);
  border-color: var(--jura-border);
}
html[data-theme="dark"] .jura-icon-options,
html[data-theme="dark"] .jura-icon-print,
html[data-theme="dark"] .jura-icon-account {
  color: #91aaa4;
}
html[data-theme="dark"] .jura-topbar .jura-brand {
  color: #bca16a;
}

/* Keep the Scribe title and workspace switch reachable beside a tool pane. */
@media (max-width: 900px) {
  #scribe-topbar #title {
    min-width: 70px;
    flex: 1;
    max-width: 170px;
  }
  #scribe-topbar .command-search span,
  #scribe-topbar .autosave span {
    display: none;
  }
  #scribe-topbar .command-search {
    width: 32px;
    min-width: 32px;
    flex: none;
  }
  #scribe-topbar .scribe-switch {
    order: 0;
  }
}

/* Document-oriented File → New gallery. */
.new-drafting-gallery {
  max-width: 1180px;
}
.new-eyebrow {
  color: var(--accent-text, #37649a);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin: 14px 0 8px;
}
.new-drafting-gallery > h2 {
  font:
    400 32px Georgia,
    serif;
  margin: 0;
  letter-spacing: -0.025em;
}
.new-blank {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 3px 16px;
  width: min(100%, 530px);
  text-align: left;
  margin: 24px 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised, #fff9);
  color: inherit;
}
.new-blank-mark {
  grid-row: span 2;
  font-size: 32px;
  align-self: center;
  color: var(--accent-text, #37649a);
  font-weight: 300;
}
.new-blank strong {
  font-size: 15px;
}
.new-blank > span:last-child {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.new-template-browser {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 22px;
  gap: 28px;
}
.new-template-categories {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.new-template-categories > button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.5;
}
.new-template-categories > button[aria-current="true"] {
  color: var(--accent-text, #37649a);
  background: #618bb91a;
  font-weight: 650;
}
.new-template-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.new-template-head h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}
.new-template-head label {
  font-size: 0;
}
.new-template-head input {
  width: 230px;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  border-radius: 7px;
  color: inherit;
  font-size: 12px;
}
.new-template-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}
.new-legal-template {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 9px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: inherit;
  background: var(--surface-raised, #fff8);
  min-height: 195px;
  transition:
    border-color 0.18s,
    box-shadow 0.18s,
    transform 0.18s;
}
.new-legal-template:hover,
.new-blank:hover {
  border-color: #6c91b6;
  box-shadow: 0 7px 20px #182b4210;
  transform: translateY(-2px);
}
.new-legal-template strong {
  font-size: 13px;
  line-height: 1.55;
  font-weight: 600;
}
.new-legal-template small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.new-template-link {
  margin-top: auto;
  padding-top: 8px;
  font-size: 11px;
  color: var(--accent-text, #37649a);
}
.new-template-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 35px;
  height: 46px;
  border: 1px solid #75889a66;
  border-radius: 2px;
  padding: 10px 6px;
  box-sizing: border-box;
  margin-bottom: 4px;
}
.new-template-page i {
  width: 100%;
  border-top: 1px solid #75889a77;
}
.new-template-page i:first-child {
  width: 70%;
  border-color: #3e6ca6;
  margin-bottom: 3px;
}
.new-personal-templates {
  margin: 30px 0 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.new-personal-templates summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 18px;
}
.new-template-context,
.scribe-template-confirm {
  width: min(530px, calc(100vw - 40px));
  padding: 28px;
  box-sizing: border-box;
  border: 1px solid var(--line, #ddd);
  border-radius: 16px;
  color: var(--text);
  background: var(--surface, #fbf9f4);
  box-shadow: 0 24px 90px #0005;
}
.new-template-context::backdrop,
.scribe-template-confirm::backdrop {
  background: #17233166;
  backdrop-filter: blur(5px);
}
.new-template-context header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}
.new-template-context h2,
.scribe-template-confirm h2 {
  font:
    400 25px/1.35 Georgia,
    serif;
  margin: 0 0 12px;
}
.new-template-context form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 24px;
}
.new-template-context label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}
.new-template-context select {
  width: 100%;
  padding: 10px;
  color: inherit;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.new-context-actions,
.scribe-template-confirm > div {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.new-context-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 22px;
}
.scribe-template-confirm p {
  font-size: 14px;
  line-height: 1.7;
}
.scribe-template-confirm button {
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: inherit;
  border-radius: 6px;
}
.scribe-template-confirm [data-create] {
  background: #315e96;
  color: white;
}
@media (max-width: 800px) {
  .new-template-browser {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .new-template-categories {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .new-template-categories > button {
    flex: none;
    max-width: 180px;
  }
  .new-template-head input {
    width: 210px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .new-legal-template,
  .new-blank {
    transition: none;
    transform: none !important;
  }
}

@media (max-width: 500px) {
  #scribe-topbar .jura-brand { font-size: 12px; letter-spacing: 1px; }
}
