:root {
  --ink: #17211b;
  --muted: #65736b;
  --paper: #f7f2e9;
  --panel: #fffdf7;
  --line: #ded4c2;
  --green: #1f6f51;
  --green-dark: #164b39;
  --red: #a33d32;
  --shadow: 0 18px 45px rgba(52, 42, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  background:
    radial-gradient(circle at top left, rgba(82, 138, 99, 0.22), transparent 32rem),
    linear-gradient(135deg, #f4ecdd 0%, #faf7f0 48%, #e8efe4 100%);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(31, 111, 81, 0.14);
  background: rgba(255, 253, 247, 0.78);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--green-dark);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.login-name {
  color: var(--muted);
  font-size: 0.9rem;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--green-dark);
  font: inherit;
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
}

.page {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) 0;
}

.auth-card,
.profile-card,
.punch-card,
.month-card {
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.punch-card {
  margin-top: 1.2rem;
}

.month-card {
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.auth-card {
  max-width: 520px;
  margin: 0 auto;
}

.eyebrow {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0.55rem 0 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.15;
}

h2,
h3 {
  margin: 0.45rem 0 0;
  line-height: 1.25;
}

.lead {
  margin: 0.85rem 0 1.8rem;
  color: var(--muted);
  line-height: 1.8;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: -0.8rem 0 1.8rem;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(31, 111, 81, 0.24);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.58);
}

.secondary-link:hover {
  border-color: rgba(31, 111, 81, 0.48);
}

.form-stack {
  display: grid;
  gap: 1rem;
}

label span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 111, 81, 0.14);
  outline: none;
}

.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.3rem;
  color: #fff;
  font: inherit;
  font-weight: 700;
  background: var(--green-dark);
  cursor: pointer;
}

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

.flash-list {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.flash {
  border-radius: 14px;
  padding: 0.8rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
}

.flash-error {
  color: var(--red);
  border-color: rgba(163, 61, 50, 0.35);
}

.flash-success {
  color: var(--green-dark);
  border-color: rgba(31, 111, 81, 0.3);
}

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

.profile-grid div {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.profile-grid dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.profile-grid dd {
  margin: 0.35rem 0 0;
  font-weight: 700;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(31, 111, 81, 0.22);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  color: var(--green-dark);
  font-size: 0.9rem;
  font-weight: 700;
  background: #fff;
}

.state-not_started {
  color: #70572c;
  background: #fff4dc;
}

.state-working {
  color: var(--green-dark);
  background: #e8f3e6;
}

.state-on_break {
  color: #8a5d14;
  background: #fff0c7;
}

.state-finished {
  color: var(--muted);
  background: #eef0f5;
}

.punch-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.punch-actions form {
  margin: 0;
}

.punch-button {
  width: 100%;
  border: 1px solid rgba(22, 75, 57, 0.16);
  border-radius: 18px;
  padding: 1rem 0.75rem;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.punch-button:hover {
  border-color: rgba(31, 111, 81, 0.45);
  box-shadow: 0 10px 24px rgba(31, 111, 81, 0.12);
  transform: translateY(-1px);
}

.punch-clock_in {
  background: #e8f3e6;
}

.punch-clock_out {
  background: #eef0f5;
}

.punch-break_start,
.punch-break_end {
  background: #fff4dc;
}

.notice,
.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.punch-history {
  margin-top: 1.4rem;
}

.timeline {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 5rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.timeline-time {
  font-weight: 700;
}

.timeline-label {
  color: var(--ink);
}

.timeline-source {
  color: var(--muted);
  font-size: 0.82rem;
}

.month-heading {
  align-items: flex-start;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.month-nav a {
  color: var(--green-dark);
  font-weight: 700;
}

.month-nav strong {
  font-size: 1.25rem;
}

.scope-note {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.date-filter {
  margin: 0 0 1rem;
}

.date-filter form {
  display: flex;
  align-items: end;
  gap: 0.75rem;
}

.date-filter label {
  width: min(16rem, 100%);
}

.date-filter select {
  min-height: 3rem;
}

.compact-button {
  padding-inline: 1.2rem;
}

.month-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.month-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.admin-day-table {
  min-width: 900px;
}

.admin-month-table {
  min-width: 980px;
}

.table-link {
  color: var(--green-dark);
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.62);
}

.summary-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-grid dd {
  margin: 0.35rem 0 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.month-table th,
.month-table td {
  border-bottom: 1px solid rgba(222, 212, 194, 0.85);
  padding: 0.7rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.month-table th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(247, 242, 233, 0.8);
}

.month-table tr:last-child td {
  border-bottom: 0;
}

.row-warning td {
  background: rgba(255, 232, 203, 0.55);
}

.row-today td {
  background: rgba(232, 243, 230, 0.52);
}

.row-future td {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.35);
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 700;
  background: #e8f3e6;
}

.status-warning {
  color: #8a4b19;
  background: #ffe8cb;
}

.warning-list {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding-left: 1.1rem;
}

.muted-text {
  color: var(--muted);
  font-size: 0.85rem;
}

.small-note {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.correction-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.correction-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.58);
}

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

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

.correction-history {
  margin-top: 1rem;
}

.correction-history-table {
  min-width: 760px;
}

.inline-punch {
  display: inline-flex;
  margin: 0.1rem 0.25rem 0.1rem 0;
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  color: var(--green-dark);
  font-size: 0.84rem;
  background: #e8f3e6;
}

@media (max-width: 640px) {
  .site-header,
  .logout-form {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .month-heading {
    align-items: stretch;
  }

  .month-nav {
    justify-content: space-between;
  }

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

  .date-filter form {
    align-items: stretch;
    flex-direction: column;
  }

  .correction-layout,
  .correction-form {
    grid-template-columns: 1fr;
  }

  .timeline li {
    grid-template-columns: 4.5rem 1fr;
  }

  .timeline-source {
    grid-column: 2;
  }
}
