:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #fff;
  --text: #20242b;
  --muted: #69717c;
  --line: #e5e7eb;
  --accent: #315fce;
  --accent-soft: #eef3ff;
  --red: #aa3945;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; padding: 12px; background: white; color: var(--accent); }
.skip-link:focus { top: 12px; }
.app-shell { width: min(1440px, calc(100% - 64px)); margin: auto; }
.topbar, .brand-block, .top-actions, .month-heading, .month-navigation, .month-switcher, .summary-heading, .toolbar-heading, .filter-row, .toolbar-actions, .toolbar-caption, .member-card-head, .member-meta, .day-title, .dialog-head, .dialog-actions { display: flex; align-items: center; }
.topbar { min-height: 84px; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.brand-block { gap: 12px; }
.brand-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--text); color: white; font-size: 13px; font-weight: 700; }
.eyebrow { font-size: 10px; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
h1 { font-size: 17px; font-weight: 650; letter-spacing: -.4px; }
h2 { font-size: 28px; line-height: 1.25; font-weight: 650; letter-spacing: -1px; }
h3 { font-size: 14px; font-weight: 650; }
.top-actions { gap: 18px; }
.save-status { color: var(--muted); font-size: 12px; }
.save-status::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; background: #398363; vertical-align: 1px; }
.save-status.save-error { color: var(--red); }
.save-status.save-error::before { background: var(--red); }
.btn, .icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: white; padding: 7px 12px; font-size: 12px; font-weight: 550; transition: background .15s, border-color .15s; }
.btn:hover, .icon-btn:hover { background: #f0f1f3; border-color: #cdd1d7; }
.btn-primary { color: white; background: var(--text); border-color: var(--text); }
.btn-primary:hover { background: #383f49; border-color: #383f49; }
.btn-ghost, .btn-text { background: transparent; }
.btn-text { border-color: transparent; color: var(--accent); }
.btn-danger-soft, .delete-member { color: var(--red); background: #fff; border-color: #ecd6d9; }
.btn-danger-soft:hover, .delete-member:hover { background: #fff1f2; }
.btn[aria-pressed="true"] { color: var(--accent); border-color: #c7d5f5; background: var(--accent-soft); }
.icon-btn { width: 34px; padding: 0; font-size: 22px; flex: 0 0 34px; }
main { padding-top: 28px; }
.month-heading { justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.month-heading p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.month-navigation { gap: 10px; }
.month-switcher { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.month-switcher .icon-btn { border: 0; min-height: 32px; }
.month-field { min-width: 0; }
.month-field input { width: 190px; min-width: 0; padding: 5px 7px; border: 0; border-radius: 4px; background: transparent; color: var(--text); font-size: 13px; font-weight: 550; }
.summary-heading { justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.summary-heading h3 { font-size: 12px; color: #515a67; }
.summary-heading > span { color: var(--muted); font-size: 11px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 24px; }
.summary-card { min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; transition: border-color .15s, background .15s; }
.summary-card:hover { border-color: #adb8cb; background: #fdfdff; }
.summary-card[aria-pressed="true"] { border-color: var(--accent); background: #f8faff; box-shadow: inset 0 0 0 1px var(--accent); }
.member-meta { gap: 9px; min-width: 0; }
.member-meta > div:last-child { min-width: 0; }
.avatar { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border: 1px solid #e7e9ed; border-radius: 50%; background: #f4f5f7; color: #596272; font-size: 10px; font-weight: 650; }
.member-meta strong { display: block; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.member-meta small { display: block; color: var(--muted); font-size: 10px; margin-top: 1px; }
.summary-number { margin-top: 10px; font-size: 26px; font-weight: 650; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.summary-number > span { color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.summary-number > small { float: right; margin-top: 14px; color: var(--muted); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.progress-track { height: 3px; margin-top: 6px; border-radius: 3px; background: #eff0f3; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: #7594dc; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.mini-chip { color: var(--muted); font-size: 10px; }
.mini-chip + .mini-chip { border-left: 1px solid var(--line); padding-left: 12px; }
.toolbar-card { margin-bottom: 14px; padding: 14px 0 0; border-top: 1px solid var(--line); }
.toolbar-heading { justify-content: space-between; gap: 12px; }
.filter-row { gap: 8px; min-width: 0; flex-wrap: wrap; }
.filter-field { min-width: 0; }
.filter-field select { max-width: 240px; min-height: 36px; padding: 6px 28px 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--text); font-size: 12px; }
.toolbar-actions { gap: 8px; flex-shrink: 0; }
.toolbar-caption { align-items: baseline; justify-content: space-between; gap: 16px; margin-top: 10px; }
.view-status { color: var(--muted); font-size: 11px; }
.status-guide { max-width: 520px; font-size: 11px; color: var(--muted); text-align: right; }
.status-guide summary { text-decoration: underline; text-underline-offset: 3px; }
.status-guide p { text-align: left; line-height: 1.8; padding: 10px 0; }
.status-guide strong { color: #47505d; font-weight: 500; }
.data-menu { position: relative; }
.data-menu summary { list-style: none; }
.data-menu summary::-webkit-details-marker { display: none; }
.data-menu-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; display: grid; gap: 3px; width: 236px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 10px 30px #18213314; }
.data-menu-panel .btn { justify-content: flex-start; border-color: transparent; }
.data-menu-panel .btn-danger-soft { border-top-color: var(--line); border-radius: 0 0 5px 5px; margin-top: 4px; }
.attendance-stack { display: grid; gap: 18px; scroll-margin-top: 16px; }
.member-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: white; scroll-margin-top: 16px; }
.member-card-head { justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.member-meta h3 { overflow-wrap: anywhere; }
.member-card-total { text-align: right; flex-shrink: 0; }
.member-card-total strong { display: block; font-size: 12px; font-weight: 550; font-variant-numeric: tabular-nums; }
.member-card-total small { display: block; color: var(--muted); font-size: 10px; }
.days-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 7px; align-items: start; }
.day-card { min-width: 0; padding: 7px; border: 1px solid #eceef1; border-radius: 7px; background: #fcfcfd; }
.day-card.today { border-color: #93ade9; background: #f6f8ff; }
.day-title { justify-content: space-between; gap: 3px; margin-bottom: 5px; }
.day-title > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 5px; }
.day-title strong { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.day-title span { font-size: 10px; color: var(--muted); }
.today-label { color: var(--accent); font-weight: 550; }
.note-toggle { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 14px; }
.note-toggle:hover { background: #eceff4; }
.note-toggle.has-note, .note-toggle[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
.day-periods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.status-line { display: grid; gap: 3px; min-width: 0; }
.status-line label { font-size: 10px; color: var(--muted); text-align: center; }
.status-button { width: 100%; min-width: 0; height: 36px; padding: 3px; border: 1px solid #e6e8ed; border-radius: 5px; background: white; color: #737b87; font-size: 11px; line-height: 1.25; transition: background .12s, border-color .12s; }
.status-button:hover { border-color: #9ea8b9; }
.status-button:active { filter: brightness(.95); }
.status-button[data-status="work"] { color: #2957bd; border-color: #d7e2fb; background: #edf3ff; }
.status-button[data-status="leave"] { color: #397152; border-color: #dcebe1; background: #eff7f1; }
.status-button[data-status="absent"] { color: #a23a46; border-color: #f0dce0; background: #fcf0f2; }
.note-wrap { display: none; margin-top: 6px; }
.notes-open .note-wrap { display: block; }
.note-wrap textarea { display: block; width: 100%; min-height: 62px; resize: vertical; padding: 7px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--text); font-size: 12px; }
.empty-state { grid-column: 1 / -1; padding: 24px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; font-size: 13px; }
footer { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
footer span > span { padding: 0 7px; color: #c3c7cf; }
.dialog { width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--text); box-shadow: 0 24px 80px #17202f26; }
.dialog::backdrop { background: #10182855; }
.dialog-card { padding: 24px; }
.dialog-head { justify-content: space-between; gap: 12px; }
.dialog-head h3 { font-size: 20px; }
.section-kicker { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.members-list { display: grid; gap: 8px; margin: 22px 0 16px; }
.member-edit-row, .add-member-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.member-edit-row input, .add-member-row input { min-width: 0; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: white; }
.delete-member { padding: 6px 12px; border: 1px solid #ecd6d9; border-radius: 7px; font-size: 12px; }
.dialog-note { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.dialog-actions { justify-content: flex-end; margin-top: 20px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(380px, calc(100% - 32px)); padding: 12px 16px; border-radius: 8px; background: #252b35; color: white; font-size: 13px; box-shadow: 0 8px 24px #0002; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .15s, transform .15s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #922f3c; }
@media (max-width: 1000px) {
  .app-shell { width: calc(100% - 40px); }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar-heading { flex-wrap: wrap; }
  .toolbar-actions { margin-left: auto; }
}
@media (max-width: 640px) {
  .app-shell { width: calc(100% - 24px); }
  .topbar { min-height: 72px; gap: 10px; }
  .brand-block { gap: 8px; }
  .brand-icon { width: 30px; height: 30px; border-radius: 8px; }
  .top-actions { flex-direction: column-reverse; align-items: flex-end; gap: 4px; max-width: 52%; }
  .save-status { font-size: 10px; text-align: right; }
  .save-status::before { width: 5px; height: 5px; margin-right: 4px; }
  .btn { min-height: 40px; }
  .top-actions .btn { min-height: 32px; }
  main { padding-top: 20px; }
  h2 { font-size: 24px; }
  .month-heading { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
  .month-navigation { width: 100%; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
  .month-switcher { flex: 1 1 250px; }
  .month-field { flex: 1; }
  .month-field input { width: 100%; font-size: 14px; }
  .month-switcher .icon-btn { min-height: 36px; }
  .summary-grid { gap: 8px; margin-bottom: 18px; }
  .summary-card { padding: 11px; border-radius: 8px; }
  .summary-card .avatar { display: none; }
  .summary-number { font-size: 23px; }
  .summary-number > small { float: none; display: block; margin-top: 0; font-size: 10px; }
  .mini-stats { gap: 6px; }
  .mini-chip + .mini-chip { padding-left: 6px; }
  .summary-heading > span { font-size: 10px; }
  .filter-row { width: 100%; }
  .filter-field { flex: 1 1 40%; }
  .filter-field select { width: 100%; max-width: none; min-height: 40px; font-size: 13px; }
  .toolbar-actions { width: 100%; justify-content: flex-end; }
  .toolbar-caption { gap: 8px; }
  .status-guide { max-width: 55%; }
  .data-menu-panel { max-width: calc(100vw - 24px); }
  .member-card { padding: 10px; }
  .member-card-head { gap: 8px; }
  .member-meta h3 { font-size: 12px; }
  .member-card-head .avatar { width: 26px; height: 26px; flex-basis: 26px; font-size: 9px; }
  .member-card-total strong { font-size: 11px; }
  .days-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .day-card { padding: 6px; }
  .status-button { height: 44px; }
  .note-toggle { width: 32px; height: 32px; flex-basis: 32px; }
  .day-title > div { column-gap: 4px; }
  .note-wrap textarea, .member-edit-row input, .add-member-row input { font-size: 16px; }
  footer { flex-direction: column; gap: 4px; font-size: 10px; }
  .dialog-card { padding: 18px; }
  .add-member-row { grid-template-columns: 1fr; }
  .toast { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
