:root {
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  background: #f3f4f6;
  color: #1c1917;
}

body {
  margin: 0;
}

#shell.wide {
  min-height: 100vh;
}

.workspace {
  min-width: 0;
}

#shell.wide .workspace {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 24px;
  background: white;
  border-bottom: 1px solid #e7e5e4;
  position: sticky;
  top: 0;
  z-index: 2;
}

.topbar[hidden] {
  display: none;
}

.topbar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.topbar #logout {
  background: white;
  color: #1c1917;
  border: 1px solid #d6d3d1;
}

main {
  min-width: 0;
  flex: 1;
  padding: 24px 32px 72px;
}

#shell.wide .topbar {
  box-sizing: border-box;
  padding-left: max(32px, calc((100% - 1080px) / 2 + 32px));
  padding-right: max(32px, calc((100% - 1080px) / 2 + 32px));
}

#shell.wide main {
  width: min(1080px, 100%);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

#shell:not(.wide) main {
  max-width: 440px;
  margin: 0 auto;
  padding-top: 10vh;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

h2 {
  font-size: 1.2rem;
  margin: 0;
}

header p,
.hint,
.muted {
  color: #57534e;
}

button,
input {
  font: inherit;
  min-height: 44px;
}

button {
  background: #1e3a8a;
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
}

button.secondary {
  background: white;
  color: #1e3a8a;
  border: 1px solid #cbd5e1;
}

button.danger {
  background: #9f1239;
}

input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  background: white;
}

input[type="file"] {
  padding: 8px 0;
  border: 0;
  background: transparent;
}

.license-preview {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
}

.license-preview.is-pending {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 88px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  background: white;
  font: inherit;
}

select {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  font: inherit;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.measure {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.data td.token {
  min-width: 16rem;
}

.data td.token .token-line {
  display: flex;
  gap: 8px;
  align-items: center;
}

.data td.token input {
  flex: 1 1 auto;
  width: auto;
  min-width: 8rem;
}

.data td.token button {
  flex: 0 0 auto;
  padding: 0 10px;
  white-space: nowrap;
}

.data td.token .error,
.data td.token .muted {
  margin: 4px 0 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.row input {
  flex: 1 1 240px;
}

.error {
  color: #9f1239;
  min-height: 1.2em;
}

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.split > .card {
  margin-top: 0;
}

.fields,
.checks {
  display: grid;
  gap: 8px;
}

.fields {
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.span-2 {
  grid-column: 1 / -1;
}

.checks {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 12px;
  color: #57534e;
}

.crumbs a {
  color: #1e3a8a;
  text-decoration: none;
}

.crumbs a:hover {
  text-decoration: underline;
}

.crumbs [aria-current="page"] {
  color: #1c1917;
}

.crumb-sep {
  color: #a8a29e;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.suggestions button {
  width: auto;
  min-height: 36px;
  padding: 0 12px;
  background: white;
  color: #1c1917;
  border: 1px solid #e7e5e4;
}

.suggestions button.picked {
  border-color: #1e3a8a;
  color: #1e3a8a;
}

.list-button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  text-align: left;
  background: white;
  color: inherit;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  margin-top: 8px;
  padding: 12px;
}

.list-button.picked {
  border-color: #1e3a8a;
}

.quote-row {
  margin-top: 12px;
}

.unread {
  font-weight: 700;
}

pre.body {
  white-space: pre-wrap;
  font: inherit;
  background: #fafaf9;
  padding: 12px;
  border-radius: 8px;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mail-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mail-tools form {
  flex: 1 1 280px;
}

.mail-tools .filters {
  margin-top: 0;
}

.mail-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk[hidden] {
  display: none;
}

.mail-subject,
.mail-meta,
.mail-preview {
  display: block;
}

.list-button.unread .mail-subject::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #1e3a8a;
  vertical-align: 1px;
}

.mail-meta,
.mail-preview {
  margin-top: 2px;
  color: #57534e;
  font-weight: 400;
}

.mail-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.secondary.on {
  background: #1e3a8a;
  color: white;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
}

table.data th,
table.data td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #e7e5e4;
}

table.data th {
  color: #57534e;
  font-size: 0.8rem;
  font-weight: 600;
}

table.data tbody tr {
  cursor: pointer;
}

table.domain-list {
  width: max-content;
  max-width: 100%;
}

table.domain-list th,
table.domain-list td {
  vertical-align: middle;
}

table.domain-list tbody tr,
table.domain-list tbody tr:hover {
  cursor: default;
  background: transparent;
}

table.domain-list td.token input,
table.domain-list td.token button,
table.domain-list td.entries button {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
}

table.domain-list td.token input {
  flex: 0 1 auto;
  width: 48ch;
}

table.domain-list td.token .error:empty,
table.domain-list td.token .muted:empty {
  display: none;
  margin: 0;
}

table.domain-list td.name-link {
  cursor: pointer;
}

table.domain-list td.name-link strong {
  color: #1e3a8a;
}

table.domain-list td.entries {
  white-space: nowrap;
  padding-left: 0;
}

table.domain-list td.entries button {
  width: auto;
  margin-left: 8px;
  padding: 0 12px;
}

table.domain-list td.entries button:first-child {
  margin-left: 0;
}

table.data tbody tr:hover {
  background: #fafaf9;
}

table.data tr.read strong {
  font-weight: 500;
}

table.data .check {
  width: 36px;
  padding-right: 0;
}

table.data .num {
  width: 4.5rem;
}

table.data .when {
  width: 12rem;
  white-space: nowrap;
  color: #57534e;
}

table.data .preview {
  display: block;
  margin-top: 2px;
  color: #57534e;
  font-weight: 400;
}

.pager {
  margin-top: 12px;
}

.card > button {
  margin-top: 12px;
}

iframe.mail {
  width: 100%;
  height: 80vh;
  min-height: 240px;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  background: white;
}

label {
  display: block;
  margin-bottom: 8px;
}

.site-link {
  display: inline-block;
  margin-top: 12px;
  color: #1e3a8a;
}

#login button,
.stack > button {
  margin-top: 12px;
}

@media (max-width: 800px) {
  .topbar,
  #shell.wide .topbar {
    position: static;
    padding: 8px 16px;
  }

  main,
  #shell.wide main {
    padding: 16px;
  }

  .fields {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .row > button,
  .row > input {
    flex: 1 1 100%;
  }
}
