:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #20242c;
  --muted: #667085;
  --line: #d9dee8;
  --blue: #1d5fd1;
  --navy: #10243f;
  --green: #16805a;
  --amber: #a15c07;
  --red: #b42318;
  --shadow: 0 14px 35px rgba(17, 24, 39, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

html:has(.embed-body) {
  overflow: hidden;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.embed-body {
  background: #fff;
  color: #1f2937;
  font-size: var(--embed-font-size, 13px);
  overflow: hidden;
}

.embed-shell {
  width: 100%;
  height: var(--embed-height, 440px);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.embed-tools {
  display: flex;
  gap: 10px;
  align-items: end;
  padding: 0 0 8px;
  background: #fff;
  flex: 0 0 auto;
}

.embed-tools label {
  flex: 1;
}

.embed-tools span {
  display: block;
  margin-bottom: 4px;
  color: #667085;
  font-size: calc(var(--embed-font-size, 13px) - 1px);
}

.embed-tools input {
  width: 100%;
  height: 30px;
  border: 1px solid #cfd8e8;
  border-radius: 4px;
  padding: 0 8px;
  font: inherit;
}

.embed-tools small {
  white-space: nowrap;
  color: #667085;
}

.embed-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 2px;
}

.embed-login-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #cfd8e8;
  border-radius: 4px;
  background: #f8fbff;
  color: #2457b8;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.embed-login-action:hover {
  border-color: #2457b8;
  background: #eef5ff;
}

.embed-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #d9dee8;
}

.embed-table {
  border-collapse: collapse;
  background: #fff;
  font-size: inherit;
  line-height: 1.45;
}

.embed-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #edf0f5;
}

.embed-table tr.odd {
  background: #f8fbff;
}

.embed-table a {
  color: #2457b8;
  font-size: inherit;
  text-decoration: underline;
}

.embed-date {
  color: #990066;
  font-weight: 700;
}

.embed-title {
  color: #2457b8;
}

.new-document-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid #f04438;
  border-radius: 999px;
  background: #d92d20;
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(217, 45, 32, .28);
}

.new-document-badge.compact {
  min-height: 18px;
  padding: 1px 6px;
  font-size: calc(var(--embed-font-size, 13px) - 2px);
}

.public-detail {
  height: var(--embed-height, 440px);
  max-height: none;
  overflow: auto;
  border: 1px solid #d9dee8;
  background: #fff;
  font-size: inherit;
}

.detail-nav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: #f8fbff;
  border-bottom: 1px solid #d9dee8;
}

.detail-nav a,
.detail-nav .disabled {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #cfd8e8;
  border-radius: 4px;
  background: #fff;
  color: #2457b8;
  text-decoration: none;
  font-weight: 700;
}

.detail-nav .embed-login-action {
  margin-left: 4px;
  color: #2457b8;
}

.detail-nav .disabled {
  color: #98a2b3;
}

.detail-article {
  padding: 12px;
}

.detail-article h1 {
  margin: 4px 0 12px;
  color: #1f2937;
  font-size: calc(var(--embed-font-size, 13px) + 5px);
  line-height: 1.45;
}

.detail-article dl {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.detail-article dt {
  color: #667085;
}

.detail-article dd {
  margin: 0;
}

.detail-muted {
  margin: 0;
  color: #667085;
}

.login-shell {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
}

.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 26px;
}

