: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;
}

#shell.with-side {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.side[hidden] {
  display: none;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 12px;
  background: #1c1917;
  color: #fafaf9;
}

.side .brand {
  color: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 8px 12px 16px;
}

.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: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;
}

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;
}

.access-link {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}

.access-link label {
  flex: 0 0 100%;
}

.access-link input {
  flex: 1 1 240px;
}

.access-link p {
  flex: 0 0 100%;
  margin: 0;
}

.import-note {
  white-space: pre-line;
}

.goods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.goods .product-block {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin: 0;
  border-top: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.product-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.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: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.split.even {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.split > :only-child {
  grid-column: 1 / -1;
}

.fields,
.checks,
.peers {
  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));
}

.peers {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.peers .list-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 84px;
  margin-top: 0;
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 1rem;
}

.sections[hidden] {
  display: none;
}

.sections a,
.sections [aria-current="page"] {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #e7e5e4;
  text-decoration: none;
}

.sections a:hover {
  background: #292524;
}

.sections [aria-current="page"] {
  background: #fafaf9;
  color: #1c1917;
  font-weight: 700;
}

.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.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: 960px) {
  .split,
  .split.even {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  #shell.with-side {
    grid-template-columns: 1fr;
  }

  .side {
    position: sticky;
    z-index: 2;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
  }

  .side .brand {
    padding: 8px;
  }

  .sections {
    flex-direction: row;
    flex: 1;
  }

  .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%;
  }
}
