:root {
  --bg: #f3f7f6;
  --surface: #ffffff;
  --surface-soft: #f7fbfa;
  --text: #17312e;
  --muted: #66807c;
  --line: #d9e7e4;
  --primary: #0f766e;
  --primary-dark: #0b5d57;
  --primary-soft: #e4f5f2;
  --success: #16845b;
  --success-soft: #e7f7ef;
  --warning: #b66a0a;
  --warning-soft: #fff3de;
  --danger: #bc3f4a;
  --danger-soft: #ffeaed;
  --shadow: 0 18px 45px rgba(24, 67, 62, 0.09);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 34rem), linear-gradient(180deg, #f8fcfb 0%, var(--bg) 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  line-height: 1.6;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 20px 0 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 2px 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.02em; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; color: #fff; background: linear-gradient(145deg, #0f766e, #20a495); border-radius: 12px; box-shadow: 0 8px 20px rgba(15, 118, 110, 0.22); }
.topbar-link { padding: 9px 14px; color: var(--primary-dark); background: rgba(255, 255, 255, 0.8); border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 700; }
.topbar-link:hover { border-color: #9dcec7; }

.form-layout, .dashboard-layout { display: grid; gap: 18px; }
.hero-card, .dashboard-header { padding: 34px; color: #fff; background: linear-gradient(120deg, rgba(6, 68, 63, 0.95), rgba(15, 118, 110, 0.89)), #0f766e; border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero-card::after, .dashboard-header::after { content: ""; position: absolute; right: -70px; bottom: -110px; width: 290px; height: 290px; border: 48px solid rgba(255, 255, 255, 0.08); border-radius: 50%; }
.eyebrow { margin: 0 0 8px; color: #b9eee7; font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.hero-card h1, .dashboard-header h1 { margin: 0; font-size: clamp(28px, 5vw, 42px); line-height: 1.25; letter-spacing: -0.03em; }
.hero-card > p:not(.eyebrow), .dashboard-header > div > p:not(.eyebrow) { max-width: 720px; margin: 12px 0 0; color: #d7f4f0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero-meta span { padding: 9px 13px; background: rgba(255, 255, 255, 0.11); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 999px; color: #e9fffc; font-size: 14px; }

.card { padding: 26px; background: var(--surface); border: 1px solid rgba(217, 231, 228, 0.75); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.section-heading, .card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-heading { justify-content: flex-start; margin-bottom: 22px; }
.section-heading.compact { margin-top: 30px; }
.step-number { display: grid; flex: 0 0 auto; width: 30px; height: 30px; place-items: center; color: var(--primary-dark); background: var(--primary-soft); border-radius: 10px; font-size: 14px; font-weight: 900; }
.section-heading h2, .card-title-row h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.section-heading p, .card-title-row p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.field-label { display: block; margin-bottom: 8px; color: #38534f; font-size: 14px; font-weight: 800; }
.select-control, .text-control { width: 100%; color: var(--text); background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm); outline: none; transition: border-color 0.18s ease, box-shadow 0.18s ease; }
.select-control { min-height: 50px; padding: 0 42px 0 14px; }
.text-control { padding: 12px 14px; resize: vertical; }
.select-control:focus, .text-control:focus { border-color: #57b5aa; box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1); }
.empty-state { margin-top: 16px; padding: 18px; color: var(--muted); background: var(--surface-soft); border: 1px dashed #cfe2df; border-radius: var(--radius-md); text-align: center; }
.room-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; padding: 16px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-md); }
.room-summary > div { min-width: 0; }
.summary-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 12px; }
.room-summary strong { display: block; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.notice { margin-top: 16px; padding: 13px 15px; border-radius: var(--radius-sm); font-size: 14px; }
.notice-info { color: #1c5b67; background: #e9f7fa; border: 1px solid #c8e9ee; }
.notice-error { color: #8f2f39; background: var(--danger-soft); border: 1px solid #f4cbd0; }

.choice-grid { display: grid; gap: 12px; }
.choice-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-card { display: flex; align-items: center; gap: 12px; min-height: 82px; padding: 15px; cursor: pointer; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-md); transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease; }
.choice-card:hover { transform: translateY(-1px); border-color: #9fcac5; }
.choice-card:has(input:checked) { background: var(--primary-soft); border-color: #54afa4; }
.choice-card input, .member-check input, .reason-option input { accent-color: var(--primary); }
.choice-content { display: flex; min-width: 0; flex-direction: column; }
.choice-content strong { font-size: 16px; }
.choice-content small { color: var(--muted); font-size: 13px; }
.absent-section { margin-top: 28px; }
.member-list { display: grid; gap: 12px; }
.member-row { padding: 16px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-md); transition: border-color 0.18s ease, background 0.18s ease; }
.member-row.is-absent { background: #fffafa; border-color: #efc3c8; }
.member-check { display: flex; align-items: center; gap: 11px; cursor: pointer; font-weight: 800; }
.member-check input { width: 19px; height: 19px; }
.reason-options { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; padding-left: 30px; }
.reason-option { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; cursor: pointer; color: #38534f; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.reason-option:has(input:checked) { color: var(--primary-dark); background: var(--primary-soft); border-color: #79beb5; }
.field-block { margin-top: 26px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 24px; }
.primary-button, .secondary-button { min-height: 46px; padding: 0 20px; cursor: pointer; border-radius: 13px; font-weight: 800; transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease; }
.primary-button { min-width: 180px; color: #fff; background: linear-gradient(145deg, var(--primary), #12968a); border: 0; box-shadow: 0 12px 25px rgba(15, 118, 110, 0.22); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.secondary-button { color: var(--primary-dark); background: #fff; border: 1px solid var(--line); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(420px, calc(100vw - 44px)); padding: 14px 17px; color: #fff; background: #173b37; border-radius: 14px; box-shadow: 0 18px 45px rgba(12, 43, 39, 0.28); font-size: 14px; }

.dashboard-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.date-controls { z-index: 1; display: grid; grid-template-columns: auto minmax(150px, 1fr) auto; align-items: center; gap: 9px; padding: 10px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 16px; }
.date-controls label { color: #dff8f4; font-size: 13px; font-weight: 700; }
.date-controls input { min-height: 42px; padding: 0 10px; border: 0; border-radius: 10px; }
.date-controls .secondary-button { border: 0; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 140px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 12px 35px rgba(24, 67, 62, 0.06); }
.metric-card span, .metric-card small { display: block; color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin: 8px 0 4px; font-size: 32px; line-height: 1.15; }
.metric-card.accent-warning { background: linear-gradient(145deg, #fff, var(--warning-soft)); }
.metric-card.accent-success { background: linear-gradient(145deg, #fff, var(--success-soft)); }
.metric-card.accent-danger { background: linear-gradient(145deg, #fff, var(--danger-soft)); }
.progress-header { display: flex; align-items: center; justify-content: space-between; font-weight: 800; }
.progress-track { height: 10px; margin-top: 10px; overflow: hidden; background: #e8f1ef; border-radius: 999px; }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, #19a493, #53c4a9); border-radius: inherit; transition: width 0.35s ease; }
.muted-text { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 18px; }
.missing-list, .absent-summary-list { display: grid; gap: 9px; margin-top: 16px; }
.missing-item, .absent-summary-item { padding: 12px 13px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.missing-item strong, .absent-summary-item strong { display: block; }
.missing-item span, .absent-summary-item p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.placeholder-text { margin: 0; padding: 18px; color: var(--muted); background: var(--surface-soft); border: 1px dashed #cfe2df; border-radius: var(--radius-sm); text-align: center; }
.table-wrap { margin-top: 18px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); background: var(--surface-soft); font-size: 13px; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
.status-pill, .reason-pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-ok { color: #116444; background: var(--success-soft); }
.status-missing { color: #8c4c02; background: var(--warning-soft); }
.status-absent { color: #94323b; background: var(--danger-soft); }
.reason-pill { margin: 2px 5px 2px 0; color: #3d5855; background: #eef3f2; }
.absent-person { margin-bottom: 7px; }

@media (max-width: 900px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-columns { grid-template-columns: 1fr; }
  .dashboard-header { align-items: stretch; flex-direction: column; }
  .date-controls { align-self: flex-start; }
}

@media (max-width: 640px) {
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 10px; }
  .topbar { padding-bottom: 14px; }
  .brand { font-size: 14px; }
  .topbar-link { padding: 8px 11px; font-size: 13px; }
  .hero-card, .dashboard-header, .card { padding: 20px; border-radius: 19px; }
  .hero-card h1, .dashboard-header h1 { font-size: 29px; }
  .room-summary, .choice-grid-two, .metrics-grid { grid-template-columns: 1fr; }
  .choice-card { min-height: 74px; }
  .reason-options { padding-left: 0; }
  .form-actions { justify-content: stretch; }
  .primary-button { width: 100%; }
  .date-controls { width: 100%; grid-template-columns: 1fr; }
  .date-controls input, .date-controls button { width: 100%; }
  .toast { right: 10px; bottom: 10px; max-width: calc(100vw - 20px); }
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 36, 33, 0.72);
  backdrop-filter: blur(8px);
}

.auth-card {
  width: min(420px, 100%);
  padding: 26px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(7, 28, 25, 0.28);
}

.auth-card h2 {
  margin: 0;
  font-size: 24px;
}

.auth-card > p:not(.eyebrow) {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.auth-submit {
  width: 100%;
  margin-top: 20px;
}
