:root {
  color-scheme: light dark;
  --back: light-dark(#f6f7f9, #151719);
  --paper: light-dark(#fff, #202226);
  --side: light-dark(#f0f2f5, #1c1e21);
  --txt: light-dark(#1d2228, #f2f3f5);
  --sub: light-dark(#53606d, #b3bbc4);
  --line: light-dark(#dce0e5, #373e46);
  --accent: light-dark(#245fa7, #9ec6ff);
  --wash: light-dark(#dee9f7, #293a50);
  --err: light-dark(#a32c32, #ffb5af);
  font: 16px/1.48 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: var(--back);
  color: var(--txt)
}

* {
  box-sizing: border-box
}

[hidden] {
  display: none !important
}

body {
  margin: 0
}

h1,
h2,
h3,
p {
  margin: 0
}

h1 {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 680;
  letter-spacing: -.055em;
  line-height: 1.12
}

h2 {
  font-size: 22px;
  letter-spacing: -.035em
}

h3 {
  font-size: 17px
}

small,
.sub,
.meta {
  color: var(--sub)
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit
}

button,
.button {
  border: 0;
  background: var(--side);
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 560;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px
}

button:hover,
.button:hover {
  filter: brightness(.96)
}

button:disabled {
  opacity: .5;
  cursor: default
}

button.quiet {
  color: var(--accent);
  background: transparent
}

button.primary,
.primary {
  background: #255f9f;
  color: white
}

button.selected,
[aria-pressed=true] {
  background: var(--wash);
  color: var(--accent)
}

a {
  color: var(--accent)
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  background: var(--paper);
  padding: 8px 10px;
  width: 100%
}

input[type=checkbox] {
  min-height: 20px;
  width: 20px;
  height: 20px
}

label {
  display: grid;
  gap: 5px;
  font-weight: 550;
  font-size: 14px
}

.check {
  display: flex;
  align-items: center;
  gap: 9px
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 25px;
  font-weight: 675;
  letter-spacing: -.05em
}

.brand img {
  width: 32px;
  height: 32px
}

#shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 206px minmax(0, 1fr)
}

aside {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 26px 13px
}

.brand {
  padding: 0 12px 25px
}

nav {
  display: grid;
  gap: 4px
}

nav button {
  background: transparent;
  justify-content: flex-start;
  font-size: 15px;
  gap: 12px
}

nav svg,
.icon {
  width: 19px;
  height: 19px;
  flex: none
}

nav [aria-current=page] {
  background: var(--wash);
  color: var(--accent)
}

main {
  min-width: 0
}

.content {
  max-width: 1000px;
  padding: clamp(22px, 5vw, 58px);
  margin: auto
}

.pagetop,
.sectionhead,
.toolbar,
.actions,
.inline,
.weeknav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap
}

.actions,
.inline {
  justify-content: flex-start
}

.pagetop {
  margin-bottom: 28px
}

.date {
  color: var(--accent);
  font-weight: 620;
  font-size: 15px;
  margin-bottom: 8px
}

.sectionhead {
  margin: 30px 0 12px
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden
}

.empty {
  padding: 22px;
  color: var(--sub)
}

.row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  padding: 13px 15px;
  justify-content: space-between
}

.row:last-child {
  border-bottom: 0
}

.row strong {
  display: block;
  font-size: 16px;
  overflow-wrap: anywhere
}

.row small {
  display: block;
  font-size: 13px;
  margin-top: 3px
}

.listtime {
  font-variant-numeric: tabular-nums;
  color: var(--sub);
  font-size: 13px;
  flex: 0 0 53px
}

.row .copy {
  flex: 1;
  min-width: 0
}

.mark {
  width: 37px;
  height: 45px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: bold
}

.chev {
  color: var(--sub);
  font-size: 22px
}

.daystrip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin: 17px 0
}

.daystrip button {
  display: grid;
  gap: 1px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 6px 2px
}

.daystrip button.selected {
  background: var(--wash);
  border-color: var(--accent)
}

.daystrip small {
  font-weight: 400
}

.daystrip b {
  font-size: 20px
}

.weeknav input {
  width: auto
}

.editor {
  min-height: 100vh
}

.edhead {
  background: var(--paper);
  padding: 10px 18px;
  border-bottom: 1px solid var(--line)
}

.edhead h2 {
  flex: 1;
  min-width: 100px;
  font-size: 18px
}

.toolbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 6px 14px;
  justify-content: flex-start
}

.toolbar button,
.toolbar input,
.toolbar select {
  min-height: 40px;
  padding: 5px 9px;
  width: auto;
  font-size: 14px
}

.toolbar input[type=number] {
  width: 68px
}

.toolbar input[type=color] {
  width: 38px;
  padding: 3px
}

.toolbar .status {
  color: var(--sub);
  font-size: 12px;
  margin-left: auto
}

.workspace {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px;
  max-width: 1600px;
  margin: auto
}

.pane {
  min-width: 0;
  flex: 1;
  overflow: auto;
  max-height: calc(100dvh - 155px);
  background: var(--side);
  border-radius: 4px;
  text-align: center;
  padding: 6px
}

.leaf {
  position: relative;
  margin: 0 auto;
  background: white;
  box-shadow: 0 1px 5px #0002;
  line-height: 0
}

.leaf canvas {
  display: block;
  width: 100%;
  height: 100%
}

.ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none
}

.solutionpane {
  position: relative
}

.solutionbar {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 13px
}

.solutionbar button {
  font-size: 13px
}

.red {
  color: var(--err)
}

#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--txt);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 10px;
  z-index: 12;
  max-width: 92vw;
  box-shadow: 0 2px 12px #0002
}

dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: var(--txt);
  padding: 22px;
  width: min(480px, 94vw);
  max-height: 90dvh
}

dialog::backdrop {
  background: #0b152657
}

dialog header,
dialog footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px
}

