:root {
  --paper: #f6f4ee;
  --surface: #ffffff;
  --ink: #1c2430;
  --muted: #5d6978;
  --line: #d9dee5;
  --strong-line: #8d98a8;
  --blue: #2f5d9f;
  --blue-dark: #204879;
  --green: #2d765a;
  --amber: #a86712;
  --red: #b34343;
  --shadow: 0 10px 30px rgba(23, 35, 53, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

body.locked .app-header,
body.locked main {
  display: none;
}

body.entry-editor-open {
  overflow: hidden;
  touch-action: none;
}

body.entry-editor-open .entry-fields {
  touch-action: pan-y;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 44px);
  background: #263244;
  color: #fff;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(38, 50, 68, 0.92), rgba(47, 93, 159, 0.72)),
    var(--paper);
}

.login-view[hidden] {
  display: none;
}

.login-panel {
  width: min(100%, 430px);
  display: grid;
  gap: 14px;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(8, 16, 28, 0.24);
}

.login-panel h1 {
  color: var(--ink);
}

.login-note,
.login-caution {
  margin-bottom: 0;
  color: var(--muted);
}

.login-caution {
  font-size: 12px;
}

.store-badge {
  max-width: 220px;
  overflow: hidden;
  padding: 6px 10px;
  color: #eaf4ff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: #b8d7c6;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  font-weight: 700;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

main {
  width: min(1500px, calc(100% - 32px));
  margin: 20px auto 44px;
}

.header-actions,
.inline-form,
.tabs,
.section-heading,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading {
  justify-content: space-between;
  margin: 24px 0 14px;
}

.compact-heading {
  margin-top: 28px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.control-band {
  display: grid;
  grid-template-columns: 2fr 120px 100px 130px 180px;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.compact-control-band {
  grid-template-columns: minmax(220px, 360px) 1fr;
  align-items: end;
}

.advanced-controls {
  align-self: end;
}

.advanced-controls summary {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  color: var(--blue-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.advanced-controls[open] summary {
  margin-bottom: 12px;
}

.advanced-control-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) 120px 100px;
  gap: 12px;
}

.print-tools {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.print-month-nav {
  display: grid;
  grid-template-columns: auto minmax(110px, auto) auto;
  align-items: center;
  gap: 8px;
}

.print-month-label {
  min-width: 110px;
  color: var(--ink);
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.inline-select {
  min-width: 150px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(47, 93, 159, 0.22);
  outline-offset: 1px;
}

.primary-button,
.ghost-button,
.tab,
.small-button {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  color: #fff;
  background: var(--blue);
}

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

.ghost-button,
.small-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.small-button {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 13px;
}

.small-button.primary-action {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.danger {
  color: var(--red);
}

.tabs {
  margin-top: 16px;
  border-bottom: 1px solid var(--line);
}

.tab {
  color: var(--muted);
  background: transparent;
  border-radius: 0;
  border-bottom: 3px solid transparent;
}

.tab.active {
  color: var(--blue-dark);
  border-bottom-color: var(--blue);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.entry-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: visible;
  background: var(--line);
  border: 1px solid var(--line);
}

.mobile-entry-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.entry-month-nav {
  display: inline-grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.entry-month-label {
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  color: var(--blue-dark);
  background: #eef3f9;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.entry-summary-stats {
  display: grid;
  gap: 4px;
}

.entry-stat-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.entry-stat-items span,
.entry-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  background: #eef3f0;
  border-radius: 999px;
  font-weight: 700;
}

.entry-filter-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #eef1f4;
  border-radius: 8px;
}

.entry-filter {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
}

.entry-filter.active {
  color: #fff;
  background: var(--blue);
}

.entry-calendar-day {
  background: var(--surface);
  min-width: 0;
  position: relative;
}

.entry-calendar-day.open {
  z-index: 12;
  box-shadow: inset 0 0 0 2px rgba(47, 93, 159, 0.22);
}

.entry-calendar-day.open .entry-calendar-button {
  min-height: auto;
}

.entry-calendar-button {
  display: grid;
  align-content: start;
  gap: 5px;
  width: 100%;
  min-height: 122px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.entry-calendar-date {
  color: #41536d;
  font-size: 18px;
  font-weight: 700;
}

.entry-calendar-head {
  padding: 8px;
  color: var(--muted);
  text-align: center;
  background: #eef1f4;
  font-size: 13px;
  font-weight: 700;
}

.entry-calendar-head.sunday {
  color: var(--red);
}

.entry-calendar-head.saturday {
  color: var(--blue-dark);
}

.entry-calendar-blank {
  min-height: 122px;
  background: #f4f5f7;
}

.entry-calendar-holiday {
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.current-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.entry-badge {
  justify-self: start;
  padding: 3px 8px;
  color: #fff;
  background: var(--amber);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.entry-calendar-day.status-off {
  background: #fff8f8;
}

.entry-calendar-day.status-off .entry-status-pill {
  color: #fff;
  background: var(--red);
}

.entry-calendar-day.status-work .entry-status-pill {
  color: #fff;
  background: var(--amber);
}

.entry-calendar-day.status-split .entry-status-pill {
  color: #fff;
  background: var(--blue);
}

.entry-calendar-day.filtered-out {
  opacity: 0.34;
}

.entry-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  padding: 0 0 4px;
  background: #fff;
}

.entry-backdrop {
  display: none;
}

.entry-fields {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  width: min(860px, calc(100vw - 36px));
  max-height: min(82vh, 680px);
  overflow-y: auto;
  padding: 18px 20px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  touch-action: pan-y;
}

.entry-editor-header {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.entry-editor-date {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.entry-editor-holiday {
  display: block;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.entry-editor-status {
  flex: 0 0 auto;
  padding: 4px 10px;
  color: #fff;
  background: var(--blue);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.entry-calendar-day.status-off .entry-editor-status {
  background: var(--red);
}

.entry-calendar-day.status-work .entry-editor-status {
  background: var(--amber);
}

.entry-calendar-day.status-split .entry-editor-status {
  background: var(--blue);
}

.entry-calendar-day.open .entry-fields {
  display: grid;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 31;
  transform: translate(-50%, -50%);
}

.entry-calendar-day.open .entry-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 0;
  background: rgba(28, 36, 48, 0.12);
  border: 0;
  border-radius: 0;
  cursor: default;
  touch-action: none;
}

.time-control {
  gap: 7px;
}

.time-control[data-time-field="start"] {
  grid-column: 1;
}

.time-control[data-time-field="end"] {
  grid-column: 2;
}

.time-control[data-time-field="start2"] {
  display: none;
  grid-column: 1;
}

.time-control[data-time-field="end2"] {
  display: none;
  grid-column: 2;
}

.entry-calendar-day.status-split .time-control[data-time-field="start2"],
.entry-calendar-day.status-split .time-control[data-time-field="end2"] {
  display: grid;
}

.break-control {
  grid-column: 3;
  gap: 7px;
}

.entry-fields > label:not(.time-control):not(.break-control) {
  grid-column: 4;
}

.break-manual-input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.break-manual-label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.time-wheel-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.time-wheel-controls select {
  min-height: 56px;
  padding: 8px 10px;
  color: var(--blue-dark);
  text-align: center;
  background: #edf5ff;
  border: 1px solid #cbd8e8;
  border-radius: 6px;
  font-size: 17px;
  font-weight: 700;
}

.time-control {
  color: var(--blue-dark);
}

.time-control .time-wheel-controls select {
  color: var(--blue-dark);
  background: #edf5ff;
  border-color: #b9cde7;
}

.break-control {
  color: var(--green);
}

.break-control .time-wheel-controls select,
.break-manual-input {
  color: var(--green);
  background: #eef8f3;
  border-color: #b9dccd;
}

.time-wheel-controls select:focus {
  outline: 3px solid rgba(47, 93, 159, 0.22);
  outline-offset: 1px;
}

.break-control .time-wheel-controls select:focus,
.break-manual-input:focus {
  outline: 3px solid rgba(45, 118, 90, 0.22);
  outline-offset: 1px;
}

.empty-message {
  padding: 18px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
}

.settings-grid {
  display: grid;
  gap: 14px;
}

.daily-note-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
}

.calendar-month-nav {
  display: grid;
  grid-template-columns: auto minmax(110px, auto) auto;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 6px 0 12px;
}

.calendar-month-label {
  min-width: 120px;
  color: var(--ink);
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

.daily-note-card {
  background: var(--surface);
  border: 0;
}

.daily-note-card.has-note {
  border-color: rgba(47, 93, 159, 0.42);
  box-shadow: inset 0 0 0 2px rgba(47, 93, 159, 0.18);
}

.daily-note-card.holiday-card {
  background: #fff8f8;
}

.daily-note-button {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 4px;
  width: 100%;
  min-height: 108px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
}

.daily-calendar-head {
  padding: 8px;
  color: var(--muted);
  text-align: center;
  background: #eef1f4;
  font-size: 13px;
  font-weight: 700;
}

.daily-calendar-head.sunday {
  color: var(--red);
}

.daily-calendar-head.saturday {
  color: var(--blue-dark);
}

.daily-note-blank {
  min-height: 108px;
  background: #f4f5f7;
}

.daily-note-date {
  color: #41536d;
  font-size: 18px;
  font-weight: 700;
}

.daily-note-holiday {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.daily-note-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-weight: 700;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.daily-note-card.has-note .daily-note-preview {
  color: var(--ink);
}

.daily-note-editor {
  display: none;
  padding: 0 12px 12px;
}

.daily-note-card.open .daily-note-editor {
  display: grid;
}

.daily-note-editor textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.staff-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.staff-panel[open] {
  border-color: rgba(47, 93, 159, 0.36);
}

.staff-panel-summary {
  display: grid;
  grid-template-columns: 24px 1fr 1.4fr;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  list-style: none;
  cursor: pointer;
}

.staff-panel-summary::-webkit-details-marker {
  display: none;
}

.staff-panel-summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
  font-weight: 700;
}

.staff-panel[open] .staff-panel-summary::before {
  content: "-";
  background: var(--green);
}

.staff-panel-name {
  font-size: 16px;
  font-weight: 700;
}

.staff-panel-preview {
  color: var(--muted);
  font-size: 13px;
}

.staff-panel-body {
  border-top: 1px solid var(--line);
}

.staff-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.default-table-wrap,
.schedule-wrap {
  overflow-x: auto;
  flex: 1;
  min-height: 0;
}

.default-table,
.shift-table {
  width: 100%;
  border-collapse: collapse;
}

.default-table th,
.default-table td {
  padding: 8px;
  border: 1px solid var(--line);
  text-align: left;
}

.default-table th {
  background: #eef3f0;
}

.default-table input,
.default-table select {
  min-width: 80px;
}

.print-area {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sheet {
  --print-font-scale: 1.15;
  min-width: 1180px;
  padding: 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.sheet.font-normal {
  --print-font-scale: 1;
}

.sheet.font-large {
  --print-font-scale: 1.15;
}

.sheet.font-xlarge {
  --print-font-scale: 1.28;
}

.sheet.landscape {
  width: 1180px;
  height: 835px;
  aspect-ratio: 297 / 210;
}

.sheet.portrait {
  width: 820px;
  min-width: 820px;
  height: 1160px;
  aspect-ratio: 210 / 297;
}

.sheet-title {
  margin-bottom: 12px;
  text-align: center;
  font-size: calc(22px * var(--print-font-scale));
  font-weight: 700;
}

.sheet.landscape .sheet-title {
  font-size: calc(17px * var(--print-font-scale));
  margin-bottom: 7px;
}

.shift-table {
  table-layout: fixed;
  font-size: calc(12px * var(--print-font-scale));
  height: 100%;
  line-height: 1.12;
}

.shift-table th,
.shift-table td {
  padding: 3px 4px;
  border: 1px solid #3d4652;
  text-align: center;
  vertical-align: middle;
}

.shift-table thead th {
  background: #eef1f4;
  font-weight: 700;
}

.shift-table .date-col {
  width: 58px;
}

.shift-table .weekday-col {
  width: 36px;
}

.shift-table .time-col {
  width: 43px;
}

.shift-table .note-col {
  width: 220px;
  text-align: left;
}

.sheet.landscape .shift-table {
  font-size: calc(9px * var(--print-font-scale));
}

.sheet.landscape .shift-table th,
.sheet.landscape .shift-table td {
  padding: 1px 2px;
}

.sheet.portrait .shift-table {
  font-size: calc(8px * var(--print-font-scale));
}

.sheet.portrait .shift-table th,
.sheet.portrait .shift-table td {
  padding: 1px 2px;
}

.sheet.portrait .shift-table .date-col {
  width: 42px;
}

.sheet.portrait .shift-table .weekday-col {
  width: 24px;
}

.sheet.portrait .shift-table .time-col {
  width: 28px;
}

.sheet.portrait .shift-table .note-col {
  width: 110px;
}

.sheet.portrait .sheet-title {
  font-size: calc(16px * var(--print-font-scale));
  margin-bottom: 7px;
}

.editable-cell {
  cursor: text;
}

.editable-cell:focus {
  outline: 2px solid rgba(47, 93, 159, 0.32);
  outline-offset: -2px;
  background: #fffdf2;
}

.shift-table .subhead {
  background: #f7f8fa;
  font-size: calc(11px * var(--print-font-scale));
}

.shift-table .weekend {
  background: #f2f4f7;
}

.shift-table .holiday-row {
  background: #fff0f0;
}

.holiday-text,
.holiday-inline,
.holiday-name {
  color: var(--red);
  font-weight: 700;
}

.holiday-inline {
  display: block;
  margin-top: 2px;
  font-size: calc(11px * var(--print-font-scale));
}

.holiday-name {
  display: block;
  margin-top: 1px;
  font-size: calc(9px * var(--print-font-scale));
  line-height: 1.15;
}

.date-cell {
  font-weight: 700;
}

.shift-table .off {
  color: var(--red);
  font-weight: 700;
}

.zero-break {
  color: var(--red);
  font-weight: 700;
}

.shift-table .changed {
  background: #fff5df;
}

.shift-table .total-row th,
.shift-table .total-row td {
  background: #eef3f0;
  font-weight: 700;
}

.badge {
  display: inline-block;
  padding: 1px 5px;
  color: #fff;
  background: var(--green);
  border-radius: 4px;
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  padding: 10px 14px;
  color: #fff;
  background: #263244;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.entry-confirm {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 36, 48, 0.28);
}

.entry-confirm-box {
  width: min(320px, 100%);
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.entry-confirm-box p {
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.entry-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 980px) {
  .app-header,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .control-band {
    grid-template-columns: 1fr 1fr;
  }

  .compact-control-band,
  .advanced-control-grid {
    grid-template-columns: 1fr;
  }

  .advanced-controls summary {
    width: 100%;
    justify-content: center;
  }

  .mobile-entry-panel {
    grid-template-columns: 1fr;
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .entry-month-nav {
    grid-template-columns: 1fr 1.4fr 1fr;
  }

  .entry-filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .entry-list {
    overflow-x: auto;
    overflow-y: visible;
    grid-template-columns: repeat(7, minmax(118px, 1fr));
    -webkit-overflow-scrolling: touch;
  }

  .entry-calendar-day.open {
    min-width: 0;
  }

  .entry-fields {
    grid-template-columns: 1fr 1fr;
  }

  .time-control {
    grid-column: span 1;
  }

  .time-control[data-time-field="start"] {
    grid-column: 1;
  }

  .time-control[data-time-field="end"] {
    grid-column: 2;
  }

  .break-control {
    grid-column: span 1;
  }

  .entry-quick-actions .small-button {
    flex: 1 1 30%;
    min-height: 42px;
  }

  .daily-note-list {
    overflow-x: auto;
    grid-template-columns: repeat(7, minmax(104px, 1fr));
    -webkit-overflow-scrolling: touch;
  }

  .calendar-month-nav {
    width: 100%;
    grid-template-columns: 1fr auto 1fr;
    justify-content: stretch;
  }

  .print-tools,
  .print-month-nav {
    width: 100%;
  }

  .print-month-nav {
    grid-template-columns: 1fr auto 1fr;
  }

  .print-month-nav [data-print-month="prev"] {
    justify-self: start;
  }

  .print-month-nav [data-print-month="next"] {
    justify-self: end;
  }

  .calendar-month-nav [data-calendar-month="prev"] {
    justify-self: start;
  }

  .calendar-month-nav [data-calendar-month="next"] {
    justify-self: end;
  }

  .staff-panel-summary {
    grid-template-columns: 24px 1fr;
  }

  .staff-panel-preview {
    grid-column: 2;
  }

}

@media (max-width: 620px) {
  main {
    width: min(100% - 20px, 1500px);
  }

  .control-band,
  .entry-fields {
    grid-template-columns: 1fr;
  }

  .entry-calendar-day.open .entry-fields {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    top: auto;
    width: auto;
    max-height: min(72vh, 620px);
    overflow-y: auto;
    z-index: 31;
    padding: 14px;
    border-radius: 10px;
    touch-action: pan-y;
    transform: none;
  }

  .entry-list > .entry-calendar-day.open .entry-fields {
    right: 10px;
    left: 10px;
    width: auto;
  }

  .entry-calendar-day.open .entry-fields {
    grid-template-columns: 1fr;
  }

  .entry-quick-actions {
    position: sticky;
    top: 42px;
    z-index: 1;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }

  .entry-editor-header {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -14px -14px 0;
    padding: 12px 14px;
    background: #fff;
  }

  .entry-quick-actions .small-button {
    flex: 1 1 100%;
  }

  .time-control {
    grid-column: auto;
  }

  .time-control[data-time-field="start"],
  .time-control[data-time-field="end"],
  .break-control {
    grid-column: auto;
  }

  .time-wheel-controls select {
    min-height: 62px;
  }

  .header-actions,
  .inline-form,
  .tabs {
    flex-wrap: wrap;
  }

  .daily-note-list {
    grid-template-columns: repeat(7, 104px);
  }

  .entry-list {
    grid-template-columns: repeat(7, 118px);
  }

  .entry-calendar-day.open {
    min-width: 0;
  }

  .daily-note-button {
    min-height: 82px;
  }

  #print-view {
    width: 100vw;
    margin-left: calc(50% - 50vw);
  }

  #print-view .section-heading {
    width: calc(100% - 20px);
    margin-right: auto;
    margin-left: auto;
  }

  .print-area {
    width: 100vw;
    border-right: 0;
    border-left: 0;
  }

  .print-area::after {
    content: "横にスクロールできます";
    position: sticky;
    left: 12px;
    bottom: 8px;
    display: inline-block;
    margin: 8px 12px;
    padding: 5px 8px;
    color: #fff;
    background: rgba(38, 50, 68, 0.86);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
  }

  .print-area .sheet {
    flex: 0 0 auto;
  }
}

@media print {
  html,
  body {
    width: 100%;
    margin: 0;
    background: #fff;
  }

  .app-header,
  .control-band,
  .tabs,
  .no-print,
  #entry-view,
  #settings-view,
  .toast {
    display: none !important;
  }

  main {
    width: 100%;
    margin: 0;
  }

  #print-view,
  #print-view.view {
    display: block !important;
  }

  .print-area {
    overflow: visible;
    border: 0;
    box-shadow: none;
  }

  .sheet {
    min-width: 0;
    padding: 0;
    aspect-ratio: auto;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .sheet.landscape {
    width: 281mm;
    height: 194mm;
  }

  .sheet.portrait {
    width: 194mm;
    height: 281mm;
  }

  .shift-table {
    font-size: calc(8px * var(--print-font-scale));
    width: 100%;
    height: 100%;
  }

  .shift-table .date-col {
    width: 5%;
  }

  .shift-table .weekday-col {
    width: 3%;
  }

  .shift-table .time-col {
    width: 3.8%;
  }

  .shift-table .note-col {
    width: 16%;
  }

  .shift-table th,
  .shift-table td {
    padding: 1px 2px;
    overflow: hidden;
  }

  .sheet.portrait .shift-table {
    font-size: calc(5.8px * var(--print-font-scale));
  }

  .sheet.portrait .shift-table .date-col {
    width: 5.5%;
  }

  .sheet.portrait .shift-table .weekday-col {
    width: 3.5%;
  }

  .sheet.portrait .shift-table .time-col {
    width: 3.65%;
  }

  .sheet.portrait .shift-table .note-col {
    width: 18%;
  }

  .sheet.portrait .shift-table th,
  .sheet.portrait .shift-table td {
    padding: 1px;
  }

  .sheet-title {
    margin-bottom: 5px;
    font-size: calc(15px * var(--print-font-scale));
  }
}
