:root {
  /* Casual mobile-game palette: bright & sharp solid colors */
  --bg: #eef9ff;
  --ink: #142033;
  --muted: #4a5d72;
  --card: #fffdf6;
  --line: #1c2a3a;
  --accent: #ff2d6f;
  --accent-ink: #142033;
  --danger: #d62839;
  --stamp: rgba(180, 20, 50, 0.85);
  --topbar: #4da3ff;
  --game-cyan: #00e5d4;
  --game-lime: #c6ff1a;
  --game-yellow: #ffe014;
  --game-orange: #ff8a00;
  --game-violet: #9b6bff;
  --game-duty: #16d46b;
  --game-place: #2f8cff;
  --button-radius: 0px;
  --button-gap: 0px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --img-page: url("../img/bg-download-pastel-mesh.jpg");
  /* How light the body bg image looks: 0% = full image, 100% = almost white */
  --bg-image-light: 30%;
  /* Larger base for workers ~30–55 reading on phones */
  font-size: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, var(--bg-image-light)), rgba(255, 255, 255, var(--bg-image-light))),
    var(--img-page);
  background-size: auto, cover;
  background-position: center top;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", "Heiti TC", sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 0.35rem;
  padding: 0.45rem 0.55rem;
  background: var(--topbar);
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 3px solid #142033;
  box-shadow: 0 4px 0 rgba(20, 32, 51, 0.18);
  overflow: hidden;
}

.topbar-name {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
}

.topbar-title {
  justify-self: center;
  text-align: center;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  /* Shrink to fit narrow phones; avoid horizontal scroll */
  font-size: clamp(0.72rem, 3.6vw, 1rem);
  letter-spacing: 0.01em;
}

.topbar-version {
  font-weight: 650;
  font-size: 0.85em;
  opacity: 0.85;
  margin-left: 0.2em;
}

.topbar-link {
  justify-self: end;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.1;
  opacity: 0.75;
  border: 1px solid rgba(20, 32, 51, 0.45);
  border-radius: var(--button-radius);
  padding: 0.12rem 0.22rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.4);
  max-width: 100%;
  text-align: center;
  white-space: nowrap;
}

.flash-wrap {
  padding: 0.5rem 0.75rem 0;
}

.flash {
  background: #fff4f4;
  color: var(--danger);
  border: 1px solid #e7bcbc;
  border-radius: 0.5rem;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.4rem;
  font-size: 1.1rem;
  font-weight: 650;
}

.field-label {
  font-weight: 700;
  font-size: 1.15rem;
}

.page {
  flex: 1;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 0.75rem;
  padding-bottom: calc(0.75rem + var(--safe-bottom));
}

.page-full {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.page-home {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 3.1rem);
  max-height: calc(100dvh - 3.1rem);
  padding-bottom: calc(0.5rem + var(--safe-bottom));
  gap: 0.65rem;
}

.panel {
  background: color-mix(in srgb, var(--card) 92%, #fff);
  border: 2px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.75rem;
  box-shadow: 0 4px 0 rgba(20, 32, 51, 0.12);
}

.panel-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-narrow {
  margin-top: 2rem;
}

.screen-title {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  text-align: center;
  font-weight: 700;
}

.screen-title-brand {
  margin-bottom: 0.25rem;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.screen-sub {
  margin: 0 0 0.85rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--muted);
}

.screen-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.screen-bar:not(:has(.screen-title)) {
  grid-template-columns: auto;
}

.screen-bar .screen-title {
  margin: 0;
  font-size: 1.2rem;
}

.back-link {
  font-size: 1.1rem;
  color: var(--accent);
  white-space: nowrap;
  font-weight: 650;
}

.grid {
  display: grid;
  gap: var(--button-gap);
  flex: 1;
  min-height: 0;
}

/* 3 columns; rows grow with duty count (was 3x4 / max 12) */
.grid-3x4 {
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(6rem, 1fr);
}

.tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 5.2rem;
  padding: 0.5rem;
  border: 2px solid #142033;
  border-radius: var(--button-radius);
  background: var(--game-yellow);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 #142033;
}

.tile:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #142033;
}

.tile-user,
.tile-choice,
.tile-duty {
  background: var(--game-cyan);
}

.tile-blank {
  background: #d7e0ea;
  box-shadow: none;
  border-color: #9aa8b8;
  cursor: default;
  pointer-events: none;
  visibility: visible;
}

.tile-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
}

.tile-line {
  display: block;
}

.tile-period {
  margin-top: 0.2rem;
  font-size: 1.05rem;
  opacity: 0.95;
  font-weight: 800;
}