dialog header {
  margin-bottom: 14px
}

dialog footer {
  justify-content: flex-end;
  margin-top: 16px
}

#formError,
#loginerr {
  color: var(--err)
}

#inputs {
  display: grid;
  gap: 13px
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}

.note {
  font-size: 14px;
  line-height: 1.5;
  color: var(--sub)
}

.loginbox {
  background: var(--paper);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  width: min(365px, 94%);
  display: grid;
  gap: 15px
}

.loginbox h1 {
  font-size: 37px
}

.loginbox p {
  color: var(--sub)
}

#login,
#boot {
  min-height: 100vh;
  display: grid;
  place-items: center
}

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 15px
}

.filters select {
  max-width: 190px
}

.readlist {
  display: grid;
  gap: 6px
}

.break {
  overflow-wrap: anywhere
}

@media(max-width:850px) {
  #shell {
    grid-template-columns: 162px minmax(0, 1fr)
  }

  aside {
    padding: 17px 7px
  }

  .workspace {
    padding: 8px
  }

  .brand {
    font-size: 22px;
    padding-left: 8px
  }

  .content {
    padding: 22px
  }

  .workspace:has(.solutionpane:not([hidden])) {
    flex-direction: column
  }

  .workspace:has(.solutionpane:not([hidden]))>.pane {
    width: 100%;
    flex: auto;
    max-height: 58vh
  }
}

@media(max-width:620px) {
  #shell {
    display: block
  }

  aside {
    padding: 6px;
    border-right: 0;
    border-bottom: 1px solid var(--line)
  }

  aside .brand {
    display: none
  }

  nav {
    display: flex;
    justify-content: space-around;
    gap: 0
  }

  nav button {
    display: grid;
    justify-items: center;
    gap: 2px;
    font-size: 11px;
    min-height: 44px;
    padding: 5px
  }

  .content {
    padding: 18px 14px
  }

  .pagetop {
    margin: 10px 0 18px
  }

  .sectionhead {
    margin-top: 22px
  }

  .edhead,
  .toolbar {
    padding: 5px 8px;
    gap: 4px
  }

  .workspace {
    padding: 5px
  }

  .pane {
    max-height: 70dvh
  }

  .actions {
    gap: 4px
  }

  .filters {
    flex-wrap: wrap
  }

  .filters select {
    max-width: 100%
  }

  .daystrip {
    gap: 2px
  }

  .daystrip small {
    font-size: 11px
  }

  .row {
    padding: 12px
  }

  .pair {
    grid-template-columns: 1fr 1fr
  }

  .editor {
    min-height: auto
  }
}


/* Safari chooses its gesture at first contact. The HTML hit surface, including
   the canvas beneath the ink, must already have the correct touch action. */
.leaf {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none
}
#leaf.hand, #solleaf {
  cursor: grab
}
.leaf > canvas { pointer-events: none }


.pane { overflow-anchor: none }
.pdf-zoom { display: inline-flex; align-items: center; gap: 3px }
.pdf-zoom button { min-width: 40px }
