:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --surface-strong: #e8eef6;
  --fg: #172033;
  --muted: #66758a;
  --line: #d8e0ea;
  --line-strong: #b9c6d6;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8f0ff;
  --teal: #0f766e;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --warning: #b45309;
  --shadow: 0 1px 2px rgba(23, 32, 51, 0.06), 0 10px 28px rgba(23, 32, 51, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html.search-page {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.site-feedback-footer {
  width: min(1180px, calc(100% - 40px));
  margin: auto auto 26px;
  padding-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.site-feedback-text,
.site-filing-text {
  display: inline;
}

.site-filing-text {
  margin-left: .8em;
  white-space: nowrap;
}

.container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 38px;
}

.auth-page {
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
}

.auth-page .page-head {
  max-width: none;
  margin: 6px auto 18px;
  text-align: center;
}

.auth-page .flash {
  max-width: none;
}

.auth-page .card {
  margin-left: 0;
  margin-right: 0;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(216, 224, 234, 0.84);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.header .container {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 0;
}

.brand {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 17px;
}

.brand a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--fg);
  text-decoration: none;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  background: #ffffff;
  object-fit: contain;
}

.header-quota {
  flex: 1 1 auto;
  min-width: 180px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav a,
.nav-button,
.nav-user {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
}

.nav-user {
  max-width: 260px;
  overflow: hidden;
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--fg);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user.account-menu-wrap {
  position: relative;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
}

.account-trigger {
  min-height: 36px;
  max-width: 260px;
  padding: 7px 12px;
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--fg);
  font-weight: 400;
  box-shadow: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-trigger:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--fg);
}

.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 132px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.account-menu[hidden] {
  display: none;
}

.account-menu-item {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border-color: transparent;
  background: transparent;
  color: var(--fg);
  font-weight: 400;
  box-shadow: none;
}

.account-menu-item:hover {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--fg);
}

.nav-button {
  width: auto;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.language-toggle {
  min-width: 76px;
}

.nav a:hover,
.nav-button:hover {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--fg);
  text-decoration: none;
}

.nav a[aria-current="page"] {
  border-color: rgba(37, 99, 235, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  color: var(--fg);
  line-height: 1.22;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 0 0 12px;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.page-head {
  display: grid;
  gap: 8px;
  max-width: 820px;
  margin: 6px 0 18px;
}

.page-head p {
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 16px 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.email-code-row {
  flex-wrap: nowrap;
}

.email-code-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.email-code-row .btn {
  flex: 0 0 128px;
  width: auto;
  font-weight: 400;
  white-space: nowrap;
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card {
  margin: 16px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card > :last-child {
  margin-bottom: 0;
}

.form-section {
  display: grid;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
}

.section-heading .muted {
  font-size: 13px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input,
select {
  padding: 8px 10px;
}

textarea {
  min-height: 360px;
  padding: 12px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  line-height: 1.48;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

input[type="file"] {
  padding: 7px;
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--fg);
  font-weight: 700;
  cursor: pointer;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

button:hover,
.btn:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
}

button:active,
.btn:active {
  transform: translateY(1px);
}

button:focus-visible,
.btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

button:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn,
button.secondary,
#reset,
#upload-cif,
#clear-cif-query {
  border-color: var(--line);
  background: #ffffff;
  color: var(--fg);
}

.btn:hover,
button.secondary:hover,
#reset:hover,
#upload-cif:hover,
#clear-cif-query:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  color: var(--fg);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 4px;
}

.segment {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.segment:hover {
  background: #ffffff;
  color: var(--fg);
}

.segment.active,
.segment.active:hover {
  background: var(--accent);
  color: #ffffff;
}

.search-card {
  display: grid;
  gap: 16px;
}

.search-tabs {
  width: min(560px, 100%);
}

.search-panel[hidden] {
  display: none;
}

.search-panel {
  display: grid;
  gap: 0;
}

.search-actions {
  margin-top: 16px;
}

#upload-search-cif,
#save,
#login_btn,
#register_btn,
#reset_btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

#upload-search-cif:hover,
#save:hover,
#login_btn:hover,
#register_btn:hover,
#reset_btn:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #ffffff;
}

.danger,
#del {
  border-color: var(--danger);
  background: #ffffff;
  color: var(--danger);
}

.danger:hover,
#del:hover {
  border-color: var(--danger-hover);
  background: var(--danger-hover);
  color: #ffffff;
}

.managed-actions {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
}

.managed-actions.is-visible {
  display: flex;
}

.select-cell {
  width: 58px;
  text-align: center;
}

.row-select {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.notice {
  margin: 10px 0;
  color: var(--muted);
  font-weight: 650;
}

.flash-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.flash-item {
  position: relative;
  padding: 10px 12px;
  padding-right: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--fg);
}

.flash-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 24px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: currentColor;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
}

.flash-close:hover {
  border: 0;
  background: transparent;
  color: currentColor;
  opacity: 0.72;
}

.flash-item.error {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fff1f2;
  color: #991b1b;
}

.flash-item.ok {
  border-color: rgba(15, 118, 110, 0.28);
  background: #ecfdf5;
  color: #065f46;
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.38);
  opacity: 0;
  transition: opacity 120ms ease;
}