.login-card form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-action,
.copy-action {
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.form-message {
  min-height: 22px;
  color: var(--red);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px 32px 20px;
  background: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
  border-bottom: 1px solid #cfd8e8;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: 0;
}

.subtitle {
  margin: 7px 0 0;
  color: var(--muted);
}

.admin-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.admin-nav a,
.admin-nav button {
  display: inline-flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.admin-nav a:hover,
.admin-nav button:hover,
.secondary-action:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.sync-panel {
  min-width: 270px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fbfcff;
  border-radius: 8px;
}

.sync-panel div {
  flex: 1;
}

.sync-action {
  height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-action {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.sync-action:disabled {
  cursor: wait;
  opacity: .7;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 128, 90, .12);
}

.sync-panel strong,
.sync-panel small {
  display: block;
}

.sync-panel small {
  margin-top: 2px;
  color: var(--muted);
}

main {
  width: min(1320px, calc(100% - 64px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.settings-page {
  width: min(1320px, calc(100% - 64px));
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.summary-grid article,
.toolbar,
.content-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-grid article {
  padding: 16px 18px;
  border-top: 3px solid #dce7fb;
}

.summary-grid span {
  display: block;
  font-size: 28px;
  font-weight: 760;
}

.summary-grid p {
  margin: 2px 0 0;
  color: var(--muted);
}

.toolbar,
.settings-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.bulk-panel {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 220px 180px 170px;
  gap: 14px;
  align-items: end;
  margin-bottom: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.select-all-line {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
}

.select-all-line input {
  width: 18px;
  height: 18px;
}

.select-all-line span {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.result-panel {
  margin-bottom: 16px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.result-panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.result-panel ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.result-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.ack-action {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.sync-report-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  overflow: auto;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(2px);
  border: 0;
  border-left: 0;
  border-radius: 0;
  box-shadow: none;
}

.sync-report-modal::before {
  content: none;
}

.sync-report-card {
  width: min(860px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  background: #ffffff;
  border: 1px solid #d6e0ef;
  border-radius: 10px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.30);
}

.sync-report-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 24px 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-bottom: 1px solid #e5ebf4;
}

.sync-report-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.sync-report-header p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
}

.report-close {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #cfd8e8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sync-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 24px;
}

.sync-report-grid article {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.sync-report-grid strong {
  display: block;
  color: var(--blue);
  font-size: 26px;
  line-height: 1;
}

.sync-report-grid span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.sync-report-detail {
  padding: 0 24px 18px;
}

.sync-report-detail h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.report-section {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.report-section h4 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  font-size: 15px;
}

.report-section h4 span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.report-section ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #344054;
}

.report-section li + li {
  margin-top: 4px;
}

.report-section li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.report-section li > span:first-child {
  min-width: 0;
}

.report-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.report-actions button {
  height: 26px;
  padding: 0 9px;
  border: 1px solid #cfd8e8;
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.report-empty {
  margin: 0;
  padding: 14px;
  color: var(--green);
  background: #eefaf3;
  border: 1px solid #c9ead7;
  border-radius: 8px;
  font-weight: 700;
}

.sync-report-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px 24px 22px;
  border-top: 1px solid #e5ebf4;
}

.sync-report-footer span {
  color: var(--muted);
  font-weight: 650;
}

.connection-result {
  margin-top: -4px;
}

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

.connection-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.connection-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.connection-item span {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
}

.connection-item.ok span {
  color: var(--green);
  background: #e8f6ef;
}

.connection-item.fail span {
  color: var(--red);
  background: #feeceb;
}

.connection-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.row-select {
  width: 18px;
  height: 18px;
}

.workspace-bar,
.settings-hero {
  display: grid;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workspace-bar {
  grid-template-columns: minmax(260px, 1fr) 260px minmax(320px, 1.4fr) 130px 110px;
}

.workspace-bar h2,
.settings-hero h2 {
  margin: 0;
  font-size: 20px;
}

.workspace-bar .eyebrow {
  margin-bottom: 3px;
}

.link-action {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-hero {
  grid-template-columns: minmax(320px, 1fr) minmax(520px, .95fr);
  align-items: center;
  padding: 18px;
}

.settings-intro p {
  max-width: 620px;
}

.settings-command {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 12px;
  justify-self: end;
  width: min(620px, 100%);
}

.settings-actions {
  display: grid;
  grid-template-columns: 128px minmax(160px, 1fr) 140px;
  gap: 10px;
}

.settings-actions .sync-action,
.settings-actions .secondary-action {
  width: 100%;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(360px, 1.2fr);
  gap: 16px;
}

.settings-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.settings-card h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.settings-card.profile-card {
  min-height: 184px;
}

.settings-card.myoffice-card {
  min-height: 184px;
}

.settings-card label + label,
.form-grid label {
  margin-top: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid label {
  margin-top: 0;
}

.settings-card:last-child {
  grid-column: 1 / -1;
}

.db-card .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.db-card .form-grid label:nth-child(6) {
  grid-column: span 2;
}

.toolbar {
  grid-template-columns: 1fr 190px 170px;
}

.settings-panel {
  grid-template-columns: minmax(250px, .9fr) 190px 190px 210px minmax(280px, 1.2fr) 96px;
  align-items: end;
}

.profile-panel {
  grid-template-columns: minmax(250px, 1fr) 220px 240px 120px 130px;
}

.db-panel {
  grid-template-columns: minmax(250px, 1fr) 160px 180px 160px 170px 210px;
}

.code-settings {
  grid-template-columns: minmax(260px, 1fr) 220px 230px 140px minmax(260px, 1fr) 110px;
}

.settings-panel h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.settings-panel p {
  margin: 0;
  color: var(--muted);
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input,
select {
  height: 40px;
}

textarea {
  min-height: 74px;
  padding-top: 9px;
  padding-bottom: 9px;
  resize: vertical;
}

.content-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 0;
  min-height: 620px;
  overflow: visible;
}

.table-zone {
  min-width: 0;
}

.table-wrap {
  min-width: 0;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

#recordsTable {
  border-collapse: separate;
  border-spacing: 0;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: #eef5ff;
}

#recordsTable tbody tr:hover {
  background: #f7fbff;
}

#recordsTable tbody tr.active {
  background: #eef5ff;
}

#recordsTable th:first-child,
#recordsTable td:first-child {
  width: 34px;
  text-align: center;
}

.book-date-cell {
  min-width: 168px;
  white-space: nowrap;
}

.book-date {
  display: grid;
  gap: 3px;
}

.book-date strong {
  color: #1f2937;
  font-weight: 780;
  white-space: nowrap;
}

.book-date span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.subject {
  min-width: 320px;
  line-height: 1.45;
}

.file-status-cell {
  min-width: 92px;
  white-space: nowrap;
}

.file-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.file-status.ready {
  color: var(--green);
  background: #e8f6ef;
}

.file-status.error {
  color: var(--red);
  background: #feeceb;
}

.file-status.skipped {
  color: var(--amber);
  background: #fff3df;
}

.file-status.missing {
  color: var(--blue);
  background: #eef5ff;
}

.file-status.internal {
  color: var(--muted);
  background: #f2f4f7;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.public {
  color: var(--green);
  background: #e8f6ef;
}

.badge.internal {
  color: var(--amber);
  background: #fff3df;
}

.badge.blocked {
  color: var(--red);
  background: #feeceb;
}

.compare-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.compare-badge.same {
  color: var(--green);
  background: #e8f6ef;
}

.compare-badge.edited {
  color: var(--blue);
  background: #eef5ff;
}

.compare-badge.changed {
  color: var(--amber);
  background: #fff3df;
}

.compare-badge.missing {
  color: var(--red);
  background: #feeceb;
}

.file-link {
  color: var(--blue);
  font-weight: 650;
  text-decoration: none;
}

.file-link:hover {
  text-decoration: underline;
}

.backup-error {
  margin: 8px 0 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}

.backup-skipped {
  margin: 8px 0 0;
  color: var(--amber);
  font-size: 13px;
  font-weight: 650;
}

.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.backup-replace {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.backup-replace span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.backup-replace input {
  width: 100%;
}

.detail-panel {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  border-left: 1px solid var(--line);
  padding: 18px;
  background: #fbfcff;
}

.detail-panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.35;
}

.detail-panel dl {
  margin: 16px 0 0;
}

.detail-panel dt {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

.detail-panel dd {
  margin: 3px 0 0;
  font-weight: 650;
}

.note {
  margin-top: 16px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #384152;
}

.detail-field {
  display: block;
  margin-top: 14px;
}

.save-action {
  width: 100%;
  height: 40px;
  margin-top: 12px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.edited-mark {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef5ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.dt-container {
  padding: 12px;
}

.dt-container .dt-search input,
.dt-container .dt-length select {
  width: auto;
  height: 34px;
  margin-left: 6px;
}

.dt-container .dt-info,
.dt-container .dt-length,
.dt-container .dt-search {
  color: var(--muted);
  font-size: 13px;
}

.dt-container .dt-paging .dt-paging-button {
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 5px 9px;
}

.code-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.code-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.code-head h2 {
  margin: 0;
  font-size: 18px;
}

.code-grid textarea {
  min-height: 520px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
}

.code-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.install-panel {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.install-panel summary {
  cursor: pointer;
  font-weight: 750;
  color: var(--navy);
}

.install-panel textarea {
  width: 100%;
  min-height: 380px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.preview-card {
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.legacy-preview {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
  overflow: auto;
}

.legacy-preview table {
  border-collapse: collapse;
}

.legacy-preview td {
  border-bottom: 1px solid #edf0f5;
  padding: 7px 6px;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.48);
  backdrop-filter: blur(3px);
}

.busy-overlay[hidden] {
  display: none;
}

.busy-dialog {
  width: min(440px, 100%);
  padding: 26px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.24);
}

.busy-spinner {
  display: inline-block;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border: 4px solid #dbe7f5;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.busy-dialog h2 {
  margin: 0;
  font-size: 21px;
}

.busy-dialog p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

body.is-busy {
  overflow: hidden;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .topbar,
  .toolbar,
  .settings-panel,
  .workspace-bar,
  .settings-hero,
  .settings-command,
  .settings-actions,
  .settings-layout,
  .form-grid,
  .code-grid,
  .content-shell,
  .bulk-panel {
    display: block;
  }

  .sync-panel,
  .toolbar label,
  .bulk-panel label,
  .connection-item,
  .detail-panel {
    margin-top: 12px;
  }

  .connection-list {
    display: block;
  }

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

  .settings-command {
    width: 100%;
  }

  .db-card .form-grid label:nth-child(6) {
    grid-column: auto;
  }

  .detail-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .embed-tools {
    display: block;
  }

  .embed-actions {
    justify-content: space-between;
    margin-top: 6px;
  }

  .detail-nav {
    flex-wrap: wrap;
  }

  .detail-nav > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  main,
  .settings-page {
    width: calc(100% - 32px);
  }

  .sync-report-modal {
    padding: 12px;
  }

  .sync-report-header,
  .sync-report-footer {
    display: block;
  }

  .report-close,
  .sync-report-footer .ack-action {
    width: 100%;
    margin-top: 12px;
  }

  .sync-report-grid {
    grid-template-columns: 1fr 1fr;
    padding: 14px;
  }

  .sync-report-detail {
    padding: 0 14px 14px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}