.tile.is-stamped {
  overflow: hidden;
  color: #333333;
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}

/* Admin stamp links + worker re-start after 已完成 must remain clickable */
a.tile.is-stamped,
button.tile.is-stamped,
.tile.is-stamped a.stamp {
  pointer-events: auto;
  cursor: pointer;
}

.tile.is-stamped .tile-text {
  color: #333333;
}

.stamp {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) rotate(-16deg);
  width: 78%;
  height: 33%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--stamp);
  color: var(--stamp);
  border-radius: var(--button-radius);
  font-size: clamp(1rem, 4.2vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.9);
  pointer-events: none;
  box-sizing: border-box;
}

.stamp-start {
  border-color: #8a1028;
  color: #8a1028;
}

.stamp-done {
  border-color: #0d3d6e;
  color: #0d3d6e;
}


.password-form {
  display: grid;
  gap: 0.7rem;
}

.field-input {
  width: 100%;
  font-size: 1.55rem;
  padding: 0.9rem 0.8rem;
  border: 1px solid #000;
  border-radius: var(--button-radius);
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--button-radius);
  border: 2px solid #142033;
  padding: 0.95rem 1rem;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 #142033;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #142033;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-ghost {
  background: #ffffff;
  border-color: #142033;
  color: var(--ink);
}

.btn-block {
  width: 100%;
}

.btn-action {
  flex: 1;
  min-height: 5.2rem;
  font-size: 1.2rem;
  line-height: 1.3;
  text-align: center;
  padding: 0.75rem 0.55rem;
  color: var(--ink);
  border: 2px solid #142033;
  box-shadow: 0 4px 0 #142033;
}

.btn-action-duty {
  background: var(--game-duty);
}

.btn-action-place {
  background: var(--game-place);
  color: #FFFFFF;
}

.home-cover {
  flex: 0 0 auto;
  /* Left title + right list: room for ~2 items (each up to 2 lines), scroll for more */
  min-height: 5rem;
  max-height: 6.2rem;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border: 2px solid #142033;
  border-radius: var(--button-radius);
  background: #fff7e8;
  box-shadow: 0 4px 0 #142033;
  overflow: hidden;
}

.home-cover-title {
  flex: 0 0 auto;
  margin: 0;
  width: 2.1rem;
  padding: 0.35rem 0.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  writing-mode: vertical-rl;
  letter-spacing: 0.2em;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  background: #ffb347;
  border-right: 2px solid #142033;
}