.app-dialog.is-open {
  opacity: 1;
}

.app-dialog-panel {
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(8px);
  transition: transform 120ms ease;
}

.app-dialog-title {
  margin-bottom: 10px;
  color: var(--fg);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
}

.app-dialog.is-open .app-dialog-panel {
  transform: translateY(0);
}

.app-dialog-body {
  color: var(--fg);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
}

.app-dialog-body.app-dialog-body--regular {
  font-weight: 400;
}

.app-dialog-body-text {
  min-height: 40px;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.app-dialog-button {
  min-width: 82px;
}

.agreement-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.55;
  overflow-x: auto;
}

.agreement-row input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.agreement-row input[type="checkbox"]:focus,
.agreement-row input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: none;
}

.agreement-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
}

.agreement-text label {
  display: inline;
  gap: 0;
  min-width: 0;
  color: inherit;
  font: inherit;
  font-weight: inherit;
}

.agreement-link {
  display: inline;
  min-height: 0;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 400;
  line-height: inherit;
  text-decoration: none;
  white-space: nowrap;
  overflow-wrap: normal;
  cursor: pointer;
  box-shadow: none;
  transform: none;
}

.forgot-password-row {
  margin: 18px 0 6px;
  text-align: right;
}

.forgot-password-link {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.agreement-link:hover,
.agreement-link:active,
.agreement-link:focus {
  border-color: transparent;
  background: transparent;
  color: var(--accent-hover);
  text-decoration: underline;
  outline: none;
  box-shadow: none;
  transform: none;
}

.agreement-page {
  flex: 1 0 auto;
}

.agreement-document {
  min-height: 520px;
  border-top: 1px solid var(--line);
  padding: 24px 0 48px;
}

.agreement-document h2 {
  margin: 30px 0 12px;
  color: var(--fg);
  font-size: 20px;
  line-height: 1.35;
}

.agreement-document h3 {
  margin: 22px 0 10px;
  color: var(--fg);
  font-size: 16px;
  line-height: 1.45;
}

.agreement-document p {
  margin: 0 0 10px;
  color: var(--fg);
  font-size: 15px;
  line-height: 1.85;
}

.agreement-document .doc-list-item {
  padding-left: 1.8em;
  text-indent: -1.8em;
}

.agreement-numbered .agreement-section {
  counter-reset: agreement-item;
}

.agreement-numbered .agreement-numbered-group {
  counter-reset: agreement-item;
}

.agreement-numbered .agreement-item {
  position: relative;
  padding-left: 2.15em;
}

.agreement-numbered .agreement-item::before {
  position: absolute;
  left: 0;
  counter-increment: agreement-item;
  content: counter(agreement-item) ".";
  color: var(--muted);
  font-weight: 700;
}

.agreement-numbered .agreement-subitem {
  padding-left: 2.15em;
}

.agreement-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0 0 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.agreement-meta p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  border-color: rgba(15, 118, 110, 0.28);
  background: #ecfdf5;
  color: #047857;
}

.badge.error {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fff1f2;
  color: #b91c1c;
}

