:root {
  color-scheme: light;
  --bg: #fffbe8;
  --surface: #ffffff;
  --surface-soft: #fff2d8;
  --ink: #273326;
  --muted: #6f745d;
  --line: #e8dfbd;
  --accent: #43a85f;
  --accent-strong: #286b3a;
  --amber: #ee9a2b;
  --rose: #d95763;
  --teal-light: #dff5d6;
  --sky-soft: #fff0d3;
  --sun-soft: #fff2d8;
  --shadow: 0 16px 36px rgba(111, 92, 38, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Yu Gothic UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

body.is-authenticated .login-screen {
  display: none;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 251, 232, 0.88), rgba(255, 242, 216, 0.92)),
    var(--bg);
}

.login-card {
  display: grid;
  gap: 20px;
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

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

.login-brand .brand-mark {
  background: #1f4f32;
}

.login-brand h1,
.login-brand p {
  margin: 0;
}

.login-brand h1 {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
}

.login-brand p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
}

.login-form span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-form input,
.login-form select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.login-error {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffe8eb;
  color: #a93b48;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.login-error.is-visible {
  display: block;
}

.login-hint {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: #fff7e6;
  color: var(--muted);
  font-size: 13px;
}

.login-hint strong {
  color: var(--accent-strong);
}

.signature-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(31, 79, 50, 0.38);
}

.signature-modal.is-visible {
  display: grid;
}

.signature-dialog {
  display: grid;
  gap: 14px;
  width: min(760px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.signature-lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

#signatureCanvas {
  display: block;
  width: 100%;
  height: min(260px, 42vh);
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #ffffff;
  touch-action: none;
}

.signature-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px 12px;
  background: #1f4f32;
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 800;
}

.brand-title,
.brand-subtitle,
.sidebar-footer p,
.metric p,
.metric span,
.topbar p,
.section-head span {
  margin: 0;
}

.brand-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
}

