:root {
  --washi: #f4efe5;
  --washi-warm: #ece5d6;
  --washi-deep: #e0d8c6;
  --sumi: #1a1815;
  --sumi-soft: #3a342d;
  --haiiro: #6b6357;
  --kinari: #c9bfae;
  --bengara: #8b3a28;
  --kincha: #b89968;
  --shu: #c8342a; /* vermilion — hanko ink-stamp red */
  --ai: #0433ff; /* royal blue, 5pm session highlight */
  --font-display: "Cormorant Garamond", "Shippori Mincho", serif;
  --font-body: "EB Garamond", "Shippori Mincho", serif;
  --font-meta: "Public Sans", -apple-system, sans-serif;
  --rule: 1px solid rgba(26, 24, 21, 0.18);
  --rule-soft: 1px solid rgba(26, 24, 21, 0.1);
}
*, *::before, *::after { box-sizing: border-box; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  position: relative;
  margin: 0;
  padding: 0.75rem 0;
  background: var(--washi);
  color: var(--sumi);
  font-family: var(--font-body);
}
/* Faint paper grain — washi means "paper"; give the color a texture to match. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}
body > * {
  position: relative;
  z-index: 1;
}

.calendar__nav {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 0 0.75rem 0.75rem;
  margin-bottom: 0.6rem;
  border-bottom: var(--rule-soft);
}
.calendar__nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding-bottom: 0.375rem;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1;
  color: var(--bengara);
  text-decoration: none;
  border: 2px solid rgba(139, 58, 40, 0.6);
  border-radius: 50%;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.calendar__nav-arrow:hover,
.calendar__nav-arrow:active {
  background: var(--bengara);
  color: var(--washi);
  border-color: var(--bengara);
}
.calendar__nav h1 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.82rem;
  margin: 0;
  min-width: 9rem;
  text-align: center;
  color: var(--sumi);
}

.calendar__menu {
  position: absolute;
  left: 0.5rem;
  top: calc(50% - 0.375rem); /* nav has bottom padding only; offset by half of it so 50% centers on the arrow/title row, not the padded box */
  transform: translateY(-50%);
}
.calendar__menu summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  width: 28px;
  height: 20px;
  margin: 0.4rem 0.5rem;
  /* Middle bar of the hamburger; ::before/::after draw the top and
     bottom bars since a pseudo-element budget of two can't fit three. */
  background: linear-gradient(var(--sumi), var(--sumi)) no-repeat center / 100% 2px;
  transition: background 0.2s;
}
.calendar__menu summary::-webkit-details-marker {
  display: none;
}
.calendar__menu summary::marker {
  content: '';
}
.calendar__menu summary::before,
.calendar__menu summary::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--sumi);
  transition: background 0.2s;
}
.calendar__menu summary::before {
  top: 2px;
}
.calendar__menu summary::after {
  bottom: 2px;
}
.calendar__menu[open] summary {
  background: linear-gradient(var(--bengara), var(--bengara)) no-repeat center / 100% 2px;
}
.calendar__menu[open] summary::before,
.calendar__menu[open] summary::after {
  background: var(--bengara);
}
.calendar__menu-items {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: 15rem;
  background: var(--washi);
  border: 1px solid var(--kinari);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(26, 24, 21, 0.15);
  overflow: hidden;
  z-index: 10;
}
.calendar__menu-items a {
  font-family: var(--font-meta);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sumi-soft);
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: var(--rule-soft);
}
.calendar__menu-items a:last-child {
  border-bottom: none;
}
.calendar__menu-items a:hover {
  background: var(--washi-warm);
  color: var(--bengara);
}

/* Dense, line-based grid — no per-cell cards/padding-heavy boxes, so more
   of the month fits on one screen (matches a phone calendar app's month view).
   Header and calendar share the same washi surface; the rule under
   .calendar__nav is what separates them, not a color/depth shift. */
table.calendar {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--washi);
}
.calendar thead th {
  font-family: "Shippori Mincho", var(--font-meta);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--haiiro);
  text-align: center;
  white-space: nowrap;
  padding: 0.4rem 0.3rem;
  background: var(--washi);
  border-bottom: var(--rule);
}
.calendar thead th:not(:last-child) {
  border-right: var(--rule-soft);
}
.day {
  position: relative;
  vertical-align: top;
  height: 7.5rem;
  padding: 0.6rem 0.5rem;
  border-bottom: var(--rule-soft);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.81rem;
  line-height: 1.3;
}
.day:not(:last-child) {
  border-right: var(--rule-soft);
}
.day--blank {
  cursor: default;
  background: var(--washi-warm);
}
.day__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.17rem;
  color: var(--sumi-soft);
  text-align: center;
  margin-bottom: 0.5rem;
}
.day__line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--haiiro);
  margin-bottom: 0.35rem;
}
/* Private 5pm session bar — same mottled-fill treatment as .day__notes
   (ink-stamp texture) but royal blue, and static rather than pulsing: this
   marks a filled slot rather than drawing attention to a new one. Lets
   staff scan a month at a glance and count private sessions for the
   sweets order. */