.mode-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mode-inline label,
#adv-form label,
#cif-query-form label {
  min-width: 150px;
}

#adv-form,
#cif-query-form {
  align-items: flex-end;
}

.query-main-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  align-items: end;
}

.space-group-combo {
  position: relative;
}

.space-group-combo input {
  padding-right: 42px;
}

.space-group-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(calc(-50% - 1px));
  width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.space-group-toggle::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
}

.space-group-toggle:hover {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--fg);
}

.space-group-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  display: grid;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.space-group-menu[hidden] {
  display: none;
}

.space-group-option {
  justify-content: flex-start;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  box-shadow: none;
  text-align: left;
}

.space-group-option:hover,
.space-group-option.is-active {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--accent);
}

.space-group-empty {
  padding: 9px 8px;
  color: var(--muted);
  font-size: 13px;
}

.file-query-inline {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.upload-query {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.upload-query-label {
  margin-bottom: -4px;
}

.custom-file-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.file-input-native {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-input-trigger {
  cursor: pointer;
}

.file-input-name {
  min-width: 180px;
  overflow-wrap: anywhere;
}

.periodic-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.periodic-panel .section-heading {
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
  text-align: left;
  white-space: nowrap;
}

.periodic-panel .section-heading h3 {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.periodic-panel .section-heading .muted {
  margin-left: auto;
  text-align: right;
}

.periodic-inner {
  width: max-content;
  min-width: calc(18 * 40px + 17 * 4px);
  margin: 0 auto;
}

.formula-key {
  grid-column: var(--group);
  grid-row: var(--period);
  width: 40px;
  min-height: 36px;
  padding: 4px 6px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--fg);
  font-size: 13px;
  font-weight: 800;
}

.formula-key:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  color: var(--fg);
}

.periodic-scroll {
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 4px;
}

.periodic-table {
  display: grid;
  grid-template-columns: repeat(18, 40px);
  grid-template-rows: repeat(10, 36px);
  gap: 4px;
  width: 100%;
  padding: 2px;
}

.element-key {
  grid-column: var(--group);
  grid-row: var(--period);
  width: 40px;
  min-height: 36px;
  padding: 4px 3px;
  border-color: rgba(15, 118, 110, 0.24);
  background: #ffffff;
  color: var(--fg);
  font-size: 12px;
  font-weight: 850;
}

.element-key:hover {
  border-color: var(--teal);
  background: #ecfdf5;
  color: #064e3b;
}

.range-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.advanced-filters-content[hidden] {
  display: none;
}

.range-pair {
  display: grid;
  gap: 6px;
}

.range-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.search-results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: none;
}

.page-head.search-results-head {
  width: 100%;
}

.search-results-head h1 {
  margin: 0;
}

.search-results-head .btn {
  width: auto;
  font-weight: 400;
}

.results-page .header-quota,
.results-page .nav a,
.results-page .nav-button,
.results-page .nav-user,
.results-page .account-trigger,
.results-page .account-menu-item,
.results-page .search-results-head .btn {
  font-weight: 400;
}

.results-page tbody .btn.small {
  width: auto;
  min-width: max-content;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  text-align: center;
}

.quota-line {
  min-height: 22px;
}

table {
  width: 100%;
  margin: 14px 0;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.results-page thead th {
  font-weight: 700;
  color: var(--fg);
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
}

.results-page tbody td,
.results-page tbody td a,
.results-page .pager,
.results-page #pager-info,
.results-page .pager .btn,
.results-page .pager button {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}

.results-page tbody td {
  text-align: center;
  vertical-align: middle;
}

.results-page tbody td a {
  font-weight: 400;
}

.results-page td::before {
  font-weight: 400;
}

.results-page .pager {
  color: var(--fg);
}

.results-page #pager-info {
  color: var(--muted);
  font-weight: 400;
}

.results-page .pager .btn,
.results-page .pager button {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--fg);
  box-shadow: none;
}

.results-page .pager .btn:hover,
.results-page .pager button:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
  color: var(--fg);
}

.results-page .mobile-results {
  display: none !important;
}

.results-page .mobile-results:empty {
  display: none !important;
  margin: 0;
}