.home-cover-scroll {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.home-cover-item {
  padding: 0.28rem 0.45rem;
}

.home-cover-line {
  font-size: 0.95rem;
  line-height: 1.3;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.home-item-started .home-cover-line {
  color: var(--danger);
}

.home-top {
  flex: 2;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--button-gap);
}

.page-home:has(.home-cover) .home-top {
  flex: 1.35;
}

.home-col {
  background: #fffdf5;
  border: 2px solid #142033;
  border-radius: var(--button-radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  box-shadow: 0 4px 0 #142033;
}

.home-col-title {
  margin: 0;
  padding: 0.6rem 0.45rem 0.45rem;
  font-size: 1.08rem;
  text-align: center;
  border-bottom: 2px solid #142033;
  color: var(--ink);
  font-weight: 700;
}

.home-col-title-duty {
  background: var(--game-duty);
}

.home-col-title-place {
  background: var(--game-place);
  color: #FFFFFF;
}

.home-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

.home-item {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid #000;
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fff;
  box-sizing: border-box;
}

.home-item-started {
  background: #ffffff;
  color: var(--danger);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.home-item-started:active {
  background: #f3f3f3;
}

.home-item-started .home-item-line {
  color: var(--danger);
  font-weight: 700;
}

.home-item-completed {
  background: #d8f5e2;
}

.home-item:last-child {
  border-bottom: none;
}

.home-item-line {
  font-size: 1.05rem;
  line-height: 1.35;
  font-weight: 650;
  word-break: break-word;
}

.empty-hint {
  margin: 1rem 0.4rem;
  text-align: center;
  color: var(--muted);
  font-size: 1.1rem;
}

.home-bottom {
  flex: 0.72;
  min-height: 0;
  display: flex;
  gap: var(--button-gap);
  align-items: stretch;
}

.page-home .home-bottom .btn-action {
  min-height: 0;
  font-size: 1.05rem;
  padding: 0.45rem 0.4rem;
}

.period-legend {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 0.45rem;
  padding: 0 0.15rem;
}

.place-grid {
  display: flex;
  flex-direction: column;
  gap: var(--button-gap);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.place-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--button-gap);
}

.tile-place {
  min-height: 5.8rem;
  border: 1px solid #000;
}

.tile-locked {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.72;
  color: #333333;
}

.tile-locked .tile-text {
  color: #333333;
}

.admin-blank {
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 60dvh;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(18, 28, 34, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal-card {
  width: min(100%, 22rem);
  background: #fff;
  border-radius: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--line);
}

.modal-message {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.45;
  white-space: pre-wrap;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--button-gap);
}

@media (min-width: 720px) {
  .page {
    width: min(100%, 640px);
  }

  .tile-text {
    font-size: 1.2rem;
  }
}

/* Admin */
.page-home-admin {
  width: min(100%, 520px);
  margin: 0 auto;
  height: calc(100dvh - 3.2rem);
  max-height: calc(100dvh - 3.2rem);
  padding: 0.5rem;
  padding-bottom: calc(0.5rem + var(--safe-bottom));
}

.admin-home-grid {
  height: 100%;
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: var(--button-gap);
}

.admin-home-grid .btn-action {
  min-height: 0;
  height: 100%;
  font-size: 1.15rem;
}

.btn-action-position {
  background: var(--game-orange);
}

.btn-action-leave {
  background: #ff6b8a;
  color: #FFFFFF;
}

.btn-action-cover-status {
  background: #5ec8ff;
}

.btn-action-report {
  background: var(--game-lime);
}

.btn-action-config {
  background: var(--game-violet);
  color: #FFFFFF;
}

.btn-action.is-disabled {
  opacity: 0.65;
  pointer-events: none;
}

.screen-bar-sticky {
  position: sticky;
  top: 0;
  z-index: 15;
  background: color-mix(in srgb, var(--card) 96%, #fff);
  padding-top: 0.15rem;
  padding-bottom: 0.35rem;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid #000;
}

.page-positions {
  width: min(100%, 520px);
  margin: 0 auto;
  height: calc(100dvh - 3.2rem);
  max-height: calc(100dvh - 3.2rem);
  padding: 0.4rem;
  padding-bottom: calc(0.35rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
}

.positions-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
}

.position-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid #000;
  overflow: hidden;
}

.position-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.35rem;
  align-items: center;
  flex: 1;
  min-height: 0;
  padding: 0.15rem 0.4rem;
  border-bottom: 1px solid #000;
}

.position-row:last-child {
  border-bottom: none;
}

.position-name {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.1;
}

.position-meta {
  font-size: 0.82rem;
  line-height: 1.2;
  font-weight: 650;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.position-meta time {
  margin-right: 0.3rem;
  font-weight: 800;
}

.position-meta.is-empty {
  color: var(--muted);
}

.position-row.is-cover .position-meta {
  color: #9a4d00;
}

.position-row.is-cover-started .position-meta {
  color: var(--danger);
  font-weight: 750;
}

.tile-main-hit {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  padding: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a.stamp {
  z-index: 3;
  text-decoration: none;
  pointer-events: auto;
}

.page-admin-wide {
  width: min(100%, 100vw);
  max-width: none;
  height: calc(100dvh - 3.2rem);
  max-height: calc(100dvh - 3.2rem);
  padding: 0.4rem;
  padding-bottom: calc(0.35rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
}

.page-admin-wide > .panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.duty-matrix-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.duty-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.62rem;
  line-height: 1.15;
}

.duty-matrix th,
.duty-matrix td {
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 0;
  vertical-align: top;
  word-break: break-word;
  background: #fff;
}

.duty-matrix tr > *:first-child {
  border-left: 1px solid #000;
}

.duty-matrix thead th {
  border-top: 1px solid #000;
  background: var(--game-duty);
  color: var(--ink);
  font-size: 0.75rem;
  padding: 0.25rem 0.1rem;
  position: sticky;
  top: 0;
  z-index: 5;
}

.matrix-cell {
  position: relative;
  display: block;
  min-height: 3.2rem;
  padding: 0.2rem 0.15rem 0.85rem;
  color: inherit;
  text-decoration: none;
  background: #fff;
}

.matrix-cell.is-blank {
  min-height: 3.2rem;
  background: #fff;
}

.matrix-cell.is-stamped {
  color: #333333;
}

.matrix-cell.is-stamped-start {
  background: #fff5f5;
}

.matrix-cell.is-stamped-done {
  background: #eef8f0;
}

.place-today-wrap {
  overflow-x: hidden;
}

.place-today-matrix {
  font-size: 0.55rem;
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.place-today-matrix thead th {
  background: #7eb8c9;
  font-size: 0.55rem;
  line-height: 1.15;
  padding: 0.12rem 0.02rem;
  vertical-align: middle;
}

.place-today-matrix th,
.place-today-matrix td {
  vertical-align: middle;
}

.place-today-col-area,
.place-today-col-period {
  display: block;
  text-align: center;
}

.place-today-loc {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #e8f4f8 !important;
  font-weight: 800;
  font-size: 0.55rem;
  white-space: nowrap;
  padding: 0.08rem 0.12rem !important;
  width: 2.8rem;
  max-width: 2.8rem;
  vertical-align: middle !important;
}

.place-today-matrix thead .place-today-loc {
  z-index: 6;
  top: 0;
}

.place-today-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.2rem;
  width: 100%;
  padding: 0.06rem 0.02rem;
  border: 0;
  background: #fff;
  font: inherit;
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.place-today-cell.is-empty {
  min-height: 1.2rem;
}

.place-today-cell-stamp {
  color: #888;
  cursor: pointer;
}

.place-today-cell.is-started {
  color: #ff1744;
  background: #fff5f5;
}

.place-today-cell.is-done {
  color: #0b5c32;
  background: #e8f5ec;
}

.place-today-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  margin: 0.35rem 0.4rem 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
}

.place-today-legend-item.is-started {
  color: #ff1744;
}

.place-today-legend-item.is-done {
  color: #0b5c32;
}

.stamp-inspect-actions {
  margin-top: 1rem;
  display: grid;
  gap: 0.5rem;
}

.matrix-text {
  display: flex;
  flex-direction: column;
  font-weight: 700;
}

.stamp-sm {
  width: 90%;
  height: 36%;
  font-size: 0.55rem;
  border-width: 2px;
  bottom: 0.1rem;
}

.stamp-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #000;
}

.stamp-detail-list li {
  padding: 0.75rem;
  border-bottom: 1px solid #000;
  display: grid;
  gap: 0.2rem;
}

.stamp-row-start {
  background: #fff5f5;
}

.stamp-row-done {
  background: #eef8f0;
}

.stamp-detail-list li:last-child {
  border-bottom: none;
}

.stamp-detail-sub {
  color: var(--muted);
  font-size: 0.95rem;
}

.tile-readonly {
  cursor: default;
}

a.tile-readonly {
  cursor: pointer;
}

.place-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.place-cell .tile {
  flex: 1;
  position: relative;
}

.config-table-list {
  display: flex;
  flex-direction: column;
  gap: var(--button-gap);
}

.config-table-link {
  display: flex;
  align-items: center;
  min-height: 3.4rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #000;
  background: #eef3f5;
  font-weight: 700;
  font-size: 1.1rem;
}

.config-actions {
  margin-bottom: 0.5rem;
}

.config-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  border: 1px solid #000;
}

.config-data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.config-data th,
.config-data td {
  border: 1px solid #000;
  padding: 0.35rem;
  vertical-align: top;
  word-break: break-word;
}

.config-data th {
  background: #c9d4e8;
  color: var(--ink);
  position: sticky;
  top: 0;
}

.config-row-actions {
  white-space: nowrap;
}

.config-row-actions form {
  display: inline;
}

.config-row-actions button {
  font: inherit;
  margin-left: 0.3rem;
}

.config-form {
  display: grid;
  gap: 0.65rem;
}

.config-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.35;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.field-input-color {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
  min-height: 3rem;
  height: 3rem;
  padding: 0.15rem;
  background: transparent;
  box-sizing: border-box;
  cursor: pointer;
}

.color-field-hex {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--ink);
}

