:root {
  --bg: #eef1f4;
  --sf: #fff;
  --tx: #18222b;
  --mu: #66727d;
  --bd: #d9dee3;
  --ac: #2b4c7e;
  --n: #dfe2f7;
  --nt: #303a8c;
  --h: #d3ece6;
  --ht: #12574a;
  --y: #7a5600;
  --yb: #fff2c2;
  --r: #b3261e;
  --rb: #fbe1de;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10161c;
    --sf: #1a232c;
    --tx: #e6ecf1;
    --mu: #93a1ad;
    --bd: #2c3945;
    --ac: #8fb4ee;
    --n: #24294f;
    --nt: #b4bcff;
    --h: #173d37;
    --ht: #8fe0cc;
    --y: #f3cf6b;
    --yb: #44370f;
    --r: #ff8f86;
    --rb: #4a1f1c;
  }
}
:root[data-theme="dark"] {
  --bg: #10161c;
  --sf: #1a232c;
  --tx: #e6ecf1;
  --mu: #93a1ad;
  --bd: #2c3945;
  --ac: #8fb4ee;
  --n: #24294f;
  --nt: #b4bcff;
  --h: #173d37;
  --ht: #8fe0cc;
  --y: #f3cf6b;
  --yb: #44370f;
  --r: #ff8f86;
  --rb: #4a1f1c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font:
    15px/1.5 "Noto Sans TC",
    "PingFang TC",
    "Microsoft JhengHei",
    system-ui,
    sans-serif;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
h1 {
  font-size: 19px;
  margin: 0;
}
select,
input,
button {
  font: inherit;
  color: inherit;
}
select,
input {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 8px;
  width: 100%;
  margin-top: 8px;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px;
}
.nav b {
  font-size: 16px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.wk {
  text-align: center;
  color: var(--mu);
  font-size: 12px;
}
.d {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  min-height: 68px;
  padding: 3px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.d em {
  font-style: normal;
  font-size: 12px;
  color: var(--mu);
}
.d.hd em {
  color: var(--r);
}
.d.hd {
  background: #f6f1c6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .d.hd {
    background: #3a3716;
  }
}
:root[data-theme="dark"] .d.hd {
  background: #3a3716;
}
.d.lvd {
  background: var(--yb);
  border-color: var(--y);
}
.lvd {
  background: var(--yb);
  border-color: var(--y);
}
.d.cl {
  opacity: 0.5;
  background: var(--bd);
}
.ps {
  opacity: 0.6;
}
.c {
  display: block;
  font-size: 10.5px;
  line-height: 1.3;
  border-radius: 5px;
  padding: 2px 3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.n {
  background: var(--n);
  color: var(--nt);
}
.h {
  background: var(--h);
  color: var(--ht);
}
.lv {
  background: var(--yb);
  color: var(--y);
}
.v {
  background: var(--bd);
  color: var(--mu);
}
.bad {
  background: var(--rb);
  color: var(--r);
  outline: 1.5px solid var(--r);
}
.sh {
  border: 1.5px dashed var(--r);
  color: var(--r);
}
.me {
  font-weight: 700;
  text-decoration: underline;
}
.lg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
  font-size: 12px;
}
.lg .c {
  display: inline-block;
}
.box {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
}
.box h2 {
  font-size: 14px;
  margin: 0 0 6px;
}
.mu {
  color: var(--mu);
  font-size: 13px;
}
.row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.b {
  border: 1px solid var(--bd);
  background: var(--sf);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
.b.pri {
  background: var(--ac);
  color: var(--bg);
  border-color: var(--ac);
}
.b.on {
  border-color: var(--ac);
  box-shadow: inset 0 0 0 1.5px var(--ac);
}
.b.rn {
  background: var(--n);
  color: var(--nt);
}
.b.rh {
  background: var(--h);
  color: var(--ht);
}
.b[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.seg {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.card {
  border-top: 1px solid var(--bd);
  padding: 8px 0;
}
.card:first-of-type {
  border-top: 0;
}
.tag {
  font-size: 12px;
  border-radius: 5px;
  padding: 1px 6px;
  margin-left: 4px;
}
.sr {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  margin-top: 4px;
}
.bar {
  height: 8px;
  background: var(--bd);
  border-radius: 4px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--ac);
}
.c.out {
  background: var(--bd);
  color: var(--mu);
  text-decoration: line-through;
}
.c.p {
  border: 1.5px dashed #d97706;
  background: #fff0d6;
  color: #a85a00;
}
.c.sel {
  outline: 2.5px solid var(--ac);
}
.c.cand {
  box-shadow: inset 0 0 0 1.5px var(--ac);
}
.swp .c {
  padding: 6px 2px;
}
.tr {
  background: var(--rb);
  color: var(--r);
}
.ty {
  background: var(--yb);
  color: var(--y);
}
.tk {
  background: var(--h);
  color: var(--ht);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .c.p {
    background: #41300f;
    color: #f5a340;
    border-color: #f5a340;
  }
}
:root[data-theme="dark"] .c.p {
  background: #41300f;
  color: #f5a340;
  border-color: #f5a340;
}
#pimg {
  display: none;
}
html,
body {
  margin: 0;
}
@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }
  body > *:not(#pimg) {
    display: none !important;
  }
  #pimg {
    display: block;
    width: 297mm;
    height: 210mm;
  }
}
#sheet {
  position: fixed;
  inset: 0;
  background: #0008;
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 5;
}
#sheet.o {
  display: flex;
}
.pn {
  background: var(--bg);
  width: 100%;
  max-width: 520px;
  max-height: 88%;
  overflow: auto;
  border-radius: 16px 16px 0 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--tx);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  display: none;
  z-index: 9;
  max-width: 90%;
}