.brand-subtitle,
.sidebar-footer p {
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  line-height: 1.35;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.role-switch {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.role-switch span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.role-switch select {
  width: 100%;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.role-switch select:disabled {
  opacity: 1;
  cursor: default;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
}

.nav-item.is-active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer strong {
  display: block;
  margin-top: 6px;
  font-size: 14px;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.2;
}

.topbar p {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.main {
  transition: background-color 180ms ease;
}

body.is-user-refreshing .main {
  background: rgba(255, 242, 216, 0.7);
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.primary-button {
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button.full {
  width: 100%;
}

.secondary-button {
  padding: 0 16px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.ghost-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #fffef8;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.ghost-button:hover {
  background: #fff4dd;
}

.compact-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--accent-strong);
  font-weight: 800;
}

.control-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

body.user-mode .staff-only {
  display: none !important;
}

body:not(.user-mode) .user-only {
  display: none !important;
}

body.user-mode .control-strip .field:first-child {
  pointer-events: none;
  opacity: 0.72;
}

body.gate-required .nav-item {
  pointer-events: none;
  opacity: 0.45;
}

.mode-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
}

.mode-banner strong {
  color: var(--accent-strong);
}

.mode-banner span {
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.field span,
.entry-form span,
.checkin-form span,
.profile-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field select,
.entry-form input,
.entry-form select,
.entry-form textarea,
.checkin-form input,
.checkin-form select,
.checkin-form textarea,
.profile-form input,
.profile-form select,
.profile-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.field select {
  min-height: 40px;
  padding: 0 12px;
}

.daily-report-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #fff2d8;
  box-shadow: var(--shadow);
}

.daily-report-cta p,
.daily-report-cta strong {
  margin: 0;
}

.daily-report-cta p {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.daily-report-cta strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  line-height: 1.5;
}

.schedule-cta {
  background: #fff7e6;
}

.checkout-cta {
  background: #f1fbea;
}

.report-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.report-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.report-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: #fff7e6;
  color: #966015;
  font-size: 13px;
  font-weight: 900;
}

.report-status.is-complete {
  background: var(--teal-light);
  color: var(--accent-strong);
}

.status-pill {
  margin-left: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--teal-light);
  color: var(--accent-strong);
  font-weight: 800;
}

.status-pill.is-warning {
  background: #fff7e8;
  color: #9a5b12;
}

.status-pill.is-danger {
  background: #ffe8eb;
  color: #a93b48;
}

.panel {
  display: none;
}

.panel.is-visible {
  display: block;
}

.panel.is-panel-refreshing {
  animation: panelRefresh 420ms ease;
}

@keyframes panelRefresh {
  from {
    opacity: 0.2;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notice-box {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.5;
}

.notice-box strong {
  color: var(--accent-strong);
}

.profile-form {
  display: grid;
  gap: 14px;
}

.daily-report-form {
  display: grid;
  gap: 14px;
}

.daily-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-section {
  display: grid;
  gap: 12px;
}

.report-section h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 17px;
}

.report-section label {
  display: grid;
  gap: 6px;
}

.report-section span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.report-section input,
.report-section textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.report-section input {
  min-height: 40px;
  padding: 0 10px;
}

.report-section textarea {
  padding: 10px;
  resize: vertical;
  line-height: 1.7;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-section h3 {
  margin: 0 0 14px;
  font-size: 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.profile-form input,
.profile-form select {
  min-height: 40px;
  padding: 0 10px;
}

.profile-form textarea {
  min-height: 96px;
  padding: 10px;
  line-height: 1.6;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.attendance-layout,
.checkin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(360px, 1fr);
  gap: 14px;
  align-items: start;
}

.attendance-intro,
.checkin-intro {
  display: grid;
  gap: 14px;
}

.attendance-intro p,
.checkin-intro p {
  margin: 0;
  color: var(--ink);
  line-height: 1.8;
}

.attendance-actions {
  display: grid;
  gap: 12px;
}

.attendance-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
  color: var(--ink);
  text-align: left;
}

.attendance-card:hover {
  border-color: var(--accent);
  background: #fff2d8;
}

.attendance-card strong {
  color: var(--accent-strong);
  font-size: 20px;
}

.attendance-card span {
  color: var(--muted);
  line-height: 1.6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric,
.workspace {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 14px;
}

.content-grid.lower {
  margin-top: 14px;
}

.workspace {
  min-width: 0;
  padding: 16px;
}

.workspace.compact {
  align-self: start;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

.schedule-head {
  align-items: flex-start;
  flex-wrap: wrap;
}

.schedule-title-block {
  display: grid;
  gap: 8px;
}

.schedule-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.schedule-caption {
  color: var(--accent-strong) !important;
  font-size: 24px !important;
  font-weight: 900;
  line-height: 1.1;
}

.schedule-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.schedule-total-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.schedule-total-pill strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.schedule-total-pill.office {
  background: #dff5d6;
  border-color: #acd99d;
  color: var(--accent-strong);
}

.schedule-total-pill.remote {
  background: #dff0ff;
  border-color: #9ec5e8;
  color: #2d5f8f;
}

.schedule-total-pill.active {
  background: #fff2d8;
  border-color: #efc47b;
  color: #966015;
}

.schedule-month-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.chart-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2.6 / 1;
  min-height: 280px;
}

.chart-wrap.small {
  aspect-ratio: 1.38 / 1;
  min-height: 260px;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.timeline {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
}

.timeline-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.timeline-main {
  min-width: 0;
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.tag.warn {
  background: #fff7e8;
  color: #9a5b12;
}

.tag.danger {
  background: #ffe8eb;
  color: #a93b48;
}

.timeline-memo {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.entry-form,
.checkin-form {
  display: grid;
  gap: 13px;
}

.entry-form.is-hidden {
  display: none;
}

.today-checkin-summary {
  display: none;
}

.today-checkin-summary.is-visible {
  display: grid;
  gap: 12px;
}

.today-summary-score {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.today-summary-score div {
  padding: 14px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #fff2d8;
}

.today-summary-score span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.today-summary-score strong {
  display: block;
  margin-top: 6px;
  color: var(--accent-strong);
  font-size: 26px;
  line-height: 1;
}

.checkin-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #fffef8;
}

.entry-form label,
.checkin-form label {
  display: grid;
  gap: 6px;
}

.score-field {
  position: relative;
  padding: 14px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #fff7e6;
}

.score-field strong {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 2px 0 4px;
  border-radius: 8px;
  background: var(--teal-light);
  color: var(--accent-strong);
  font-size: 28px;
  line-height: 1;
}

.score-field input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.sleep-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #fffaf0;
}

.checkin-form .sleep-fields {
  grid-column: 1 / -1;
}

.sleep-fields label {
  display: grid;
  gap: 6px;
}

.sleep-result {
  grid-column: 1 / -1;
  padding: 12px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 900;
  text-align: center;
}

.daily-status-list,
.daily-reports-list {
  display: grid;
  gap: 12px;
}

.daily-status-item,
.daily-report-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
}

.daily-status-head,
.summary-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.daily-status-head strong {
  font-size: 18px;
}

.daily-status-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(260px, 0.82fr) minmax(420px, 1.35fr);
  gap: 12px;
}

.daily-status-grid section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.daily-status-grid h3 {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 15px;
}

.daily-memo,
.empty-text,
.report-reference {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.report-reference {
  padding-left: 18px;
}

.report-summary {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
}

.report-summary dt {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.report-summary dd {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.support-note-section textarea {
  width: 100%;
  min-height: 150px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  line-height: 1.7;
}

.support-note-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.support-note-section span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.support-note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.support-note-actions .support-note-counter {
  margin-top: 0;
  text-align: left;
}

.attendance-editor {
  display: grid;
  gap: 10px;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.attendance-editor span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.attendance-editor select,
.attendance-editor input,
.attendance-editor textarea {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.attendance-editor textarea {
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.6;
}

.signature-preview {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
}

.signature-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.signature-preview img {
  display: block;
  max-width: 100%;
  height: 72px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.staff-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  align-items: start;
}

.settings-layout {
  display: grid;
  gap: 12px;
}

.settings-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 16px;
  color: var(--accent-strong);
  list-style: none;
  cursor: pointer;
}

.settings-group summary::-webkit-details-marker {
  display: none;
}

.settings-group summary::after {
  content: "開く";
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--teal-light);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.settings-group[open] summary::after {
  content: "閉じる";
  background: #fff2d8;
  color: #966015;
}

.settings-group summary span {
  font-size: 17px;
  font-weight: 900;
}

.settings-group summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-group .workspace {
  margin: 0 12px 12px;
  box-shadow: none;
}

.staff-form {
  display: grid;
  gap: 14px;
}

.staff-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.staff-form input,
.staff-form select,
.staff-form textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.staff-list {
  display: grid;
  gap: 10px;
}

.staff-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
}

.staff-card.is-active {
  border-color: #acd99d;
  background: #f1fbea;
}

.staff-card div {
  display: grid;
  gap: 4px;
}

.staff-card strong {
  color: var(--accent-strong);
}

.staff-card span,
.staff-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.id-management-grid {
  display: grid;
  gap: 12px;
}

.id-management-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
}

.id-management-card h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 15px;
}

.id-management-card > strong {
  font-size: 24px;
  line-height: 1;
}

.id-management-card > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.id-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #ffffff;
}

.id-row + .id-row {
  margin-top: 8px;
}

.id-row strong {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.id-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.schedule-user-area,
.schedule-staff-area {
  display: none;
}

.schedule-user-area.is-visible,
.schedule-staff-area.is-visible {
  display: grid;
  gap: 14px;
}

.schedule-guidance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #fffaf0;
}

.schedule-guidance p,
.schedule-guidance strong {
  margin: 0;
}

.schedule-guidance p {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.schedule-guidance strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  line-height: 1.5;
}

.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.schedule-legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.schedule-legend span,
.matrix-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.plan-dot {
  width: 12px;
  height: 12px;
  border: 1px solid transparent;
  border-radius: 50%;
}

.plan-dot.office {
  background: #dff5d6;
  border-color: #9fcf96;
}

.plan-dot.remote {
  background: #dff0ff;
  border-color: #94bee5;
}

.plan-dot.off {
  background: #ffe8eb;
  border-color: #efa0a8;
}

.plan-dot.unset {
  background: #eef1ec;
  border-color: #cbd4c8;
}

.schedule-planner {
  display: grid;
  grid-template-columns: repeat(7, minmax(88px, 1fr));
  gap: 10px;
}

.schedule-day {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.schedule-date-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.schedule-date-row span {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.schedule-date-row small {
  color: var(--muted);
  font-weight: 800;
}

.schedule-choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.schedule-choice {
  display: grid;
  place-items: center;
  min-height: 30px;
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}

.schedule-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.schedule-choice span {
  display: block;
  line-height: 1.2;
}

.schedule-choice.is-active[data-plan-choice="office"],
.plan-cell.office {
  background: #dff5d6;
  color: var(--accent-strong);
  border-color: #acd99d;
}

.schedule-choice.is-active[data-plan-choice="remote"],
.plan-cell.remote {
  background: #dff0ff;
  color: #2d5f8f;
  border-color: #9ec5e8;
}

.schedule-choice.is-active[data-plan-choice="off"],
.plan-cell.off {
  background: #ffe8eb;
  color: #a93b48;
  border-color: #efa0a8;
}

.plan-cell.unset {
  background: #eef1ec;
  color: #667064;
  border-color: #cbd4c8;
}

.schedule-time-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.schedule-time-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.schedule-time-field select {
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.schedule-time-field.is-disabled {
  opacity: 0.48;
}

.schedule-decision-bar {
  position: sticky;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: var(--shadow);
}

.schedule-decision-bar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.schedule-decision-bar span.is-dirty {
  color: #966015;
}

.schedule-day.is-weekend {
  background: #fffef8;
}

.schedule-day.is-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 111, 99, 0.12);
}

.schedule-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.schedule-summary-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #fffaf0;
}

.schedule-summary-card strong {
  color: var(--accent-strong);
}

.schedule-summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.schedule-table th span {
  color: var(--muted);
  font-size: 11px;
}

.daily-active-total {
  display: grid;
  place-items: center;
  width: 24px;
  height: 22px;
  margin: 6px auto 0;
  border-radius: 6px;
  background: #fff2d8;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.schedule-table {
  min-width: 1520px;
  table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
  min-width: 38px;
  padding: 10px 8px;
  border-right: 1px solid rgba(232, 223, 189, 0.55);
  text-align: center;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 116px;
  min-width: 116px;
  max-width: 116px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.schedule-table thead th:first-child {
  z-index: 3;
  background: #fff7e6;
}

.schedule-table th:nth-last-child(-n + 4),
.schedule-table td:nth-last-child(-n + 4) {
  min-width: 52px;
  background: #fffef8;
  font-weight: 900;
}

.plan-cell {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.plan-time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.entry-form input,
.entry-form select,
.checkin-form input,
.checkin-form select {
  min-height: 40px;
  padding: 0 10px;
}

.entry-form textarea,
.checkin-form textarea {
  resize: vertical;
  padding: 10px;
  line-height: 1.6;
}

.checkin-form .wide {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td {
  line-height: 1.5;
}

.import-box {
  max-width: 920px;
}

.import-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 18px;
}

#csvInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-drop {
  display: grid;
  gap: 6px;
  flex: 1;
  padding: 18px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: var(--surface-soft);
}

.file-drop strong {
  color: var(--accent-strong);
}

.file-drop span {
  color: var(--muted);
}

.mapping-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mapping-list p {
  width: 100%;
  margin: 0 0 2px;
  color: var(--muted);
  font-weight: 800;
}

.mapping-list div {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fffef8;
  border: 1px solid var(--line);
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 14px;
  }

  .nav-list {
    grid-column: 1 / -1;
    grid-template-columns: repeat(10, minmax(92px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    white-space: nowrap;
    text-align: center;
  }

  .role-switch {
    align-self: center;
  }

  .sidebar-footer {
    display: none;
  }

  .metric-grid,
  .content-grid,
  .profile-grid,
  .daily-report-grid,
  .attendance-layout,
  .checkin-layout,
  .daily-status-grid,
  .staff-layout,
  .monthly-actual-grid.is-visible {
    grid-template-columns: 1fr 1fr;
  }
}

.users-table {
  min-width: 980px;
}

.row-action {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 800;
}

.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.matrix-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.monthly-actual-grid,
.monthly-schedule-card {
  display: none;
}

.monthly-actual-grid.is-visible {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.monthly-actual-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #efd7a7;
  border-radius: 8px;
  background: #fffaf0;
}

.monthly-actual-card span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.monthly-actual-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.monthly-actual-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.monthly-schedule-card.is-visible {
  display: block;
  margin-top: 14px;
}

.monthly-schedule-readonly {
  margin-top: 12px;
}

.state-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.state-dot.stable {
  background: #dff5d6;
  border-color: #a5d996;
}

.state-dot.watch {
  background: #fff2d8;
  border-color: #efc47b;
}

.state-dot.danger {
  background: #ffe8eb;
  border-color: #efa0a8;
}

.state-dot.empty {
  background: #fffdf2;
}

.state-dot.unset {
  background: #eef1ec;
  border-color: #cbd4c8;
}

.matrix-wrap {
  overflow: auto;
}

.matrix-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.monthly-table {
  min-width: 1280px;
  table-layout: fixed;
}

.matrix-table th,
.matrix-table td {
  min-width: 34px;
  height: 34px;
  padding: 4px;
  text-align: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.monthly-table th,
.monthly-table td {
  min-width: 38px;
  padding: 9px 8px;
  border-right-color: rgba(232, 223, 189, 0.55);
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 132px;
  background: #ffffff;
  text-align: left;
}

.monthly-table th:first-child,
.monthly-table td:first-child {
  width: 116px;
  min-width: 116px;
  max-width: 116px;
  color: var(--ink);
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff7e6;
  color: var(--muted);
  font-size: 12px;
}

.monthly-table thead th:first-child {
  z-index: 3;
  background: #fff7e6;
}

.matrix-cell {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.matrix-cell.stable {
  background: #dff5d6;
  color: var(--accent-strong);
}

.matrix-cell.watch {
  background: #fff2d8;
  color: #966015;
}

.matrix-cell.danger {
  background: #ffe8eb;
  color: #a93b48;
}

.matrix-cell.empty {
  background: #fffdf2;
  color: #9b9a83;
}

.matrix-cell.unset {
  background: #eef1ec;
  color: #667064;
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

  .topbar,
  .control-strip,
  .mode-banner,
  .daily-report-cta,
  .import-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .primary-button {
    flex: 1;
  }

  .report-action-group {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill {
    margin-left: 0;
    text-align: center;
  }

  .metric-grid,
  .content-grid,
  .profile-grid,
  .daily-report-grid,
  .attendance-layout,
  .checkin-layout,
  .daily-status-grid,
  .schedule-summary-grid,
  .monthly-actual-grid.is-visible,
  .staff-layout,
  .checkin-form,
  .sleep-fields,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .schedule-guidance {
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-planner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-actions,
  .notice-box {
    flex-direction: column;
  }

  .chart-wrap,
  .chart-wrap.small {
    min-height: 240px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}

@media print {
  .sidebar,
  .topbar-actions,
  .control-strip,
  .entry-form,
  #recordsPanel,
  #importPanel {
    display: none !important;
  }

  .app-shell,
  .content-grid,
  .metric-grid {
    display: block;
  }

  .main {
    padding: 0;
  }

  .workspace,
  .metric {
    box-shadow: none;
    break-inside: avoid;
    margin-bottom: 12px;
  }
}
