* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f6f8;
  color: #17202a;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}

a {
  color: #0b5cab;
}

.app-nav {
  display: flex;
  gap: 18px;
  align-items: center;
  min-height: 48px;
  padding: 0 max(16px, calc((100vw - 1040px) / 2));
  border-bottom: 1px solid #d8dee6;
  background: #fff;
}

.app-nav a {
  color: #17202a;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.app-nav form {
  margin: 0;
}

.nav-spacer {
  flex: 1 1 auto;
}

.signed-in {
  color: #4b5563;
  font-size: 13px;
  white-space: nowrap;
}

.nav-button {
  min-height: 30px;
  border-color: #b8c2cc;
  padding: 0 10px;
  background: #fff;
  color: #17202a;
  font-size: 13px;
}

.shell {
  width: min(1040px, calc(100vw - 32px));
  margin: 32px auto;
  display: grid;
  gap: 18px;
}

.landing-shell {
  width: min(460px, calc(100vw - 32px));
  min-height: 100vh;
  align-content: center;
  margin: 0 auto;
}

.wide-shell {
  width: min(1280px, calc(100vw - 32px));
}

.panel {
  background: #fff;
  border: 1px solid #d8dee6;
  border-radius: 6px;
  padding: 22px;
  box-shadow: 0 1px 2px rgb(31 41 55 / 8%);
}

h1,
h2 {
  margin: 0 0 18px;
  font-weight: 650;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.upload {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

label span {
  font-size: 13px;
}

input {
  min-height: 42px;
  border: 1px solid #b8c2cc;
  border-radius: 4px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.search-form,
.inline-upload {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.search-form input {
  min-width: min(420px, 100%);
}

.inline-upload label,
.search-form input {
  flex: 1 1 320px;
}

fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid #d8dee6;
  border-radius: 4px;
}

legend {
  padding: 0 6px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 650;
}

.choice {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: center;
  font-weight: 500;
}

.choice input {
  min-height: 18px;
  width: 18px;
  padding: 0;
}

button,
.button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid #1f6fb2;
  border-radius: 4px;
  padding: 0 14px;
  background: #1f6fb2;
  color: #fff;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #1f6fb2;
  border-radius: 4px;
  padding: 0 10px;
  background: #1f6fb2;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.secondary {
  background: #fff;
  color: #1f6fb2;
}

.danger {
  border-color: #b42318;
  color: #b42318;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

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

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

.data-table {
  min-width: 760px;
}

.data-table td {
  max-width: 460px;
  overflow-wrap: anywhere;
}

.log-topline {
  margin-bottom: 10px;
}

.log-source {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
}

.log-table-scroll {
  width: 100%;
  max-width: 100%;
  max-height: 560px;
  overflow: auto;
  scrollbar-gutter: stable;
  border: 1px solid #d8dee6;
  border-radius: 4px;
}

.log-table {
  width: max-content;
  min-width: 1320px;
  font-size: 13px;
}

.log-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  border-bottom-color: #c8d0d9;
}

.log-table th,
.log-table td {
  padding: 8px;
}

.log-table td {
  max-width: 300px;
  overflow-wrap: anywhere;
}

.log-table td:nth-child(1) {
  min-width: 210px;
  white-space: nowrap;
}

.log-table td:nth-child(2),
.log-table td:nth-child(3),
.log-table td:nth-child(4),
.log-table td:nth-child(5),
.log-table td:nth-child(8) {
  min-width: 110px;
}

.log-table td:nth-child(6) {
  min-width: 360px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #e3e7eb;
  text-align: left;
  vertical-align: top;
}

th {
  color: #4b5563;
  font-size: 13px;
}

.results-table {
  table-layout: fixed;
}

.results-table th:nth-child(2),
.results-table td:nth-child(2) {
  width: 72px;
}

.results-table th:nth-child(3),
.results-table td:nth-child(3) {
  width: 88px;
}

.results-table th:nth-child(4),
.results-table td:nth-child(4) {
  width: 136px;
}

.results-table th:nth-child(5),
.results-table td:nth-child(5) {
  width: 168px;
}

.results-table td {
  white-space: nowrap;
}

.results-table td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.config-list td:first-child {
  min-width: 280px;
}

.muted,
.lede {
  color: #4b5563;
}

.muted {
  margin-top: 4px;
  font-size: 13px;
}

.lede {
  margin: -8px 0 18px;
}

.status {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #b8c2cc;
  border-radius: 4px;
  background: #f8fafc;
  color: #17202a;
}

.status.success {
  border-color: #8fc79e;
  background: #eef9f1;
}

.status.error {
  border-color: #e3a2a2;
  background: #fff1f1;
}

.status ul {
  margin: 0;
  padding-left: 18px;
}

.file-icon {
  display: inline-block;
  position: relative;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: -3px;
}

.file-icon::before {
  content: "";
  position: absolute;
  inset: 2px 3px 1px 3px;
  border: 1px solid #7b8794;
  border-radius: 2px;
  background: #fff;
}

.file-icon::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 2px;
  width: 5px;
  height: 5px;
  border-left: 1px solid #7b8794;
  border-bottom: 1px solid #7b8794;
  background: #eef2f6;
}

.folder-icon::before {
  inset: 6px 2px 2px 2px;
  border-color: #b7791f;
  background: #f8d776;
}

.folder-icon::after {
  left: 3px;
  top: 3px;
  width: 8px;
  height: 5px;
  border: 1px solid #b7791f;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: #f3c64e;
}

.file-doc::before {
  border-color: #1f6fb2;
  background: #dcebff;
}

.file-sheet::before {
  border-color: #238636;
  background: #dcf6e4;
}

.file-slide::before {
  border-color: #b45309;
  background: #ffead5;
}

.file-pdf::before {
  border-color: #c2410c;
  background: #fee2d6;
}

.file-code::before {
  border-color: #6d5bd0;
  background: #ebe8ff;
}

.file-text::before {
  border-color: #64748b;
  background: #f1f5f9;
}

.file-image::before {
  border-color: #0e7490;
  background: #d9f3f8;
}

.file-archive::before {
  border-color: #92400e;
  background: #f7e4bf;
}

dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  margin: 0;
}

