:root {
  --navy: #0d2d5b;
  --gold: #c9a96a;
  --ivory: #faf9f2;
  --muted: #68717c;
  --line: #dddcd5;
  --serif: "Kudrashov Mon", Georgia, serif;
}
.compliance-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
  padding: 22px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  background: #fffdf9;
}
.compliance-filters label {
  min-width: 0;
}
.compliance-filters input,
.compliance-filters select {
  min-width: 0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--ivory);
  color: var(--navy);
  font:
    14px/1.55 Arial,
    sans-serif;
}
h1,
h2,
h3,
.brand {
  font-family: var(--serif);
  font-weight: 500;
}
h1 {
  font-size: 36px;
  line-height: 1.2;
  margin: 8px 0 14px;
}
h2 {
  font-size: 25px;
  margin: 0 0 16px;
}
h3 {
  font-size: 19px;
  margin: 0 0 10px;
}
a {
  color: var(--navy);
  text-underline-offset: 4px;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button,
.button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--navy);
  padding: 9px 15px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
}
button:hover,
.button:hover {
  border-color: var(--gold);
  background: #c9a96a14;
}
.primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.primary:hover {
  background: #1c426f;
}
.danger {
  color: #8f302a;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--navy);
  color: var(--ivory);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.brand {
  font-size: 25px;
  letter-spacing: 3px;
  text-decoration: none;
  color: inherit;
}
.brand small {
  display: block;
  font:
    9px Arial,
    sans-serif;
  letter-spacing: 4px;
  margin: 4px 0 0;
}
.brand img {
  width: 33px;
  float: left;
  margin: 4px 12px 0 0;
  filter: brightness(0) invert(1);
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sidebar nav a {
  color: #ecece8;
  text-decoration: none;
  padding: 12px;
  border-left: 2px solid transparent;
}
.sidebar nav a.active {
  border-color: var(--gold);
  background: #ffffff0d;
}
.sidebar .account {
  margin-top: auto;
  font-size: 12px;
  color: #c2cbd8;
}
.sidebar button {
  color: var(--ivory);
  border-color: #ffffff33;
}
.content {
  min-width: 0;
}
.topbar {
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  padding: 16px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.topbar input {
  max-width: 330px;
}
.topbar .language {
  white-space: nowrap;
  font-size: 12px;
}
main {
  padding: 34px 36px 60px;
  max-width: 1500px;
  margin: auto;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 10px;
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  margin: 24px 0;
}
.stat {
  padding: 22px;
  border-right: 1px solid var(--line);
  background: white;
}
.stat:last-child {
  border: 0;
}
.stat strong {
  display: block;
  font: 32px var(--serif);
  margin-top: 8px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.panel {
  border: 1px solid var(--line);
  padding: 24px;
  background: #ffffff90;
  margin-bottom: 24px;
}
.panel.attention {
  border-top: 3px solid var(--gold);
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: white;
  margin-bottom: 24px;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  background: #f4f3ec;
}
th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tr:last-child td {
  border-bottom: 0;
}
td small {
  display: block;
  color: var(--muted);
}
td button {
  font-size: 12px;
  padding: 5px 9px;
  min-height: 32px;
}
.badge {
  font-size: 11px;
  padding: 4px 9px;
  background: #0d2d5b0a;
  border: 1px solid #0d2d5b1a;
  display: inline-block;
  white-space: nowrap;
}
.overdue {
  color: #9a382f;
}
.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}
.tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  border-color: var(--gold);
}
.detail {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  margin: 0;
}
.detail dt {
  color: var(--muted);
  font-size: 12px;
}
.detail dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  border-left: 1px solid var(--gold);
  padding: 0 0 22px 20px;
  margin-left: 5px;
}
.timeline time {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.timeline p {
  white-space: pre-wrap;
}
.notice {
  padding: 14px 18px;
  background: #c9a96a18;
  border-left: 3px solid var(--gold);
  margin: 16px 0;
}
.error {
  color: #922d2d;
}
.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-art {
  background:
    linear-gradient(#0d2d5b70, #0d2d5be0),
    url("/assets/consultation-mongolia.png") center/cover;
  color: white;
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-art h1 {
  font-size: 48px;
  max-width: 440px;
}
.login-main {
  padding: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 420px;
}
.login-card .primary {
  width: 100%;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 16px;
  color: var(--muted);
}
input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  min-height: 44px;
  background: white;
  color: var(--navy);
  border: 1px solid #c7cbd0;
  border-radius: 0;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}
label.check {
  flex-direction: row;
  align-items: center;
}
select[multiple] {
  min-height: 130px;
}
.field-help {
  font-size: 11px;
  color: var(--muted);
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.field-grid .wide {
  grid-column: 1/-1;
}
dialog {
  width: min(720px, calc(100% - 28px));
  max-height: 90vh;
  padding: 28px;
  border: 1px solid var(--gold);
  background: var(--ivory);
  color: var(--navy);
}
dialog::backdrop {
  background: #06193199;
  backdrop-filter: blur(3px);
}
dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
dialog header button {
  border: 0;
  padding: 4px;
}
dialog footer {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  justify-content: flex-end;
}
#editor-error {
  color: #922d2d;
}
#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--navy);
  color: white;
  padding: 12px 22px;
  max-width: 450px;
  z-index: 5;
}
#toast:empty {
  display: none;
}
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 10px;
  top: 10px;
  background: white;
  z-index: 10;
  padding: 12px;
}
.loading {
  padding: 50px;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.row input {
  flex: 1;
  min-width: 180px;
}
.portal-shell .sidebar {
  background: #102e54;
}
.file-note {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0;
}
.filter {
  margin-bottom: 18px;
  max-width: 400px;
}
.activity-json {
  white-space: pre-wrap;
  font-size: 11px;
  max-height: 220px;
  overflow: auto;
}
body:has(dialog[open]) {
  overflow: hidden;
}
@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 195px minmax(0, 1fr);
  }
  .sidebar {
    padding: 24px 16px;
  }
  main {
    padding: 24px;
  }
  .topbar {
    padding: 16px 24px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .stat:nth-child(2) {
    border-right: 0;
  }
  .stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 700px) {
  .shell {
    display: block;
  }
  .sidebar {
    gap: 16px;
    padding: 20px;
  }
  .sidebar nav {
    flex-direction: row;
    overflow: auto;
  }
  .sidebar nav a {
    white-space: nowrap;
    padding: 8px;
  }
  .sidebar .account {
    display: none;
  }
  .brand {
    font-size: 20px;
  }
  .topbar {
    padding: 12px 20px;
    min-height: 60px;
  }
  .topbar input {
    max-width: 190px;
  }
  main {
    padding: 22px 16px;
  }
  h1 {
    font-size: 29px;
  }
  .page-head {
    flex-direction: column;
  }
  .panel {
    padding: 18px;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .detail {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .detail dd {
    margin-bottom: 12px;
  }
  .login-layout {
    grid-template-columns: 1fr;
  }
  .login-art {
    min-height: 220px;
    padding: 30px;
  }
  .login-art h1 {
    font-size: 30px;
    margin-top: 35px;
  }
  .login-main {
    padding: 30px 22px;
  }
  .field-grid .wide {
    grid-column: auto;
  }
  th,
  td {
    padding: 12px;
  }
  .stats {
    margin: 18px 0;
  }
  .stat {
    padding: 16px;
  }
}
:root .grid {
  align-items: start;
}
.sidebar .brand {
  font-size: 20px;
  letter-spacing: 2px;
  white-space: nowrap;
}
.analysis-item {
  border-top: 1px solid #dedbd3;
  padding: 16px 0;
}
.analysis-item > summary {
  cursor: pointer;
  font-weight: 600;
  text-transform: capitalize;
}
.analysis-item details {
  margin: 12px 0;
}
.analysis-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}
.clause-diff ins {
  background: #e2f3e7;
  color: #16482b;
  text-decoration: underline;
}
.clause-diff del {
  background: #fbe7e7;
  color: #7b2020;
  text-decoration: line-through;
}
.clause-diff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 800px) {
  .clause-diff-grid {
    grid-template-columns: 1fr;
  }
}
.table-wrap td:first-child a[href^="#matters/"] {
  white-space: nowrap;
}
.billing-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  margin: 0.5rem 0 1rem;
}
.research-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
  margin: 24px 0;
}
.research-layout.research-collapsed {
  grid-template-columns: minmax(0, 1fr);
}
.research-reader,
.research-side {
  background: white;
  border: 1px solid #dedbd3;
  padding: 22px;
  min-width: 0;
  max-height: 78vh;
  overflow: auto;
}
.research-side {
  position: sticky;
  top: 12px;
}
.research-text,
.official-excerpt {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.75;
}
.research-section {
  border-top: 1px solid #eee;
  padding-top: 14px;
}
.research-section h4 {
  color: #6b7280;
  font-size: 12px;
}
.selection-menu {
  position: sticky;
  top: -22px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: #f4f1e8;
  border: 1px solid #c9a96a;
  box-shadow: 0 4px 10px #0001;
}
.selection-menu[hidden],
.research-side[hidden] {
  display: none;
}
.selection-menu button {
  padding: 8px;
  font-size: 12px;
}
.research-selection {
  font-size: 13px;
  border-left: 3px solid #c9a96a;
  padding-left: 12px;
  max-height: 100px;
  overflow: auto;
  white-space: pre-wrap;
}
.research-citation {
  padding: 18px 0;
  border-bottom: 1px solid #dedbd3;
  overflow-wrap: anywhere;
}
.research-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}
.research-form label,
.research-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.research-form .check {
  display: flex;
  align-items: start;
}
.research-form input,
.research-form textarea,
.research-form select,
.research-filters input,
.research-filters select {
  width: 100%;
  min-width: 0;
}
.research-form input[type="checkbox"] {
  width: auto;
}
.research-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.official-excerpt {
  margin: 14px 0;
  padding: 16px;
  background: #faf9f2;
  border-left: 3px solid #0d2d5b;
}
@media (max-width: 1000px) {
  .research-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .research-side {
    position: static;
    max-height: 70vh;
  }
  .research-reader {
    max-height: 55vh;
  }
}
@media (max-width: 600px) {
  .research-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .research-reader,
  .research-side {
    padding: 14px;
  }
  .selection-menu {
    top: -14px;
  }
}
.billing-rows {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}
.billing-row {
  border: 1px solid #dedbd3;
  border-radius: 8px;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  min-width: 0;
}
.billing-row label {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}
.billing-row input {
  width: 100%;
  min-width: 0;
}
.billing-row button {
  justify-self: start;
}
.panel > details {
  border-top: 1px solid #dedbd3;
  padding: 1rem 0;
}
.panel > details > summary {
  cursor: pointer;
  font-weight: 600;
}
@media (max-width: 600px) {
  .billing-row {
    grid-template-columns: 1fr;
  }
}
.document-stage {
  position: relative;
  height: 65vh;
  min-height: 320px;
  background: #eee;
}
.document-frame {
  position: absolute;
  inset: 0;
  overflow: auto;
}
.document-content {
  padding: 20px;
  background: white;
  font-size: 16px;
}
.document-content img {
  max-width: 100%;
  height: auto;
}
.document-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0;
}
.document-controls input[type="number"] {
  width: 70px;
}
.document-controls input[type="search"] {
  width: 220px;
  max-width: 100%;
}
.document-controls select {
  width: auto;
}
.document-section {
  margin-bottom: 24px;
}
.document-viewer .current-match {
  background: #fcae38;
  outline: 2px solid #946100;
}
.research-reader:has(.document-viewer) {
  max-height: none;
  overflow: visible;
  min-width: 0;
}
.document-viewer {
  min-width: 0;
}