.day__line--five-pm.day__line--highlight {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--washi);
  background:
    radial-gradient(circle at 28% 25%, rgba(255, 255, 255, 0.22), transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(0, 0, 0, 0.12), transparent 60%),
    var(--ai);
  border-radius: 3px;
  padding: 0.12rem 0.42rem;
}
/* Notes indicator, styled after a hanko ink-stamp rather than an app
   notification badge — mottled vermilion fill, soft glow-pulse ("ink
   breathing") instead of a blinking dot. Text stays unrotated and legible;
   the stamp read comes from color/texture, not literal tilt. */
.day__notes {
  margin-top: 0.4rem;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--washi);
  background:
    radial-gradient(circle at 28% 25%, rgba(255, 255, 255, 0.22), transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(0, 0, 0, 0.12), transparent 60%),
    var(--shu);
  border-radius: 3px;
  padding: 0 0.42rem;
  animation: hanko-pulse 2.4s ease-in-out infinite;
}
@keyframes hanko-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 52, 42, 0.35); }
  50%      { box-shadow: 0 0 7px 1px rgba(200, 52, 42, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .day__notes { animation: none; }
}

.day-dialog {
  border: none;
  border-radius: 4px;
  padding: 1.4rem;
  width: 90%;
  max-width: 360px;
  max-height: min(85vh, 640px);
  overflow: hidden;
  background: var(--washi);
  color: var(--sumi);
  font-family: var(--font-body);
}
.day-dialog[open] {
  display: flex;
  flex-direction: column;
}
.day-dialog:focus {
  outline: none; /* focused programmatically to steer focus away from the first field on touch devices, not a keyboard-nav target */
}
.day-dialog::backdrop {
  background: rgba(26, 24, 21, 0.5);
}
.day-dialog form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.day-dialog__body {
  overflow-y: auto;
  min-height: 0;
}
.day-dialog h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.56rem;
  margin: 0 0 1rem;
}
.day-dialog label {
  display: block;
  font-family: var(--font-meta);
  font-size: 0.91rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
  color: var(--haiiro);
}
.day-dialog input,
.day-dialog textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.7rem;
  font-size: 1.3rem;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
  color: var(--sumi);
  background: #fff;
  border: 1px solid var(--kinari);
  border-radius: 3px;
}
.day-dialog textarea {
  min-height: 4rem;
  resize: vertical;
}
.day-dialog input[readonly],
.day-dialog textarea[readonly] {
  background: var(--washi-warm);
  color: var(--haiiro);
  cursor: default;
}
.day-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-shrink: 0;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}
.day-dialog__actions button {
  font-family: var(--font-meta);
  font-size: 0.94rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  border-radius: 3px;
  border: 1px solid var(--kinari);
  background: transparent;
  color: var(--sumi-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.day-dialog__actions button[type="submit"] {
  color: var(--bengara);
  border-color: rgba(139, 58, 40, 0.35);
}
.day-dialog__actions button[type="submit"]:hover {
  background: var(--bengara);
  color: var(--washi);
  border-color: var(--bengara);
}

.change-password {
  max-width: 360px;
  margin: 0 auto;
  padding: 0 0.75rem 2rem;
}
.change-password fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.4rem;
}
.change-password legend {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.56rem;
  color: var(--sumi);
  padding: 0 0 0.5rem;
}
.change-password label {
  display: block;
  font-family: var(--font-meta);
  font-size: 0.91rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
  color: var(--haiiro);
}
.change-password input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.7rem;
  font-size: 1.3rem;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
  color: var(--sumi);
  background: #fff;
  border: 1px solid var(--kinari);
  border-radius: 3px;
}
.change-password__hint {
  font-family: var(--font-meta);
  font-size: 0.72rem;
  color: var(--haiiro);
  margin-bottom: 1rem;
}
.change-password__rules {
  font-family: var(--font-meta);
  font-size: 0.7rem;
  color: var(--haiiro);
  margin-top: -0.5rem;
}
.change-password__success {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  color: #2f6b3a;
  margin-bottom: 1rem;
}
.change-password__error {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  color: #a3392a;
  margin-bottom: 0.5rem;
}
.change-password button {
  width: 100%;
  font-family: var(--font-meta);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  border-radius: 3px;
  border: none;
  background: var(--bengara);
  color: var(--washi);
  cursor: pointer;
}

body.gate-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gate {
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.gate h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 2.25rem;
  margin: 0 0 0.25rem;
  color: var(--sumi);
}
.gate__jp {
  font-family: var(--font-display);
  margin: 0 0 0.375rem;
  color: var(--sumi);
  font-size: 1.0625rem;
  font-weight: 500;
}
.gate__en {
  font-family: var(--font-body);
  margin: 0 0 1.5rem;
  color: var(--haiiro);
  font-size: 0.9rem;
}
.gate__error {
  font-family: var(--font-body);
  margin: -0.75rem 0 1rem;
  color: #a3392a;
  font-size: 1.0625rem;
}
.gate input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1.0625rem;
  font-family: var(--font-body);
  color: var(--sumi);
  border: 1px solid var(--kinari);
  border-radius: 3px;
  margin-bottom: 0.75rem;
  background: #fff;
}
.gate button {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-family: var(--font-meta);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--washi);
  background: var(--bengara);
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

@media print {
  .calendar__nav-arrow,
  .calendar__menu { display: none; }
  .day { cursor: default; }
}