dt {
  color: #4b5563;
  font-weight: 650;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.topline,
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.actions {
  justify-content: flex-start;
  margin: 18px 0 0;
}

pre {
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid #d8dee6;
  border-radius: 4px;
  background: #111827;
  color: #d1d5db;
  white-space: pre-wrap;
}

.file-preview {
  max-height: 70vh;
}

.markdown-preview-shell {
  max-height: 72vh;
  overflow: auto;
  border: 1px solid #d8dee6;
  border-radius: 4px;
  background: #ffffff;
}

.markdown-preview-shell .muted {
  padding: 14px;
}

.markdown-preview {
  min-width: 0;
  padding: 18px;
  color: #1f2937;
  line-height: 1.55;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4 {
  margin: 18px 0 10px;
  line-height: 1.25;
  color: #111827;
}

.markdown-preview h1 {
  font-size: 24px;
}

.markdown-preview h2 {
  font-size: 19px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 6px;
}

.markdown-preview h3 {
  font-size: 16px;
}

.markdown-preview p,
.markdown-preview ul,
.markdown-preview ol,
.markdown-preview blockquote,
.markdown-preview pre,
.markdown-preview table {
  margin: 0 0 14px;
}

.markdown-preview blockquote {
  border-left: 4px solid #cbd5e1;
  padding: 8px 12px;
  background: #f8fafc;
  color: #475569;
}

.markdown-preview code {
  padding: 2px 4px;
  border-radius: 3px;
  background: #f3f4f6;
  color: #111827;
}

.markdown-preview pre {
  min-height: 0;
  max-height: none;
  overflow-x: auto;
  white-space: pre;
}

.markdown-preview pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-preview table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown-preview th,
.markdown-preview td {
  padding: 7px 9px;
  border: 1px solid #d8dee6;
  text-align: left;
  vertical-align: top;
}

.markdown-preview th {
  background: #f3f4f6;
  font-weight: 700;
}

.markdown-preview a {
  color: #174ea6;
}

.file-note {
  display: grid;
  gap: 12px;
}

.file-note p {
  margin: 0;
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 20px, 1040px);
    margin: 10px auto;
  }

  .panel {
    padding: 16px;
  }

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

  .results-table {
    table-layout: auto;
  }

  .results-table thead {
    display: none;
  }

  .results-table,
  .results-table tbody,
  .results-table tr,
  .results-table td {
    display: block;
    width: 100%;
  }

  .results-table tr {
    padding: 10px 0;
    border-bottom: 1px solid #e3e7eb;
  }

  .results-table td {
    border-bottom: 0;
    padding: 3px 0;
    white-space: normal;
  }

  .results-table td:first-child {
    overflow: visible;
    text-overflow: clip;
    font-weight: 650;
  }

  .row-actions {
    padding-top: 8px;
  }
}