.nav select {
  width: auto;
  margin: 0;
  padding: 6px 8px;
}
.prow {
  transition: transform 0.16s ease;
}
.grip {
  cursor: grab;
  touch-action: none;
  padding: 4px 8px 4px 0;
  color: var(--mu);
  font-size: 18px;
}
.prow.drag {
  position: relative;
  z-index: 5;
  transition: none;
  background: var(--sf);
  box-shadow: 0 6px 16px #0004;
  border-radius: 8px;
}
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
input,
select,
textarea {
  -webkit-user-select: text;
  user-select: text;
}
body.dragging {
  overscroll-behavior: contain;
  cursor: grabbing;
}
#app {
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}
#mainc,
#side {
  display: contents;
}
header {
  order: 0;
}
.nav {
  order: 1;
}
#fin {
  order: 2;
}
#todo {
  order: 3;
}
#hint {
  order: 4;
}
#pal {
  order: 5;
}
#cal {
  order: 6;
}
.lg {
  order: 7;
}
#adm {
  order: 8;
}
#mine {
  order: 9;
}
#st {
  order: 10;
}
#cfg {
  order: 11;
}
.b:hover {
  filter: brightness(0.96);
}
.d:hover {
  border-color: var(--ac);
}
.b:focus-visible,
.d:focus-visible,
select:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 1px;
}
@media (min-width: 700px) {
  #app {
    max-width: 820px;
    padding: 16px;
  }
  .d {
    min-height: 92px;
    padding: 5px 6px;
  }
  .c {
    font-size: 12.5px;
    padding: 4px 6px;
  }
  .d em {
    font-size: 13px;
  }
  .grid {
    gap: 5px;
  }
  #sheet {
    align-items: center;
  }
  .pn {
    border-radius: 16px;
    max-width: 560px;
    max-height: 88vh;
    box-shadow: 0 12px 40px #0006;
  }
  .pn:has(img) {
    max-width: 920px;
  }
}
@media (min-width: 1000px) {
  body {
    font-size: 16px;
  }
  #app {
    max-width: 1400px;
    padding: 20px 28px;
    grid-template-columns: minmax(0, 1fr) 400px;
    column-gap: 24px;
    align-items: start;
  }
  #mainc,
  #side {
    display: block;
    min-width: 0;
  }
  header {
    grid-column: 1/-1;
    margin-bottom: 6px;
  }
  h1 {
    font-size: 22px;
  }
  #side {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding-right: 2px;
  }
  #side > *:first-child {
    margin-top: 0;
  }
  .d {
    min-height: 128px;
    padding: 8px 10px;
    border-radius: 10px;
  }
  .d em {
    font-size: 14px;
    font-weight: 600;
  }
  .grid {
    gap: 8px;
  }
  .wk {
    font-size: 14px;
    padding: 4px 0;
  }
  .c {
    font-size: 14px;
    padding: 5px 8px;
    border-radius: 7px;
  }
  #cal .c.n::before {
    content: "監工 ";
    opacity: 0.65;
  }
  #cal .c.h::before {
    content: "工安 ";
    opacity: 0.65;
  }
  .swp .c {
    padding: 7px 8px;
  }
  .sr {
    grid-template-columns: 76px 1fr auto;
  }
}
.pi {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pi.off > .b {
  opacity: 0.45;
  text-decoration: line-through;
}
.c.off {
  opacity: 0.45;
}
.b.ex {
  opacity: 0.45;
  text-decoration: line-through;
}
.sw {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  cursor: pointer;
  flex: none;
}
.sw input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.sw i {
  position: absolute;
  inset: 0;
  background: var(--bd);
  border-radius: 20px;
  transition: 0.15s;
  pointer-events: none;
}
.sw i::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: 0.15s;
  box-shadow: 0 1px 3px #0004;
}
.sw input:checked + i {
  background: var(--ac);
}
.sw input:checked + i::after {
  transform: translateX(14px);
}
.row.prow {
  flex-wrap: nowrap;
  gap: 4px;
}
.prow .row {
  flex-wrap: nowrap;
  gap: 4px;
}
.prow .b {
  padding: 4px 8px;
  flex: none;
}
.pl {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.nmt {
  overflow: hidden;
  text-overflow: ellipsis;
}
.nmt.ex {
  opacity: 0.45;
  text-decoration: line-through;
}
.est {
  display: none;
}
@media (min-width: 700px) and (max-width: 999px) {
  .est {
    display: inline;
  }
}
