:root{
  --ink:#111111;
  --ink-2:#666666;
  --ink-3:#999999;
  --paper:#ffffff;
  --paper-2:#ffffff;
  --rule:#e8e8e8;
  --marker-soft:#f1f1f1;
  --red:#c83232;
  --green:#16834d;
  --shadow:0 12px 40px rgba(0,0,0,.08);
}

*{
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
}

html,body{
  margin:0;
  padding:0;
}

body{
  background:#ffffff;
  color:var(--ink);
  font-family:"Instrument Sans",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
  font-size:17px;
  line-height:1.5;
  min-height:100svh;
  -webkit-font-smoothing:antialiased;
}

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

button{
  -webkit-appearance:none;
  appearance:none;
}

:focus-visible{
  outline:2px solid #111111;
  outline-offset:2px;
  border-radius:5px;
}

.wrap{
  max-width:560px;
  margin:0 auto;
  padding:0 20px calc(120px + env(safe-area-inset-bottom));
}

[hidden]{
  display:none!important;
}

#auth{
  max-width:420px;
  margin:0 auto;
  padding:calc(13vh + env(safe-area-inset-top)) 22px 40px;
}

#auth h1{
  font-family:"Bricolage Grotesque",sans-serif;
  font-weight:700;
  font-size:40px;
  line-height:1.05;
  margin:0 0 8px;
  letter-spacing:-.025em;
}

#auth .sub{
  color:var(--ink-2);
  font-size:15.5px;
  margin:0 0 28px;
}

#auth .field{
  margin-bottom:14px;
}

#auth .err{
  color:var(--red);
  font-size:14.5px;
  margin:2px 0 12px;
  min-height:1px;
}

#auth .foot{
  color:var(--ink-3);
  font-size:13.5px;
  margin:22px 0 0;
  line-height:1.6;
}

.auth-actions{
  margin-top:4px!important;
}

.config-error{
  max-width:440px;
  margin:18vh auto;
  padding:26px;
  line-height:1.6;
}

.config-error h1{
  font-size:24px;
  margin:0 0 10px;
}

.config-error p{
  margin:0;
  color:#555555;
}

header{
  padding:calc(28px + env(safe-area-inset-top)) 0 18px;
  display:flex;
  gap:14px;
  align-items:flex-start;
}

.head-main{
  flex:1;
  min-width:0;
}

.today{
  margin:0;
  font-size:14px;
  color:var(--ink-3);
}

h1.page{
  font-family:"Bricolage Grotesque",sans-serif;
  font-weight:700;
  font-size:clamp(34px,10vw,44px);
  line-height:1.02;
  margin:6px 0 10px;
  letter-spacing:-.025em;
}

.tally{
  margin:0;
  font-size:15px;
  color:var(--ink-2);
}

.mark{
  background:var(--marker-soft);
  border-radius:4px;
  padding:2px 7px;
  font-weight:600;
  color:var(--ink);
}

.acct{
  padding-top:calc(30px + env(safe-area-inset-top));
  flex-shrink:0;
  text-align:right;
}

.acct .nm{
  font-size:13.5px;
  color:var(--ink-2);
  font-weight:600;
  display:block;
}

.out{
  font-size:13px;
  color:var(--ink-3);
  background:none;
  border:0;
  cursor:pointer;
  text-decoration:underline;
  padding:4px 0 0;
}

.filters{
  display:flex;
  margin:4px 0 6px;
  border-bottom:1px solid var(--rule);
}

.filters button{
  background:none;
  border:0;
  padding:9px 2px 11px;
  margin-right:22px;
  font-size:15px;
  font-weight:500;
  color:var(--ink-3);
  cursor:pointer;
  border-bottom:2px solid transparent;
  margin-bottom:-1px;
}

.filters button[aria-selected="true"]{
  color:var(--ink);
  border-bottom-color:var(--ink);
}

ul#list{
  list-style:none;
  margin:0;
  padding:0;
}

li.row{
  display:flex;
  gap:14px;
  align-items:flex-start;
  padding:15px 2px;
  border-bottom:1px solid var(--rule);
}

li.row.overdue{
  box-shadow:inset 3px 0 0 -1px var(--red);
  padding-left:12px;
}

.box{
  flex-shrink:0;
  width:26px;
  height:26px;
  margin-top:1px;
  border-radius:6px;
  border:1.5px solid #b5b5b5;
  background:#ffffff;
  cursor:pointer;
  display:grid;
  place-items:center;
  padding:0;
  transition:background .15s,border-color .15s;
}

.box svg{
  width:15px;
  height:15px;
  stroke:#ffffff;
  stroke-width:3.2;
  fill:none;
  stroke-linecap:round;
  stroke-linejoin:round;
  opacity:0;
  transform:scale(.5);
  transition:opacity .16s,transform .16s;
}

.box[aria-pressed="true"]{
  background:var(--green);
  border-color:var(--green);
}

.box[aria-pressed="true"] svg{
  opacity:1;
  transform:scale(1);
}

.body{
  flex:1;
  min-width:0;
  background:none;
  border:0;
  padding:0;
  text-align:left;
  cursor:pointer;
}

.subject{
  font-size:12.5px;
  font-weight:600;
  color:var(--ink-2);
  letter-spacing:.04em;
  margin:0 0 1px;
}

.title{
  font-size:17px;
  font-weight:500;
  margin:0;
  word-wrap:break-word;
}

.note{
  font-size:14px;
  color:var(--ink-2);
  margin:3px 0 0;
  word-wrap:break-word;
}

li.done .title,
li.done .subject{
  color:var(--ink-3);
}

