:root {
  --red: #B81D2D;
  --red-deep: #931724;
  --red-light: #F9E8EA;
  --ink: #3B3B3C;
  --bg: #F4F4F5;
  --surface: #FFFFFF;
  --border: #DFDFE3;
  --gray-light: #ECECEF;
  --text: #26262A;
  --muted: #5C5C61;
  --hint: #9A9AA0;
}

* { box-sizing: border-box; }

img {
  max-width: 100%;
  height: auto;
}

[hidden] {
  display: none !important;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

h1, h2, h3 {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

a { color: var(--red); }

.section-head {
  font-size: 1.5rem;
  border-left: 6px solid var(--red);
  border-radius: 3px;
  padding-left: 14px;
  margin: 0 0 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}

.btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 11px 20px;
  font: 600 1rem "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(184, 29, 45, 0.28);
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--red-light);
  outline-offset: 2px;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not([disabled]) {
    background: var(--red-deep);
    transform: translateY(-3px);
    box-shadow: 0 7px 18px rgba(184, 29, 45, 0.36);
  }
}

.btn-block { width: 100%; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover:not([disabled]) {
    background: var(--gray-light);
    transform: none;
    box-shadow: none;
  }
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 14px 0 6px;
  color: var(--muted);
}

input[type="email"],
input[type="password"],
input[type="search"],
input[type="time"],
input[type="tel"],
input[type="url"],
input[type="text"],
input[type="number"],
input[type="date"],
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: 400 1rem "DM Sans", system-ui, sans-serif;
  touch-action: manipulation;
}

input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--red-light);
  border-color: var(--red);
}

.form-error {
  color: #B4231F;
  font-size: 0.9rem;
  margin: 12px 0 0;
}