.color-swatch {
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid #142033;
  border-radius: 0.2rem;
  vertical-align: middle;
}

.modal-card-alert {
  width: min(100%, 28rem);
  max-height: 80dvh;
  overflow: auto;
}

.alert-list {
  display: grid;
  gap: 0.65rem;
}

.alert-item {
  display: grid;
  gap: 0.45rem;
  border: 1px solid #000;
  padding: 0.65rem;
  background: #fff8e8;
}

.alert-item-text {
  font-size: 1.05rem;
  line-height: 1.35;
}

.alert-item-sub {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.flash-ok {
  background: #eef8f0;
  color: #2d6a3a;
  border-color: #b7d8be;
}

.report-hint {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--ink);
}

.report-form {
  display: grid;
  gap: 0.85rem;
}

.report-fieldset {
  border: 2px solid #142033;
  border-radius: var(--button-radius);
  padding: 0.75rem;
  margin: 0;
  background: #fff;
}

.report-radio {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.45rem 0;
}

.report-radio input {
  width: 1.25rem;
  height: 1.25rem;
}

.btn-action-report-export {
  margin-top: 0.35rem;
  min-height: 4rem;
  background: var(--game-lime);
  color: var(--ink);
}

/* Admin date picker */
.screen-title-date {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
  -webkit-tap-highlight-color: transparent;
}

