:root {
  --sheet: #fcfcfb;
  --sheet-grid: #e2e4e7;
  --sheet-yellow: #fff34d;
  --sheet-row: 40px;
}

body {
  min-width: 0;
  min-height: 100dvh;
  color: #111;
  background-color: var(--sheet);
}

@media (max-width: 600px) {
  body {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1315 40' preserveAspectRatio='none'%3E%3Cpath d='M0,0H1315M0,40H1315M0,0V40M100,0V40M200,0V40M300,0V40M400,0V40M500,0V40M600,0V40M700,0V40M855,0V40M1015,0V40M1115,0V40M1215,0V40M1315,0V40' fill='none' stroke='%23e2e4e7' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
    background-size: 100% var(--sheet-row);
    background-repeat: repeat-y;
  }
}

#app { min-height: 100dvh; }

.columns,
.toolbar,
.bottom-bar {
  display: grid;
  grid-template-columns: 1fr repeat(6, 1fr) 1.55fr 1.6fr 1fr 1fr 1fr;
  width: 100%;
  gap: 0;
}

.workspace {
  width: 100%;
  max-width: none;
  margin: var(--sheet-row) 0 0;
  padding: 0;
}

.columns { min-height: calc(23 * var(--sheet-row)); }
.list-section { grid-column: 2 / 8; min-width: 0; }
.details-section { grid-column: 9 / 12; min-width: 0; }

.section-title,
.add-row,
.add-block,
.empty,
.reader-intro {
  position: relative;
  isolation: isolate;
  background: transparent;
}

.section-title::before,
.add-row::before,
.add-block::before,
.empty::before,
.reader-intro::before {
  position: absolute;
  z-index: -1;
  inset: 1px;
  content: "";
  background: var(--sheet);
}

.section-title::before { background: var(--sheet-yellow); }

.section-title {
  width: 100%;
  height: var(--sheet-row);
  margin: 0 0 var(--sheet-row);
  padding: 0 10px;
  overflow: hidden;
  font-size: 20px;
  font-weight: 400;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .section-title {
    box-shadow: none;
  }
}

.companies,
.details-body { padding: 0; }
.company { margin: 0 0 var(--sheet-row); }

.company-head {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  height: var(--sheet-row);
  margin: 0;
}

.company-head input {
  grid-column: 1 / 7;
  width: 100%;
  height: var(--sheet-row);
  padding: 0 12px;
  overflow: hidden;
  background: var(--sheet);
  font-size: 18px;
  font-weight: 700;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .company-head input {
    box-shadow: inset 0 0 0 1px var(--sheet-grid);
  }
}

.company-head h3 {
  grid-column: 1 / 7;
  width: 100%;
  height: var(--sheet-row);
  margin: 0;
  padding: 0 12px;
  overflow: hidden;
  background: var(--sheet);
  font-size: 18px;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .company-head h3 {
    box-shadow: inset 0 0 0 1px var(--sheet-grid);
  }
}

.company-head .delete {
  position: absolute;
  left: 100%;
  right: auto;
  top: 0;
  z-index: 2;
  width: 25.8333%;
  height: var(--sheet-row);
  background: var(--sheet);
}

@media (max-width: 600px) {
  .company-head .delete {
    box-shadow: inset 0 0 0 1px var(--sheet-grid);
  }
}

.person {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  min-height: var(--sheet-row);
  padding: 0;
  border: 0;
}

.person > :is(input, textarea),
.reader .person > span {
  width: 100%;
  height: var(--sheet-row);
  min-height: var(--sheet-row);
  margin: 0;
  padding: 0 8px;
  overflow: hidden;
  background: transparent;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person > :is(input, textarea):nth-of-type(1),
.reader .person > span:nth-of-type(1) { grid-column: 1; }
.person > :is(input, textarea):nth-of-type(2),
.reader .person > span:nth-of-type(2) { grid-column: 2; }
.person > :is(input, textarea):nth-of-type(3),
.reader .person > span:nth-of-type(3) { grid-column: 3; }

.contact-actions {
  display: grid;
  grid-column: 4 / 7;
  grid-row: 1;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  height: var(--sheet-row);
  gap: 0;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--sheet-row);
  padding: 10px;
}