li.done .title{
  text-decoration:line-through;
  text-decoration-thickness:1.5px;
}

li.done .note{
  display:none;
}

.due{
  flex-shrink:0;
  font-size:13px;
  font-weight:600;
  color:var(--ink-2);
  padding-top:3px;
  text-align:right;
}

.due.today{
  color:var(--ink);
  background:var(--marker-soft);
  border-radius:5px;
  padding:3px 7px;
}

.due.late{
  color:var(--red);
}

li.done .due{
  color:var(--ink-3);
  background:none;
  font-weight:500;
}

.empty{
  padding:56px 6px;
  text-align:center;
  color:var(--ink-2);
}

.empty h2{
  font-family:"Bricolage Grotesque",sans-serif;
  font-size:22px;
  font-weight:500;
  margin:0 0 6px;
  color:var(--ink);
}

.empty p{
  margin:0 auto;
  font-size:15px;
  max-width:34ch;
}

.skeleton{
  height:56px;
  border-bottom:1px solid var(--rule);
  opacity:.5;
}

.bar{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:20;
  padding:14px 20px calc(16px + env(safe-area-inset-bottom));
  background:linear-gradient(
    to top,
    #ffffff 65%,
    rgba(255,255,255,0)
  );
  display:flex;
  justify-content:center;
  pointer-events:none;
}

.bar button{
  pointer-events:auto;
  width:100%;
  max-width:520px;
  background:#111111;
  color:#ffffff;
  border:0;
  border-radius:12px;
  padding:16px;
  font-size:16.5px;
  font-weight:600;
  cursor:pointer;
  box-shadow:var(--shadow);
  transition:transform .12s,background .12s;
}

.bar button:active{
  transform:scale(.985);
}

.bar button:hover{
  background:#222222;
}

.scrim{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  z-index:30;
  opacity:0;
  transition:opacity .22s;
}

.scrim.open{
  opacity:1;
}

.sheet{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:31;
  background:#ffffff;
  border-radius:20px 20px 0 0;
  box-shadow:0 -10px 40px rgba(0,0,0,.12);
  padding:10px 20px calc(22px + env(safe-area-inset-bottom));
  max-height:92svh;
  overflow:auto;
  transform:translateY(102%);
  transition:transform .28s cubic-bezier(.32,.72,0,1);
}

.sheet.open{
  transform:translateY(0);
}

.grip{
  width:40px;
  height:4px;
  border-radius:99px;
  background:#d8d8d8;
  margin:0 auto 14px;
}

.sheet h2{
  font-family:"Bricolage Grotesque",sans-serif;
  font-size:23px;
  font-weight:700;
  margin:0 0 16px;
  letter-spacing:-.02em;
}

label{
  display:block;
  font-size:13.5px;
  font-weight:600;
  color:var(--ink-2);
  margin:0 0 6px;
}

.field{
  margin-bottom:15px;
}

input[type=text],
input[type=password],
input[type=date],
textarea{
  width:100%;
  background:#ffffff;
  border:1px solid #dcdcdc;
  border-radius:10px;
  padding:13px 14px;
  font-size:16.5px;
  transition:border-color .15s,box-shadow .15s;
}

input[type=text]:focus,
input[type=password]:focus,
input[type=date]:focus,
textarea:focus{
  outline:none;
  border-color:#111111;
  box-shadow:0 0 0 3px rgba(0,0,0,.06);
}

textarea{
  resize:vertical;
  min-height:72px;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:8px;
}

.chips button{
  background:#ffffff;
  border:1px solid #dddddd;
  border-radius:99px;
  padding:6px 12px;
  font-size:13.5px;
  color:var(--ink-2);
  cursor:pointer;
}

.chips button:hover{
  border-color:#111111;
  color:#111111;
}

.actions{
  display:flex;
  gap:10px;
  margin-top:22px;
}

.actions button{
  border-radius:11px;
  padding:15px;
  font-size:16px;
  font-weight:600;
  cursor:pointer;
  border:0;
}

.save{
  flex:1;
  background:#111111;
  color:#ffffff;
}

.save:hover{
  background:#222222;
}

.save:disabled{
  opacity:.45;
}

.del{
  background:#ffffff;
  color:var(--red);
  border:1px solid #dddddd!important;
  padding-inline:18px!important;
}

.cancel{
  background:#ffffff;
  color:var(--ink-2);
  border:1px solid #dddddd!important;
  padding-inline:18px!important;
}

.cancel:hover,
.del:hover{
  border-color:#111111!important;
}

#toast{
  position:fixed;
  left:50%;
  bottom:calc(96px + env(safe-area-inset-bottom));
  transform:translate(-50%,14px);
  z-index:40;
  background:#111111;
  color:#ffffff;
  padding:12px 18px;
  border-radius:10px;
  font-size:14.5px;
  max-width:88vw;
  text-align:center;
  opacity:0;
  pointer-events:none;
  transition:opacity .2s,transform .2s;
  box-shadow:var(--shadow);
}

#toast.show{
  opacity:1;
  transform:translate(-50%,0);
}

footer{
  padding:30px 2px 6px;
  font-size:13px;
  color:var(--ink-3);
  line-height:1.6;
}

@media (max-width:600px){
  .wrap{
    padding-left:18px;
    padding-right:18px;
  }

  header{
    gap:10px;
  }

  .acct .nm{
    max-width:100px;
    overflow:hidden;
    text-overflow:ellipsis;
  }
}

@media (prefers-reduced-motion:reduce){
  *{
    transition-duration:.01ms!important;
  }
}