.screen-title-date:active,
.screen-title-date:focus-visible {
  background: rgba(47, 111, 126, 0.12);
  outline: none;
}

.modal-card-date {
  width: min(100%, 22rem);
  padding: 0.85rem;
}

.date-picker-heading {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
}

.date-picker-body {
  min-height: 14rem;
  margin-bottom: 0.75rem;
}

.date-picker-empty {
  margin: 2rem 0;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.date-picker-dow {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  padding: 0.25rem 0;
}

.date-picker-day {
  appearance: none;
  border: 0;
  background: #eef6f8;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  min-height: 2.4rem;
  border-radius: 0.4rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.date-picker-day.is-pad {
  visibility: hidden;
  pointer-events: none;
}

.date-picker-day.is-disabled {
  background: #eceff1;
  color: #b0b8bd;
  cursor: not-allowed;
}

.date-picker-day.is-today:not(.is-disabled) {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.date-picker-day.is-selected:not(.is-disabled) {
  background: var(--accent);
  color: #fff;
}

.date-picker-day:not(.is-disabled):active {
  filter: brightness(0.95);
}

.date-picker-list {
  display: grid;
  gap: 0.4rem;
  max-height: 16rem;
  overflow-y: auto;
}

.date-picker-list-months {
  grid-template-columns: repeat(3, 1fr);
}

.date-picker-list-item {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.date-picker-list-item.is-current {
  background: #e8f4f8;
  border-color: var(--accent);
}

.date-picker-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

/* 工友請假 / 代工 */
.page-leave-cover,
.page-leave-assign,
.page-leave-status {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 3.1rem);
  max-height: calc(100dvh - 3.1rem);
  overflow: hidden;
}

.leave-cover-panel,
.leave-assign-panel,
.leave-status-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.page-leave-cover .screen-sub {
  flex: 0 0 auto;
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.leave-cover-user-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.leave-cover-user-grid .tile {
  min-height: 0;
  height: 100%;
  padding: 0.3rem;
}

.tile-leave-set {
  outline: 3px solid #d62839;
}

.leave-cover-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--button-gap);
  margin-top: 0.45rem;
}

.leave-cover-actions .btn {
  min-height: 2.75rem;
}

.leave-assign-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.leave-assign-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #000;
}

.leave-status-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #000;
}

.leave-assign-row {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 2.6rem;
  gap: 0.25rem;
  align-items: center;
  padding: 0.08rem 0.3rem;
  border-bottom: 1px solid #000;
}

.leave-status-row {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 3.2rem;
  gap: 0.25rem;
  align-items: center;
  padding: 0.08rem 0.3rem;
  border-bottom: 1px solid #000;
}

.leave-assign-row:last-child,
.leave-status-row:last-child {
  border-bottom: none;
}

.leave-assign-task,
.leave-status-task {
  min-width: 0;
  overflow: hidden;
}

.leave-cat {
  display: inline;
  font-weight: 900;
  margin-right: 0.2rem;
  color: #9b1c2e;
}

.leave-assign-line {
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.15;
  word-break: break-word;
}

.leave-assign-line-cont {
  padding-left: 0.78rem;
}

.leave-assign-select {
  width: 2.6rem;
  min-width: 2.6rem;
  max-width: 2.6rem;
  min-height: 0;
  height: 1.85rem;
  padding: 0 0.05rem;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
  text-align-last: center;
}

.leave-assign-footer {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--button-gap);
  margin-top: 0.35rem;
}

.leave-assign-footer .btn {
  min-height: 2.35rem;
  padding: 0.25rem 0.4rem;
  font-size: 1.05rem;
}

.leave-status-nav {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.3rem;
}

.leave-status-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.35rem;
  padding: 0 0.2rem;
  border: 1px solid #142033;
  background: #fff;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.leave-status-nav-btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.leave-status-who {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.35rem;
}

.leave-status-meta {
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.15;
}

.leave-status-helper {
  font-weight: 800;
}

.leave-status-inline {
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.leave-status-row.is-started .leave-status-inline {
  color: var(--danger);
}

.leave-status-row.is-done {
  background: #d8f5e2;
}

.leave-status-row.is-started {
  background: #ffffff;
  color: var(--danger);
}

.btn.is-disabled {
  opacity: 0.65;
  pointer-events: none;
}

.leave-clear-forms {
  margin-bottom: 0.5rem;
}

.field-textarea {
  min-height: 4.5rem;
  resize: vertical;
}