.delete {
  right: 0;
  top: 0;
  width: calc(100% / 6);
  height: var(--sheet-row);
  padding: 0;
  line-height: var(--sheet-row);
}

.person > .delete {
  left: 100%;
  right: auto;
  top: 0;
  z-index: 2;
  width: 25.8333%;
  background: var(--sheet);
}

@media (max-width: 600px) {
  .person > .delete {
    box-shadow: inset 0 0 0 1px var(--sheet-grid);
  }
}

.add-row,
.add-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0 8px;
}

.add-row { height: var(--sheet-row); }
.add-block { height: calc(5 * var(--sheet-row)); }

@media (max-width: 600px) {
  .add-row,
  .add-block,
  .empty,
  .reader-intro {
    box-shadow: none;
  }
}

.add-row:hover:not(:disabled),
.add-block:hover:not(:disabled) { background: transparent; }

.add-row:hover:not(:disabled)::before,
.add-block:hover:not(:disabled)::before { inset: 1px; background: #f6f7f8; }

.empty {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: calc(2 * var(--sheet-row));
  margin: 0 0 var(--sheet-row);
  padding: 8px;
  color: #666;
  line-height: calc(var(--sheet-row) / 2);
}

.details-body {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  grid-auto-flow: row;
  align-content: start;
}

.name-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1.6fr 1fr 1fr;
  height: var(--sheet-row);
  gap: 0;
}

.name-row :is(input, textarea) {
  height: var(--sheet-row);
  padding: 0 12px;
  line-height: var(--sheet-row);
}

.name-row :is(input, textarea):first-child { grid-column: 1; }
.name-row :is(input, textarea):last-child {
  grid-column: 2 / 4;
  background: var(--sheet);
}

@media (max-width: 600px) {
  .name-row :is(input, textarea):last-child {
    box-shadow: inset 0 0 0 1px var(--sheet-grid);
  }
}

.details-body > :is(input, textarea),
.reader .details-body > .name,
.reader .plain-detail {
  grid-column: 1 / 2;
  width: 100%;
  height: var(--sheet-row);
  min-height: var(--sheet-row);
  margin: 0;
  padding: 0 12px;
  overflow: hidden;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader .details-body > .name { font-size: 18px; font-weight: 700; }

.detail-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1.6fr 1fr 1fr;
  min-height: var(--sheet-row);
  gap: 0;
}