.mobile-result-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mobile-result-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
}

.mobile-result-name {
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-result-action {
  flex: 0 0 auto;
  width: auto;
  min-height: 34px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.results-page .metric-view-link {
  width: auto;
  min-height: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
}

.results-page .metric-view-link:hover {
  border-color: transparent;
  background: transparent;
  color: var(--fg);
  text-decoration: underline;
}

.mobile-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 14px;
}

.mobile-result-grid div {
  min-width: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.mobile-result-grid span {
  font-weight: 400;
}

.mobile-result-grid em {
  font-style: normal;
  font-weight: 400;
}

.mobile-result-metrics {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfdff;
}

td a {
  font-weight: 720;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.pager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kv {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 8px 14px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.kv .no-data {
  grid-column: 1 / -1;
}

.no-data {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.5;
  text-align: center;
}

.kv div:nth-child(odd) {
  color: var(--muted);
  font-weight: 750;
}

.kv div:nth-child(even) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.viewer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: min(520px, 64vh);
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.viewer.no-data-state {
  height: auto;
  min-height: 0;
}

.viewer.no-data-state > div {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
}

.viewer > canvas,
.viewer canvas,
.viewer > div {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
}

pre {
  max-height: 460px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.protected-cif {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  cursor: default;
}

.detail-title-row {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-actions {
  justify-content: flex-end;
}

.detail-actions .btn {
  font-weight: 400;
}

.detail-panels {
  align-items: stretch;
}

.detail-panel {
  display: flex;
  flex-direction: column;
}

.detail-panel .kv,
.detail-panel .viewer {
  flex: 1 1 auto;
  margin: 14px 0 0;
}

.detail-panel .kv > div:nth-child(odd) {
  color: var(--fg);
  font-weight: 750;
}

.detail-panel .kv > div:nth-child(even) {
  color: var(--fg);
  font-weight: 400;
}

.small {
  font-size: 13px;
}

@media (max-width: 900px) {
  .grid2 {
    grid-template-columns: 1fr;
  }

  .grid3,
  .range-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar label,
  .mode-inline label,
  #adv-form label,
  #cif-query-form label,
  .query-main-row {
    flex: 1 1 220px;
  }

  .query-main-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 28px, 1180px);
    padding: 16px 0 28px;
  }

  .site-feedback-footer {
    width: min(100% - 28px, 1180px);
    margin-bottom: 18px;
    padding-top: 16px;
    font-size: 11px;
  }

  .site-filing-text {
    display: block;
    margin: 2px 0 0;
  }

  .header {
    position: static;
  }

  .header .container {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
  }

  .brand {
    flex: 0 0 auto;
    font-size: 16px;
  }

  .brand-logo {
    width: 22px;
    height: 22px;
  }

  .header-quota {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    font-size: 13px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    width: auto;
    justify-content: flex-end;
    margin-left: auto;
  }

  .nav a,
  .nav-button,
  .nav-user,
  .account-trigger {
    width: auto;
    min-width: 0;
    min-height: 34px;
    padding: 5px 8px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
  }

  .account-trigger {
    max-width: 76px;
  }

  .nav a[aria-current="page"] {
    display: none;
  }

  .card {
    padding: 14px;
  }

  .agreement-page {
    padding-bottom: 24px;
  }

  .agreement-document {
    min-height: 45vh;
    padding: 18px 0 34px;
  }

  .agreement-document h2 {
    margin: 24px 0 10px;
    font-size: 18px;
  }

  .agreement-document h3 {
    margin: 18px 0 8px;
    font-size: 15px;
  }

  .agreement-document p {
    font-size: 14px;
    line-height: 1.75;
  }

  .agreement-meta {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }

  .toolbar,
  .row,
  .pager {
    align-items: stretch;
  }

  .results-page .pager {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .results-page #pager-info {
    width: 100%;
    text-align: left;
  }

  .results-page .pager-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
  }

  .results-page .pager .btn,
  .results-page .pager button {
    flex: 1 1 0;
    width: auto;
  }

  .mobile-result-top {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .mobile-result-action {
    width: auto;
    min-height: 32px;
    padding: 3px 8px;
    font-size: 13px;
  }

  .mobile-result-stacked em,
  .mobile-result-stacked .metric-view-link {
    display: block;
    margin-top: 2px;
  }

  .results-page table {
    display: none !important;
  }

  .results-page .mobile-results {
    display: grid !important;
    gap: 12px;
    margin: 14px 0;
  }

  .periodic-panel .section-heading {
    align-items: flex-start;
    gap: 4px;
    white-space: normal;
  }

  .periodic-panel .section-heading h3,
  .periodic-panel .section-heading .muted {
    flex: 1 1 100%;
  }

  .periodic-panel .section-heading .muted {
    margin-left: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .agreement-row {
    align-items: flex-start;
    overflow-x: visible;
  }

  .agreement-text {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .agreement-link {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .file-query-inline {
    grid-template-columns: 1fr;
  }

  .toolbar label,
  .row label,
  #adv-form label,
  #cif-query-form label,
  .mode-inline label {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .toolbar button,
  .toolbar .btn,
  .row > button,
  .row > .btn,
  .pager button,
  .pager .btn {
    flex: 1 1 150px;
  }

  .detail-title-row,
  .detail-actions {
    flex-direction: row;
    align-items: flex-start;
  }

  .detail-title-row {
    flex-wrap: nowrap;
  }

  .detail-actions {
    flex: 0 0 auto;
  }

  .detail-actions .btn {
    width: auto;
    min-width: max-content;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  thead {
    display: none;
  }

  tr {
    margin: 12px 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  td {
    display: grid;
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
  }

  .kv {
    grid-template-columns: minmax(86px, 32%) minmax(0, 1fr);
    gap: 8px 10px;
    padding: 12px;
    font-size: 13px;
  }

  .viewer {
    height: 420px;
    min-height: 280px;
  }

  textarea {
    min-height: 300px;
  }
}

@media (max-width: 420px) {
  .container {
    width: min(100% - 22px, 1180px);
  }

  .nav {
    flex-wrap: nowrap;
  }

  .grid3,
  .range-grid {
    grid-template-columns: 1fr;
  }

  .search-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 24px;
  }

  .card {
    padding: 12px;
  }

  .agreement-row {
    gap: 6px;
    align-items: center;
    font-size: 11px;
    line-height: 1.45;
  }

  .agreement-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
  }

  button,
  .btn {
    width: 100%;
  }

  .results-page .pager .btn,
  .results-page .pager button {
    flex: 1 1 0;
    width: auto;
  }

  .header button,
  .header .btn,
  .header .nav a,
  .header .nav-user,
  .search-tabs button {
    width: auto;
  }

  .row > button,
  .row > .btn {
    flex: 1 1 100%;
  }

  .email-code-row {
    flex-wrap: nowrap;
  }

  .email-code-row input {
    flex: 1 1 auto;
    min-width: 0;
  }

  .email-code-row .btn {
    flex: 0 0 118px;
    width: auto;
    font-weight: 400;
    padding-left: 8px;
    padding-right: 8px;
    white-space: nowrap;
  }

  .detail-actions .btn {
    flex: 0 0 auto;
    width: auto;
  }

  .search-results-head .btn {
    width: auto;
    margin-left: auto;
    justify-self: end;
  }

  .formula-key,
  .element-key {
    width: auto;
  }

  .periodic-scroll {
    overflow-x: auto;
  }

  .periodic-table {
    grid-template-columns: repeat(18, 26px);
    grid-template-rows: repeat(10, 26px);
    gap: 2px;
  }

  .periodic-inner {
    width: max-content;
    min-width: calc(18 * 26px + 17 * 2px);
  }

  .formula-key,
  .element-key {
    width: 26px;
    min-height: 26px;
    padding: 1px 2px;
    border-radius: 4px;
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
    overflow-wrap: normal;
  }

  td {
    grid-template-columns: 1fr;
  }

  .viewer {
    height: 360px;
  }
}

@media (max-width: 340px) {
  .agreement-row {
    align-items: center;
    overflow-x: visible;
  }

  .agreement-text {
    white-space: normal;
  }

  .agreement-link {
    white-space: nowrap;
  }
}