.login-body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.login-wrap {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.pad-logo {
  display: block;
  width: min(360px, 94%);
  height: auto;
  margin: 0 auto 18px;
}

.pad-bar {
  display: block;
  width: 46px;
  height: 3px;
  background: var(--red);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.pad-bar-small {
  width: 28px;
  height: 2px;
  margin: 8px auto 18px;
}

.pad-portal {
  color: var(--hint);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  margin: 0 0 30px;
}

.pad-label {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 13px;
  margin: 0 0 22px;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--red);
  background: transparent;
  transition: background 0.1s ease;
}

.dot-filled {
  background: var(--red);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.key {
  min-height: 70px;
  background: var(--surface);
  border: 1px solid #EFEFF1;
  border-radius: 16px;
  box-shadow: 0 2px 6px rgba(38, 38, 42, 0.07);
  font: 700 1.5rem "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.1s ease, transform 0.1s ease;
}

.key:active {
  background: var(--red-light);
  border-color: var(--red);
  transform: scale(0.97);
}

.key:focus-visible {
  outline: 3px solid var(--red-light);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .key:hover { background: var(--gray-light); }
}

.key-ghost {
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.key-del {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--muted);
  font: 600 1.05rem "DM Sans", system-ui, sans-serif;
}

.key-del:active {
  background: transparent;
  border: 0;
  color: var(--red);
  transform: scale(0.95);
}

@media (hover: hover) and (pointer: fine) {
  .key-del:hover { background: transparent; color: var(--red); }
}

.pin-msg {
  min-height: 1.3em;
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.pin-msg-error {
  color: #B4231F;
  font-weight: 600;
}

.powered {
  text-align: center;
  color: var(--hint);
  font-size: 0.78rem;
  margin: 26px 0 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.brand-logo {
  display: block;
  height: 32px;
  width: auto;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.pagefoot {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px 28px;
}

.loading {
  color: var(--muted);
  text-align: center;
  padding: 30px 0;
}

.banner {
  background: var(--red-light);
  border: 1px solid var(--red);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 0.95rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.toolbar .section-head { margin: 0; }

.job-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  margin: 0 0 12px;
  transition: border-color 0.12s ease;
}

@media (hover: hover) and (pointer: fine) {
  .job-card:hover { border-color: var(--red); }
}

.job-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.job-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}

.job-age {
  color: var(--hint);
  font-size: 0.82rem;
  white-space: nowrap;
}

.job-sub {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 2px;
}

.job-hours {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.job-hours-over {
  color: #B4231F;
  font-weight: 600;
}

.progress {
  height: 8px;
  background: var(--gray-light);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-over {
  background: #7E1520;
}

.subhead {
  font-size: 1.1rem;
  margin: 22px 0 10px;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0 0 10px;
}

.badge-done {
  display: inline-block;
  background: var(--gray-light);
  color: var(--muted);
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  vertical-align: middle;
  margin-left: 8px;
}

.kv {
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.kv > span:first-child {
  display: inline-block;
  min-width: 84px;
  color: var(--hint);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kv-block > span:first-child { display: block; margin-bottom: 2px; }

.tracker { margin: 14px 0 4px; }

.tracker-nums {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.hint-text {
  color: var(--hint);
  font-weight: 400;
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn-danger {
  background: #fff;
  color: var(--red);
  border: 1px solid var(--red);
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn-danger:hover:not([disabled]) {
    background: var(--red-light);
    transform: none;
    box-shadow: none;
  }
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.inline-form > div { flex: 0 0 auto; }

.inline-form > div > input { width: 110px; }

.inline-form .grow { flex: 1 1 160px; }

.inline-form .grow input { width: 100%; }

.inline-form label { margin-top: 0; }

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--gray-light);
  font-size: 0.95rem;
}

.row-main { flex: 1 1 auto; }

.row-qty {
  color: var(--muted);
  font-size: 0.88rem;
}

.row-side {
  color: var(--hint);
  font-size: 0.85rem;
  white-space: nowrap;
}

.row-x {
  background: none;
  border: 0;
  color: var(--hint);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  touch-action: manipulation;
}

.row-x:active { color: var(--red); }

@media (hover: hover) and (pointer: fine) {
  .row-x:hover { color: var(--red); }
}

.empty-line {
  color: var(--hint);
  font-size: 0.92rem;
  margin: 4px 0 0;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 0;
}

.chip {
  background: var(--gray-light);
  color: var(--hint);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 10px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.photo-item {
  position: relative;
}

.photo-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
}

.photo-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.photo-x:active { color: var(--red); }

input[type="file"] {
  width: 100%;
  font-size: 0.9rem;
  color: var(--muted);
  touch-action: manipulation;
}

select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: 400 0.95rem "DM Sans", system-ui, sans-serif;
  touch-action: manipulation;
}

select:focus-visible {
  outline: 3px solid var(--red-light);
  border-color: var(--red);
}

.permit-card { margin-bottom: 12px; }

.permit-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.permit-name {
  font-weight: 700;
  color: var(--ink);
  flex: 1 1 auto;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.permit-form { margin-top: 8px; }

.stamp {
  color: var(--hint);
  font-size: 0.8rem;
  margin: 10px 0 0;
}

.todo-check {
  width: 20px;
  height: 20px;
  accent-color: var(--red);
  touch-action: manipulation;
  flex: 0 0 auto;
}

.todo-done .row-main {
  text-decoration: line-through;
  color: var(--hint);
}

.privacy-line {
  color: var(--hint);
  font-size: 0.88rem;
  margin: -6px 0 16px;
}

.note-preview {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-head {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 14px 0 2px;
}

.receipt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--gray-light);
}

.receipt-row:first-child { border-top: 0; }

.receipt-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
}

.receipt-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--gray-light);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: none;
}

.receipt-info { flex: 1 1 auto; min-width: 0; }

.badge-due {
  background: var(--red-light);
  color: var(--red);
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  white-space: nowrap;
}

.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--gray-light);
}

.rating-row label {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.review-card { margin-bottom: 12px; }

.progress-fill.p-ok { background: #2E7D32; }
.progress-fill.p-watch { background: #C9A227; }
.progress-fill.p-warn { background: #E08A00; }
.progress-fill.p-hot { background: #D9481F; }
.progress-fill.p-danger { background: #B81D2D; }
.progress-fill.p-over { background: #7E1520; }

.band-note {
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 600;
}

.band-note.p-watch { color: #9A7B14; }
.band-note.p-warn { color: #B26E00; }
.band-note.p-hot { color: #D9481F; }
.band-note.p-danger { color: #B81D2D; }
.band-note.p-over { color: #7E1520; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 38, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.modal h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.rem-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--gray-light);
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
}

.modal .btn-block { margin-top: 16px; }

.tag {
  display: inline-block;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  vertical-align: middle;
  white-space: nowrap;
}

.tag-pub {
  background: var(--red-light);
  color: var(--red);
}

.tag-for {
  background: var(--navy, #EEF0F8);
  background: #EDEFF7;
  color: #34406B;
}

.tag-from {
  background: var(--gray-light);
  color: var(--muted);
}

.check-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 400;
  color: var(--text);
  font-size: 0.95rem;
  margin: 14px 0 0;
}

.check-line input {
  width: 19px;
  height: 19px;
  accent-color: var(--red);
}

.note-body {
  white-space: pre-wrap;
  margin-top: 8px;
}

.photo-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-title {
  font-weight: 700;
  color: var(--ink);
  font-size: 1.05rem;
}

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

.cal-dow {
  text-align: center;
  color: var(--hint);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 0 6px;
}

.cal-cell {
  min-height: 58px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px;
  text-align: left;
  cursor: pointer;
  font: 400 0.8rem "DM Sans", system-ui, sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  touch-action: manipulation;
}

.cal-blank {
  background: transparent;
  border: 0;
  cursor: default;
  pointer-events: none;
}

.cal-daynum {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--muted);
}

.cal-today .cal-daynum { color: var(--red); }

.cal-today { border-color: var(--red-light); }

.cal-sel {
  border-color: var(--red);
  background: var(--red-light);
}

.cal-chip {
  display: block;
  background: var(--red);
  color: #fff;
  border-radius: 4px;
  font-size: 0.64rem;
  font-weight: 600;
  padding: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-chip-pub {
  background: #6B7280;
}

.cal-more {
  color: var(--hint);
  font-size: 0.66rem;
  font-weight: 700;
}

.cal-add { margin-top: 14px; }

.userbox {
  position: relative;
  margin-left: auto;
}

.user-chip {
  background: var(--gray-light);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font: 600 0.92rem "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.user-chip:active { background: var(--red-light); }

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
  min-width: 180px;
  padding: 6px;
  z-index: 60;
  display: flex;
  flex-direction: column;
}

.user-menu a,
.user-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 11px 12px;
  border-radius: 8px;
  font: 600 0.95rem "DM Sans", system-ui, sans-serif;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.user-menu a:active,
.user-menu button:active { background: var(--red-light); color: var(--red); }

@media (hover: hover) and (pointer: fine) {
  .user-menu a:hover,
  .user-menu button:hover { background: var(--gray-light); }
}

.tabnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 12px;
  -webkit-overflow-scrolling: touch;
}

.tabnav a {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 14px;
  border-radius: 10px;
  touch-action: manipulation;
}

.tabnav a.active {
  color: var(--red);
  background: var(--red-light);
}

.page { padding-bottom: 40px; }

@media (min-width: 720px) {
  .tabnav { justify-content: center; }
}

.pad-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 6px 0 0;
}

.tracker-card { margin-bottom: 12px; }

.job-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 0 0 14px;
  -webkit-overflow-scrolling: touch;
}

.job-tab {
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 15px;
  font: 600 0.9rem "DM Sans", system-ui, sans-serif;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}

.job-tab.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.stepper-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-btn {
  width: 52px;
  height: 52px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font: 700 1.4rem "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.step-btn:active {
  background: var(--red-light);
  border-color: var(--red);
}

.step-val {
  min-width: 58px;
  text-align: center;
  font: 700 1.4rem "DM Sans", system-ui, sans-serif;
  color: var(--ink);
}

.step-unit {
  color: var(--muted);
  font-size: 0.92rem;
}

.step-date { width: auto; }

#toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 30px;
  background: var(--ink);
  color: #fff;
  font: 600 0.92rem "DM Sans", system-ui, sans-serif;
  padding: 11px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 70;
  max-width: 86vw;
  text-align: center;
}

#toast.toast-show { opacity: 1; }

.crew-row { align-items: center; }

.hist-row { border-top: 1px solid var(--gray-light); }

.add-panel {
  background: var(--bg);
  border: 1px solid var(--gray-light);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.add-panel .check-line { margin-top: 10px; }

.stepper-line label { margin-top: 0; }

.toolbar-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}

.call-card .list-row {
  border-top: 0;
  padding: 2px 0;
}

.card-done { opacity: 0.6; }

.jnote { white-space: pre-wrap; }


.collapse-btn {
  display: block;
  background: none;
  border: 0;
  padding: 0;
  margin: 26px 0 12px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.tab-count {
  display: inline-block;
  background: var(--gray-light);
  color: var(--ink);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.75rem;
  margin-left: 6px;
}

.job-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.month-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 22px 2px 10px;
  font-weight: 700;
  color: var(--ink);
}

.month-total {
  color: var(--red);
  font-weight: 700;
}

.row-tap {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-top: 1px solid var(--gray-light);
  padding: 13px 2px;
  font: 600 0.98rem "DM Sans", system-ui, sans-serif;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}

.row-tap:first-child { border-top: 0; }

.row-tap:active { background: var(--red-light); color: var(--red); }

.cal-chip-job {
  background: #FFFFFF;
  border: 1px solid var(--red);
  color: var(--red);
}

.home-date {
  margin: 2px 0 0;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--ink);
}

.home-sub {
  margin: 0 0 14px;
  color: var(--muted);
}

.home-head {
  margin: 22px 2px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.tile {
  margin: 0;
  padding: 14px;
  text-decoration: none;
  display: block;
}

.tile-num {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--red);
  line-height: 1.1;
}

.tile-label {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.sched-row {
  display: flex;
  gap: 12px;
  padding: 11px 2px;
  border-top: 1px solid var(--gray-light);
}

.sched-row:first-child {
  border-top: 0;
}

.sched-time {
  flex: 0 0 72px;
  text-align: right;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}

.sched-red {
  color: var(--red);
}

.sched-body {
  flex: 1;
  min-width: 0;
}

.sched-title {
  display: block;
  font-weight: 600;
}

.sched-sub {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.home-link {
  display: block;
  text-align: right;
  margin: 6px 2px 0;
  font-size: 0.88rem;
}

.pf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.fee-table {
  margin-top: 14px;
  border-top: 2px solid var(--ink);
}

.fee-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-light);
}

.fee-label {
  flex: 1;
  font-size: 0.92rem;
}

.fee-rate {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.fee-qty {
  flex: 0 0 82px;
  width: 82px;
}

.fee-line {
  flex: 0 0 80px;
  text-align: right;
  font-weight: 600;
}

.fee-total-row {
  border-bottom: 0;
  padding-top: 12px;
}

.fee-total {
  color: var(--red);
  font-size: 1.05rem;
  font-weight: 800;
}

.permit-name {
  flex: 1 1 100%;
}

.permit-head select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.permit-head .btn {
  flex: 0 0 auto;
}

.cal-nav {
  gap: 6px;
}

.cal-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fee-row {
  gap: 8px;
}

.fee-qty {
  flex: 0 0 72px;
  width: 72px;
}

.fee-line {
  flex: 0 0 72px;
}

.tb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-row {
  text-align: right;
  margin: 0 0 6px;
}

.who-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 4px 0 10px;
}

.who-line {
  margin: 2px 0;
}

.row-tap-ev {
  cursor: pointer;
}

.row-tap-ev:active {
  background: var(--red-light);
}
.bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
.bell:active { background: var(--red-light); color: var(--red); }
.bell-count {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font: 700 0.7rem/18px "DM Sans", system-ui, sans-serif;
  text-align: center;
}
.alert-row {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-top: 1px solid var(--gray-light);
  padding: 12px 4px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}
.alert-row:first-child { border-top: 0; }
.alert-unread { box-shadow: inset 3px 0 0 var(--red); padding-left: 12px; }
.alert-unread .alert-msg { font-weight: 700; color: var(--ink); }
.alert-msg { display: block; }
.alert-time { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; }
.ready-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--gray-light);
  font-weight: 600;
}
.ready-yes { background: #E7F4EA; color: #1D6B34; }
.duty-group { padding: 12px 2px; border-top: 1px solid var(--gray-light); }
.duty-group:first-child { border-top: 0; }
.duty-mine { background: var(--red-light); border-radius: 10px; padding: 12px; }
.duty-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.duty-list { margin: 8px 0 0; padding-left: 20px; }
.duty-list li { margin: 4px 0; }
.role-card { padding: 12px 2px; border-top: 1px solid var(--gray-light); }
.role-card:first-child { border-top: 0; }
.role-title { margin-top: 2px; color: var(--red); font-size: 0.9rem; font-weight: 700; }
.role-desc { margin: 6px 0 0; white-space: pre-wrap; }
.task-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.print-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.print-sheet { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; color: #000; }
.print-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.print-logo { height: 44px; width: auto; }
.print-head h2 { margin: 0; }
.print-head p { margin: 2px 0 0; color: var(--muted); }
.print-sheet h3 { margin: 16px 0 6px; color: var(--muted); font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table th,
.print-table td { padding: 6px 4px; border-bottom: 1px solid var(--gray-light); text-align: left; vertical-align: top; }
.print-table th { width: 42%; font-weight: 600; }
.print-table .num { text-align: right; white-space: nowrap; }
.print-total td { border-bottom: 0; font-weight: 800; }

@media print {
  .topbar, .tabnav, .pagefoot, .no-print, #toast { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; margin: 0; padding: 0; }
  .print-sheet { border: 0; border-radius: 0; padding: 0; }
  .print-table th, .print-table td { border-bottom-color: #ccc; }
}
.btn-sm { min-height: 38px; }
select { max-width: 100%; }
select.full { width: 100%; }
.inline-form > div > input[type="date"] { width: 158px; }
.inline-form > div > input[type="time"] { width: 136px; }

.row-link { color: inherit; text-decoration: none; }
.row-link:active { background: var(--gray-light); }
.row-chev { flex: 0 0 auto; color: var(--hint); font-size: 1.3rem; line-height: 1; }
.row-sub { display: block; margin-top: 2px; color: var(--hint); font-size: 0.85rem; font-weight: 400; overflow-wrap: anywhere; }
.receipt-info .row-side { white-space: normal; }

.row-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 40px;
  min-height: 40px;
  margin: -8px -10px -8px 0;
  padding: 0;
}

.collapse-btn { width: 100%; min-height: 44px; padding: 10px 0; text-align: left; }

.job-card-top { flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 6px 8px; }
.job-when { margin-top: 4px; color: var(--hint); font-size: 0.86rem; }

.job-tabs { flex-wrap: wrap; overflow: visible; }

.permit-head select { flex: 1 1 100%; }
.ready-bar .btn { flex: 0 0 auto; white-space: nowrap; }
.print-head { flex-wrap: wrap; }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}
.cal-key-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-key { display: inline-block; width: 18px; height: 6px; border-radius: 3px; background: var(--red); }
.cal-key-pub { background: #6B7280; }
.cal-key-job { background: #fff; border: 1px solid var(--red); }
.cal-chip {
  align-self: stretch;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.25;
  text-overflow: clip;
}
.cal-chip b { font-weight: 800; }

.duty-yours { margin-top: 4px; color: var(--red); font-size: 0.85rem; font-weight: 700; }

@media (max-width: 600px) {
  .tabnav { gap: 0; padding: 6px 4px; }
  .tabnav a { flex: 1 0 auto; min-width: 42px; padding: 10px 3px; font-size: 0.82rem; text-align: center; }
  .cal-card { margin-left: -16px; margin-right: -16px; padding: 10px 3px; border-radius: 0; border-left: 0; border-right: 0; }
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 78px; padding: 3px 2px; }
  .cal-chip { padding: 1px 2px; border-radius: 3px; font-size: 0.6rem; line-height: 1.2; -webkit-hyphens: auto; hyphens: auto; }
  .sheet-overlay { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; max-height: 90vh; border-radius: 16px 16px 0 0; }
  .cal-more { font-size: 0.62rem; line-height: 1; }
  .job-tabs { gap: 5px; }
  .job-tab { padding: 8px 9px; font-size: 0.86rem; }
}
a.job-tab { display: inline-block; text-decoration: none; }
.hours-sum { color: var(--text); font-size: 0.98rem; }
.hours-sum strong { color: var(--ink); font-size: 1.15rem; }
.hours-over, .hours-over strong { color: #7E1520; }
.hours-by { margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; }
.progress-thin { height: 5px; margin-top: 8px; }
.job-card .job-hours { margin-top: 6px; }
.ta-list {
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}
.ta-item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-top: 1px solid var(--gray-light);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.ta-item:first-child { border-top: 0; }
.ta-item:active { background: var(--gray-light); }
@media (hover: hover) {
  .ta-item:hover { background: var(--gray-light); }
}
.tag-svc { background: #E6F0FA; color: #1F4E79; }
.svc-link {
  display: block;
  margin: 0 0 12px;
  padding: 11px 14px;
  border: 1px solid #C9DDF0;
  border-radius: 12px;
  background: #F2F7FC;
  color: #1F4E79;
  font-weight: 600;
  text-decoration: none;
}
.svc-link:active { background: #E6F0FA; }
.tb-actions .btn, .toolbar > .btn { white-space: nowrap; }
.svc-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.svc-link .row-chev { color: #1F4E79; }
.cal-item { display: block; padding: 12px 2px; border-top: 1px solid var(--gray-light); color: inherit; text-decoration: none; }
.cal-item:first-child { border-top: 0; }
.cal-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.cal-item-when { color: var(--red); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.cal-item-job .cal-item-when { color: var(--muted); }
.cal-item-title { margin-top: 2px; color: var(--ink); font-size: 1rem; font-weight: 700; }
.cal-item-sub { margin-top: 3px; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.cal-item-desc { margin-top: 6px; color: var(--text); font-size: 0.92rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.cal-item-tags { margin-top: 6px; }
.cal-item-job:active { background: var(--gray-light); }

.sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--gray-light);
}
.sheet-title { color: var(--ink); font-size: 1.15rem; font-weight: 800; }
.sheet-sub { margin-top: 2px; color: var(--red); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.sheet-x {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: -8px -10px 0 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 18px 0; }
.sheet-foot { position: sticky; bottom: 0; padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--surface); }
.sheet-foot .btn { width: 100%; }
.sheet-foot-2 { display: flex; gap: 10px; }
.sheet-foot-2 .btn { flex: 1 1 0; }
.sheet-form { padding-bottom: 6px; }
.date-row { display: flex; align-items: center; gap: 8px; }
.date-row input[type="date"] { flex: 0 0 auto; width: 158px; }
.date-row .btn { flex: 0 0 auto; }

.photo-x { top: 6px; right: 6px; width: 36px; height: 36px; font-size: 1.2rem; line-height: 1; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); touch-action: manipulation; }
.confirm-detail { margin: 0 0 4px; color: var(--muted); overflow-wrap: anywhere; }
.ta-item.ta-on { background: var(--gray-light); }
.ta-new { color: var(--red); font-weight: 600; }
.call-card { padding: 0; overflow: hidden; }
.call-link { display: block; padding: 18px 20px 10px; color: inherit; text-decoration: none; }
.call-link:last-child { padding-bottom: 18px; }
.call-actions { display: flex; justify-content: flex-end; padding: 0 20px 14px; }
.call-card .tag { white-space: normal; overflow-wrap: anywhere; }
.call-card .job-sub, .kv .jnote { overflow-wrap: anywhere; }
.call-by { color: var(--muted); font-size: 0.88rem; }
