:root {
  color-scheme: light;
  --ink: #18362f;
  --muted: #526861;
  --line: #d7e4df;
  --canvas: #f2f7f4;
  --accent: #006d59;
  --deep: #113a30;
  --danger: #a13528;
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid #16856d;
  outline-offset: 3px;
}
.bar { background: var(--deep); color: #fff; }
.bar-inner { width: min(1180px, 100% - 48px); display: flex; align-items: center; gap: 26px; margin: 0 auto; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; line-height: 1.2; white-space: nowrap; }
.brand small { display: block; color: #c6e4d8; margin-top: 4px; font-size: 11px; font-weight: 520; }
.mark { display: grid; place-items: center; width: 38px; height: 38px; background: #ccebdc; color: #13513e; border-radius: 9px; }
.work-nav {
  position: fixed;
  inset: auto 0 0;
  z-index: 3;
  display: flex;
  gap: 4px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 6px max(10px, env(safe-area-inset-right), calc((100% - 960px) / 2))
    calc(6px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left), calc((100% - 960px) / 2));
}
.work-nav a { flex: 1; display: flex; justify-content: center; align-items: center; gap: 3px; min-height: 44px; padding: 4px 2px; border-radius: 7px; white-space: nowrap; font-size: .83rem; font-weight: 650; }
.work-nav a:hover, .work-nav a[aria-current] { background: #e4f1ea; color: var(--accent); }
.nav-unread { border-radius: 8px; padding: 0 4px; color: #fff; background: var(--accent); font-size: .72rem; }
body:has(.work-nav) .layout { margin-bottom: calc(76px + env(safe-area-inset-bottom)); }
.account summary { padding: 8px 10px; border-radius: 7px; font-size: .88rem; min-height: 38px; }
.account summary:hover { background: #235748; }
.demo-badge { padding: 2px 7px; border-radius: 6px; background: #235748; color: #e0eee7; font-size: .72rem; }
.account { margin-left: auto; position: relative; }
.account summary { cursor: pointer; }
.account summary span { color: #c6e4d8; font-size: .78rem; }
.account-menu { position: absolute; z-index: 2; top: 100%; right: 0; min-width: 140px; padding: 8px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 22px #123b301a; }
.account-menu a, .account-menu button { display: block; width: 100%; text-align: left; padding: 7px; border: 0; background: none; cursor: pointer; color: var(--ink); }
.account-menu a:hover, .account-menu button:hover { background: var(--canvas); }
.layout { width: min(1180px, 100% - 48px); margin: 32px auto 64px; }
.login-layout { margin-top: clamp(32px, 9vh, 105px); }
.login-card { max-width: 410px; margin: 0 auto; padding: 32px; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1.12rem; margin-bottom: 12px; }
h3 { font-size: .96rem; margin-block: 14px 4px; }
.eyebrow { font-size: .78rem; color: var(--accent); margin-bottom: 5px; font-weight: 720; letter-spacing: .055em; }
.muted { color: var(--muted); margin-top: 7px; font-size: .92rem; }
.page-head { margin: 15px 0 21px; display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.panel { background: white; border: 1px solid var(--line); border-radius: 13px; min-width: 0; }
.pad { padding: 20px; }
.stack { display: grid; gap: 13px; min-width: 0; }
.login-card .stack { margin-top: 22px; }
.form-panel { max-width: 750px; padding: 22px; }
.form-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.completion-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.completion-picker legend { padding: 0; margin-bottom: .3rem; font-size: .88rem; font-weight: 650; }
.completion-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: .5rem .7rem; }
.completion-values { display: flex; gap: .85rem; align-items: center; }
.completion-values label { display: inline-flex; gap: .35rem; align-items: center; white-space: nowrap; }
.completion-values select { width: 4rem; min-height: 44px; margin-top: 0; padding-inline: .55rem; }
.completion-values select:disabled { color: var(--muted); background: #f0f5f2; }
.completion-preview { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; gap: .15rem .65rem; padding: .5rem .65rem; background: #eaf4ef; border-radius: 7px; font-size: .88rem; }
.completion-preview output { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 350px) {
  .completion-row { grid-template-columns: minmax(0, 1fr); }
}
label { display: block; min-width: 0; font-size: .88rem; font-weight: 650; }
label small { display: block; color: var(--muted); margin-top: 4px; font-weight: 450; }
input:not([type=hidden]), select, textarea {
  display: block; width: 100%; min-width: 0; margin-top: 4px; padding: 9px 10px; color: var(--ink);
  background: #fbfdfc; border: 1px solid #b9cdc4; border-radius: 7px; font-size: 1rem; min-height: 43px;
}
textarea { resize: vertical; }
.button { display: inline-flex; justify-content: center; align-items: center; width: fit-content; min-height: 42px; padding: 7px 13px; border: 1px solid #a5c4b8; background: #fff; color: var(--ink); border-radius: 8px; cursor: pointer; font-weight: 650; font-size: .88rem; }
.button:hover { background: #eaf5ef; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.primary:hover { background: #005846; }
.caution { color: var(--danger); border-color: #cb8e82; }
.login-card .button { width: 100%; }
.back { display: inline-block; color: var(--accent); font-size: .87rem; font-weight: 620; padding-block: 4px; }
.flash { padding: 10px 12px; margin: 0 0 12px; background: #e1f3e8; border: 1px solid #bedccc; border-radius: 8px; }
.flash.error, .errorlist { color: var(--danger); background: #fff0eb; overflow-wrap: anywhere; }
.errorlist { padding: 7px 10px 7px 24px; margin: 3px 0; border-radius: 6px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.metrics a { background: #e4f1ea; border: 1px solid var(--line); padding: 12px 16px; border-radius: 10px; }
.metrics a:hover { background: #d8ede3; }
.metrics span, .metrics strong { display: block; }
.metrics span { font-size: .84rem; color: var(--muted); }
.metrics strong { font-size: 1.55rem; }
.danger { color: var(--danger); }
.filters { display: flex; align-items: end; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.filters label:first-child { flex: 1; }
.ticket-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(80px,.22fr) minmax(138px,.28fr); align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 12px 15px; }
.ticket-row:hover { background: #f0f9f4; }
.ticket-row:last-child { border-bottom: 0; }
.row-main, .row-status { display: grid; justify-items: start; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.row-main small, .row-main span, .row-time { color: var(--muted); font-size: .8rem; }
.badge, .unread { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #deefe7; color: #125441; white-space: nowrap; font-size: .78rem; font-weight: 650; }
.badge.triage, .badge.dispatch, .badge.review { background: #fff0d5; color: #79511b; }
.badge.canceled { background: #ebeeed; color: #485652; }
.empty { padding: 30px 14px; color: var(--muted); text-align: center; }
.pagination { display: flex; justify-content: center; gap: 16px; padding: 15px; }
.pagination a { color: var(--accent); text-decoration: underline; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); align-items: start; gap: 14px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .78rem; }
.facts dd { margin: 1px 0 0; overflow-wrap: anywhere; }
.actions details { border-top: 1px solid var(--line); }
.actions summary { cursor: pointer; padding: 9px 0; font-weight: 620; min-height: 42px; }
.actions form { padding: 4px 0 14px; }
.extension { background: #fff0d5; margin-bottom: 10px; padding: 8px; border-radius: 8px; overflow-wrap: anywhere; }
.history article { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.history time { color: var(--muted); font-size: .78rem; }
.multiline { white-space: pre-wrap; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.photos a { display: grid; justify-items: center; }
.photos img { width: 110px; height: 88px; object-fit: cover; border-radius: 6px; }
.notice-row:not(:last-child) { border-bottom: 1px solid var(--line); }
.notice { width: 100%; border: 0; display: flex; justify-content: space-between; padding: 12px; gap: 10px; text-align: left; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: center; font-size: .85rem; }
td:first-child, th:first-child { text-align: left; }
@media (max-width: 640px) {
  .bar-inner, .layout { width: calc(100% - 24px); }
  .bar-inner { flex-wrap: wrap; gap: 4px 10px; padding: 9px 0; min-height: 62px; }
  .account summary span { display: none; }
  .layout { margin-top: 20px; }
  .login-layout { margin-top: 32px; }
  .login-card, .pad, .form-panel { padding: 15px; }
  .page-head { align-items: start; }
  .page-head .button { flex-shrink: 0; }
  .metrics { gap: 4px; }
  .metrics a { padding: 6px 2px; text-align: center; }
  .metrics a span { font-size: .72rem; }
  .filters { flex-wrap: wrap; gap: 6px; padding: 9px; }
  .filters label:first-child { flex-basis: 100%; }
  .filters label:nth-child(2) { flex: 1; }
  .ticket-row { grid-template-columns: minmax(0,1fr) auto; padding: 10px; }
  .row-time { grid-column: 1/-1; }
  .form-grid, .detail-layout { grid-template-columns: minmax(0,1fr); }
  .detail-layout { display: flex; flex-direction: column; }
  .detail-layout > * { width: 100%; }
  .actions { order: -1; }
  .actions form .button, .form-panel .stack > .button { width: 100%; min-height: 46px; }
}

.edit-link { margin: 0 0 10px; }

.address-status:empty { display: none; }

label[hidden] { display: none; }

.staffing-dialog {
  width: min(28rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  margin: auto;
  padding: 1.15rem 1.15rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(16, 40, 32, .2);
}
.staffing-dialog::backdrop { background: rgba(17, 58, 48, .45); }
.staffing-dialog h2 { margin: 0 0 .75rem; font-size: 1.08rem; }
.staffing-dialog p { margin: 0 0 .55rem; line-height: 1.55; overflow-wrap: anywhere; }
.staffing-dialog .button { width: 100%; margin-top: .45rem; min-height: 44px; }
.actions select:disabled { opacity: 1; color: var(--ink); background: #eef3f0; }

.due-soon { color: #8a5a12; }
.badge.overdue { background: #fff0eb; color: var(--danger); }
.badge.approaching { background: #fff4de; color: #8a5a12; }
.due-alerts { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); }
.due-alerts h2 { margin: 0 0 4px; font-size: .95rem; }
.due-alerts ul { list-style: none; margin: 8px 0 0; padding: 0; }
.due-alerts li { margin: 0; }
.due-alerts a { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; overflow-wrap: anywhere; }
.photos .photo-open { display: grid; justify-items: center; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.photo-dialog {
  width: min(40rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  margin: auto;
  padding: .8rem .8rem calc(.8rem + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #111;
  color: #fff;
  box-shadow: 0 16px 40px rgba(16, 40, 32, .3);
}
.photo-dialog::backdrop { background: rgba(10, 20, 16, .72); }
.photo-dialog img { display: block; width: 100%; max-height: calc(100dvh - 6.5rem); object-fit: contain; background: #000; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.photo-dialog .button { width: 100%; margin-top: .7rem; min-height: 44px; }

@media (max-width: 640px) {
  .brand, .account summary, .account-menu :is(a, button), .actions summary,
  .layout :is(button, select, input:not([type=hidden]), textarea),
  .layout .button, .layout .back, .pagination a, .due-alerts a, .page-head > a {
    min-height: 44px;
    min-width: 44px;
  }
  .layout .back, .page-head > a, .pagination a { display: inline-flex; align-items: center; }
  .account { max-width: 100%; min-width: 0; }
  .account summary, .history strong, .multiline { white-space: normal; overflow-wrap: anywhere; }
  .brand small, .eyebrow, .account summary span, .row-main small, .row-main span, .row-time,
  .badge, .unread, .facts dt, .history time, .metrics span, label small, .layout small, .layout .back { font-size: .875rem; }
}

  display: flex; align-items: center; gap: .4rem; min-height: 44px; height: 100%;
  box-sizing: border-box; padding: .4rem .55rem; border: 1px solid var(--line); border-radius: .55rem;
}
.deadline-options label:has(:checked), .location-options label:has(:checked) { background: #e3f3ed; border-color: #087368; }
.deadline-options input, .location-options input { width: auto; min-height: auto; flex: none; }
@media (min-width: 560px) {
  .deadline-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.report-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.monthly-scroll { overflow-x: auto; }
.monthly-table { width: 100%; border-collapse: collapse; }
.monthly-table th, .monthly-table td { text-align: left; border-bottom: 1px solid #d2ded8; padding: .75rem; white-space: nowrap; }

.binding-panel { max-width: 38rem; padding: clamp(18px, 4vw, 28px); }
.binding-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.binding-actions .button { min-height: 44px; }

.setup-steps{display:flex;flex-wrap:wrap;gap:8px 22px;margin:12px 0 24px;padding-left:22px;color:var(--muted)}
.setup-steps [aria-current="step"]{font-weight:700;color:var(--ink)}
.setup-qr{display:block;max-width:100%;height:auto;margin:12px 0}
.setup-panel .binding-actions .button{min-height:44px}

.reminder-summary-state { margin-inline-start: .2rem; color: var(--muted); font-size: .82rem; font-weight: 500; }
.reminder-record { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .4rem .6rem; margin: 0 0 .8rem; font-size: .88rem; }
.reminder-record dt { color: var(--muted); }
.reminder-record dd { margin: 0; overflow-wrap: anywhere; }
.reminder-button:disabled { background: #e7ecea; color: #455c54; border-color: #c7d2ce; cursor: not-allowed; }