.detail-row .value {
  position: relative;
  isolation: isolate;
  grid-column: 1;
  width: 100%;
  min-width: 0;
  height: var(--sheet-row);
  min-height: var(--sheet-row);
  margin: 0;
  padding: 0 12px;
  overflow: hidden;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-row .value::before,
.details-subsection h3::before,
.intro-title h3::before,
.file-name > span::before,
.file-name .file-remove::before {
  position: absolute;
  z-index: -1;
  content: "";
  background: var(--sheet);
}

@media (max-width: 600px) {
  .detail-row .value::before,
  .details-subsection h3::before,
  .intro-title h3::before,
  .file-name > span::before,
  .file-name .file-remove::before {
    inset: 1px;
  }
}

.detail-row .value:focus-within::before { background: #ffffed; }

.detail-row .value input:focus {
  background: transparent !important;
  box-shadow: none;
}

.detail-row .value input {
  height: var(--sheet-row);
  padding: 0;
  overflow: hidden;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-row > .icon:nth-of-type(1) { grid-column: 2; }
.detail-row > .icon:nth-of-type(2) { grid-column: 3; }

.details-subsection {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1.6fr 1fr 1fr;
  margin: var(--sheet-row) 0 0;
}

.details-subsection h3 {
  position: relative;
  isolation: isolate;
  grid-column: 1;
  height: var(--sheet-row);
  margin: 0;
  padding: 0 12px;
  overflow: hidden;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-subsection .detail-row { grid-column: 1 / -1; }
.facts .detail-row { grid-template-columns: 0.35fr 1.25fr 1fr 1fr; }

.facts .fact-no {
  display: flex;
  grid-column: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--sheet-row);
}

.facts .detail-row .value { grid-column: 2; }
.facts .detail-row > .icon { grid-column: 3; }

.intro-title {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1.6fr 1fr 1fr;
  height: var(--sheet-row);
  margin: var(--sheet-row) 0 0;
}

.intro-title h3 {
  position: relative;
  isolation: isolate;
  grid-column: 1;
  height: var(--sheet-row);
  margin: 0;
  padding: 0 12px;
  overflow: hidden;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intro-title .icon { grid-column: 2; }

.intro-text,
.reader .intro-message {
  grid-column: 1 / -1;
  width: 100%;
  min-height: calc(4 * var(--sheet-row));
  margin: 0;
  padding: 8px;
  background: var(--sheet);
  line-height: calc(var(--sheet-row) / 2);
}

@media (max-width: 600px) {
  .intro-text,
  .reader .intro-message {
    box-shadow: inset 0 0 0 1px var(--sheet-grid);
  }
}

.intro-help {
  position: relative;
  isolation: isolate;
  grid-column: 1 / -1;
  min-height: var(--sheet-row);
  margin: 0;
  padding: 6px 8px;
  overflow: hidden;
  background: transparent;
  line-height: 1.35;
}

.intro-help::before,
.save-status::before,
.toolbar button::before,
.tab::before,
.tabs > [data-action="add-list"]::before,
.account-actions button::before {
  position: absolute;
  z-index: -1;
  inset: 1px;
  content: "";
  background: var(--sheet);
}

.file-name {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1.6fr 1fr 1fr;
  min-height: var(--sheet-row);
  margin: 0;
  padding: 0;
}

.file-name > span {
  position: relative;
  isolation: isolate;
  grid-column: 1;
  height: var(--sheet-row);
  padding: 0 12px;
  overflow: hidden;
  background: transparent;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .file-name > span {
    box-shadow: none;
  }
}

.file-name .file-remove {
  position: relative;
  isolation: isolate;
  grid-column: 2;
  width: 100%;
  height: var(--sheet-row);
  margin: 0;
  padding: 0 8px;
  background: transparent;
  line-height: var(--sheet-row);
}

@media (max-width: 600px) {
  .file-name .file-remove {
    box-shadow: none;
  }
}

.file-name .file-remove:hover:not(:disabled) { background: transparent; }
.file-name .file-remove:hover:not(:disabled)::before { inset: 1px; background: #f6f7f8; }

.reader-intro {
  width: calc(5 / 6 * 100%);
  max-width: none;
  min-height: calc(3 * var(--sheet-row));
  margin: 0 0 var(--sheet-row);
  padding: 8px;
  overflow: hidden;
  color: #111;
  line-height: calc(var(--sheet-row) / 2);
}

.reader .list-section > .section-title { margin-bottom: 0; }
.reader .company { margin-bottom: var(--sheet-row); }
.reader .columns { min-height: calc(16 * var(--sheet-row)); }

.reader .reader-footer {
  grid-column: 1 / -1;
  min-height: calc(2 * var(--sheet-row));
  margin: var(--sheet-row) 0;
  padding: 8px;
  background: var(--sheet);
}

@media (max-width: 600px) {
  .reader .reader-footer {
    box-shadow: inset 0 0 0 1px var(--sheet-grid);
  }
}

.toolbar {
  align-items: stretch;
  min-height: var(--sheet-row);
  margin: 0;
  padding: 0;
  border: 0;
}

.toolbar button {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: var(--sheet-row);
  padding: 0 8px;
  line-height: var(--sheet-row);
}

.toolbar button:hover:not(:disabled),
.tab:hover:not(:disabled),
.tabs > [data-action="add-list"]:hover:not(:disabled),
.account-actions button:hover:not(:disabled) { background: transparent; }

.toolbar button:hover:not(:disabled)::before,
.tab:hover:not(:disabled)::before,
.tabs > [data-action="add-list"]:hover:not(:disabled)::before,
.account-actions button:hover:not(:disabled)::before { inset: 1px; background: #f6f7f8; }

.toolbar [data-action="preview"] { grid-column: 2; }
.toolbar [data-action="save"] { grid-column: 3; min-width: 0; background: transparent; }
.toolbar [data-action="save"]::before { background: var(--sheet-yellow); }
.toolbar [data-action="save"]:hover:not(:disabled)::before { background: #f6f7f8; }
.toolbar [data-action="share"] { grid-column: 4; }

.save-status {
  position: relative;
  isolation: isolate;
  grid-column: 9 / 12;
  width: 100%;
  height: var(--sheet-row);
  margin: 0;
  padding: 0 8px;
  overflow: hidden;
  background: transparent;
  line-height: var(--sheet-row);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-bar { min-height: var(--sheet-row); padding: 0; }

.tabs {
  display: flex;
  grid-column: 2 / 8;
  align-items: stretch;
  min-height: var(--sheet-row);
  gap: 0;
}

.tab-wrap,
.tabs > [data-action="add-list"] {
  position: relative;
  isolation: isolate;
  width: calc(100% / 6);
  height: var(--sheet-row);
  flex: 0 0 calc(100% / 6);
}

.tab {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: var(--sheet-row);
  min-width: 0;
  padding: 0 6px;
  overflow: hidden;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab.active { background: transparent; border: 0; }
.tab.active::before { background: var(--sheet-yellow); }
.tab.active:hover:not(:disabled)::before { background: #f6f7f8; }
.tab-wrap .delete { right: 0; top: 0; width: 24px; height: 20px; line-height: 20px; opacity: 0; }

.account-actions {
  display: grid;
  grid-column: 9 / 12;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 0;
  height: var(--sheet-row);
  padding: 0;
  border: 0;
}

.account-actions button {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: var(--sheet-row);
  padding: 0 8px;
  overflow: hidden;
  line-height: var(--sheet-row);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-page > .site-head,
#app > .site-head {
  display: grid;
  grid-template-columns: 1fr repeat(6, 1fr) 1.55fr 1.6fr 1fr 1fr 1fr;
  align-items: end;
  width: 100%;
  height: calc(3 * var(--sheet-row));
  max-width: none;
  margin: 0;
  padding: 0 0 var(--sheet-row);
}

.sheet-page > .site-head .brand,
#app > .site-head .brand {
  display: flex;
  grid-column: 2 / 4;
  align-items: center;
  height: var(--sheet-row);
  gap: 8px;
  overflow: hidden;
  background: var(--sheet);
  font-size: 18px;
  line-height: var(--sheet-row);
  white-space: nowrap;
}

.sheet-page > .site-head .brand-mark,
#app > .site-head .brand-mark,
dialog .brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: calc(0.9 * var(--sheet-row));
  height: calc(0.9 * var(--sheet-row));
  overflow: hidden;
}

.sheet-page > .site-head .brand-mark img,
#app > .site-head .brand-mark img,
dialog .brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}

.sheet-page > .site-head nav,
#app > .site-head nav {
  display: flex;
  grid-column: 9 / 12;
  justify-content: end;
  height: var(--sheet-row);
  gap: 0;
}

.sheet-page > .site-head nav > *,
#app > .site-head nav > * {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50%;
  height: var(--sheet-row);
  min-width: 0;
  padding: 0 6px;
  overflow: hidden;
  background: var(--sheet);
  color: #111;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice,
.preview-label {
  height: var(--sheet-row);
  margin: 0;
  padding: 0 8px;
  overflow: hidden;
  background: var(--sheet);
  color: #555;
  font-size: 13px;
  line-height: var(--sheet-row);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legal-links { margin-top: calc(2 * var(--sheet-row)); }

.policy {
  width: calc(7 / 13.15 * 100vw);
  max-width: none;
  margin: 0 0 0 calc(1 / 13.15 * 100vw);
  padding: 0;
  line-height: 1.55;
}

.policy h1,
.policy h2 {
  min-height: var(--sheet-row);
  margin: var(--sheet-row) 0 0;
  padding: 0 10px;
  overflow: hidden;
  background: var(--sheet-yellow);
  font-size: 20px;
  font-weight: 400;
  line-height: var(--sheet-row);
}

.policy p { margin: 0; padding: 8px 10px; background: var(--sheet); }

dialog {
  width: min(430px, calc(100vw - 32px));
  max-height: min(90dvh, 720px);
  padding: 0 22px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid #c9cac7;
  border-radius: 0;
  background: var(--sheet);
  box-shadow: none;
  color: #111;
}

dialog::backdrop {
  background: rgba(24, 24, 22, 0.22);
  backdrop-filter: blur(1px);
}

dialog:not([open]) { display: none; }
dialog > *,
dialog form > * { min-width: 0; }

dialog h2 {
  min-height: 56px;
  margin: 0 -22px 20px;
  padding: 15px 56px 14px 20px;
  border-bottom: 1px solid #d6d7d4;
  overflow-wrap: anywhere;
  font-size: 21px;
  font-weight: 400;
  line-height: 1.25;
}

dialog .close {
  position: absolute;
  top: 0;
  right: 0;
  width: 54px;
  height: 55px;
  padding: 0;
  border: 0;
  border-left: 1px solid #d6d7d4;
  border-radius: 0;
  background: transparent;
  color: #666;
  font-size: 25px;
  line-height: 55px;
}

dialog .close:hover:not(:disabled) { background: #f6f7f8; }

dialog .brand {
  display: flex;
  align-items: center;
  width: fit-content;
  margin: 0 0 16px;
  gap: 8px;
  overflow: hidden;
}

dialog .social,
dialog .primary {
  width: 100%;
  min-height: 44px;
  border-radius: 0;
  box-shadow: none;
}

dialog .social {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid #cfd0cc;
  background: #fff;
  gap: 12px;
}

dialog .social:hover:not(:disabled) { background: #f6f7f8; }

dialog .primary {
  margin: 18px 0 0;
  padding: 10px 16px;
  border: 1px solid #dfd32f;
  background: var(--sheet-yellow);
}

dialog .primary:hover:not(:disabled) { background: #f6f7f8; }

dialog .divider {
  display: flex;
  align-items: center;
  margin: 18px 0 4px;
  color: #85857f;
  font-size: 13px;
  gap: 12px;
}

dialog .divider::before,
dialog .divider::after {
  display: block;
  height: 1px;
  background: #dedfdb;
  content: "";
  flex: 1;
}

dialog form { display: block; margin: 0; padding: 0; }

.rename-list-fields { display: contents; }

dialog form > label,
dialog form > :where(.rename-list-fields) > label {
  display: block;
  margin: 14px 0 0;
  padding: 0;
  color: #3f3f3c;
  font-size: 14px;
  line-height: 1.35;
}

dialog input,
dialog textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  margin: 6px 0 0;
  padding: 9px 10px;
  border: 1px solid #c9cac7;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  line-height: 1.4;
}

dialog input:focus,
dialog textarea:focus {
  border-color: #777873;
  outline: 1px solid #777873;
  outline-offset: 0;
  background: #ffffed !important;
  box-shadow: none;
}

dialog textarea {
  min-height: 132px;
  resize: vertical;
}

dialog .modal-info,
dialog .modal-bottom,
dialog .error,
dialog .field-error,
dialog > p,
dialog > h3 {
  margin: 14px 0 0;
  padding: 0;
}

dialog > h3,
dialog .profile-section h3 {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
}

dialog .modal-info {
  color: #686864;
  font-size: 14px;
  line-height: 1.5;
}

dialog .modal-bottom {
  margin-top: 20px;
  color: #555551;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

dialog .modal-bottom button { padding: 2px 3px; text-decoration: underline; }

dialog .error,
dialog .field-error {
  color: #a13420;
  font-size: 13px;
  line-height: 1.4;
}

dialog .field-error { margin-top: 5px; }
dialog .field-error:empty,
dialog .error:empty { display: none; }

dialog .text-link,
dialog a.text-link {
  display: inline-block;
  width: auto;
  min-height: 0;
  margin: 10px 0 0;
  padding: 2px 0;
  color: #5f5f5a;
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  text-decoration: underline;
}

dialog .text-link:hover:not(:disabled),
dialog a.text-link:hover { background: #f6f7f8; color: #111; }

dialog .profile-section {
  display: block;
  margin: 20px 0 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid #dedfdb;
}

dialog .profile-section h3 { margin: 0; padding: 0; }
dialog .profile-section br { display: block; }
#toast { border-radius: 0; box-shadow: none; }

@media (max-width: 1100px) {
  .section-title { font-size: 17px; }
  .company-head input,
  .company-head h3,
  .reader .details-body > .name { font-size: 16px; }
  .details-body > :is(input, textarea) { grid-column: 1 / -1; padding: 0 8px; background: var(--sheet); }

  @media (max-width: 600px) {
    .details-body > :is(input, textarea) {
      box-shadow: inset 0 0 0 1px var(--sheet-grid);
    }
  }
  .person > :is(input, textarea),
  .reader .person > span,
  .detail-row .value,
  .reader .plain-detail { padding-right: 5px; padding-left: 5px; font-size: 14px; }
}

@media (max-width: 1050px) {

  @media (max-width: 600px) {
    body {
      background-image: linear-gradient(to right, var(--sheet-grid) 1px, transparent 1px), linear-gradient(to bottom, var(--sheet-grid) 1px, transparent 1px);
      background-size: calc(100% / 8) var(--sheet-row);
      background-repeat: repeat;
    }
  }
  .columns,
  .toolbar,
  .bottom-bar,
  .sheet-page > .site-head,
  #app > .site-head { grid-template-columns: repeat(8, 1fr); }
  .columns,
  .reader .columns { min-height: 0; }
  .list-section,
  .details-section { grid-column: 2 / 8; }
  .list-section { margin-bottom: calc(2 * var(--sheet-row)); }
  .company-head > .delete,
  .person > .delete { width: calc(100% / 6); }
  .details-body,
  .name-row,
  .detail-row,
  .details-subsection,
  .intro-title { grid-template-columns: repeat(6, 1fr); }
  .name-row :is(input, textarea):first-child { grid-column: 1 / 4; background: var(--sheet); }

  @media (max-width: 600px) {
    .name-row :is(input, textarea):first-child {
      box-shadow: inset 0 0 0 1px var(--sheet-grid);
    }
  }
  .name-row :is(input, textarea):last-child { grid-column: 4 / 7; }
  .details-body > :is(input, textarea),
  .reader .details-body > .name,
  .reader .plain-detail { grid-column: 1 / 5; }
  .detail-row .value { grid-column: 1 / 5; }
  .detail-row > .icon:nth-of-type(1) { grid-column: 5; }
  .detail-row > .icon:nth-of-type(2) { grid-column: 6; }
  .facts .detail-row { grid-template-columns: repeat(6, 1fr); }
  .facts .fact-no { grid-column: 1; }
  .facts .detail-row .value { grid-column: 2 / 5; }
  .facts .detail-row > .icon { grid-column: 5; }
  .details-subsection h3 { grid-column: 1 / 5; background: transparent; box-shadow: none; }
  .file-name { grid-template-columns: repeat(6, 1fr); }
  .file-name > span { grid-column: 1 / 5; }
  .file-name .file-remove { grid-column: 5; }
  .intro-title h3 { grid-column: 1 / 6; background: transparent; }

  @media (max-width: 600px) {
    .intro-title h3 {
      box-shadow: none;
    }
  }
  .reader-intro { width: 100%; }
  .intro-title .icon { grid-column: 6; }
  .toolbar {
    grid-template-rows: repeat(2, var(--sheet-row));
    min-height: calc(2 * var(--sheet-row));
  }
  .toolbar [data-action="preview"] { grid-column: 2; grid-row: 1; }
  .toolbar [data-action="save"] { grid-column: 3; grid-row: 1; }
  .toolbar [data-action="share"] { grid-column: 4; grid-row: 1; }
  .save-status {
    grid-column: 2 / 8;
    grid-row: 2;
    padding: 0 8px;
    font-size: 13px;
    text-align: left;
  }
  .bottom-bar {
    grid-template-rows: auto var(--sheet-row);
    margin-top: var(--sheet-row);
  }
  .tabs { grid-column: 2 / 8; grid-row: 1; }
  .account-actions {
    grid-column: 2 / 8;
    grid-row: 2;
    grid-template-columns: repeat(6, 1fr);
  }
  .account-actions button:first-child { grid-column: 1 / 4; }
  .account-actions button:last-child { grid-column: 4 / 7; }
  .sheet-page > .site-head .brand,
  #app > .site-head .brand { grid-column: 2 / 4; }
  .sheet-page > .site-head nav,
  #app > .site-head nav { grid-column: 6 / 8; }
  .policy { width: 75vw; margin-left: 12.5vw; }
}

@media (max-width: 680px) {
  :root { --sheet-row: 36px; }

  @media (max-width: 600px) {
    body {
      background-image: linear-gradient(to right, var(--sheet-grid) 1px, transparent 1px), linear-gradient(to bottom, var(--sheet-grid) 1px, transparent 1px);
      background-size: calc(100% / 6) var(--sheet-row);
      background-repeat: repeat;
    }
  }
  .columns,
  .toolbar,
  .bottom-bar,
  .sheet-page > .site-head,
  #app > .site-head { grid-template-columns: repeat(6, 1fr); }
  .workspace { margin-top: var(--sheet-row); }
  .columns { min-height: 0; }
  .list-section,
  .details-section { grid-column: 2 / 6; }
  .list-section { margin-bottom: calc(2 * var(--sheet-row)); }
  .company-head { grid-template-columns: repeat(4, 1fr); }
  .company-head input { grid-column: 1 / 4; }
  .company-head h3 { grid-column: 1 / 5; }
  .company-head > .delete { left: 75%; right: auto; width: 25%; opacity: 1; }
  .person { grid-template-columns: repeat(4, 1fr); min-height: calc(2 * var(--sheet-row)); }
  .person > :is(input, textarea):nth-of-type(1),
  .reader .person > span:nth-of-type(1) { grid-column: 1; grid-row: 1; }
  .person > :is(input, textarea):nth-of-type(2),
  .reader .person > span:nth-of-type(2) { grid-column: 2; grid-row: 1; }
  .person > :is(input, textarea):nth-of-type(3),
  .reader .person > span:nth-of-type(3) { grid-column: 3 / 5; grid-row: 1; background: var(--sheet); }

  @media (max-width: 600px) {
    .person > :is(input, textarea):nth-of-type(3),
    .reader .person > span:nth-of-type(3) {
      box-shadow: inset 0 0 0 1px var(--sheet-grid);
    }
  }
  .person > .contact-actions { grid-column: 1 / 4; grid-row: 2; height: var(--sheet-row); }
  .person > .delete { left: auto; right: 0; top: var(--sheet-row); width: 25%; height: var(--sheet-row); opacity: 1; }
  .add-block { height: calc(3 * var(--sheet-row)); }
  .details-body,
  .name-row,
  .detail-row,
  .details-subsection,
  .intro-title { grid-template-columns: repeat(4, 1fr); }
  .name-row :is(input, textarea):first-child { grid-column: 1 / 3; background: var(--sheet); }

  @media (max-width: 600px) {
    .name-row :is(input, textarea):first-child {
      box-shadow: inset 0 0 0 1px var(--sheet-grid);
    }
  }
  .name-row :is(input, textarea):last-child { grid-column: 3 / 5; }
  .details-body > :is(input, textarea),
  .reader .details-body > .name,
  .reader .plain-detail { grid-column: 1 / -1; background: var(--sheet); }

  @media (max-width: 600px) {
    .details-body > :is(input, textarea),
    .reader .details-body > .name,
    .reader .plain-detail {
      box-shadow: inset 0 0 0 1px var(--sheet-grid);
    }
  }
  .detail-row .value { grid-column: 1 / 3; padding: 0 6px; background: transparent; box-shadow: none; font-size: 12px; }
  .detail-row > .icon:nth-of-type(1) { grid-column: 3; }
  .detail-row > .icon:nth-of-type(2) { grid-column: 4; }
  .facts .detail-row { grid-template-columns: repeat(4, 1fr); }
  .facts .fact-no { grid-column: 1; }
  .facts .detail-row .value { grid-column: 2 / 4; }
  .facts .detail-row > .icon { grid-column: 4; }
  .details-subsection h3 { grid-column: 1 / 3; background: transparent; box-shadow: none; }
  .file-name { grid-template-columns: repeat(4, 1fr); }
  .file-name > span { grid-column: 1 / 4; }
  .file-name .file-remove { grid-column: 4; }
  .intro-title h3 { grid-column: 1 / 4; background: transparent; font-size: 13px; }

  @media (max-width: 600px) {
    .intro-title h3 {
      box-shadow: none;
    }
  }
  .intro-title .icon { grid-column: 4; }
  .reader-intro { min-height: calc(4 * var(--sheet-row)); }
  .intro-help {
    display: flex;
    align-items: center;
    height: calc(2 * var(--sheet-row));
    min-height: calc(2 * var(--sheet-row));
    padding: 4px 6px;
    font-size: 11px;
  }
  .toolbar button { padding: 0 4px; font-size: 13px; white-space: nowrap; }
  .toolbar [data-action="preview"] { grid-column: 2; grid-row: 1; }
  .toolbar [data-action="save"] { grid-column: 3; grid-row: 1; }
  .toolbar [data-action="share"] { grid-column: 4; grid-row: 1; }
  .save-status { grid-column: 2 / 6; grid-row: 2; padding: 0 6px; font-size: 11px; text-align: left; }
  .bottom-bar { margin-top: 0; }
  .tabs { grid-column: 2 / 6; grid-row: 1; flex-wrap: wrap; }
  .tab-wrap,
  .tabs > [data-action="add-list"] { width: 25%; flex-basis: 25%; }
  .tab { padding: 0 3px; font-size: 13px; }
  .account-actions { grid-column: 2 / 6; grid-row: 2; grid-template-columns: repeat(4, 1fr); }
  .account-actions button:first-child { grid-column: 1 / 3; }
  .account-actions button:last-child { grid-column: 3 / 5; }
  .sheet-page > .site-head,
  #app > .site-head { height: calc(3 * var(--sheet-row)); }
  .sheet-page > .site-head .brand,
  #app > .site-head .brand { grid-column: 2 / 4; }
  .sheet-page > .site-head nav,
  #app > .site-head nav { grid-column: 4 / 6; }
  .policy { width: calc(4 * 100vw / 6); margin-left: calc(100vw / 6); }
}

@media (max-width: 520px) {
  dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding-right: 18px;
    padding-bottom: 18px;
    padding-left: 18px;
  }

  dialog h2 {
    margin-right: -18px;
    margin-bottom: 18px;
    margin-left: -18px;
    padding-left: 18px;
  }
}
